#help-development

1 messages ยท Page 1850 of 1

young knoll
#

At least it isnโ€™t 1.8

tender shard
#

true lol

sage patio
#

I told you about our hostings, you don't remember?

tender shard
sage patio
#

๐Ÿ˜

tender shard
#

germany's largest role player server is also still on 1.12

dusty sphinx
#

? this is driving me a little up the wall lol

tender shard
#

but what I really don't understand is servers still being on 1.8

tender shard
olive lance
#

hcf servers gonna update to 1.18 soon enough

dusty sphinx
#

like

tender shard
#

Do you want to do stuff like
@SomeAnnotation("${project.version}") ?

dusty sphinx
#

in a plugin.yml you can use ${project.version} to get that property from maven

#

yeah

#

i cant filter the java as a resoruce

tender shard
#

hm yes it's possible

#

one second

#

but

#

it's a bit messy

#

you need the maven templating plugin

#

I once tried it, but as I said, it sucks

#

you don't want to use it unless you 100% have to

#

is there any reason why you need this?

sage patio
#

๐Ÿ˜

tender shard
#

ooh nice lol

dusty sphinx
#

no way

sage patio
#

๐Ÿ˜‚

dusty sphinx
#

making a template for myself

dusty sphinx
#

i mean this whole thing seems stupid ish but still

dark arrow
#

I have created a command "/vault" which opens up a inventry of 6 slots but there is a problem that when i do it

#

it opens fien but it cannot store my items

#

so is there any way to make it store my items that i keep?

young knoll
#

Youโ€™ll need to save it somewhere

dark arrow
#

yah but what is the class i need to call to save it?

#

i searched on spigot docs

#

but i am unable to find

young knoll
#

There is no magical class to save it

#

You need to make something

next robin
#

Hello, I don't know how to develop a plugin in 1.18. I created my spigot in 1.18 with BuildTools but when I add it to the library in intelliJ, I cannot extends JavaPlugin. Can you help me ?

young knoll
#

Read the update post

next robin
#

Oh, thx ๐Ÿ˜„

#

I didn't see it

dark arrow
young knoll
#

What

spiral light
dusty sphinx
#

is there a way to get the first developer in the developers property in maven

spiral light
sacred mountain
#

does anyone know how to use effectlib?

#

i need some help with yaw and pitch stuff

visual tide
sacred mountain
#

bruh

#

i know what yaw and pitch is

visual tide
#

oops

sacred mountain
#

idk how to implement it into my plugin as the builtin effect.yaw = float; doesnt affect the direction of the effect

visual tide
#

is there a setter maybe

#

idk which lib you mean

sacred mountain
#

i was thinking i had to use a vector

visual tide
#

slikey's?

sacred mountain
#

yeah

#

slikeys

#

read the wiki but he doesnt specify the yaw and pitch in the listed params

visual tide
#

hmm

sacred mountain
#

but it clearly exists because of this

visual tide
#

well is there a setter

#

or an alternative constructor

#

or something

sacred mountain
#

no clue

#

im a bad dev

#

i jus want to make this effect go straight up every time instead of west

sacred mountain
sacred mountain
visual tide
#

no like a method setPitch(float pitch)

sacred mountain
#

of

woeful crescent
#

ClassShopItem inherits from ShopItem. Any idea why I'm getting this exception?

quaint mantle
#

guys i have a problem with PacketPlayInUseEntity in 1.17

#

i want to get the action type of the packet

#

but its an interface and its changed

#

not an enum

#

if anyone knows please help

#

if you are going to recommend shitty apis like protocollib, dont reply

sacred mountain
#

protocollib isnt that shitty

#

smh

quaint mantle
#

it is
a lot of usage and hard to use api

#

now please answer my question if you know
no api just nms

woeful crescent
#

im dying out here

#

Just found out java is silly :(

#

It could be anything, not just Object

#

any specific to generic type parameter conversion is impossible (?)

quaint mantle
#

thats not reasonable

woeful crescent
#

what?

quaint mantle
#

what are you trying to do

woeful crescent
#

ok lemme show you

#

ClassShopInventory inherits from ShopInventory

#

But must take ClassShopItems

eternal oxide
#

inherits? Do you mean extends?

woeful crescent
#

yea

paper viper
#

? extends

woeful crescent
#

yea, are they different

#

whatev it's all good

#

yeah extends

wide coyote
#

he means <? extends X>

paper viper
#

^

woeful crescent
#

waiit

#

could I like

#

OHHH

#

one sec

woeful crescent
#

I feel stupid, as anyone should after receiving good programming advice.

#

Thank you again!

#

now I get why all those things said ? extends T instead of just T

sacred mountain
#

hey anyone here know how to use effectlib yaw and pitch

#

im dying

ivory sleet
woeful crescent
#

yea

#

tysm again guys

wide coyote
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!

wide coyote
#

what is the problem?

sacred mountain
wide coyote
#

wow..

#

dont repeat yourself

#

you wasted ~1000 lines for nothing

sacred mountain
#

i didnt type it up now

vestal moat
#

does the tab complete packet has Transaction id for legacy?

naive loom
#

I'm trying to run BuildTools (for 1.8.8) and I keep getting this error.

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Child module E:\SpigotBuildTools\BuildTools\Spigot\Spigot-Server of E:\SpigotBuildTools\BuildTools\Spigot\pom.xml does not exist @
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project org.spigotmc:spigot-parent:dev-SNAPSHOT (E:\SpigotBuildTools\BuildTools\Spigot\pom.xml) has 1 error
[ERROR]     Child module E:\SpigotBuildTools\BuildTools\Spigot\Spigot-Server of E:\SpigotBuildTools\BuildTools\Spigot\pom.xml does not exist
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [C:\WINDOWS\system32\cmd.exe, /D, /C, E:\SpigotBuildTools\BuildTools\apache-maven-3.6.0/bin/mvn.cmd, -Dbt.name=582a, clean, install]
        at org.spigotmc.builder.Builder.runProcess0(Builder.java:964)
        at org.spigotmc.builder.Builder.runProcess(Builder.java:895)
        at org.spigotmc.builder.Builder.runMaven(Builder.java:864)
        at org.spigotmc.builder.Builder.main(Builder.java:700)
        at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
red sedge
#

how can i send a message that when clicked opens a link

red sedge
quaint mantle
#

Quick question how do I check if there are still players in a world to unload the world afterwards ?

pale bear
#

maybe player.getWorld().getPlayers(); could work

quaint mantle
#

thank you I test it

tulip owl
#

What class shouldn't be static?

spare prism
#

is there a way to create a map that can contain repeating keys?

eternal oxide
#

keys are always unique

spare prism
#

ok

#

ty

sleek pond
#

Why do you need maps with repeating keys?

#

That kinda sounds like an xy problem

spiral light
#

well you can create a map with a list of values as value of the map ^^ that way you can store more then 1 value with the same key

quaint mantle
#

Or just use Guava Multimaps

sleek pond
#

You shouldn't really need repeating keys

#

Oil can't think of a situation in which you'd need them

spiral light
#

hmmm ... maybe storing many fake holos of a player in a list in a map / multimap

waxen plinth
#

Easiest way is Map<K, List<V>>

#

You can use a set or other collection if needed

spare prism
#

thanks for u all

young knoll
#

The easiest way is using the multimap from guava

vague stone
#

Short question
How can I get the max slots from a bungee server?

sage patio
#

Hi, I'm trying to create custom drops for Beetroot, this is my code but does not work

spiral light
#

which version ?

sage patio
#

1.12

spiral light
#

i think getBlock.getDrops.add will not work

#

getDrops just gives a copy of the drop-list

#

you should use block.getWorld().dropItemNatur...

sage patio
#

thanks

tulip owl
#

What is the event for a player sleeping

#

want to cancel it

spiral light
#

PlayerBedEnterEvent ?

sleek pond
sage patio
#

I did that yesterday

tulip owl
sleek pond
#

Obviously not hard enough

tulip owl
#

the javadocs couldn't find anything ๐Ÿ˜†

sage patio
tulip owl
#

ty

waxen plinth
#

@sage patio you're not calling setItemMeta

sage patio
#

I have a bigger problem now

#

if beetroot look like this, my plugin gives the player both beetroot and beetroot seed

waxen plinth
#

Well you aren't doing any checks

sleek pond
#

Figure out the beetroot growth stage

waxen plinth
#

You have to check the growth stage and determine the drops based on that

sage patio
waxen plinth
#

Ageable I think? Not sure

ancient plank
#

ageable yes

vague stone
#

Can someone help me please

#

.-.

waxen plinth
#

Max players?

#

Try googling "bungee get max players"

ancient plank
ancient plank
#

I've done a lot of things w/ custom farming ๐Ÿ˜”

sage patio
#

custom name for farmed drugs

ancient plank
#

it be like that

sage patio
#

like this?

spiral light
#

getBlock().getData()

#

getState just returns a "copy" of the current blockinformation

proud badge
#

getServer().getPluginManager().registerEvents(listener:this, plugin:this); What did i do wrong?

spiral light
#

listener: and plugin:

sage patio
young knoll
#

You canโ€™t specify arguments by name in java

ancient plank
#

idk what version you're on but on 1.16+ (these versions are what I've used, idk when it was implemented), there's Block#getBlockData()

