#development

1 messages · Page 3 of 1

outer fulcrum
#

<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot-api</artifactId>
        <version>1.18-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>me.clip</groupId>
        <artifactId>placeholderapi</artifactId>
        <version>2.11.2</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
proud pebble
#

whats the issue exactly? saying the dependancy doesnt mean too much without context

orchid wyvern
#

for anyone else helping, this was sent in DMs, not that it provides too much more information

outer fulcrum
#

yes

merry knoll
#

2.11.2 apparently is the latest

outer fulcrum
#

look

merry knoll
#

and yes yours match

#

reload your maven

outer fulcrum
#

how?

merry knoll
#

you see that maven button there

#

on the screenshot you sent

outer fulcrum
#

yes

orchid wyvern
#

nice spot

proud pebble
#

click the maven button on the top rightish in the pom.xml

merry knoll
#

also switch to gradle if you value your sanity

outer fulcrum
#

oh thanks now it worked

proud pebble
#

that was a simple fix

outer fulcrum
#

im new to coding

#

thats why i don't know much

merry knoll
#

maven / gradle does not update automatically in general

#

so after changes, you need to reload

outer fulcrum
merry knoll
#

i am guessing you are going to put the version

#

with placeholders in

#

into replaced?

outer fulcrum
#

yes

merry knoll
#

if yes, then its for clarity purposes

#

if its only gonna be used once, then it does not matter

outer fulcrum
#

but when i do it shows errors

merry knoll
#

if you create a new variable or not

#

errors?

#

PlaceholderAPI.applyPlaceholders or smt is the method afaik

outer fulcrum
#

oh i will try

merry knoll
#

wait are you trying to set it to PlaceholderAPI

#

then it obviously wont work

spiral prairie
#

Just PlaceholderAPI wont work

merry knoll
#

String is not PlaceholderAPI

outer fulcrum
#

then

merry knoll
#

you might want to check some basics

spiral prairie
#

I always recommend getting into Java before using Spigot

merry knoll
#

before jumping into using apis

outer fulcrum
#

im trying to create a scoreboard with placeholderapi support

merry knoll
#

thats kinda above your punching weight if you are new

#

do some absolute basics first

#

hooking into a basic event and changing a block etc

outer fulcrum
merry knoll
#

it might work with code yoinked from places

#

but i dont think you are understanding what exactly is happening

#

if you tried to put PlaceholderAPI into a string

outer fulcrum
#

i did

spiral prairie
alpine lava
#

I do have some experience with java

#

Also courses are scams, that stuff can be found for free

orchid wyvern
#

I agree, like Aki said however, some of the stuff you find for free isn't the best quality

merry knoll
#

best way to learn is to just do it

outer fulcrum
alpine lava
orchid wyvern
#

If you have an understand of Java and you learn the absolute basics of spigot like how events are handled, you could just tinker with things to learn

#

that's how I've learnt new APIs more recently

merry knoll
#

you also are creating a new scoreboard each time the command is entered

alpine lava
#

Is this good tutorial?

orchid wyvern
#

That is for setting up a server, not creating plugins

alpine lava
#

Oh

outer fulcrum
merry knoll
#

scoreboards are above your punching grade currently

#

i know you want to do the cool stuff, but please listen and do some java research first

#

especially instances - classes <- is what you want to learn

merry knoll
#

i would not jump into spigot first

#

there are some stuff that that break oop principles

alpine lava
merry knoll
#

and make it really hard to learn

alpine lava
merry knoll
#

oh then you should not need a tutorial

proud pebble
#

you know java but havent used a ide before?

alpine lava
#

Yeah but idk how to setup workspace for spigot and stuff

proud pebble
merry knoll
#

this is good enough for all

alpine lava
#

But i used eclipse

outer fulcrum
#

ok but can you tell me how can i use placeholderAPI on my plugin on sending an command it will send a message like %player_name% executed the command

merry knoll
#

eclipse and intellij are not different

outer fulcrum
merry knoll
#

PlaceholderAPI.applyPlaceholders

outer fulcrum
#

for coding

alpine lava
#

Do i use gradle or 2nd thing

merry knoll
#

gradle is fine

proud pebble
alpine lava
outer fulcrum
alpine lava
#

I will stick to Thier docs

merry knoll
#

docs is clean enough if you know java already

#

no need to tutorials, they are either wrong or waste of time half the time

#

or both in some cases

alpine lava
#

Ok

proud pebble
alpine lava
#

Also does thier docs work in 1.16.5 paper spigot

outer fulcrum
merry knoll
#

minecraft api breaks

alpine lava
merry knoll
#

with version changes

alpine lava
#

I had some shit with forge

#

Thats why i ask

proud pebble
#

so you would want to use PlaceholderAPI.setPlaceholders(event.getPlayer(), yourStringHere);

merry knoll
#

so you need to do reflection if you want to use nms

merry knoll
#

there are methods being added usually, but removals are rarer

#

some do get deprecated though but eh

alpine lava
#

Only for my server

#

So 1.16.5

#

Will be only version

proud pebble
#

then you just have to set the api version in plugin.yml to 1.16

#

and then the java version you compile with to whatever your server is using

merry knoll
#

yes, and you can simply depend on your jar as well

#

in case you use one of those weird forks

#

some have extra methods in the api

outer fulcrum
#

why isn't the listeners not working

merry knoll
#

register them

outer fulcrum
#

i did

merry knoll
#

i will simply stop responding, you need java knowledge

#

learn classes and instances

outer fulcrum
#

from youtube?

#

can you give me some link?

outer fulcrum
#

My color codes not showing on console why or it doesn't show on console

