#help-development

1 messages · Page 649 of 1

inner mulch
#

thank you

unkempt peak
#

For future reference try searching terms related to what your doing on the ?docs such as potion etc before asking here

#

?docs

young knoll
#

?jd

unkempt peak
#

Does that command not work anymore?

#

Oh

simple schooner
#

aaa how do I run a synchronous method asynchronously

#

brrruuuhhhh

alpine urchin
#

some methods spigot prevents from running async with asynccatchers

#

you shouldn’t just bypass it

#

this is probably more of a

#

?xy

undone axleBOT
simple schooner
alpine urchin
#

show me the async context

#

why are you in an async section

#

show us some code

#

so we can judge it as a whole

simple schooner
#

Is there a way to run it there

alpine urchin
#

if you do right

#

just use a bukkit scheduler to run it on main thread

quaint mantle
#

open it sync but u can fill the items async if u want

sterile breach
#

I just add an array in my hashmap ?

river oracle
#

yeah

#

that's what a multimap is

sterile breach
#

So to store an indétermined info per player is good ?

sterile breach
#

Caffeine

river oracle
#

Yeah Caffeine does just use maps

#

you should probably understand the data structures you are using before using them. I mean these questions seem fairly basic

sterile breach
#

Yes, I wondered if that was possible.

tender shard
#

me after my 7th cup of caffeine

sterile breach
#

Mmmmmh

native bramble
#

whether it is necessary to use multithreading in working with databases

#

and in which situation i need to use multithreading?

quaint mantle
#

any time u interact with the db u prob dont want to do in a blocking manor

#

I just interact with a cache all the time and save to db every 5m on a new thread

native bramble
#

its ok to use conpletablefuture and executorservice?

native bramble
#

like i have func which check if record exist in db

wet breach
#

Just make sure you execute it in an async task

native bramble
#

okay

#

thank u

#

should i connect to db also in async task?

ivory sleet
native bramble
#

ty

ivory sleet
#

I mean tbh

#

u should use a connection pool

#

(perhaps hikari)

#

and then just use that to acquire connections on the fly

native bramble
#

HikariCP?

ivory sleet
#

yes thats the one

native bramble
#

thank u

#

I'll find out

simple schooner
#

I think im getting ddosed

wraith dragon
#

Anyone experienced in making minigames, I was just talking to another developer on minigame states and how it could be optimzed more, I asked him about listeners and listener providers which is basically something like, PlayingGameState uses PlayingListenerProvider and Waiting and Starting game state uses PreGameListenerProvider or just gamestates as the listeners themselves. Is there any other method to be used that is even better than the two mentioned?

lost matrix
hazy parrot
lost matrix
#

Ah i see what he did there. I guess this is fine but it resembles a bit the one-class approach of alex's BlockData.

#

GamePhase is a bit overloaded when it comes to responsibilities here

wraith dragon
lost matrix
#

Wait i think he doesnt register events on runtime? It depends on the registerEvents implementation...

#

Could also have a Map<Class<? extends Event, Consumer<? extends Event>> underneath.

wraith dragon
#

here is an example

#

instead of listenerProvider its GameStateListener

undone axleBOT
wraith dragon
#

oh mb

hybrid spoke
#

yeah, you cant?

lost matrix
#

Yes. This will produce unfathomable amounts of lag.
One player can probably lag out the entire server by
himself.

#

Its a bit of an overexeggeration but this code will perform very poorly.

#

Spawners are tile entities.
-> When the chunk loads : count spawners and keep track of that
-> On block place : increase amount
-> On spawner destrcuction : decrease amount

#

Why is EventExecutor not generic PES2_Angry

#

Nothing, wasnt directed at you.

#

Just brainstorming on dynamic event handling for minigames.

wraith dragon
lost matrix
#

I got carried away with an idea. Let me quickly read your code.

#

You dont. Listen for ChunkLoadEvent

lilac dagger
#

no need for dynamic events

wraith dragon
lost matrix
#
    public void deleteGame(UUID uuid){
        this.games.get(uuid).delete();
        this.games.remove(uuid);
    }

Does the same as

    public void deleteGame(UUID uuid){
        this.games.remove(uuid).delete();
    }
native bramble
#

Is it right way to use CompletableFuture with jdbc?
Here is code - https://pastebin.com/CpQLZmWJ
call the function in this way - DiscordDataHandler.connect();

lilac dagger
#

assuming you have only a single game

#

you can have it pretty small

#

one per game, not per arena i mean

lost matrix
native bramble
#

i need to return not boolean but CompletableFuture<boolean>?

lost matrix
native bramble
#

ty

ivory sleet
lost matrix
wraith dragon
ivory sleet
#

Well the idea was that you’d use the same event executor for different event callbacks that callback invariant event types

#

Like ForkJoinPool::commonPool

#

Its an executor thats widely used for different types of callbacks

wraith dragon
ivory sleet
lost matrix
lilac dagger
ivory sleet
#

Assuming it might cache varhandles/methodhandles or other things but yeah

lost matrix
#

?paste

undone axleBOT
lost matrix
#

If it does then this is a very nice tool for dynamic, lazy event registrations for minigames

glossy venture
#

yeah everything in their render distance

glossy venture
#

seems like its checked

lost matrix
#

It depends if the population of the Map was done in a safe manner

glossy venture
#

yeah true but it seems like it is

lost matrix
#

If you put a Class<InventoryClickEvent> and a Consumer<BlockBreakEvent> in this then it breaks

glossy venture
#

unless someone fucks up the data with reflection or smth

wraith dragon
glossy venture
lost matrix
#

Depends on the guy that implemented the phase.getEvents(); methods.
The map is not type safe.

lilac dagger
lost matrix
#

I really miss something like that. A map where the key type correspons to the value type.
But this is not possible with type errasure.

ivory sleet
#

Consumers are contravariant by nature

lilac dagger
ivory sleet
#

(I mean it can make sense sometimes)

