#help-development

1 messages · Page 755 of 1

hushed spindle
#

you and your technicalities

quaint mantle
#
if(entity instanceof LivingEntity livingEntity)```
storm crystal
#

Like that?

hushed spindle
#

yuh

storm crystal
#

okay so right now I am checking

#

if the entity that's damaged

#

is made from "recipe" that's premade in class for living entities

#

so a pig would be made form this recipe but with assigned attributes

#

like its not hostile and has this amount of max health and such

#

do I get it right?

hushed spindle
#

recipe..?

storm crystal
#

primitive name for instance

hushed spindle
#

oh

storm crystal
#

very simplified

#

it sounds awful

#

but kind of helps me understand it

quaint mantle
hushed spindle
#

if the pig is a living entity (yes) it can have attributes (max health) and a health value

#

so yes

#

hostility has nothing to do with this

#

zombies are also livingentities

#

basically any entity that can take damage is a living entity

#

though keep in mind armor stands are also considered livingentities, presumably because they can wear equipment

storm crystal
#

oh well there is small problem

#

its not really an integer/double/float

hushed spindle
#

ah right

#

gotta do maxHP.getvalue()

steel swan
#

hi ! I was always used to ChatColor. and then the color, but they say its outated, and this wont work, what should i use?

remote swallow
#

its not outdated, its just deprecated on paper

#

use spigot api or use components on paper api

steel swan
remote swallow
hushed spindle
#

i'd just make a utility method that translates color codes to colors, no need to dick around with hacky enums like that

remote swallow
#

the proper chat color isnt an enum

hushed spindle
#

the blue and yellow they use there are right

remote swallow
#

oh thats awt color, yeah probably

shadow night
#

What's awt color

remote swallow
#

java.awt.Color

hushed spindle
#
public static String chat(String msg){
  return ChatColor.translateAlternateColorCodes('&', msg);
}
shadow night
storm crystal
#

I have one problem

#

whenever I deal damage to entity

#

it always shows it's name with previous instance of damage

hushed spindle
slender elbow
shadow night
slender elbow
#

leaves it as is iirc

hushed spindle
quaint mantle
# storm crystal

you could do it better by just doing reverse

if(!(entity instanceof LivingEntity livingEntity)) return;```
hushed spindle
#

events essentially occur before the thing actually happens

storm crystal
#

ah

shadow night
hushed spindle
#

i mean yeah it makes sense

#

how are you gonna cancel something thats already happened

slender elbow
#

oh no many events are fired after the thing happened

#

even cancellable ones

#

it's a mess

shadow night
#

Bukkit: we'll give you 4 events for when the player is joining so you can control them
Forge: 1, and it might be a bit inconvinient in some cases.

hushed spindle
chrome beacon
#

Outside of reflection

hushed spindle
#

used anywhere? wdym?

chrome beacon
#

You have minimize on

#

It will strip unused classes

#

so if you're not using your nms classes they will get removed

quaint mantle
storm crystal
#

can I make switch of int x and check for cases:
1 - x > 5
2 - 5 > x > 3
3 - 3 > x > 0

chrome beacon
#

use as in directly calling

storm crystal
#

or should I do it with else if

hushed spindle
#

nms classes are being initialized with reflection so maybe i gotta look at that

#

but like even core isnt there

#

nothing i made is there

quaint mantle
#

nvm

#

whatever

storm crystal
#

I mean I know its not correct syntax

#

it was more of conceptual

#

if cases need to exactly equal to something or can be like "greater than this but smaller than this"