ancient plank
#

ic

vague stone
#
            ByteArrayDataOutput out = ByteStreams.newDataOutput();
            out.writeUTF("PlayerCount");
            out.writeUTF("server");```

Is there a implementation like PlayerCount where I can get the Max of player?
ancient plank
#

๐Ÿคทโ€โ™€๏ธ then try it your way I suppose

true vault
#

This is from the ProtocolLib api documentation and i'm trying to get the Equipment Array (and from that the Equipment Slot), but the .getByteArrays() method did not work and getting a list failed, since i couldn't use the EquivalentConverter<T> it requested

ancient plank
#

kek

young knoll
#

Ahh legacy

ancient plank
#

memph

proud badge
# sage patio `new EventName()`

even more errors new = EventName(); getServer().getPluginManager().registerEvents(listener:this, plugin:this); I probably didn't do this right

young knoll
#

What

proud badge
#

wait

#

i just realised

#

i didn't

#

im an idiot

#

new EventName()getServer().getPluginManager().registerEvents(listener:this, plugin:this); nvm im still an idiot

sage patio
#

do it like this

proud badge
#

ok

#

do i have to do each getServer for each event?

sage patio
#

I don't know, I do that

young knoll
#

I mean you can store the pluginmanager to a variable

grizzled pollen
#

you can make one listener for all events

#

It is not necessary to make a bunch of listener classes for this

ancient plank
#

new = EventName();
I love this

young knoll
#

๐Ÿ™ƒ

proud badge
#

i didnt rewrite it properly

#

i have only 1 monitor atm

grizzled pollen
#

getServer().getPluginManager().registerEvents(new ListenerClassName(), this);

proud badge
#

ok

#

lemme try

grizzled pollen
#

Is your main class an Listener?

#

Or other class?

sage patio
#

I want to clear drops of a block break, but this is not working

proud badge
#

No idea i just started spigot plugin stuff 10 minutes ago, how do i check?

grizzled pollen
#

๐Ÿ˜

proud badge
#

._.

sage patio
#

or its in another class

grizzled pollen
young knoll
ancient plank
#

uh uh uh

proud badge
#

the event the onPlayerJoin? yes its in the same one

sage patio
#

BlockBreakEvent

grizzled pollen
#

Yes

#

Try?

ancient plank
#

there was smth strange with clearing the block drop list iirc

#

lemme go try n remember

grizzled pollen
grizzled pollen
#

^^

grizzled pollen
#

?paste

undone axleBOT
proud badge
#
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class Neddox extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        System.out.println("Neddox plugin successfully enabled");

        getServer().getPluginManager().registerEvents(new ListenerClassName(), this);
    }

    @Override
    public void onDisable() {
        System.out.println("Neddox plugin successfully disabled");
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
               System.out.println("yooo player joined");

    }
}```
grizzled pollen
#

getServer().getPluginManager().registerEvents(this, this);

sage patio
#

and another question, when you break the block under this beetroot, this drops a beetroot seed, how I Can change that or cancel that?

trim crystal
#
private void sendCooldown(Player player){
        if(cooldowns.containsKey(player)){
            int cooldown = (int) (cooldowns.get(player) * 10);
            StringBuilder msg = new StringBuilder();
            int i= 0;
            for(; i < cooldown; i++){
                msg.append(ChatColor.GREEN + "|");
            }
            for(; i < 50; i++){
                msg.append("|");
            }
            player.spigot().sendMessage(ChatMessageType.ACTION_BAR,
                    new TextComponent(msg.toString()));
        }
    }

Anyone knows why it just sends me "|||" * 50 in green color?

ancient plank
ancient plank
#

same with pistons

spiral light
trim crystal
#

My bad lol didn't reset the ChatColor on the second loop

sage patio
ancient plank
#

good question

sage patio
ancient plank
#

SOIL maybe?

sage patio
#

yea thanks

ancient plank
#

๐Ÿ‘

#

the mystical ghost ping ๐Ÿ˜”

spiral light
#

someone here that know how the biome-grassOverride-Color gets added to the default "grey" grass_block texture in the client ?
just adding the grassoverride to the grey won't work

sacred mountain
true vault
spiral light
true vault
#

2 times

#

there were other questions so i reposted it once now

true vault
sacred mountain
#

anyone know the best particle for a tornado effect

#

something grey

worldly ingot
#

brent, PL doesn't go based on the protocol documentation. That documentation states what type of field is sent over the network whereas PL makes use of the types of the fields in the class, which can differ

#

In the case of that packet, you want an EquipmentSlot to ItemStack Map

#

That's the one you're looking for

sage patio
#

this 4 logs are with same name, how I can detect them?

spiral light
#

blockdata

worldly ingot
#

If they have the same name they're probably in 1.12 or lower

worldly ingot
#

In which case, (1) please update... for the love of God, (2) use MaterialData of Wood

sage patio
worldly ingot
#

Then getSpecies()

spiral light
#

so complicated in 1.12 O.O

worldly ingot
#

Yeah not quite lol

spiral light
#

but not that complicated ^^