wraith dragon
lost matrix
# ivory sleet Consumer<? extends X> doesnt ever make sense

Consumer<? extends X> is more flexible than Consumer<X> as it allows accepting arguments of different subtypes of X, but it does not allow modifying the underlying object. You would never use a Consumer<Event> and then pass subtypes like PlayerEvent to that.

#

You need a Consumer<? extends Event> to pass a PlayerEvent to the consumer

ivory sleet
#

Do you know anything about type theory smile? Else if I say covariance and contravariance it means nothing

lost matrix
hybrid spoke
#

there is no covariance when talking about events

#

you want that flexibility

ivory sleet
#

Yes there is no covariance but there might be contravariance

lost matrix
hybrid spoke
#

how would there be a contravariance

ivory sleet
#

Consumer is a consumer

#

super is just the java keyword for allowing contravariance, extends is just the keyword for allowing covariance

lost matrix
#

Yes i think that makes sense. How are consumers inherently contravariant then? This part i dont understand.

ivory sleet
#

well lets turn it around

#

How are they inherently or even at all possible to have a covariant relation

distant wave
#

is it possible to change the amount of ticks to wait between runs of task timer while its already executed

ivory sleet
#

Consumer<Bear> x = bear -> bear.doBearSpecificSounds();
void invokeConsumer(Consumer<? extends Animal> consumer) {
consumer.accept(new Animal());
}

invokeConsumer(x);

#

this becomes the issue

#

Now that shouldnt compile if my brain thinks correctly

#

But just looking at it you’d understand sth is wrong with it

lost matrix
lost matrix
#

Ok and a contravariant solution?

#

Wait let me try

ivory sleet
#

Yeah (:

lost matrix
#

Wait... every consumer is contravariant

ivory sleet
#

Yeah well in theory yes

#

I mean as godcipher said

#

There are moments when we break theory

#

Either you make the consumer bivariant, or contravariant yk (:

lost matrix
#

Anyways i got a headache. Gonna play with my doggo and do some rl stuff.

stone bronze
#

The program I installed on Spigot was removed due to disturb, where did you come to such a conclusion when there was not even the slightest impression of it in the program?

hybrid spoke
#

and what even is disturb

stone bronze
sterile breach
#

hello, I have a question about how to store my data.
When a player joins I load his data in an array that I need to put in a hashmap. When he leaves, I don't remove them directly. It waits 10 min and if after 10 min he hasn't logged in, it deletes them. Is it possible to do this with caffeine? Or do I have to make my own system with hashmap?

chrome beacon
#

🤔 why an array instead your own object

tall dragon
#

you can easily find examples on google on how that works

sterile breach
sterile breach
wet breach
#

Might need to explain more as that doesnt quite make sense

tall dragon
#

meaning it will reset the counter after each time you access a key

sterile breach
tall dragon
#

why would you care if he gets removed from the cache a bit earlier

sterile breach
#

When the cache got removed i add it in the db

#

But yes i can change that at the player leave

quaint mantle
#

This is probally a really stupid mistake but i cant find it. All other commands are basically build the same so i dont know whats the error with this one specific one.

#

i tried "fusing" some plugins and everything works perfectly up until i added fly to

#

idk why

lilac dagger
#

did you register fly in plugin.yml?

zealous osprey
eternal oxide
#

^

tall dragon
#

i suspect he did not

quaint mantle
#

i knew it was gonna be stupid

#

but

#

this beats all my expectations

#

thx tho

buoyant viper
#

happens to the best of us, its rly fckin annoying having to double register

zealous osprey
#

Why? It's a common mistake. If you see this exception in the future for when you register a command, you'll be more likely to check the spigot.yml.

tall dragon
#

i always just register right into the commandmap

#

cba with plugin.yml

ivory sleet
#

Same

#

I do personally think it makes more sense to not use plugin yml altho the api is designed that way so 🤷

tall dragon
#

yea same

ivory sleet
#

Like commands are arguably not plugin meta manifest thiny thingy

tall dragon
#

the way its currently designed in the api doesnt even support creating commands on the fly

ivory sleet
#

yeah

tall dragon
#

its probably done for the extra information you can provide

#

like usage i believe?

#

and permissions

ivory sleet
#

Tbh tho

tall dragon
#

not sure on that

ivory sleet
#

That is just as addable using the api

#

PluginCommand yk

tall dragon
#

yea true

quaint mantle
#

i completly forgor plugin.yml was even a thing after not making plugins for weeks x)

solid cargo
#

is it possible (and good practice) to put these listeners in one?

#

so have public void onProcess (PlayerCommandPreProcessEvent event, ServerCommandEvent event2)

tall dragon
#

id just keep it like you have right now

ivory sleet
#

You cant do that

tall dragon
#

and no

#

unless he makes his own method and passed both events to it

quaint mantle
#

why would u want to do that

tall dragon
#

but that makes little sense to me

solid cargo
ivory sleet
#

its a good idea potentially but the api isnt designed that way

tall dragon
#

spigot event api go brrrrr

chrome beacon
#

also why sudo

solid cargo
#

not if you custom-run your server

#

then you need a restart script

#

afaik

chrome beacon
#

The Spigot restart command runs a script

ivory sleet
#

Im very against having ur code doing that tho

#

just use proper tools

chrome beacon
#

It's specified in the spigot.yml

ivory sleet
#

like docker

#

or sth

solid cargo
#

eh its a close friend smp anyways

#

they wont care

#

(i wont as well)

#

if its a bigger project then i would consider it

ivory sleet
#

well once u become good at docker and kubernetes you will prefer it over manually program those startup and shutdown procedures

tall dragon
#

i really need to learn how docker works properly

#

seems to usefull

solid cargo
#

oh shit its that simple

#

sorry i take my words back

ivory sleet
tall dragon
#

do you know of any good things to watch/read to learn?

ivory sleet
#

i watched like 1 or 2 yt vids

#

but then proceeded to just try things with support from their docs

tall dragon
#

fair enough

ivory sleet
#

also did ask about best practices in comm servers ,:)

