#help-development

1 messages · Page 1032 of 1

tardy delta
#

idk

#

thats client side though

young knoll
#

It's not

#

net.minecraft.world.level.block.ButtonBlock#press

#

Note that all it does is

world.setBlock(pos, (BlockState) state.setValue(ButtonBlock.POWERED, true), 3);
this.updateNeighbours(state, world, pos);
world.scheduleTick(pos, (Block) this, this.ticksToStayPressed);
robust ginkgo
#

Is there a way to check for this tag?

tardy delta
robust ginkgo
#

Yes, I've seen that.

#

But how do I check a block for that tag?

blazing ocean
robust ginkgo
#

oh my god

#

I'm stupid

#

I always forget what these <> things are for.

#

I'm used to C#, but I still fail to understand the meaning of them

pseudo hazel
#

its just a type

robust ginkgo
#

I thought I understood, apparently I don't.

blazing ocean
#

you cannot pass in variables / values in there

#

only types

eternal oxide
#

Tag.REPLACABLE.isTagged(...

shadow night
#

how tf would somebody explain generics. "Dynamic typing but for statically typed langs"?

blazing ocean
#

lmao

#

p much

robust ginkgo
#

this feels so weird

shadow night
shadow night
blazing ocean
shadow night
#

looks like a normal day in java

torn shuttle
#

dynamic typing but without any of the convenience

robust ginkgo
#

yeah but there are so many things about java that I find weird

blazing ocean
shadow night
#

Tag -> Class
REPLACABLE -> Statically accessed field
isTagged -> Method from the field

robust ginkgo
#

I understand why primitives don't have a .toString() method (they're primitives, duh)

#

but why do you have to check if an object has a tag, via the tag?

blazing ocean
#

ofc they do

#

everything does

torn shuttle
#

the only weird thing there is that traditionally api access on spigot is done via method, so that field could also be in a getter instead of being public

robust ginkgo
young knoll
#

Spigot has a ton of public fields

torn shuttle
#

sure

blazing ocean
#

does java not have that on int

#

java moment

#

use Integer instead

torn shuttle
#

spigot also has a ton of parts of its api that don't follow normal standards

#

it's a big project

young knoll
#

Imagine a getter for every material

torn shuttle
#

you weirdo

blazing ocean
torn shuttle
#

well the mappings website doesn't have 1.21 yet so I guess I have to check manually, how cringe

blazing ocean
#

cephx smh

robust ginkgo
torn shuttle
#

cephx hasn't updated yet truly the website has fallen off

blazing ocean
torn shuttle
#

now do I even remmber where mojang hides the remaps

shadow night
robust ginkgo
blazing ocean
#

what

young knoll
#

Buildtools will remap everything for you

#

:p

shadow night
blazing ocean
#

real

river oracle
shadow night
torn shuttle
#

thanks mojang I hate it

shadow night
#

lol

#

just get the obfuscation map link from the builddata repo

torn shuttle
#

too late I'm already jacked in

#

also they privated the ClientboundAddEntityPacket, thanks mojang very based

shadow night
torn shuttle
#

yknow I should really document what name this field actually is some day

robust ginkgo
#

Is it inefficient to check for all entities in a chunk to see if a block can be placed or not?

#

and I said something confusing again

wide coyote
#

wth is 1.21 out?

pseudo hazel
#

yup

torn shuttle
#

yep

young knoll
#

mhm

robust ginkgo
#

time for everyone to spam the spigot and paper devs

torn shuttle
#

nearly done updating my systems

young knoll
#

Spam us for what

torn shuttle
#

spigot is already done

young knoll
#

^

robust ginkgo
#

paper devs then

torn shuttle
#

I think I needed bb?

young knoll
#

You should ping @eternal night about it

pseudo hazel
#

trust me they already have

young knoll
#

:D

eternal oxide
#

eta for 1.22 when? 😛

torn shuttle
#

aF

#

fantastic

#

thanks piston

#

I'm sure I got it right in one

young knoll
#

If you access NMS fields by name via reflection

#

ur bad

#

<3

torn shuttle
#

has anyone updated their ClientboundAddEntityPacket and if so can I steal your homework review the quality of your code

#

@echo basalt

echo basalt
#

1.21 or what

torn shuttle
#

1.21

echo basalt
#

new packet changes? lesgo

torn shuttle
#

yeah

echo basalt
#

let's see

torn shuttle
#

?paste

undone axleBOT
torn shuttle
echo basalt
#

doesn't look different

torn shuttle
#

the public version now wants a ServerEntity, Entity and uh something else

pseudo hazel
#

just look at the wiki 💀

echo basalt
#

or you can just call the constructor with 5 billion params

torn shuttle
#

weren't you using the now private version with RegistryFriendlyByteBuf?

eternal night
echo basalt
#

nah

young knoll
#