worldly ingot
#
MaterialData data = block.getState().getData()
if (data instanceof Wood && ((Wood) data).getSpecies() == TreeSpecies.OAK) {
    System.out.println("You have oak wood");
}```
sage patio
#

thanks

worldly ingot
#

Not using J16 features because 1.12

#

The MaterialData API was pretty incomplete. There are lots of areas where it just doesn't cover, but wood was at least one of them

young knoll
#

I vaguely remember that API

ancient plank
#

I worked with 1.12 for 3 months kek

worldly ingot
#

It was a decent attempt at abstracting away byte data, just never got finished before block states were added

ancient plank
#

a pain in the ass

#

so many INVENTORY update bugs man

sacred mountain
#

nvm my discord didnt load

sage patio
sacred mountain
#

pre 1.12 i forgot

#

yea

ancient plank
#

pre 1.13***

sage patio
#

my problem has been sloved, thanks anyway

sacred mountain
#

i didnt know treespecies was a

#

ok cool

ancient plank
#

ppl on 1.12 wouldn't get accurate inventory updates when I called the #update() function, ๐Ÿ˜” I didn't know it was a client side bug so I spent like 3 hours trying to fix it

vagrant saddle
#

How can I work with the Spigot API and Paper API at the same time for compatibility.
When I load my plugin in a Spigot Server it crash, because the ClassLoader (from the net-kyori-adventure API) dont find a Paper Class, but the plugin works when I load it a Paper Server.

(srry for my english)

young knoll
#

You can always just use the bungee chat API

spiral light
#

i think paper api adds just a few thinks ... you should stick to spigot api and use reflection to use paper api

ivory sleet
young knoll
#

PaperLib helps with a few things

#

You could make your own expanded paper lib I guess

ivory sleet
#

Think they just want to use adventure but since itโ€™s not shaded in spigot they get themselves a ncfde

young knoll
#

Ah

#

I would just shade it myself

#

Or stick to the bungee one

dense geyser
#

I know this is a stupid question, I don't actually know why I'm asking but here goes:

A friend I have works as a bug tester/QA member for a big server. They said that if they take photos or videos using software on their computer or screenshare the server on discord, the server owners know and have auto-ban scripts for it. This isn't possible is it?

#

why am I even asking this

young knoll
#

I mean

#

Maybe if the owner forced them to install some weird software

dense geyser
#

yeah, itd be weird if it did something like modified the packets that you sent to the server somehow, and it was detecting that, seems like they were telling half truths

sullen marlin
#

Weird af tbh

#

It's a Minecraft server, not designs for a nuclear missile

unreal quartz
#

mount a camera on a tripod and point it at your monitor

young knoll
#

Gotta have those NDAs

quaint mantle
#

redstone contraption as the key.

dense geyser
#

space satellite whichs only function is to see what their QA team are doing

#

there with that 8k camera

slow oyster
#

Am I tripping or does 1.18 not include the version in the NMS package names?

#

Or was that in 1.17 too?

paper viper
#

that was in 1.17 too

#

yes

slow oyster
#

Oh nice

#

That makes things much nicer

paper viper
#

Yeah

young knoll
#

CB still does sadly

slow oyster
#

It does?

#

I've been using CB and that's where I found out that it isn't used anymore?

hasty prawn
#

It still does

slow oyster
#

Ah so CraftServer etc?

hasty prawn
#

Yes

slow oyster
#

Gotcha

paper viper
#

CB smh

quaint mantle
#

hi, I have some code here that when I click a certain compass it opens an inventory this is the code: ```java
public void createInv(Player player) {
inv = Bukkit.createInventory(null, 9, ChatColor.GREEN + "something");

    m.tmeta.setDisplayName("Training");
    m.training.setItemMeta(m.tmeta);
    inv.setItem(0, m.training);

    m.pmeta.setDisplayName("President");
    m.president.setItemMeta(m.pmeta);
    inv.setItem(1, m.president);

    m.cmeta.setDisplayName("Clutch");
    m.clutchgod.setItemMeta(m.cmeta);
    inv.setItem(2, m.clutchgod);

    player.openInventory(inv);

}

