#help-development

1 messages · Page 1584 of 1

paper geyser
#

alright thank you!

static whale
#

I was also wondering, how does one go about having multiple configs for their plugin with different names? I’m assuming it’s something to do with the FileConfiguration class but I’m not sure

smoky finch
#

I'm pretty sure that question is quite common that you can find multiple solutions on Google

static whale
#

I did try searching but I didn’t get clear answers on it

#

I would have thought it’d be talked about more

#

Thanks a bunch mate

quaint mantle
#

Doesnt works

paper geyser
#

weird thing

quaint mantle
#

i need desc not asc

paper geyser
#

IntelliJ keeps telling me the .playerConnection isn't resolved


import io.netty.channel.*;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;

public class PacketListener {

    public static void start(Player player) {
        ChannelDuplexHandler channelDuplexHandler = new ChannelDuplexHandler() {
            @Override
            public void channelRead(ChannelHandlerContext channelHandlerContext, Object packet) throws Exception {

                super.channelRead(channelHandlerContext, packet);

            }

            @Override
            public void write(ChannelHandlerContext channelHandlerContext, Object packet, ChannelPromise channelPromise) throws Exception {

                super.write(channelHandlerContext, packet, channelPromise);

            }
        };

        ChannelPipeline pipeline = ((CraftPlayer) player).getHandle().playerConnection.networkManager.channel.pipeline();
        pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
    }
}```
quaint mantle
#

and i execute this code on phpmyadmin and it works

#

it only on minecraft

eternal oxide
#

The SQL is fine, you are putting it in some order list

paper geyser
#

im following a course

#

for java

#

i should clarify i have a very mediocre/subpar grasp on whats happening

#

yeah it was haha

#

nms was changed in 1.17? :(

ivory sleet
#

There’s no nms field called playerConnection in 1.17

paper geyser
#

wait

#

yes ofc it was

#

bro nms is changed every update shhh

#

alright is there an alternative or

ivory sleet
#

Well you could develop against the mojmaps

#

[:

paper geyser
#

that is interesting

#

but yeah i have no clue how to do the packet thing i bet its way out of my league haha

#

should i wait or just try to tackle it with tutorials

ivory sleet
#

I am pretty sure there is no tutorial for 1.17 specifically

#

Unless someone is speed running the classic spigot dev

#

Although this makes me wonder, why packets?

paper geyser
#

oh!

#

so have you played on wynncraft before?

tame coral
#

i knew nothing about java when i started coding my plugin

ivory sleet
#

Myes

tame coral
#

learned all on the field

paper geyser
#

yeah the tree-chopping system

#

i want to recreate it

ivory sleet
#

Uh Idk that tho

#

Kinda played before the new system arrived

tame coral
#

and did the packets thing as my second project

paper geyser
#

oh ok

tame coral
#

just try it

chrome beacon
#

Shouldn't be to hard

quaint mantle
#

Isn’t it for right click only? I’ld like to detect left click too

paper geyser
#

so when you mine it cancels the event and sends the packet that you broke it to only the player that broke it

#

so to everyone else it looks like the tree is still there

#

even when you've mined it

ivory sleet
#

There’s a method for that

chrome beacon
paper geyser
#

oh?

ivory sleet
#

Like an api method pretty sure

paper geyser
#

oh thats great

#

what method is it?

paper geyser
#

yeah thing is im like super new to java like ive just got my hand on commands on spigot and im coming from skript

#

OH

#

the name alone just sounds perfect

tame coral
#

I don't understand why you would want that only the player that broke it could see it destroyed though 🤔

paper geyser
#

rpg style game

#

want it to be mineable for everyone

drowsy helm
#

good for farming

paper geyser
#

yeah

#

makes it so no one has to wait to mine

tame coral
ivory sleet
#

?jd-s I do suggest looking into this when you want to search for how to do stuff before resorting to packets.

undone axleBOT
paper geyser
#

better then the wait and regen method bc of that

tame coral
#

I see

#

Good luck anyways, sounds like a big project

drowsy helm
#

it isnt really that much work

paper geyser
#

hopefully one that wll teach me alot as a dev haha

drowsy helm
#

you can do it in one listener

tame coral
#

i like to learn

ivory sleet
quaint mantle
#

That’s from the spigot Java docs

paper geyser
#

alright so

#

is it ok if i put chunks of code as i go along

ivory sleet
#

?paste them chad

undone axleBOT
paper geyser
#

swag ty

#

this should be good so far for cancelling the event right?

#

actually no dont answer that i can just test

ivory sleet
#

😌

tardy delta
#

something like this?

return Bukkit.getWorlds().size() > 0;
hybrid spoke
paper geyser
#

haha

#

ive seen it used on so many people

#

ive fallen

#

oh noooo

#

haha but yeah i got like half of it working

hybrid spoke
opal juniper
tardy delta
#

ok

hybrid spoke
tame coral
#

oh no

opal juniper
#

Well then some real wacky shit has gone on

tardy delta
#

-1 worlds 🤔

ivory sleet
#

throw new AssertionError();

opal juniper
#

throw new wtfHaveYouDoneError();

tardy delta
#

never heard of smh

opal juniper
#

this better discord documentation is pretty shit

ivory sleet
#

Is it?

opal juniper
#

well

#

it is

hybrid spoke
opal juniper
#

😳

#

uhhh

#

nothing to see here

tardy delta
#

and uhh how can i create a full colored bossbar?

#

barstyle.solid?

#

or segmented_20?

opal juniper
#

but

hybrid spoke
#

what what hwat

#

bossbar should have a #setColor method

opal juniper
#

the github wiki is still pretty terrible

#

and my lack of js experience not helping

tardy delta
#

oh

#

i did it like this

BossBar bar = Bukkit.createBossBar(key, "Vanished", BarColor.BLUE, BarStyle.SEGMENTED_20);
limpid bronze
#

Hey, I'm trying to get a custom head except (https://minecraft-heads.com/custom-heads/alphabet/8902-blue-arrow-left)
I have to set it in a GUI. I can set the owner but the link only offers that :
/give @p minecraft:player_head{display:{Name:"{\"text\":\"Blue Arrow Left\"}"},SkullOwner:{Id:[I;2019808580,1338983880,-1755567695,414268273],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNWFlNzg0NTFiZjI2Y2Y0OWZkNWY1NGNkOGYyYjM3Y2QyNWM5MmU1Y2E3NjI5OGIzNjM0Y2I1NDFlOWFkODkifX19"}]}}} 1
How can I get the custom head for my plugin?

ivory sleet
#

The color is immutable yeah

hybrid spoke
ivory sleet
#

No it probably isn’t lol

hybrid spoke
#

^^

hybrid spoke
#

copy the minecraft URL + the code right under and get the head from that url

limpid bronze
#

Okay but how do I get the url of the head ?

hybrid spoke
#

@limpid bronze thats the url you need to use to get the skin

paper geyser
#

alright so you guys mentioned using protocollib to send packets right

ivory sleet
#

Yeah

#

Or some packet wrapper lib

paper geyser
#

would you mind helping me figure out how to implement that or send a tutorial?

#

all the tutorials i can find are 2 hours and i was hoping to see if there's a quicker summary haha

ivory sleet
#

Wait

#

Wtf

#

Uh 1 sec

hybrid spoke
ivory sleet
#

There

paper geyser
#

ill check both out! much appreciated

limpid bronze
paper geyser
#

nope i said nothing

hybrid spoke
#

thats the link you need

quaint mantle
#

Not 100% spigot related, but is there a way to call a function when a class gets extended

#

Idk how to explain this

ivory sleet
#

Yea

quaint mantle
#

I want to extend an abstract class and automatically register it to an command manager

ivory sleet
#

Let the super class call a function in the constructor, an init block or smntg

quaint mantle
#

Ah okay

hybrid spoke
#

or find it via reflection

#

or add it yourself

quaint mantle
#

But do I still need to call super()

ivory sleet
#

Uh

#

Well that depends

hybrid spoke
#

if your super class has a constructor your subclasses have to

ivory sleet
#

If it’s not a nullary constructor also

#

But then comic you’d probably need to call something like super(commandManager);

#

assuming the superclass requires a CommandManager

quaint mantle
#

So there's not a way to make it automated?

hybrid spoke
#

if he wants to register it on the command manager he would need to DI it

#

so yeah, his subclasses would have to call a super in their constructor

quaint mantle
#

Ah okay

hybrid spoke
ivory sleet
#

you could have a static singleton of your CommandManager

#

Tho it would lead to rigid code

hybrid spoke
#

but reflections aren't necressary and overcomplicated

quaint mantle
#

Yeah I made it static

#

gtg*

hybrid spoke
#

and if we are technically correct

#

there is always a super

#

in every constructor

ivory sleet
#

class CmdBase {
{
CmdManager.getInstance().register(this);
}
}

class HelpCmd extends CmdBase {

}

#

Or smtng

hybrid spoke
#

leading to the top of the superclasses

#

~Object~

ivory sleet
#

The super of a nullary constructor is inferred which is nice tho

hybrid spoke
#

so no matter what he does

#

there is always a super

#

in a hidden on runtime created default constructor

tardy delta
#

any ideas to add to my plugin?

hybrid spoke
paper geyser
#

what plugin are you making

tardy delta
#

uhh it has alot of functions

paper geyser
#

like?

tardy delta
#

trade command

#

locks

paper geyser
#

a way to view people you've traded with in the past and what got traded

tardy delta
#

👀

#

probably storing it in files then

paper geyser
#

yeah haha

#

so you can see how you got fucked left and right while getting scammed

#

"oh this wasnt... the item i thought it was..."

#

"luckily i can show staff what happened"

#

and bahm easier resolution

hybrid spoke
#

a-giant-black-hole

paper geyser
#

hmmm

#

WAIT

hybrid spoke
#

or replace the minecraft fire with yourself animated particles

paper geyser
#

i just realized

hybrid spoke
#

or or or

paper geyser
#

i was about to ask why my code wasnt working but i forgot to reference...

tardy delta
#

ahh lemme make a gui for prefixes

hybrid spoke
#

what about the monumental black hole?

tardy delta
#

the what-

hybrid spoke
#

⚫ which do skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkrrrrrt and sucking everything in

tardy delta
#

oh

hybrid spoke
#

with cool effects

#

gravity

tardy delta
#

kinda void with cool effects

hybrid spoke
#

yeah just a black hole

tardy delta
#

sucking void

#

oh i forgot interface methods cant have a body 💀

#

probably confusing C#

hybrid spoke
#

they can

#

default or static methods

tardy delta
#

oh

paper geyser
#

im ngl i have no idea what im doing

hybrid spoke
paper geyser
#

i forgot to send my follow up question-

#

so int he example theres this

#
fakeExplosion.getDoubles().
    write(0, player.getLocation().getX()).
    write(1, player.getLocation().getY()).
    write(2, player.getLocation().getZ());
fakeExplosion.getFloat().write(0, 3.0F);```
#

