#help-development

1 messages · Page 1550 of 1

eternal oxide
#

yamlFile.getKeys(false)

digital plinth
#

can i get the item stack of an arrow from a projectile launch event

lunar wedge
#

I'd like to only get it from a Child of keys. So all keys after
Player.Homes

eternal oxide
#

all depends how you have it stored

#

getConfigurationSection("Player.Homes").getKeys(false)

lunar wedge
#

Thank you that should work!

digital plinth
#

wtf why are armor stands living entity

#

how?

#

how 2 get the itemStack

mental bone
#

Cast it to itemstack?

#

and yeah they're entities not tiles

mental bone
mental bone
#

though that's a super confusing question

tired dagger
#

So, I am trying to hide the auto tab complete page but am apparently doing something wrong. This is what I have and I am not sure what is wrong. I know the event is registered because I tried another event and it worked.

eternal oxide
#

Not spigot then

tired dagger
#

Hmm?

eternal oxide
#

nm, I typod

#

You didn't make any changes to the available commands

tired dagger
#

Yea, I know but the debug message didn't go through

mental bone
eternal oxide
#

I've never used that event but I'm certain command updates are only sent when the update is called or permissions are changed

mental bone
#

In any case, I think you'll need to use protocollib or nms

tired dagger
eternal oxide
#

the command map is sent on player login and when update is called

tired dagger
#

It works with that method but not in the way I need it to

eternal oxide
#

That method is only when they make a selection

tired dagger
#

Yeah, ik it was the method I tried to make sure the event handler was registering

eternal oxide
#

Are you expecting a list of commands to be sent every time the player opens a command prompt?

mental bone
#

isn't there another event?

granite stirrup
#

fuck you discord

eternal oxide
#

Thats not how it works

granite stirrup
#

wont auto read channels i go to :(

tired dagger
#

Wdym?

eternal oxide
#

The command map is sent when a player joins the server or a manual update is called.

#

otherwise no update is needed so no event

#

The client already has a populated command map when they open the command prompt. It needs no event

mental bone
tired dagger
#

This is what the TabCompleteEvent does

eternal oxide
#

Sounds more like what you are looking for

#

However it only happens on args

tired dagger
#

yeah

eternal oxide
#

If you want to block commands you have to use the other event, but that only fires when teh initial map is sent. and that could be when the player logs in

granite stirrup
#

u sure the command map just get sent when the player joins? im pretty sure if you edit the command map when players are on im sure it does actually update for everyone

dusty estuary
#

guyz one thing is driving me crazy is that i need admin perms to drag and drop a new version of my plugin into the server plugin folder
and after i authorizr admin perm

eternal oxide
#

Yes, there are specific times it can be sent. On join, when a command is changed or an update is called. but its not when he's expecting, when the player opens a tab complete

dusty estuary
#

it said access deny

granite stirrup
#

for blocking commands couldnt use just use onCommand?

eternal oxide
#

Not what he's trying to do

dusty estuary
#

but i am admin of the computer

granite stirrup
#

whats is he trying to do

dusty estuary
#

so why it doesnt allow me to copy and paste the plugin

tired dagger
#

I'm trying to hide the default commands

eternal oxide
#

Then do it when teh command map is sent

#

Thats the only opportunity you get.

granite stirrup
#

i thought TabCompleteEvent fires when someone presses tab?

eternal oxide
#

thats only for args

dusty sphinx
#

How can I get all the Advancements a player has obtained?

dusty estuary
#

its just dumb

#

guyz so how to solve this stupid issue

eternal oxide
dusty estuary
#

@eternal oxide you dont need to do that before

#

I got admin perms

#

but it just say access deny

eternal oxide
#

Yes your jar is in use

dusty sphinx
granite stirrup
#

:)

dusty estuary
#

i know

#

but it used to just replacr

granite stirrup
#

just copy and paste easy fix

dusty estuary
#

without me needing to STOPPING the server every time i compile

compact haven
#

you need to restart the server anyways to refresh the plugin

granite stirrup
#

i gotten used it

dusty estuary
#

i used copy paste

compact haven
#

just stop the server and add the plugin

granite stirrup
#

ctrl c ctrl v?

dusty estuary
#

I AM USING COPY PASTE

dusty estuary
#

but it said i need admin perm

granite stirrup
#

it should prompt a replacement

dusty estuary
#

and then access deny

#

it prompted

tired dagger
granite stirrup
dusty sphinx
#

You are misreading my question

#

I want to get all the Advancements a player has completed

tired dagger
#

Then getAwardedCriteria()?

dusty sphinx
#

I don't want to have to iterate through all the advancements and test to see if it isDone

#

Sidestepping that, how can I reset the advancement progress

azure phoenix
tired dagger
#

revokeCriteria

#

Pretty sure you're going to have to end up iterating through them

dusty sphinx
#

shame

#

who needs performance

dusty sphinx
#

Nah

#

Different use case

#

That won't do here

split egret
#

Only solution seems to be to iterate through AdvacementProgresss

dusty sphinx
#

yeah im doing that

split egret
#

It wouldn't be that bad on performance

#

It would also probably have to do it internally anyway

eternal oxide
#

Its an iterator so you could probably run it Async reasonably safely

dusty sphinx
#

Can't run async, need to block, its a long story with jank code

#

Should just rewrite it

#

Plus yeah it prob wont be that bad

eternal oxide
#

If you are making changes then yes sync, if only reading then Async is fine

dusty sphinx
#

Well then blocking should be fine since I do need to write changes