@EventHandler
public void onInteract(PlayerInteractEvent e) {
    if (e.getPlayer().getInventory().getItemInMainHand() == com
            && (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)
                && e.getPlayer().getInventory().getItemInMainHand().containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL)) {

        createInv(e.getPlayer());
    }
}``` but for some reason when I click the compass it wont open the inventory... I don't know if the event for clicking the compass is the problem or if the creation of the inv is off
#

someone help?

dense geyser
#

First line of the event, don't == an itemstack

#

use .equals or .issimilar

drowsy bramble
#

what is default fly speed?

quaint mantle
drowsy bramble
#

in bps

#

sprint flying

quaint mantle
#

wait i clone those at the spigot stash

#

where do you guys got the cb from?

#

buildtools?

dense geyser
#

you want... The blocks per second speed of flight?

quaint mantle
#

i thought buildtools do the same

dense geyser
#

w-why @drowsy bramble ?

quaint mantle
#

or it use another url to clone huh....

dense geyser
#

craftbukkit is built into spigot

drowsy bramble
quaint mantle
#

imagine not knowing that. couldnt be me

#

yeah mine and buildtools cloned from the same url

#

hmm

#

how is it different

dense geyser
#

the maximum is somewhere around 8 at the default speed limit but idk

young knoll
#

If you look on the stash you will also find the version numbers are not there

dense geyser
#

wdym different

young knoll
#

I assume they are added at compile time

quaint mantle
young knoll
#

What do you mean

#

Sure they can

quaint mantle
#

ok lemme check

rough basin
#

The purpose of this code is to remove the Targeted entity starting from EntityTargetEvent.
But, if i spawn a snowman that satisfies the if statement in the code doesn't work and throws no error.
However, the snowman actually targets the target. Do you know any workarounds or errors in the code for this problem?

ancient plank
#

i love the marking out of the korean

#

i think that's korean at least

quaint mantle
#

how to remove all colors in a string?

young knoll
#

ChatColor.stripColor

mellow gulch
young knoll
#

Makes sense, the default walk speed is 0.1 iirc

mellow gulch
#

so take what im saying with a grain of salt, unless it is correct

young knoll
#

Is the default walk speed the same as the movement speed attribute?

mellow gulch
#

i think attributes work on different numbers than the api methods

hardy swan
#

Is there a way to increase the natural limit of a potion effect's amplifier?

young knoll
#

As in when brewing?

#

You can mess with custom brewing recipes

hardy swan
#

not brewing, say bad-omen

mellow gulch
young knoll
#

Ah

#

Probably not with a plugin

#

But you could listen for the kill event and add it yourself

hardy swan
#

that's the problem

drowsy bramble
#

Well its to get their speed for anticheat stuff

#

Idk if i coded it properly tho cuase it doesnt display the msg saying a bunch of stuff about speed

hardy swan
mellow gulch
#

you can probably get the velocities in a temporary move event handler for testing purposes

young knoll
#

So set it after

hardy swan
#

I am currently using pdc to keep track of player's previous omen level

drowsy bramble
#

Id send the code but im going to buy a ps3 rn so itll be like 2 hours until i can.

young knoll
#

That works

hardy swan
#

I don't know any way to tell the previous omen level (could be higher than 5) before the kill event without the pdc

#

but the pdc solution is not very nice, especially when effect can be applied through commands and what not

drowsy bramble
#

Ill create a thread tho when i get home about it

young knoll
#

I mean you can use the effect application event to detect the level from commands

hardy swan
#

I can

#

But i also do not really know how persistent is the pdc

young knoll
#

What do you mean

hardy swan
#

So I have to remove the record of the effect from the pdc manually after 40minutes when the effect vanishes.

young knoll
#

You can remove it with the event as wel

hardy swan
#

First, I am not absolutely convinced that players loggin in and out will always have the effect intact.

mellow gulch
left plover
#

Does spigot support item components like Knockback resistance?

young knoll
#

Yes

hardy swan
young knoll
#

As do effects

quaint mantle
#

they in nbt i think?

#

or maybe in worlld data

#

lemme check

hardy swan
young knoll
#

Yes

#

PDC is persistent

#

It's in the name

quaint mantle
#

it never remove by anything

#

unless you manually remove it

#

through codes, or delete the server file

hardy swan
#

Ok great then, current solution works.

mellow gulch
#

ya, i hope the metadatable stuff stays around because of that. sometimes you only need to tag stuff temporarily

hardy swan
young knoll
#

It will

#

Spigot doesn't remove much, and metadata isn't even deprecated

mellow gulch
#

because i still find uses for it, and i don't want to have to deal with trying to use pdc in a non-persistent way

quaint mantle
#

Oh no!

young knoll
#

I mean

quaint mantle
#

They do relocation

young knoll
#

Isn't metadata just a fancy map

quaint mantle
#

that sadge

mellow gulch
#

sure, but same can be said about pdc and nbt kinda

#

they all map keys to values

young knoll
#

Yes but that handles saving for you

mellow gulch
#

cross-plugin communication is a thing built into metadtable isn't it?
as in if i write 2 plugins, they can see eachothers metadatable keys and values.

foggy estuary
#

?paste

undone axleBOT
mellow gulch
#

if i had to use my own map i'd also need to have some interface for providing access to the non-owning plugin

foggy estuary
young knoll
#

Yes

#

That is the main uses, but not many people use it

foggy estuary
#

yup

young knoll
#

So if you add a sysout there it works

foggy estuary
#

manager.registerEvents(new ScoreboardDM(), this);

mellow gulch
#

(srry for ping, just almost missed that statement you sent)

young knoll
#

Iโ€™m aware

foggy estuary
young knoll
#

If you add a print line in the event, does it work

foggy estuary
#

oh right

#

it does not

#

strange

junior briar
#

i'm trying to understand new version of java after 9 with eclipse. does anybody know how to import classes from jdk.internal.loader package?

#

1.17.1 is forcing me to use java 16 it seems

paper viper
#

those arent meant to be imported

junior briar
#

just learning. i have old projects contain features of class loaders. so i want to understand the new version and maybe find a proper way to port them.

wet breach
junior briar
#

no matter since we're talking about new version.

quaint mantle
#

hey, Bungeecord API question here..

is it possible to get an offline ProxiedPlayer..? I imagine it is, but i'm really not sure - i poked around the javadocs but i couldnt find anything helpful

buoyant viper
#

does bungee save player data?

quaint mantle
#

i'm really not sure

#

idk exactly what this means, but ProxiedPlayer has it

wet breach
quaint mantle
buoyant viper
#

?jd

quaint mantle
#

oh im on the wrong

#

lets try the OFFICIAL javadoc then

wet breach
#

alright but if you come back stating you can't find anything, my question is the same ๐Ÿ™‚

quaint mantle
eternal oxide
#

Bungee is not like a server. It only deals with connections and it only relates to active players

quaint mantle
buoyant viper
#

that's what i'm thinkin

eternal oxide
#

Why do you want offline?

quaint mantle
#

/whois

eternal oxide
#

I don;t see a use case

#

whois shoudl give you info on a live player

buoyant viper
#

maybe like a get last server connected to

#

network wide seen

quaint mantle
wet breach
quaint mantle
wet breach
#

when you can just improve the one on the mc servers

#

seems a bit redundant and inefficient

quaint mantle
#

because the bungeecord /whois shows information that i dont want to use plugin messaging channels for?

wet breach
quaint mantle
wet breach
#

what information does bungeecord provide that the mc server doesn't already have? o.O

quaint mantle
#

i have Litebans' api inside of the bungeecord plugin ._.

wet breach
#

ok but you are literally not acknowledging the point I am saying

quaint mantle
#

ok thanks

wet breach
#

you have a plugin already on your mc servers you can improve

#

would make sense that one of them needs removing/improving

rough basin
wet breach
#

I recommend adding some debug code so you can follow exactly what is going on

left plover
#

Is there any documentation about percentage rates of knockback resistance for netherite?

buoyant viper
#

yeah, 100%

#

jk

#

it just feels like that when i hit someone in netherite

left plover
#

Pog cat

#

I agree

#

And there is next to no documentation on knockback resistance rates

wet breach
#

its probably in the code ๐Ÿ™‚

left plover
#

Time to dive into source

wet breach
#

really have no idea if its documented there or not

young knoll
#

The scale of horizontal knockback resisted from attacks and projectiles. Vertical knockback is not affected. Does not affect explosions.[3] 1.0 is 100% knockback resistance. 0.4 means 60% of knockback is applied.

torn shuttle
#

clearly you guys aren't l33t pvp players like me who knows the details of knockback like I know the back of my hand

buoyant viper
#

u ever take a moment to appreciate ur hands

#

all the muscles and tendons controlling the movements

#

barely even having to think about the movement u want to do

torn shuttle
#

if we were 200 years into the future I'd already have chopped them off to replace them with synthetic hands

wet breach
#

they have betrayed me

torn shuttle
#

truly you have forgotten the feeling of the back of your father's hands

wet breach
torn shuttle
#

don't judge the man, cartons of milk and packs of cigs are surprisingly hard to come by

wet breach
buoyant viper
torn shuttle
#

you have an anime pfp so some might argue you don't know it well enough

foggy estuary
#

?paste

undone axleBOT
foggy estuary
#

for example

#

15:00 minutes and not

#

900 seconds

young knoll
#

Divide by 60 to get minutes

#

And then mod 60 for the remaining seconds

#

There probably some kind of library out there to handle that for you though

#

Try SimpleDateFormat or DateTimeFormatter

left plover
young knoll
#

I assume that is 1.0, so it should be 100%

#

But last I checked it still acted like a chance, even though it shouldnโ€™t

candid galleon
mellow gulch
#

on behalf of the world; hello MSWS

midnight quarry
#

can we spawn NPC without NMS now?

#

I saw a NPC class in Bukkit API and tried something like this

#

But I get this error: java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.NPC

young knoll
#

Doesnโ€™t that tell you your answer

midnight quarry
#

what?

young knoll
#

But I get this error: java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.NPC

midnight quarry
#

I mean if there's a NPC class, I was wondering if there's a way to spawn it

#

without NMS

young knoll
#

NPC is just an interface to group together traders

#

The javadocs state this

midnight quarry
#

okay

quaint mantle
#

Is it possible to use getOfflinePlayer and if the user is offline you can still get their statistics and their xp level etc?

candid galleon
#

not natively no

quaint mantle
#

So I would have to store their stuff if I wanted to get their statistics of an offline player?

lost matrix
quaint mantle
#

Ah great

young knoll
#

But not level, etc

#

Maybe that could be a fun addition

quaint mantle
#

Ah ok that makes sense

candid galleon
#

plugin specific sure

#

otherwise sounds like a memory hog

young knoll
#

Meh

#

You would have to actively request it

quaint mantle
#

So any statistics would work but getting their xp level wouldnโ€™t ye?

lost matrix
#

two more ints for xp/lvl dont seem so bad. Its as if mojang just introduced two new statistics

quaint mantle
#

Ye that and inventory or smth would be nice

young knoll
#

True

#

But inventory and such

#

My thought was to have an explicit OfflinePlayer#loadData

lost matrix
#

Or implement it lazy.

#

Which doesnt rly work as all data is saved in one file anyways...

young knoll
#

Yeah

tribal sparrow
#

so when you fly into the ground with elytra on is there a way to detect that using damageevent? i've tried damagecause CONTACT but that doesn't work i've got this so far

    public void damage(EntityDamageEvent event) {

        if(event.getEntity() instanceof Player) {

            Player player = (Player) event.getEntity();
            if(hasElytra(player.getInventory())) {
                if(event.getCause() == EntityDamageEvent.DamageCause.FLY_INTO_WALL ||
                        event.getCause() == EntityDamageEvent.DamageCause.CONTACT) {
                    player.getWorld().createExplosion(player.getLocation(), 3.5f);
                }
            }
        }
    }

    public boolean hasElytra(PlayerInventory inventory) {
        if(inventory.getChestplate() != null && inventory.getChestplate().getType() == Material.ELYTRA)
            return true;
        return false;
    }```