and im confused by

#
    write(0, player.getLocation().getX()).
    write(1, player.getLocation().getY()).
    write(2, player.getLocation().getZ());
fakeExplosion.getFloat().write(0, 3.0F);```
#

this

#

its just getting the location

#

to send the packet to right?

#

so i can just change the packet type to BLOCK_BREAK and it should work right?

tardy delta
#

brr coding in C# and then going back to java goes brrr

#

also isnt it possible to get the slots of an inventory?

#

kinda list

paper geyser
#

WAIT

#

player.sendBlockChange() IS A THING

#

ok but

austere cove
#

is there a way to make a degenerate bounding box?

#

i.e. where min > max

tardy delta
#

someone who has the vault discord?

tacit drift
strange elk
#

I saw in the code BlockDispenser.eventFired but I never see it actually being set, any clue where it is being set cause i don't see it

tardy delta
#

oh sad

paper geyser
#

good news! it works1

burnt kettle
paper geyser
#

bad news! no it doesnt

#

when you break something else it upda

#

it updates*

#

any way to prevent this from happening and make players wait the 10 seconds\

#

OH WAIT

#

ITS UPDATING

tardy delta
#

and getslot() after it doesnt work

burnt kettle
tardy delta
#

well actually it was a dumb question of me

#

already figured out another way

burnt kettle
#

yeah i didn't really understand what you meant

#

very nice

tardy delta
#

i also dont😵‍💫

paper geyser
hybrid spoke
tardy delta
#

yes iknow

paper geyser
#

just gotta figure out a way around the block updating

burnt kettle
#

updating client side?

#

or server side

paper geyser
#

it updates client side

burnt kettle
#

packets?

paper geyser
#

yeah

#

using player.sendBlockChange

burnt kettle
#

that isn't packets

paper geyser
#

oh

tardy delta
#

smh my intellij cant work with *

#

for imports

burnt kettle
#

or at least i don't think it is

paper geyser
#

hmm idk what it would be then haha

burnt kettle
#

you could use the protocollib api if you wanted

paper geyser
#

hmm

#

would that fix my issue

#

or would it have the same outcome?

chrome beacon
#

Do you want it to stop from updating when right clicked?

burnt kettle
#

idk i don't really do packets often

paper geyser
#

yes

#

and also when blocks around it are mined

#

(i.e block above/below)

chrome beacon
#

I can send you the code I'm using give me a min

paper geyser
#

oh my god you're a saviour

#

lets start the hashtag #Olivoissexyandswag

tardy delta
#

#Olivoissexyandswag

ivory sleet
chrome beacon
#

So I don't really care and it's easier than explaining it

ivory sleet
#

Alrighty

hybrid spoke
#

Olivio is 5heading again by let others test his code

#

so he doesn't have any issues when implementing

chrome beacon
#

I mean that code has been running on quite a few servers so it should be fine 😅

hybrid spoke
#

rip those servers

hollow lodge
#

How would I set the slots in an anvil GUI? (1.17.1) I have tried the usual way like how you would set a chest's content, with slots 0, 1 and 2 but that doesn't do anything.

hollow lodge
#
Inventory anvil = Bukkit.createInventory(player, InventoryType.ANVIL);
                player.openInventory(anvil);
                anvil.setItem(0, new ItemStack(Material.PAPER));
hybrid spoke
rigid hazel
#
players.add(this.getServer().getOfflinePlayer(playerUUID));
playerUUID = 1234; // Example
rigid hazel
#

Wait

hollow lodge
#

Yeah that also doesn't work

rigid hazel
#
Player player;
player.getUniqueId().toString() = 5678
hollow lodge
#

It opens the Anvil but no item.

rigid hazel
#

Why the UUID changes, after adding an OfflinePlayer to a list and the get the UUID back , but casted to a Player?

chrome beacon
rigid hazel
#

I know

#

It is an example to symbolize the difference.

chrome beacon
#

Anyway it might be offline mode UUID

rigid hazel
chrome beacon
#

I mean it shouldn't change but that would be the only reason

hybrid spoke
#

just if you got an offlineplayer who doesnt exist by the name and it couldnt find the uuid

rigid hazel
#

It exists 100%

#

I tested it multiple times with my own account.

rigid hazel
chrome beacon
#

Send your full code

rigid hazel
chrome beacon
#

The information you're giving doesn't make any sense send all of it

hybrid spoke
#

yeah i can't guess what you mean

#

its just confusing

rigid hazel
#

Okay.

#

Plugin.java:

chrome beacon
#

?paste

undone axleBOT
rigid hazel
#

ServerJoinListener.java:

#

RolePlayer.java:

hybrid spoke
rigid hazel
ivory sleet
#

Send entire classes

rigid hazel
#

It is the whole code

hybrid spoke
#

you need to send more

#

its not

ivory sleet
#

It literally isn’t

hybrid spoke
#

its just a piece of your code

rigid hazel
#

paste-md has a max amount of code.

#

I can't paste it in

ivory sleet
#

Use another pasting service then

rigid hazel
#

the class is too large

ivory sleet
#

Or push to GitHub

rigid hazel
#

I had

#

But it is private

quiet ice
#

or create a github gist

ivory sleet
#

^

rigid hazel
hybrid spoke
#

never heard of SRP?

ivory sleet
#

Then share it

rigid hazel
#

I had.

#

@ivory sleet

ivory sleet
#

Link me then

rigid hazel
#

See the links

quiet ice
#

So where ist it?

ivory sleet
#

That’s me paste bin

#

Not a gist

#

Gist != pastebin

hollow lodge
#

Anyone else knows how to set items inside an Inventory GUI? (1.17.1)

rigid hazel
ivory sleet
ivory sleet
hybrid spoke
hybrid spoke
#

"go fullfill it"

#

you need to provide more

#

at least entire methods

hollow lodge
hybrid spoke
#

we need to understand your code to help you.

rigid hazel
quiet ice
#

are you sure that you are not operating on a clone?

ivory sleet
#

It does tho kyllian

#

Assuming you’re not implementing it yourself or some other stupid shit

rigid hazel
hollow lodge
#

its just this:

Inventory anvil = Bukkit.createInventory(player, InventoryType.ANVIL);
                anvil.addItem(new ItemStack(Material.DIAMOND));
                player.openInventory(anvil);
rigid hazel
quiet ice
#

I think so at least

rigid hazel
#

Okay. That was the whole code.

#

@hybrid spoke

hollow lodge
hybrid spoke
ivory sleet
#

Are you suppose to create an anvil inventory with the player holder

hollow lodge
#

I am not sure, I can try setting it to null I suppose?

ivory sleet
#

Thought passing Players to inventory creation was only for the PlayerInventories

#

Yeah try that maybe

hybrid spoke
#

its not

rigid hazel
#

RolePlayer.java Line 16 and 17

hybrid spoke
#

AnvilGUI is also doing that

#

and that works fine

ivory sleet
#

Just because they do it doesn’t mean it’s suddenly right but I guess. Haven’t looked at implementation so cant tell.

rigid hazel
#

@hybrid spoke

hybrid spoke
#

why are you adding the player to the onlineplayer list?

rigid hazel
#

In Plugin.java

#

Ups. Wait

#

I realized something#

hollow lodge
#

Yeah I don't get it, am I not allowed to create an inventory inside of an event?

rigid hazel
hybrid spoke
rigid hazel
#

GodCipher.

hybrid spoke
#

i am here

rigid hazel
#

In Plugin.java line 37

rigid hazel
#

Oh. Line 38

ivory sleet
paper geyser
#

is there a way to affect every block in an array list?

ivory sleet
#

Mye

paper geyser
#

like use player.sendBlockChange for every block in an array

ivory sleet
#

That’s possible totally

chrome beacon
#

There is a multiblock change packet

#

It's just really annoying to use

paper geyser
#

ik

#

im really trying my hardest to avoid it

hybrid spoke
#

i am really not sure what you are trying to do or even doing there. your code is a huge mess. afaik the UUID is immutable so you can't just change it. @rigid hazel

rigid hazel
#

Nevermind. I will fix it by myself.

#

Even I commented so much. 😫

hybrid spoke
#

so the uuid of the same player can't just change. it have to be 2 different player instances

paper geyser
#

ill send over my code 1 sec

#

this project has taught me alot

tardy delta
#

arraylist without <> smh

quiet ice
#

fuck generics

paper geyser
quiet ice
#

yes

tardy delta
#

yes

paper geyser
#

alright

ivory sleet
#

Raw types is generally a bad idea

hybrid spoke
#

okay for the procotol

paper geyser
#

ahhh alright

hybrid spoke
#

you are creating a local arraylist

#

without generics

#

adding the block

#

and throwing it away

quiet ice
#

also removing them later

paper geyser
#

yes but im throwing it away after 10 seconds

quiet ice
#

a hashset might be better here

paper geyser
#

its a bypass for the updating

#

oh

hybrid spoke
#

a bypass for the updating? you are just adding it, never querying it and later removing it

quiet ice
#

but since you do not invoke #contain nor use the return value of #remove, why would you need to have the arraylist in the first place?

paper geyser
#

ok so

#

what i ant to do is

#

whenever you mine it turns the block into bedrock client side

#

but when you mine a block below/above/near it

hybrid spoke
#

you should completely refactor your code

paper geyser
#

it updates on the client side completely bypassing the 10 second wait time

hybrid spoke
#

you are also defining a local Location variable at the beginning of your function

#

and never querying it again

paper geyser
#

ahh i used it at one point

#

never got rid of it

#

wait

quiet ice
paper geyser
#

yeah

#

i want that

#

so other people can mine during the other person's cooldown

#

if that makes sense?

hybrid spoke
#

why aren't you just canceling the break event for people inside a list?

#

that would be much easier

paper geyser
#

y-

#

you can do that?

quiet ice
#

uh yes

hybrid spoke
#

you shouldn't handle with packets if you just barely know java/spigot

paper geyser
#

yeah you're right

quiet ice
#

But if you absolutely need to have it be bedrock, then I think the easiest way would be to spam that packet over and over again

paper geyser
#

with the cancel break event for people inside a list

#

can people walk through it

#

like

#

the person who's mined

#

they wouldn't be able to right?

#

bc serverside its still there

hybrid spoke
#

canceling the break event will let them not break that block

quiet ice
#

oh oh, this sounds complicated

paper geyser
hybrid spoke
#

but what i was understanding

#

explain more detailed

paper geyser
#

yeah so

#

it cancels the event for x players right

#

lets say y player is the person who breaks the block

hybrid spoke
#

for the players defined in the list, right.

paper geyser
#

can y player walk through the block even though on x player's screen its not mined

hybrid spoke
#

yeah

paper geyser
#

OH

#

THATS EXACTLY WHAT I WANT

quiet ice
#

But ACs will not be happy with it at all

#

But I would say no, that should not be possible

#

this requires protocol stuff

paper geyser
#

oh so with protocollib i could do that?

quiet ice
#

I recommend changing your design plans to remove or at least minimise the usage of NMS (and other protocol hackery)

paper geyser
#

yeah haha

#

i'll try

hybrid spoke
#

it is possible

#

but not for him

paper geyser
#

plus this is only part of a demo i'd like to show to my player's before

hybrid spoke
#

without any help

paper geyser
#

yeah!

#

hopefully one day i can

#

its definetly possible wynncraft has done it

quiet ice
#

You can't have a block exist on one client but not on the other one without packet hackery

paper geyser
#

yeah

#

for now

hybrid spoke
quiet ice
#

Well, you could spawn a wall with sendPlayerBlockChange i guess, but that would require you to constantly spam it so the client does not recieve "hey, this is air"

hybrid spoke
#

but as soon as you click it its gone

#

just set an armorstand on the top of the players head

#

so he can't interact at all

#

easy

paper geyser
#

im back sorry

paper geyser
#

they should still be able to mine other parts

#

just not the part previously mined

#

which is what i was trying to do with arrays

#

everytime its mined it'd run through what the player recently mined and make that into bedrock on the player's side

hybrid spoke
#

but why if its gone after anyways?

paper geyser
#

well it goes away after 10 seconds

#

and i dont want people making a bypass ig

#

it'd feel weird idk haha

#

i want the players to move for resources bc it also helps with macros

#

the less ways people have to cheat the better

hybrid spoke
#

i am not sure if i understand you right.
currently you are dropping an extra log for every broken oak log block so there drops 2. 1 tick later you set at the location of the mined block a bedrock block CLIENTSIDE. after 10 seconds you change that clientside bedrock to a clientside oak log. why?

quiet ice
#

because other players should be able to proceed as usual

paper geyser
#

^

#

idk how to make it server side again haha

#

so client side work

#

s

crude charm
#

uhh

#

what

paper geyser
#

ok so

#

oak log gets mined

  1. cancel event
  2. set log to bedrock CLIENT SIDE so player cant mine until
  3. 10 seconds have passed and player can mine again
hybrid spoke
#
  1. they can not
#

its clientside

#

1 click and the block is gone

paper geyser
#

uhh?

quiet ice
#

And that is the issue

paper geyser
#

the event is cancelled

#

it works

#

the block never actually gets mined

#

because of step 1

hybrid spoke
#

ah i see

paper geyser
#

the issue is that when you click near the block it updates to whats server side

#

like mining right below the client side bedrock

#

and thats the oak log

hybrid spoke
#

ya never saw the canceling, my bad.
but anyways. just spam it like geol said

#

you dont have other options

paper geyser
#

ahh alright

#

that'd lag though right?

quiet ice
#

I think NMS has packet transformers that might do the job here, but I have never used those so ¯_(ツ)_/¯

paper geyser
#

ahhh

hybrid spoke
paper geyser
#

you are so smart

#

so its just a while loop

quiet ice
#

While loop?

hybrid spoke
#

if the player is playing on 3 fps normally they will probably have 2 afterwards but other changes shouldnt occur

#

while loop will crash your server

tardy delta
#

💀

paper geyser
#

ahh you're right-

#

hmmm how do i go about spamming that

#

a loop for sure right

hybrid spoke
#

timer

#

every tick

quiet ice
#

Call the method every tick

paper geyser
#

ahhh alright

quiet ice
#

It'll only be a few dozen bytes per tick per player, so it isn't too much of a deal lag-wise

#

That being said, it isn't the best solution

summer scroll
#

Does it require NMS to spawn an armor stand on the player passengers using packet and rotating the armor stand alongside with the player movement?

paper geyser
#

its close enough to what i wanted for a small demo

hybrid spoke
summer scroll
#

oh god nms

quiet ice
#

I think it should be possible using basic bukkit api

hybrid spoke
quiet ice
#

this does not require packets at all

hybrid spoke
#

but he want to do it with packets

paper geyser
#

no he doesnt

hybrid spoke
#

doing it server side

#

with enough players

#

can lag the server

#

so clientside is the best option here

summer scroll
#

Yeah it is possible, but you cannot teleport If there is passenger.

quiet ice
#

How would you want to do it clientside?

hybrid spoke
#

packets

#

xD

quiet ice
#

Which are created by teh server?

hybrid spoke
#

yeah but the server just know it created it

#

spawning an entity is frequently

#

spawning via packets is onetimer

quiet ice
#

Worst case scenario the server has 200 players online, so it maintains 200 real entities that are moved every tick, shouldn't be too resource consuming

summer scroll
#

Well, you can remove or spawn the armor stand whenever you want to basically.

lusty cipher
#

how can I quickly get a list of all plugin resources, so I can save them all to my data directory?

hybrid spoke
#

the server doesn't even know that the entity is there

#

its not moving without sending the packets to let it move

#

just the user the packet is send to know that the entity is there

quiet ice
#

So what, bukkit api can do it!

hybrid spoke
#

it can, but just serverside.

quiet ice
hybrid spoke
#

and doing such things serverside is bad

#

since the server and the client have to manage and handle the extra entity

#

if you send it via packets just the client have to handle it

summer scroll
#

Also I have a couple of issues using the api

quiet ice
#

A single extra entity! How outrageous!

summer scroll
#

Like when you go in the water, the armor stand will dismount from the player

hybrid spoke
#

a single extra entity for every online player on a 200 player server

summer scroll
#

And I don't want that to happen.

quiet ice
#

So then it is sealed, packet it is

hybrid spoke
#

f.e. a multiline title system with a title over the players nametag.

#

do you want to have 10 armorstand entities for each player on a 200 players server?

#

no you don't want to. you want to have them clientside so just the client have to handle them

quiet ice
#

Either way, the question was the question of possibillity, not whether it makes any sense

hybrid spoke
#

yeah we digressed. it is possible.

summer scroll
#

If I have to use NMS, that means I need to create a module for every version right?

#

I want it to support 1.14+

hybrid spoke
#

if you want to go that way, sure.

summer scroll
#

Are there any other way?

hybrid spoke
#

probably reflections. but i can't recommend that. reflections are bad.
otherwise doing a single plugin for every version

quiet ice
#

ono

hybrid spoke
#

but modules are the best way to go here ig

paper geyser
#

ok so

#
                    @Override
                    public void run() {
                        player.sendBlockChange(event.getBlock().getLocation(), Material.BEDROCK.createBlockData());
                    }

                }, 0L, 1L);```