quaint mantle
#
switch(x) {
 case x-1 ->some(),
 case x+2-> some()
}```
#

lol

quaint mantle
#

also

#

idk

lilac dagger
hushed spindle
#

yeah i was about to say i didnt know you could do operations on switch cases

quaint mantle
#

you always could

#

you just need to think differently

#

also

lilac dagger
#

as in doing it on switch (x)?

#

i don't think i could do it on the cases

storm crystal
#

im just

#

not sure if it looks elegant

#

probably doesnt

lilac dagger
#

nope

#

looks like it could be simplified

quaint mantle
#

nah it cant be

#

java doesnt support full match statements

lilac dagger
#

the first 3 executions are exactly the same minus the color for health

quaint mantle
#

the only way you could do it better is using switch Statement from java 21

quaint mantle
lilac dagger
#

one sec

storm crystal
#

wait

#

how do I make it wait

quaint mantle
#

😩

chrome beacon
quaint mantle
chrome beacon
#

Use the scheduler if you want something to run at a later time

#

?scheduling

undone axleBOT
lilac dagger
#

for example

#

and just placeholder it in

quaint mantle
#

if you dont use multi threaded version

storm crystal
#

I just want to delay it a little

#

everytime entity gets damaged

quaint mantle
#

it will change nothing tho

chrome beacon
lilac dagger
#

it can be reused too

quaint mantle
#

yeah

#

it can be

steel swan
#

Hello, i m using commands, and i want to get the player that sent it. I can use the COmmandSender, but how do i get the Player?

chrome beacon
#

Check if the command sender is a player

steel swan
#

for instance here "Online()" needs a Player class

chrome beacon
#

?conventions

steel swan
chrome beacon
#

sender instanceof Player

#

and then cast

steel swan
#

ohhh thx

steel swan
steel swan
storm crystal
#

it doesnt change name of entity to dead, how can I resolve it?

lilac dagger
#

did you do what i sent for the other thing?

#

maybe the entity is not dead yet?

storm crystal
#

no not really cuz im trying to make the code work, then ill work on optimization

#

is there really no way to just tell it to work like 1ms after registering event?

hushed spindle
#

well if you're doing that on a damage event

#

then the entity will never be dead

#

because an entity cannot take damage if they're dead

#

if you want to check if damage would have killed the entity

#

check if their health - event.getFinalDamage() <= 0

hushed spindle
#

what am i doing wrong

nvm, it was the jar minimalizing that did it. tho its 9mb now lol

steel swan
#

hello, this is a command registered in another class than my main, but however, it doesnt work. Like it doesnt register the command. When i put the code in main class it worked, so i m gessing i should register this Command_Main in my main class, but how?

young knoll
#

getCommand(name).setExecutor

#

In your main class

storm crystal
#

but still

#

first instance of damage is not registered

#

if I hit 10/10 hp pig for 1 hp

#

its still 10/10

#

then next hit its 8/10

hushed spindle
#

show code

storm crystal
steel swan
hushed spindle
#

you are doing getLastDamage()

#

why

#

i said event.getFinalDamage()

storm crystal
#

oh its

#

event

#

XDDDD

hushed spindle
#

event.getFinalDamage() returns the damage value taken from the event considering things like armor and other damage mitigation sources

#

thats why its fine in your use case to check if a damage instance would have killed something

glad prawn
hushed spindle
#

custom damage systems will break this though

storm crystal
#

in future I should make on entity damage by player cancel the event and set my own damage formula?

#

and then just use whatever is returned?

hushed spindle
#

in my experience, no

#

but with your level of programming i wouldnt even think about implementing a custom damage system yet

#

work on simpler projects in the meantime

storm crystal
#

would adding level of mobs be easy?

hushed spindle
#

its not really difficult i think

#

depends how indepth you wanna go with it

storm crystal
#

or like when I equip armor that has protection X it gives me a certain potion effect?

hushed spindle
#

also not difficult, but easy to make poorly

storm crystal
#

easy to make poorly?

hushed spindle
#

like a beginner might think to loop through every player on the server every tick and getting their equipment and getting their enchantments and then doing something to implement it

orchid trout
#

sphaghetti code

hushed spindle
#

that can be quite intense on the server

mortal hare
#

does any of you know what Packet ID is used for?

#

looking at wireshark i cant seem find the 0x00 as the first byte in tcp data segment

#

so im kinda confused

lilac dagger
#

there's little documentation other than this

storm crystal
#

well uh my main point of plugin making was to make mmo server

hushed spindle
#

well you can

#

you just cant yet

#

rather, it would be a poor idea to try that right away or soon

#

you need practice

#

a decent grasp on java and oop

orchid trout
#

oop vewy difficuklt

hushed spindle
#

if you ignore that and try to make one anyway, you'll find yourself struggling a lot to maintain it all and rewriting your project several times and lots and lots of bugs and performance issues

orchid trout
#

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^]]

#

many characters to highlight the importance

hushed spindle
#

oop is difficult but it'll come as second nature to you if you have enough practice

orchid trout
#

practice is my #1 emeny

slender elbow
slender elbow
storm crystal
#

I honestly learn java the best by just making plugins

#

I mean

hushed spindle
#

thats fine

storm crystal
#

it just makes me understand the ideas way more

hushed spindle
#

you just gotta do the simpler ones first

storm crystal
#

cuz they are immediately put in practice

hushed spindle
#

i think spigot is a fine way to learn programming

orchid trout
#

dont make big projects

hushed spindle
#

but just dont bite off more than you can chew

#

learn how to make your mouth big first

orchid trout
#

make a plugin thats centered around player stats maybe

#

mid sized

hushed spindle
#

like you gotta acknowledge that as a beginner you'll make very very bad plugins at first

#

using them on a server you want players to have fun on might not be the best idea

zealous scroll
#

Is there a way I can make the ray size on World#rayTraceEntities not get a hit on entities that are clipping through blocks like this

timid hedge
#

How does people run minecraft though intellij?

lilac dagger
#

do they?

remote swallow
#

mcp or fabric

lilac dagger
#

i thought they just copy the plugin onto a started server and reload

hushed spindle
#

thats the common way yea

#

but you can actually test mods within the ide itself

lilac dagger
#

assuming we're still talking server here

hushed spindle
#

i know fabric mod development allows it anyway

#

dont know about spigot plugins

lilac dagger
#

i don't think you can do it beyond some tests that don't involve mc

young knoll
#

There’s a gradle plugin that runs paper from the ide

mortal hare
#

nvm i think i found it

#

its not the first byte, but the second one

slender elbow
#

well it might not be the second byte, for that particular packet it'll probably always be but the entire payload is prefixed with the length as a varint

mortal hare
#

thanks i wouldn't have knew

#

but why do they include it in the first place, when the tcp protocol already tracks the payload length

#

?

slender elbow
#

you only receive a set of bytes that might contain multiple mc packets or less than one, there is no framing, there is no "complete packet", you need to take care of framing, that's what the length prefix is for

grim ice
#

how would i go about to make a friends and party system

slender elbow
grim ice
#

like, any ideas?

mortal hare
#

so basically its used due to inconsistency of bandwidth and the ability to send multiple packets

grim ice
#

like where to store stuff n shit

mortal hare
#

in my case

slender elbow
#

it just explains the problem

#

it's a trait of tcp

mortal hare
#

ok, the size of the packet is not determined, due to how bandwidth works, right, but is the ordering of the packets guaranteed or not in this case?

slender elbow
#

yes, tcp guarantees order

#

and integrity too iirc

mortal hare
#

at least you can then defragment them by the order i guess

quaint mantle
#

Hello guys, can i talk with someone who have high mc developing knowledge ? i have lot of question for my project

mortal hare
#

well i feel like i unlocked new chapter in my knowledge

#

i knew how to send packets via NMS, but never took a look it in raw form

slender elbow
mortal hare
slender elbow
#

correct

lilac dagger
#

can you switch from tcp to udp in minecraft?

#

without any modifications of the server/client code

slender elbow
#

by playing mc bedrock yes, lol

lilac dagger
#

ah ooff

slender elbow
#

but yeah, not possible to "just switch"

mortal hare
#

yeah its not possible, both server and client would need to be changed, and the whole netcode reworked, just because how different tcp and udp are in terms of handling

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!

lilac dagger
#

i thought it was just a way data is sent so it could just switch

slender elbow
#

i mean technically speaking you could switch the setup with some fair amount of work

#

if you're fine with out-of-order and dropped packets :^)

eternal night
#

just run a dual setup

mortal hare
#

ok i think i've managed to decode the first ever TCP packet for me

eternal night
#

one TCP connection to send packets that need to be in order, one UDP connection for move packets and entity data packets

slender elbow
#

let's go

eternal night
#

stonks

#

solved

#

hire me now mojang

mortal hare
storm crystal
#

that server is... for me

#

best case scenario for a few friends

young knoll
#

Mojang should hire all of us

#

Spigot devs are the best devs

remote swallow
#

even me

storm crystal
#

is it resource optimal idea?

hushed spindle
#

right, how do you check for player equips

#

spigot doesnt have an equip event

#

i think paper does so if thats something you wanna do you might want to consider paper api instead

signal kettle
#

Hello, did anyone maybe know cool libraries/utils for time in minecraft like days, hours, minutes in minecraft time? I want to make plugin that will spoile/rotten food after some time past in and don't want to make things like runnable with deelays 💀

young knoll
#

There’s a library for it

quaint mantle
hushed spindle
#

playerinteractevent only accounts for clicks, so equipping armor by right clicking in hand would work

#

in-inventory equips are not accounted for

mortal hare
quaint mantle
#

is that not what he meant by equip

young knoll
hushed spindle
#

there's multiple ways to equip armor lol

storm crystal
#

yeah Id like to include them all

#

or generalize it

hushed spindle
#

using that lil resource from alex would work

storm crystal
#

something that wouldnt need to loop for all players

tulip phoenix
#

Hello, I wanted to make a command that the player's food recovers completely, but it seems that it is not working. could anyone help me with what's going on? https://prnt.sc/GgXpoe0EpwKv

tulip phoenix
#

Yeah

quaint mantle
#

alright

#

can i see your imports

hushed spindle
#

well

#

you capitalized Player for one

quaint mantle
#

are you importing a Sender class

quaint mantle
#

he just didnt put a variable name

hushed spindle
#

yeah so like

#

thats an object

#

not variable

quaint mantle
#

he's capitalizing Sender

hushed spindle
#

well in this context Sender is also the variable name

#

he's got a variable player (lowercase) but then he sets Player = (Player) Sender

quaint mantle
#

oh i thought it was a class, my bad

hushed spindle
#

you shouldnt be using uppercased variable names at all anyway

#

Sender should be sender

tulip phoenix
#

Like this?

tall dragon
#

yea and now give your Player variable a name

quaint mantle
#
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
    if (sender instanceof Player p && command.getName().equalsIgnoreCase("food")) {
        p.setFoodLevel(foodLevel);
        p.sendMessage("message");
    }
}
#

you can use pattern variables too

hushed spindle
#

he already has a Player variable, and he named it player

#

but then he tries to set Player to something else

tall dragon
#

if my man is using a sufficient language level that is

quaint mantle
#

my code does everything he wants tho

#

in 3 lines

#

so

quaint mantle
#

why are u using java 8

tulip phoenix
#

Idk, It was the first version I installed when I formatted the computer, haha! What is the recommended version?

quaint mantle
#

the latest probably

tulip phoenix
#

I fix it

#

Thank you so much @quaint mantle @tall dragon

mortal hare
#

why does the server send two packets which are empty after Server Handshake?

#

oh i think i know why

#

after the packets i sent, for every packet server receives it sends back an empty packet confirming that it received it

#

it seems

eternal oxide
#

its called an ACK

mortal hare
#

unless the sent packets expects data back so instead it sends payload of data

#

ok, so it seems ACK packets are being sent for each packet

odd lark
#

Hi, I have a very strange bug.
I have this line of code which will be fed when a person sends "[inv]" in the chat

public static HashMap<Long, ItemStack[]> inventoryPlayer = new HashMap<>();
//code
PlayerInventory inventory = player.getInventory();
long invId = System.currentTimeMillis();
inventoryPlayer.put(invId, inventory.getContents().clone());

and I retrieve this value via a command /intecativechat inv <invId>

try {
  long invId = Long.parseLong(args[1]);
  ItemStack[] inventory = InteractiveChat.inventoryPlayer.get(invId);
  if (inventory != null) {
    new ProfileGui(sender, inventory);
    return true;
  }
} catch (NumberFormatException e) {
  return false;
}

I have no display problem as long as I don't open inventory to remove my items
but I don't understand how this value can be modified when I never edited it once created
everything is replaced by ItemStack{AIR x 0}

mortal hare
#

i thought they were being sent only in the handshake process, along with SYN flag

eternal oxide
#

MC is odd. Its unusual for ACK packets to be used at all when it's over TCP

#

as a TCP connection is synchronized and error corrected

mortal hare
#

so receiving those packets back to the client are not conventional

#

?

lethal coral
#

how can I create compatibility of object serialization/deserialization between plugin versions (potential additions to the object)

eternal oxide
#

are you listening to raw data?

mortal hare
#

yea, im just looking at wireshark output

#

every time i send a packet i get ACK packet back

eternal oxide
#

then its fine

#

those are not generated by MC itself, rather the protocol

#

the TCP protocol

mortal hare
eternal oxide
#

its to confirm a packet was received

mortal hare
#

yea, but why its unusual

#

then

eternal oxide
#

if no ACK is recieved in sequence the last packet is requested to be sendt again

#

because TCP does all that under the hood. ACK packets are usually seen in UDP connections not TCP

#

you shoudl not be be seeing the TCP actions

mortal hare
#

well wireshark does allow to track tcp protocol frames so its nothing unusual

chrome beacon
eternal oxide
#

then thats what you are seeing

#

not MC

mortal hare
#

yea i got it

young knoll
#

Store some kind of data version in the object

#

So you know if you need to update it

chrome beacon
young knoll
#

Pretty much

quaint mantle
hazy parrot
#

MainCommand class is somehow not present in jar

quaint mantle
#

what

#

how would i make it present

hazy parrot
#

what build system are u using

quaint mantle
#

wym?

#

gradle?

hazy parrot
#

u use gradle ?

quaint mantle
#

yes

hazy parrot
#

sorry, im not familiar with it

#

try to rebuild

quaint mantle
#

😦

#

ok

#

now it cant find metrics

storm crystal
quaint mantle
storm crystal
#

nothing

quaint mantle
#

PlayerInventory#getArmorContents returns an array of ItemStack

#

it's not an event that you can listen for

storm crystal
#

"use PlayerInventory#getArmorContents to get a list of the player's equipped armor, then loop over them and use ItemStack#containsEnchantment to check if it has the enchantment, if you want to simplify your code you can also use Arrays.stream and .filter and anyMatch"

valid burrow
#

can i check for multible values in mysql like this?

kind hatch
#

Use the AND keyword?

worldly ingot
#

Yeah, WHERE xCenter = ? AND zCenter = ?

slender elbow
#

??

#

where ?

worldly ingot
#

!!

#

WHERE !

#

Fuck. "Where" doesn't look like a real word now

slender elbow
#

nowhere

thin iris
#

Where

#

has anyone used ConversationFactory before

lethal coral
quaint mantle
#

it cant find this

remote swallow
storm crystal
#

Is it possible to decompile plugins?

#

With only jar files

kind hatch
#

If you're talking about normal jar files, then yes, they can easily be decompiled.

river oracle
#

A jar file is legit just a glorified zip file

#

You cab probably open it with your file explorer

mortal hare
#

finally

#

after so many tries

#

i've managed to ping the server via powershell 😄

#

works pretty well, it even retrieves the icon as you can see in base64

storm crystal
mortal hare
#

if you can obey the obfuscation

#

premium resources often have pretty strong DRM's (for example in builtbybit plugin store, not sure about spigot)

valid burrow
#

fafawgaignaenghioqewangh

#

discord just restarted and played the "discord up" sound

#

it scared me to death

#

it was so silet

quaint mantle
#

What does translationKey return

valid burrow
#

in itemstack?

#

String

#

seems to return a string everywherew actually

quaint mantle
#

I mean like minecraft:stone

#

or "stone"

valid burrow
#

?tas

undone axleBOT
quaint mantle
#

to compile this thing

valid burrow
#

just print it out ig lol

quaint mantle
#

takes like 10m

#

to compile

valid burrow
#

what??

#

takes like 10 seconds to compile a plugin

#

tf you building

#

ill try it for u

#

oke?

quaint mantle
#

I kid you not it uploads 15 modules to artifcatory, compiles and reobuscates 10 modules

quaint mantle
valid burrow
#

my game is starting

#

that normally takes longer then compiling my plugins xd

#

give me a min

quaint mantle
#

I really appreciate your help ❤️

valid burrow
#

@quaint mantle here u go

#

i changed a value in my shop plugin so ignore the rest

quaint mantle
#

hmm

valid burrow
#

what do you need it to return

valid burrow
quaint mantle
#

Either minecraft:stone for example

#

or "stone"

#

the minecraft namespaced key

valid burrow
#

yh thats just material

#

.getType

#

returns the material

quaint mantle
#

and its not blockTranslationKey right

valid burrow
#

nope

quaint mantle
#

oh I guess that would be the same

valid burrow
#

itemstack#getType()

quaint mantle
#

so it would just be that

valid burrow
#

dont even need the .name

#

u can just directly use material as a string

quaint mantle
#

and then lowercase it ig

valid burrow
#

mhm

#

wait no

slender elbow
#

uh I mean, Material implements Keyed so you can just getKey

valid burrow
#

wiat

#

@quaint mantle

quaint mantle
#

ih

#

olh

#

.key

#

is a thing

valid burrow
#

material it self returns the readable name

quaint mantle
#

I just saw that

#

why is this hapopening

valid burrow
quaint mantle
valid burrow
#

dont do material only im stupid

quaint mantle
#

Yeah I switched it to be that

valid burrow
#

alright

#

if this entire code works first try i deserve a cookie from yall

quaint mantle
#

Please

#

😭

#

fix class names

valid burrow
#

whats wrong with my class names :/

quaint mantle
#

spaceCalculator -> SpaceCalculator
schematic -> Schematic

#

database -> Database

valid burrow
#

u happy now

quaint mantle
#

I couldn't be hapier

valid burrow
#

thats greate

#

great

#

now back to seeing how horribly i failed

#

oh

#

that smol

#

[Islands] Es konnte keine Verbindung zur DataBase hergestellt werden: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'int xCenter, int zCenter, creationDate DATETIME)' at line 1

#

i checked the manual and it said datetime is a thing :-:

#

oh wait i stupid

#

ignore

echo basalt
# valid burrow

you could toss this in a translatable component and call it a day

valid burrow
#

date wasnt the problem

#

i wronte int name in the wrong oder

#

it shouldve been name int

echo basalt
valid burrow
quaint mantle
#

ok given a NameSpacedKey like (minecraft:stone) how do I get a Material from it

echo basalt
#

it's a really ambiguous name

echo basalt
valid burrow
echo basalt
#

lol no

valid burrow
#

its obsiously a joke

echo basalt
#

I sometimes can't tell the difference between sarcasm and borderline insanity

valid burrow
quaint mantle
#

Ah

echo basalt
#

put 2 plugins with the same name and you'll see it on the exception

quaint mantle
#

Material#matchMaterial

echo basalt
#

yep

quaint mantle
#

And what if u made like a ProfileDatabase RankDatabase

valid burrow
#

i know what it means

#

just never have i anyone see use it

#

it loaded without errors

#

that something ig

#

now lets see if it works

#

except for some reason it doest get the version when compiling

echo basalt
valid burrow
#

u making a skyblock plugin?

echo basalt
#

yeh

valid burrow
#

damn

#

love it when i use & insteaf od §

#

i do that like 50% of the time

#

for no reason

#

my brain just tricks me

echo basalt
#

something something your message util sucks

valid burrow
#

its not a msg util

#

its a get prefix util

river oracle
#

Legacy sucks

#

Components ftw

valid burrow
quaint mantle
#

im on my knees begging for help on this

eternal oxide
#

is metrics in your pom?

thin iris
tight glade
#

looking to hire a spigot dev to help create a plugin, dm me 🙂

undone axleBOT
tight glade
#

Thank you! @river oracle

quaint mantle
#

not maven

eternal oxide
#

You are not using Spigot then, I can't help you

quaint mantle
#

i am

sterile axle
#

you can use gradle with spigot

eternal oxide
#

You can but little point. I don;t use gradle though so can't help with that

cursive kite
#

If I am seralizing my itemstack can I deseralize it in php

quaint mantle
sterile axle
#

is metrics in your build.gradle dependencies section

quaint mantle
#

yes

sterile axle
#

then no idea

river oracle
cursive kite
#

I tried but it’s just a big string of giberish

wet breach
#

you can't deserialize unless you know the specifics of how it serialized to begin with

quaint mantle
#

Had anybody got issues with IntelliJ IDEA CE not authenticating github anymore?

echo basalt
#

usually happens if you login with your account directly

#

I just make a token

blazing ocean
#

how can I hide everybody from the tablist (so just header+footer are visible) but be able to see them ingame? my current code is this:

    static void hideAllPlayers() {
        CraftServer craftServer = (CraftServer) Bukkit.getServer();
        MinecraftServer server = craftServer.getServer();

        // Get a list of all online player UUIDs
        List<UUID> players = Bukkit.getOnlinePlayers().stream()
                .map(Player::getUniqueId)
                .collect(Collectors.toList());

        // Send a packet to remove all those players from the tablist
        server.getPlayerList().broadcastAll(
                new ClientboundPlayerInfoRemovePacket(players));
    }``` 
