#help-development

1 messages ยท Page 2153 of 1

ivory sleet
#

but it will sure block the thread its running on

#

yeah, altho I recommend using a thread pool

humble tulip
ivory sleet
#

java's thread object pool implementation patterm

#

saves you a ton of work

crimson terrace
#

you mean the ExecutorService?

sterile token
#

Yeah its better to use java Executor

ivory sleet
#

myes

humble tulip
ivory sleet
#

yup

sterile token
humble tulip
#

Oh ok

sterile cobalt
#

idk if this is acceptable here, if it isnt please tell me but i would like a combat plugin

#

saying info abt combat

sterile token
#

Conclure running Bukkit#taskTimer() do they block the thread?

midnight shore
#

how do i cancel a task from within it?

sterile token
humble tulip
#

Get the bukkittask

crimson terrace
humble tulip
#

And call task.cancel from wothin

wet breach
sterile token
# ivory sleet pretty much

Hum, so why many plugins uses spigot tasks to save the data async, when they still block the thread. Its strange

midnight shore
#

like this?

humble tulip
sterile cobalt
#

a plugin like this that already exist

sterile token
midnight shore
crimson terrace
ivory sleet
#

spigot is miles away from best practices

humble tulip
#

It's kinda stupid that everyone says to use async runnables for every read/write operation on the forums

sterile cobalt
manic furnace
#

How can I hide the item lore of an item via packets?

sterile cobalt
#

i always find anti combat log etc etc

eternal night
#

I mean, you use completable futures for read and writes

#

not spigot scheduler

crimson terrace
#

probably better to move this to the #help-server channel @sterile cobalt

humble tulip
crimson terrace
#

or #general

ivory sleet
#

yeah just make sure you're not passing the server thread executor to your future

humble tulip
#

Server thread go brrr

sterile cobalt
wet breach
crimson terrace
#

np

humble tulip
#

Learned a lot today thx guys

eternal night
#

huh ?

#

hows that

wet breach
#

because it is an asynchronous computation

#

which means that it won't necessarily use another thread unless you specifically tell it to

#

I would still recommend using futures using thread pool since it has a nice api

misty current
#

as shown in the clip

ivory sleet
#

I mean by default it uses fjp common pool if and only if parallelism if over one, else a thread factory executor

misty current
#

did anyone else ever notice this kind of issue

#

or is it me being stupid

#
    @EventHandler
    public void onBackpackInventoryClick(InventoryClickEvent event) {
        Bukkit.broadcastMessage("click event");
        if(!(event.getWhoClicked() instanceof Player player)) return;
        if(!openBackpack.containsKey(player)) return;

        Bukkit.broadcastMessage(String.valueOf(event.getAction()));

        //more code
    }
#

this is what i used to debug in the chat

chrome beacon
#

DragEvent

misty current
#

so that doesnt' count as a click

humble tulip
#

Really stupid

#

Nope

misty current
#

interesting, thanks

red sedge
#

it'd be weird if those were the same event

humble tulip
#

The start of the drag should still count as a click tho

red sedge
#

oh yeah

#

it does tho doesnt i

humble tulip
#

So u can cancel ot which would cancel the drag

humble tulip
misty current
#

at first it was so weird because i thought it was because double clicking didnt call the event for some reason

#

but then i noticed it was about drags

misty current
red sedge
#

now thats weird

#

No wait its not

#

its because minecraft only sends the packet once you release the button

#

^^

misty current
#

makes sense

#

how did I never notice it i wonder

red sedge
#

Cuz usually when you're dealing with inventoryevents you deal with the first pickup

golden kelp
#

how can I make a light thing (not sure what to use for it) follow a player + i also want to change the intensity

eternal oxide
#

Using the Levelled Interface you can set the light level at a Block

hybrid spoke
golden kelp
#

i k i should use lightAPI

eternal oxide
#

remember the last location and reset it each time you move the light

golden kelp
#

wont that be performance heavy?

#

i thought bout that

hybrid spoke
#

what are you about to do? a 2000x2000 light field?

golden kelp
#

not really. my idea is to make a light around the player with editable intensity. kinda like a spotlight

eternal oxide
#

All light calculations are fairly heavy operations.

golden kelp
#

yea thats why

hybrid spoke
#

but a little spotlight will not even scrape the performance

eternal oxide
#

so all you need is the players eye location

golden kelp
#

o ty

latent pelican
#

Hi, i have created a command that is creating a random maze that is being stored in an mcfunction. Whats the code in Intellij in order to access and use that file??

golden kelp
#

why eye location?

eternal oxide
#

thats his head

golden kelp
#

i am trying to make the player look like the insect that glows

#

Ohh

#

i understand

hybrid spoke
#

so get the butt location

latent pelican
golden kelp
hybrid spoke
#

ohh and place there an armorstand with glowstone as head

eternal oxide
#

set teh light level, store that in a variable so you can remove it when you set teh next location

golden kelp
#

oo and glowstones have eeditable intensity

eternal oxide
#

Thats fine, you only need one location per player for a single light

chrome beacon
golden kelp
#

and then how do i store the intesnity

hybrid spoke
#

you could also make use of OOP

golden kelp
#

yea

#

i m doing that

#

i should make an object which contains a Player, Location, Intensity

#

and then use an array of it ig

hybrid spoke
#

if you have many spotlights a map would be better

golden kelp
#

yea i do

worldly ingot
tardy delta
#

what are artifacts doing in intellij? are they just the same as what the mvn build command does?

humble tulip
#

Ye

#

You can setup how you wanna build it and what u wanna shade

tardy delta
#

so build artifact and execute maven goal (build) is the same

humble tulip
#

Well I'm not sure if it can do evrrything maven can

#

But it can build your jarfile

humble tulip
kindred valley
#

?paste

undone axleBOT
tardy delta
#

im just trying to setup the local debug thing

ivory sleet
#