Or you can use public ClientboundAddEntityPacket(Entity var0, int var1, BlockPos var2) {

torn shuttle
#

huh

robust ginkgo
#

Also, is there an entity tag for replaceables (like item frames)?

torn shuttle
#

did I not steal your code for this? It's been a minute

echo basalt
#

I last messed with these packets back in like

#

february

torn shuttle
#

sameish I think

#

which one is the least annoying to build

echo basalt
#

If you have the bytebuf you could just use the stream codec

torn shuttle
#

hm

echo basalt
#

Otherwise I'd just pass the same exact params to the constructor with all the args

#

because it's the most basic primitive one

#

(entityId, uuid, x, y, z, pitch, bodyYaw, entityType, extraData, initialSpeed, headYaw)

echo basalt
#

wacky ass packet

torn shuttle
#

yeah I guess

young knoll
#

What is the extraData even for

torn shuttle
#

probably stuff like wolf color

echo basalt
#

that's metadata

#

extra data was used for some old stuff

torn shuttle
#

lovely

#

I should be able to just derive all of this data from a valid living entity right, doesn't sound like that would be a problem

echo basalt
#

I believe it was "1" for certain entity types

young knoll
#

Ah it was probably the subtype back in the day?

echo basalt
#

no clue why the var0 var1 but you might just be able to pass the entity on both

young knoll
#

I don't think ServerEntity extends entity

echo basalt
#

ah yes now I remember this

torn shuttle
#

how clean.

#

should probably integrate the initial pos at some point... eh

blazing ocean
#

please click reformat

echo basalt
#

just add a bunch of enters

#

wasn't there an Entity#getSpawnPacket method

young knoll
#

yes

junior geyser
#

What would be the best way to get how much damage a player would do (on average, for example without a crit) with an itemstack?

young knoll
#

Uhh, math

torn shuttle
#

you can't

junior geyser
#

Like an ItemStack.getAproximateDamage

#

Ah

eternal night
torn shuttle
#

math won't help, minecraft has a ton of variables you can't consistently account for

young knoll
#

I mean, you can

#

The game does

torn shuttle
#

does it now

junior geyser
#

Okay cause I have a method using NMS to calculate it, but I was wondering if there was a better solution without nms

#

It is not exact, but its okay

young knoll
#

Yes presumably the game knows how much damage you do when you do damage

torn shuttle
#

yes

#

when you do damage

#

but it doesn't know how much damage an item will do ahead of time

#

there's no abstract true value for how much damage an itemstack will do

junior geyser
junior geyser
#

or somethin

#

Whatever, ill just stick with my nms for that

torn shuttle
#

the damage depends on whether you crit, whether you are on swing cooldown, and what you are hitting, what effects it is under and what armor it is wearing, plus what effects the player is under, before accounting for any plugin weirdness

junior geyser
#

Just the NMS getDamageBounus method was removed in 1.21, so I need to figure out a replacement

young knoll
#

Tis a very large method

torn shuttle
#

if you just want an inaccurate amount I am pretty sure items literally have stats you can expose

#

they are meaningless is many scenarios but they are there

#

and it doesn't account for enchantments because it can't

young knoll
#

The calculations are all in net.minecraft.world.entity.player.Player#attack

echo basalt
#

I remember doing this kind of simulation stuff

torn shuttle
#

if you have bane of arthropods 10000 and hit a zombie it won't do jack shit

#

but you will send a spider to the shadow realm

#

that's why I just made my own damage system

junior geyser
echo basalt
#

yo magma I'm doing a pro gamer move btw

junior geyser
#

It did a resonable job in the past

echo basalt
#

you know how geyser shits the bed with models?

torn shuttle
young knoll
#

Ah right getDamageBonus would have been changed

echo basalt
#

Well

young knoll
#

Since enchantments are datadriven now

torn shuttle
#

I mean in what sense

echo basalt
#

It doesn't like modelengine 4 because display entities

#

So everyone uses meg3 because armor stands

torn shuttle
#

🤡

fair rock
#

Geyser shit hits the bed sounds kinda interesting

torn shuttle
#

if only...

#

if only...

echo basalt
#

If only..

torn shuttle
#

yeah right

#

crazy

#

if someone made a plugin that has both

echo basalt
#

Anyways I'm making a plugin that fixes that

young knoll
#

Clearly this means Java is better

junior geyser
echo basalt
#

Hooks into all modelengine-like plugins

young knoll
#

Ignore the fact that bedrock has actual custom entities

echo basalt
#

And sends bedrock custom entities

#

yeah

torn shuttle
#

I just send them armorstand packets

junior geyser
#

Is there a similar helper class to get a value easy peasie?

echo basalt
#

That lags the client a bunch though

#

Or we can just use native stuff with all the fancy interpolation

young knoll
#

We'll find out once buildtools is done

torn shuttle
#

sure

#

pr it coward

#

it's about to update to 1.21 anyway

young knoll
#

Ew model engine

torn shuttle
#

meanwhile I'm out here making a plugin that will automerge, autoconvert and autodistribute java and bedrock edition rsps

#

I'm having fun clown_dead

young knoll
#

Imagine merging packs

#

That's so 1.20.4

torn shuttle
#

did that change or something

young knoll
#

You can have multiple server packs now

torn shuttle
#

but does it work for bedrock and java at the same time

young knoll
#

No idea

#

Bedrock is bad

torn shuttle
#

uh where is the announcement that that became a feature

#

I don't even see that in the changelogs for the wiki page

alpine urchin
#

that that became a feature is better than that becoming a deletion.

pale tendon
#

Does anyone here speak Spanish so you can help me create a plugin?

alpine urchin
#

that’s why it’s better than that

slender elbow
pale tendon
wraith aurora
#

basicaly for bedrock, you just run
sudo rm plugins/geyser-velocity.jar

#

and that will fix it

alpine urchin
#

wdym ms

#

md

#

do i look like md

young knoll
torn shuttle
#

all programmers look alike, except for me, since I'm the main character

torn shuttle
#

not saying I don't believe you just saying it's hard to see if it's a global change or just java

slender elbow
#

it's something in the java protocol

young knoll
torn shuttle
#

doesn't really change that because because I don't trust mojang to merge them correctly because I want to automatically detect collisions anyway to give proper warnings, plus merging them isn't that bad, converting is

slender elbow
#

I mean they merge just as if you had multiple resource packs on your client, that's all it does really

#

you send multiple resource packs and.. it adds them

torn shuttle
#

then it wouldn't work for my purposes

slender elbow
#

in your resource pack list

torn shuttle
#

I think

#

actually I'm not 100% sure, if two rsps have different custom sword models with non-colliding IDs does mc handle that correctly?

#

that's the main thing I want to make sure I'm handling

young knoll
#

yes

torn shuttle
junior geyser
young knoll
#

No idea about bedrock

#

Their server content system is entirely different (and jank AF last I checked)

buoyant sonnet
#

how do i do a custom furnace recipe

#

with a custem item

young knoll
#

Make a FurnaceRecipe and then bukkit.addRecipe

buoyant sonnet
#

i had that but for a custom item

#

you put a custewm item in out you get also custom

young knoll
#

RecipeChoice.exactChoice for the input

#

tho idk if that works for furnace recipes

#

When do we get a recipe choice that takes a Predicate<ItemStack>

mild stone
torn shuttle
#

uh oh

#

enchantment names changed

young knoll
#

They are data driven now

torn shuttle
#

it's always good when it stops because it hits a cap

blazing ocean
#

fun

torn shuttle
#

particles are broken, enchantments are broken, potion effects are broken

#

it's joever

#

oh entity types are also broken

#

choice

#

events are broken

#

sounds like this update is going to cause a rift

blazing ocean
#

:)

torn shuttle
#

well... I'm going to have to abstract a lot away from bukkit/spigot/mc I guess

young knoll
#

Skill issue

torn shuttle
#

am I crazy? did 1.20.6 already have all these changes and I just didn't notice?

pseudo hazel
#

awesome, seems like 1.21 spigot build got the fix for spawneggs damage I reported 😮