I now have this code but how do I make it only run the amount of times I need it to (200)
hybrid spoke
paper geyser
#

aight

hybrid spoke
#

ah nvm you want the delay

#

just count up an integer

#

and if its on 200 cancel the task

summer scroll
#

Which part that requires the NMS?

hybrid spoke
quiet ice
#

Isn't that a really laggy solution?

hybrid spoke
#

shouldn't lag at all

quiet ice
#

Why not use a repeating task?

paper geyser
#

is there a way to get it to end after x ticks?

quiet ice
#

Instead of sheduling 200 tasks at once

hybrid spoke
summer scroll
#

he's using repeating task

paper geyser
#

I mean

#

we could get rid of the delay?

#

wait no

#

there needs to be a 1 tick delay before starting

#

but after that it should just be able to loop

quiet ice
#

Ah I got confused by the code

hybrid spoke
#

a for loop would also work but wouldn't change anything since it's changing 200 times at once

paper geyser
#

yeah

#

ahh wait how do i stop the loop

#

with a repeating task

quiet ice
#

I am getting confused here

paper geyser
#

i think itd be better to use a for loop

quiet ice
#

why the hell do we need a for loop

paper geyser
#

to spam send the packets

#

but for a certain amount of time

quiet ice
#

But that is already done by the task?