#
            Iterator<Advancement> advancementIterator = this.plugin.getServer().advancementIterator(); // Bad, but this is the only way to do this.
            while (advancementIterator.hasNext()) {
                Advancement advancementToCheck = advancementIterator.next();
                AdvancementProgress advancementProgress = player.getAdvancementProgress(advancementToCheck);
                for (String criteria : advancementProgress.getAwardedCriteria()) {
                    advancementProgress.revokeCriteria(criteria);
                }
            }```
#

¯_(ツ)_/¯

eternal oxide
#

You basically want to reset all advancements?

dusty sphinx
#

Effectively, yes.

granite stirrup
#

Bukkit.getServer().advancementIterator()?

dusty sphinx
#

?

#

I'm using that

granite stirrup
#

wouldnt that be the same as this.plugin.getServer().advancementIterator()

dusty sphinx
#

yes

#

and it is

#

i'm just doing the latter for consistency's sake, and i prefer it that way

#

both return functionally identical objects

granite stirrup
#

do you even need advancementToCheck ?

turbid silo
#

How can I have a delay before doing a function?

dusty sphinx
#

Nah I could make it a oneliner

granite stirrup
#

also for the for loop if u wanted you could remove the {} since its a the end of the while loop and its one line

#

but you can keep it i mean its kinda nicer to keep it

dusty sphinx
#

i want my code to retain some readability so nah

granite stirrup
#

k

#

omggg ctrl shift t is a life saver

#

i accidently closed a tab i didnt want to close

#

lol

#
<?php include 'something.php'; ?>``` didnt know this would work lol
#

since i thought it wouldnt work one line

#

lol

eternal oxide
#

whitespace is irrelevant in most scripting languages

granite stirrup
#

lol so the space kinda acts like a newline/seperator apparently if you put it in one line cuz if you remove the space between <?php and include it will error