stuck canopy
#
    public void onHit(EntityDamageByEntityEvent e) {

        Player player = (Player) e.getDamager();
        double x = e.getEntity().getLocation().getBlockX();
        double y = e.getEntity().getLocation().getBlockY();
        double z = e.getEntity().getLocation().getBlockZ();
        int size = e.getEntity().getNearbyEntities(x, y, z).size();
        Location location = e.getEntity().getLocation();

        if(e.getDamager() instanceof Player) {
            if(player.getInventory().getItemInMainHand().isSimilar(Cleaver)) {
                e.setDamage(e.getDamage() + 40);
                List<Entity> entities = new ArrayList<>(e.getEntity().getWorld().getNearbyEntities(location, 3, 3, 3));
                entities.removeIf(entity -> entity instanceof Player || entity instanceof ArmorStand);
                for (Entity entity : entities) {
                        ((LivingEntity) entity).damage(e.getDamage() / size);
                }
            }
        }
    }```
#

how can I fix this error

merry knoll
#

((LivingEntity) entity).damage(e.getDamage() / size); this is your issue

#

you are trying to cast items into a living entity

stuck canopy
#

any solution for it?

merry knoll
#

check if the entity is an item

#

entities.removeIf(entity -> entity instanceof Player || entity instanceof ArmorStand);

#

you can just use this to remove it the same way as stand / players

stuck canopy
#

I wanna damage the entities

#

I dont want to remove them

merry knoll
#

entities is a list

#

you are removing the itemstacks from the entity list

#

not from the server

stuck canopy
#

ItemStacks?

#

wah

#

its in EntityDamageByEntityEvent

merry knoll
#

class org.bukkit.craftbukkit.v1_19_R1.entity.CraftItem cannot be cast to class org.bukkit.entity.LivingEntity

#

what event it is doesnt matter

stuck canopy
#

confusing

merry knoll
#

you are getting all entities

proud pebble
#

item entities isnt a living entity

merry knoll
#

around a point

#

what is happening is :

Entity gets damaged by entity
get entities around the location
filter out armor stand + players
damage all remaining entities

#

but the issue is items are also entities

#

and an item is not a living entity

#

so, you need to filter them out the same way you filter the armor stand and players

stuck canopy
#

Oh

#

I see

merry knoll
#

better way honestly would be to

#

only get living entities

#

rather than filtering individually

#

then remove player from it if you dont want players

stuck canopy
#

thanks for the advice

#

it worked

outer fulcrum
mental cypress
queen inlet
#

oh,sry

outer fulcrum
dense drift
outer fulcrum
#

i see

worn jasper
#

uhm is normal that Runtime.getRuntime().totalMemory() / 1000000 (to make it return it in MB) is returning 1698MB? While doing the same minus the freeMemory gives me 13776MB (to get used memory)???

#

I am so confused rn

#

did I switch something up?

rigid mountain
#

https://paste.helpch.at/xapaxogora.sql
So i decided to update versions as i was using a pretty old version, 3.2 or something so mi on 4.7 now but i get this error any ideas?
{"name":"test","description":"Default description!","owner":"5e71a800-4e12-4cda-aa2a-98791b2ff818","open":false,"members":["5e71a800-4e12-4cda-aa2a-98791b2ff818"],"admins":[],"claimedChunks":0,"invites":[],"vault":[],"maxClaims":16,"war":""} this is the json for the object on that error

lyric gyro
worn jasper
# lyric gyro maybe

how doesn't make any sense that totalMemory is returning less than used memory...

lyric gyro
#

I mean I can't see your code so

#

I'm gonna assume you don't know how to math

lyric gyro
#

reading is for nerds

sterile hinge
#

🤓

worn jasper
#

b- b- aren't we all nerds?

worn jasper
#

👀

proud pebble
#

when the text is highlighted green, it usually means its being presented as a string

dense drift
#

Only if we could get around this for compileOnly dependencies like paper-api

dusty frost
#

I mean that's like, not how bytecode versioning works

dense drift
#

🥲

obsidian sonnet
tacit quail
#

when i spawn an ender dragon with /summon the bossbar doesnt show how can i enable it?

#

i tried doing ((EnderDragon) e).getBossBar().setVisible(true);

#

the event is EntitySpawnEvent

#

the event isnt the problem since the custom name works

worn jasper
#

any ideas why #getTPS() is returning different results from /tps (spark)?

lyric gyro
#

they're gaslighting you

pulsar ferry
#

It lies to you so you think the product is good!

broken elbow
#

lmao

worn jasper
#

confusion can anyone give me like, realistic reasons :-:

broken elbow
#

well I guess they already managed to brainwash you 😭

lyric gyro
#

:>

worn jasper
#

xD so spark is actually giving me fake tps?

broken elbow
#

no.

#

bukkit is

#

:)))

#

it all makes sense if you think about it

worn jasper
#

now I am realllllyyy confused

#

can't tell what's sarcasm and what's not

#

lol

broken elbow
#

the wonders of the internet

worn jasper
#

:-:

dusky harness
#

Isnt spark OS?

torpid raft
#

and is also rounding it

#

actually wait i thought paper's tps gave you the single tick tps but i guess not

worn jasper
#

ye that's whats confusing me too

#

cause all data from getTPS is changing

#

so it's really not an average xd

torpid raft
#

it might be that they give you different averages

#

pure guesswork on my part but maybe paper gives the mean and spark gives like a median or some other average which is less impacted by outliers

worn jasper
#

Probably

proud pebble
rigid mountain
#

i think i might have figured it out i just reverted some changes

thorn cape
#

How do I properly send colored messages to console?
How I convert currently https://paste.helpch.at/ecenaluriw.cs

[04:35:09] [Thread-7/INFO]: §c- - - - - - - - - - - - -
[04:35:09] [Thread-7/INFO]: §aAPI KEY: §bqVUAQox0cRiLnD8B
[04:35:09] [Thread-7/INFO]: §c- - - - - - - - - - - - -

Or is there a way to check if a console does not support color?

warm steppe
#

ChatColor.RED + "It seems like you haven't subscribed to our brand new paid subscription yet."

dense drift
#

Send the message to ConsoleCommandSender

thorn cape
thorn cape
#

I use colors in my log messages and I'm guessing that is not going to be compatible with the logger right

tight junco
rich coral
#

Yo i have a problem and dont know how should i approach it.
Im trying to reward player for voting.
What i can do is make a request and get an Array with list of players and VoteDates
How can i verify votes to make sure people who voted get rewards once per day?

What i tried:

  1. A task every 30 seconds which checks if size of array changed and rewards the newest vote
  • WHY IT DIDNT WORK: After a month votes are removed from website so it would trigger falsely
  1. A command which gets the list of votes and filters only votes newere than 3 hours and then from that list checks if player voted. Then it saves to HashMap that player voted and rewards him.
  • WHY IT DIDNT WORK: After a server restart players can reclaim their rewards

I literally took out a pen and paper to try and figure out a way to verify votes but didnt come up with anything so i count on you guys to have some simple solution i didnt consider/fix one of my solutions or there is a simpler way..

merry knoll
#

you need to save this on a database though obviously

#

if you want to make it work between restarts

#

and no need to do weird 30 second schedulers

#

vote events exist through votifier

icy shadow
#

is there a better way of compiling against nms code than buildtools? if so what

sterile hinge
#

paperweight userdev?

icy shadow
#

ok thanks

icy shadow
#

Is there a way of rotating an entity without worrying about head movement?
I want to make a mounted entity rotate left / right when pressing A or D, but I have to wait for the entity's head movement first which is a bit annoyign

#

that's with either setRotation or setting yaw and pitch with nms

dense drift
#

is it any entity or an armorstand?

high edge
#

I'd assume entity entity

icy shadow
#

Any entity

#

A LivingEntity to be precise

#

So not an armorstand, I couldn't really get the controls working for armorstands

hoary scarab
#

Is there a way of rotating an entity without worrying about head movement?
Don't think so because the rotation matches the head position/rotation.

#

Best option is entities that are full rotation. (Boats, minecarts etc...)

icy shadow
#

Dang

#

Okay hopefully that won't cause any issues

lyric gyro
#

Could you add these to the jar file, I like my terminal clean of warnings/errors xd:


[18:12:24] [Server thread/WARN]: [PlaceholderAPI] Loaded class net.luckperms.api.LuckPerms from LuckPerms v5.4.40 which is not a depend or softdepend of this plugin.

[18:12:24] [Server thread/WARN]: [PlaceholderAPI] Loaded class net.milkbowl.vault.economy.Economy from Vault v1.7.3-b131 which is not a depend or softdepend of this plugin.```
broken elbow
#

because PlaceholderAPI ain't loading none of that

#

the expansions are

lyric gyro
#

Could i fix this myself then?

broken elbow
#

those are not problems you can fix. I mean if you want, you can add them as soft depends to the plugin.yml file

#

by opening the jar

#

those are not problems* is what I meant to say

lyric gyro
#

Ah okay..

tight junco
#

gotta deal with having warnings sometimes

broken elbow
# lyric gyro Ah okay..