but that also hides their skin and stuff
quaint mantle
# echo basalt usually happens if you login with your account directly

You are right. By mistake I opened the URL that Maven logs and attempted to log in.
My assumption is that if you don't authenticate correctly (through browser), it will cache/dirt your computer until you manually (through browser) attempt to access that address and log in successfully

quaint mantle
tender shard
#

why are you using a 10 year old MC version

quaint mantle
echo basalt
#

Can someone remind me what euler angles are measured as

#

is it radians or degrees or can I just toss a vector

brazen badge
#

anyone that knows a course for NMS and multi version plugin? I'm very interested to learn that

echo basalt
#

There isn't much of a course as there are just basic ways to do things you need

#

Most of what you need is already available through bukkit

#

If you're going into NMS you've obviously gained some confidence already

#

If you have mappings even better, just read and figure out as you go

signal tiger
#

a setting for items donated from GM1 like /ssearch <player> itemGM1 ask for mod'

quaint mantle
#

could someone tell me whats the thing called that lets us draw stuff on the map? draw pixels or smth?

signal tiger
#

I created a few years ago for /satlas <player> GM1item# (only OP)

#

but now it's not working

hollow willow
quaint mantle
#

helping

hollow willow
#

Bro do u know about lifesteal plugin

#

LS lifesteal