eternal night
#

1.20.6 was the giant update

#

.21 is rather small beyond enchantments and attribute modifiers

torn shuttle
#

man I basically entirely ignored it

#

so does that mean a huge amount of pre-1.20.6 plugins would fail to load on 1.20.6 at this stage?

eternal oxide
#

I hope so. clean out the trash

kindred sentinel
#

my code is trash, what do I have to clean?

pseudo hazel
dark moth
#

lol

warm scroll
#

Looking for an experienced dev who can teach me development. Message me for more info

pseudo hazel
#

?services

undone axleBOT
pseudo hazel
#

imagine waiting on dependencies to update to 1.21 💀

#

tempted to just do what the api does myself so I don't have to rely on them updating in the future

robust ginkgo
#

What's the best way to connect a container to a block?

kindred sentinel
#

How to change player's skin using plugin

robust ginkgo
kindred sentinel
robust ginkgo
#

oh I thought you could only store primitive types

#

I guess I'm wrong

kindred sentinel
#

?morepdc

undone axleBOT
robust ginkgo
#

thanks

kindred sentinel
#

?blockpdc

undone axleBOT
kindred sentinel
#

I used something like

Location blockLocation = block.getLocation()
ItemStack[] items = new CustomBlockData(block,plugin).get(new Namespacedkey(plugin,"items"),        DataType.ITEM_STACK_ARRAY)
Inventory inv = Bukkit.createInventory(null,27,"title");
for(ItemStack item : items){
if(item != null){
inv.addItem(item)
}
}
obsidian drift
#

Hypixel has this thing for 1.20.5+ where going to new servers has a nether background, in what packet can you trigger this background of the loading screen?

obsidian drift
#

There is no resource pack enabled

#

and I mean trigger the nether screen not change it btw

#

oops

blazing ocean
obsidian drift
#

yeah, I mean even trigger when not going to the nether

#

sorry didnt make it clear enough

kind hatch
#

Added in 1.20.5

obsidian drift
#

I know im trying to find a way to trigger it even when not going to the nether, like going to another server

kind hatch
#

I’m not sure if you can. It’s something that the client does when switching between worlds.

You might find something in those packets, or it might possibly be triggered when using a nether portal specifically.
Just have to find the right packet events for that and see if any new fields have been added for the background.

#

?mappings

undone axleBOT
obsidian drift
#

Then how come hypixel did it lol

kind hatch
#

They didn’t?

#

It’s a client side background

obsidian drift
#

its usually just a dirt background

#

they changed it to a nether one

kind hatch
#

If you use 1.20.5+ then you’ll get that background.

blazing ocean
kind hatch
#

Regardless of server

#

You even get it in single player

fair rock
#

Bro try 1.20.1-1.20.4 and tell us if its a nether portal 💀

obsidian drift
#

In 1.20.5+ they changed the background of the loading screen depending on the type of world you are entering, and I always want it to be nether

eternal night
kind hatch
#

It uses the respawn packet?!?!

obsidian drift
#

I see

eternal night
#

Well that is how cross dimension teleportation happens lol

robust ginkgo
#

This might be a dumb question, but is there a way to make the game wait a tick before handling an event? Right clicking sometimes places 2/3 blocks at a time because there is no delay.

mild stone
fair rock
#

Because interact event should fire twice because of 2 hands when you click

fair rock
#

No, check the hand as well

obsidian drift
#

at the top if the event check if getHand is not "HAND" if so return

fair rock
#

"Represents an event that is called when a player interacts with an object or air, potentially fired once for each hand. The hand can be determined using getHand()."

robust ginkgo
#

Since when was that a thing?

fair rock
#

Since you have a offhand?#

robust ginkgo
#

oh right that makes sense

river oracle
#

1.21 was an easy updated

#

none of my NMS changed 💪

#

3 minutes on the clock

green prism
#

here's why I do need close reasons

#

oh title is just a test xd

river oracle
#

then make a PR?

#

I mean I'll probably swing around to it when I update the full inventory API otherwise

#

but it could be a while for that

green prism
river oracle
#

?contribute

green prism
#

ohhh pull request

#

my bad

pseudo hazel
#

stands for Perfect Replica, which means you have to do everything yourself without an examp;e then try to force it into the existing code

river oracle
#

kekw

river oracle
#

no it does not PR stands for pull request

blazing ocean
young knoll
#

Smh imagine being able to do your NMS updates already

pseudo hazel
#

then I might have messed it up all this time ☠️

blazing ocean
#

you at cabernetmc use diff terms

blazing ocean
pseudo hazel
#

I got lucky

#

all packets I use from packetevents magically still work in 1.21

river oracle
robust ginkgo
# fair rock Do you checked in your event which hand got used for right click?

Apparently that didn't fix it.

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
  if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getHand() == EquipmentSlot.HAND) {
    if (event.hasItem()) {
      // Item interactions / Block placement
      ItemStack heldItem = event.getItem();

      // Block behavior
      if (heldItem == null) return;

      if (heldItem.getType() == Material.STICK) {
        Block targetBlock = checkCanPlaceBlock(event);

        if (targetBlock == null) return;
        targetBlock.setType(Material.NOTE_BLOCK);

      }
    }
  }
}

@Nullable
public Block checkCanPlaceBlock(PlayerInteractEvent event) {
  Block targetBlock = event.getClickedBlock().getRelative(event.getBlockFace());
  if (Tag.REPLACEABLE.isTagged(targetBlock.getType()) && targetBlock.getWorld().getNearbyEntities(targetBlock.getLocation(), 0.5, 0.5, 0.5).isEmpty()) {
    return targetBlock;
  }
  return null;
}
young knoll
#

I need to wait for userdev

#

👀

wraith apex
#

Oh fun... Mojang made the enchantment class a record 💀 can't extend from it now 💀

river oracle
green prism
young knoll
#

Patrick remapper is janky

slender elbow
river oracle
#

extending it would be stupid

wraith apex
#

hm?

kindred sentinel
#

How to change player's skin using plugin?

young knoll
#

I don't think the patrick remapper task has an output configuration

kindred sentinel
#

I need a tutorial

river oracle
#

enchantments are data driven there is absolutely 0 reason to extend enchantment

wraith apex
#

custom enchants

river oracle
#

yeah

#

data driven enchants make custom encahtns easy asf

slender elbow
#

I wonder if I can make a paper fork that undoes all of paper changes to get a spigot devbundle

