#help-development

1 messages ยท Page 549 of 1

wet breach
#

A clan channel the leader could assign 3 accounts or members ops. You can also have 1 temp op and then you have the leader account for a total of 5 ops in a single channel

#

Clan channels are hard to make sometimes

#

You needed 15 warcraft 3 accounts to make one

#

Because of me my clan had 3 clan channels. I possessed at the time 1k starcraft keys, and like 300 warcraft 3 keys

#

The hard part about making a clan channel as well once you have everyone. Is that once you hit create clan everyone within 5 minutes has to accept the clan invite. If one person doesnt receive it or doesnt hit accept you have to do it over again

#

Also if you try to do it by yourself you needed proxies because only a single ip was allowed 3 connections to battle net

#

Btw, when one of my bots was opped, it accidentally banned the clan leader for swearing

#

And then when they got unbanned they were trying to whitelist themselves and they accidentally activated my bot protection for the channel so it started banning everyone in the channel lmao

#

I lost my ops for like a week for that

#

Anyways, have some work to do. Be back in like an hour

grave kayak
#

I keep getting null pointer exception on line 57, i have tried a number of ways to fix it but I'm not sure what's going wrong its printing this to console so i assume the item is being pulled from the map fine? [17:38:41] [Server thread/INFO]: Selected tool: {54569797-2646-4112-92ea-f566ec302ad4=ItemStack{ELYTRA x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gold","text":"Elytra"}],"text":""}, lore=[{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Click to select an elytra!"}],"text":""}]}}}

https://paste.md-5.net/uricudugez.java

smoky anchor
#

How are you getting NPE on line 57 and still getting stuff printed ?
Show us the exception as well

astral pilot
#

it doesn't give any errors it jsut says "FAILED"

smoky anchor
grave kayak
smoky anchor
#

I think you are passing null in the constructor for the selectedTool
Try putting the System.out.println("Selected tool map: " + selectedTool);
after line 23 and see what it prints

grave kayak
drowsy helm
#

why not access selectedTool through DI instead of passing the entire map

brazen stream
#

https://gyazo.com/8bd0a0c7af287c6b6ddbc2671e5a179a
I have this script to when holding an iron ingot while left clicking an oak door, it will turn it into an iron door. But the iron door keeps breaking. The script was working a while ago but it suddenly just idk stopped working so can anyone tell me why?

#

^also event.setCancelled(true) does work when not holding iron, but when it turns it into an iron door, it immediately breaks and turns into an item

drowsy helm
#

use a delayed runnable

brazen stream
#

Will learn that ty! Was stuck for a long time

drowsy helm
#

yeah sometimes events are just funky with that sorta stuff. delay it by a tick and it should be sweet

#

^ applicable to a few other events aswell

smoky anchor
#

I don't think that is the case
The problem is that he's setting just a single block of the door

drowsy helm
#

ah you might be right

smoky anchor
#

I think you need to disable physics on the first half of the block and then set the other one normally

drowsy helm
smoky anchor
#

yep

astral pilot
#

how do you fix unable to find valid certification path to requested target

#

ive been stuck on this error

#

for soo long

chrome beacon
#

Send the entire error

#

?paste

undone axleBOT
sage dragon
smoky anchor
eternal oxide
#

oh my, use a decent paste site. that is unreadable

noble lantern
#

What is that website that let me super easily view the obfuscated names for Mojangs obfuscated names?

Need to make a private field public in the Block NMS class but during runtime, the field names changed obviously

eternal oxide
sage dragon
eternal oxide
#

When you close an inventory you are copying the players inventory into the shulker.

noble lantern
sage dragon
eternal oxide
#

Do as steve said, run only on one hand

#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
smoky anchor
#

There is command for everything, isn't there.

smoky anchor
eternal oxide
#

yep, but he also copies the closing inventory to teh schulker, so even though he emptied it he put the items back

#

So hard to read double spaced code though

#

My mind just can;t process it

smoky anchor
eternal oxide
#

not if the inventory thats closing is the players

noble lantern
#

?paste

undone axleBOT
smoky anchor
sage dragon
eternal oxide
#

As I said, too hard to read double spaced for some reason. Once it hits a blank line my brain just switches off and thinks it's a new bit of code forgetting the previous.

smoky anchor
#

Yeah, kinda same.
Really hard to read that.

noble lantern
#

SOOO, on a scale of 1-10 how stupid am I approaching this:

My reflection method: https://paste.md-5.net/coxuruloga.cs

Screaming Sandals says that the obfuscated name is aP (screenshot), Block implements BlockBehaviour and I'm wanting to access the properties field that BlockBehaviour (yeah I tried properties as well) holds

Is this cause im using a paper server jar orrr?

echo basalt
#

you get the player's direction, reverse it

#

normalize if needed and multiply by 2

#

I recommend reading this

tardy delta
#

me writing a 2d game and having no clue how vector multiplications work ๐ŸŒ

echo basalt
#

getDirection, multiply -1

eternal oxide
#

a direction vector is a unit vector, so a length of 1

#

multiply by -2 if you wan to go back 2

echo basalt
#

still the same process

eternal oxide
#

get Location, get Direction, multiply. add vector to location

echo basalt
#

anything more than this is spoon feeding

smoky anchor
echo basalt
#

But sure let me point you in the right direction

#
Location playerLocation = player.getLocation();
Vector direction = playerLocation.getDirection(); // if you're looking north, which is +Z, it'll be (0, 0, 1)
#
Location ahead = playerLocation.add(direction);
noble lantern
smoky anchor
#

That information is not synchronized with clients (yet)

echo basalt
#

what in particular

noble lantern
echo basalt
#

indeed

#

your direction vector has a length of 1

smoky anchor
echo basalt
#

play with it

noble lantern
#

huh interesting...

noble lantern
young knoll
#

.multiply

chrome beacon
young knoll
#

^ works quite well

#

Only problem is it makes breaking blocks server side, which means ping becomes a bigger problem

noble lantern
#

I saw that as a common solution but I really wanted avoid the effect state of things

I'm basically wanting to recreate the hypixels mining system/speed in turns of the normal efficiency levels buuut

Yeah you do have a point there coll, would have a great deal on performance TBF

smoky anchor
noble lantern
#

or nms + packets

chrome beacon
#

Well that's on Minestom, but it can be recreated with mostly Spigot API

young knoll
#

I believe I did it entirely with the api

#

Minus sending a packet to give mining fatigue client side

#

Youโ€™ve got the BlockDamageEvent and BlockDamageAbortEvent

chrome beacon
#

Does it really matter if the effect is client side or not?

young knoll
#

(Also PlayerAnimationEvent if needed)

#

No but I didnโ€™t want to replace any server side mining fatigue

chrome beacon
tardy delta
young knoll
#

For vectors thatโ€™s reasonable

#

But people use it on classes where it makes no sense and it just kills readability

tardy delta
#

true

noble lantern
#

or you used it entirely to control the break speed?

chrome beacon
#

Progress can be sent with API

echo basalt
#

true but it's kinda weird

noble lantern
#

Looking at the block damage event right not but only see insta break options unless its private and needs reflection

yeah nothing for block breaking progress or setting it in there

echo basalt
#

yeah but you can't control the entity id belonging to the packet

#

That packet is just

#

entityid, stage

young knoll
#

You can now