#

currently it works perfect when flying into a wall

young knoll
#

Itโ€™s fall damage

#

Contact is cactuses

tribal sparrow
#

true, that would work.
however that would fire if i just jumped down while wearing it, is there a proper way to see if somebody is flying with elytra?

young knoll
#

isGliding iirc

tribal sparrow
#

thank you very much ๐Ÿ™‚ i should of thought more into this before asking lol

tidal skiff
young knoll
#

PlayerQuitEvent

quaint mantle
#

I am trying to detect if an ender dragon egg is burnt, what code could I use to find if the dropped item is indeed a dragon egg?

@EventHandler
    public void onEggBurn(EntityCombustEvent e){
        World w = e.getEntity().getWorld();

        getLogger().info("item combusted");
        if (e.getEntity().getType() == EntityType.DROPPED_ITEM) {
lost matrix
#

Cast the Entity to Item -> get the ItemStack -> get the type (Material)

#

maybe you can just get the type directly from the Item

#

Nope you need to get the ItemStack first

quaint mantle
#

also

#

im getting this error

#

java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.CraftOfflinePlayer cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_17_R1.CraftOfflinePlayer and org.bukkit.entity.Player are in unnamed module of loader 'app')

#

from the following code

unkempt peak
#

For some reason when i place a torch connected to a wall and try to detect it on BlockPlaceEvent with event.getBlock().getType() == Material.TORCH it doesn't work but it works fine if i place a torch on top of a block. Does anyone know why this happens?

lost matrix
quaint mantle
#

tysm

quaint mantle
# quaint mantle from the following code

response = user.getName() + "/n" + user.isOnline() + "/n" + user.getLastPlayed() + "/n" + blocksmined + "/n" + itemscrafted + "/n" + user.getStatistic(Statistic.PLAYER_KILLS) + "/n" + user.getStatistic(Statistic.MOB_KILLS) + "/n" + user.getStatistic(Statistic.DEATHS) +"/n" + user.getStatistic(Statistic.BELL_RING);.

candid galleon
#

well the error tells you

#

OfflinePlayer cannot be cast to class org.bukkit.entity.Player

lost matrix
young knoll
#

I think itโ€™s WALL_TORCH

unkempt peak
#

ahh ok that makes sense

young knoll
#

Is that still a thing in modern versions?

quaint mantle
#

ohhh im stupid

#

i was making a player class not an offlineplayer one

unkempt peak
#

i didn't think so but ig it is

young knoll
#

If Mojang didnโ€™t replace that with block states imma be upset

unkempt peak
#

Yeah lol that's why i didn't even think to check for a separate material

young knoll
#

They didnโ€™t

#

Ahhhh

unkempt peak
#

why mojang

young knoll
#

I guess there is a somewhat valid reason

lost matrix
#

time to be update

young knoll
#

The normal torch has a tag that the wall one does not

unkempt peak
#

what tag is that

young knoll
#

wall_post_override

unkempt peak
#

ah that makes sense

green prism
#

hey guys, I have a question... I'm using "\n" to break the line in the lore configuration line but I get [LF]
(Like in the photo - I am using 1.15.2 (Server, plugin and client version) with Via Version)
Can you help me?

https://i.imgur.com/dGLBOZD.png

quaint mantle
#

maybe you cant do that?

#

make a list<string> then set it in the lore

vagrant stratus
#

?paste

undone axleBOT
mellow gulch
rough basin
#

Is player.setPlayerListName Effects in chat?

sullen marlin
#

setDisplayName does

prime reef
#

is there a reason doing YamlConfiguration#saveConfiguration(File) isn't actually saving the file?

#

like what would cause that

spiral light
#

saveConfiguration ?
save(file) should be the way to safe it

prime reef
#

ah sorry

#

i am using save

#

my bad

#

Yeah, it's not saving the actual information

#

which is weird since it's being set as far as i know

spiral light
#

as far as you know ??
i think you should take a look at your code and should know if something gets set/added/removed

sage patio
#

I want to remove 1 Beetroot from player's inventory, but this code removes all of beetroots

spiral light
#

best way to do this is probably iterate through all items and if found set the Amount of the item -1

sage patio
#

thanks

#

some thing like this

spiral light
#

if the player has the item in the mainhand for the action you can do this .... not sure about 1.12 but you should check if the new ItemAmount == 0 and then set the item in hand to null

sage patio
#

I already have required checks thanks

#

lemme show you

#

"Foroosh" in my lang means Sell

#

and works :D

tidal skiff
#

anyone know how to fix (Player) moved wrongly

#

?

spiral light
#

your server is too slow or the player is too fast

tidal skiff
#

im making a trap plugin and one of the traps when u step on it makes u teleport away but its messing with that teleport

spiral light
#

do you just teleport or set velocity too ?

tidal skiff
#

i just use Player.teleport()

sage patio
spiral light
#

string#replace(a,withB)

sage patio
#

Can I replace withB with nothing?

spiral light
#

yeah just ""

sage patio
#

just ""

#

yea thanks

tidal skiff
#

its making it so the player just doesnt teleport at all

#

it teleports in creative not in surviavl tho

#

survival*

spiral light
#

well you could try to run it in a new bukkittask ...

tidal skiff
#

ill try but how would that help

spiral light
#

not running in the same tick where the player could have interact with smth .... i think this will help

spiral light
#

not rly

#

you can set it but visiually its not there

visual tide
#

it is there visually if below 128

sage patio
#

How I can check if player's INC_SACK's durability is 3? ( I want to check for this item stack : )

spiral light
#

get durability ?

#

yes thats intended

#

by addItem

sage patio
tardy delta
#

You can compare the type with ==

spiral light
#

equals should be more future proove ^^

tardy delta
#

Mwoa

dapper ether
#
Cannot determine path to 'tools.jar' library for openjdk-17 (C:/Users/felix/.jdks/openjdk-17.0.1)

Error when trying to build my project in intellij to the spigot debugger thing

chrome beacon
#

Try reinstalling your jdk

#

?jdk17

#

?java17

undone axleBOT
dapper ether
chrome beacon
trim crystal
#
92 private void updateCooldown(){
93        Bukkit.getScheduler().runTaskTimerAsynchronously(main, new Runnable() {
94            @Override
95            public void run() {
96                if (!cooldowns.isEmpty()) {
97                    cooldowns.forEach((player, cooldown) -> {
98                        if (cooldown - 0.05f > 0f) {
99                            cooldowns.replace(player, cooldown - 0.1f);
100                      } else {
                            cooldowns.remove(player);
                        }
                        sendCooldown(player);
                    });
                }
            }
        }, 0L, 1L);
    }

Error:

[Rprison] Plugin Rprison v1.0-SNAPSHOT generated an exception while executing task 435
java.util.ConcurrentModificationException: null
        at java.util.HashMap.forEach(HashMap.java:1424) ~[?:?]
        at RPrison.rprison.mining.MiningManager$2.run(MiningManager.java:97) ~[?:?]
        at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.18-R0.1-SNAPSHOT.jar:3359-Spigot-dbf4938-4f5d59a]
        at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) [spigot-1.18-R0.1-SNAPSHOT.jar:3359-Spigot-dbf4938-4f5d59a]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:833) [?:?]

Anyone knows what's the problem?