young knoll
#

kek

pseudo hazel
#

yeah you bother jason for a few hours and then you have new enchantments

wraith apex
#

what do you do to accomplish that?

#

data pack?

river oracle
wraith apex
#

ah

young knoll
#

Who developed userdev, I'll pay them $3.50 to make a spigot version

#

Normally a datapack, yes

river oracle
#

you could use a datapack, could probably do it with NMS too though

pseudo hazel
#

its probabl also possible with datapacks now yeah

river oracle
#

as long as you unfreeze the registry and ensure no one is on

young knoll
#

kek

river oracle
#

perfect thing to do onEnable or onLoad

wraith apex
#

bruh datapacks don't play nicely with spigot (afaik)

young knoll
#

They play fine

wraith apex
#

they server wide though

river oracle
#

I find datapacks plus spigot stupidly annoying

wraith apex
#

instead of per world

river oracle
#

so just use NMS

wraith apex
#

unless I'm missing something

blazing ocean
#

i find datapacks to be stupidly annoying

young knoll
#

Maybe if we get that registry api

blazing ocean
young knoll
#

I think they have one

#

But I meant for us

blazing ocean
young knoll
#

Well no one cares about their api

#

smh

river oracle
#

probably need to add a step to the plugin loader

wraith apex
#

lol

river oracle
#

or do a partial rewrite of it

#

that allows for writes to registries

blazing ocean
wraith apex
#

enchantments stored in some text file in assets?

#

like they do with recipes now

blazing ocean
#

src/main/resources/data when

young knoll
#

When someone writes the PR for it

blazing ocean
eternal night
blazing ocean
eternal night
#

What is with the paper slander these days Sadge

blazing ocean
#

finish updating now smh

#

paper 1.21 when

#

smh smh

eternal night
#

MM is churning through the patches like crazy NODDERS

blazing ocean
#

but hes afk rn

eternal night
blazing ocean
#

i'm watching you

#

i hear your keyboard

eternal night
#

spooky

young knoll
blazing ocean
#

now he's back

#

good

eternal night
#

people just don't care for the spigot CLA ¯_(ツ)_/¯

kindred sentinel
#

?nms

blazing ocean
young knoll
#

But half of you have already signed it smh

pliant topaz
kindred sentinel
blazing ocean
#

smh my head

eternal night
#

and I mean, mostly to look at PRs

blazing ocean
kindred sentinel
blazing ocean
#

smh my head

eternal night
#

to sob at whatever the fuck commodore changes come in

young knoll
#

Idk who the largest contributors are

#

so

eternal night
#

I mean, leaf has a couple giant ones

#

I still don't get why spigot isn't on GH these days Sadge

blazing ocean
#

smh my head

eternal night
#

stash is so depressing

wraith apex
#

GH?

eternal night
#

github

blazing ocean
#

github

wraith apex
#

oh my bad

blazing ocean
#

fuck

young knoll
#

github

eternal night
wraith apex
#

gitpub 🍺

eternal night
wraith apex
#

usurp and push to master, no pull request needed

blazing ocean
#

there's a fly in my room asdkjasdjahsd

eternal night
#

because like, spigot is chilling at 129 PRs with 0 paper contributors

young knoll
#

How many open PRs does paper have

blazing ocean
#

yes

eternal night
#

Yea 208 rn

sharp cosmos
#

Does Bukkit.getOfflinePlayer(name).getUniqueId() always return the correct uuid?

blazing ocean
#

yea if it exists

eternal oxide
#

actual answer is.. not always

blazing ocean
#

yeah i lied

wraith apex
#

getOfflinePlayer() seems to only return an offline player if they've ever joined your server

eternal oxide
#

getOfflinePlayer always returns an OfflinePlayer

#

but it may not be valid

wraith apex
#

^

#

das what I meant

blazing ocean
#

^

eternal night
wraith apex
#

like getting an amazon parcel

#

but nothing inside

blazing ocean
#

amazon moment

wraith apex
#

I had an amazon parcel with 5 different shipping labels slapped ontop of eachother all inside a DPD parcel

#

I guess someone couldn't agree where it should go lol

remote swallow
#

hes contributed to paper recently

eternal night
#

True true NODDERS

#

I also had a spigot PR

remote swallow
#

did paper fix that thing we last dm'd about

eternal night
#

yes yes (thank god KEKW )

remote swallow
#

smh

young knoll
#

Epic are you working with the enemy now? smh

eternal night
#

Nah, don't worry

young knoll
#

👀

eternal night
#

(its a setup for carabenetMC (or whatever it is called))

robust ginkgo
young knoll
#

Add a delay

kindred sentinel
#

What does it mean?

robust ginkgo
eternal night
young knoll
#

?cooldowns

undone axleBOT
remote swallow
eternal night
#

(it was my anime list)

young knoll
#

kek?

mild stone
kindred sentinel
robust ginkgo
eternal night
#

I mean, something is exposing a version of mysql connector with a known CVE

kindred sentinel
#

And how to fix it?

eternal night
#

Eh, you could exclude that dependency if you don't need it

kindred sentinel
#

I just want to install fucking nms

eternal night
#

oh

#

dw about it in NMS then

#

you can't do shit about it

kindred sentinel
eternal night
#

if you don#t need it, don't worry about mysql

#

if you do, maybe shade your own mysql connector

kindred sentinel
#

Okay, I would but IT DOESN'T WORK

#

What's wrong

#

It has mojang authlib

#

but doesn't have craftbukkit

young knoll
#

It's not from NMS

#

At least not 1.21 NMS

kindred sentinel
#

Well, then I need CraftPlayer

#

Which I don't have

young knoll
#

Remove the spigot-api one

#

You don't need both

random vine
#

is there something to edit for 1.21 to allow 1.20.6 plugins?(its the chunky plugin to pregenerate)

kindred sentinel
#

?paste

undone axleBOT
robust ginkgo
#

What's the default block placing cooldown?

kindred sentinel
young knoll
#

Did you run buildtools for 1.20.1

#

with the remapped flag

pseudo hazel
#

whats the most reliable way to see the server's mc version? Right now I am making a switch on Bukkit.getVersion but feels a bit clucnky

kindred sentinel
young knoll
kindred sentinel
#

I don't think so

young knoll
#

run it with that

#

it's in options

charred blaze
#

is npc instanceof Player?

#

for example citizens

eternal oxide
#

its ServerPlayer

charred blaze
#