quaint mantle
#

ask there

hollow willow
#

Ok

quaint mantle
#

dang

#

no embed perms

quaint mantle
signal tiger
#

a plugin , like search item from gamemode 1 donate for player gamemode 0

#

brotherhood of admins

#

for <player>

#

like donate item's from gamemode 1

#

Configuration for Staff Mode

#

Added /gm info command
Added /gm reload command

#

like' this

sand cave
#

hi

signal tiger
lost matrix
#

Other than that, this should be fairly simple

quaint mantle
#

oh those are connecting rooms

lost matrix
#

If you want to generate dynamic dungeons from a set of rooms/corridors then use the wave function collapse algorithm.

fallen lily
#

Maven 🥸

hoary wing
#

is a double chest the biggest ui there is or is there a way to make a bigger one

lilac dagger
#

You can have it 1 row extra

lost matrix
#

Nah thats pretty much the limit

lilac dagger
#

But you need a custom resource pack for it

lost matrix
lilac dagger
#

I don't know actually

#

Was it patched?

fallen lily
#

How does the extra row work

#

Is it actually registered as a clickable region in the game

lilac dagger
#

Just add an extra 9

#

Yes

#

You can click it, but the ui is a bit broken

fallen lily
#

Interesting

lilac dagger
#

But i don't know if it still works