trim crystal
maiden briar
#
public void onArenaJoinEvent(PlayerArenaJoinEvent e)
    {
        CachedArena arena = e.getArena();
        Player player = e.getPlayer();

        PartyDataRequestCallbackAPI.getInstance().fetchPartyData(player, (player1, partyData, i) ->
        {
            int playersInParty = partyData.getAllPlayers().size();
            int maxPlayers = arena.getMaxPlayers();
            int maxPlayersInTeam = arena.getMaxInTeam();
            int currentPlayers = arena.getCurrentPlayers();

            if(currentPlayers + playersInParty > maxPlayers || playersInParty > maxPlayersInTeam)
                e.setCancelled(true);
        });
    }

The problem is that I can't cancel the event in time, because messaging takes some time

dapper ether
trim crystal
#

Oh sorry, the problem is with th JDK not spigot

#

mb

maiden briar
#

The part is in a (custom) runnable, but when I call e.setCancelled(true) the event is already executed and cancelling doesn't matter anymore

spiral light
#

the cancel will not affect the event because it will not run in the same tick the even is fired

maiden briar
#

Exactly

#

That is the problem

trim crystal
#

Can you disconnect the player then?

maiden briar
#

Disconnect????

#

I just want to check the party from another plugin

trim crystal
#

from the arena, let him join then kick him lol

tardy delta
spiral light
#

so you will need to get the data without desync or store the data somewhere else.... you can also cancel the event instant and after checking you can add the player by hand

trim crystal
maiden briar
#

I can cache the data, but how do I know when I have to cache it?

spiral light
trim crystal
#

then remove from that map and then replace the og with the copy?

maiden briar
#

SO I have to cache it every tick? Isn't that a little bit laggy?

#

Also, cancelling the event will result that the bedwars plugin immediately searches for another arena

spiral light
trim crystal
#

Oh, Thanks!

burnt current
#

hey i have a quick question: i am trying to integrate in my plugin that a player can claim chunks. For this purpose, the X and Z coordinates of the respective chunk are strung together and separated from each other with a "." for a certain action of the player. (String chunkID = chunk.getX() + "." + chunk.getZ();)
Afterwards this chunk ID is stored in a database. I created the two corresponding tables as follows: https://www.toptal.com/developers/hastebin/habemotope.sql
now i am trying to query if a chunkid is assigned to a specific player. However, when I then enter statements like this into MySQL:
SELECT playername FROM playerdata, chunks WHERE chunkid = '13.4';
I get not only the player name that belongs to the chunkid but all player names that are stored in the table.
Can anyone help me with this?

restive tangle
#

My JDA guildMessageListener does not fire at all,

    public void onEnable() {
        discordBot = new DiscordBot(getConfig().getString("discordBotToken"));
        discordBot.connect();

        discordBot.getJda().addEventListener(new DiscordMessageEvent(this));

    }
public class DiscordBot {

    JDA jda;
    private final String token;

    public DiscordBot(String token){
        this.token = token;
    }

    public void connect(){
        try {
            jda = JDABuilder.createDefault(token)
                    .enableIntents(GatewayIntent.GUILD_MESSAGES)
                    .build()
                    .awaitReady();
        }catch (LoginException | InterruptedException e){
            e.printStackTrace();
        }
    }

    public void sendMessage(MessageChannel channel, String message){
        channel.sendMessage(message).queue();
    }

    public JDA getJda() {
        return jda;
    }
}```

```h
public class DiscordMessageEvent extends ListenerAdapter {

    Main plugin;
    public DiscordMessageEvent(Main plugin){
        this.plugin = plugin;
    }

    final String prefix = "/";