solid cargo
#

goodbye restartcommand o/

ivory sleet
vital ridge
#

This sk89qs getCardinalDirection method which returns where are you facing:

#

?pastebin

#

?paste

undone axleBOT
vital ridge
#

But for some reason it returns the cardinal direction to the right of me

#

So if I'm facing north it returns west

lilac dagger
#

@vital ridge public static BlockFace getFacing(double yaw) {
if (yaw > 135 && yaw <= 180 || yaw < -135) {
return BlockFace.NORTH;
} else if (yaw >= -135 && yaw <= -45) {
return BlockFace.EAST;
} else if (yaw < 135 && yaw >= 45) {
return BlockFace.WEST;
}
return BlockFace.SOUTH;
}

#

try this

vital ridge
#

I mean east*

tall dragon
#

probably the -90 isnt needed anymore

vital ridge
#

Why does he does all the calculations doe like %360 etc

#

why wont he take the raw yaws

#

and just do comparisions

solid cargo
#

wait this is all i need for the thing?

vital ridge
#

I could add 180 degrees

tall dragon
#

i guess its + 90 then xD

#

depends on what kind of server

#

and server version

#

as well as playerbase

#

thats plenty

chrome beacon
#

^

vital ridge
#

now it works

tall dragon
clever lantern
#

how do i send message to action bar?

#

since spigot().sendMessage is deprecated

icy beacon
clever lantern
#

no

icy beacon
#

no deprecations

#

paper javadocs: deprecated

undone axleBOT
clever lantern
#

sry mb i didnt cast sender to player

#

lol

stray nacelle
#

helo guz

icy beacon
#

anyway, came here to ask a question, is this method applicable to the entire inventory? it seems that it fails to remove an item in the second hand, though i did not debug enough yet

stray nacelle
#

how i can call server.craftItem() without player

icy beacon
stray nacelle
#

bukkit

#

craftserver

icy beacon
icy beacon
icy beacon
#

well you probably cannot because the argument of Player is not null. try calling it on the first online player and see if that works for you

stray nacelle
#

it will call craft event from that player

icy beacon
#

yep

#

The World and Player arguments are required to fulfill the Bukkit Crafting events.

stray nacelle
#

bad

icy beacon
#

you cannot avoid it most likely

chrome beacon
#

Why don't you want to provide a player?

quaint mantle
icy beacon
#

i assume there's no player for them and they just want to craft an item from ingredients

opal juniper
# quaint mantle

instead of using Objects.requireNonNull i would reccomend a proper null check

quaint mantle
#

👍

zealous osprey
opal juniper
#

basically it throws an error if the paramter is is null

#

so you wont get an NPE, you just get a different exception but i really wished intellij didnt reccomend it

#

Cause it aint just gonna magically create an object

zealous osprey
#

So it's similar to assert obj ! = null

opal juniper
#
public static <T> T requireNonNull(T obj) {
    if (obj == null)
        throw new NullPointerException();
    return obj;
}
#

im wrong, you still get an NPE just in a different place

shadow night
#

lmfao

#

most useless shit

ocean hollow
#

how can I Block.setType to String, it gives me error

#

used to be "String" gave the same

chrome beacon
ocean hollow
chrome beacon
#

Yeah

#

Don't do that

ocean hollow
chrome beacon
#

Yeah

#

in legacy versions

#

which is why it's called legacy

quaint mantle
#

String is not block

stray nacelle
#

potato is not block

ocean hollow
quaint mantle
#

Refering to exeption

stray nacelle
#

craftblock

ocean hollow
#

so what shound I do?

chrome beacon
#

Don't use the legacy material

sterile breach
ocean hollow
stray nacelle
#

u trying to place that?

ocean hollow
#

yeah

wise mesa
#

Can someone help me understand bounded generics? I don’t get them

#

I’ll just use list and number as an example

stray nacelle
#
public class Value<I_THINK_ITS_VALUE_YES_IT_IS_OMG_GENERICS_IN_JAVA_OMFG_YES_YES_SKIBIDI_DOP_DOP_DOP_DOP_YES_YES_YES_YES>
wise mesa
#

Why would I ever use

List<? extends Number>

Over

List<Number>
#

Can I not put integers and whatnot in the second list

#

Why do I need the first

stray nacelle
#

idk

dreamy nimbus
#

Hello, can we talk about mod programming too in here?

chrome beacon
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!

dreamy nimbus
#

Alright

wise mesa
#

But you can ask

dreamy nimbus
#

Being new to modding, I just started a fresh new mod in Intellij.
But when I launch gradlew genIntellijRuns I get

> startup failed:
  General error during conversion: Unsupported class file major version 64

  java.lang.IllegalArgumentException: Unsupported class file major version 64

wise mesa
dreamy nimbus
#

That's forge 1.16.5

lilac dagger
wise mesa
dreamy nimbus
wise mesa
#

Can I cast a List<Number> to a List<? extends Number> and vice versa?

lilac dagger
#

you can cast it yes, as long as the list you're casting is at least a number

dreamy nimbus
#

Being new to modding I just started a

ivory sleet
#

I mean List<? extends Number> supports a term of the type List<Double>, List<Integer> and so on

#

Its also considered to be a read only list as its pretty much is a producer and allows for covariance

wise mesa
#

Ohhhhhhhh

#

OHHHHHH

#

okay I was confused because

#

A List<Number> could contain a Double because polymorphism

icy beacon
#

where can I find the indexing for player inventory? specifically, which slot is mapped to which number for setItem and other operations

wise mesa
#

But that helps a lot

ivory sleet
wise mesa
#

3 people will send it

icy beacon
#

i wanna find it

wise mesa
#

All at the same time

icy beacon
#

fine by me

rain night
icy beacon
#

tyty

wise mesa
#

I feel like that image should be pinned

young knoll
#

It’s not even right for spigot

icy beacon
young knoll
#

0-8 is mapped to the hotbar