hope you use dcevm for it

tardy delta
#

dunno what that is

ivory sleet
#

special jvm implementation

#

makes hot swapping endlessly more powerful

tardy delta
#

uhh

humble tulip
#

Such as maven build

tardy delta
#

but mvn build will probably output it to the default directory, i want it to build it to ~/mcserver/plugins

fading lake
humble tulip
#

Can't you change tje directory?

tardy delta
#

dunno is the mvn build command takes flags

humble tulip
tardy delta
#

mvn compile is not outputting the jar or is it?

humble tulip
#

Not sure ๐Ÿ‘€

#

Tbh just use the artifacts in intellij

#

It's what i do when I'm debugging

tardy delta
#

mye

#

im starting to talk like conclure lol

ivory sleet
#

mye

eternal needle
#

Hi i have a code line that have a white line over the text

tardy delta
#

what

river oracle
#

That's cool

#

I'm glad for you tbh

#

Does it look cool?

eternal needle
#

nope

#

i know it means somthing

golden kelp
#

so guys, i m running 1.18 on a server and the build limit should be 319 but its still 256, any clues?

elfin rover
#

someone stole my plugin and reuploaded it on bukkit.org, I reported it but nothing has happened yet. is there anything else I should do?

eternal needle
golden kelp
#

I want to increase it

#

i want 319

eternal needle
golden kelp
#

Aight, thank you

prisma osprey
#

Is there a way to tell if a plugin is compatible with a specific minecraft version just from its code used ?

eternal oxide
#

look at its API version in the plugin.yml

#

tells you how far back you can go

#

But mostly, look at its Spigot page

river oracle
#

I'm surprised your ide doesn't tell you

golden kelp
#

hey guys, what should I do to make a player glow.
My plan is to spawn an invisible armor stand but I dont know what to give it.

#

Should I give it a glowstone?

#

Or put it in his head if thats a thing

river oracle
#

Isn't there a glow effect

#

Lol

golden kelp
#

uh i m looking for something more intense

#

like i m tryna make a spotlight effect

#

can i make its helmet a glowstone?

crimson terrace
#

What version are you programming for?

golden kelp
#

1.15.2

crimson terrace
#

that doesn't have the light blocks in it, does it

golden kelp
#