wet breach
#

obviously you can't do it from code alone, you do in fact need a resource pack to make it possible

slender elbow
#

54

wet breach
#

plus 1 row

lilac dagger
#

So 63

wet breach
#

yes that is the maximum amount of rows unless you use some trickery of course

lilac dagger
#

I did math yay

hoary wing
#

im making a parkour generating plugin where you can create parkours by combining jumps and you can search for jump schematics based on theme,difficulty,... should i use mysql or sqlite to store and acces all the schematic files or is a few json files enough

lilac dagger
#

Pages also are great

#

If you can do them

lost matrix
lilac dagger
#

Json is great for this and even a new format

#

But sql has the advantage of being able to reuse schematics between servers fast

#

As in you just set mysql

hoary wing
grim hound
#

uh

#

help

#
(java.util.EnumSet,java.util.Collection),
(net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket$a,net.minecraft.server.level.EntityPlayer),
(net.minecraft.network.PacketDataSerializer)

These are the constructors for the ClientboundPlayerInfoUpdatePacket. In the docs, is says that

(net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket$a,java.util.Collection)
#

should also be present

#

yet it'

#

s

#

not

#

oh wait nvm

#

am blind

wary harness
#

what is this is it possible with java

lilac dagger
#

Seems like bedrock

hoary wing
lilac dagger
#