#
<?php include'something.php';?>
``` <-- cursed
hollow river
#

Hey my illagers sometimes spawn as captain when i summon them with my plugin, i can't find online how to guaranteed not make them captains does anyone know?

granite stirrup
#

read the docs :)

#

Illagers extend that Raider class so you can use it on a Illager object

#

im pretty sure it is that

hollow river
#

Ive looked there and used both set methods to false but some were still spawning as patrol/raid captains (or at least with a banner)

granite stirrup
#

¯_(ツ)_/¯

hollow river
#

I might just listen to the entitypotionevent thing and check if its caused by a captain and then cancel it

#

Oh well

#

Just dont want them to give bad omen (custom raid so omen is gonna mess it up)

granite stirrup
#

hmm maybe you have to set it after the entity spawns?

#

try that first

tired dagger
#

@eternal oxide Progress 🙂

dusty herald
#

🎊

eternal oxide
#

Are you using a broken permission plugin?

dusty herald
#

I had an idea of doing that before

eternal oxide
#

removing a permission shoudl remove teh command from tab complete

dusty herald
eternal oxide
#

GroupManager does

dusty herald
#

yeah if the developer decides to use plugin.yml permissions but some just use their own permission checking

tired dagger
#

I don't have a perms plugin installed on it rn because it's just my code testing server

dusty herald
#

oh I thought u were doing tab complete checking 😂

tired dagger
#

I am

#

xD

granite stirrup
# tired dagger

what if you had essentials:creative i believe essentials.creative isnt the permission for it? unless it is

eternal oxide
#

Use a decent perms plugin and all your code is redundant

dusty herald
tired dagger
#

I'll try adding a perms plugin but I don't think it will change anything. All the other commands were hidden properly

#

It's just been the default Minecraft/Spigot/Bukkit commands that are being difficuilt

eternal oxide
#

If the player doesn;t have the command permission pushed to Bukkit calling a Player#updateCommands() will remove it from teh command map thats sent to the layer

tired dagger
#

It does for plugins but I don't think it does that with the built in server commands

dusty herald
#

even luck perms does this elgar 😂, if you don't have permission for /plugins the tab completion will still show

#

at least when i did it

#

🤷

eternal oxide
#

It doesn;t I tested this exact thing with /plugins only yesterday

dusty herald
#

wtf

tired dagger
#

I'll try it one sec

dusty herald
#

ig my install is fucked lemme update

granite stirrup
#

whats a good font?

eternal oxide
#

- -bukkit.command.plugins removes plugins from tab complete using GroupManager

#

its a default permission setting in GM

tired dagger
#

Told you

eternal oxide
#

?

#

unless you specifically removed the permission they are default assigned

tired dagger
#

Ugh, okay. One sec

digital plinth
#

i cant cast the .getEntity to an itemStack

tired dagger
#

It somewhat worked

eternal oxide
#

somewhat?

tired dagger
#

Still shows the minecraft commands

eternal oxide
#

have you tried negating their perms?

tired dagger
granite stirrup
#

i dont think bukkit.* or minecraft.* works

tired dagger
#

the bukkit one did

granite stirrup
#

oh but minecraft.* doesnt

#

i believe

tired dagger
#

yeah

eternal oxide
#

sec and I'll test

#

yep, Minecraft root commands are not overridden by permissions

tired dagger
#

RIP

#

Trash Spigot

#

jk

young knoll
#

I mean does it really matter

#

They still can’t use them

eternal oxide
#

um, sec. It seemed to work here

#

nope, my mistake

#

Yeah, he's trying to remove from tab complete

granite stirrup
eternal oxide
#

tab complete is updated via permissions for all commands EXCEPT base MC commands

young knoll
#

Nice

eternal oxide
#

yes, you can remove teh permission, but tabcomplete still shows that command (MC only)

granite stirrup
#

ik

young knoll
#

I’m sure we’ll survive with them in tab complete

granite stirrup
#

ye

digital plinth
#

is it possible for me to stop snowballs from being thrown if i right click snowballs at a specific block

#

like obsidian

tired dagger
#

Yes

granite stirrup
#

you check if a player rightclicked a block
and if they did check if the block is the block you dont want snowballs being able to be thrown at
then check if they are holding a snowball
if so cancel the event

#

i think PlayerInteractEvent is what you need

hexed hatch
#

You’d be better off not checking the trajectory of the snowball and cancelling the throw event and instead just cancelling the projectile hit event on the specific block

digital plinth
#

but the snowball is still getting thrown :/

tired dagger
#

Try cancelling the projectile launch event

granite stirrup
digital plinth
#

i cant see if the player is aiming at a block

#

in that event

#

i have a idea

#

but it might be a bit weird

#

so i make a boolean

#

aimAtBlock

#

and i set the booleans to true through playerInteract

#

and if it is true

#

then i cancel the projectileLaunch

tired dagger
#

I'd use a method

digital plinth
#

ahh yes

#

my method worked

wicked inlet
#

hi, im trying to change type of every mob that spawns to creeper, the problem is EntitySpawnEvent (and CreatureSpawnEvent) events are not fired for some mobs

    @EventHandler(priority = EventPriority.HIGHEST)
    public void onEntitySpawn(org.bukkit.event.entity.EntitySpawnEvent e) {
        if (plugin.isActive()) {
            if (e.getEntityType() != EntityType.CREEPER) {
                if (!ignoredEntityTypes.contains(e.getEntityType()) && e.getEntity() instanceof LivingEntity) {
                    e.getEntity().getWorld().spawnEntity(e.getLocation(), EntityType.CREEPER);
                    Bukkit.getLogger().info(e.getEntityType().toString());
                    e.getEntity().remove();
                }
            }
        }
    }

this is my event handler
as i said, not all mobs are changed to creeper,
i can still see sheeps, pigs, cow (mostly passive mobs)

digital plinth
#

am i a genious or something :>

tired dagger
#

Something like:

public void onProjectileLaunchEvent(ProjectileLaunchEvent event, Material block)
etc...
tired dagger
#

I'm not positive if you'd pass it as material tho, it might be something else

#

Its something like that though

digital plinth
#

btw how do i get the item stack of a fired arrow

#

i cant convert the projectile from ProjectileLaunch to a itemStack

tired dagger
#

I thought you were firing a snowball?

young knoll
#

Don’t cancel the event

digital plinth
#

i also fire arrows

digital plinth
#

it worked

#

by canceling it

young knoll
#

Iirc it’s event.setUseItemInHand

digital plinth
#

are you talking about

young knoll
#

The interact event is special and has two things you can cancel

#

Actually it looks like setCancelled just cancels both

#

So it should work

digital plinth
#

e.setUseItemInHand(Event.Result.DENY);

digital plinth
#

it didn't work

#

anyways

#

i fixed that issue

#

btw how do i get the item stack of a fired arrow
[10:41 PM]
i cant convert the projectile from ProjectileLaunch to a itemStack

#

theres a EntityShootBow event

#

but i dont think the .getConsume method gives you the consumes arrow

young knoll
#

What

#

You don’t think the getConsumable method gives you the consumed item

digital plinth
#

it gives you that?

mental bone
young knoll
#

What else would it give you

digital plinth
#

then i messed up somehwere

frosty tinsel
#

I said I made it based, so it is similar. And if you are noticing this kind of stuff, you will surely be able to make your own.

wicked inlet
young knoll
#

You do know you can still import it

mental bone
#

yes but if the plugin is active it'd work anyways, and if it weren't it wouldn't work

#

and you should probably refactor the class

mental bone
young knoll
#

Unless you have a class with the same name in the same package as the bukkit one which you don’t

digital plinth
#

oh i see

#

it worked

#

i got the itemStack

#

but how am i gonna track the arrow now

young knoll
#

What

wicked inlet
digital plinth
#

i cant get an instance of the arrow as a projectile

young knoll
#

What are you trying to do

digital plinth
#

adn get its uuid

#

and stuff

digital plinth
#

they lose the data

#

so im trying to track the arrow with custom model data

mental bone
young knoll
#

...

#

So just get the shot arrow and add some data to it?

digital plinth
#

i pick up a noral arrow

#

normal*

young knoll
#

Apply data to the entity

#

And read that in the arrow pickup event

digital plinth
#

i cant get the entity?

#

only the iemstack

eternal oxide
digital plinth
#

is there a way to convert itemstack to entity?

eternal oxide
#

its still an Entity there

digital plinth
#

ohh

#

bruh im an idiot

young knoll
#

You really need to learn to use the javadocs

eternal oxide
#

and the event has getItem so you can see the itemStack

digital plinth
young knoll
#

getConsumed*

digital plinth
#

.getItem

#

lol

young knoll
#

Consumable

#

Close enough

mental bone
digital plinth
#

waht?

mental bone
#

shhh

digital plinth
#

i use Intellij

mental bone
#

im having like 4 convos at the same time

digital plinth
#

do i want

#

XD

digital plinth
mental bone
#

anyways, doesn't it give you autocompletes?

digital plinth
#

it does

mental bone
#

because you can usually just scroll through those to see if it does what you want

digital plinth
#

well i was being an idiot

#

and forgot

mental bone
#

you're fine haha

digital plinth
#

.setDurabilty((short) 0 )

#

is not breaking the item

#

wtf

young knoll
#

Iirc it won’t unless you use it again

#

I’m not sure there is a way to break an item other than setting it to null and playing the break item entity effect

digital plinth
#

but the item's like

#

durability bar

#

didnt chage

sage swift
#

le deprecated method

digital plinth
#

change*

digital plinth
#

its deprecated

#

so what?

sage swift
#

that means you shouldn't fucking use it

digital plinth
#

i remember removing an item from the player inv is possible with in-game cmds

digital plinth
young knoll
#

Use the replacement

sage swift
#

what are you trying to do

young knoll
#

Which the javadoc should tell you

sage swift
#

if you want to break the item then set the inventory slot to null...

young knoll
#

And play the break effect if you want that

digital plinth
#

i did exactly that

keen kelp
#
[14:27:53 INFO]: [GameManager] Disabling Game v0.0.10
[14:27:53 INFO]: [GameManager] Enabling Game v0.0.10
[14:27:53 WARN]: Enabled plugin with unregistered PluginClassLoader Game v0.0.10
#

How do I fix this

sage swift
#

the hell you doin in the onDisable bro

keen kelp
#

what

jade perch
keen kelp
#

I just use the same

#
public void reloadGameManager(CommandSender sender)
    {
        PluginManager pluginManager = Bukkit.getPluginManager();
        Plugin plugin = pluginManager.getPlugin("Game");

        if(pluginManager.isPluginEnabled("Game"))
        {
            pluginManager.disablePlugin(plugin);
        }

        pluginManager.enablePlugin(plugin);
    }
jade perch
#

Umm why

tired dagger
#

what....

keen kelp
#

Why as in?

jade perch
#

That whole function

keen kelp
#

Cause I want to reload it?

#

Or is that now how u do it ._.

jade perch
#

You can reload your plug-in without literally reloading it

young knoll
#

You generally only reload external data

#

Ie configs

keen kelp
#

How

#

What

digital plinth
#

change it

keen kelp
#

No Im not trying to reload the config

#

Im reloading the jar

#

Because I'm developing the plugin being reloaded aswell .-.

jade perch
#

Show us your main class

keen kelp
#

Which

#

The plugin being reloaded?

jade perch
#

Sure

young knoll
#

Don’t reload plugins like that

keen kelp
#

It's pretty big and it worked fine when I reload with ServerUtils

young knoll
#

Restart the server, use plugman, or use /reload

keen kelp
#

That's the thing

#

I want to make my own reload

young knoll
#

Well

#

Don’t

jade perch
#

Just wanna see your onenable and ondisable

young knoll
#

Plugins shouldn’t be reloaded on a live server

keen kelp
#

Why not

young knoll
#

Because it breaks things

keen kelp
#

am I suppose to restart the server every time I make a single line of code of change?

young knoll
#

In dev just use /reload

#

Or plugman

keen kelp
#

It's slow

#

That's the whole point, I dont want to use an external plugin

young knoll
#

Have fun breaking more things then

keen kelp
#

Breaking what

#

the plugin that's designed to work with reloads?

#

It's just a warn

#

not an error

tired dagger
#

Get an instance of your main class and then disable/enable the plugin using PluginManager

keen kelp
#

it works fine

tired dagger
#

There might be a reload method, I'm not sure

young knoll
#

Does doing that even reload the contents of the jar

keen kelp
#

That's what I was thinking

digital plinth
#
[23:36:50] [Server thread/ERROR]: Tried to load unrecognized recipe: bukkit:122a26e0-0351-4025-a8ed-5eb34c1c9779 removed now.
[23:36:50] [Server thread/ERROR]: Tried to load unrecognized recipe: bukkit:3732c498-6089-4a9e-885b-d3dd9ee4bb44 removed now.
[23:36:50] [Server thread/ERROR]: Tried to load unrecognized recipe: bukkit:122a26e0-0351-4025-a8ed-5eb34c1c9779 removed now.```
#