nope ;(

#

thats why i m using glowstone

crimson terrace
#

sadge

golden kelp
#

can u put a block on a armor stand

#

which also makes it light-y around the armor stand?

crimson terrace
#

you should be able to put a block as a hat

golden kelp
#

o

crimson terrace
#

not sure about the light part tho

golden kelp
#

using #getEquipment()#setHelmet()?

crimson terrace
#

never done it, but I was able to put boots on my head when I had my array the wrong way around so I guess it should work

golden kelp
#

hmm but here comes the bad part

#

i also want to change the intensity

crimson terrace
#

well crap

#

packets?

#

I think nms or packets in general are the only solution there

golden kelp
#

no i think glowstone implements the Light interface

#

and it has a setIntensity method

crimson terrace
#

Damn, thats convenient

golden kelp
#

but I dont know if its the glowstone itemstack

#

glowstone has a block

#

i should use that

#

oh

#

Glowstone is a block

#

its GlowstoneDust that isnt

crimson terrace
#

Ye

golden kelp
#

some days my dumb surprises me

#

wait so

#

setHelmet requires an itemstack

#

how can i pass a block?

tardy delta
#

new ItemStack(Material.TNT)

golden kelp
#

do i need to get its itemstack, if yes, wont that just like remove its properties?

tardy delta
#

what properties?

golden kelp
#

lets keep it slow.

tardy delta
#

you probably have to mess with meta

golden kelp
#

So how do I get the Glowstone block

#

wait wait

#
  • I need to get a Glowstone block
  • Change its intensity using setIntensity
  • Put it on the armor stand
#

how can I do the first step, as I cant just instanciate a block

#

and Glowstone isnt a class

worldly ingot
#

Intensity? Glowstone has no intensity

golden kelp
#

Someone told me it did

#

What does have intensity?

worldly ingot
#

Nope. Just 15 light level

#

Light blocks do

golden kelp
#

But they dont exist in 1.15.2 sadly

#

i got an idea

worldly ingot
#

They don't. Nothing, to my knowledge, has a changeable light value in 1.15

golden kelp
#

when the intensity is 15, use glowstone
when the intensity is 14, use X block

#

Well

#

I think I found something

#

Light blocks do exist in 1.15

#

Oh, never mind they dont, i was looking at the bedrock section

tardy delta
#

ayy debuggin my plugin via ij works

golden kelp
#

fr?

#

that must be a life saver

#

Where can I find the list of blocks sorted by their light level

#

I want to find blocks from 1 to 15 light levels

tardy delta
#

it injects code into memory lol

#

no more need to reload

golden kelp
#

can u use breakpoints

tardy delta
#

uhh lets see

eternal needle
golden kelp
#

what block has the light level 1?

tardy delta
#

yep it works with breakpoints

golden kelp
#

dayum

#

make it a ij plugin pls

tardy delta
#

just follow the yt video i sent above

#

ah breakpoints let the client time out lol

humble tulip
tardy delta
#

and the server too

#

kekw

humble tulip
#

Think there's something u can change in the server settings to stop player timeouts

#

But u can't stop server timeouts

tardy delta
#

and it crashed

golden kelp
#

what block has the light level 1?

humble tulip
#

Don't mushrooms have a slight glow

#

Maybe mushrooms

tardy delta
golden kelp
humble tulip
#

There u go

#

Mushrooms do produce 1

waxen plinth
#

@golden kelp there is a literal light block

#

Which is an invisible light source whose light level can be set

golden kelp
#

not in 1.15.2

tardy delta
#

oh god

humble tulip
#

Wtf

#

Why

ivory sleet
#

Julia yee

tardy delta
#

ye

midnight shore
#

How can I create a site from my minecraft plugin so that I can send a player the url in chat and he can open the site and view the content Iโ€™ve added such as for example the missions he completed?

#

Something like Pastebin but not quite that

humble tulip
#

Do you have a website?

midnight shore
#

no i wish i could create something like a pastebin site on the fly

#

every time i need it

red sedge
#

Uh I have a trie for a blacklist system, but right now if "Hello" is blacklisted, "Hell" is also considered invalid

tardy delta
#

use the pastebin api?

red sedge
#

Idk how to fix it

humble tulip
#

A trie?

red sedge
#

smth like this

humble tulip
#

Tree

red sedge
#

sure

humble tulip
#

Do you have the name of what that is?

#

So i can read on it a bit?

red sedge
#

its a trie..

humble tulip
#

Oh a trie tree

#

preface: Trie tree is also known as dictionary tree and word search tree. The biggest feature of trie tree is to share the common prefix of string to save space.Then we can filter sensitive words and automatically associate them according to the characteristics of its public prefix. The data structure of trie tree is abstracted [โ€ฆ]

tardy delta
#

it gets called when you close the inventory?

#

i guess youre clicking a button which is openeing a new inv

#

so the prev one gets closed

#

if thats your problem

#

?paste your code

undone axleBOT
humble tulip
red sedge
#

dw i just forgot to add a state

tardy delta
#

should i let my Storage#saveUser also handle the creation of users if they are not present in the db yet?

#

instead of having a createUser method handle that

river oracle
#

Brih got an ide and don't even know how to use it

tardy delta
#

๐Ÿ˜”

rich inlet
#

Hey, wenn packaging my project with maven, I'm getting this error: Unsupported class file major version 62 Does anyone know what this means? There is no additional information

vocal cloud
#

Have you tried googling the issue?

rich inlet
#

Yes, there are only answers for errors 60 and 61, I didnt find anything about 62

sacred mountain
#

hey what would be the best way to have an item with a config that a player can get at any point, and updates the config on reload? i dont want to use static abuse anymore

#

my code is currently hideous

tardy delta
#

could you paste your current code?

#

?paste

undone axleBOT
dry forum
#

whats the best way to project a video onto maps in say a 5x3 size? ive seen protocallib has a method unless its old but its just for 1 map?

wide coyote
rich inlet
#

Oh. So what should I do?

humble tulip
#

Or create user on save

#

Or get and if null create user

undone axleBOT
humble tulip
#

Java.version is 1.7

#

That's java 7

#

And you're compiling to java 17

quaint mantle
#

I have a question, storing the db credentials ina string is not a good way to do it obviously, so what would be the best way to do it ?

quaint mantle
#

Like username, password etc..

#

To have them in a String.

humble tulip
#

Yeah it's fine in a string

#

In the config file

#

That's how everyone does it

rich inlet
quaint mantle
#

Ohh okay, i thought there were better ways.

humble tulip
#

Oh wait

#

Change the compiler target to 1.8 or 11

#

Which is java 8 or11

#

What version of java are you using @rich inlet

rich inlet
#

17

humble tulip
#

I mean to run the server

rich inlet
#

do you mean minecraft version?

humble tulip
#

No

#

What java version do you have on your machine installed

rich inlet
#

17

humble tulip
#

Not the one you're using to code

rich inlet
#

I am using 17 on my PC and in my code, both

humble tulip
#

I was getting this error a while back

#

I forgot how exactly to fix

#

Change java.version to 17 and try again ig

rich inlet
#

If you mean that, then no

sacred mountain
#

i need help to understand instances and static abuse a bit better

Basically my code is hideous and i need help improving it. I think i learn best from criticism tbh.

basically most of my methods look something like this: (my goldenhead section for a custom item that i coded a couple months ago)

https://pastes.dev/V7leqm7cJq
https://pastes.dev/PofHAP0vkH

idk what i was on when i coded the second one but its ugly asf and a great example of 'if it works it works'

( if the code makes no sense then i'd still appreciate some help on how to use wrapper classes to make my code cleaner, and remove static abuse )

dry forum
#

whats the best way to project a video onto maps in say a 5x3 size?

rugged topaz
#

can anyone check this out for me thanks.

#

sending a OPEN_SIGN_EDITOR packet to the player with the nbt attached to TILE_ENTITY_DATA packet

tepid ore
#

How fast are hash maps with get and remove with sizes of around 2k?

crimson terrace
#

it depends on the map

tepid ore
#

HashMap?

waxen plinth
#

fast

#

it's O(1)

crimson terrace
#

no I mean it depends on how the map was made, what values were used. but it should still not be too slow. cant give exact values but ideally a HashMap would have a runtime of O(1) for get

waxen plinth
#

meaning the performance of those methods does not increase as more elements are added to the map

crimson terrace
#

but thats most of the time not the case

waxen plinth
#

hashmaps are dope

crimson terrace
#

especially with that many values there is bound to be some duplicate hashes

waxen plinth
#

not necessarily

tepid ore
#

Wat, that is kinda crazy lol. I understand your profile Redempt, hashmap enthusiast

crimson terrace
#

in the worst case it could be O(2000)

waxen plinth
#

if you are astronomically unlucky

crimson terrace
#

yes

waxen plinth
#

you'd sooner be struck by lightning ten times in a row

crimson terrace
#

but it could happen, im just making a point

#

and as I said, the map could have bad values or just not be rehashed for whatever reason. in that case it would be real bad

waxen plinth
#

not really

#

2000 iterations is obviously not optimal but it's unlikely to create significant issues

crimson terrace
#

this is what I mean. if thats chosen badly it could create problems

waxen plinth
#

you would truly need to be so unlucky that you'd sooner have to pick a specific atom from earth randomly and get it first try than get that bad of a distribution

#

ok yeah if load factor is 99%

#

still though

crimson terrace
#

HashMaps are good, lets agree on that. they can have a bad time when youre really unlucky

humble tulip
#

@sacred mountain

#
switch (item) {
            case THROWABLEFIREBALL: case THROWABLEFB: case TFB: case TFIREBALL: case FB: case FIREBALL:
                return fireballConfiguration.getWithdrawAmount();
            case THROWABLETNT: case TNT: case TTNT:
                return tntConfiguration.getWithdrawAmount();
            case GOLDENHEAD: case GH: case GHEAD: case GOLDHEAD: case HEAD:
                return goldenHeadConfiguration.getWithdrawAmount();
            case MOBPACK: case SPAWNPACK: case SPAWNER:
                return spawnPackConfiguration.getWithdrawAmount();
        }
#

why do you have so much of the same enum

sacred mountain
#

its for tab completion

#

and its not wven correct

humble tulip
#

do you have a github for the project?

dapper harness
#

Hello I was wondering what do the parameters villagers-every: 600
villagers-for: 100 do in spigot .yml ?

waxen plinth
#

it every villager every for the every villager village

#

๐Ÿ˜€

quaint mantle
#

But first, install 17

#

Thats how I fixed mine.

dapper harness
echo granite
#

Any mod developers here?

ivory sleet
#

ye

wicked remnant
#

i need to check if an inventory (in a click event) is one that i have created. whats the best way to do this? store a list of Inventory instances and check if the instance returned by the event is contained? or a list of hashcodes

wicked remnant
#

right

lost matrix
#

More advanced guis are often done like this:
Map<Inventory, SomeCustomHandler>

wicked remnant
#

and as long as i remove the inventory from the set in the close event, i should be fine eh?

lost matrix
wicked remnant
#

they are created per player out of necessity :)

#

so hashcode/equals does not change when the inventory's content is changed? or

lost matrix
wicked remnant
#

right

#

whoops

raw sky
#

what is the best way for the player to fly a vehicle with a increasing speed over time? (I have w and s input working already)

quaint mantle
#

elite dangerous

raw sky
#

yea about

#

ngl, havent watched 1 star wars movie so I dont have a clue what that is called

ivory sleet
#

x wing

waxen plinth
#

resource pack

quaint mantle
waxen plinth
#

anything else will explode

#

legitimately

raw sky
#

ok so

#

we have a mod that does that currently, we are just hoping people wouldnt just steal the models

#

we will have a resource mod version, just lower poly models

quaint mantle
#

mods ๐Ÿคข

waxen plinth
#

nothing you can do about it but it's unlikely

raw sky
quaint mantle
waxen plinth
#

very easily

#

it's like 4 lines of code

quaint mantle
raw sky
#

huh you can change the roll of a mob?

quaint mantle
#

jeb_

raw sky
#

if so that will change this a ton

#

well that would be really choppy

quaint mantle
#

no

raw sky
#

its a instant roll though?

unkempt peak
#

can the PlayerMoveEvent be called more than once per tick? (per player)

quaint mantle
#

im kidding

waxen plinth
#
var player; // assume this is the player
var loc = player.location;
var r = loc.roll;
r += Math.toRadians(180f);
loc.roll = r;
player.location = loc;```
#

bammo

raw sky
#

oh my god roll is a thing

#

tysm

waxen plinth
#

(it's a lie)

#

(trollface)

quaint mantle
#

(it's minecraft)

raw sky
#

OHHH

quaint mantle
#

(silly block game)

raw sky
#

sad, wish there was a way

quaint mantle
#

jeb_

raw sky
#

thats just

waxen plinth
#

I a the ultimate prankster

raw sky
#

you cant rotate with a and d

quaint mantle
#

jeb.

raw sky
#

very ultimate

#

bro

#

please

quaint mantle
#

oh yeah you had a question

waxen plinth
#

umop apisdn

raw sky
#

iwej laksd

waxen plinth
#

fool

raw sky
#

dw I found the answer

waxen plinth
#

you leave unchanged

raw sky
#

entity.SetCustomName("_Jeb" * .5)

#

there we go, 90* roll rotation

quaint mantle
#

c#

shut field
#

how do I get the 1.18.2 spigot file with CraftEntity? I tried Maven and it didn't work. Idk what to do

#

It is like what am I supposed to depend on?

#

Or what am I not doing right with Maven

raw sky
#

what?

#

oh

#

are you using intellij

shut field
eternal oxide
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

raw sky
#

get the minecraft development plugin

#

and make files

#

using that

#

so much easier, maven is all setup

shut field
eternal oxide
#

because thats the api

shut field
#

because it doesn't contain CraftEntity

eternal oxide
#

read the linked post and its link to the 1.17 post

#

It explains all you need for NMS

shut field
#

someone else told me to do exactly that, and I don't kjnow what it is saying to do

eternal oxide
#

buildtools -remapped

#

read teh NMS secions of the 1.17 post carefully

shut field
#

I downloaded both the "SpecialSource" and used buildtools to make one with --remapped and neither of those had CraftEntity in it

#

or as a whole net.minecraft

eternal oxide
#

you will have built a remapped jar. use that one

#

well its in yoru local maven

shut field
#

where is my Local Maven?

eternal oxide
#

read the post again until you see correct dependency <classifier>remapped-mojang</classifier>

#

literally everything you need is in those two posts

#

the 1.17 post tells you about running buildtools. The second shows you all the pom entries for 1.18

shut field
#

yeah, it says the exact same thing, "It downloads additional files into your local maven"

#

that doesn't actually say what a local maven is tho

eternal oxide
#

its a secret .m2 directory on yoru computer where resources are stored

#

you don't need to know exactly where it is

#

maven handles all that

#

just run buildtools correctly (remapped)

#

then add teh correct parts to yoru pom

shut field
#

just like what it has in the "Example Dependency Config" on the 1.18.1 but changed to 1.18.2?

eternal oxide
#

yes

shut field
#

it says it isn't found

#

oh now it is

eternal oxide
#

you mean this? xml <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot</artifactId> <version>1.18-R0.1-SNAPSHOT</version> <classifier>remapped-mojang</classifier> <scope>provided</scope> </dependency>

shut field
#

but it is still saying I don't have any CraftBukkit stuff

eternal oxide
#

if you are using InteliJ I believe you have to refresh or something

#

type an import and see if it has NMS import net.minecraft.

shut field
eternal oxide
#

?paste your pom

undone axleBOT
shut field
eternal oxide
#

does your pom show any errors?

sage patio
#

I can't still understand public, private, static and... stuffs, is there a video to explain it completely?

dusk flicker
#

?learnjava

undone axleBOT
dusk flicker
#

check those out

sage patio
#

thanks

shut field
eternal oxide
#

then you should have nms access

#

are you sure you are trying to use a valid nms import?

shut field
#

wait, net.minecraft is back!

#

but where is EntityInsentient

#

did they rename it or smth?

eternal oxide
#

no guarantee anything has the same name

shut field
#

anyway, thank you very much for your help

#

but stuck on this issue for like many dayys now

torpid pond
#

I have an issue myself, I went to a Java programming Discord and they told me I should "ask the experts over at Spigot" so now I'm here

#

This... isn't exactly developing anything so I'm not sure if I'm allowed to post this in here or not

eternal oxide
#

?ask

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!

torpid pond
#

Fair enough

#

I went over to the Java programming Discord and they told it was more complicated than it seemed and that I should come to people who knew about Spigot

eternal oxide
#

Its a maven project so quite simple

torpid pond
#

The artifacts on this page have all expired, that's why I need to compile this myself

#

I loaded the project on Idea, and exported it, and the guy told me it basically just made a ton of smaller files and not an actual usable jar file

eternal oxide
#

looks like its for Spigot 1.13

torpid pond
#

All it does is help 2 plugins work with each other, MobArena and MythicMobs

#

its been updated 6 months ago, and it used to work just fine on 1.17

eternal oxide
#

that pom on Github says its for Spigot 1.13.2

#

It also uses a local jar file <systemPath>${basedir}/libs/MythicMobs-4.4.1.jar</systemPath>

torpid pond
#

Hmm, maybe it won't work with the newest MythicMobs then?

dapper harness
#

Hello I was wondering what do the parameters
villagers-every: 600
villagers-for: 100
do in spigot .yml ?

torpid pond
#

Since I upgraded to MythicMobs 5.0

eternal oxide
#

The version you linked will not

torpid pond
eternal oxide
#

or you update that code to support newer. You will need to be adept at Java for that though

torpid pond
#

I know a basic amount, this project will probably be too much for me

#

That's a real shame

#

Thanks for your help though!

eternal oxide
#

does Mythic mobs not have a repo?

summer scroll
#

They have a repo

eternal oxide
#

I was just wondering why that code used a local file for the MM jar. I guess its the paid version

summer scroll
#

Sure but MythicMobs also include the paid version repo too, idk why they use local file xd.

humble tulip
#

just found a really bizarre behaviour in my plugin.

for (int i = 0; i < enderChest.getInventory().getViewers().size(); i++) {
            System.out.println(i + ": " + enderChest.getInventory().getViewers().get(i).getName());
        }

prints

[20:21:41] [Server thread/INFO]: 0: minion325_

[20:21:41] [Server thread/INFO]: 1: minion325_

[20:21:41] [Server thread/INFO]: 2: minion325_

[20:21:41] [Server thread/INFO]: 3: minion325_
#

why are there deuplicate viewers?

#

if i open it 10 times, there are 10 duplicate even though i close the inventory with esc

eternal oxide
#

are you holding a reference between opening to either the chest or the viewers?

humble tulip
#

the enderchest holds a reference

#
protected void openInventory(Player player) {
        player.openInventory(this.inventory);
    }
#

that how i open the inventory

#

i dont recreate a new one

eternal oxide
#

are you doing anything crazy like canceling a close event or something?

humble tulip
#

the only listener is inventoryopenevent

#

i cancel opening of an enderchest to open my inv instead

#

u wanna see the src?

eternal oxide
#

sure

humble tulip
#

enderchest manager onleave

eternal oxide
#

You are doing somethign funny with viewers in your EnderChest#setRows

#

is that for resizing the inventory?

humble tulip
#

yeah when its resized, i wanna reopen it for those that are viewing it

#

but when im testing right now, im using a constant size

#

let me just debug if that's being called

#

that part of setrows isnt even being called

#

8 entries means i opened the chest 8 times

eternal oxide
#

I see no obvious reason for it in that code. its as if the close event is being ignored

#

but you do not even listen to that event

humble tulip
#

gonna listen to it and see if the number of views goes up

#

it does

#

thought i was somehow calling openinventory twice

#

but im not

#

i'm so confused

humble tulip
#
    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    private void onInventoryClose(InventoryCloseEvent event) {
        event.getViewers().remove(event.getPlayer());
    }

@eternal oxide look at how stupid this is

#

why do i have to do that manually?

#

it fixes my problems

eternal oxide
#

very odd

summer scroll
#

API problem maybe

humble tulip
#

happens on 1.8.8 as well as 1.18.2

humble tulip
#

Feels wrong

worldly ingot
#

infinitely incrementing viewer list?

#

If so, I'd open a bug report on the JIRA because it's probably something that needs to get fixed

humble tulip
#

Everytime i open it the viewerlist increases by 1

worldly ingot
#

e.g. equivalent of

for (int i = 0; i < 5; i++) {
    player.openInventory(inventory);
}```
#

?

#

(obviously not that stupid, but same general idea? opening without explicitly closing?)

humble tulip
#

No that's not what's happeninh

#

I open it then close with escape

quaint mantle
#

How could I Implement Item Sets?

humble tulip
#

Inventorycloseevent is called

worldly ingot
#

but isn't removed from the viewer list

humble tulip
#

Nope

worldly ingot
#

Yeah, I'd file a report on the JIRA for that then. If you can make a minimal reproduction plugin (as little code as possible but enough to replicate/demonstrate the bug), that'd be ideal

#

?jira

undone axleBOT
worldly ingot
#

tyty

halcyon mica
#

Question, I am messing around with custom dimension heights, but when I change the dimension height and start up the server, I am getting spammed with Ignoring heightmap data for chunk [-26, -1], size does not match; expected: 43, got: 37 warnings

#

They really pollute the log, can I supress or avoid them somehow

ivory flume
#

how would I get a player head via dcode

#

theres no HeadItemMeta

#

how do I tell a stack of what player to get its hed form

#

how do I specify it via nbt

brave sparrow
ivory flume
#

should be renamed smh

#

spigot api's attempts for forward compability are weird

brave sparrow
#

Thatโ€™s backward compatibility

#

When it was introduced all โ€œheadsโ€ were just skulls with a data value of 3

ivory flume
#

hmmm

humble tulip
#

?jira

undone axleBOT
humble tulip
#

never used jira

silent timber
#

Where is PacketPlayOutMapChunk in 1.18(.2)? It seems to no longer be located at net.minecraft.network.protocol.game.PacketPlayOutMapChunk

(Please ping me when responding)

lethal python
#

how can i open an anvil gui with a custom title? i saw some old forum posts where someone said you could do it

lethal python
#

in the same thread someone said they tried to do that where they specified the title but it still showed the anvil title in the client

quaint mantle
#

try it

lethal python
#

i will

#

i hope it works

#

it was 5 years ago do you think it might work now

quaint mantle
#

yeah

lethal python
#

cool :)