Or a client mod

young knoll
#

It’s bedrock

#

You could make something somewhat similar in java

#

No scrolling though

hoary wing
lilac dagger
#

Yes

#

But there's no scrolling impl into java

hoary wing
lilac dagger
#

And neither an x to close

young knoll
#

Yeah you can have buttons for up down

#

And for close

#

You can detect clicks outside the inventory but sadly not their location

#

That would be cool

mortal hare
#

this could probably be possible with clever shaders tho

mortal hare
#

you can detect clicked trades too

young knoll
#

True

#

But only within the bounds of the trade

#

Which is a small column on the screen

glad prawn
young knoll
#

Bit of a design question, let’s say I have an api class with a bunch of static methods to interact with parts of my plugin

#

I assume it would be bad to make use of those api methods in the implementation

#

Since that would couple the implementation to the api

grim hound
#

how the fuck

#

do I create an EnumSet

#

without using the very class type

glad prawn
grim hound
#

using a single enum Object

lilac dagger
#

EnumMaps have to be preped

grim hound
#

uh

#

but like

#

how do others do it?

lost matrix
#
EnumSet<Material> materials = EnumSet.of(Material.STONE);

For example.

grim hound
#

the thing is

lost matrix
#

Or

EnumSet<Material> materials = EnumSet.noneOf(Material.class);
grim hound
#

is that I can't use the "Material" keyword

#

ClientboundPlayerInfoUpdatePacket

#

is what I want to create

#

but I don't have the mojang packet lib

#

so

lost matrix
#

What do you mean by that?

grim hound
#

I just kinda

lost matrix
#

Are you trying to reflectively create that packet?

grim hound
#

use reflections

grim hound
#

they're suprisingly quick

lilac dagger
#

Then cast your object to enum

grim hound
lilac dagger
#

Enum<Action>

young knoll
#

But they don’t have the action class

grim hound
#

I just said

lost matrix
grim hound
#

I cannot use that class

lilac dagger
#

Wait right

young knoll
#

Hey if you cache everything reflections aren’t that bad

grim hound
young knoll
#

JIT will also optimize them if they get used a lot

lost matrix
#

Yes if you cache them

grim hound
#

yeah

#

I only use the newInstance methods at runtime

#

the rest is cached

#

anyway

#

help

grim hound
#

but the packet needs an EnumSet

#

I also cannot create my own EnumSet because these mfos just decided to let all of their classes be package-private

#

and their abstract methods

lilac dagger
#

Yeah, they have private implementations

#

Single and jombo

#

Or something like that

#

For when there's need for more than 1 long

#

Maybe try Enum<Object>

#

Might be a problem with the?

grim hound
#

yeeeahhh

#

the compiler told me to fuck off

lost matrix
#
  @SuppressWarnings({"rawtypes", "unchecked"})
  public void someHackyStuff() {
    Enum reflectedEnumObj = ...;
    EnumSet enumSet = EnumSet.of(reflectedEnumObj);
  }
lilac dagger
#

Or raw enum works too

lost matrix
#

Dont bother using types when doing reflections

grim hound
#

I always did (Enum<?>)

#

but (Enum) might just work

#

lemme test

lilac dagger
#

The? Specifies immutability

#

So it might break when it asks for mutability

grim hound
#

let's just see if it throws an error

#

it shouldn't

lost matrix
#

Im guessing you dont like ProtocolLib?

grim hound
#

correct guess

#

it always broke down for no reason

lilac dagger
#

I find reflections more readable than protocollib

lost matrix
#

I would use it over reflection fkery any day

grim hound
#

and was more complicated than doing it raw

grim hound
#

👍

mortal hare
#

ok this is so weird, can someone explain? I have a minecraft in my server list which has open port 25565, but the thing is whenever i open wireshark it uses a different port, and not the default one (25565) to query the server, even though i've inputted 25565 manually, what voodoo magic is going on here?

#

it refuses to connect via 25565

#

but agrees to connect via 5001, even though i've inputted 25565 in my server list

mortal hare
#

what is happening in this case?

grim hound
#

no idea

mortal hare
#

how does it resolve a different port

grim hound
#

but you can connect to it though, right?

mortal hare
#

im thinking about dns trickery, but i can't find any dns records

mortal hare
grim hound
#

so no problemo

mortal hare
#

that's not what im achieving, i cant connect to the server from my custom client, just because this server magically changes port like chameleon

#

i've written custom micro client for minecraft to retrieve server status in powershell

#

and it works great

lost matrix
#

Guessing NAPT

mortal hare
#

but for this server i need to manually find the port from the client via wireshark

#

in order to use it

#

my client with port 5001 works just fine

grim hound
lost matrix
#

Is it an external server? Because in that case im assuming its bc of NAT/NAPT

mortal hare
grim hound
#

well I didn'

#

t

#

really know what you were doing

mortal hare
#

fair enough

grim hound
#

so wait

#

you want to ping a random server?

#

limited to what?

mortal hare
#

i just implement minecraft server status checker

#

but in powershell

#

since i have an university assignment

#

of working with powershell

#

and i have right now course on UDP and TCP packets aswell

#

so i thought this would be a great opportunity to learn both

blazing ocean
#

how can I hide a player just from the tablist and not their character as well?

#

i really need to do that i asked at least 2-3 times here, never gotten a useful response

mortal hare
#

i think its not really possible, since all player data is tied with tablist, well according to wiki.vg

blazing ocean
#

i just want the header and footer to be visible

#

setting the username to null, "", " " doesnt work

lost matrix
mortal hare
#

idont remember this

blazing ocean
#

how would that look with NMS?

mortal hare
#

even citizens plugin used some kind of trickery to get around flickering in tablists

lost matrix
#

Send a Player info update packet with the Udate Listed Action and a false boolean as value

blazing ocean
lost matrix
#

This was added fairly recently. 1.19 or something

blazing ocean
#

might be since PacketPlayOutPlayerInfo was removed