wut is this

tired dagger
#

It should?

young knoll
#

Last I checked plugman had to do a bit of hackery to release the lock on the jar

tired dagger
#

Ah, it may but I figured it just called onDisable();

#

But I was just going based off the log

sage swift
#

absolutely just use plugman reload

keen kelp
#

It's not even that big wdym

tired dagger
#

132 lines

keen kelp
#

Most are error messages

stone sinew
#

Why would you use plugman to reload a plugin with its own reload command?

tired dagger
sage swift
#

why would you have a reload command that disables and enables the plugin within the plugin itself

stone sinew
tired dagger
#

Testing purposes

tired dagger
sage swift
#

no.. just use something like plugman for that

tired dagger
sage swift
#

use PlugWoman then, can vouch™️

tired dagger
#

*Plugperson

stone sinew
#

PlugApachiHelicopter

tired dagger
compact haven
#

ManPlug

compact haven
sage swift
#

no joke

iron condor
#

is it possible to make custom enchants appear in enchantment tables?

sage swift
#

not with the hover, but you can modify the end result

iron condor
#

thanks

young knoll
#

What happens if you register them into the proper registries

#

I’ve never tried

sage swift
#

same way that server-side enchantments don't show on items, they won't show in the table

iron condor
#

And what about combining efficiency 5 in the anvil to get 6?

sage swift
#

l1 == l2 ? l1+1 : Math.max(l1, l2)

young knoll
#

Do they just not appear in the table, or they just don’t visually show since they lack a localization

sage swift
#

the latter

young knoll
#

Ah

sage swift
#

custom enchantments show the glow but no text

young knoll
#

So you gotta use lore

#

I’m surprised it doesn’t show minecraft.enchantment.name.4 or something

jade perch
#

Don't use lore for enchantments

#

Use PDC

#

Always

sage swift
#

we were talking about the display for the client

loud island
#

What's the difference between using Player#hasPermission & vault's Permission#has/Permission#playerHas?

#

Is there any reason to use vault's over Player#hasPermission?

unreal quartz
#

well one needs vault

#

the other doesn’t

loud island
#

So there's no real reason to use vault for permissions checking in this case?

unreal quartz
#

no

loud island
#

ty

unreal quartz
#

plugins like luck perks directly inject code into the Player class and override the behaviour of the hasPermission method to make sure it works

cinder thistle
#

Guys I need help

#

My dick

unreal quartz
#

luck perms*

cinder thistle
#

It’s stuck

cinder thistle
#

In a wood chipper

unreal quartz
#

i’m sorry to hear that

cinder thistle
#

I can’t get it out

#

anyways i am mmaking a plugiin to ban noobs form my server

#

can someone give me workign code that do this

jade perch
#

Sure

#

If you give me money

cinder thistle
#

ok

#

get my dick out of the wood chipper and you will give me the codes to make it work

#

good deal

frosty tinsel
dusty herald
#

imagine using names 😂

#

shame on u

frosty tinsel
dusty herald
#

UUID!!

frosty tinsel
#

Lmao, it's a joke lol

dusty herald
#

yes

#

and so was i

cinder thistle
#

mods ban

#

he use d inapropriatee lanGuage

frosty tinsel
#

Do you think you are funny?

lament bronze
#

elllo

cinder thistle
#

🤣 🤣 🤣

#

What a sussy impostor

frosty tinsel
#

No, I am asking? lmao

cinder thistle
#

Exactly my point

#

I did not ask

dusty herald
#

hey creeper

#

how are u

cinder thistle
#

pregnant

#

hbu?

dusty herald
#

oh no

#

congratuatls

#

i am good just about to head to bed

cinder thistle
#

Time is almost 4:20 so I suppose it’s almost time to give birth

dusty herald
#

wish them happy birthday