#

The only real question is how to stop the task

paper geyser
#

after a certain amount of time

#

got it

quiet ice
#

yea

#

The issue is that you would need to somehow obtain the BukkitTask object

unreal quartz
quiet ice
#

and I am not too sure whether

int ticksPassed = 0;
BukkitTask task = Bukkit.getServer().getScheduler().runTaskTimer(this, () -> {
    player.sendBlockChange(event.getBlock().getLocation(), Material.BEDROCK.createBlockData());
    if (++ticksPassed == 200) {
       task.cancel();
    }
});

is a valid solution

young knoll
#

You’ll need to pass the task in the lambda

paper geyser
#

bukkit runnables can loop?

quiet ice
#

That is what I have been saying the whole time!

young knoll
#

task -> {
Blah blah
task.cancel()
}

quiet ice
#

Good to know that this is also valid

#

Alternatively maintain a single task and have some global LinkedHashMap<Player, Location> that is iterated over

#

then remove/add to this map when time comes

paper geyser
#

thats what i had earlier haha

#

decided to do this instead

#

well

#

not with hashmaps

#

i proposed doing it with arrays

summer scroll
#

GodCipher, how do I keep track of the entity?

quiet ice
#

Actually, LinkedHashMap<Player, Map.Entry<Location, Integer>> needs to be used since at some point the entry needs to be invalidated