icy beacon
#

oh right

#

true

#

though the 9-35 is corrrect iirc

young knoll
#

@tender shard has one for spigot

icy beacon
#

actually i don't think that the crafting matrix is even available to setItem

#

so yeah this does seem to be inaccurate

lilac dagger
icy beacon
#

i guess it's right somewhere

#

don't know where though

#

i don't think it was created randomly with no thought put in

young knoll
#

Probably packet level

icy beacon
#

perhaps

smoky oak
#

I know this is probably a very bad idea. Can Java internally compile source code from input string(s) and execute it without writing them to a file?

icy beacon
#

uhh i bet that some niche library can parse java in real time maybe possibly perhaps

#

why though?

icy beacon
pine forge
#

Is there a way to put clickable links in a kick reason?

chrome beacon
icy beacon
#

how so?

chrome beacon
icy beacon
#

holy shit

young knoll
#

New skript just dropped

icy beacon
#

yeah i was just thinking that a scripting language for a plugin could be java itself lmao

#

but it's less of a hassle to just make one's own

pine forge
#

Clickable links in Kick Reason

chrome beacon
#

Yeah you can make a scripting language that compiles to native code if you want

icy beacon
#

did you add the essentials dependency to pom?

#

you ideally never manually type in the import value, it should be imported automatically or by auto suggestions

#

and you really should

#

well it's never too late to learn

#

your ide should have a creation wizard for a maven/gradle project

#

just create one and start going with the flow. when you don't understand something, look it up and really soak in the information and then try to apply what you've learned

#

when you stop learning, you start dying
(c) some guys signature on spigot

#

be aware that everybody here is happy to help you as long as you try to really understand what you're being provided, as long as you really want to learn and as long as you are not trying to be spoonfed

#

it won't take long to port your code. it's as much as copying the files from your old project to your new project and then actually adding dependencies instead of whatever you have now

lilac dagger
#

i miss eclipse

shadow night
#

hey, I'm trying to create an interface for certain kinds of classes and everything I do there has to be static, but apparently static methods in interfaces have to have a body and in abstract classes static is not allowed at all

undone axleBOT
shadow night
lilac dagger
#

interfaces are strictly for contracts

shadow night
icy beacon
#

and the phrase "everything i do there has to be static" is kinda throwing me off. is this a utility class? why would you need to abstract a utility class?

lilac dagger
#

static is bound to the class, abstract is bound to object

icy beacon
wise mesa
#

Just don’t make the method in the interface static?

#

And don’t give a body

quaint mantle
#

is there a way to make mobs ignore a specific player

shadow night
# icy beacon please explain ***exactly*** what you are trying to do

basically, I need to have a class I can implement/extend to create other classes with certain functions, such as getId(), getItem(), and something like that, but I don't need to be creating a new class each time or having one before because
I can't explain I'm confused as shit now

icy beacon
#

you are not calling getId() on nothing

shadow night
icy beacon
#

it's on something

#

and that something is already implied to exist if you're calling the method

shadow night
#

I just want a template for my classes

icy beacon
#

it's not like you call a static method "getId()" and it just understands what object for id exactly you want

#

yeah i guess, gradle is harder for newbies

wise mesa
#

Wdym

#

Like having that many in your computer?

#

Is what possible

#

You have to be more specific

#

Minecraft is mostly single threaded

#

The main code at least

#

Certain parts like the packet handler run on other threads, and even more parts run on other threads on paper

#

But your plugin can use as many threads as it would like

livid dove
wise mesa
#

But just one class

#

With multiple instances for each version

#

So it can like return it’s id for example

#

But you would pass that id into the constructor

#

Instead of having a bunch of classes

#

Just an idea

livid dove
#

Minecraft is single threaded.

A 15 core cpu running spigot is like having 15 developers thar have to share one pc

wise mesa
#

?

#

No?

#

That’s not a good analogy

#

Do you understand what I said above

livid dove
wise mesa
#

Most of Minecraft’s code runs on one thread (similar to one core but not exactly)

#

A couple things run on some other ones

#

If you make a plug-in, that plug-in can then use more cores if you want for its own code

ivory sleet
#

Yeah I’d say more than just a couple of things

wise mesa
#

Buts it’s unlikely that will be helpful to your plugin

#

Sorry didn’t mean it in a rude way

#

Was literally asking if you understood

#

Not trying to be harsh or anything 😅

livid dove
icy beacon
#

plz don't ping me i'm rather busy rn. i've never worked with eclipse so i can't assist you here

#

but i bet that there are tutorials you can easily find

#

i can help you with general maven help but not with eclipse unfortunately

simple schooner
#

U should probably use intellij

remote swallow
#

yeah

#

just get the community edition

#

yeah i use it for free

icy beacon
#

for me intellij is better yeah

remote swallow
#

in total?

#

just a bit low

#

15 hours in one day is gonna lead to burnout

icy beacon
#

15hrs of coding in a day will make you cognitively responsiveless

#

my record is 13 and i was trying to run away from reality so there was no other rock bottom anyway

remote swallow
#

you should do at a max 10 hours a day and if you can only do 7-8

icy beacon
#

if you are not about to commit blanket please do not code more than like 7-8 hours a day, and even that is quite a reach

remote swallow
#

with breaks between it all

icy beacon
#

^^

#

now maybe

remote swallow
#

that is gonna lead to really simple bugs

icy beacon
#

afterwards you will feel exhausted

#

yeah

remote swallow
#

coding while tired is painful

icy beacon
#

you are gonna miss stuff in plain sight because you're really tired

#

you must have some strong ass motivation and/or coffee

remote swallow
#

go sleep

icy beacon
#

well generally don't code this much and especially stop as soon as you're feeling unwell

#

'm a coffee addict

#

good for you

#

this is concerning fyi

#

this is not normal

#

though same

#

but it's not normal

#

you might

#

so it's best to check that as soonas possible

#

yeah please do

#

do you live alone

simple schooner
#

Use the community edition