cinder thistle
#

well it’s not like they’ll be alive for their next birthday

#

or tomorrow for that matter

#

oh my god ITS HAPPENING

#

okay the weirdness has somewhat left me

rotund pond
#

Aïe 🤐

dusty herald
#

mans sleeping

earnest sonnet
#

the heck did I miss

dusty herald
#

leave him be

rotund pond
dusty herald
#

I mean an easy way is to skip verifying an inventory is that inventory via names and use custom inventory classes

frosty tinsel
rotund pond
#

Mh okay, let's see

dusty herald
#

ill show u my inventory template rq

#
public class InventoryThingy implements InventoryHolder {
    private final Inventory inventory;
    private final somepluginname plugin;

    public InventoryThingy(somepluginname plugin) {
        this.inventory = Bukkit.createInventory(null, 9, "title or whatever");
        this.plugin = plugin;
    }

    @Override
    public Inventory getInventory() {
        return this.inventory;
    }
}```
#

then u can check if the opened inventory is an instance of that class

rotund pond
#

Oh ?!
Okay I see

#

Tu

#

Ty

dusty herald
#

something like this

#
if (!(event.getInventory().getHolder() instanceof InventoryThingy)) {
            return;
        }```
rotund pond
dusty herald
#

also you don't even need the plugin variable, it's just part of my template

#

good night

rotund pond
#

Ty, good night too

rugged topaz
#

how would i disable crafting in the 2x2?