hybrid spoke
hybrid spoke
quiet ice
#

I think the entities are referenced as integer ids, so storage shouldn't be too much of an issue

summer scroll
hybrid spoke
summer scroll
#

I think I'll create another object for that, I want to get the owner of the fake entity too.

paper geyser
#

guys so

hybrid spoke
#

or go functional and use a hashmap

paper geyser
#

i ended up using the loop and spamming and i think i did it poorly bc it technically worked??? but nothing turns back

summer scroll
#

Do I need to send the packet again If the player changed world or teleported?

#

Or the armor stand will stay on the player's passengers?

paper geyser
#

if you've mined multiple things

paper geyser
#

WAIT

quiet ice
paper geyser
#

I MIGHT

#

OF REALIZED SOMETHING

hybrid spoke
paper geyser
#

it could be turning back on the last loop as it turns into a log

hybrid spoke
#

ah wait i am dumb

quiet ice
#

I dont understand

quaint mantle
#

idk if im stupid but how do i make an static getInstance() method on a class

hybrid spoke
#
public class YourMain extends JavaPlugin {

private static YourMain instance;

public void onEnable() {instance = this}

public static YourMain getInstance() {return instance;}

}
``` ![think](https://cdn.discordapp.com/emojis/650157150785765377.webp?size=128 "think")

or in normal java you can use the (static) constr.
paper geyser
#

testing now

sour loom
#

is there a way to see someones resource packs?

quiet ice
#

does clicking the block change anything?

paper geyser
#

yeah :/

#

WAIT

#

im silly

summer scroll
#

How do I make the armor stand ride player tho?

hybrid spoke
sour loom
#

if a player changes his resource packs, will the PlayerResourcePackStatusEvent be fired?

paper geyser
#

it works

summer scroll
#

Oh, there is EntityArmorStand#startRiding method

paper geyser
#

ty guys so much

hybrid spoke
paper geyser
#

but theres an error-

hybrid spoke
paper geyser
#

my plugin.yml is super basic

#
name: TreePlugin
version: 1.0```
hybrid spoke
#