its just spigot letting you know that placeholder api (one of its expansions) is loading a class from another plugin. this is most likely to retrieve data

lyric gyro
#

All good thank you..

hoary scarab
#

PlaceholderAPI runs the extensions and because of that spigot is saying placeholderapi is loading those classes. You could have the extensions softdepend/depend.

lyric gyro
#

Is there any plugin witch could let me hide the warnings from the terminal? Can't remember the name of the plugin?

broken elbow
#

COnsoleSpamFIx

#

or something like thqt

#

that

bitter basin
#
private val compactNumberFormatter = run {
    with (NumberFormat.getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT)) {
        this.minimumFractionDigits = 2

        this
    }
}

fun Number.compactDecimalFormat(): String {
    return compactNumberFormatter.format(this)
//My papi onRequest
"user_dps" -> user.dps.compactDecimalFormat()

Any idea why my formatting randomly does this weird shit sometimes, the int number before decimal point is just absurdly large for no reason. I printed out a default number which i convert and u can see most the time its correct but randomly it will do some weird shit, looks like a rounding error of some sort but idk why or how to get rid of it

smoky hound
#

nvm maybe, i think i misread your question lol

bitter basin
#

it does all the M,B,T for me

#

like the lettering

smoky hound
#

yea i didn't see that part

bitter basin
#

ye idk why it does this shit at random points

#

its fine like 7 times in a rowe

#

then decides to just do some dumbo shit

dense drift
#

Is the number the same?

bitter basin
#

ye

#
println(5453.compactDecimalFormat())
#

thats litteraly all im doing

#

for the console screenshot

#

so the number is always 5453

#

expected 5.45k

#

then 554.53k comes out the fucking skies

dense drift
bitter basin
#

ye might just have to use that

#

i saw it but then i saw the numberfomatting thing

#

thought it might be better to use something thats alrdy implemented

smoky hound
#
val formatter = NumberFormat.getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT).apply { minimumFractionDigits = 2 }
repeat(1000) {
    val s = formatter.format(5453)
    println(s)
}

just ran this in a scratch file, no issues

bitter basin
#

wtf

smoky hound
#

try changing ur compactNumberFormatter to my formatter code

bitter basin
#

just nabbed ur .apply

#

i wonder if its my extension function thats messing it up

#

guess not

#

got rid of the extension

#

just used it in my papi class

#

and its same shit

#

i wonder if its smth to do with my java version

#

@smoky hound what version of java did u run the code on?

#

im on 18

lyric gyro
#

unlikely

#

how exactly are you testing it?

bitter basin
#
println(5453.compactDecimalFormat())

well im just calling this in papi's onRequest

#

and ended up with this

#

its all being called in the onRequest for my placeholders

lyric gyro
#

do you know if that is ran async?

bitter basin
#

do placeholders get called async?

#

lmao

#

idk

#

i think so i guess

lyric gyro
#

that's like very bad to begin with but anyway, it isn't specified but NumberFormat is not thread safe, either make your onRequest method synchronized (idk how you do that in kotlin) or create a new instance in the method instead of putting it in a field (bad idea if you ask me)

bitter basin
#

Im using DecentHolograms and it looks like its running on its own thread

#

when calling the placeholders

#

😦

icy shadow
#

ThreadLocal<NumberFormat>?

lyric gyro
#

ew

icy shadow
#

ur ew

lyric gyro
#

ThreadLocals are ew

icy shadow
#

why

lyric gyro
#

you already know why actually

icy shadow
#

do i?

lyric gyro
#

yes

#

you're a smart dude

#

sometimes

#

it's just code smell

#

bad design

#

bad infra

icy shadow
#

better than synchronizing a method that's supposed to be lightweight

lyric gyro
#

also mutable

icy shadow
#

true

lyric gyro
#

but that's okay

bitter basin
#

ok

#

so what do i do

#

💀

icy shadow
lyric gyro
#

lol

#

why on earth does NumberFormat have mutable state anyway....

lyric gyro
icy shadow
#

🙏

lyric gyro
#

afaik thread locals are not cleaned up

#

which would be extremely dumb if it was the case

#

but hey ho

smoky hound
#

but i think we're past that being the issue lol

bitter basin
#

ye but ty

#

just did some threadlocal

#

🙂

#

now they are locally

#

threaded

lyric gyro
bitter basin
#

😶‍🌫️

#

might synchronize it

#

if it makes u happy

icy shadow
#

nooo

#

synchronizing seems problematic given that the method will most likely be called by the main thread most of the time

lyric gyro
#

i mean it wouldn't be an issue if it was always called from within the same thread

smoky hound
#

make your own server, papi, plugins, etc. that way you can ensure no multithreading at all

lyric gyro
#

it's just dumb

#

rewrite NumberFormat to make it thread safe noescape

icy shadow
bitter basin
#

its fine threadlocal seems to balance the equations a bit more

#

dont know what that means

#

but ye

dusty frost
#

that one server impl called like bamboo or something has a tick loop per player iirc

smoky hound
#

Its much more fun to have everything on one thread. That way I can ensure that players experience lag when I do anything intensive

lyric gyro
icy shadow
#

whats that?

smoky hound
lyric gyro
#

"your connection must be lagging"

smoky hound
#

Implement a faulty ping command that returns a value 10x higher than their actual ping so I can blame something else

icy shadow
shell moon
#

Best way to handle worlds in a minigame? (Worlds are not supposed to be modified so i dont need to save the world blocks or something)

#

If a player joins an arena (world chunk) that is not loaded (because it wasnt used in some time) it would load the chunk on teleport to the arena (the first player)

#

would that cause lag or smth (best way to prevent that)

torpid raft
#

wait so are multiple instances of your minigame in a single world

#

or do you have a world per minigame

shell moon
#

per world arena

dense drift
#

Slime?

shell moon
#

but, how would that work in this case

#

as i dont need to save/load worlds

#

or slime would make it available all t he time

dense drift
#

Yeah, thats what it is for

shell moon
#

so it doesnt need to be loaded (the chunks)

#

interesting

#

do you have any idea if SlimeWorldManager and AdvancedSlimeWorldManager

#

APIs are compatible?

dense drift
#

Looks like ASWM is a fork

lyric gyro
#

ASWM is the way to go btw

shell moon
#

yeah i get that, i mean that original is 1.8 - 1.15 only and advanced one is 1.18 - 1.19

#

(i mean, from what i can read in the github)

hoary scarab
#

Man... I just thought of a good way to load arenas. I'll only give a hint incase my lazy ass decides to make it.

Packets ;)

dusky harness
#

Unless you mean storing the chunk packet data

#

And sending that while loading the world

#

But that's quite hacky and risky

leaden sinew
#

That’s almost definitely what they mean

hoary scarab
#

Close. But something along those lines.

dusky harness
#

If you're willing to go that far

Just paste in a schematic instead

hoary scarab
dusky harness
#

Well yea but your method does too

#

You can sort it by spaen

#

Spawn

#

So when they spawn they will spawn on blocks

#

Then gradually spawn more

hoary scarab
leaden sinew
#

You’ll have to load the chunks eventually

lyric gyro
#

You need to store the structures to make the packets out of in memory so like, they don't exist "in the game", but they do exist anyway, lol

hoary scarab
leaden sinew
hoary scarab
#

That's all the info I'm giving though. ;)

leaden sinew
#