icy beacon
#

live*

#

mb

remote swallow
#

live probably

icy beacon
#

even regarding actually health??

mighty pine
#

whats the package name of the full bungee jar not just the api on maven

icy beacon
#

shit sorry about that

simple schooner
#

I feel u bro, we live in poverty too

#

Bro what ur 12?

icy beacon
#

you're starting to code at a finely young age, good for you

simple schooner
#

Aight im not gonna snitch

icy beacon
#

if a person is adequate why'd i care

ocean hollow
#

what is the best way to know: "if the player looks at the block of glass for 3 seconds, then ..."

icy beacon
#

discord terms of service say that a user must be 13 or above to use it

simple schooner
#

Lucky you

#

I tried to code when I was 13 but I have no motivation back then

#

I regretted quitting

mighty pine
ocean hollow
#

i started coding for minecraft in 14

simple schooner
#

I could've been alot better now

empty basin
#

ive got a plugin thats almost done, can a competent java dev PLEASE check it over for me/add some final touches?

simple schooner
#

Same it's only been like 3 days since I'm using it

#

But I'm currently making my first project now :D

simple schooner
#

It'll never be too late

icy beacon
# ocean hollow what is the best way to know: "if the player looks at the block of glass for 3 s...

check onMove and raytrace from the player, if they are looking at a block of glass, put them in a map<UUID, Int>, which you monitor with a per-tick scheduler and increase the value by 1, when it reaches 60, the player has been looking at a block of glass for 3 seconds
but also make sure to check onMove to see if they are still looking at the block of glass (if they were, but now they aren't, remove them from the list)

mighty pine
empty basin
icy beacon
#

i started "coding" at 8 and i was doing silly scratch projects, i found python at like 10 or 11 and then i started coding for spigot at 12 or 13

#

i like my journey

remote swallow
#

atleast skript isnt in it

quaint mantle
#

hello

simple schooner
icy beacon
simple schooner
#

And that I should pick a different language for my 2nd language

icy beacon
#

never a good idea

quaint mantle
#

i want an plugin that allows players to join 1.16.5+ version can someone help me?

simple schooner
#

So yeah I kinda picked java

remote swallow
quaint mantle
#

not working

icy beacon
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

chrome beacon
#

It works just fine

simple schooner
#

Via rewind

chrome beacon
simple schooner
chrome beacon
#

Python is slow

simple schooner
chrome beacon
#

It's fine for scripting things though

icy beacon
#

java, too

chrome beacon
#

like automation and such

icy beacon
#

you should pick whatever you feel like picking

#

you can go learn cobol no one is stopping you

simple schooner
#

Well here I am now

chrome beacon
#

You can earn big money with cobol

simple schooner
#

Already started and I'm kinda liking it

#

I'm making my first big project now (a hologram plugin which u can edit your hologram through a custom gui)

icy beacon
icy beacon
chrome beacon
#

Yeah banks still use it

icy beacon
#

just rewrite it with rust uwu

chrome beacon
#

which is why it pays very well

chrome beacon
icy beacon
#

that'd be funny

chrome beacon
#

They aren't taking any risks

empty basin
#

Can a Dev please help me make a plugin? Really simple, just disables tipped arrows and netherite armour. Will pay in nitro

flint coyote
#

This channel is not for commissions

#

?services

undone axleBOT
empty basin
#

mb

mighty pine
#

whats the package name of the full bungee jar not just the api on maven

#

Should i just ping md_5

icy beacon
#

no

flint coyote
#

It probably isn't on the repo

icy beacon
#

pinging anybody will not do any good for you most likely

#

except discorauging the person in question from helping you

flint coyote
#

Just like you can't get an actual spigot.jar from the repo

mighty pine
#

At least it containing nms

#

I need nms on bungee

icy beacon
#

nms is net.minecraft.server, a name of a package for spigot

#

what exactly are you trying to do

chrome beacon
flint coyote
#

If it's about the packets you will probably find them under net.md_5.bungee.protocol.packet

rotund ravine
mighty pine
#

Ok so i need jank got it

inner mulch
#
    public void onBreak(BlockBreakEvent event) {
        Player player = event.getPlayer();
        UUID uuid = player.getUniqueId();
        if(event.getBlock().equals(Material.OAK_WOOD)) {
            player.sendMessage("Hello :)");
        }```
Why isnt the message being sent?
icy beacon
#

a block can't be equal to a material

#

event.getBlock().getType()

inner mulch
#

ok, i will try it, thank you

#
    public void onBreak(BlockBreakEvent event) {
        Player player = event.getPlayer();
        UUID uuid = player.getUniqueId();
        if(event.getBlock().getType().equals(Material.OAK_WOOD)) {
     player.sendMessage("Hello :)");
        }```
it still doesnt work, did i implement it wrong?
remote swallow
#

use ==

rain night
#

Im currently trying to get colored nametags working, i found out that using the Play.Server.SCOREBOARD_TEAM Packet is best to use. After alot of trial and error i need help with that.

private PacketContainer generateCustomNameTagPacket(Player p, WrappedChatComponent nametag) {
        PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.SCOREBOARD_TEAM);
        packet.getModifier().writeDefaults();
        StructureModifier<WrappedChatComponent> chatcomponentsModifier =  packet.getChatComponents();
        chatcomponentsModifier.writeDefaults();
        String name = UUID.randomUUID().toString().replace("-", "").substring(0, 12);
        packet.getIntegers().writeSafely(1, 0);
        packet.getStrings().writeSafely(0, name);
        chatcomponentsModifier.writeSafely(0, nametag);
        return packet;
    }

Thats my current state of the packet but it doesnt work. I know that the write-operations may fail because of an OutOfBounds Error...

eternal night
inner mulch
#

yes

young knoll
#

Also are you sure the event is registered

inner mulch
#
    public void onEnable() {
        PluginManager manager = Bukkit.getPluginManager();
        manager.registerEvents(new TESTLISTENER(), this);
eternal night
#

an angry test listener KEKW

inner mulch
#

yes

remote swallow
#

nice kekw lynx

eternal night
#

shush

#

well, make sure you are breaking an oak wood block, not an oak log block I guess

inner mulch
#

oooh

eternal night
#

I-

inner mulch
#

shit i thought it was a log

eternal night
inner mulch
#

idk that oak wood == planks

eternal night
#

no

#

not planks

remote swallow
#

it doesnt

eternal night
#

WOOD

remote swallow
#

oak wood is its own block

eternal night
#

its the block you get when you use an axe

#

on a log

inner mulch
#

Im breaking oak log

#

and the event doesnt work

remote swallow
#

you craft oak wood

eternal night
inner mulch
#

WHAT

remote swallow
#

4 logs = 3oak wood

#

right clicking a log gives stripped stuff

eternal night
#

right

#

🇰🇪

#

I AM

#

GOING TO FUCKING LOOSE IT

#

DISCORD

inner mulch
#

it works with oak_log :)

eternal night
#

there

remote swallow
#

well done lynx

eternal night
#

why would :ke be the fucking flag

remote swallow
#

go and sue discord for emotional damages

eternal night
#

when it could be kekw

#

HM ?

#

why can they not store that preference info in my user profile ?

#

why does it reset when I jump to a superior distro ?

remote swallow
#

what

#

uwuntu

eternal night
#

obviously

inner mulch
#

int number = 1 * 1.1;
Why doesnt it let me define stuff like this?

chrome beacon
#

A double isn't an int

inner mulch
#

i cant take this anymore

chrome beacon
#

Cast to int

#

and it will remove all decimals

inner mulch
#

oh man :(

chrome beacon
#

?

icy beacon
#

a number with a floating point cannot be an integer because an integer is a number without a floating point

empty basin
#

Anyone got a plugin to disable pie ray?

icy beacon
#

i don't think it's a thing, pie ray is client-sided

empty basin
#

i believe there is one that spams the client with non-existant block entities

#

some big servers have it

icy beacon
#

ah, that could be a solution

#

not aware of one though, sorry

empty basin
#

ive got the github for one but cant figure out how to compile it

icy beacon
#

link?

empty basin
icy beacon
#

i guess it's just gradle build or gradlew build

#

i'm not experienced with gradle

inner mulch
icy beacon
#

ah xD

river oracle
#

I'm sorry what... Did I just get a Concurrent Modification Exception on an Iterator?

[10:38:26] [pool-7-thread-1/WARN]: Caused by: java.util.ConcurrentModificationException
[10:38:26] [pool-7-thread-1/WARN]:      at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1597)
[10:38:26] [pool-7-thread-1/WARN]:      at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1620)
[10:38:26] [pool-7-thread-1/WARN]:      at sh.miles.townyleveled.calculation.TownValueCalculator.get(TownValueCalculator.java:55)
[10:38:26] [pool-7-thread-1/WARN]:      at sh.miles.townyleveled.calculation.TownValueCalculator.get(TownValueCalculator.java:25)
[10:38:26] [pool-7-thread-1/WARN]:      at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
[10:38:26] [pool-7-thread-1/WARN]:      ... 3 more
if (retrievedWorker.isDone() || retrievedWorker.isCompletedExceptionally()) {
    retrievedWorkerIterator.remove(); // TownValueCalculator.java:55
    chunksLeft--;
}
empty basin
#