vestal dome
#

I'm attempting to recompile Bungeecord with a 1 line change, and I get this.

#

I don't get it

#

I just downloaded bungeecord from the github 2 seconds ago.

lethal python
#

r thos the lines u edited

vestal dome
#

yes.

#

but IDE has no errors showing

lethal python
#

did ur editor do some mad spaces/tab stuff

vestal dome
#

NVM

#

I'm gonna go cry

lethal python
#

ยฟ

humble tulip
#

Put a space before closing brackets and after opening

vestal dome
#

I'm compaining there's no spaces.

#

on the stupid

humble tulip
#

And remove imports that are unused

vestal dome
#

things inside..

#

well gonna see if it works

spiral hinge
#

Can someone lmk how to get a list of currently online players on a server in my plugin?

quaint mantle
#

?jd-s

undone axleBOT
humble tulip
#

Another server i think

quaint mantle
#

they didnt really ask that

humble tulip
#

True but no way they don't know about Bukkit.getOnlinePlayers

vestal dome
#

who says?

humble tulip
#

And they said "a" server

vestal dome
#

maybe he is using Word to create their plugin and it doesn't have auto-completer

#

you never know..

summer scroll
#

Why do I need to manually insert the id in the database table even though I already set it to auto increment? This is how I create the table.

spiral hinge
quaint mantle
#