Yeah but you have to create / destroy worlds for the minigames

#

Unless you want to have 50 minigame worlds always loaded with 2500 chunks

leaden sinew
lyric gyro
leaden sinew
#

Lol

#

This could be the one though

hoary scarab
#

Honestly other then my 2 projects I have in the making and this one that I just said I don't remember any others... (atleast in the past 3 months)

bronze nova
#

?jdk

neat pierBOT
bronze nova
#

?docs

neat pierBOT
bronze nova
#

Is there a setBracketPlaceholders equivalent for relational placeholders?

stuck canopy
#

help

#
    public void onSwitch(PlayerItemHeldEvent e) {

        Player player = e.getPlayer();
        int oldSlot = e.getPreviousSlot();
        int newSlot = e.getNewSlot();

        if(player.getInventory().getItem(newSlot).isSimilar(Cleaver)) {
            player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 10000, 0));
        }
        if(player.getInventory().getItem(oldSlot).isSimilar(Cleaver)) {
            player.removePotionEffect(PotionEffectType.SPEED);
        }
    }```
#

the adding of the Potions works fine

#

but the removal of the effect only works when I switch to another ItemStack

#

but if I switch from the Cleaver to a empty slot it doesnt work

alpine lava
#

so i need to edit player essentials eco, change players direction he is looking at, place block somewhere in world, also detect if player is executing command at specific place (if yes command does execute, if no then not), add command cooldown

#

how to do that

merry knoll
#

edit eco using vault

#

direction you just change location of player yaw pitch

#

for command you just check player location on command

#

not sure what you need help with honestly, what did you do so far

alpine lava
alpine lava
#

and smth

#

nothing too big

merry knoll
alpine lava
#

but i really need essentials stuff

#

eco

merry knoll
#

here is the vault api

#

read through it its self explanatory

alpine lava
#

ok

#

ima check later

keen hinge
#

i can't find the guilds repository for maven, may i know where i can find it?

tight junco
#

if(player.getInventory().getItem(oldSlot).isSimilar(Cleaver)) { the item in oldSlot is null

#

you can see that buy actually reading the errors

stuck canopy
stuck canopy
#

what is the right way to check if the item in the slot is null in ItemHeldEvent

stuck canopy
#

I wanna give player a specific amount of health when the player holds a specific ItemStack and take the health back when they switch their inventory slot to something else or if they drops the itemStack or puts it in a chest

#

How should I do it

tight junco
#

couldn't you just assign an attribute to the item

#

might only work for armor

stuck canopy
#

any other way to do that?

warm steppe
#

?mf

neat pierBOT
iron karma
#

is it very difficult to make a crates plugin?

icy shadow
#

yeah my friend tried once and they literally died

#

thats how hard it was

iron karma
#

but

#

what is the most difficult part?

leaden sinew
#

Probably the dying part

#

Hard to recover from it

iron karma
icy shadow
#

honestly a simple one is pretty easy

#

pick a random reward
give reward
profit

fading stag
#

I'm trying to send packet's to update the gui's texture.
I was doing:

PacketContainer packet = new PacketContainer(PacketType.Play.Server.OPEN_WINDOW);
packet.getModifier().writeDefaults();
packet.getModifier().write(0, invId);
packet.getModifier().write(1, invSize);
packet.getChatComponents().write(0, WrappedChatComponent.fromText(title));
// Send the packet to player

it was working on other versions than 1.19. Now on 1.19 it throws an error on

packet.getModifier().write(1, invSize);

line. Does anyone know what can I do about it?

Error:

Caused by: java.lang.IllegalStateException: Unable to set value of field private final net.minecraft.world.inventory.Containers net.minecraft.network.protocol.game.PacketPlayOutOpenWindow.b

Caused by: java.lang.ClassCastException: Cannot cast java.lang.Integer to net.minecraft.world.inventory.Containers
tardy cosmos
#

how is this possibly always false, do classes need to be compared with .equals?

wintry grove
#

instanceof

#

better to do that

tardy cosmos
#

I'm trying to check if it's been modified by another plugin so I want to check if it's actually a different class type even if it's an instance of it

wintry grove
#

oh

#

well

#

idk then lmao

tardy cosmos
#

somehow it's also saying .equals is always false

hushed badge
#

is BaseSpawner an interface

#

/ abstract class

tardy cosmos
#

It's an abstract class yeah

icy shadow
#

yeah .getClass always returns the concrete type

raw nova
#

Im trying to use deluxemenus to charge xp for a purchase but how do i make it so if they dont ahve the xp they cant get it?

hushed badge
tardy cosmos
#

oh I guess that does make sense that it would never be true then

#

the problem is minecraft creates it by creating an anonymous version so I don't know how to properly check it now lol

#

I can probably figure something out I'll just go smash my head against the wall hard enough

hushed badge
#

there is Class#isAnonymousClass

#

im unsure as to what ur trying to do here so im not too sure how much of a help that is

tardy cosmos
#

I think that is actually incredibly useful thanks lol

hushed badge
icy shadow
#

or just... instanceof?

#

that should still work

tacit belfry
#

I'm trying to send out an entity metadata packet in 1.8, this is what I have so far:

        DataWatcher dw = ((CraftPlayer) p).getHandle().getDataWatcher();
        dw.watch(0, (byte) 0x02);

        PacketPlayOutEntityMetadata metadata = new PacketPlayOutEntityMetadata(p.getEntityId(), dw, false);

        ((CraftPlayer) p).getHandle().playerConnection.sendPacket(metadata);```
#

nothing happens whatsoever

tardy cosmos
# icy shadow or just... instanceof?

I want to check if it's not the original class type or my custom class type because if it's the original I want to overwrite it with my own and if it's somebody else's then I want to not interfere with it

#

So it seems like checking if it's anonymous or my own type will suffice

lyric gyro
#

Class.forName("...BaseSpawner$1") noescape

tardy cosmos
#

got it working, much pain

pulsar ferry
tardy cosmos
#

I don't know but I don't like it

lyric gyro
#

lol

robust flower
tardy cosmos
#

the abstract class is part of mojang's code

#

I just wanted to see if it was changed by somebody else other than me and I succeeded in doing that good enough

worn jasper
#

does p.getInventory().getContents() also return armor slots?

robust flower
#

I do believe that Inventory#getContents returns everything (from a player inventory) including armor, while Inventory#getStorageContexts only return inventory items (no armor), but I recommend you test that first

dense drift
#

d;Inventory#getContents

uneven lanternBOT
#
@NotNull
ItemStack[] getContents()```
Description:

Returns all ItemStacks from the inventory

Returns:

An array of ItemStacks from the inventory. Individual items may be null.

robust flower
#

d;Inventory

uneven lanternBOT
#
public interface Inventory
extends Iterable<ItemStack>```
Inventory has 1 extensions, 2 super interfaces, 18 sub interfaces, and  24 methods.
Description:

Interface to the various inventories. Behavior relating to Material.AIR is unspecified.
Note that whilst iterator() deals with the entire inventory, add / contains / remove methods deal only with the storage contents.
Consider using getContents() and getStorageContents() for specific iteration.

dense drift
#

d;PlayerInventory#getArmorContents