anyone have any knowledge of gradle?

remote swallow
#

me

icy beacon
empty basin
#

i have no clue what i do

#

i have the .zip

#

and theres a gradle.bat

icy beacon
#

clone the repository and open it in an ide

#

actually even no need to open it in an ide probably

#

just clone it with git

#

and then run the command in the folder

remote swallow
#

one sec ill build it

empty basin
#

TYSM

eternal night
#

you don't need to install gradle in order to use it

#

just, open a terminal in the cloned folder

#

and run gradlew build

#

or ./gradlew build

#

depends on your OS

empty basin
#

windows

eternal night
#

then the first

empty basin
#

if thats possible

#

idk shit

#

gradlew.bat doesnt wanna build

#

odd

eternal night
#

just gradlew

#

not gradlew.bat

#

in your windows cmd

remote swallow
#

ye one min, just waiting for paperweight to load

remote swallow
empty basin
#

tysm

river oracle
#

this is probably the most I've ever been confused when coding. For some reason my iterator is throwing ConcurrentModificationException... I feel like I'm not getting the full stacktrace here. Something important is being left out because Iterator#next should never throw ConcurrentModificationException.
https://paste.md-5.net/ufarojivuh.md
https://paste.md-5.net/xiyobeqiju.rb

eternal night
#

I mean, looks like a race condition

#

iterators are not magic

#

they don't protect you from racing a different thread

river oracle
eternal night
#

Yes, iterators don't clone your list or anything

#

I mean, technically depends on the iter implementation

river oracle
#

yeah hmm okay that's it

#

because when looping the array an element could be filled in

#

I could see a concurrent modification exception in that case

eternal night
#

Like, ArrayList iter is just a fancy counter KEKW

spare hazel
#

what is the event for using a hoe on a dirt,grass,podzol block?

eternal oxide
#

interact

river oracle
# eternal night I mean, technically depends on the iter implementation

Essentially I'm waiting for a bunch of CompleteableFuture<BigInteger> tasks to finish when all tasks are done I return the resulting BigInteger 🤔. How would you reccomend I go about this I mean before. I would loop the list, but removing from a list while looping it is an issue to say the least

#

maybe I clone the iterator and remove from the list

spare hazel
echo basalt
#

Action

river oracle
#

no

#

just check for right click and shovel hoe in hand

#

using the Action enum

remote swallow
#

shovel?

#

for hoeing?

stuck flax
#

How could you play the chest opening animation to a player

spare hazel
eternal oxide
stuck flax
#

one player

stuck flax
#

Alr thanks

eternal oxide
#

an dpackets are annoying