echo basalt
#

you can?

#

oh yeah

chrome beacon
#

Yeah there's a method that accepts the id

young knoll
#

Thereโ€™s an overload with an int

noble lantern
noble lantern
#

took me an hour to write this, time to test this shits gonna be broken as hell i bet

quaint mantle
#

chunksnapshots cords is binary ?

eternal oxide
#

binary?

quaint mantle
eternal oxide
#

a chunk is 0 to 15

quaint mantle
#

i wanna show my code to u but
they will laugh at me

echo basalt
karmic phoenix
#

hello, i'm trying to set custom effects to the enchanted golden apple only, but it keeps applying it for the regular golden apple and the enchanted one.

    public void playerFoodConsume(PlayerItemConsumeEvent e) {
        Player p = e.getPlayer();
        ItemStack ega = new ItemStack(Material.GOLDEN_APPLE,1 , (short) 1);
        if ((e.getItem().getType().equals(ega) && !e.getItem().getItemMeta().hasLore()) || (!e.getItem().getItemMeta().hasDisplayName())) {
            p.getInventory().removeItem(ega);
            if (p.getFoodLevel() <= 18)
                p.setFoodLevel(p.getFoodLevel() + 4);
            e.setCancelled(true);
            for (String po : this.effects) {
                String[] inf = po.split(":");
                if (inf.length == 3 &&
                        PotionEffectType.getByName(inf[0].toUpperCase()) != null) {
                    PotionEffectType pot = PotionEffectType.getByName(inf[0].toUpperCase());
                    try {
                        this.dur = Math.min(Integer.parseInt(inf[1]), 2147483647);
                    } catch (NumberFormatException e1) {
                        this.dur = Integer.MAX_VALUE;
                    }
                    try {
                        this.amp = Math.min(Integer.parseInt(inf[2]), 255);
                    } catch (NumberFormatException e1) {
                        this.amp = 255;
                    }
                    if (!p.hasPotionEffect(pot)) {
                        PotionEffect potionEffect = new PotionEffect(pot, this.dur, this.amp);
                        p.addPotionEffect(potionEffect);
                        continue;
                    }
                    p.removePotionEffect(pot);
                    PotionEffect effect = new PotionEffect(pot, this.dur, this.amp);
                    p.addPotionEffect(effect);
                }
            }

        }
    }
#

any ideas?

fluid river
#

this is kinda nested and unreadable

eternal oxide
#

do not compare/match by names

#

apply a flag to the pdc to identify your apple

fluid river
#

enchanted ones

karmic phoenix
#

Only the enchanted ones.

fluid river
#

default enchanted golden apples

karmic phoenix
#

It keeps applying it to both regular and enchanted.

fluid river
#

still you shouldn't match by names and lore

#

you can just check if it's enchanted

#

are there any errors tho?