    public void onGuildMessageEvent(MessageReceivedEvent event){
        event.getChannel().sendMessage("Test").queue();
    }
#

What am I doing wrong?

chrome beacon
#

I recommend asking the jda discord

#

Also I belive listening to messages for commands is deprecated

#

Use the slash command feature

ivory sleet
#

Try put @Override over the event method and youโ€™ll see why it isnโ€™t valid

trim crystal
#

@ivory sleet how are you?

ivory sleet
#

The event callback method

restive tangle
#

MessageReceiveEvent?

#

I tried it with guildmessage.. too.

ivory sleet
#

Thatโ€™s not what I said

#

I told you to put @Override on it

#

If you do that, you can properly validate at compile time that you are indeed overriding a valid event callback.

sharp prawn
#

Hello, which itemflag is used to remove enchantment glow?

tacit drift
#

can't

#

to give an item a glow you need to enchant it

#

to remove the glow, remove the enchant

sharp prawn
#

So it's client side?

ivory sleet
sharp prawn
#

Will using packets work?

ivory sleet
#

Idk sounds like a dumb workaround

sharp prawn
#

Well I have registered custom enchantments and only want the glow to show up when they are applied while the base custom items already have one or two vanilla enchantments

quaint mantle
#

setGlowing

#

i thought bukkit have that?

ivory sleet
#

I mean you could ofc send packets lying to the client that the item does not have any enchantments

quaint mantle
#

wait that is not item

ivory sleet
#

But like itโ€™s a duct taped workaround

quaint mantle
#

that is for entities lol

sharp prawn
ivory sleet
#

No because the game and its api doesnโ€™t have your best interest in mind sadly

sharp prawn
#

Welp duct tape it is

split panther
#

using packet a dumb is not really a dumb idea

#

many of the time packet level stuff is also way more efficient

quaint mantle
#

clumpy ninjas!

trim crystal
#

You could always recreate your the enchantments using lore, but if it's something like efficiency you can't since you need to change the breaking speed (been there didn't do that since it's impossible nowadays)

ivory sleet
#

Efficiency but you lose safety

split panther
#

not really

ivory sleet
#

Yes

split panther
#

That would be the case if you're not fully understand how Minecraft networking works

trim crystal
#

most of the time if you use packets you lose safety

ivory sleet
#

Having high abstractions around low level implementations help you to design safe stuff safer since the abstraction will limit you to a lot of stuff

#

It is a fundamental gain-loss concept

split panther
#

if you know what you are doing, you'll be able to write your own packet abstraction layer instead of relying on Bukkit/Spigot one.

At the end of the day, entire Minecraft server is pretty much a huge TCP abstraction

spiral light
#

enchantment glowing on itemstacks only if custom enchantments applied ?

trim crystal
spiral light
#

they CAN break on each version

ivory sleet
sage patio
#

Hello, I made a plugin for custom farming item names, when a player breaks a Carrot for example, my plugin removes the original Carrot and drops a Carrot with Custom name and Lore, but there is a problem
problem is if player don't have permission to break the block ( worldguard cancels the block break, ), my plugin drop the custom farm again, what should I do ?

spiral light
#

just check if event.isCanceled

split panther
sage patio
ripe burrow
#

Hi does anyone have idea how to make long cooldown(1day, 1week etc.)

split panther
#

And do you think Mojang have compile time validation when they develop their abstraction layer? testing is a thing

ivory sleet
sage patio
#

like this ?

sharp prawn
spiral light
#

yes

sage patio
#

thanks again

ivory sleet
trim crystal
split panther
sharp prawn
spiral light
acoustic pendant
#

Why this way to check if players item in hand is null doesnt' work?

spiral light
#

because getInventory.getItem already can be null

#

and "null" does not have the method isSimilar

#

getItem != null would be enought

acoustic pendant
#

but

#

it sends errors to the console

trim crystal
#

What errors?

spiral light
#

NPE probably

acoustic pendant
#

says that item is null

spiral light
#

yes

acoustic pendant
#

when i don't have nothing

spiral light
#

and null cant have the method isSimilar

ripe burrow
#

thanks ๐Ÿ™‚

trim crystal
#

first if or second one?

acoustic pendant
#

i did it like this, and keep sending errors

spiral light
#

in the second line ?

sage patio
#

same bug

acoustic pendant
spiral light
trim crystal
#

You could also use the worldguard api

spiral light
sage patio
#

both ideas are nice and thanks

#

I do the second

trim crystal
#

np

acoustic pendant
#

sorry

trim crystal
#

lol

burnt current
#

hey i have a quick question: i am trying to integrate in my plugin that a player can claim chunks. For this purpose, the X and Z coordinates of the respective chunk are strung together and separated from each other with a "." for a certain action of the player. (String chunkID = chunk.getX() + "." + chunk.getZ();)
Afterwards this chunk ID is stored in a database. I created the two corresponding tables as follows: https://www.toptal.com/developers/hastebin/habemotope.sql
now i am trying to query if a chunkid is assigned to a specific player. However, when I then enter statements like this into MySQL:
SELECT playername FROM playerdata, chunks WHERE chunkid = '13.4';
I get not only the player name that belongs to the chunkid but all player names that are stored in the table.
Can anyone help me with this?

drowsy helm
#

you need to leftjoin it

split panther
drowsy helm
#

are you using a foreign key in chunks?

sharp heart
#

do anyone know how to change color name above player's head ? (1.8 version)

drowsy helm
#

use scoreboard teams

sharp heart
acoustic pendant
#

is there any event that fires when players put armor on?

drowsy helm
sharp heart
#

I used team's prefix and after add players in the team

#

but didn't work..

burnt current
acoustic pendant
drowsy helm
drowsy helm
split panther
burnt current
drowsy helm
#

yeah you need to left join

#

or subquery

tardy delta
#

reminds me of learning sql at school

#

then i forgot most of the stuff for my exam

sharp heart
drowsy helm
#

i.e does a team prefix work at all?

burnt current
drowsy helm
#
SELECT playername FROM playerdata WHERE playerid IN (SELECT playerid FROM chunks WHERE chunkid = '13.4');```
#

something along the lines of that

burnt current
#

i dont know

#

I could not find anything else about this

earnest anvil
#

hey. whenever trying to create a npc with the executers skin, the skin is black but got some textures on the inside. does anybody know why?

    private void setSkin(GameProfile target, Player playerSkin) {
        GameProfile playerProfile = ((CraftPlayer) playerSkin).getHandle().getGameProfile();
        System.out.println(playerProfile);

        Property property = (Property) playerProfile.getProperties().get("textures").toArray()[0];
        String texture = property.getValue();
        String signature = property.getSignature();

        target.getProperties().put("textures", new Property("textures", texture, signature));
    }
earnest anvil
#

okay looks like the texture doesn't pass the outlines of a skin

#

does anybody know how i can pass them?

left swift
#

Hey, does anyone know how I can register attributes for my entity type? this is my current way, but it doesn't always work, it randomly throws a null exception that occurs when attributes are not registered. (API 1.17.1)

    private static <E extends Entity> void setDefaultAttributes(EntityTypes<E> type){
        try {
            final Field field = AttributeDefaults.class.getDeclaredField("b");
            field.setAccessible(true);
            Map<EntityTypes<?>, AttributeProvider> attributes = new HashMap<>((Map<EntityTypes<?>, AttributeProvider>)field.get(null));
            attributes.put(type, EntityInsentient.w().a());
            Utils.setField(field, null, attributes);
        } catch (NoSuchFieldException | IllegalAccessException exception) {
            exception.printStackTrace();
        }
    }```exception```fix
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.ai.attributes.AttributeProvider.a(java.util.function.Consumer, net.minecraft.world.entity.ai.attributes.AttributeBase)" because "this.d" is null
    at net.minecraft.world.entity.ai.attributes.AttributeMapBase.e(SourceFile:48) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
    at java.util.HashMap.computeIfAbsent(HashMap.java:1224) ~[?:?]
    at net.minecraft.world.entity.ai.attributes.AttributeMapBase.a(SourceFile:48) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
    at net.minecraft.world.entity.EntityLiving.getAttributeInstance(EntityLiving.java:2333) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
    at net.minecraft.world.entity.EntityLiving.<init>(EntityLiving.java:292) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
    at net.minecraft.world.entity.EntityInsentient.<init>(EntityInsentient.java:132) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
    at net.minecraft.world.entity.EntityCreature.<init>(EntityCreature.java:17) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
    at pl.tuso.xentitydev.entities.type.EntityDev.<init>(EntityDev.java:84) ~[?:?]
    at pl.tuso.xentitydev.entities.Snail.<init>(Snail.java:28) ~[?:?]
    at pl.tuso.xentitydev.events.DevCommand.onCommand(DevCommand.java:29) ~[?:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
    ... 19 more```
sharp heart
#

The name above player head didnโ€™t change

lapis lark
#

First time see this exception. Are you know what is it?

java.lang.AssertionError: TRAP
    at net.minecraft.world.item.ItemStack.N(ItemStack.java:188)
    at net.minecraft.world.item.ItemStack.e(ItemStack.java:1186)
    at net.minecraft.server.level.PlayerInteractManager.a(PlayerInteractManager.java:444)
    at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1602)
    at net.minecraft.network.protocol.game.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:28)
    at net.minecraft.network.protocol.game.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1)
    at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:30)
    at net.minecraft.server.TickTask.run(SourceFile:18)
    at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:151)
    at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.c(SourceFile:23)
    at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1157)
    at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:1)
    at net.minecraft.util.thread.IAsyncTaskHandler.y(SourceFile:125)
    at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1136)
    at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1129)
    at net.minecraft.util.thread.IAsyncTaskHandler.bp(SourceFile:110)
    at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1112)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1037)
    at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:303)
    at java.base/java.lang.Thread.run(Thread.java:833)
spiral light
#

is there any reason why a thread with .setDeamon(true) will still block the mainthread ?

maiden briar
lapis lark
ivory sleet
#

Itโ€™s the opposite

#

Or well

#

The application will not await a daemon threads termination

#

but it sounds like youโ€™re just joining said thread

spiral light
# ivory sleet What

i want to iterate through a list of files that will then load and handle a lot of data -> loop will wait for each entry finish before next starts...

now i created a thread that should run for each entry ... but starting the thread and setting it to deamon=true will still block the process of the others while not finished

ivory sleet
#

Send your code

#

Because it sounds like youโ€™re using daemon erroneously

spiral light
ivory sleet
#

thread.run

#

Itโ€™s .start()

#

Run just runs the runnable inside

spiral light
#

that makes sense ^^

ivory sleet
spiral light
ivory sleet
#

Which might not be a great idea depending on what exactly youโ€™re doing

maiden briar
#

Yep, I have to integrate a new party plugin. I can do that by implementing an interface. The problem is that the interface wants direct results, but messaging takes time

ivory sleet
#

Yup

maiden briar
#

So I have to cache the parties every tick (async)

#

Hopefully that is not too intensive for the server

ivory sleet
#

do whatever crappy workaround you might find, itโ€™s very hard to manage a multithreaded plugin in correlation to spigot sometimes

maiden briar
#

Yes

left swift
ivory sleet
#

Like why not just reconfigure them on the entity spawn event

left swift
#

The problem is, I don't quite know how to do this, I can't spawn an entity until I register its attributes.

ivory sleet
#

Is it a custom entity?

left swift
#

Custom entity type

spiral light
ivory sleet
#

Tusoo

#

When do you call that method

#

You might wanna call it very very early on

left swift
left swift
spiral light
#

in 1.17 i had smth like this