mortal hare
lost matrix
thin iris
#

how do i get all the sounds a player is listening to? i want to like fade it out

mortal hare
#

i've removed filter from wireshark and got this

#

its just weird that even if you specified the port, it still tries to resolve it via dns

blazing ocean
# lost matrix ClientboundPlayerInfoUpdatePacket

sorry for spoonfeeding but I don't quite get how I can add the action with the toggle. something like this?

            ClientboundPlayerInfoUpdatePacket packet = new ClientboundPlayerInfoUpdatePacket((FriendlyByteBuf) player);
            packet.actions().add(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED);```
mortal hare
#

instead of using the specified one

lost matrix
#

A DNS is only needed if you have an actual domain. If you connect to an IP directly then its useless.
Unless your server provider has an internal namespace and DNS that resolves internal domains.

mortal hare
lost matrix
mortal hare
#

i thought how minecraft omitted the port numbers is that they appended 25565 as a default while trying to resolve the hostname

mortal hare
blazing ocean
#

thank you!

lost matrix
mortal hare
#

minecraft uses records

#

no way

worldly ingot
lilac dagger
#

PacketSerializer

lost matrix
#

You need to construct an Entry and add it to the Entry list

worldly ingot
#

That's the one

mortal hare
#

is there any way to query SRV records from dns server in .NET framework?

#

I've used System.Net.Dns package to query the hostname but it only queries the ip, not the port

kindred sentinel
#

How to check if item is one of dyes?

#

or one of other group of items?

lost matrix
# blazing ocean thank you!
    Player bukkitPlayer = ...;
    ServerPlayer serverPlayer = ((CraftPlayer) bukkitPlayer).getHandle();
    
    UUID uuid = serverPlayer.getUUID();
    GameProfile profile = serverPlayer.getGameProfile();
    boolean showListed = false;
    int latency = serverPlayer.connection.latency();
    GameType gameType = serverPlayer.gameMode.getGameModeForPlayer();
    Component displayName = serverPlayer.getTabListDisplayName();
    RemoteChatSession.Data chatSession = Optionull.map(serverPlayer.getChatSession(), RemoteChatSession::asData);
    
    ClientboundPlayerInfoUpdatePacket.Entry entry = new ClientboundPlayerInfoUpdatePacket.Entry(
        uuid, 
        profile, 
        showListed, 
        latency, 
        gameType, 
        displayName, 
        chatSession
    );
    
    ClientboundPlayerInfoUpdatePacket.Action action = ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED;
    EnumSet<ClientboundPlayerInfoUpdatePacket.Action> actionSet = EnumSet.of(action);
    ClientboundPlayerInfoUpdatePacket packet = new ClientboundPlayerInfoUpdatePacket(actionSet, List.of());
    
    packet.entries().add(entry);
blazing ocean
#

oh boy

lost matrix
blazing ocean
#

shortest NMS code

kindred sentinel
#

Oh yeah thanks

lost matrix
# blazing ocean shortest NMS code

This also shows you how to edit the ping, tablist name, gamemode etc in the tab list for any player.
Or even add fake entries in the tab list.

full holly
#

Does anyone have an idea how I can check whether a block with a rail has been connected to another rail next to it?

lost matrix
#

Im actually not sure if you need all of those parameters for just removing the player from the tablist.

#

A few can be null

lilac dagger
#

saved by the annotations

kindred sentinel
lost matrix
wary remnant
sullen wharf
#

Any specific reason why a spawner doesn't show the entity inside when I do setSpawnedType()?

mortal hare
#

i dont seem to see an option

lost matrix
#

Make one

mortal hare
sullen wharf
#

uhm

mortal hare
#

there should be a solution

kindred sentinel
lost matrix
sullen wharf
#

🙏

lost matrix
#

Something somethig

    CreatureSpawner spawner = ...;
    spawner.update(true);

i think

mortal hare
#

why doesnt craftbukkit do it for you

wary remnant
mortal hare
#

im limited with powershell my friend 🥲

wary remnant
#

The System.Net.Dns class seems to only do IP resolving

mortal hare
#

ok yea, i asked chatgpt

#

and he suggested me to open UDP client and send the packet by yourself :DDdd

#

lol

#

what a trash package System.net.dns is

#

and SRV records are old

#

why doesnt it support it lol

wary remnant
#

it isn't, its only purpose is resolving ips

#

it never was meant for querying other record types

wary remnant
blazing ocean
lost matrix
#

Fk the entry list is an immutable collection

#

Wait

blazing ocean
#

yeah, I used (actionSet, Collections.emptyList())

lost matrix
#

Are you... hiding all players on player join?

blazing ocean
#

yes

#

pretty much

mortal hare
#

ah, f*ck it its only uni assignment im not gonna add a whole dns client just for retrieving a port

lost matrix
# blazing ocean pretty much

Just intercepting the packets in the first place might be another idea.
Anyways. Let me check if there is a way around using the byte buffer...

kindred sentinel
#

How to get DyeColor from dye??

#

like dye item..

lost matrix
# blazing ocean pretty much

Nope. Two options: Construct the packet via a FriendlyByteBuf or replace the entries collection via reflections.

blazing ocean
#

probably intercepting it might be better. do i need protocollib?

quaint mantle
#

can someone help me with purpur

#

?

river oracle
#

?forks

#

Whatber

remote swallow
#

singular fork

river oracle
#

I always forget, go to purpur discord this is spigot blah blah blah

remote swallow
#

?fork

undone axleBOT
#

SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.

quaint mantle
#

oh ok

blazing ocean
#

?whereami

blazing ocean
#

@quaint mantle

quaint mantle
#

yes ?

quaint mantle
#

what ?

blazing ocean
#

go to the purpur discord

remote swallow
#

they already got told that

kindred sentinel
#

is there a way to get color of a dye item?

#

like i have item x and i know that x is one of the dyes, how to get it's DyeColor?

lost matrix
#

Package private fields that are needed for the fking bytebuffer

lilac dagger
kindred sentinel
lilac dagger
#

either way

young knoll
#

Yeah afaik you can only map it

#

There isn’t a built in method

#

although I bet there could be

lilac dagger
#

yeah, probably the crafting table has some information somewhere

young knoll
#

I imagine the dye items themself do

lost matrix
# blazing ocean probably intercepting it might be better. do i need protocollib?
    Player bukkitPlayer = ...;
    ServerPlayer serverPlayer = ((CraftPlayer) bukkitPlayer).getHandle();

    UUID uuid = serverPlayer.getUUID();

    List<ClientboundPlayerInfoUpdatePacket.Entry> entries = new ArrayList<>();
    entries.add(null);

    ClientboundPlayerInfoUpdatePacket.Action action = ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED;
    EnumSet<ClientboundPlayerInfoUpdatePacket.Action> actionSet = EnumSet.of(action);

    ByteBuf directByteBuf = Unpooled.directBuffer();
    FriendlyByteBuf buffer = new FriendlyByteBuf(directByteBuf);

    buffer.writeEnumSet(actionSet, ClientboundPlayerInfoUpdatePacket.Action.class);
    buffer.writeCollection(entries, (proxyBuffer, writer) -> {
      proxyBuffer.writeUUID(uuid);
      proxyBuffer.writeBoolean(false);
    });

    ClientboundPlayerInfoUpdatePacket packet = new ClientboundPlayerInfoUpdatePacket(buffer);

Ok i decyphered mojangs nms and applied some black magic fkery.
This can only be used for a single player at a time and only to hide him from the tablist.
Try this out

young knoll
#

Isn't there api for that

quaint mantle
#

why r u adding null to the list

#

what the hell is this code

lost matrix
#

So that the collection writer has one iteration

#

A packet to remove a player from the tablist

quaint mantle
#

so you just create an array list with size 1???

blazing ocean
#

@lost matrix did you not include serverPlayer.connection.send(packet) or do I not have to call that?

quaint mantle
#

new ArrayList<>(1);

#

or something

lost matrix
quaint mantle
#

also you can just use List.of if you dont mutate the array list

lost matrix
#

List.of uses varargs so i cant use null there

young knoll
#

What about an empty list?

blazing ocean
#

was confused lol

lost matrix
young knoll
#

I see

quaint mantle
#

you can do List.of((Object) null)

#

Arrays.asList(null)

lost matrix
#

My guy... varargs parameters

young knoll
#

It does work

#

Tho the ide does give a warning

#

List<ItemStack> list = Arrays.asList(null);

quaint mantle
#

varargs parameters accept nulls

#

idk where you got that it doesnt

#

how old your java version needs to be to not support null in varargs

lost matrix
#

Its an ambiguous call because both a single object and an array can qualify as null

quaint mantle
#

the issue is that, varargs is short for {null}

#

therafore passing null will result in array with one value that is null

lost matrix
#

That are internal semantics and depend on the jvm impl you are using.
I dont do ambiguous calls. You can use them all you want.

quaint mantle
#

also what about using final var

ivory sleet
#

i mean var isn’t ambiguous it just infers the type

young knoll
#

Adding the cast removes the IDE warning

#

Idk if it changes anything internally :p

quaint mantle
#

yeah

#

i mean, update your jdk or something

#

also instead of using varargs you can do

#
new Object[1]```
#