uneven lanternBOT
#
@NotNull
ItemStack[] getArmorContents()```
Description:

Get all ItemStacks from the armor slots

Returns:

All the ItemStacks from the armor slots. Individual items can be null.

dusky harness
#

D;spigot PlayerInventory#getstoragecontents

uneven lanternBOT
#
@NotNull
ItemStack[] getStorageContents()```
Description:

Return the contents from the section of the inventory where items can reasonably be expected to be stored. In most cases this will represent the entire inventory, but in some cases it may exclude armor or result slots.
It is these contents which will be used for add / contains / remove methods which look for a specific stack.

Returns:

inventory storage contents. Individual items may be null.

dusky harness
#

I think for player it's all

#

95% sure that the method to get an available slot use storage contents

#

Might want to test first tho

#

Or look in the spigot code

#

Yep storage gives all

#

And contents isn't overridden so ig that gives all too

lyric gyro
#

I remember sending a table or something showing what each method returned

#

aha!

forest jay
#

I have some simple code, and it gets a list of blocks and then loops through and breaks them naturally with the users pick. It isnt breaking the blocks. block.breakNaturally() is just returning as false. Here is the code: https://paste.helpch.at/duqayeguxo.java

stuck canopy
#

I wanna give player a specific amount of health when the player holds a specific ItemStack and take the health back when they switch their inventory slot to something else or if they drops the itemStack or puts it in a chest
How should I do it

high edge
#

ItemSwitchEvent or something like that

stuck canopy
#

also theres no ItemSwitchEvent but there is ItemHeldEvent

#

but the problem with that event is that it doesnt detect if the player drops the item or puts it in another inventory

merry knoll
#

you mean you want to give it when they have it in their inventory?

#

or hold it in their hand?

stuck canopy
#

when they are holding it in their hand yess

merry knoll
#

itemholdevent works

#

but i dont think it fires

#

when they switch to air

stuck canopy
#

I had a fix for that but

#

like if a player holds the item they get the health and what if they dont switch back to another item or to air and they drops it

#

they will keep the health

merry knoll
#

you need to add all options

#

so hook up to item drop event

#

possibly to item drag event etc as well

stuck canopy
#

alright so ig thats the final option I can go for

alpine lava
#

hey, anyone here?

#

how to use it

hushed badge
#

it tells u how to use it on the link u sent

alpine lava
neat pierBOT
#
Uploading Images

You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.

alpine lava
hushed badge
#

show ur build.gradle

alpine lava
#
plugins {
    id 'java'
}

group = 'com.mikicrepstudios.mikicraft'
version = '1.0'

repositories {
    mavenCentral()
    maven {
        name = 'spigotmc-repo'
        url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
    }
    maven {
        name = 'sonatype'
        url = 'https://oss.sonatype.org/content/groups/public/'
    }

    maven { url 'https://jitpack.io' }
}

dependencies {
    compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
    compileOnly "com.github.MilkBowl:VaultAPI:1.7"
}

def targetJavaVersion = 8
java {
    def javaVersion = JavaVersion.toVersion(targetJavaVersion)
    sourceCompatibility = javaVersion
    targetCompatibility = javaVersion
    if (JavaVersion.current() < javaVersion) {
        toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
    }
}

tasks.withType(JavaCompile).configureEach {
    if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
        options.release = targetJavaVersion
    }
}

processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('plugin.yml') {
        expand props
    }
}
alpine lava
alpine lava
#

i hate timezones

#

anyone please

wary dust
#

This is probably a relatively stupid question but are running sql preparedstatements resource intensive

#

My timings report is lagging a lot in this area and all its doing really is running about 6 sql queries and using the outcomes to do minor functions like change the playertime etc

alpine lava
#

kaliber hi

#

please

#

🙏

hushed badge
# alpine lava anyone please

that should work I think. did u reload gradle?
or try to compile the plugin, could just be a cache issue with gradle/ij

alpine lava
#

reload gradle?

#

how

#

compiling just says build suceed

hushed badge
#

press the elephant in the top right

proud pebble
wary dust
#

Thanks very much

alpine lava
#

which elephant

wary dust
#

Yeah thats the report on the code is all just get a field from the table and then if statements regarding it

alpine lava
#

i did something

alpine lava
#

i found i think i fixed

proud pebble
wary dust
#

doesnt that just mean you do a bunch of statements then manually commit after

#

like uhh transactions

#

but again idk if thats relevant cus im only querying it?

merry knoll
#

all your sql (aka io) work needs to move to another thread

#

and ideally you also want to use connection pooling if its going to be used a lot

wary dust
#

okay thanks

#

thats helpful ty

lyric gyro
#

JDBC ugh

quaint skiff
#

Hi, I tried to code it so that I create a fake chestplate for different roles (and i used protocollib to send the packets) but every time i get the Traitor role my armor (that I wear before I get the role) just disappears for other players and there isn´t a fake one but with the other roles it works (I even tried it with other colors) so i don´t really understand how that could happen. https://paste.helpch.at/pemorobide.java

proud pebble
fiery pollen
#
    method java.util.Random.nextInt() is not applicable
      (actual and formal argument lists differ in length)
    method java.util.Random.nextInt(int) is not applicable
      (actual and formal argument lists differ in length)```
#

I get that error while compiling

#

Its pointing to this line in the code:
int chance = random.nextInt(0,101);

#

Random#nextInt(), has one or two parameters right? origin and bound?

sterile hinge
#

that method only exists in the new RandomGenerator interface and in the ThreadLocalRandom class

#

so you either need to use Java 17 or ThreadLocalRandom

viral moth
#

@fiery pollen

#
    public static int randomInt(int min, int max) { 
         return new Random().nextInt((max - min) + 1) + min; 
     }```
#

that's how I do mine

#

with a min, max, both inclusive

fiery pollen
#

Ah okay, thanks!

high edge
#

make the random a constant

sterile hinge
#

or a parameter

icy shadow
#

if you use new Random every time I will kill you

#

(in minecraft)

lyric gyro
#
Random random = new Random();
while (random.nextBoolean()) { random = new Random(); }
icy shadow
#

oh no

viral moth
#

while (Math.random() < 1) random = new Random();```
fiery pollen
#

When pasting a schematic with WorldEdit API, do the chunks need to be loaded for it to be pasted?

#

Or does it load the chunks by itself

smoky hound
#

examples online don't show loading chunks manually, so prob not necessary but try and see

viral moth
#

they will be loaded by WE

quaint skiff
#

Hi, I tried to code it so that I create a fake chestplate for different roles (and I used protocollib to send the packets) but every time I get the Traitor role my armor (that I wear before I get the role) just disappears for other players and there isn´t a fake one but with the other roles it works https://paste.helpch.at/pemorobide.java

shell moon
#

D;spigot PlayerInventory#contains

uneven lanternBOT
#
@Contract
boolean contains(@Nullable ItemStack item)```
Description:

Checks if the inventory contains any ItemStacks matching the given ItemStack.

This will only return true if both the type and the amount of the stack match.

Returns:

false if item is null, true if any exactly matching ItemStacks were found

Parameters:

item - The ItemStack to match against

shell moon
#

This would return true if the exact item is matched? including itemmeta, nbt, etc?

#

best way to remove an specific item from inventory would be?

dense drift
#

And ItemStack#equals check for amount and ItemStack#isSimilar (material, durability and hasItemMeta)

warm steppe
#

It shows the path "", but nothing is there? 🤷‍♂️

dense drift
#

Don't use {{ }}

warm steppe
#

oh wait