eternal night
#
List<CompletableFuture<BigInteger>> list = new ArrayList<>();
CompletableFuture<Collection<BigInteger>> ints = CompletableFuture.allOf(list.toArray(CompletableFuture[]::new))
    .thenApply(ignored -> Collections2.transform(list, CompletableFuture::join));
#

works

spare hazel
remote swallow
#

lmfao wh at

#

spotify completeable futures

eternal night
#

ye ?

remote swallow
#

wasnt expecting it

flint coyote
#

Netflix also had some cool libs

eternal night
#

has some nice helpers if you work with it a lot

river oracle
eternal night
#

they are in that version

#

thenApply is only executed when all of them finished

#

allOf awaits all of them / executes if all are finished

river oracle
#

ohhh okay

eternal night
#

given how small the spotify dep is

#

just shade it KEKW

river oracle
eternal night
#

Well

spare hazel
#

who was the person who said why do newbies always use hypixel at the start of their plugins name? im back with another plugin:

public final class HypixelCustomItems extends JavaPlugin {
remote swallow
#

alex

eternal night
#

yea

#

but it handles the error case nicer

#

which that one liner doesn't

remote swallow
#

you call remove on the entitiy not the item

#

sysout the hasCustomEffect var

river oracle
eternal night
#

it is a nice lib if you work a lot with CF

#

iirc still maintained too ?

#

yea looks like it

river oracle
#

I use CF a good bit in spigot and non-spigot projects

#

its my preferred way of Threading in most cases

eternal night
#

Yea then go for it, the lib is like ~7 classes

river oracle
#

I love the CompletableFuture api its so nice to use

eternal night
#

until you have to manage errors KEKW

spare hazel
#

should i make a custom item like this?

public class CustomItem implements Item {

it added like 50 methods

eternal night
#

Guess your arror does not have custom effects then

remote swallow
#

so it isnt a custom effect

spare hazel
remote swallow
#

use pdc to identify it

eternal night
#

tipped arrows don't have custom effects

#

they have the single normal effect

river oracle
remote swallow
#

now i bet ur about to say "im on 1.8"

#

?1.8

undone axleBOT
remote swallow
#

the other guy

eternal night
#

just, if you wanna check for tipped arrows

#

there is a whole interface there

#

for you to instanceOf against

#

makes this whole thing a lot easier

lost matrix
eternal night
#

where ?

eternal night
#

What was the issue ?

#

if you obviously also checked for custom effects on those, that would not work out either

river oracle
lost matrix
#

Show use the code that applies custom effects to your arrows

eternal night
#

they don't

#

from the looks of it

#

just normal tipped arrows

#

looks good ?

#

yea

#

it is ?

#

oh

#

then ignore me

eternal oxide
#

tipped arrows are just arrows with potion effects

dire minnow
#

@eternal oxide

eternal night
#

the base effect is what you are after then

river oracle
eternal night
#
@EventHandler
public void on(final ProjectileLaunchEvent event) {
    if (event.getEntity() instanceof Arrow arrow && arrow.getBasePotionData().getType() != PotionType.UNCRAFTABLE) {
        arrow.remove();
    }
}
#

e.g. this

spare hazel
#

i know this isnt realated to the spigot api and everyone is gonna say ?learnjava but is there a way to assign values to enums? like assigning a text and a ChatColor to an enum to use later

eternal night
#

what is the point in "processing" them

#

if you need the sum

spare hazel
river oracle
# eternal night if you need the sum

hmmm actually yeah you're right I'm thinking about the logic of how to sum it wrong. There's no point in summing some of it if I don't have all of the ChunkSnapshots from the main thread yet what good is a half answer

remote swallow
#

public enum Enum {
    COOL("sus", ChatColor.RED);

    String string;
    ChatColor color;

    public Enum(String string, ChatColor color) 
        this.string = string;
        this.color = color;
    }

    // getters
}
lost matrix
spare hazel
#

for custom items

lost matrix
#

Ok, go on

#

Why does your rarity need mutable fields?

#

(And which fields)

#

What is the enum used for

dire minnow
#

@remote swallow

lost matrix
#

Any exceptions? Is the listener registered?

dire minnow
#

@lost matrix

lost matrix
#

Add debug messages. Print out the item type

eternal night
#

there is your message

#

I mean it literally says "hii"

#

unless I am missing something

inner mulch
#

How do I get only the full number and 1 number after a dot from a double converted to a string? (or is there any other way than converting stuff)

eternal night
#

isn#T that what you wanted ?

lost matrix
eternal night
#

why am i not getting the message

#

I mean

#

outdated plugin jar in server folder ?

#

did you mess around there ?

#

what is your current code

lost matrix
inner mulch
#

I want to have the exact number in the background, but the player should only sees the rounded one for less complexity @lost matrix

eternal night
#

literally works fine for me ¯_(ツ)_/¯

lost matrix
inner mulch
lost matrix
#

The formatting is a more classical approach used in other languages like C.
DecimalFormat gives you a bit more freedom when it comes to the actual format.

inner mulch
#

okay :D

lost matrix
#

So this works, right?

ivory gale
#

Hello!

Can someone explain to me why I can't use the Player#performCommand() method to open a menu from for example DeluxeMenus or ChestCommands? It always say Unknown command, even if it works manually... Does this have anything to do with the fact that commands are often defined in the file and not directly recorded in the plugin.yml?

Thanks!

native bramble
#

discord srv does not let players join to the server until it is fully loaded. how i can do this?

lost matrix
young knoll
#

^

#

I don't remember if you need the / or not for performCommand

ivory gale
#

Oh, well, let me try it

#

But no, it works with any other command so I think it's not necessary

young knoll
#

Deluxe commands may not properly register commands

upper hazel
#

I'm making a block regeneration plugin and would like to know if it's reasonable to just save the locations in the database or in a file and after introducing what real /regen command to compare through the for loop?))

young knoll
#

That's what coreprotect does

#

With some optimization to save space of course