left swift
#
    public static <E extends Entity> EntityTypes<E> register(EntityTypes.b<E> entity, String name, EntityTypes<?> model){
        EntityTypes<E> type = IRegistry.Y.a(
                IRegistry.Y.getId(model),
                ResourceKey.a(IRegistry.l, new MinecraftKey("experimental", name)),
                new EntityTypes<>(entity, model.f(), true, model.b(), model.c(), model.d(), ImmutableSet.of(),
                        model.m(), model.getChunkRange(), model.getUpdateInterval()), Lifecycle.stable()
        );
        setDefaultAttributes(type);//here
        return type;
    }```
ivory sleet
#

And when is that

trim crystal
#

Where should I find a resource that shows how to make custom mobs?

spiral light
trim crystal
#

Yep that's the problem lol

left swift
# ivory sleet And when is that

here i register that type

private static final EntityTypes<EntityDev> DEV = register(EntityDev::new, "entity", EntityTypes.c);```and i use this in the constructor```java
super(DEV, ((CraftWorld) location.getWorld()).getHandle());```
spiral light
#

its not thaaaaaat complicated but since i know something about your skill-lvl it would be to complicated i guess

ivory sleet
#

Tuso, you might wanna try putting the attribute before registering the type

#

Idk

#

Like in modding we usually just do it with an event (as thatโ€™s when I touch nms the most)

left swift
spiral light
#

in the constructor of the CustomEntity:

registerGenericAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
registerGenericAttribute(Attribute.GENERIC_ARMOR);

hardy swan
#

bruh i got stuck in a piece of code for so long thinking that PotionEffectType is enum

#

and was comparing them via == ._.

ivory sleet
hardy swan
#

sometimes public constants of class with names ending with Type do be misleading

spiral light
#

normally there is smth like
Tag.UNDERWATER_BONEMEALS.isTagged(material)

spare prism
#

Hello. I'm encountering a trouble with PAPI (it doesn't set the placeholders).
I use this code: PlaceholderAPI.setPlaceholders(player, s);
PlaceholderAPI.setPlaceholders(offlinePlayer, s);

#

Output:

ะ’ะฐัˆ ะฝะธะบ: %player_name%
ะ’ะฐัˆ ะฟะพัะปะตะดะฝะธะน ะทะฐั…ะพะด ะฝะฐ ัะตั€ะฒะตั€: %player_last_join_date%
#

(I have this expansion installed on my server)

left swift
earnest anvil
spiral light
#

hmm i never rly tested to register the entity into minecraft because i got some errors .... i spawned the villager and just overwrote the moving/attacking data stuff and also sended a player spawn packet instead of the villager spawn packet ... if a chunk gets unloaded i saved the custom villager in a extra file and removed it from the chunk .... when the chunk loads again the file gets readed and spawn the customvillager again

chrome beacon
spare prism
# chrome beacon Make sure you use the string that it returns
            case "stats": {
                if(!DiscordUtils.isVerified(event.getAuthor())) {
                    event.getChannel().sendMessageEmbeds(embedManager.errorEmbed(Message.ACCOUNT_IS_NOT_VERIFIED.getText())).queue();
                    return;
                }

                String messageToSend = "";
                for (String s : Message.STATS_FORMAT.getStringList()) {
                    messageToSend += s + "\n";
                }


                Player player = DiscordUtils.getPlayer(event.getAuthor());
                System.out.println("isEnabled: " + Main.getInstance().getPapiManager().isEnabled());
                if(player != null) {
                    Main.getInstance().getPapiManager().setPlaceholders(player, messageToSend);
                } else {
                    OfflinePlayer offlinePlayer = DiscordUtils.getOfflinePlayer(event.getAuthor());
                    Main.getInstance().getPapiManager().setPlaceholders(offlinePlayer, messageToSend);
                }

                event.getChannel().sendMessageEmbeds(embedManager.infoEmbed(messageToSend)).queue();
                break;
            }
#

lol

#

I'm so dumb

#

I didn't assign the value

#

XD

chrome beacon
#

ouch

spare prism
#

ty anyways

gentle oriole
#

hi, i have a problem with setDeathMessage. So what happens is, The error message only displays for a short period of time on the death screen. How do I fix this?

spiral light
#

does the player get respawned or what happens with the death screen ?

gentle oriole
#

The player does not get respawned and the death screen will update so that it doesnt have any death messages

#
public class Killer implements Listener {
    static String message = null;

    public static void kill(Player player, String newMessage) {
        message = newMessage;
        player.setHealth(0.0D);
    }

    @EventHandler
    public void onDeath(PlayerDeathEvent e) {
        if (message == null) {
            return;
        } else {
            e.setDeathMessage(e.getEntity().getPlayerListName() + " died because " + message);
            message = null;
        }
    }
}
dark arrow
#

how can i make passive mobs agressive?

quaint mantle
#

maybe check if a passive mob has touched a player or something like that and then deal damage?

#

I would also like to see the answer to this question

dark arrow
#

ohh

#

i want to make it so that passive mobs will get atracted to u

quaint mantle
#

stracted?

dark arrow
#

then will give the damage

quaint mantle
#

ok so I am pretty sure that you have to use NMS

dark arrow
quaint mantle
#

you can make pathfinders I believe

dark arrow
#

ohh

quaint mantle
#

I can't help you on the topic on nms tho... I am terrible at it and it is just bad

dark arrow
#

is it possible that i can make invisible food(which attracts the mob) on teh player so he will come towards u

rustic mica
#

I am pretty new to making plugins, anyone knows of a way to make items with custom textures?

spiral light
#

with resourcepacks

#

if you have the resourcepack and for example inksack with durability 10 is a gun you need to set the durability of t he item to 10

round elbow
#
@EventHandler
    public void onInteract(PlayerInteractEvent e) {
        if (e.getAction().equals(Action.PHYSICAL)) {
            if (e.getClickedBlock().getType() == Material.HEAVY_WEIGHTED_PRESSURE_PLATE) {
                Location spawnpoint = e.getPlayer().getBedSpawnLocation();
                YamlManager manager = new YamlManager();
                if (manager.getStartCheckPoint().equals(e.getClickedBlock().getLocation())) {
                    if (!startedAnAttempt.containsKey(e.getPlayer())) {
                        new ParkourAttempt(e.getPlayer());
                        e.getPlayer().sendMessage(Parkour.prefix + "You have started a parkour attempt. get to the end checkpoint as fast as possible!");
                        startedAnAttempt.put(e.getPlayer(), true);
                    } else {
                        e.getPlayer().sendMessage("You have already started a parkour attempt");
                    }

                }

so i have this piece of code but the problem is, it spams alot if a player stood still on the pressure plate, any help?

spiral light
#

check if he is in startedAnAttempt ^^

round elbow
#

I did that

spiral light
#

oh ... the msg "You have already started a parkour attempt" spams ?

round elbow
#

Ye

spiral light
#

create a new list that contains players that already got that msg

gentle oriole
#
public class Killer implements Listener {
    static String message = null;

    public static void kill(Player player, String newMessage) {
        message = newMessage;
        player.setHealth(0.0D);
    }

    @EventHandler
    public void onDeath(PlayerDeathEvent e) {
        if (message == null) {
            return;
        } else {
            e.setDeathMessage(e.getEntity().getPlayerListName() + " died because " + message);
            message = null;
        }
    }
}

Can anyone help me with this? The custom death message works fine, but it disappears after a few seconds. The player does not get respawned and the death screen will update so that it looks like it doesnt have any death messages.

round elbow
spiral light
gentle oriole
spiral light
#

if the e.setDeathMessage wont work its probably a version bug

gentle oriole
spiral light
#

probably a Map with Player - String to be sure its only the player you want to be dead with that custom msg

#

a specific time ?

gentle oriole
#

I haven't measured it

#

But it disappears after a few seconds

#

3-5 seconds i think

spiral light
#

weird.... it does not say it will show up in death screen

#

do you use mods for this ?