#

thats the old one

dense drift
#

Changed the wrong link

warm steppe
#

xd

#

damn

#

now updated the correct one

dense drift
#

And is the error the same?

warm steppe
#

yes

dense drift
#

Also, I recommend to use objects and not maps of maps of maps

#

Send the config that's generated, nitro

smoky hound
#

That's kotlin so slightly different syntax but the same logic should apply

dense drift
#

Is there no MapProperty?

smoky hound
#

There is, but it wasn't working for me

warm steppe
#

i was thinking of making it with objects, but matt hasn't made any docs

#

didn't know how to do that

shell moon
smoky hound
shell moon
dense drift
shell moon
#

whatt, different meta returns true?

dense drift
#

Oh wait wait

smoky hound
#

Oh my issue with MapProperty was that it was immutable and I needed mutability

#

(I think) i don't really remember

dense drift
#

so type, durability and if one has meta, it calls Bukkit.getItemFactory().equals(meta1, meta2)

shell moon
#

i just wanna remove all items that match the provided ItemStack ignoring amount ofc

dense drift
#

If all this fits your needs, then you can use ItemStack#isSimilar I guess

Edit: isSimilar should be good

hoary scarab
dense drift
shell moon
dense drift
#

Inventory#remove(ItemStack) uses a fori loop and isSimilar

shell moon
#

Inventory#remove(ItemStack)