upper hazel
lost matrix
ivory gale
# young knoll Deluxe commands may not properly register commands

Looks like it's the same for several menu plugins unfortunately...
Even more surprisingly, DeluxeMenus can't open my menu by command (even though it's registered in the usual way in the plugin.yml file and with registerCommand()), but ChestCommands can.That's some pretty strange behaviour

lost matrix
#

But thats essentially coreprotects approach.
They get the query from a DB and restore them over time

upper hazel
young knoll
#

?workdistro

lost matrix
upper hazel
#

the only option for?

young knoll
#

Well

upper hazel
#

"for"

young knoll
#

Coreprotect maps each block state to an int to save space

#

I believe they also map each player to an int for the same reason

lost matrix
#

You can tackle it however you want. Just make sure to not do everything in one tick.
And you should group all blocks that are in the same chunk.

lost matrix
#

This way you can locally cache a Map<Integer, BlockState>

young knoll
#

It also means you only need to store the int in the db

lost matrix
#

With an extra table int | VarChar

near mason
#

How to set head texture of player head block data

quaint mantle
#

does anyone have any idea how I could make totem packets always register before death packets?

upper hazel
icy beacon
#

hey, I've always been curious about what approach is the best for map regenerating, like if I was making a plugin for bedwars. my current idea of how this can be done is with saving the world in a different folder and then just copying it. are there better practices for this or is this one basically the go-to?

upper hazel
#

but I realized that such plugins eat a lot

lost matrix
young knoll
#

Plus int is smaller than varchar

upper hazel
#

"regeneration"

#

for skywars

lost matrix
quaint mantle
lost matrix
quaint mantle
#

oh ok mb I'm still learning

lost matrix
#

What is your general problem

quaint mantle
#

ocasionally totems "ghost" when you offhand them just before you take enough damage to kill you, which results in the totem not registering, but still showing as being in your offhand in the respawn screen

#

I wanted to see if its possible to stop this

quaint mantle
upper hazel
#

bukkit api is not a good tool for big projects

lost matrix
quaint mantle
flint coyote
#

If two classes always come together, is there some way to make a "combined generic"?
For example I have:
Class A extends Letter
Class B extends Letter
Class AConfig extends Config<A>
Class BConfig extends Config<B>

Is there a way to combine
Class MyClass<L extends Letter, C extends Config<L>>
to something like
Class MyClass<X extends *object that represents combination of letter and config*>
and use that reasonably? Maybe something like a wrapper?

Or should I just stick with specifying both even if AConfig only comes with A and same for B?

lost matrix
#

I feel like im missing information in this question

rose trail
#

Is it possible to make an event be sent to only one consumer in Apache Kafka?

pseudo hazel
#

in what?

flint coyote
#

I tried to ask a generic as possible. I'm using this for inventories that modify ConfigurationSerializables that all extend the same class.
All of the relevant (config) files also extend the same class.

Now I want an Inventory to edit all types of those ConfigurationSerializables.

Basically:
public abstract class FieldEditInventory<A extends Configurable, C extends ConfigurableConfig<A>> extends InventoryGUI {

pseudo hazel
#

in pub sub you dont usually do that, but if you must you would sent like a name or id of the one you want to message

lost matrix
rose trail
flint coyote
sterile breach
#

Hello, with placehoder api. if I have an extenre plugin that displays my placeholder. Knowing that the placeholder changes often, will it update automatically?

ivory sleet
#

What exactly are you trying

lost matrix
ivory sleet
#

I feel like you over engineered this with generics

#

but that might just be me

flint coyote
#

I just don't want to duplicate the code for editing the fields so I try to have one generic class for all of them

lost matrix
#

Not in spigot. I think there is a lib that does it.

smoky oak
#

i think u can use the inventoryChangeEvent

ivory sleet
#

Since there are essentially 2 types you construct from

#

But as said

#

This feels very over engineered

#

I would try not to go with a transparent bivariant design or whatever u call those

lost matrix
ivory sleet
#

Lmaooo

flint coyote
#

lol

ivory sleet
flint coyote
#

I was basically hoping for one generic that can then derive the other.

ivory sleet
#

Or well “design issue”

echo basalt
#

adapter moment

ivory sleet
#

I mean one way is to just have C extends Config<?>

flint coyote
#

public abstract class FieldEditInventory<C extends Configurable, B extends BaseField, D extends ConfigurableConfig<C, B>> extends InventoryGUI {

Because this looks meh

ivory sleet
#

or just if u dont need the C type go with <L extends Letter> and then just use Config<L>

ivory sleet
#

And java isnt structurally typed

#

So big issue

lost matrix
icy beacon
#

fair enough, I'm working on a personal project onyway

lost matrix
#

How about, we finally look into this and see if we can pr something reasonable.

ivory sleet
#

Thats a big pr

#

But would be nice

lost matrix
#

World loading and deleting was an issue since i started

ivory sleet
#

Yeah I think the api is a bit too scarce thats just it

flint coyote
#

Hmm but I need to know those classes to access to be able to call methods with the right fields in the right config.
It would probably work like that but the same Configurable always comes with the same Config and the same BaseField(s) so it's kinda dumb having to specify all three

ivory sleet
#

You just over engineer it as I mentioned a couple of times

#

A class needing more than 3 type parameters is rarely ever a sustainable design

flint coyote
#

Yes I like over engineering if it saves me from duplicating a function

ivory sleet
#

But even 3 is kinda eyes_bleeding

ivory sleet
#

Pretty sure you can solve it w/o having tons of type parameters

smoky oak
#

its not that difficult, i think. Let me check somethin

ivory sleet
mighty pine
ivory sleet
flint coyote
#

I might be able to save on some generics when implementing the right functions in those classes. I'll review it again. Thx

ocean hollow
#

why i have this problem

lost matrix
ivory sleet
#

array, Map, Set etc

mighty pine
ivory sleet
#

No

#

Java isnt structurally typed

#

So having that is just a big no no

icy beacon