add api-version:1.13

quiet ice
#

You need to define the api-version

paper geyser
#

aight

#

ty

#

i started working on this a while ago thank you everyone who spent so much time to help me

sour loom
#

in Player.setResourcePack how can i make it set the default Resource pack?

waxen barn
#

btw, does anyone know what PathfinderGoal.d() does?

ivory sleet
#

What does it return?

#

Is it a boolean, EnumSet or void?

waxen barn
#

void

ivory sleet
#

It could either be the onStart, tick or onStop

waxen barn
ivory sleet
#

What goal are we talking about now

waxen barn
# ivory sleet What goal are we talking about now

I have custom goal. (and the navigation is also custom, it should set the motion of the entity to aim at the coordinates that are in its params and return true/false based of if the missile reached the target)

public class PathfinderGoalTrackTarget extends PathfinderGoal {

    Missile e;
    EntityLiving target;

    private boolean success = false;

    public PathfinderGoalTrackTarget(Missile e) {
        this.e = e;
    }

    @Override
    public boolean a() {
        target = e.getGoalTarget();
        return target != null;
    }

    @Override
    public boolean b() {
        return success;
    }

    @Override
    public void c() {
        success = e.getNavigation().a(target.locX(), target.locY(), target.locZ(), 2D);
    }

    @Override
    public void d() {
        e.setMot(0, 0, 0);
        System.out.println(success);
        this.e.world.addParticle(Particles.EXPLOSION, e.locX(), e.locY(), e.locZ(), 1.0D, 0.0D, 0.0D);
        //e.die();
        //target.die();
    }
#

but idk if it is correct, because there are no tutorials on this

quiet ice
#

d() should be onStop

ivory sleet
#

Hmm yeah obfuscation is ewww

quiet ice
#

At least it was like it in 1.16.5

ivory sleet
#

You know the difference between a() and b() right?

#

Anyways it’s canStart vs canContinue iirc

waxen barn
woeful crescent
#

Anyone know how I could cancel drops while still getting the perks of block#breakNaturally?

waxen barn
ivory sleet
#

No

#

b is shouldContinue / canContinue

#

At least in 1.17

quiet ice
#

^Mojmap warning

waxen barn
#

I am using 1.16, but it will be probably same

quiet ice
#

And that was valid for 1.16.5

quaint mantle
#

Is there any way to make a command handler

woeful crescent
#

Mojmap warning?

quaint mantle
#

Like not a class for every command

woeful crescent
#

You don't have to make a class for every command

ivory sleet
#

But a class per command is good usually

woeful crescent
#

Really?

quiet ice
ivory sleet
#

It adheres to srp

twilit vector
#

How do I get the player name from a command args?

woeful crescent
#

Even for tiny commands?

quaint mantle
#

Yeah but like a handler for the commands

ivory sleet
#

And ofc if you have similar commands abstract common code away

quaint mantle
#

So i dont have to repeat getCommand("name").setExecutor(new CommandClass());

sour loom
#

is there an asynchronous event for quiting, like Join?

ivory sleet
#

No

#

No need to frankly

#

Just run an async task yourself

waxen barn
lusty cipher
#

might impact startup perf slightly

quiet ice
#

Alternatively: use tools such as ClassGraph

ivory sleet
#

You’re scary

junior remnant
woeful crescent
#

And use it for all of the registering

lusty cipher
#

If you want to totally over engineer command loading:

Use reflections to get every class from your package in which your commands are stored. Have there be a base class, making them all have some property like String name or sth, then load all of them through that.

#

Or, just write that statement a bunch of times

quiet ice
#

I do not think that this is possible via reflection, you have to use tools such as ClassGraph for this

#

At least for obtaining the Class object that is

ivory sleet
#

Anyways why not just provide a stream of commands and then register each one. Just one more line per command, won’t destroy you.

quiet ice
#

(or just open the jar yourself)

ivory sleet
#

Lol

junior remnant
#

In the end of the day you’ll hahe to put em on the plugin.yml haha

ivory sleet
#

Hopefully lol

quiet ice
#

writes gradle plugin to automate it

young knoll
#

Not if you access the command map

ivory sleet
#

I mean people reflect the cmd map all the time

#

Or with paper getting it w/o

exotic echo
#

Hi, I'm making an API for Mini-Games and my APIPlugin has a class called GameManager that has static methods. My game plugin is supposed to call a those methods to add itself to the GamaManager's list.
However my list always seems to be empty for some reason has anyone else had issues with this ?

young knoll
#

I think it’s exposed now on spigot

ivory sleet
#

Only paper

drowsy helm
#

Cant just play guessing games

exotic echo
#

Yep hold on

twilit vector
waxen barn
quiet ice
#

Why the hell does paper have all the good (and unsafe) features while we do not have them?

#

This is unfair!

ivory sleet
#

Yeah lol

junior remnant
exotic echo
#

Alright so my Actuel game plugin implements GameAddon
This is my code from my GameAddonManager that handles registering