if (items[i] != null && items[i].equals(item)) {

shell moon
#

yeah, doesnt use isSimilar, so it wont ignore amount

dense drift
#

equals call isSimilar

#

Look at what I sent and then go from method to method if you need a deep understanding

hoary scarab
# shell moon i dont think i can look like that player inventory content
ItemStack comparable = new ItemStack(Material.DIAMOND);
Inventory playerInv;

Arrays.asList(playerInv.getContents()).forEach(i -> {
    if(i != null && i.getType() != Material.AIR) {
        if(!i.isSimilar(comparable))
            playerInv.removeItem(i);
    }
});

// or
for(ItemStack i : playerInv.getContents()) {
    if(i != null && i.getType() != Material.AIR) continue;
    if(!i.isSimilar(comparable))
        playerInv.removeItem(i);
}
dense drift
#

No..

shell moon
dense drift
#

a fori loop is enough lol

shell moon
#

mmmm

#
    for (ItemStack content : player.getInventory().getContents()) {
        if(itemStack.isSimilar(content)) player.getInventory().remove(itemStack);
    }
#

would work right

hoary scarab
#

If the item is similar yes. (I might have read your above question wrong.)

#

Check if the item is null though or else you'll get an NPE

shell moon
#

i dont think i'll get one

hoary scarab
dense drift
#

Yea

shell moon
#

and?

#

itemStack is not null

#

content can be

hoary scarab
shell moon
#

if content = null, isSimilar returns false

#

but itemStack is not null

hoary scarab
shell moon
#

no

#

its not

#

i provide itemStack

hoary scarab
#

Sometimes it won't be and it will be air which is why I check for that to in the example above

shell moon
#

i dont think you get my point

#

itemStack will never be null

#

content can be

hoary scarab
shell moon
#

thats why

#

my code wont throw errors

hoary scarab
#

It will because its null

shell moon
#

no

#

itemStack is not null

#

content might be

hoary scarab
#

🤦 Go ahead... Try that code with items missing from your inventory.

shell moon
#

Context:

#
    public void removeItem(Player player, ItemStack itemStack) {
        for (ItemStack content : player.getInventory().getContents()) {
            if(itemStack.isSimilar(content)) player.getInventory().remove(content);
        }
    }
hoary scarab
#

If either of the itemstacks are null it throws an error

shell moon
#

thats why, it wont throw errors

#

as stated above

#

itemStack is not null

lyric gyro
shell moon
#

so it wont throw errors

#

i guess you tho i was using

if(content.isSimilar(itemStack))

hoary scarab
#

My bad ItemStack.isSimiliar(ItemStack) does return false now for null inputs. (Thought at some point it didn't)

shell moon
#

yeah, apparently it never threw error (at least not since 1.8)

warm steppe
#

Ok. I fixed my problem. Thank you @smoky hound and @dense drift.

I made my list:

public static Property<Map<String, MenuItem>> MENU_CONTENTS_FILL = Property.create(MenuItem.class, Map.of(/* large code chunk redacted */));

and added a default constructor to my MenuItem class.
Again, thank you very much, guys. thumbsupbro

dusky harness
#

Wait if you can't access generics
how does gson work?

icy shadow
#

depends how you use it

#

type arguments are preserved in a few places

#

subclasses and field types most importantly

dusky harness
#

oh

#

then why doesn't triumph config support it?

icy shadow
#

dunno

#

never used TC

#

im sure theres a valid reason

lyric gyro
#

laziness?

icy shadow
#

probably

pulsar ferry
#

I wasn't the one who wrote it shrug

dusky harness
#

True

pulsar ferry
#

You are very fast at deleting messages, it's genuinely impressive

torpid raft
#

any high quality but bite sized java projects to take a look at as a reference for TDD / unit and acceptance tests, good code style

torpid raft
#

i know you're out there

#

sacrifice your foss to me

lyric gyro
#

byte sized?

#

also TDD ugh

torpid raft
#

what's wrong with tdd

#

i've looked into it a bit and it sounds like it's perfect for me

#

because i always have a urge to address and expand on things i dont need to

lyric gyro
#

lol

worn jasper
#

And I am currently quite confused on why.

#

or wait

#

might know why and I am just stupid

#

okay wait let test something before saying anything else lol

#

okay, so having this method https://paste.helpch.at/ibosevuqaz.java, usually its meant for storing stuff like chests, not a player inventory, which is exactly what's causing issues now, because I can't create a chest with 41 slots... but I can also not create a player inventory with the dataInput....

#

so I am really confused rn

robust flower
#

is there a way of parsing a WE schematics into something that provide me with the block types/data in some kind of collection/map/array?

past ibex
#

have you tried figuring out how the .schematic works?

#

as there should be a wiki for this

lyric gyro
#

Why not just.. use worldedit? But anyway if you absolutely cannot then it is an actual format specification, it's uh somewhere in the SpongePowered GitHub org

pulsar ferry
#

Sponge out there doing lord's work

turbid tree
#

does anyone know how I would stop someone from interacting a bed if they right click it?
I'm trying to implement it into this but I literally don't have any clue on how I would be able to do it

@EventHandler
public void onLeaveBed(PlayerBedLeaveEvent event) {
    Player player = event.getPlayer();
    if (player.isOp() == false)
    player.damage(1);
    player.sendMessage("§7[§3K-Events§7]§C§LSleeping is not enabled on this server!");
viral moth
#

player interact event?

mental cypress
#

There's a PlayerBedEnterEvent that can be cancelled.

turbid tree
#

thank you both, I didn't know that

turbid cove
#

does any body here have an example with tab completion (1.12<) with subcommands and stuff ?

#

i'm struggling to add tab completion to subcommands (and subcommands of subcommands etc) of a command i registered

mental cypress
#

Default Bukkit command handling is a nightmare.

flint kernel
#

I like ACF, but i always found it a bit confusing and to an extent overcomplicated

mental cypress
#

That's totally reasonable.

#

I've heard that from some people.

warm steppe
#

?mf

neat pierBOT
warm steppe
#

@flint kernel ^

#

Easy to use

worn jasper
#

that's a bit outdated xD

#

triumph-cmds and gui are better

broken elbow
pulsar ferry
#

Outdated, should remove that faq

dense drift
#

edit

mental cypress
#

You can compare the upload date with the versions and timestamp of the message in #ecloud-updates

median rock
#

Think this needs to be changed to LEGACY_SKULL to work with 1.18

dusky harness
#

remove api-version

dense drift
#

LEGACY_ Is a prefix added automatically I believe

dusky harness
#

yep

median rock
dusky harness
#

nope

median rock
#

oo

dusky harness
#

just open like winrar

#

or something like that

dense drift
#

^

broken elbow
#

dkim do you know what time it is?

dusky harness
#

me losing in a comp game time

#

👍

median rock
broken elbow
dusky harness
#

😭

#

my teammates didn't want to draw when a teammate left

dense drift
#

If you remove api-version, I believe so

dusky harness
#

and now we're losing :(((

median rock
#

yikes, it doesn't have api-version in plugin.yml

dusky harness
#

what is the error

#

oh wait

#

nvm

median rock
dusky harness
#

probably like PLAYER_HEAD

#

idk i dont remember

#

but legacy should work

#

not sure why it isn't

median rock
dusky harness
#

so in this case it should work but ig it doesn't

#

what is the repo?

#

github repo

median rock
dusky harness
#

I'm busy atm but maybe someone else can take a look

merry knoll
#

in the console

dusky harness
#

i'd tell him to print out what the type is but he isn't a java dev

merry knoll
#

a

#

ah*

median rock
#

The only Java code I know is System.out.prntln 😁
And when I learn thats how much you gotta write for a basic console log, I noped out lol - in fear the rest of the language would be just as laborious

merry knoll
#

should not be too much work though

#

if thats the only line needs changing that is

median rock
#

Yea well that was my next question, if the condition was successfully met (once the correct material was actually used), would the 4 lines of code that it executes even still be valid 😁

merry knoll
#

should be? although its kinda iffy since the plugin is from 1.7 i think

#

if you want to use it in new versions i can see some pain coming up

high edge
#

a lot*

merry knoll
#

bukkit keeps its api same for the most part

median rock
#

I would happily use any other plugin that could achieve the same funcitonaility, but somehow, on the whole wide internet universe, nothing exists, sadly

merry knoll
#

but a lot of stuff still break over time so

high edge
#

A lot of shit has been changed since 1.7

merry knoll
#

yeah, not sure how much of it is affecting the plugin though

#

is it just a leaderboards plugin using heads?

median rock
#

yup

merry knoll
#

i feel like there are alternatives

median rock
#

and everything else is configured and works beautifully. No errors. Just doesnt wanna update skulls.

merry knoll
#

or rather should be alternatives

median rock
#

believe me, I looked.

#

put on my adventure boots and scoured the darkest corners of the internet 😁

merry knoll
#

quick google gives this one

median rock
#

the heck did you google

merry knoll
median rock
#

looks like it does exactly what I want.... but wtf... when I say I looked, I definitely did. maybe my search term phrasing skills aren't as sharp 😳

alpine lava
#

How do i add cool down to my command

merry knoll
#

system.currentmillis

#

then do math to see if cooldown passed

tacit quail
#

Im trying to get it so when you summon a ender dragon with /summon it actually shows the bossbar this is what im using now (it doesnt work) and i also used before

((EnderDragon) e).getBossBar().addPlayer((Player) Bukkit.getOnlinePlayers()); ```
#

rn im just using .getBossBar

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

tacit quail
#

I also get this error whenever it spawns

#

im assuming this is interfering

merry knoll
#

at me.encription.fly.listeners.dragonNerf.dragonName(dragonNerf.java:36) ~[?:?]

#

whats here?

turbid cove
#

Hi, how can i automatically put the shaded plugin jar into the plugins folder after mvn package ?

#

and replace the jar if it's already there

flint kernel
tacit quail
merry knoll
#

its null

tacit quail
#

wdym

median rock
# merry knoll https://www.spigotmc.org/resources/ajleaderboards.85548/

Had a bit of a read through their wiki. Turns out, it can't really do what the other plugin could. Plugin I was using would query SQL database directly to get top players, this one only works with placeholders. Is a problem because the SQL database route, lets me have a leaderboard in a completely different server (i.e. the lobby).

rigid mountain
elfin geode
#

Hello, I need someone to help me out with Prices for my server's ingame shop.

#

DM if you can help me out I got some questions, I can reward you with something idk

lyric gyro
#

nah fam i'm good

shell moon
#

ConfigurationSection#getKeys(false)

#

returns the keys in order?

#

(i know its not a list, but a set, question still the same)

hushed badge
#

a Set will never guarantee the order

shell moon
#

so basically that means that

#

section:
a1: "aaaaa"
a2: "bbbbb"
a3: "cccccccc"

#

a1 a2 and a3

#

can be read in any order

#

when using section.getKeys(false)

hushed badge
#

very possibly yes

shell moon
hushed badge
#

u can test it ofc, but if the implementation says that the order isnt guaranteed, u shouldnt really rely on it

shell moon
#

that means when working with sections, some option should be a must-use like

#

priority:1 , or order: 1?

icy shadow
#

d;ConfigurationSection#getKeys

uneven lanternBOT
#
@NotNull
Set<String> getKeys(boolean deep)```
Description:

Gets a set containing all keys in this section.

If deep is set to true, then this will contain all the keys within any child ConfigurationSections (and their children, etc). These will be in a valid path notation for you to use.

If deep is set to false, then this will contain only the keys of any direct children, and not their own children.

Returns:

Set of keys contained within this ConfigurationSection.

Parameters:

deep - Whether or not to get a deep list, as opposed to a shallow list.

icy shadow
#

iirc at runtime it's a LinkedHashSet but you shouldn't really rely on that behaviour

#

or you could get some difficult to debug things if that changes

shell moon
feral cloud
#

Hi Guys! Any1 can help me with understanding this ./timings report?
My server is using 14gb with only 4 players online
This is that the server has so many villagers?
https://i.imgur.com/i9Md9vB.png

shell moon
broken elbow
#

I mean its not a bad place to ask either

feral cloud
#

Like I'm so lost

#

Idk if anyone is trying to make a cpu killer in my server

broken elbow
#

you might want to send the full timings report btw

#

might help a lot more

robust flower
#

I'm having some troubles with WE, more specifically with rotating a Clipboard content.

The issue: I need to be able to test if a certain schematic is inside a certain region, or in other words, if there's any place in the region that matches a given schematic (by comparing all blocks in it excluding air blocks).

How I planned to solve this issue: Store all BlockStates that are not air in a map alongside their offset (effectively creating a Map<BlockVector3, BlockState>), then use that to search in the region for that specific building (that is represented in schematic).

A build would only be considered there if all blocks in the schematic were found, with the exact offset. The issue is that it should work independently of the current rotation of the building, that's why I want to copy the same clipboard 4 times, to have all possible 90° Y axis rotation of the same building.

I'm not sure if WE provides such functionality (searching for a group of blocks in a bigger group of blocks), but I don't think so 'cause I never saw anyone talking about or using it in any of the plugins I saw, so I would need to implement that manually.

Does anyone have already done this kind of thing, and if so, how did you solve the issue?

sterile hinge
#

uh oh that will be resource intensive

past ibex
#

I'd really suggest NOT using a hashmap

#

unless it's a small amount of data then it's fine

robust flower
sterile hinge
#

Okay that’s doable I guess

robust flower
robust flower
sterile hinge
#

WE has transforms, but I don’t remember how you could use them to access the rotated blocks in a clipboard right now

leaden sinew
lyric gyro
#

So, I'm relivable new to plugin dev, and I want to fill an area with blocks in my plugin, like the /fill command but with Spigot plugin code. And I've searched up so many different ways but I don't really understand them. What's the best way to fill an area?

high edge
#

Easiest is loop through the area, and just set the type

lyric gyro
#

What do you mean loop through the area?

high edge
#
for (startingCornerX until endCornerX) {
  for (startingCornerY until endCornerY) {
    for (startingCornerZ until endCornerZ) {
      your block location within the area of which you want to set the type to something else
    }
  }
}
lyric gyro
#

Alright, but I want to fill lots of locations so I would have dozens of variables saying like startingCornerX15 and stuff and it would just get so long

#

Wait hold on, is there a way to run normal commands like /fill from the plugin?

merry knoll
#

just use variables @lyric gyro

#

make a method that takes all 6 info needed

lyric gyro
#

You probably wanna try and figure out a way to take in less parameters since 6 is too big lol

#

Would be 7 if you also add a material parameter

high edge
#

Vector probably what you want

#

Can't remember if you have that by default lol

sterile hinge
#

you most likely want some kind of region/cuboid/aabb concept

merry knoll
#

i mean you just need 2 locations most likely

median rock
#

so uh... that thing I was tryna get working yesterday... well I've managed to get it working... but at what cost 😁

#

have to use an outdated spigot version (1.8) + use ViaVersion to allow updated clients + an outdated SQL database for the heads leaderboard plugin

#

somehow I dont think this is such a good idea

robust flower
#

@leaden sinew a friendly ping

stuck fjord
#

Hello, im looking for a rough price estimate for a plugin that includes the following:
.a command that gives you an item that allows you to shift click minecarts together (the command must have a cooldown of 5 minutes and only 15 minecarts can be attached together)
.a command that allows you to change the max speed of minecarts and the powered rail boost percentage
.vertical rails and upside down rails, vertical rails must be able to transition like shown in the photo
.a new type of track that moves trains at 3 blocks per second that can be toggled on/off by redstone and right clicking

merry knoll
#

this isnt the right place

stuck fjord
leaden sinew
# robust flower <@564600562172297216> a friendly ping
        if (this.clipboard == null) return null;
        final BlockVector3 min = this.clipboard.getMinimumPoint();
        final BlockVector3 max = this.clipboard.getMaximumPoint();
        final BlockArrayClipboard clipboard = new BlockArrayClipboard(this.clipboard.getRegion());
        clipboard.setOrigin(this.clipboard.getOrigin());
        for (int x = min.getBlockX(); x < max.getBlockX(); x++) {
            for (int y = min.getBlockY(); y < max.getBlockY(); y++) {
                for (int z = min.getBlockZ(); z < max.getBlockZ(); z++) {
                    clipboard.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
                }
            }
        }

        final Transform transform = new AffineTransform().rotateY(-rotation);

        BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
        Vector3 minInWorld = this.to.toVector3().add(transform.apply(clipboardOffset.toVector3()));
        Vector3 maxInWorld = minInWorld.add(transform.apply(clipboard.getRegion().getMaximumPoint().subtract(clipboard.getRegion().getMinimumPoint()).toVector3()));
        final org.bukkit.World bukkitWorld = BukkitAdapter.adapt(this.world);
        return new Region(
                WorldPosition.of(bukkitWorld.getUID(), minInWorld.getBlockX(), minInWorld.getBlockY(), minInWorld.getBlockZ()),
                WorldPosition.of(bukkitWorld.getUID(), maxInWorld.getBlockX(), maxInWorld.getBlockY(), maxInWorld.getBlockZ())
        );

This may help

dense drift
#

Does anybody know if material translation keys are accessible on 1.12.2 and lower? Maybe on NMS

rigid mountain
proud pebble
#

post the code?

rigid mountain
#
    public MongoDatabase database = client.getDatabase("TheVault");
    public MongoCollection<Document> empireCollection = database.getCollection("empires");
    public MongoCollection<Document> claimCollection = database.getCollection("claims");
    public MongoCollection<Document> playerCollection = database.getCollection("players");```
#

Might be a network error since im on a VPN

mystic gull
#

Hello, is there a way to set prefix of a group with the luckperms api ? i tried to find how but i cant

errant kraken
#

how do I make it so the intellij editor wraps text? it's annoying to edit YMLs and the lines can get really long

errant kraken
#

I can't find a setting for that in there

#

found it, it was in Editor > General

dense drift
#

is done trough meta

dense drift
#
final var node = PrefixNode.builder("prefix", priority).build()
group.data().add(node)
// save```
lyric gyro
#

smh spoonfeeding

dense drift
#

😢

#

ngl I love lp but for me at least the api was a little hard to understand at first 😐

mystic gull
#

Thank you, I think I had very misunderstood the doc now it seems more logical to me and I feel stupid

robust flower
leaden sinew
robust flower
#

What is the name of this functional pattern?

fun <K, V> Iterable<V>.whatIsMyName(keySelector: (V) -> Set<K>): Map<K, Set<V>> {
    val map = mutableMapOf<K, MutableSet<V>>()
    forEach { value ->
        val keys = keySelector(value)
        keys.forEach { 
            val valueSet = map.getOrPut(it) { mutableSetOf() }
            valueSet += value
        }
    }
    return map
}
#

It is similar to Kotlin's associateBy, but it returns a Set<K> instead of a single K, and the method takes care of associating the single value with all the provided keys

viral moth
#

ew kotlin

icy shadow
#

i dont think that has a name

#

seems very niche

#

associateByMany perhaps?

dusky harness
icy shadow
#

it doesnt exist

#

i just made it up as a name

dusky harness
#

oh

robust flower
frigid pollen
feral cloud
#

Hi guys, noob question sometimes /tps is related to the host of the server is the usage of memory?

#

I get like 14tps with 7gb out of 22gb in my server :/

past ibex
#

as long as you have enough memory, adding more memory won't help

#

profile your server with spark to see why it is lagging

viral moth
#

if you have a cpu that can't keep up with everything that's going on then you'll have tps loss

#

that doesn't mean you should upgrade your cpu but it means you should optimize your server so there is less going on, at least on the main thread

urban temple
#

can i use papi in a bungeecord plugin

#

?

tight junco
#

i dont think so

urban temple
#

alright

tight junco
#

not until papi v3

#

(when is that coming out?) who the fuck knows

edgy lintel
#

maybe when amogus 2 come out

feral cloud
high edge
tight junco
median rock
#

Also, you're right. The github is outdated. Latest plugin version is 4.0.something whereas the source is only 3.0. Couple of people asked him to push the updated source way back in 2017 but they got no response

frigid pollen
#

Huh okay yeah maybe I'll just fill that need for such a plugin

median rock
#

That would be bloody brilliant. Heck, even make it a premium resource, since there's no competing plugins

edgy lintel
median rock
#

Nah, mate, just a couple of cold ones and a snag on the barbie

median rock