alpine radish
rugged topaz
#
@EventHandler
    public void onInventoryClick(InventoryClickEvent event) { // disables crafting in the inventory 2x2
        if (event.getInventory().getType().equals(InventoryType.CRAFTING)) {
            event.setCancelled(true);
        }
    }```

this completely disables clicking in the inventory
alpine radish
#

dont use equals when comparing enums

rugged topaz
#

o okay

alpine radish
#

use == instead

#

and are u sure that // disables crafting in the inventory 2x2 ?

#

probably will disable 3x3 too

rugged topaz
#

there's a WORKBENCH enum

#

plus, i use a custom crafting menu anyway

alpine radish
rugged topaz
#

all g

alpine radish
#

i hate namings in spigot/bukkit/minecraft

rugged topaz
#

nah that disables the inventory too

#

gonna just figure INVENTORY and CRAFTING are both always opened together

alpine radish
#

lmao 😂

rugged topaz
#

so i'd have to check for raw slots

dusty herald
#

maybe prevent items from being put into the crafting inventory idk

#

now I'm go bed now for real

alpine radish
#

i can handle this guys 😂

dusty herald
#

3:33 am here

#

sleepy time

alpine radish
#

11 am here, u are at gmt-5 xD

rugged topaz
#

gotta be a way to modify the output of the 2x2

#

on this server, placing a leather chestpiece and a dye in the 2x2 makes the output (of a white chestplate) appear for a second, then quickly disappears

#

i'm just not sure if it's possible w the spigot api

dusty herald
#

just prevent users from opening their inventory

rugged topaz
#

yea ok

alpine radish
dusty herald
#

InventoryOpenEvent is not triggered when a players inventory is opened sadly

#

so you'd have to spam open them a new inventory every tick and close it one tick later to bypass any inventory from being opened

alpine radish
#

just try to check top inventory's size. Dont sure will it work

dusty herald
#

I mean unless they interact with the inventory nothing will happen which fucking sucks balls

#

I hate client sided things

#

ok ok for real sleep

rugged topaz
rugged topaz
#

but night

rugged topaz
#

?

dusty herald
rugged topaz
#

couldn't tell lmao

dusty herald
#

sorry

rugged topaz
#

is coo sleep well

dusty herald
#

yes.

rugged topaz
#

is there a way to modify all recipes dealing with dye

#

the only issue is being able to dye armor in the 2x2

rugged topaz
#

which made me realize

#

instead of event.getInventory() i should've been using e.getClickedInventory() which solved all my issues

#

lmao thanks

alpine radish
#

so, just use

alpine radish
#

theres getTopInventory and getBottomInventory methods

rugged topaz
#

nah because top inventory is always CRAFTING when the inventory is open

alpine radish
#

you gonna just check size

#

CRAFTING or anything doesn't matter

rugged topaz
#

my issue's already solved:

    @EventHandler
    public void onInventoryClick(InventoryClickEvent e) { // disables crafting in the inventory 2x2
        if (e.getClickedInventory().getType() == InventoryType.CRAFTING) {
            e.setCancelled(true);
        }
    }
alpine radish
#

🤷‍♂️ oki

noble spire
#

What's the best way to get rid of the first item in a String[]? In python you'd use splicing: arr[1:], In Java I'm using Arrays.stream(arr).skip(1).toList(), although it seems there's probably a better way..

celest nacelle
#

I know this isnt spigot but does anyone know how I can add string nbt data in 1.16 nms

eternal oxide
#

?pdc

noble spire
#

awesome

celest nacelle
#

the problem is, that uses spigot and I need to use nms

eternal oxide
#

why?

noble spire
#

That seems like a terrible idea

frosty tinsel
#

There is Arrays copyOfRange

#

Method

eternal oxide
#

copyOfRange is Java 9+

noble spire
#

nice, yeah I'm doing 1.17 anyway so that's great

frosty tinsel
eternal oxide
#

k

celest nacelle
# eternal oxide why?

basicly, my codebase is in 1.8 spigot (please dont shout at me, I just dont want to have to completely recode everything in newest version) but I want to add 1.16 support. So I need import packages that are version specific

eternal oxide
#

does TagAPI support back to 1.8?

noble spire
eternal oxide
#

Sorry that should be NBT API

celest nacelle
#

Ok, I'll have a look, thanks

stable plinth
#

does this change the attack speed value directly? or just the same as spigot attribute modify?

#

What I mean is the green value that states item's default value instead of the blue/red (in negative) value that is modified

quaint mantle
crude hound
#

hi, how can I get the health of an entity who has damaged by something (I've early created the EntityDamageByEntityEvent event but I didn't found a way to get health of the entity)

#

(and It can by all sort of entity)

quaint mantle
#

entity.health? Is not a thing

#

Well I believe it’s not

crude hound
#

no it didn't exist

quaint mantle
#

Well here’s the thing, items don’t have health

#

They are entities too

#

You need to specify which entities

crude hound
#

so how I know if this entity is a damageable so

quaint mantle
#

I guess if they’re damaged in that event but you need to cast it to it’s type and grab the health that way

stable plinth
#

e.getEntity() instanceOf LivingEntity

#

and u can getHealth I guess

crude hound
#

thx I will test that

quaint mantle
#

Should work

stable plinth
#

if (e.getEntity() instanceOf LivingEntity)
LivingEntity l = (LivingEntity) e.getEntity();

frosty tinsel
#

Please no

#

Don't name your variables with one letter

quaint mantle
#

Lol who cares it’s discord chat, he probably doesent do that

#

Obviously an example

stable plinth
#

its in discord so i keep it simple XD

quiet ice
crude hound
#

if I one-shot the zombie it don't work

quaint mantle
#

Cuz they’re dead

stable plinth
#

cuz the zombie is dead

quiet ice
#

Entity or Event are common ones

quaint mantle
#

Lol

frosty tinsel
crude hound
#

yes I need to know when the zombie death by another entity

frosty tinsel
#

Just ble

quiet ice
#

As long as you don't additionally use the var type, there is nothing to be afraid of

quaint mantle
#

Entity death event

crude hound
#

so I used an ! but it don't activate it

quiet ice
#

The issue only becomes noticeable in megamoths

crude hound
eternal oxide
quaint mantle
#

var entity > LivingEntity entity

frosty tinsel
#

And recommend for everyone else

quaint mantle
#

I mean it’s a Lombok or kotlin thing

stable plinth
#

wait the health of a dead entity should be 0 or negative, isnt it?XD

eternal oxide
#

in damage event its not

frosty tinsel
#

<= 0

quiet ice
#

nah, var is jls since j10

frosty tinsel
#

What is jls?

quiet ice
#

java language specification

frosty tinsel
#

Ah

quaint mantle
#

Yea Lombok had it much earlier same with kotlin

frosty tinsel
#

Does anyone here use Kotlin?

quiet ice
#

likely

frosty tinsel
#

I personally hate the syntax

stable plinth
frosty tinsel
#

It's so unfriendly

quaint mantle
#

Yes I do

#

Very friendly imo

frosty tinsel
#

The name before type, ble

quaint mantle
#

Can do cooler things too 🙂

frosty tinsel
quaint mantle
#

? You don’t have to specifics a type everytime

#

Extensions

#

Not file class specific

quiet ice
#

Syntax is not really a priority, the bigger question is whether it is actually useable - I've seen quite a lot of languages where the compiler segfaults or where the compiler is hard to obtain in the first place

frosty tinsel
#

The only interesting thing I see is the null safety

quaint mantle
#

Extensions are very cool

stable plinth
frosty tinsel
crude hound
#

I just want to get the last damager who killed the entity

stable plinth
#

i see...

quiet ice
#

I think you can use the entity damage by entity event?

stable plinth
#

how about getDamager in EntityDamageByEntityEvent

quaint mantle
#

You can call extensions off any type. fun Int.add(): Int { return this += 5 } just a simple example

stable plinth
#

and cal the damage they will deal on the entity

quiet ice
#

You need to check whether the entity would be dead before that though

crude hound
#

I early use it but I don't know when the entity death

#

wait...

#

I got an idea

tardy delta
#

what are you trying?

quiet ice
#

do the math yourself

stable plinth
#

i mean, if ( living.getHealth - damage <= 0)
return e.getDamager();

quiet ice
#

it needs to be final damage

#

And the < operator, not the <=; an entity is still alive with 0.0 health iirc

stable plinth
#

e.getFinalDamage() then

crude hound
#

I didn't work so I will try this

quaint mantle
torn shuttle
tardy delta
#

oh

stable plinth
#

guys, is it possible to simulate knockback enchant? or can I set knockback is conflict to some itemstack (custom item)?

#

i know if i gonna simulate knockback, i will need velocity

quiet ice
#

it's just a bit of vector maths

frosty tinsel
quaint mantle
#

You can pretty much call 1.add() and it’ll make it 6

#

With that example

quiet ice
#

Extensions iirc are whack

quaint mantle
#

Whack in java

quiet ice
#

I do not like the idea

quaint mantle
#

How so?

quiet ice
#

It is interesting, but someone will abuse the hell out of it

stable plinth
#

but the point is when i use entity.getLocation().getDirection().mulitply(-1)
the knockback direction is depends on the entity instead of damager

crude hound
#

it work thx!

stable plinth
#

welcome 😊

quiet ice
quaint mantle
frosty tinsel
quaint mantle
#

Probably it’s a different language

#

Than you’re use to

stable plinth
quiet ice
#

So am I, so I cannot really help you

frosty tinsel
quaint mantle
#

Such as?

quiet ice
#

I understand the basics of it, but not how you can use them to get the thing you want to be done

frosty tinsel
# quaint mantle Such as?

If I understand it correctly, you cold for example add a function to the Player interface. For example something like removing them fro tab?

quaint mantle
#

Sure Player.Anything

frosty tinsel
#

But now I don't know if it would be possible with an interface

quaint mantle
#

Ofc it is

frosty tinsel
quiet ice
#

I do not think so

quaint mantle
#

If there are getters for it? Lol

#

It’s not just gonna make variables public

quiet ice
#

Unless kotlin has class transforming abilities - but I highly doubt it

celest nacelle
frosty tinsel
quiet ice
#

not really

#

It's not a cheap copy of sponge's mixins that will work everywhere

quaint mantle
frosty tinsel
quaint mantle
#

No

#

Why would that make sense?

#

It’s not going into player literally and adding that function

quiet ice
#

I think the compiler just compiles it down to add(Int var1, Int var2) in an arbitrary class instead of a method add(Int var2) in the class Int

quaint mantle
#

It’s just allowing you to call it off that object

quiet ice
#

Basically - it does not do code weaving

frosty tinsel
#

Of that particular instance only?

quaint mantle
#

Yes particular instance of that type you use

ivory sleet
#

What’s the topic?

quiet ice
#

kotlin extensions

ivory sleet
#

Oh pog, doesn’t something like that exists in lombok also btw

quaint mantle
#

Yea it’s very odd tho

#

And not as simple

quiet ice
#

Why does lombok have everything that kotlin has and vice versa?

ivory sleet
#

lmao

quaint mantle
#

Lol I wouldn’t even compare there extensions

#

Kotlin doesent really use getters and setters

#

Tbh very different in that sense

ivory sleet
#

Yeah I mean not as methods/functions

quaint mantle
subtle kite
#
event.setJoinMessage(plugin.getConfig().getString(event.getPlayer() + "PlayerJoinEvent"));
#

this doesn't work
, how will I pull the players name

#
event.setJoinMessage(plugin.getConfig().getString("PlayerJoinEvent"));
#

does work btw

quiet ice
#

event.getPlayer().getName()?

subtle kite
#

makes sense

quiet ice
#

event.getPlayer() + "PlayerJoinEvent" is basically event.getPlayer().toString() + "PlayerJoinEvent" at the bytecode layer

#

the implementation of the #toString method in the CraftPlayer class is not the player name method however, which can result in issues

celest nacelle
#

for a string

#

in legacy versions you did this

ivory sleet
#

Uh is that craftbukkit classes or your own stuff?

celest nacelle
#

Thats craftbukkit

ivory sleet
#

Didn’t know craftbukkit had nbt classes

celest nacelle
#

well, nms

ivory sleet
#

Ah fair

#

I think you can call NBTTagCompound#setString

#

no?

#

Else try just pass a normal string, and btw have you looked at the implementation of the method?

ivory sleet
#

CTRL + Left click the method

celest nacelle
#

OH

#

I see

#

setString

#

okay, thank you

ivory sleet
#

Cheers

delicate fractal
#

anyone know stuff about luckperms wait

opal juniper
#

waits

noble spire
#

waits some more

stable plinth
#

the attack speed is gone in NBT tag

#

and the attack speed is still 4 (default value

ivory sleet
#

Ever used spigot api?

stable plinth
#

yeah I tried but the value is like -2.8 attack speed

ivory sleet
#

You do know that spigot api provides a fully working api for attributes tho

delicate fractal
stable plinth
#

i mean yeah the value it does is correct

ivory sleet
#

Luckperms api? @delicate fractal

delicate fractal
#

also i have a problem with homes

stable plinth
#

but the tag it shows

#

sounds like a debuff instead a default value

ivory sleet
#

Tang_n I am just telling you to use the api instead of miserably damn nms

delicate fractal
wraith rapids
#

you can't modify base attributes

wraith rapids
#

they're hardcoded into the game iirc

stable plinth
#

so not even nbt api right?

ivory sleet
wraith rapids
#

the best you can do is add attribute modifiers

#

which isn't quite the same

ivory sleet
delicate fractal
#

oh

stable plinth
weak mauve
#

anyone know how to stop Giant head spining around when it's spawn?

wraith rapids
#

Bukkit.shutdown()

idle grotto
gusty notch
#

what's the best way to get an items name, so like if you use ItemStack#getType and it's andesite, it'll return stone, so how do i make it return andesite instead? (this must work will all types of stone, wood and everything)

torn frost
#
      String obtainedData = plugin.config.getConfig().getString(useCustomWorld + "respawn-world");

        if(obtainedData.isEmpty()){
            respawnWorld = deathWorld;
        }

in config i have respawn-world: ''
but it says isEmpty may return null...
do i need to add assert as it says in quick action

wraith rapids
#

no, and an assert won't help

#

isEmpty doesn't return null, the warning doesn't say it may return null, it says something else

stable plinth
#

if u talking about the item instead of the name, ItemStack#getType() actually returns Material.ANDESITE (if it's andesite)

#

btw getDisplayName(); also works

gusty notch
#

thank you so much, that's exactly what i needed! 😄

stable plinth
#

😊

ivory sleet
#

Check javadocs next time, it will help you through many questions

iron condor
#

Is there a way to load my economy plugin before any other one?

ivory sleet
#

Like a vault implementation?

#

I mean you could use onLoad but it should mostly be used for super early internal plugin loading

eternal oxide
#

why do you want to load early?

frosty tinsel
ivory sleet
#

Though listing every existing economy plugin would be a tedious process and arguably impossible to a degree

frosty tinsel
#

Yea

iron condor
eternal oxide
#

then fix the shop plugin. its coded badly

ivory sleet
#

Axilirate hmm you could load before vault?

iron condor
#

closed source

#

(shop plugin)

eternal oxide
#

then don't use a buggy plugin or let the author know so he can fix it

ivory sleet
#

Load before vault and provide your Economy implementation

#

Use what Tomasan said to load before vault then just in onEnable
getServer().getServicesManager().register(Economy.class, new EcoImpl(),this,ServicePriority.High);

iron condor
#

I'll probably switch the plugin, found an alternative free one

ivory sleet
#

Bruh

iron condor
#

I didn't pay for this one tho

#

used the demo

ivory sleet
#

But even so, the solution I told ya works perfectly fine

iron condor
#

whats funny is that I see a lot of bots giving 1 stars to the free and saying they should get the premium one

ivory sleet
#

It would provide compatibility for any vault economy dependent plugin

iron condor
#

i'll do this if I will encounter this again, thanks.

ivory sleet
#

What doesn’t work

river spear
#

Since the event is called twice, once where the anvil is started and where it lands and at the end I need the result so that I can sort it out again. But what is the best solution

wraith rapids
#

what

oblique path
#

Hello. How can I connect nms 1.17 to maven?

hardy swan
#

it is in the spigot jar you build with buildtools

#

artifactId is spigot for spigot's dependency

oblique path
torn frost
#

hi can we get location of respawn anchor? or tp to it...as i am creating random spawn after death

quaint mantle
#

guys im extremely confused, im not even sure if im in the rigth channel, im working with multiverse on an aternos server, and im having an issue since i have 2 worlds, and smp world and spawn, but when i create a nether portal on the smp, and i go to the nether everything is fine, but if i try to go back to my home base, i go back to spawn.

torn frost
#

doing this :

        if (ApiUtil.isAvailable(PlayerRespawnEvent.class, "isAnchorSpawn") && event.isAnchorSpawn()) {
            Location anchorLocation = event.getRespawnLocation();
             event.setRespawnLocation(anchorLocation);
            return;
        }

or just return will tp me to 0 y 0

wraith rapids
#

no, you are not in the right channel

#

this channel is for development and programming

quaint mantle
#

oh, im sorry, where should i go?

wraith rapids
#

in the other help channel

quaint mantle
#

oh ok

#

thx

torn frost
earnest sonnet
wraith rapids
#

doesn't matter where, as long as it isn't here

#

at least as far as I'm concerned

torn frost
#

so can you help me with this 0 y 0 respawn anchor error

wraith rapids
#

probably not

hardy swan
torn frost
quaint mantle
#

?jd

quaint mantle
#

is the way you make items for 1.16 the same as 1.8???/

#

How can i remove this from the item?

frosty tinsel
quaint mantle
#

Okay

#

Let me see java docs

opal juniper
#

Idk probs cause shit never gets removed

#

@quaint mantle

#

But just try it

smoky oak
#

How do I separate the Ender Pearl Damage from Fall damage?

oblique path
hardy swan
cold tartan
#

(Opinion Question)
What item do you guys think represents form?

wraith rapids
#

what

cold tartan
#

i was thinking clay

wraith rapids
#

form? form is a very vague word

cold tartan
#

like the form a spell comes in

next stratus
#

What's the best and easiest way to store locations locally? It'll be a per player thing also.

next stratus
#

PersistentDataContainer?

eternal oxide
#

?pdc

cold tartan
#

u know the /data command in mc

next stratus
#

If you were to reboot the server would it stay and can you re-load it?

cold tartan
#

yep

next stratus
#

I've not actually touched /data before ngl.

cold tartan
#

ok, it just stores info on the player

#

just do /data get entity @s in game and u will see

next stratus
#

my gosh it has a lot of data

wraith rapids
#

If you were to reboot the server would it stay and can you re-load it?
yes, that is what persistent means

next stratus
#

ok, my bad didn't realise

quaint mantle
#

I wont help for one plugin!

noble spire
#

Do you need to get the angle and then figure it out, if so, which method do you use?

hardy swan
#

you can just get yaw

noble spire
#

oh nice

opal juniper
#

Afaik you have to work it out manually

noble spire
#

thanks

next stratus
noble spire
#

yup got it

hardy swan
#

apparently, the yaw returned ranges from -360 to 360

noble spire
#

ah nice

#

I was literally about to write that

tardy delta
#

well for some reason this doesnt give me the distance travelled by boat but something that is 50x higher

meta.setDisplayName((p.getStatistic(Statistic.BOAT_ONE_CM) / 100) + " blocks travelled with boat");
wraith rapids
#

divide by 50 then

tardy delta
#

Will this break the boat when stepping out of it?

@EventHandler
    public void onVehicleExit(VehicleExitEvent event) {
        if (!(event.getVehicle() instanceof Boat)) {
            return;
        }
        event.getVehicle().remove();
    }
quiet ice
#

I would say that the boat just plops out of existence

wraith rapids
#

the player probably hasn't exited the boat yet by the time that fires

#

but that should be fine, probably

smoky oak
#

Anyone mind helping me tho? I want to manipulate fall damage dependent on plugin variables but exclude ender pearls from it

tardy delta
#

i want to break the boat when the player exits so thats no porblem

#

so i have to simulate the drop myself?

smoky oak
#

well the remove function removes the boat. Is there a break function or something like that?

#

otherwise yses

#

*yes

#

shouldnt there be an internal function for that?

tardy delta
#

well i want to drop the corresponding boat

smoky oak
#

@tardy delta let me just look at the ap for a sec

summer scroll
tardy delta
#

yea im trying to drop the corresponding boat

eternal oxide
#

will damaging th boat break it?

tardy delta
#

not sure lemme try

earnest sonnet
#

Take the slot, check for nulls and then for the material type

tardy delta
quiet ice
#

You would need to store the config in memory and have a slot -> name map/list

eternal oxide
tardy delta
#

oki

summer scroll
tardy delta
#

if i just do 20.0 would that be enough or too much? idk

eternal oxide
#

try it and see?

opal juniper
#

Just do a really large amount of damage

#

Like 2000

#

Then no matter what it will die

tardy delta
#

does this checks for the boat?
event.getVehicle().getType() == EntityType.BOAT

eternal oxide
#

yes

quiet ice
#

Alternatively, instanceof

eternal oxide
#

instanceof is slower

#

I believe

quiet ice
#

likely

smoky oak
#

@summer scroll Manipulating fall damage so that i can change how bad it is to fall down, but the problem is that pearls are also counted as fall damage. But I don't want to increase pearl damage

tardy delta
#

ah
Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_16_R3.entity.CraftBoat cannot be cast to org.bukkit.entity.Damageable

quiet ice
#

well, Boat does not extend Damageable so I would be surprised if that was the case

tardy delta
#

maybe livingentity

quiet ice
#

Boat does not extend that either

eternal oxide
#

nope, not damageable

smoky oak
#

@summer scroll eh thats the question what SHOULD I use

#

becakse

#

*because

#

OnEntityDamageEvent...

#

ender pearl is listed as damage cause FALL

eternal oxide
wraith rapids
#

because that is how it is handled internally

summer scroll
smoky oak
#

wait does that not still trigger EntityDamageEvent anyways?

summer scroll
#

EntityDamageEvent will still be called i think

smoky oak
#

yea that menas the code still runs doesn't it

summer scroll
#

yes, on the EntityDamageEvent

smoky oak
#

and thats the problem

#

i cant separate the EntityDamageEvent into actual fall damage and pearl damage