and then put it into your ArrayList

young knoll
#

Bit of a design question, let’s say I have an api class with a bunch of static methods to interact with parts of my plugin
I assume it would be bad to make use of those api methods in the implementation since that would couple the implementation to the api

quaint mantle
#

    final var bukkitPlayer = ...;
    final var serverPlayer = ((CraftPlayer) bukkitPlayer).getHandle();
    final var uuid = serverPlayer.getUUID();
    final var entries = new ArrayList<ClientboundPlayerInfoUpdatePacket.Entry>(new Object[1]);
    final var action = ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED;
    final var actionSet = EnumSet.of(action);
    final var directByteBuf = Unpooled.directBuffer();
    final var buffer = new FriendlyByteBuf(directByteBuf);
    buffer.writeEnumSet(actionSet, ClientboundPlayerInfoUpdatePacket.Action.class);
    buffer.writeCollection(entries, (proxyBuffer, writer) -> {
      proxyBuffer.writeUUID(uuid);
      proxyBuffer.writeBoolean(false);
    });
    final var packet = new ClientboundPlayerInfoUpdatePacket(buffer);```
#

i would do this

lost matrix
#

Alright here is the solution without the list dispute

  @EventHandler
  public void onJoin(PlayerJoinEvent event) {
    Player joinedPlayer = event.getPlayer();
    Bukkit.getOnlinePlayers().forEach(online -> hideFromTabList(joinedPlayer, online));
  }

  private void hideFromTabList(Player target, Player playerToHide) {
    ServerPlayer serverPlayer = ((CraftPlayer) playerToHide).getHandle();

    UUID uuid = serverPlayer.getUUID();

    ClientboundPlayerInfoUpdatePacket.Action action = ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED;
    EnumSet<ClientboundPlayerInfoUpdatePacket.Action> actionSet = EnumSet.of(action);

    ByteBuf directByteBuf = Unpooled.directBuffer();
    FriendlyByteBuf buffer = new FriendlyByteBuf(directByteBuf);

    buffer.writeEnumSet(actionSet, ClientboundPlayerInfoUpdatePacket.Action.class);
    buffer.writeVarInt(1);
    buffer.writeUUID(uuid);
    buffer.writeBoolean(false);

    ClientboundPlayerInfoUpdatePacket packet = new ClientboundPlayerInfoUpdatePacket(buffer);
    ((CraftPlayer) target).getHandle().connection.send(packet);
  }
lost matrix
#

What fking final var?

lost matrix
#

Go write C#

quaint mantle
#

already done

lost matrix
#

Nice. Then keep your vars there.