there is no serverplayer class

eternal oxide
#

ServerPlayer is nms

charred blaze
#

how do i check if entity is npc without that?

#

hasmetadata("npc")?

charred blaze
#

i mean its a player like entity

#

why shouldnt it

graceful patrol
#

hello, im updating a 1.8.8 plugin to 1.20.1, it for some reason just does not know what "minecraft" is.... help please?
https://ctrlv.cz/UcJB

robust ginkgo
#

Am I missing something?

#

Where's custom data?

rough ibex
#

so like before you could have {literallyanyNBT:1b,Count:1,othervaliddata:{}}

robust ginkgo
wet breach
#

The compiler puts the implementation into the class file info

rough ibex
#

it would then be custom_data={literallyanyNBT:1b},count=1 I think

robust ginkgo
#

Is it not part of the item meta?

rough ibex
#

uhh

pseudo hazel
wet breach
robust ginkgo
#

I can only seem to find the vanilla components

#

Does spigot not support it yet?

winter zenith
#

is it possible to put a durability bar on items that naturally dont have durability

pseudo hazel
#

yes, since 1.20.6

pseudo hazel
winter zenith
#

with what

pseudo hazel
#
if (stackMeta instanceof Damageable) {
  ((Damageable)stackMeta).setMaxDamage(maxDamage);
   ((Damageable)stackMeta).setDamage(currentDamage);
   }```
#

or prettier

#

but thats the idea

robust ginkgo
#
meta.getPersistentDataContainer().set(new NamespacedKey("pixelatedsorcery", "item_id"), PersistentDataType.STRING, "test_block");

Is this the way to add custom components? Or am I overcomplicating things?

carmine mica
pseudo hazel
#

so I guess Bukkit.getVersion is good enough for me

wet breach
#

Because if you look in the pom you can see where the compiler puts that in

green prism
#

?paste

undone axleBOT
wet breach
#

So you should be able to do something like Bukkit.class.getImplementation or something like that

#

Cant remember exactly lol

pseudo hazel
#

hmm

#

I cant find it

#

its somewhere in nms

green prism
#

Hello. Can you please help me? My i value is not resetting

Guilty code: https://paste.md-5.net/vubeyikime.cs
How it is called:

        CustomGui customGui = cachedGuis.get(id);
        customGui.generateInventory();

        // Inject page system consumers
        GuiDetails guiDetails = injectPageSystemConsumers(customGui);
        customGui.setGuiDetails(guiDetails);

        player.openInventory(customGui.getInventory());

        // Update default page systems
        // to allow them to appear in the inventory
        customGui.getPageSystemMap().values().forEach(pageSystem -> {

            instance
                    .getServer()
                    .getScheduler()
                    .runTask(
                            instance,
                            pageSystem::updateInventory
                    );

        });

Output sample:
https://paste.md-5.net/fujecucipu.css

#

(It cycles 3 times)

pseudo hazel
#

oh maybe its this Bukkit.getServer().getClass().getPackage().getName();

wet breach
wet breach
pseudo hazel
#

oh, well I just care about the version of minecraft that the server is running on

#

sice I wanna use different items based on version

#

like items in 1.21 dont exist in 1.19 for example

#

so my config will die

wet breach
#

Well i only recommended the way i was saying because its guaranteed to not have some plugin change it as it cant

#

And it exists on the official versions

pseudo hazel
#

yeah I will try whati showed, should be good

eternal night
#

Bukkit.getServer().getBukkitVersion(); also exists NODDERS

pseudo hazel
#

what does that return

eternal night
#

e.g API version

#

1.20.6-R0.1-SNAPSHOT

topaz cape
#

how do you get the new ServerEntity

#

in NMS*

pseudo hazel
#

oh thats funny

#

Bukkit.getServer().getClass().getPackage().getName() returns org.bukkit.craftbukkit.v1_20_R4

#

but im 100% in a 1.20.6 server

eternal night
#

because that number is more or less magic

topaz cape
#

yes thats what R4 is

eternal night
#

I'd strongly recommend to not use that method

pseudo hazel
#

okay

eternal night
#

mostly because it'll break on paper KEKW

pseudo hazel
#

oh right

#

okay

#

so then Bukkit.getVersion it is xD

#

like im not making a paper pplugin but I dont wanna break paper builds on purpose xD

eternal night
#

Yee

green prism
wraith apex
#

¯_(ツ)_/¯

rough ibex
#

no it's pathetic

#

not shit

#

different library

wraith apex
#

Build your own 3D A* pathfinder then lol

rough ibex
#

A* for effort

wraith apex
#

if it's a hostile mob then setTarget()

#

if not well...

wet breach
rough ibex
#

'if it's a hostile'

wraith apex
#

well ye a cow is not hostile

rough ibex
#

cows are not hostile

wraith apex
#

xD

#

EVIL COW

eternal night
wraith apex
#

aggressive mooing intensifies

rough ibex
#

yes

#

do you know anything about minecraft

wraith apex
#

You'll need a 3D A* or some other 3d path finder

rough ibex
#

'is zombie hostile' bruh

wraith apex
#

A* is one of the easier ones to learn I'd say

topaz cape
#

how do you get the new ServerEntity out of an entity in NMS

#

huiwfghuiwf

#

ITS CONFUSING

wraith apex
#

use Mojang Mappings?

topaz cape
#

ye

#

apparently ClientboundAddEntityPacket now requires (Entity var0, ServerEntity var1) instead of before was just (Entity var0)

#

and I can't get it from anywhere

wraith apex
#

have you tried passing null and just see what happens?

eternal oxide
#

just get teh addEntity packet from teh entity

#

Entity#getAddEntityPacket()

topaz cape
#

D:

topaz cape
#

its not saved as a variable

eternal oxide
#

the second arg looks to be the player you are sending to

#

can't tell no IDE open at mo

topaz cape
#

doesn't really sound like it, it takes X, Y, Z from it

eternal oxide
#

um

kindred sentinel
#

How to get now EnumPlayerInfoAction?

eternal oxide
#

not sure what version you are using but npc.getAddEntityPacket()

#

takes no args

#

that npc is a ServerPlayer

topaz cape
#

huh?

#

what NPC

#

oh

#

no it really doesn't

#

are you sure you are on 1_21_R1

eternal oxide
#

I'm not

topaz cape
#

well thats the problem

#

😄

#

on older versions it didnt

#

now it does

charred blaze
#

what event do npcs call for move?

robust ginkgo
#

Is there a better block to use for custom blocks than note blocks?

drowsy helm
#

If it’s packet based it wont call an event

eternal oxide
#

oh no, latest Eclipse fails to install due to a linkage error (Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: )

#

wth Eclipse my baby

robust ginkgo
#

well that sucks

eternal oxide
#

I bet it doesn't like Adoptium or some shit

vast kelp
eternal oxide
#

god no, Ij will not do what I want

vast kelp
#

What is it you want

eternal night
#

Not intellij NODDERS

eternal oxide
#

multiple projects in one workspace

eternal night
#

5Head just open the folder above it /s

eternal oxide
#

I have a half dozen Eclipse installs on this PC> just the latest fails to install 😦

vast kelp
eternal oxide
#

Not changing to Ij

charred blaze
#

can someone confirm that citizens plugin doesnt call move event?

junior geyser
#

What was Enchantment.ARROW_DAMAGE replaced with in 1.21?

eternal night
#

power

#

presumably

junior geyser
#

K thats what I thought thanks

echo basalt
#

What is pikamug doing here o_o

quiet ice
#

Since eclipse is now using Java 21

eternal oxide
#

I had to go back a version to get Eclipse to install

#

somethign def up with latest release

quiet ice
#

I managed to upgrade to it well enough - I'm not sure if I installed that requested plugin; probably did though

#

Ah no I didn't as I already was using the Java 22 variant of that plugin for a reason that eludes me

eternal oxide
#

yeah it failed with an outdated swt dll on latest. Even though IT provided the dll

#

going back one version (3 months) it installs fine

#

2024-03

worldly ingot
#

My Eclipse update actually also failed

eternal oxide
#

I'm installing fresh

worldly ingot
#

I had to reinstall the latest version using the Eclipse Installer and copy over the files manually

#

Yep

eternal oxide
#

had to go back one version to even install on java 21

#

I actually have 5 different installs of Eclipse, all different versions for differing reasons

next plume
#

I go years without updating Eclipse.

quiet ice
#

I actually downloaded eclipse 2022-06 today just to verify I wasn't going insane, only to find out that a feature was removed but apparently noone is aware of that and the removal is poorly communicated

#

Like the fact that the developers didn't respond with a "uh, that feature doesn't exist, wdym?" for over 9 months is terrible.
But I know that other projects have similar issues (IJ having removed the same feature [remote repository indexing] - although I don't quite understand to which extend IJ removed it)

eternal oxide
#

I don;t really like teh indexing Eclipse does

#

I usually disable it

quiet ice
#

I just wanted to test it out as I'm writing a maven repository (NIH syndrome strikes yet again) - while I was aware that it existed at some point in time, I never knew how well it worked out

raw epoch
#

do someone have an answer to this ? (Rotate a display block around a axis with the spigot rotation maxtrix sys ?)

#

Quaternion diff lmao

young knoll
#

My eclipse auto updated

#

But it mangled everything

eternal oxide
#

I'll try an update to latest if it ever finishes installing

#

slow mirrors its saying

quiet ice
#

Yeah that is what I've been experiencing for the past few hours too

eternal oxide
#

I guess they are not looking for more donations

quiet ice
#

My eclipse won't auto-update as it failed to properly update mylyn ages ago so I always have to manually exclude mylyn from the update process - so there is always some kind of manual intervention that needs to occur

eternal oxide
#

didn;t that get removed long ago?

quiet ice
#

My eclipse install is two or three years old now

eternal oxide
#

or combined into somethign else

#

yeah I have some of those

#

my last one keeps asking if it can delete a plugin cache as its no longer used. But my other install uses it

quiet ice
#

plugin cache - that isn't something I've heard of actually

eternal oxide
#

I'll fire it up and see

#

2023-06

quiet ice
#

Ah that is the cache for the remote repository indices (i.e. the nexus-maven-repository-index.gz et al files) and is actually that feature I complained about being removed

drowsy helm
eternal oxide
#

yeah older Eclipse craps its pants if its cleared

quiet ice
#

doesn't surprise me - the maven central index is like 15 GiB decompressed

sullen marlin
#

I've disabled that on netbeans since forever

#

It's just so much wasted data

native gale
#

What were the obfuscation rules on Spigot?

#

I can't find the article

echo basalt
#

Yo md I sent an email to spigot last night

#

Did y'all get it?

#

Woke up to a bunch of roundcube emails saying I had 6 unsent emails or sumn

native gale
#

I didn't

sullen marlin
#

I don't think so

echo basalt
#

F

#

basically is manual setup allowed for premium plugins? (non-drm related)

sullen marlin
#

Oh

#

Idk why that rule is so confusing

#

Use common sense

echo basalt
#

I remember seeing a rule regarding plugins must be functional out of the box with no setup

#

So memory + wonky terms = confusion

junior geyser
#

Does the Generic Attack damage attribute modifier on itemstacks include damage from enchantments?

sullen marlin
#

The intention is obviously DRM and not configuring functional things

echo basalt
#

Perhaps being slightly more explicit stating DRM only might clear up

dire pewter
#

Hello,
does anybody know if there are other sources or methods other than wiki.vg to see the new packets added in the new versions like 1.21?

sullen marlin
#

It's pretty clear but feel free to propose new wording

dire pewter
echo basalt
#

Hm

#

Maybe including an example under "manual installation steps" will suffice

young knoll
#

It does not

junior geyser
#

kk Thanks

eternal oxide
#

Yeah updated to latest Eclipse 2024-06 and it fails to startup. Same error as tryign to install it. swt link error

#

I'll stick with 2024-03

eternal oxide
#

libswt seems to be a Eclipse dll

#

2024-03 works fine (4.31) but 2024-06 fails to install or start after an update (4.32)

worldly ingot
#

Even on a clean install? Weird

eternal oxide
#

yep, installer errors out as it starts with the linking error

eternal oxide
#

Win 7 😉

wet breach
eternal oxide
#

I thought that too, but it seems not

#

it finds the dll fine, but fails to find an entry point

#

which is odd as its a dll provided by the Eclipse installer

#

installs to the users .swt folder

wet breach
#

Is the dll compiled with higher lang version?

eternal oxide
#

possibly but I have no indications of that

#

however 2024-6 supports java 22 so its possible

#

I'm running java 21

wet breach
#

Only 2 ways to solve that. Install the runtimes or use a dll compiled on lower version

#

Not sure if win 7 can install the runtimes

eternal oxide
#

I'll stick with 2024-03 until I have to update

#

it actually seesm to be the same swt dll file in both versions

#

swt-win32-4965r11.dll

#

works on 4.31 but not on 4.32

river oracle
#

Anyone here familiar with vineflower? When decompiling I get some rather yucky variable names

      if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
         $$0.append("-- Head --\n");
         $$0.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
         $$0.append("Stacktrace:\n");

         for (StackTraceElement $$1 : this.uncategorizedStackTrace) {
            $$0.append("\t").append("at ").append($$1);
            $$0.append("\n");
         }
#

for example

#
      StringWriter $$0 = null;
      PrintWriter $$1 = null;
      Throwable $$2 = this.exception;

I kinda just want to switch them to var versus $$

#

but It doesn't seem like their is a configuration option for that

sterile axle
#

only thing i see in their docs is maybe --use-lvt-names=0, by default it's 1 and tries to do something to interpret the type to fix the naming of vars but looks like that might be failing

#

entirely a guess, though

river oracle
sterile axle
#

o

carmine mica
#

what are you trying to remap/decompile?

river oracle
river oracle
carmine mica
#

with way better lvt names than vineflower can give you

#

also includes decompile fixes so you can actually compile and run the vanilla server

river oracle
#

Ik of mache, but I'm homebrewing my own shit for a hobby project atm

river oracle
vagrant stratus
#

any ideas on if

    public void WorldLoading(final Player player) {
        if (WorldLoading.field_spectatorMode == null) {
            Core.instance.getLogger().severe("Failed to show world loading screen to player. This server version is not compatible.");
            return;
        }
        final PacketContainer packet = new PacketContainer(PacketType.Play.Server.GAME_STATE_CHANGE);
        try {
            final Object spectatorMode = WorldLoading.field_spectatorMode.get(null);
            packet.getModifier().write(0, spectatorMode);
            packet.getFloat().write(0, (Object)0.0f);
            sendPacket(player, packet);
        }
        catch (final IllegalAccessException e) {
            Core.instance.getLogger().severe("Failed to show world loading screen to player:");
            e.printStackTrace();
        }
    }

is possible w/ just the api? (Just shows the loading screen)

river oracle
vagrant stratus
# vagrant stratus any ideas on if ``` public void WorldLoading(final Player player) { ...

there's

    public void Credits(final Player player) {
        if (Credits.field_spectatorMode == null) {
            Core.instance.getLogger().severe("Failed to show credits screen to player. This server version is not compatible.");
            return;
        }
        final PacketContainer packet = new PacketContainer(PacketType.Play.Server.GAME_STATE_CHANGE);
        try {
            final Object spectatorMode = Credits.field_spectatorMode.get(null);
            packet.getModifier().write(0, spectatorMode);
            packet.getFloat().write(0, (Object)1.0f);
            sendPacket(player, packet);
        }
        catch (final IllegalAccessException e) {
            Core.instance.getLogger().severe("Failed to show credits screen to player:");
            e.printStackTrace();
        }
    }

as well, for the credits screen

lean arrow
#

If I set a player's scoreboard, is there anyway to "unset" it so it goes back to using whatever vanilla scoreboard is assigned to that player? Because otherwise the plugin overrides anything, even if it is not continually getting sent.

sullen marlin
young knoll
#

You can set it back to ScoreboardManager#getMainScoreboard

#

However another plugin may have replaced their scoreboard already

#

I suppose you could store their old scoreboard and then restore it later

sterile axle
remote swallow
#

wait thats not taylor swift thats a model 1857 12 pounder napoleon cannon

sterile axle
#

wow, you're right...that's not taylor swift, that's a model 1857 12 pounder napoleon cannon! good eye

young knoll
#

I mean

#

I’ve never seen Taylor Swift and a model 1857 12 pounder napoleon cannon together

river oracle
# sterile axle

I have a sneaking suspicion that, that isn't taylor swift I think it might be a model 1857 12 pounder napoleon cannon

sterile axle
sterile axle
#

fucking england moment

#

oi m8 u got your chattin on discord license

#

oi m8 you got your comput'ah license

#

oi m8, you got your breathing license

remote swallow
#

i will break your legs

sterile axle
#

oi m8 you got your physical violence license

remote swallow
#

smh

mild stone
#

how do i get the 1.21 server jar in buildtools

#

what cmd do i run in ubuntu?

kind hatch
#

java -jar BuildTools.jar --rev 1.21

#

Make sure you have Java 21 JDK installed.

#

Also, keep in mind that 1.21 only just released recently.
Spigot will be updated frequently throughout the week to address any outstanding bugs with the release. So you may need to run BuildTools again in the near future.

sour mountain
#

I've been making plugins for a bit and I want to start trying to make plugins other people so I can get money to keep running my server, what are some good sites/ways to find people looking for plugins to be made?

#

Also what are some sites for selling plugins?

#

I know spigot you can but I don't meet the requirements yet

eternal oxide
#

?services

undone axleBOT
eternal oxide
#

You may get banned linking other commercial sites here

sour mountain
#

also do you have to be 18 or older to sell plugins?

native gale
sour mountain
silk mirage
#

Is there some good inventory api libraries?

#

Something like SmartInvs but more upto date?

silk mirage
#

.-.

eternal oxide
#

A lot of places you have to be 13+

#

However for selling it's likely going to be 18+ as in most countries you can not legally enter into a contract under 18.

warm scroll
#

I’ve been wanting to learn some Minecraft development, is there anyone that teaches? Dm me

celest wadi
#

make sure you have some understanding of java then its straight forward searches

#

"how do i create a custom item in spigot"

#

"spigot custom command tutorial"

warm scroll
#

I don’t know anything about Java tho

celest wadi
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

warm scroll
#

Thank you

silk mirage
#

How do I check if a material is a stained glass pane?

#

Regardless of it's color/data that is

lilac dagger
#

i think material has material data

#

you can get the material and check for the stained glass material data

pseudo hazel
#

or make a set of all stainedglass materials and check if your material is in the set

eternal oxide
#

or just see if teh name ends with...

pseudo hazel
#

yeah thats another good way

vital sandal
#

Hmm

#

These 2 function should all have the same properti right ?

pseudo hazel
#

yes, my dumb ass prefers the first one

#

I think the second one means you cant put it an Employee

eternal oxide
#

I do the first too, but I prefer the second

pseudo hazel
#

except if you put in a derived version

dusk violet
#

good morning. I need your help. My hosting server has been allocated 10 GB of RAM. After restarting the server, only about 1 GB is used, but gradually the amount of RAM used grows, and when 3-5 players are online, the server crashes due to insufficient RAM. Somebody tell me that it is necessary to optimize the server, but I absolutely do not know how to do it. Please help me

pseudo hazel
#

any plugins?

eternal oxide
#

any crash log?

dusk violet
#

Plugins (73): ACubelets, ajLeaderboards, AntiRelog, AtributeHeadsPlace*, Automessage*, BankPlus, BattlePass, BeeStar, BKCommonLib, BottledExp, BSpawner, ChatEx, Chunky, Citizens, ClearLag, CMI, CMIEInjector*, CMILib, CommandTimer, ConsoleSpamFix, CraftEnhance, DecentHolograms, DeluxeMenus, EasyPayments, FunUtillity, GooDTimEBosses, GooDTimEMessages, HexAirDrop, HideAchievements*, HideStream*, HolographicDisplays, HolyBoers, HyperReseller, HyperSpeedTasks, IRandomTeleport*, ItemEdit, KOTH, LagMonitor*, LightCheck, LiteBans, LuckPerms, MineResetLite, MiningBlock, MoneyFromMobs, MultiEconomy*, Multiverse-Core, MyCommand, NBTAPI, Orebfuscator, PlaceholderAPI, PlayerPoints, PlugManX (PlugMan), PrimeAlchemist, ProtectionStones, ProtocolLib, PSAddon, PSUApi*, Quests, RE4TNT, RocketPlaceholders, SCore, SimpleAutoRestart, SKLibrary, spark, TAB, UltimateServerProtector, Vault, ViaBackwards, ViaVersion, Vulcan, WorldEdit, WorldGuard, zAuctionHouseV3

dusk violet
eternal oxide
#

strip your plugins and start with a few at a time. You have a leak

pseudo hazel
#

half your plugins

eternal oxide
#

get rid of Plugman. Should never be on a live server

pseudo hazel
#

if you dont have lag, try the other half

#

then repeat until you find the culprit

dusk violet
#

okay

#

thank you

pseudo hazel
#

could also be death by a 1000 cuts, i.e. multiple plugins causing leaks

#

but yeah, if memory just keeps going up with 3-5 players its a memory leak

vital sandal
#

Both should function the same right?

#

Or the second one cannot add new entry 🤔 to the pass by reference list

#

Or the second method is just pass by values?

eternal oxide
#

neither is pass by value

pseudo hazel
#

the difference is just an inheritance thing

#

but im convinced noone knows the actual difference

tardy delta
# vital sandal

first one means you cannot pass an ArrayList<FancyEmployee> where FancyEmployee extends Employee

vital sandal
#

But how about when you try to add new entry to the list

#

Let say we have
FancyEmployee and BadEmployee are the childs of Employee
So we cannot add FancyEmployee to the list of the BadEmployee right ?

tardy delta
#

no because thats not a subtype of bad employee

vital sandal
#

But it is all subclass of Employee

#

So I believed we cannot add new entry to the second method’s parameter list

tardy delta
#

if its a List<Employee> you can

#

why wouldnt you

#

it just says its a list of employee or subtypes of employee

#

so you can pass an ArrayList<FancyEmployee>, ArrayList<Employee> and ArrayList<BadEmployee>

vital sandal
#

if you pass ArrayList<FancyEmployee> => You cannot add BadEmployee right ?

tardy delta
#

in the first one it gotta be an ArrayList<EMployee> (which ofc doesnt mean you cant do .add(BadEmployee))

#

well does BadEmployee extend FancyEmployee?

#

if so you still can

vital sandal
tardy delta
#

no ofc, does that mean ofc not or ofc it does?

vital sandal
#

ofc not

tardy delta
#

then you cant

#

im thinking

#

iirc in ArrayList<? extends Employee> you can still add BadEmployee

#

wait no you cant

#

with ? super Employee you can

vital sandal
#

hmm and 2 methods cannot exist at the same time

tardy delta
#

what are you even trying to do

vital sandal
#

so to conclude you cannot add entry if the parameter has ? extends

tardy delta
#

? extends means reading, ? super means writing

vital sandal
tardy delta
#

covariant/ contravariant thing

vital sandal
#

but you cannot put the class extend Employee into the function anymore

quaint mantle
vital sandal
#

but yes you can add

echo basalt
#

The whole point of those janky ? extends Whatever in collections is to put them on other collections and ensure wonky type restrictions

#

Think of a Map<Class<? extends Joe>, List<? extends Joe>>

#

If you encapsulate things properly you can end up with strict type constraints that prevent you from inserting misc Joe subtypes in the wrong place

vital sandal
#

well that is not the point of this question

#

in reality this is a question that I got from my friend's test

vital sandal
# vital sandal

1> 2 methods have the same properties
2> first method cannot add entry to the list while the second one can
3> second method cannot add entry to the list while the first one can
4> all entry of methods 2 can only include subclass of Employee and not include Employee

#

which statements are correct?

#

for me it is 3

tardy delta
#

both can add, or atleast the first one

#

but on the second one, it must be of the exact type Employee iirc

tardy delta
#

or is it the other way around, that it only allows adding a subtype?

#

ah wait that type means it could be a List of whatever subtype of Animal so you cannot add an Animal because the list might actually be of type Dog, or Cat, or whatever

tardy delta
#

so i believe thats the reason you cannot add

vital sandal
tardy delta
#

ye cuz you dont know the exact type

vital sandal
#

yeh

#

so you cannot add I believed ?

tardy delta
#

yes

#

with List<? super Animal> you can however

#

but i havent touched that stuff enough

vital sandal
#

and you can no longer cast childs to that function

tardy delta
#

i mean the place that constructed the list is still responsable for knowing the exact type

quaint mantle
# vital sandal

What about this?

public static <T extends Animal> void func(ArrayList<T> list) { /* */ }
tardy delta
#

now thats a list of a single type

#

just fill in T

#

bound is on the T, not the list anymore now

#

glad kotlin has T : Animal for generic bounds and in, out for collections

robust ginkgo
#

Is this how I'm supposed to cast a pdc value to a string?

#

nevermind there's a toString method

#

I'm confused

pseudo hazel
#

isnt it already a string?

robust ginkgo
#

Does it just give me this warning because java can't tell if it is guaranteed to return a string?