karmic phoenix
eternal oxide
#
    ItemStack ega = new ItemStack(Material.GOLDEN_APPLE,1 , (short) 1);
        if ((e.getItem().getType().equals(ega) && !e.getItem().getItemMeta().hasLore()) || (!e.getItem().getItemMeta().hasDisplayName())) {```
fluid river
#

what the hell is in your effects

eternal night
#

Since when is enchanted golden apple not its own material eyes_zoom

fluid river
#

that you check for numberformat exception

eternal oxide
#

all you are matching is any golden apple with no lore or no display name

eternal night
#

or is this some < 1.13 shit

#

ah

#

yea

#

lEgAcY

fluid river
#

i know it's not 1.8.8

#

but

#

?1.8

undone axleBOT
fluid river
#

java 8

karmic phoenix
#

hello i m trying to set custom effects

ocean hollow
#

how to import api?

fluid river
#

lol why is it searching on papermc

river oracle
#

Fr

#

Intellij moment

#

Clear caches maybe

glad prawn
#

How i can get stationary water/lava in 1.19?

flint coyote
#

he asked about vault though

glad prawn
young knoll
#

Itโ€™s just water

#

Whether itโ€™s flowing or not is just a state

flint coyote
#

yeah you can use the blockData and do #setFlowing(false)

young knoll
#

I believe false is the default

glad prawn
#

Nvm found.

karmic phoenix
ember estuary
#

How can you do an overlay like this? (top of the screen)

ocean hollow
#

title with custom symbols or invisible bossbar

ember estuary
#

maybe retextured bossbar?

#

with custom symbols you mean that some unicode symbol is (in a resource pack) changed to have that look and be that far up, and then you display it as a title to the player, it then displays that overlay up there?

young knoll
#

Custom fonts

#

The answer to anything fancy is usually custom fonts

ember estuary
#

alright, will look into that, thank you

echo basalt
#

boss bar with a funky unicode title

hybrid spoke
astral scroll
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

astral scroll
#

!verify CiroSanchezB

undone axleBOT
#

This account is already verified!

astral scroll
#

oh dear

remote swallow
#

sus

crimson wharf
#

how to properly load the config of the minecraft file on startup?

river oracle
#

What

#

What is a minecraft file

crimson wharf
#

oh sry

#

was brain afk

#

the config.yml

#

onEnable

    getConfig().options().copyDefaults(true);
    saveConfig();
river oracle
#

Oh idk that stuff sorry

tardy delta
#

saveDefaultConfig() and i hope you know copyDefaults() does nothing if you dont have defaults

#
BukkitWiki

The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...

river oracle
#

Is it just me who detests the bukkit built in config idk why but I find it Hella confusing

eternal oxide
#

I like it

tardy delta
#

i like the get/set stuff but the loading is weird

crimson wharf
#

should I safe it all the time like DefaultConfig

tardy delta
#

actually just calling getConfig() loads the config too, only doesnt save

eternal oxide
#

I also like the built in serialization

river oracle
eternal oxide
#

I just wish more Bukkit objects were serialized

tardy delta
#

geol would say DataOutputStream :)

worldly ingot
eternal oxide
#

No real point for me. I'd make too many formatting errors to have a pull accepted

eternal night
#

configurate supremacy

river oracle
#

It is kinda annoying to ensure no formatting errors it's annoying as hell to setup your ide around those configs

eternal night
#

cat_what just run mvn with the development profile

#

and checkstyle is gonna scream at ya

river oracle
#

Still annoying cuz I love using auto formatting

#

Hate doing it manually

eternal night
#

I mean, if your PR is so large that you need autoformatting

#

๐Ÿ’€

wet breach
#

I think there is only a few things in bukkit that can't

eternal oxide
#

it could be one line and I'd make a formatting error ๐Ÿ˜›

river oracle
eternal night
#

ah xD

river oracle
#

No downside to in your normal projects

#

But for spigot it fucks up the entire class

eternal night
#

true I guess ๐Ÿ˜… someone make a .editorconfig for spigot

undone axleBOT
echo basalt
#

weird ahh thing

#

my browser doesn't work

river oracle
#

Use LibreWolf it'll work

tardy delta
#

i thought that was smth like libreoffice ๐Ÿ’€

quaint mantle
#

@echo basalt can u teach me this switch problem ?

tardy delta
#

bruh its literally 9/10 the same code

river oracle
#

LIBREWOLF is ๐Ÿ status

tardy delta
#

but it doesnt have an auto updater

#

currently using firefox

#

man i told you yesterday

#

you just had to spot the differences between your code and mine

eternal night
#

use a Consumer<BukkitTask> instead of a Runnable

dense grove
#

Hi how to fix this :- when I use this comment [/znpcs action add 1 CMD Shop Food ] . It tells [Hey!, The inserted number/id does not look like a number]

eternal night
#

lEgAcY

tardy delta
#

your ide going crazy isnt exacly smth useful to say

echo basalt
#

.

dense grove
#

Ok

tardy delta
#

alr 1.12.2 doesnt have that method, get rekt

#

go upgrade your stuff

#

imagine supporting 1.12

echo basalt
#

recursive loop skullWazowski

tardy delta
#

who even told em you need to put an L after longs in scheduling methods duke

echo basalt
#

learnjava moment

young knoll
#

What's a java

quaint mantle
tardy delta
#

what? the lambda is the method impl

quaint mantle
#

i was watched video and

echo basalt
#

yeah a lambda is an impl of the method

#

basically an interface is a sort of template of a class

tardy delta
#
Runnable r = new Runnable() {
  @Override
  public void run() {
    System.out.println("Thicc");
  }
}```
is the same as
```java
Runnable r = () -> System.out.println("Thicc");```
echo basalt
#

something just saying "any class that implements this will have these methods"

tardy delta
#

parameters correspond to eachother

echo basalt
#

Let's say that interface only has one method that needs to be implemented by the inheriting class

#

you put all the params of that method in the lambda's ()'s

#

and return whatever that method would return

quaint mantle
#

if i use lambda methods i don't need this ?

echo basalt
#

you do

#

Listener is a "tag" interface and has no methods to impl

tardy delta
#

nailed me

echo basalt
#

But let's say you have an interface called ChatFormatter which is just a String format(String original)

#

and you have a class that has a method like public void setFormatter(ChatFormatter formatter)

#

you can call setFormatter((original) -> original.substring(1)) for example

#

as that's a valid implementation of the format method

tardy delta
#

kinda sucks that java doesnt have type aliases

echo basalt
#

here's a 15min video

tardy delta
#

c++ would be using ChatFormatter = std::function<string(string)>

quaint mantle
#

i have other question elgar did sleep ?

tardy delta
#

same in java basically but i dislike people writing a new func interface where they can use parameterized existing ones

worldly ingot
tardy delta
#

uh oh the c++ commander joined

worldly ingot
#

It would clean up a bit of CraftBukkit code

#

We have a lot of repeating types

tardy delta
#

static imports uwu

echo basalt
#

waiting for the day that CraftEntity is cleaned up

tardy delta
#

i tried to avoid them but i came to the point that those nested types are just annoying

worldly ingot
#

Be the change you want to see

#

But what about it do you want cleaned up?

young knoll
#

CraftEntity

#

Is that the beautiful hellscape one?

quaint mantle
#

u guys explain me how can i convert blocks from chunk.snapshot to normal chunk blocks

echo basalt
worldly ingot
#

Oh. The problem is that there isn't really a great way to resolve that

#

At least none I can think of

tardy delta
#

i would be one of those people that changes the order and then sees the comment

echo basalt
#

maybe a little generic typing

young knoll
#

Can it not be done with a map like CraftBlockStates?

echo basalt
#

or use reflection to make a sort of tree

worldly ingot
#

Reflection is a no

echo basalt
#

manually make the tree

#

I was gonna say to use reflection to like scan all mob classes and make an inheritance tree type deal

#

and then the method would just look over the tree until it finds the best node

young knoll
#

Something like mapping NMS entity class -> BiFunction

echo basalt
#

or you can do that, sure

young knoll
#

Seems the most logical to me

#

Since all CraftEntity constuctors are just BiFunctions

echo basalt
#

Map<Class<T extends Entity>, Function<Entity, CraftEntity>>

worldly ingot
#

One way or another, you're going to end up having a lot of lines somewhere

#

It will inevitably be ugly

young knoll
#

But not that ugly

echo basalt
#

something like that

worldly ingot
#

The only way to make it clean is to patch every single NMS Entity class to have a createCraftBukkitEntity() method, but that would involve patching every single NMS Entity lol

echo basalt
#

it's only like 50 classes

worldly ingot
#

Doesn't matter. Too many patches

echo basalt
#

better than doing this clunky mess

worldly ingot
#

You're welcome to update it

echo basalt
#

can't bother typing my address

#

on a google form

worldly ingot
#

"can't bother typing" brother that's why we have auto fill

tardy delta
#

md5 will be at your door

young knoll
#
private static final Map<Class, BiFunction> map = blahblah

static {
  map.put(EntityCreeper.class, CraftCreeper::new);
  ... etc ..
}```
worldly ingot
#

I signed it like 8 years ago and he has yet to show up at my door sadge

echo basalt
#

put spigot on github

#

he'll arrive faster

worldly ingot
#

Can't

echo basalt
#

yes you can

worldly ingot
#

Been there, done that

tardy delta
#

he has to go through the ocean

young knoll
quaint mantle
#

for to unload chunk i need wait some time ?

eternal oxide
#

you don't unload a chunk

#

leave it to MC to unload

quaint mantle
#

oh elgar isnt sleep

worldly ingot
#

But if you map each individual internal class, might work

tardy delta
#

and youd need the exact class

quaint mantle
young knoll
#

The exact classes are already all imported so

#

meh

#

The only special case might be the dragon

#

Because

  else if (entity instanceof EntityComplexPart) {
            EntityComplexPart part = (EntityComplexPart) entity;
            if (part.parentMob instanceof EntityEnderDragon) { return new CraftEnderDragonPart(server, (EntityComplexPart) entity); }
            else { return new CraftComplexPart(server, (EntityComplexPart) entity); }
        }
edgy crystal
#

cancel();

#
                    this.cancel();
                }
            }
        }.runTaskTimer(Main.getInstance(), 0L, 1L);```
#

thats my code

#

ah

#

than what is it ?

#
BukkitTask particleTask = new BukkitRunnable() {
            double progress = 0.0;
@Override
            public void run() {
                if (!player.isOnline()) this.cancel();
                if (true) {
                    //stuff
                } else {
                    this.cancel();
                }
            }
        }.runTaskTimer(Main.getInstance(), 0L, 1L);```
#

mine is a BukkitTask

#

or am i wrong ?

#

ah

vestal matrix
#

anyopne know if its possible to check if a location is in a player's plot using PS api?

eternal oxide
#

the ages you set depends on how long the chunk has been unloaded

wet breach
hazy parrot
#

There is overload that takes a consumer

#

Use that overload, and call task.cancel()

#

๐Ÿ˜ญ

tardy delta
#

holy cow

quaint mantle
eternal oxide
#

yes, you've not implemented anything async that I told you. You got as far as taking a chunk snapshot, then went your own way

quaint mantle
eternal oxide
#

don't get distracted with work distro, lambdas or queue system. implement an async runnable, passing the snapshot

quaint mantle
#

ah oke

orchid trout
#

ham

cerulean solstice
#

Hello, I forgot my spigot account password. And it asks for email to reset password and I forgot the email because it's pretty old account. Is it possible for you to send me your e-mail name?

young knoll
#

?support

undone axleBOT
cerulean solstice
#

THX

tardy delta
#

i believe i found my new editor, ides are overrated

worldly ingot
#

Oh dear

tardy delta
#

vim like keybinds ๐Ÿฅฐ

worldly ingot
#

I always assumed that was a negative thing

tardy delta
#

it makes me not require a mouse anymore

round finch
#

why is buffer like [1024]?

tardy delta
#

you put the size in front of the type

round finch
#

i have seen same stuff with a spigot custom config tutorial

#

buffer[1024]

#

i know it is array size but beside that i got no clue

tardy delta
#

best file finder

wet breach
round finch
#

memory size i get it now

#

Thanks @wet breach

tardy delta
#

still learnig java?

vital sandal
worldly ingot
#

Honestly I just need to take time to learn Vim properly. I really enjoy at least the basics of Nano, but learning some basic Vim, or at least Neovim would be useful

tardy delta
#

this editor is called helix btw

worldly ingot
#

Yeah I've seen Helix before

round finch
#

ofc i'm not highly advanced in java

tardy delta
#

hmm ill love this

#

ah yes i have two processes on that file and they're deadlocking eo

river oracle
#

.odin

vestal matrix
#

does anyone know if its possible to check if a location is in a plot

echo basalt
#

define "in a plot"

vestal matrix
#

plotsquared plot

#

couldnt find anything in their documentation so idk

echo basalt
echo basalt
#

maybe check if this is null

#

wait that's their location wrapper

vestal matrix
#

that would work though no?

mellow frost
echo basalt
#

that's... not the right approach

mellow frost
#

let me edit my coms*

tardy delta
#

comrades

young knoll
#

Not much

#

Really depends on what you are doing

eternal night
#

one is a proper API

#

the other is version dependant magic

compact haven
#

packet interception is obviously going to be faster and the most โ€œtrueโ€ to the real event because nothing couldโ€™ve modified it yet

eternal night
#

I mean

compact haven
#

but yeah you would never do that unless youโ€™re trying to keep the server blind

eternal night
#

"Faster" is out there

compact haven
#

itโ€™s faster, thatโ€™s undeniable

#

by how much? Maybe a ms

eternal night
#

it really isn't

compact haven
#

It really is

eternal night
#

the server still runs the event code

#

the server still constructs the event

compact haven
#

Itโ€™s faster for your code to execute.

young knoll
#

You save that reflective call to your event handler!

eternal night
#

that already uses method handles or full ASM

young knoll
#

Maybe on paper

eternal night
#

and is effectively as fast as a normal invocation

compact haven
#

Because itโ€™s not dependent on every other event before yours in the handlerlist to run, furthermore the reflective call

eternal night
#

I mean, even normal reflection is implemented with MethodHandles these days

compact haven
#

no, itโ€™s faster

#

Iโ€™m not going to argue that

eternal night
#

You run earlier

#

the server doesn't get a speed boost from it lol

compact haven
#

Sure, faster

chrome beacon
#

Earlier != Faster

compact haven
#

No one said the server gets a speed boost

eternal night
#

that is literally what faster means

young knoll
#

Hey even a method handle takes some CPU cycles :p

compact haven
#

y'all are arguing over the dumbest shit

eternal night
#

faster is not earlier

compact haven
#

if I want my send message to run 20ms instead of 30ms after the packet is received

#

that's faster

#

and earlier

#

let's not be dumb, please

eternal night
#

that-

compact haven
#

don't argue just to argue

eternal night
#

Okay sure ๐Ÿ˜… if you interpret faster that way

#

then it is faster I guess

young knoll
#

It also depends on events though

compact haven
#

it literally is

young knoll
#

Some events don't coorespond to a packet being receieved

#

And some packets don't have cooresponding events

compact haven
#

well the whole question was packet vs event

#

so I'm assuming a 1-1 like chat

eternal night
#

for the general case, events are better

compact haven
#

of course, and I completely agree

#

the "faster" part is so miniscule it doesn't affect anything

young knoll
#

Yeah in the case of 1-1 events are infinetly more stable at the cost of a few CPU cycles

eternal night
#

and only works if your logic does not require main thread either

compact haven
#

and using proper API > magic that other plugins need to start injecting into the Netty pipeline

compact haven
#

but yeah, that's probably slower than just listening to the event at that point

eternal night
#

ye

graceful oak
#

Hey guys I was trying to play around with NMS and when I switch up my xml file to have spigot to allow me to use it underlines yellow and says this

EXPOSURE OF SENSITIVE INFORMATION TO AN UNAUTHORIZED ACTOR IN COMMONS

       <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.19.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

Anything to worry about or could I just ignore this?

chrome beacon
#

You can ignore it

silent steeple
#

ItemMeta keyCrate = new key.getItemMeta();

#

Cannot resolve symbol 'getItemMeta'

#

?

young knoll
#

?learnjava

undone axleBOT
river oracle
#

Nooooo but I wanna code minecraftttt

silent steeple
delicate lynx
#

are you saving data to the lore of an item?

delicate lynx
#

please do not do that, use pdc

#

?pdc

delicate lynx
#

oh good luck

quaint mantle
#

i need extends bukkitrunnable to class ?

river oracle
#

Why

quaint mantle
#

for to make methods to async i need use runTaskAsynchronously ?

river oracle
#

You should cut support off below 1.19.2 IMHO

#

2b2t plugin dev spotted????

maiden thicket
#

redstone requires dustoptions

#

iirc

#

if i recall correctly

#

i dont believe thats redstone

#

im not sure actually

#

redstone needs the dustoptions instance, in recent versions its passed to the last param no idea abt 1.12.2

#

should be a T data param

wide steeple
#

Maybe spawn some type of particle?

young knoll
#

Pretty sure it has a default for that

#

?

#

It absoultly is

#

They just spawn the break particles

#

And play a sound

wide steeple
#

Last time I checked MCMMO used particles

maiden thicket
#

or well thats what happened to me

young knoll
#

Iirc its Particle.BLOCK_DUST

celest sonnet
#

switch (scrollParameter){
case EXPLOSIVE:
scrollMeta.setDisplayName("Explosive Scroll");
spearLore.add("Scroll Type: Explosive");
case LEVIATING:
scrollMeta.setDisplayName("Levitation Scroll");
spearLore.add("Scroll Type: Levitating");
default:
Bukkit.broadcastMessage("what");
}

in this code when i try to do levitating it works fine but explosive applies both the levitation lore and explosive lore, as well as sets the name to levitation scroll

young knoll
#

It takes something as the extra data

#

Idk what it is in 1.12

#

MaterialData maybe

celest sonnet
#

omg u right

young knoll
#

You always need break at the end of a case

#

Unless you want to fall through intentionally

silent steeple
celest sonnet
#

thank you guys

young knoll
#

[1.13-1.19]

#

๐Ÿค”

noble lantern
quaint mantle
young knoll
#

Well that isn't the new switch case

noble lantern
#

oh mb didnt see his i kinda just popped in

young knoll
#

But yes the new stuff means you can avoid them

young knoll
noble lantern
#

i was about to say damn i been writing stuff wrong for a long time CH_Muahahaha

celest sonnet
#

are player inventories not an inventory? what im tryna do works in like a chest (and the players inventory while in a chest) but not just like a normal inventory opened by E

eternal oxide
#

there is no open event when the player opens their own

quaint mantle
#

elgarll

celest sonnet
eternal oxide
#

then your code is flawed

quaint mantle
noble lantern
#

oh dear

#

you cant load chunks async :p

#

you cant do a lot of stuff async with minecraft

eternal oxide
#

he's not

quaint mantle
#

no actually i loop chunk blocks with async

#

i can ?

noble lantern
#

oh with ChunkSnapshot?

eternal oxide
#

?paste

undone axleBOT
quaint mantle
noble lantern
#

Yeah CS is generally safe for async and ^

eternal oxide
noble lantern
#

everything is fine up until you change the block data

quaint mantle
noble lantern
#

oh wait nvm

#

he threw it in a task

quaint mantle
#

u trying to help me on this day thanks bro

celest sonnet
#

is an 'InventoryAction.SWAP_WITH_CURSOR" different in a player inventory?

young knoll
#

Afaik CS is fully threadsafe

noble lantern
#

yeah you just cant actually edit the blocks, for some reason paste.md5's coloring is weird it made me miss that runnable he added lol

young knoll
#

But of course it only has read methods, no write methods

quaint mantle
#

why u guys does not laugh ?

#

u guys serious

noble lantern
#

im always laughing in here tbh

#

normally its at my own stupidity

#

like 99%

quaint mantle
#

๐Ÿ˜€

celest sonnet
#

is there a way for me to get picture perms in here

eternal oxide
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

young knoll
oblique timber
#

can extract the sourcecode of a plugin? dm me

quiet ice
#

we shall never know

quiet ice
noble lantern
#

bro pirates plugins smh

quiet ice
#

Incremental recompilation is recommended especially if the plugin is larger

#

Most IDEs don't provide such functionalities out of the box but recaf does support that.
But please remember that JPantom is reliable and fails.

noble lantern
#

idk intellij's decompilation always worked whenever i wanted to see how a plugin is doing something

But... i HIGHLY doubt he wants the source code for that purpose

quiet ice
#

He defo wants to recompile the plugin, at which point you'd likely not want to decompile the plugin in it's entirety

eternal oxide
#

any time I've needed source jd-gui has done it fine for me

orchid trout
#

๐Ÿˆ

quiet ice
celest sonnet
#

public void inventoryEvent (InventoryClickEvent event){
Bukkit.broadcastMessage("inventory click event");
if (event.getAction() == InventoryAction.SWAP_WITH_CURSOR){
Bukkit.broadcastMessage("1");
if (event.getClickedInventory().getItem(event.getSlot()).getType() == Material.TRIDENT) {
Bukkit.broadcastMessage("2");
if (event.getCursor().getItemMeta().getLore().contains("Scroll Type: Levitating")){
Bukkit.broadcastMessage("3");
event.getCursor().setAmount(0);
event.getClickedInventory().setItem(event.getSlot(), new Spear().getSpear(Spears.LEVIATING));
}
Bukkit.broadcastMessage("4");
event.setCancelled(true);
}

    }
}
#

ok dont mind the amount of nested if statements i was testing it

#

but why doesnt this work in a players inv?

eternal oxide
#

?notworking

undone axleBOT
#

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

celest sonnet
#

in players inv it only gets to the first broadcast, does nothing else

#

however, this does work in a normal chest

#

no errors or anything

eternal oxide
#

try getRawSlot()

celest sonnet
#

where?

eternal oxide
#

everywhere you use getSlot()

celest sonnet
#

alright

#

but just to elaborate it does work in the players inventory if a chest is opened

next zinc
#

Unsure if this is the correct chat as I'm unsure if its a coding issue or a plugin/api issue, however when using Holographic Displays API my hologram only will show after I rejoin my server (using my plugin)
https://hastebin.com/share/olonuhataz.typescript

quaint mantle
eternal oxide
#

a chunk x and z are groups of 16 blocks in each axis

celest sonnet
#

well it didnt work unfortunately. is it possible that that action is called something else in a solely player inventory?

eternal oxide
#

so multiply chunkX to get the Location X

young knoll
#

I wonder if it's better to batch that rather than calling a bunch of runTasks

silent steeple
#

whats the best way i can check if args[1] for example, isnt set

young knoll
#

Meh, doubt it matters much

young knoll
#

If length is 1 or less tha args[1] doesn't exist

next stratus
#

Hey, sorry if it's a stupid question but how can I remove some particles from the world? Like spigot allows you to spawn them but I can't despawn them ๐Ÿ˜…

eternal oxide
#

you can't

next stratus
#

oh, fun

eternal oxide
#

particles are fixed duration and client side only

#

server litterally just sends a packet to fire a particle

next stratus
#

So there's no way to get the particle at the location and delete it?

eternal oxide
#

no, it doesn;t exist on the server

next stratus
#

Hm, I just wanna spawn it for 5 seconds then remove it so that's not possible? It must be possible to make them invisible or something

eternal oxide
#

no

next stratus
#

How do popular servers spawn particles for guns and such then? ๐Ÿค”

eternal oxide
#

as I already said, particles are client side only. server only has control over spawning them

chrome beacon
#

They just spawn them

next stratus
#

I wish there was a way to specify how long they're around for ๐Ÿ˜…

eternal oxide
#

some you can

#

some accept a speed value

next stratus
#

So the one I need only accepts color and size. Fun ๐Ÿฅฒ

dull goblet
#

Hey guys, i'm making a plugin which uses https://github.com/JEFF-Media-GbR/CustomBlockData, but when i try to use it, i get the following error:
java.lang.NoClassDefFoundError: com/jeff_media/customblockdata/
I can find it in pom.xml and i am autocompleting the classnames, so i think its weird that it doesn't work

next stratus
#

You need to shade it

dull goblet
#

i'm not an expert, but i think i did it

#

that's what it said on github

next stratus
#

I don't understand maven sorry, I only use gradle. I'll have to wait for someone else to help

dull goblet
#

Okay, thank you anyway

dull goblet
#

I did that

next stratus
#

I'm so confused how there's so many servers deleting particles after a certain amount of time and I can't work out how to do it lol

echo basalt
#

particles have a set time

#

you just spawn them once and they'll fade away

next stratus
#

Can I set the time they're alive for then?

echo basalt
#

no

#

Some last longer than others

silent steeple
echo basalt
#

So if your array length is 1, you fetch at index 0

silent steeple
#

yeah thats what i said

echo basalt
#

Attempting to fetch at index 1 will provide an exception

#

So yes what coll said is correct

#

and it is the exact same as what yo usaid

next stratus
#

I mean, at the moment my plugin has been ruined due to the particle thing, I want to spawn particles in a certain shape then them go

silent steeple
#

bet

echo basalt
#

xy problem moment

#

.

young knoll
#

I normal use the redstone particle

#

It doesnโ€™t last too long

#

Like 2 ticks maybe

next stratus
#

So, I'm trying to spawn some particles in a set shape then remove it after 5 seconds or so. I've currently got the particles spawning but I can't remove it. I need to use black and red.

I've been doing it like this

      for (int d = 0; d <= 90; d += 1) {
        Location particleLoc = new Location(center.getWorld(), center.getX(), center.getY(), center.getZ());
        particleLoc.setX(center.getX() + Math.cos(d) * circleSize);
        particleLoc.setZ(center.getZ() + Math.sin(d) * circleSize);
        Objects.requireNonNull(center.getWorld())
            .spawnParticle(Particle.REDSTONE, particleLoc, 1, new Particle.DustOptions(Color.BLACK, 5));
      }
dull goblet
echo basalt
#

spawn another one after a few ticks

next stratus
echo basalt
echo basalt
next stratus
echo basalt
next stratus
#

yea.. it was that. thank you so much

dull goblet
oblique timber
#

im open src but file is ready error help me

tardy delta
#

man speaking google translate

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!

tardy delta
#

?ask

echo basalt
#

ask coherent questions

#

don't pretend we're google and just say a couple keywords

tardy delta
#

||how to get bitches||

echo basalt
#

leave this server

wise pumice
#

Hello, i'm building minecraft plugin with maven. And i have small problem.
I am use maven shade plugin to create jar and after this in this jar there are these files:
org.intellij.lang.annotations
org.jetbrains.annotations
I was doing mvn clean, restarting intellij, deleting .idea directory but this not work.
It doesn't throw any error, but I'd like a clean jar file with no redundant files.
Anyone know what I can do to keep them from being in this jar?

noble lantern
dull goblet
#

i got more problems with maven than my shitty code ๐Ÿ’€

celest sonnet
eternal oxide
#

impossible, still

cerulean solstice
#

ฤฐtemsAdder error

echo basalt
#

I still don't understand why people keep asking for server help here

young knoll
#

Because ItemsAdder error

cerulean solstice
#

knowing

hazy parrot
#

same bro

lavish robin
#

Is there a method to see if a bounding box intersects a sphere?

echo basalt
#

mans trying to do a crazy physics engine

pseudo hazel
#

sphere intersections should be super easy as you just check the distance between all points of the box and the center of the sphere

#

if any of those is smaller than the radius, you are intersecting

lavish robin
pseudo hazel
#

hmm

#

idk

echo basalt
#

I did that math once for cuboids and it was annoying

pseudo hazel
#

why would you want to do that in block game

#

its relatively easy for 2 cubes

lavish robin
pseudo hazel
#

but like you said it gets weird for some combinations like this

echo basalt
#

the only solution is to probably raytrace with a limited distance honestly

pseudo hazel
#

just take a point an measure the distance

echo basalt
#

pretty sure I actually did the math for a plane and it was just raytracing with extra steps

pseudo hazel
#

unless it needs to be mega precise it wont matter

river oracle
#

@tardy delta just believe in yourself and keep coding you will finish that AI girlfriend eventually

echo basalt
#

if you're a bad dev you still have chances

river oracle
noble lantern
#

ayo ai girlfriend

restive thunder
noble lantern
#

in maven typically you can just mvn clean package, gradle sometimes its different but normally the compile task works fine enough for most things

This is even considering you have these setup in the first place

restive thunder
#

What do you recommend?

noble lantern
# restive thunder What do you recommend?

If you are just learning java - maven since its probably gonna be easier for you to read, others are probably gonna disagree. But, in reality, it's a personal preference unless you're gonna get into NMS you may wanna stick with Maven since I've always found it easier with a special source plugin

I recommend taking a few courses in Java before trying your hand in spigot plugins

#

?learnjava

undone axleBOT
restive thunder
#

Thank you

hard socket
#

I cant claim the result

young knoll
#

It might require a valid recipe

hard socket
young knoll
#

Do you have a recipe registered that takes Diamond pants and a gold ingot

young knoll
#

Then perhaps the game doesnโ€™t like that

hard socket
#

how do I make it then

young knoll
#

Register a recipe

hard socket
#

this isn't the same as craft table recipes

young knoll
#

So?

#

You can register any type of registry with Bukkit.addRecipe

#

*aside from merchant recipe

hard socket
#

ok what will the shape be?

#

Shapeless or Shaped?

young knoll
#

Smithing

hard socket
#

ok

noble lantern
#

Wild question:

Is there a way to convert Pojo classes to Yaml back and forth thonk

drowsy helm
#

idk if theres any libs out there for yaml

drowsy helm
#

dont see why not though

noble lantern
#

yee true but im trying to make things easy for end users as json might not be the best for some people ๐Ÿ˜›

noble lantern
#

serializer would be aids

drowsy helm
#

not really

noble lantern
#

but could prolly take inspiration from gson

drowsy helm
#

some reflection and ur done

noble lantern
#

What yaml lib does spigot use?

drowsy helm
#

Snakeyaml

noble lantern
#

oh hmm seems like jackson can do it but jackson is a large lib iirc

young knoll
#

RedLib has stuff for converting from objects to yaml

noble lantern
#

nice thanks!

graceful oak
#

How would spawning entities with player skins work is that packet based and can be done with NMS or is there an entity I can spawn without NMS to do so. For example on hypixel they use entities with player skins or MMO servers that use player entities with skins instead of texture packs

young knoll
#

Packets

#

Or the citizens api

drowsy helm
obsidian plinth
#

how do people make plugins like the real seasons one that changes colors without a pack

drowsy helm
obsidian plinth
#

o thats cool

#

i did not know that

drowsy helm
#

check out the src for that

obsidian plinth
#

can i get the docs for the logic

young knoll
#

Itโ€™s all packets for messing with biome colors atm

#

Packets and NMS

obsidian plinth
#

o i hate messing with packets

#

i always break something

drowsy helm
#

yes but it'll be a miniscule window

#

anbd you can have measures in place to make sure it doesnt happen

#

query whether the player's data has been loaded when accessing it

young knoll
#

If itโ€™s during onEnable afaik no

#

I donโ€™t think players can join before all onEnables are done

drowsy helm
#

they said during runtime so id assume after onEnable

young knoll
#

I see

slim wigeon
#

Trying to copy Huuuge Casino slot machines but asking ChatGPT, don't know if I trust it for programming help. Is there a JQuery discord server like this one that I can ask?

graceful oak
#

Trying to use NMS I put the 1.19.4-R0.1-SNAPSHOT into my dependency but whenever I import something its from the 1.19.3-R0.1-SNAPSHOT any reason why this would happen?

What I have

      <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.19.4-R0.1-SNAPSHOT</version>
            <classifier>remapped-mojang</classifier>
            <scope>provided</scope>
        </dependency>```

What happens when I import something
```import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;```
young knoll
#

R3 is the correct version for 1.19.4

graceful oak
graceful oak
#

Im trying to play around with spawning player entities through packets and its not letting me get the serverLevel through the world. I found a recource where this worked for a player but its difficult to find anything recent with what I want to do.

This is the error im getting
Caused by: java.lang.NoSuchMethodError: 'net.minecraft.server.level.ServerLevel org.bukkit.craftbukkit.v1_19_R3.CraftWorld.getHandle()

This is the code below

        CraftWorld world = (CraftWorld) location.getWorld();
        MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
        ServerLevel level = world.getHandle().getLevel();
young knoll
#

Did you forget to remap

graceful oak
#

I did remapped when I did build tools

#

Is there a way for me to double check?

young knoll
#

Yes but did you remap when building your plugin

graceful oak
#

How do you do that?

young knoll
#

?nms

graceful oak
#

Yeah I do have that

wet breach
#

You read that post and the post it links to?

#

Important that both are followed

graceful oak
#

By other links do you just mean the build tools link or am I blind?

quaint mantle
#

I was thinking about writing a lib for typesafe resource pack stuff, so I was thinking about writring a gradle plugin to generate classes for each custom item that has methods like getItem ect what do you guys think about that or would there be a nicer UI way to do it

graceful oak
#

Yeah thats the one I just went through I did all of that

wet breach
tender seal
#

how do I make it so an announcement has a link embedded into a work? For instance clicking "Discord" in the announcement will take to you to discord.gg

graceful oak
#

Im kinda lost here ngl I have had everything that blog post done but it wont work

wet breach
#

Yeah its about buildtools. The first link which is the link that the bot gives describes what needs to be in your pom

#

Second link tells you how to get the appropriate jars for remapping

graceful oak
#

yeah I did the buildtools with --remapped and all the other steps everything has been done

wet breach
#

Ah ok, and still having issues?

graceful oak
#

Still getting the same error tho

wet breach
#

What is the error?

graceful oak
#

Caused by: java.lang.NoSuchMethodError: 'net.minecraft.server.level.ServerLevel org.bukkit.craftbukkit.v1_19_R3.CraftWorld.getHandle()'

wet breach
#

Using intellij?

graceful oak
#

Yes

wet breach
#

Have you tried clearing caches?

graceful oak
#

I may have what do you do to do that

wet breach
#

Um what? Lol

#

Oh i understand now

#

So i dont particularly use intellij but somewhere in the menus there is an option to clear caches

remote swallow
#

ij calls it invalidating caches iirc

young knoll
#

Are you building with maven

#

Or are you building with whatever intelij has

wet breach
graceful oak
#

ok i cleared the cache going to give it a try after its finished setting back yup

#

and yes im using maven

wet breach
#

Next step is what coll is asking if clearing or invalidating caches doesnt fix problem. Just tell us how exactly you initiate building

graceful oak
#

Ok yeah still getting the same thing

To build I have the file being built right into my plugin folder with

<outputFile>D:\Minecraft Coding\3vasivesmp Test Server\plugins\EvasiveSMPCore.jar</outputFile>

and then I use the package button in the Lifecycle

wet breach
#

Are you right clicking? On project to do this? Or using the menu build option?

#

Ideally if i recall you should only need to hit the big green play button

graceful oak
#

The green button also does work

young knoll
graceful oak
#

Yeah

wet breach
#

Btw if i recall you need to surround the path with quotes if it contains spaces

graceful oak
#

It also stops it from keeping a previous file and renaming it original it just remakes the file

wet breach
#

Anyways, it could be an issue with your pom. Which if you can use the paste site

#

?paste

undone axleBOT
graceful oak
#

yeah ill post a pastebin

wet breach
#

Did you make sure remapped mojang is in local repo?

#

Also

#

Fix your java version for the compiler

#

You using a too outdated version and this is actually most likely your problem right there

wet breach
#

And the java version. They have it set to java 1.8

#

Needs to be 17 minimum

young knoll
#

Maven is putting the regular output into your plugins folder, you need it to be putting the reobfuscated one in there

wet breach
#

Or 18

#

If you use the incorrect java version you will get the error you are experiencing too since the buildtool jars and mojang stuff for the version of mc you are targeting use a more updated java version

wet breach
#

I think its just the java version lol

#

Anyways, also listen to coll as i have work to do uwu

graceful oak
#

What java version would you reccomend and im trying the output rn

wet breach
#

18 if you can

#

But i believe 17 is fine too

young knoll
#

17 is recommended

#

Itโ€™s LTS

tender seal
#

I have ranks on my server, I have luckperms, essentialsx, and vault, but my rank isn't showing on the scoreboard and it's still set to the default setting. How can I fix this?

wet breach
graceful oak
#

Am i doing this right?

<java.version>1.17</java.version>


Module EvasiveSMPCore SDK 17 is not compatible with the source version 17.

Upgrade Module SDK in project settings to 17 or higher. Open project settings.
#

I swapped to 17 in the project settings but im getting that

#

Oh i got it just didnt need the 1.17 just 17

#

ok well changing this broke one of my dependencies
Caused by: java.lang.ClassNotFoundException: com.jeff_media.armorequipevent.ArmorEquipEvent

potent ibex
#
new BukkitRunnable() {
  int currentIndex = 0;
  int iterations = 0;
  final int maxIterations = Math.min(4, nearbyMobs.size());

  @Override
   public void run() {
    if (iterations >= maxIterations) {
        cancel();
        return;
    }

   LivingEntity mob = nearbyMobs.get(currentIndex);
   mob.damage(event.getDamage() + iterations);
   mob.getWorld().strikeLightningEffect(mob.getLocation());

   currentIndex++;
   iterations++;
  }
}.runTaskTimer(JavaPlugin.getPlugin(Sirius.class), 5L, 5L);
#

Hey guys is this code performance wise inefficient?

#

It does work fine without errors but just wanted to know if there is better way that I don't know to achieve this

graceful oak
#

Ok wait When I use outputDirectory in maven it doesnt use my dependencies but when I use outputFile it works ?

#

Ok im all good had to make a maven profile to build it correctly the guide helped a lot thanks

frail gazelle
wise mesa
#

how can I rotate a worldedit clipboard before pasting it?

frail gazelle
#

NMS Error

graceful oak
#

Have a question about fake player packets. If I make a "npc" How exactly would I check if a player is hitting it if its only player side? Would I have to check client packets (if thats possible) or is there a better way to do it. Im trying to replicate servers that have player like npcs that can attack like hypixel or MMO servers to take advantage of skins instead of having to make custom textures

young knoll
#

You have to listen for incoming attack packets afaik

wise mesa
#

will spigot ever add an api for npcs/fake players

young knoll
#

Doubtful

#

But maybe

wary wren
#

Does someone has experience with using the MULTI_BLOCK_CHANGE packet (protocollib) with not fulling up the WrappedBlockData completly and the 0/0/0 origin chunk block is always empty / not set

sullen marlin
#

Why do you need protocollib

wary wren
#

I'm just using protocollib to sent the packets but I already tried a minimal setup with just nms and the origin will be empty.

Example how I'm testing it. When im removing the if case and set all blocks, it also fills the origin chunk block otherwise its not set or just ignored

int index = 0;
      for (int relativeX = 0; relativeX < 16; relativeX++) {
        for (int relativeY = 0; relativeY < 16; relativeY++) {
          for (int relativeZ = 0; relativeZ < 16; relativeZ++) {
            Material material = Material.BLACK_STAINED_GLASS;
            
            // with this line, the origin block at 0, 0, 0 will be missing.
            // this is just a example logic to show
            if(relativeX > 5 || relativeZ > 5) continue;
            
            positions[index] = (short) (relativeX << 8 | relativeZ << 4 | relativeY);
            blockDatas[index] = WrappedBlockData.createData(material);
            index++;
          }
        }
      }
sullen marlin
#

Why are you not using the API

sullen marlin
#

Player#sendBlockChange(s)

slim wigeon
#

How do I get the item's slot index?``` if( !hopperLib.isVaild(event.getSource().getLocation().getBlock()) ) { return; }
event.setCancelled(true);

    Inventory sourInv = event.getInitiator(); Inventory destInv = event.getDestination();
    ItemStack item = event.getItem().clone(); item.setAmount(8);
    
    if( hopperLib.isVaild(event.getDestination().getLocation().getBlock()) ) {
        
    }```
potent ibex
#

ur right, I just need one of them

#

and also is it better to separate into distinct plugins if I have multiple features like item, gui, npc, level plugin in one plugin.jar or it doesn't matter in terms of performance

slim wigeon
undone axleBOT
#

A private message has been sent to your SpigotMC.org account for verification!

lavish cliff
#

wich is the best method for control if a player have an item?

echo basalt
#

.

fringe yew
#

has spigot already got 1.20 support?

echo basalt
#

Have you heard an announcement?

remote swallow
#

untill 1.20 releases fully spigot cant release an update

lavish cliff
# echo basalt .

so , just re-create the item in the event ( because i wanna use it here ) and it's done(?)

echo basalt
#

uh

#

?pdc

echo basalt
#

most likely what you want

#

your original question was bad

lavish cliff
#

oh ok

#

thx

#

can i use capital letters or only numbers?

echo basalt
#

where?

lavish cliff
#

our-custom-key

echo basalt
#

oh

#

yeah that's just a key name

lavish cliff
#

so , can i use what it want ?

echo basalt
#

there are some rules but yeah

lavish cliff
#

ok thx :))

mystic merlin
#

when minecraft 1.20 comes out will spigot have a update?

echo basalt
#

obviously

remote swallow
#

should be iirc

eternal night
#

eh

#

to be seen โ„ข๏ธ

quaint mantle
#

why this: Bukkit.getScheduler().cancelTask(0); dont stop this task: Bukkit.getScheduler().runTaskTimer(PlaygroundHC_Survival.instance(), () -> { p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.YELLOW + "> Jesteล› w trybie sprawdzania <")); }, 0, 30);

#

?

remote swallow
#

because that isnt the right task id im gonna guess

quaint mantle
#

this plugin has only one task

#

then task id = 0

remote swallow
#
BukkitTask task = Bukkit.getScheduler().runTaskTimer(PlaygroundHC_Survival.instance(), () -> {
                            p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.YELLOW + "> Jesteล› w trybie sprawdzania <"));
                        }, 0, 30);

Bukkit.getScheduler().cancelTask(task);```
remote swallow
quaint mantle
#

ok

#

but how to set task id?

remote swallow
#

read the code i sent

quaint mantle
#

this code not works becouse I have task in deferent verible

#

and stop has deferent verible

remote swallow
#

why are you stopping the task elsewhere

quaint mantle
#

becouse one command starts it and deferent stops

remote swallow
#

keep an instance of the class then

#

then add a getter

#

or use a manager class type deal

#

you have 1 instance of the class and have a start and stop

quaint mantle
#

sorry, in deferent if

remote swallow
#

one min

quaint mantle
#
Player p = (Player) sender;
                    if (args[0].contains("on")){
                        p.sendMessage(ChatColor.GREEN + "Uruchomiono tryb sprawdzania!");
                        p.getInventory().clear();
                        p.setGameMode(GameMode.CREATIVE);
                        BukkitTask task = Bukkit.getScheduler().runTaskTimer(PlaygroundHC_Survival.instance(), () -> {
                            p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.YELLOW + "> Jesteล› w trybie sprawdzania <"));
                        }, 0, 30);
                        p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.YELLOW + ">> Jesteล› w trybie sprawdzania <<"));
                        PotionEffect effect = new PotionEffect(PotionEffectType.INVISIBILITY,Integer.MAX_VALUE,0,false,false);
                        effect.apply(p);


                    }
                    if (args[0].contains("off")){
                        Bukkit.getScheduler().cancelTask(task);
                        p.setGameMode(GameMode.SURVIVAL);
                        p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(""));
                        p.removePotionEffect(PotionEffectType.INVISIBILITY);
                    }```
shadow night
#

Guys, I have a project and there are like a lot of classes that are all of the same category and I need to make a list of them, should I make like an enum or a class that returns a list or is there a way to do that stuff automatically?

river oracle
remote swallow
#

most code ive wrote in the past like 3 weeks

shadow night
tardy delta
#

isnt there Class#getSubtypes or smth?

shadow night
#

That exists?

tardy delta
#

nah

#

only with reflections library

normal thicket
#

not the best quality on rx580

#

idk why

shadow night
remote swallow
#

that looks fine, just low quality

tardy delta
#

i still have no idea what youre doing

remote swallow
#

is it just a low poly game

normal thicket
#

in reality it is pice of sht

remote swallow
#

you sure it not just your monitor

normal thicket
#

maybe but on some games it doesnt have blury textures

#

thats why I am confused

#

oh this is not general ._.

#

sorry

#

I texted in general before and messed up

river oracle
#

Id add them to a registry with reflection than retrieve them from the registry

shadow night
#

I need to learn java because my understanding of what reflections are is basically 0

river oracle
#

This would be a pretty good application of it especially as you scale it would reduce your workload a shit ton

tardy delta
#

hmm Math.ceil and Math.floor should always return a double that can be represented as an int without precision loss right?

#

im kinda wondering why they dont return a long

eternal oxide
#

So you can continue the builder pattern

tardy delta
#

especially gets annoying in langs without implicit casts

grave kayak
#

hey im trying to make a GUI that enchants a selected item with selected enchantments, but im getting a null pointer exception when trying to pass the selected enchantments to the confirmation page. I have no idea how to fix this, been trying for hours but nothing seems to work. any help would be much appreciated!
here is two of the classes: https://pastebin.com/8WD4hvrn, https://pastebin.com/jhc5S3u4 and here is the error: https://pastebin.com/upLp550t

eternal oxide
#

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.getOrDefault(Object, Object)" because "this.selectedEnchantments" is null

#

ConfirmationMenu.java:51

#

you either didn;t set it or you passed in null

grave kayak
remote swallow
#

figure out why selectedEnchantments is null

eternal oxide
#

where do you initialize the ConfirmationMenu class?

tardy delta
#

kinda looking awful without implicit casts

eternal oxide
#

look at line 60

#

you create a new instance passing in selectedEnchantments

#

Now find where in that class you set the Field selectedEnchantments

remote swallow
#

oh and also, you shouldnt be storing in a Player instance

grave kayak
grave kayak
eternal oxide
#

you are never putting any enchantments in the Map

remote swallow
#

store their uuid

#

a player instance expires when they log out

grave kayak
grave kayak
remote swallow
eternal oxide
livid dove
#

Polite PSA to devs out there making lottery plugins on a set timer.

Random uses the current server time for determing the number ... predictably so ๐Ÿคฃ๐Ÿ˜ญ

#

Use Secure Random instead ๐Ÿ˜…

tardy delta
#

securerandom

livid dove
#

HAHA BEST YOU TO IT BUDDY

eternal oxide
#

Or, don;t encourage gambling

livid dove
#

Eh , just a good QoL piece of semi obscure java knowledge either way

tardy delta
#

who will actually figure out the exact ms your method runs

#

have fun id say

flint coyote
livid dove
eternal oxide
#

if they are going to put that much effort into guessing your random, they deserve the free rewards

flint coyote
#

Therefore people would have to know when the server started and at which millisecond the plugins onEnable was called

livid dove
#

Either way think about the human subconscious factor of a set interval repeating task using a random number gen based on time values.

Eventually someone is gonna subconsciously rain man it

eternal oxide
#

not going to happen, not unless they have direct access to the server hardware

flint coyote
#

at which point some free rewards are the least of your problems lol