?learnjava

undone axleBOT
humble tulip
#

LUL

quaint mantle
#

it returns a Collection<? extends Player>

humble tulip
#

It was actually Bukkit.getOnlinePlayers

sterile token
vestal dome
quaint mantle
vestal dome
#

wall what other object implements the Player interface?

ivory sleet
#

Yeah cuz under the hood itโ€™s of the type Collection<CraftPlayer>

#

(Which is a derivative type of Collection<? extends Player>)

vestal dome
#

not a ?

quaint mantle
#

not the Player interface

#

still

#

unneeded explicit

vestal dome
#

when you start a worthless argument

#

I love it

ivory sleet
#

Well this is just generic type inheritance variance

quaint mantle
#

i dont get the point

ivory sleet
#

Because
Collection<CraftPlayer> is a subtype of Collection<? extends Player>

But
Collection<CraftPlayer> is not a subtype of Collection<Player>

quaint mantle
#

bad java

ivory sleet
#

Ye

#

Java popo

summer scroll
#

the id become null, when I put NOT NULL on the create table it throws an error

#

forget about this, thanks anyway

vestal dome
vocal cloud
#

Yeesh thats a lot of bold

vestal dome
#

(shouldn't be needed imo tho)

ivory sleet
#

weโ€™re not talking about instances

#

Weโ€™re talking about generic types

vestal dome
#

Anywayyyy

summer scroll
#

that's what i do

vestal dome
#

ok I need help, basically I'm trying to "disable jline", so I could read the console, I marked as white the things I changed, but it doesn't work, and I don't understand it, can somebody help me here?

sterile token
#

And what about when needing to keep an interface, and then 2 implementations together, but knowing that each impl has extra methods that are not in the interface. Because if i cast "interface" => "implementation", then i get NPE

vestal dome
#

then => !(implementation extends interface)

#

! -> Does not

sterile token
#

I know the operators

#

๐Ÿ˜‚

vestal dome
#

maybe you don't

#

idk

sterile token
#

I just dont know how to do it with a map

#
  1. Map<UUID, Menu> (menu its an interface)
  2. InventoryMenu (normal menu), implements menu interface
  3. PaginatedMenu (menu with pages), implements menu interface
vestal dome
#

just

#

implementation instanceof InventoryMenu

#

for example

sterile token
#

So im the fuck literally because when casting, menu to paged i get NPE and if i dont cast it, them i cannot access to methods that are not in the interface

quaint mantle
#

what

#

what are u trying to do

sterile token
#

I explain have you read on top?

sterile token
#

Wait wait

#

Its okay, but doesnt fit me

eternal oxide
#

?paste

undone axleBOT
sterile token
#

Why? Because menu contains some common methods and each impl contains others methods that are not included in the interface: so then when doing:

PaginatedMenu paged = Map#Get(UUID) => Then i get NPE

#

Know i think its clear

eternal oxide
sterile token
#

๐Ÿ˜‚

#

That what i tihink. But i realise im wrong

vestal dome
#

then at that point

quaint mantle
vestal dome
#

PaginatedMenu extends InventoryMenu

#

bruhh

sterile token
#

Hmn?

#

I think im not clear

quaint mantle
#

verano i dont think you're understanding interfaces and casting

sterile token
#

Its really annoying not getting understanded :(

eternal oxide
sterile token
quaint mantle
#

are you just wondering how to make a paginated gui

sterile token
#

So im not wrong at all

#

No no

#

Im just wondering to be able to do:

InventoryMenu menu = Map#get(UUID) - Which returns a "Menu" object
PaginatedMenu paged = Map#get(UUID) - Which returns a "Menu" object

#

But them i get NPE

vestal dome
#

then MAP IS NULL???????????

#

or UUID is null?

quaint mantle
#

lmao

vestal dome
#

LMFAO?

sterile token
#

Lmao why the fuck i taken "advanced international exam" if no one understand me

#

๐Ÿ˜ฎโ€๐Ÿ’จ

quaint mantle
#

dude

vestal dome
#

are you literally saying that we are below your exam?

quaint mantle
#

if you get an npe from that

vestal dome
#

like

#

we don't know how to code?

quaint mantle
#

the key (UUID) is null or the map is

#

you havent even shown us the fricking NPE yet

sterile token
#

On the map nothing its null, its happen by cast

quaint mantle
#

what

vestal dome
#

how do you know?

#

further more

sterile token
#

Because Menu its an interface right?

vestal dome
#

as far as I'm concerned

#

a NPE != CCE

quaint mantle
#

lmao

#

back to what i said

quaint mantle
#

"and casting"

sterile token
#

I dont know i have this code

vestal dome
#

okey bro

#

show us your code

#

do it

sterile token
#

public class MenuHandler { 

  private final Map<UUID, Menu> menus = new ConcurrentMap<>();

  public void register(UUID uuid, Menu menu) { this.menus.put(uuid, menu); }

  public void unregister(UUID uuid) { this.menus.remove(uuid); }

  public Menu getMenu(UUID uuid) { return this.menus.get(uuid); }
}


public class Test {

  // I need to cast the menu object to PaginatedMenu, because then i cannot use next(), previus(), etc methods
  public void test(Player player) {
    PaginatedMenu menu = (PaginatedMenu) MenusPlugin.getInstance().getMenus().getMenu(player.getUniqueId());
    menu.getPage().next();
    menu.open(player)   
  }
}

#

I think know i have explained

#

Or atleast im wondering to be understand

#

Its longer but that a simple demostration of what i have

river oracle
sterile token
#

I dont have the code atm, but its demostration code of what i have

river oracle
#

oh I was just offended by the lack of DI

sterile token
#

What do you think? Im really annoyed since yesterday

river oracle
#

that idea looks pretty solid though for a 1 menu per player system I'm not to advanced in java so I don't know if there'd be some unforceen extreme overhead of doing it that way, but I think it looks fine

sterile token
#

For me it fine, because i dont even touch the register/unregister methods, its auto managed by the MenuListener

river oracle
#

well what is it supposed to do exactly

#

just keep 1 menu per player?

sterile token
#

Dont worry of the key-value map

quaint mantle
#

you have not

sterile token
#

Its my way of tracking my custom inventory

quaint mantle
#

showed the error

sterile token
#

Im not on pc atm

#

That why i didnt send

quaint mantle
river oracle
#

well if there was an NPE which their shouldn't be it means you added a player without adding a menu

sterile token
#

But i think its caused because im casting the getMenu which returns Menu object into PaginatedMenu

river oracle
#

I've never had an NPE with a map before though so ASakashrug

quaint mantle
#

if i know java that does not cause an npe

#

casting null to something is just null

#

null is null

sterile token
#

Maybe its not an NPE

quaint mantle
#

you will not get an npe from casting to anything other than a primitive

sterile token
#

Its a cast exception

quaint mantle
#

its

#

NOT

river oracle
sterile token
#

you confuse me too much

river oracle
#

just wait till you get the error

sterile token
#

Or im either dumb

river oracle
#

than post it here

quaint mantle
river oracle
#

it'll be easier for all

quaint mantle
#

how does your IDE not scream at you

#

holy shoit

river oracle
#

my idea doesn't care about blind casts, but thats because I told it not to ๐Ÿ˜ˆ

sterile token
#

Im turning pc on

quaint mantle
#

PaginatedMenu menu = (PaginatedMenu) MenusPlugin.getInstance().getMenus().getMenu(player.getUniqueId());
menu.getPage().next();

#

you just blindly cast

sterile token
#

blindly?

earnest forum
#

without checking instanceof

sterile token
earnest forum
#

i think

#

im not 100%

sterile token
#

I shouldnt check instanceof

quaint mantle
#

im gonna go kms

sterile token
#

Because i wont know if the uuid has at the moment opened either a paginated menu or normal menu do i explain?

#

That hat fucking me

quaint mantle
#

holy shit

#

?learnjava

undone axleBOT
river oracle
#
if(menushitwhynoDIlMFAO instanceof PaginatedMenu menu){
 // logic here this is a safecheck no errors will be thrown
}```
sterile token
#

I know about instanceof

quaint mantle
#

theres stuff abourt abstractation

#

in those tutorials

sterile token
#

Lmao

quaint mantle
#

thats not lambda

sterile token
#

that will be al amazing party

river oracle
#

uhm not a lambda

dusk flicker
#

what

sterile token
#

I use lamda

#

๐Ÿ˜‚

river oracle
#

I think you are having trouble with english translation? or your just dumb

dusk flicker
#

Can you even use a lambda for an instance of?

#

Better question is why the fuck would you

sterile token
#

๐Ÿ˜‚

sterile token
#

I know im really specially

river oracle
#

do you know what a lambda is?

quaint mantle
#

๐Ÿ˜‚

river oracle
#

-> the cute little bolded arrow symbolizes a lambda

sterile token
#

that the correct one

dusk flicker
#

what

quaint mantle
#

what

river oracle
#

what

dusk flicker
#

no

quaint mantle
#

no

river oracle
#

are you trolling?

sterile token
#

No

#

Really

#

Js ues that

river oracle
#

JS is disgusting mistake of a language

quaint mantle
#

JS is dogshit

sterile token
#

I know lmao that hwy i prefer typescript

river oracle
#

The day I use JS is the day I've given up my dignity

quaint mantle
#

=> is only acceptable in rust

#

we love rust

river oracle
#

rust ASthumbsup

sterile token
#

In fact to solve my shity issue i need to do an instanceof in the Menu getMenu() methods right?

river oracle
#

yes accept I reccomend using dependency injection

#

?di

undone axleBOT
river oracle
#

rather than static reference

dusk flicker
#

?di ck

undone axleBOT
quaint mantle
sterile token
#

I already use that

dusk flicker
#

ty ty

quaint mantle
#

oooh i wonder something

river oracle
sterile token
#

Hmn i be clear please

river oracle
#

Your statically accessing the main plugin ๐Ÿ˜ญ

sterile token
#

Im really dumb 3 shots of gummy voodka and i look like having nightmare in a bot

sterile token
#

Or ima wrong?

river oracle
#

there should be no static method

summer scroll
#

If I send a TextComponent without the player.spigot().sendMessage is the text still have like a click event?

sterile token
#

I only have the MainClass getter static method

river oracle
#

proper way for portability and cleanness is using dependency Injeciton

#

?di

undone axleBOT
river oracle
#

^ read very good shit

quaint mantle
#

then it was edited

river oracle
#

good job Imajin

quaint mantle
#

by @dusk flicker

#

and conclure

sterile token
#

My full methods uses DI

quaint mantle
#
    /**
     * Logs a message in red using the associated plugin's logger.
     *
     * @param message the message to log
     */
    public void logRed(String message) {
        // accessing JavaPlugin's logger
        plugin.getLogger().info(ChatColor.RED + message);
    }

@dusk flicker this doesnt actually work

river oracle
#

you know this would be easier if I spoke spanish but my spanish is the equivalent of a 1 year old

quaint mantle
#

i will implement!

#

nvm dont feel like it

sterile token
#

Yes if talk in spanish you understand what i mean in less than 1m

river oracle
#

your not using Dependency injection for your main class though

#

thats the issue

#

you wanna be using Dependency Injection there

sterile token
#

Always learning smt new here

river oracle
#

also fix your casting too

#

no lambda needed just

if(menu instanceof PagedMenu pagedMenu){
  // logic
}

#

simple Di

sterile token
#

Yeah i think it will be fixed by:

Menu getMenu(UUID uuid) {
    return (this.menus.get(uuid) instanceof InventoryMenu) ? (PaginatedMenu) this.menus.get(uuid) : (InventoryMenu) this.menus.get(uuid);    
}
river oracle
#
public class ThePlugin extends JavaPlugin {
  @Override
  public void onEnable(){
    new OtherClass(this);
  }
}

public class OtherClass {
  
   private ThePlugin plugin;
  public OtherClass(ThePlugin plugin){
    this.plugin =plugin;
  }
}```
sterile token
river oracle
river oracle
quaint mantle
#

OMG

#

IT ITS A MAP OF MENUS

#

GET RETURNS A MENU OR NULL

#

im more pissed that you have not read a single thing said by your ide than not understanding

river oracle
#

idk why he doesn't just do

if(this.menu(uuid) instanceof PraginatedMenu menu){
  // logic
}
sterile token
#

I need to do it because i dont want to be checking instanceof every time i call getmenu()

river oracle
#

bad habbit

#

just check the instanceof and move on

quaint mantle
quaint mantle
#

he will STILL have to check the instance

river oracle
#

I just read it and gave up it was so horrid

quaint mantle
river oracle
#

wtf does that mean

quaint mantle
#

? = if

#

: = else

river oracle
#

oh wtf

#

gross

quaint mantle
#

gross

#

wym

sterile token
#

imajin so the code is okay or not?

river oracle
#

why would you wanna one liner something so big

#

no just check theinstanceof

#

seriously

quaint mantle
quaint mantle
#

just return menus.get(uuid)

#

ykw

sterile token
#

Allright

quaint mantle
#

if you dont understand then im done bothering

sterile token
#

But them i still need either the casting or instanceof

quaint mantle
#

kms

river oracle
#

why do you mind so much

#

who cares

#

this is painful

sterile token
#

I thinkyou dont undertand what i really want to say

river oracle
#
menus.get(uuid) instanceof PaginatedMenu menu
#

this

sterile token
quaint mantle
river oracle
#

^

quaint mantle
#

NO YOU DONT

#
Menu getMenu(UUID uuid) {
    return (this.menus.get(uuid) instanceof InventoryMenu) ? (PaginatedMenu) this.menus.get(uuid) : (InventoryMenu) this.menus.get(uuid);    
}
sterile token
#

I alreayd taken that out

#

๐Ÿ˜‚

quaint mantle
#

okay good

#

so we got somewhere

sterile token
#

I do it before hen you told me

#

๐Ÿ˜

quaint mantle
#

...

sterile token
#

Really im not trolling, im just dumb and my cmmunication its horrible

river oracle
#

Ok lets start from step one your method sucks
now lets remake that horrid piece of trash

Menu getMenu(UUID uuid){
  return this.menu.get(uuid);
}```
#

maybe I'm also stupid

#

but I think this method works perfectly fine

sterile token
#

Alrlight

#

I will try the code