 private static ArrayList<GameAddon> gameAddons = new ArrayList<>();
  public static void registerGamePlugin(GameAddon gameAddon){
        if(!gameAddons.contains(gameAddon)) {
            gameAddons.add(gameAddon);

        }
        else{

            return;
        }
    }
    public static void unregisterGamePlugin(GameAddon gameAddon){
        if(gameAddons.contains(gameAddon))
            gameAddons.remove(gameAddon);
        else{
            return;
        }
    }

I'll grab the code from my game plugin in a sec

drowsy helm
#

uh i see nothing wrong with that

#

how are you verifying its not there

quaint mantle
twilit vector
#

ohk

#

TY

exotic echo
drowsy helm
#

and just use a set if you dont want duplicates

#

then you dont have to check it

#

um my only thought is its not initializing at the right time

exotic echo
#
@Singleton
public final class FightOut extends JavaPlugin implements GameAddon {

    @Inject
    GameManager newGameManager;
    @Inject
    PlayerManager playerManager;



    @Override
    public void onLoad(){
        GameAddonManager.registerGamePlugin(this);
    }
``` this is what happens in my gamePlugin class
ivory sleet
#

Do u use guice?

exotic echo
#

I do

ivory sleet
#

Or whatever di framework that looks like

exotic echo
#

But in this case, it isn't the problem because I'm not iniecting GameAddonManager (because it's static)

#

I'm only using Guice to inject GameManager and PlayerManager

ivory sleet
#

Sounds like it shouldn’t be static

junior remnant
#

that's the problem with static

#

sometimes

ivory sleet
#

Well I guess, I haven’t used guice myself however if you use guice then you’d use it to inject every dependency ideally.

young knoll
#

Inject all the guice into your veins

ivory sleet
#

Maybe not the lowest level modules

#

But apart from that

exotic echo
#

The reason why I'm using static for my addons is so I can tell guice to inject the other stuff into my addon from my api
gamePlugins.forEach((key, value) -> bind(key).toInstance(value));

ivory sleet
#

I haven’t messed with guice a single bit (but dagger) so can’t help you out with the architecture sorry bud

#

But what was the issue anyways we went too much off topic hehe

exotic echo
#

Basically GameAddonManager.registerGamePlugin(this); doesn't seem to work
Because my API thinks that the list is empty

ivory sleet
#

Oh right

junior remnant
#

if you return the class instead of a arraylist?

ivory sleet
#

Use a Set which was already mentioned

junior remnant
#

sounds better

exotic echo
#

Okay, will try

ivory sleet
#

Set<E> set = new HashSet<>(); precisely

hybrid spoke
exotic echo
#

Did I register what ?

hybrid spoke
#

to register your game plugin on enable

#

GameAddonManager.registerGamePlugin(this); this into your onEnable

junior remnant
#

GameManager.registerGamePlugin

exotic echo
#

Nope I'll give that a try

hybrid spoke
#

also make sure that your GameManager api plugin is loaded before your plugin

junior remnant
#

yes unless you call onLoad in onEnable

exotic echo
#

I think it does since it's listed as a dependency if that's how it works

hybrid spoke
#

epic

#

should then

junior remnant
#

somebody have experience with gameprofiles and packets? more directly, with disguise plugin?

#

I have an issue, a little one

hybrid spoke
#

?ask ^^

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.

ivory sleet
#

Uh I am decent with nms mye

#

Tho on phonie so that’s crappy

hybrid spoke
junior remnant
#

So, in my disguise plugin everything goes good, the problem it's in commands. If i use the original nickname of a disguised player it works, so i dont know if i have to send a packet or do something else with the gp

honest gust
#

help me

#

how to use cubeminiature plugin?

dire marsh
#

go ask the developer?

quiet ice
#

But just read the docs/ask the developer of the plugin

quaint mantle
#

is there any other way of registering an command than getCommand("name").setExector(...);

junior remnant
#

nop, unless you writte your commands in main

#

but it is lss organizated

paper viper
#

Or you can use brigadier or some command framework that does it for you

#

But otherwise, no

paper viper
#

Destroys the point

full holly
#

can anyone say me why my uuid on player.getUniqueID() is different then my normal UUID?

paper viper
#

Unless you are modifying existing commands

full holly
granite stirrup
paper viper
#

Is your server in offline mode

full holly
paper viper
#

Then that’s why

full holly
#

but I cant change to online mode

paper viper
#

Why not

eternal night
#

rip

full holly
#

bungeecord

paper viper
#

Oof

eternal night
#

bungeecord forwards the correct uuid

chrome beacon
#

^^

summer scroll
#

I want to create a module for version 1.16.5 and 1.17, does that means I need to use Java 16 for all modules?

chrome beacon
full holly
chrome beacon
#

?paste

undone axleBOT
exotic echo
#

Okay so I tried a few things and my addon system seems to register itself, however when It doesn't seem to be in the list

paper viper
#

Java 8 code for the most part is compatible with Java 16

dire marsh
#

might as well just use j16 anyway though

paper viper
#

He’s using 1.16

dire marsh
#

so

paper viper
#

So it would depend ig

dire marsh
#

just make server owner update

#

¯_(ツ)_/¯

paper viper
#

You see, that isn’t the solution

#

Just don’t support 1.16

#

Lol

dire marsh
#

lol

#

but seriously 1.16 with java 16 isn't much of a problem anymore and almost anyone can update to it

summer scroll
#

I have problem with while trying to compile it tho, it's kinda weird.

dire marsh
#

well

#

need a beter explanation

summer scroll
exotic echo
#

Hey I have a question, can I update a static variable from plugin A in a plugin B ?

exotic echo
#

I have a list from plugin A that handles games and I need plugin B to add itself to that list

dire marsh
summer scroll
#

I mean, that makes the plugin only usable with j16

vague oracle
exotic echo
#

Okay cool, would you be able to provide me with an example please ?

summer scroll
#

I still want the plugin work on java version below 16

young knoll
#

NMS code is compiled with java 16, and I guess it doesn’t like you referencing that

dire marsh
#

^

vague oracle
summer scroll
#

So I'm forced to use j16 basically

dire marsh
#

¯_(ツ)_/¯

#

probably some hacky way around it

summer scroll
#

I guess I'm gonna create 2 different version of the plugin.

full holly
#

how can I send a plugin message without player?

dire marsh
#

sounds like making your life harder for no reason

summer scroll
dire marsh
#

You can try reflection

summer scroll
#

But I want to make it work with modular system tho

#

Get a method with reflection?

dire marsh
#

yes

summer scroll
#

Yeah that could work, thanks!

exotic echo
summer scroll
#

But the method will be called very often, what's the best way to use the rerlection?

dire marsh
#

cache it

#

the reflection calls

vague oracle
quiet ice
#

Can't you compile with j16 but still make it produce j8 bytecode?

dire marsh
#

yeah but

#

sounds painful

quiet ice
#

it's a two-liner in gradle and a 6-liner (or something like that) in maven

#

just copy & paste

#

I think you have to define target to be 16 while source is 8, but it could be the other way around

summer scroll
quiet ice
#

what about a source = target = 1.8?

#

Javac should complain about referencing newer bytecode, but it should work, I think

summer scroll
#

Same

quiet ice
#

interesting

#

Where does it fail? On the compiler side or minecraft?

summer scroll
#

On the compiler I think

#

Cannot access class

vague oracle
#

Not going to lie, im still confused what you mean, how is your gameaddon interface in both plugins without the plugins being linked?

quiet ice
summer scroll
#

So the source will be 16 and target is 8

#

Is that for the whole project or for just the specific module?

quiet ice
#

Depends, but usually it should be the whole project

mystic tartan
#

If you disallow a playerloginevent, is playerjoinevent called?

summer scroll
#

Alright thanks for that, will try it later.

quiet ice
#

since target is only the Class format version and a class file formatted for java 8 can still reference java 16 features, it doesn't really matter

#

Source just dictates what features you can use and as such cannot be lower than target (since otherwise it would make no sense)

vague oracle
#

What was the error again? It just doesn't work?

exotic echo
#

It registers and then says it has 0 addons

#

If I make my game log how many addons it has it will say 1 but If I make my game api log how many addons it has, it will say 0

hybrid spoke
#

maybe 2 different lists?

#

2 different instances?

exotic echo
#

I'm calling the same static method from two plugins, which results in the values being different, so I'm trying to find the correct way of doing this

#

They both call

 public static HashSet<GameAddon> getGamePlugins(){
        return  gameAddons;
    }
hybrid spoke
#

could it be that guice is making your second plugin use different classes?

#

never worked with guice

exotic echo
#

it shouldn't be, I remember trying without guice and I'm not even using guice to inject this class anyway so probably not

#

Also GameAddonManager is marked as @Singleton which should stop that from being the case

opal juniper
#

conclure is just better

left swift
#

how can i use nms using 1.17 spigot api (i use maven)?

chrome beacon
opal juniper
#

What the man said

limpid bronze
#

@hybrid spoke Hey, sorry for the time I took to say the problem I encountered. You gave me this link: https://github.com/deanveloper/SkullCreator/blob/4789847930cd68021a95a99d1e16c69b905d420a/src/main/java/dev/dbassett/skullcreator/SkullCreator.java
and I couldn't import these imports:
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
How i can solve this problem ?

GitHub

An easy to use library to create player skulls in minecraft - deanveloper/SkullCreator

chrome beacon
limpid bronze
#

And where is BuildTools

eternal night
#

depending on the server impl is kind of destroying the idea of using reflection in the first place no ? xD

#

why not just depend on mojangs authlib

waxen barn
#

Does anyone know why this doesn't create the particles

Explosion explosion = new Explosion(this.e.world, e, e.locX(), e.locY(), e.locZ(), 5, false, Explosion.Effect.NONE);
        explosion.a();
        explosion.a(true);

but this does (even when these two codes should do exactly the same thing)?

this.e.world.createExplosion(e, null, e.locX(), e.locY(), e.locZ(), 5, false, Explosion.Effect.NONE);
chrome beacon
#

?bt

undone axleBOT
eternal night
#

it is a huge difference what

chrome beacon
#

Not in what steps to follow

eternal night
#

one is capable of being compiled without build tools installing the local server into the repo