#help-development

1 messages · Page 977 of 1

gloomy ocean
#

I said that's an older pack I've been using

#

I'm making my own rn

worldly ingot
#

It'll be under assets/textures/entity/trident.png or something like that

gloomy ocean
#

I know where it is but idk where to find the thing to edit it

worldly ingot
#

I don't know what you mean

#

You can only override the one texture by replacing it with a texture pack

worthy yarrow
#

How are you doing choco?

gloomy ocean
#

This thing

#

Idk where to find this so I can make my own texture

worldly ingot
#

Yes. You've already overridden it. That's literally all you can do

#

You would need to make a resource pack that has the /assets/textures/entity/trident.png texture to override that one

#

Open it in your image editor of choice, edit to your heart's content, save as new file, setup a resource pack

torn shuttle
#

tfw you use a java version that actually assigns an amount of memory that is based on how much memory your pc has

#

specifically, 25%

young knoll
#

tfw you don’t have hardcoded values in your startup command

torn shuttle
#

give me a break I just installed this

#

besides I have ram to spare

remote swallow
#

name?

quiet ice
torn shuttle
#

damn it mojang

#

only thing that broke too

chrome beacon
#

? why are you making new entity dimensions

torn shuttle
#

hitboxes

quiet ice
cinder abyss
#

bad pratice? Never heard of that

cinder abyss
#

perfect 👍

#

good 46 FPS btw

worldly ingot
#

There you go. Glad we got that figured out :p

quiet ice
oak mica
#

what was the mapping website again

worldly ingot
#

That's a lot of assignments

#

but it doesn't have 1.20.5 yet

cinder abyss
#

yeah

#

that's sad

#

but

worthy yarrow
cinder abyss
#

this one has been updated

torn shuttle
#

great method, 10/10

cinder abyss
cinder abyss
torn shuttle
#

oh bet it's not bh anymore too

#

fuck me

worthy yarrow
torn shuttle
#

can somoene link me the website with the thing

quiet ice
cinder abyss
#

which thing?

torn shuttle
#

I got it, the mappings website

oak mica
oak mica
#

im scared for the nbt changes

remote swallow
worldly ingot
young knoll
#

Imagine doing reflection by name

#

Couldn’t be me

cinder abyss
#

I have nothing with spigot, it's pretty cool renaming ONLY classes

#

looks like IT DOESN'T WORKS

young knoll
#

When are we just gonna run mojmap at runtime

#

Kek

cinder abyss
#

were is this class...

cinder abyss
cinder abyss
#

well, my code is bad lol

#

"my code"

worldly ingot
#

We still have some remnants of CraftBukkit mappings in source

cinder abyss
#

"our code" 🇷🇺

young knoll
#

Wait until you see my new fork that runs mojmap at runtime and access transforms everything to public non-final

#

10/10

cinder abyss
cinder abyss
chrome beacon
#

Ignite

cinder abyss
#

the last thing I have to wait in my entire life is for cephx to update his mappings...

cinder abyss
young knoll
#

Mixins aren’t the same as having everything be public!

#

We’ll add those too tho

chrome beacon
#

It has access wideners too :)

cinder abyss
#

what is "access wideners"?

#

I know about mixins, but not that

chrome beacon
#

It's used to change the visibility of methods/fields/classes

chrome beacon
#

like widen access

cinder abyss
#

like with mixin then

chrome beacon
#

hence the name

#

So if you have a private method you can change it to public

cinder abyss
cinder abyss
chrome beacon
#

?

cinder abyss
#

a strange thing

#

it shouldn't do that

young knoll
chrome beacon
#

smh just provide a widen all things file

cinder abyss
#

so no need to "code"

#

for those nostalgic persons who thinks that "coding with complicated words and types" is the future

chrome beacon
#

GPTSpigot

cinder abyss
#

I asked ChatGPT about spigot one time.

#

only one time.

#

because it was the "too much" time

#

oh...

young knoll
#

Isn’t that already a think

#

Fuckin

#

VisualBukkit

chrome beacon
#

Yeah it exists

cinder abyss
#

ExcelBukkit

worthy yarrow
#

Is there a way to induce the overcast of setStorm without making it actually storm

chrome beacon
#

Desert biome?

worldly ingot
#

Yeah, biome is really the only way

worthy yarrow
#

Erm I can't force biomes in this case

echo basalt
#

@lost matrix I'm gonna start coming up with a proper nice redis-backed database system tomorrow

#

I figured you might want to guide it a little bit

#

So stick around

chrome beacon
#

👀

echo basalt
#

Main requirements I'm gonna mandate:

  • Support for all kinds of relational and non-relational databases, with support for custom queries regardless of type
  • Codec system for non-relational database
  • Redisson instead of jedis even though I hate dependencies
  • Optional redis middle layer for caching results and improving latency, as well as locking.
cursive kite
#

I have a boss that spawns in an arena which players can then view health with a command, an instance of the entity is saved by LivingEntity reference in a class, the issue is when the chunk gets unloaded it becomes messed up and starts referencing an invisible entity (assuming the one that unloaded and doesnt update to the new replacement) how can i get around that

fiery cedar
#

https://prnt.sc/lX-J4N37MMGi can i have some help here can some one say me the placeholder command here like i give 15k to buy the kit and the message i add in deluxemenu send the new balance

(- $15,000 1x tier 1 kit (the balance i have 23,000 befor the buy and the 8k after the buy)

glad prawn
quaint mantle
#

md_5

#

The reproduction code should be a runnable plugin or just a code snippet?

kind hatch
#

Both would be better than one.

raven badger
#

Hello! Follow up to my earlier JIRA. sendSignChange() no longer throws an exception but now seems to have no effect

#

I'll file a new one. Using the same code as last time, no exception but nothing seems to happen. Same code works as expected on 1.20.4

sullen marlin
#

make sure you include what event or how you're doing it. I did see some glitchiness, but I put it down to the interact event causing a block update

raven badger
#

Will do

quaint mantle
#

md_5, I also updated the plugin that tests the issue

#

The plugin is BlobRP, but it depends on BlobLib. I uploaded both jars

#

Sorry for requiring both jars, I was on a rush 😬

glad prawn
#

🤔

sullen marlin
#

We don't know if it's a bug in spigot or your thousands of lines plugin with no instructions

#

See release announcement

summer gale
#

I built NMS using the --remapped flag but still the methods are like a, b, c, d

celest mirage
summer gale
#

Java: 17, MC: 1.19.4

quaint mantle
#

Also the source

sullen marlin
#

Thanks

warm light
#

"MUSHROOM_COW" has been replaced with "MOOSHROOM"?

sullen marlin
#

Yes?

shadow night
mellow edge
#

which packet can I send to change player's lives to hardcore while he is still in game?

lilac dagger
#

ClientboundChangeDifficultyPacket @mellow edge

#

wait no, you want hardcore

#

hmm

upper hazel
lilac dagger
#

@mellow edge ClientboundLoginPacket is the packet

shadow night
mellow edge
upper hazel
lilac dagger
#

fake change*

mellow edge
#

maybe

#

but this was indeed the only packet that contains hardcore from what I saw in protocol wiki

glad prawn
sullen marlin
#

Why is it strange

#

Otherwise the thread would survive the plugin being disabled

upper hazel
#

why doesn't ChunkSnapshot save chest data??

quaint mantle
#

can i insert fastlogin as a dependence in my plugin?

#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

quaint mantle
#

like that?

knotty totem
#

Im kinda stuck rn. Im trying to make a gui open up when I enter a portal. (Not a Random TP location or Nether)

#

public void onPortal(PlayerPortalEvent event) {
if(event.getCause() == TeleportCause.Nether_PORTAL) {
event.setCancelled(true);
event.getPlayer().openInventory(portalGui.getInv());
players.add(event.getPlayer().getUniqueId());
}
}
@EventHandler
public void OnInventoryClose(InventoryCloseEvent e){
players.remove(e.getPlayer().getUniqueId());
}
}

smoky anchor
#

My guess is that the client will forcibly close any gui if the player is in a portal.

worthy yarrow
knotty totem
quaint mantle
sullen marlin
upper hazel
sullen marlin
#

yes

knotty meteor
#

Does someone know the unicode of this?
I want to put it in a message in my plugin if there isnt any player nearby
But i cant find it anywhere

#

Nvm finally found it 🎉

slender elbow
#

x

rough drift
lost matrix
#

y

rough drift
lost matrix
#

Probably a y with a shifted and scaled \

rough drift
#

lol

restive ledge
#

How can I run some code every game tick?

lost matrix
#

?scheduling

undone axleBOT
sand spire
rough drift
#

brother in christ 😭

use a 3-dimensional for loop to iterate over every block from start to end of the bounding box and get all the blocks in there

#

use a set because you'll get dups

#

go at 0.49 block increments to make sure you get all of the blocks

lost matrix
#

You can surely write this without getting dupes

remote swallow
#

Player#getBoundingBox

rough drift
#

maybe

sand spire
remote swallow
#

kek

lost matrix
#
  public List<Block> getIntersectingBlocks(Player player) {
    World world = player.getWorld();
    BoundingBox box = player.getBoundingBox();
    int minX = (int) Math.floor(box.getMinX());
    int minY = (int) Math.floor(box.getMinY());
    int minZ = (int) Math.floor(box.getMinZ());
    int maxX = (int) Math.ceil(box.getMaxX());
    int maxY = (int) Math.ceil(box.getMaxY());
    int maxZ = (int) Math.ceil(box.getMaxZ());
    List<Block> blocks = new ArrayList<>();
    for (int x = minX; x < maxX; x++) {
      for (int y = minY; y < maxY; y++) {
        for (int z = minZ; z < maxZ; z++) {
          blocks.add(world.getBlockAt(x, y, z));
        }
      }
    }
    return blocks;
  }

Try this. Didnt test.

sand spire
#

1s

sand spire
lost matrix
sand spire
#

way better than my 106 lines..

tender shard
#

in 1.20.5: NMS' ItemStack#save(...) method now requires a HolderLookup.Provider as parameter instead of a CompoundTag - does anyone know how to acquire one?

young knoll
#

Uhh

#

My guess is something to do with registries

tender shard
#

yeah I've been searching but couldn't find anything yet lol

buoyant jasper
#

I have problem do you know why i cant do commands
when i type /kill sd
it shows
An internal error occured while attempting to tab-complete

blazing ocean
#

?stacktrace

undone axleBOT
lost matrix
buoyant jasper
#

how to fix

lost matrix
#

Fix the error

buoyant jasper
#

how do i find the error

smoky anchor
#

Is there any error in the server console ?

buoyant jasper
#

this is in console

smoky anchor
#

Update/Remove Essentials

lilac zenith
#

Hi! I have a 1.19.4 server with ViaVersion to allow players from newer versions to connect. As I have a RPG server, I require a texture pack to be sent to players on join (I sent it with Player#setResourcePack(url, hash, force)). The issue arises when a 1.20.4 player joins into the server, for some reason, if they join with the "Server Resource Pack" option set to "Prompt", the resource pack is sent correctly and they can apply it by accepting it, however, if they join with the option set to "Enabled", they don't recieve texture pack requests. This is strange as this doesn't happen with 1.19.4 players.

Does someone know why could this happen? Could this be a ViaVersion problem, or a 1.20 client problem?

#

My plugin is developed with the 1.19.4 API

#

Tested with 1.20.4 and 1.19.4 Vanilla (may also happen with 1.20-1.20.3 versions aswell)

slender elbow
#

generally "see how the game calls it" is a good approach when working with nms

tender shard
#

hm I don't find anything useful inside those two to get a Stream (or whatever) of RegistryLookup(s)

slender elbow
#

it returns a RegistryAccess.Frozen which extends RegistryAccess which extends HolderLookup.Provider, which is the parameter of ItemStack#save

tender shard
#

hm yeah thx but how am I supposed to get an ItemStack as CompoundTag? I mean sure, I can just throw the RegistryAccess into nms ItemStack#save, but - I just need it as compoundtag or sth else that I can easily turn into a String and load it back

slender elbow
#

it returns a Tag

tender shard
#

Damn i‘m blind. Thx

slender elbow
#

?learn-java

tender shard
#

btw is there now a way to make items glow without hacking custom enchantments into the registry? did I dream this, or did they add some dummy enchantment or sth like that?

#

(and without adding unbreaking + itemflag or other hacks ofc)

slender elbow
#

there is a data component for that, yeah

#

enchantment_glint or w/e

#

/give has cool autocompletions now for the component names

tender shard
#

thanks!

#

last question: There used to be (NMS) ItemStack.of(CompoundTag), any replacement for that? The method is now gone completely

slender elbow
#

enchantment_glint_override

tender shard
slender elbow
#

prolly have to deserialize the Tag into its (Patched?)DataComponentMap

#

codec zzz

tender shard
#

:<

#

hm guess I'll just switch to JsonConfigurationSerialization for this

#

then it won't match the "vanilla builtin snbt" but at least it's working

slender elbow
#

aren't there api methods for snbt?

#

or, well, not snbt anymore :^) given that the output/input of those are now component strings

tender shard
#

I'm currently stuck here

    @Override
    public String itemStackToJson(@NotNull final org.bukkit.inventory.ItemStack itemStack) {
        ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
        RegistryAccess access = NMS.getServer().registryAccess();
        Tag tag = nmsItemStack.save(access);
        return tag.getAsString();
    }

    @Override
    public org.bukkit.inventory.ItemStack itemStackFromJson(@NotNull String json) throws Exception {
        final CompoundTag compoundTag = TagParser.parseTag(json);
        final ItemStack nmsItemStack = // ?;
        return CraftItemStack.asBukkitCopy(nmsItemStack);
    }

I know that ItemMeta.getAsString() exists but it returns sth else than the compoundTag.getAsString() and I need to parse the result of that

slender elbow
#

you'd do the reverse of ItemStack#save, so something like ItemStack.CODEC.decode(...)

tender shard
#

yeah I thought that too but no clue how to turn the CompoundTag into thise Dynamic thingy

slender elbow
#

whatever #save does but the other way around

#

ItemStack.CODEC.decode(provider.createSerializationContext(NbtOps.INSTANCE), tag).getOrThrow()

tender shard
#

ah, NbtOps.INSTANCE

#

that's a good hint

slender elbow
#

the registry thing is probably important :d

tender shard
#

oh man it does work fine... except that the serialized and deserialized items are not equal lmao

[16:02:44] [Server thread/ERROR]: Itemstacks are not equal:

ItemStack{WOODEN_SWORD x 2, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"","extra":[{"text":"JeffLib NMSTest Item","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"red","bold":false}]}, PublicBukkitValues={
    "jefflib-nmstest-plugin:prevent-stacking": "c4094d98-7efb-42e3-a41e-03648ee0633b"
}}}

vs

ItemStack{WOODEN_SWORD x 2, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"","extra":[{"text":"JeffLib NMSTest Item","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"red","bold":false}]}, PublicBukkitValues={
    "jefflib-nmstest-plugin:prevent-stacking": "c4094d98-7efb-42e3-a41e-03648ee0633b"
}, custom=H4sIAAAAAAAA/wXBQQ7CIBAF0FmaLnsGE1eTUCG1dekJXLkH/DQjlDQyeH7fG4gGGp89FImPnrPoy5eOdqLLBykVCVz3pmjKR+mb1PvxxQ9VuamPWepG5+jM6t7rwjekwO4Ky95NYGNntwBmtjYQ/QG4oqUjagAAAA==}}

It adds the stupid "custom=..." part when deserializing it

#

the output of itemStackToJson is {components:{"minecraft:custom_data":{PublicBukkitValues:{"jefflib-nmstest-plugin:prevent-stacking":"c4094d98-7efb-42e3-a41e-03648ee0633b"}},"minecraft:custom_name":'{"extra":[{"bold":false,"color":"red","italic":false,"obfuscated":false,"strikethrough":false,"text":"JeffLib NMSTest Item","underlined":false}],"text":""}'},count:2,id:"minecraft:wooden_sword"}

lost matrix
#

"prevent-stacking" is for test purposes only i suppose ^^

tender shard
#

the whole itemstack is for testing

#

I know that I can prevent stacking with 1.20.5, but that's not my issue

lost matrix
#

A bit more colors and a white background and your IDE looks like eclipse

tender shard
#

I wonder where that "custom..." part is coming from - is that from bukkit/craftbukkit or from NMS itself?

lost matrix
slender elbow
#

the custom_data data component? or what?

tender shard
#

I gotta go to the store now, when I come back I'll check whether the NMS itemstacks are equal (so ignoring CraftItemStack.asBukkitCopy)

slender elbow
#

that is where vanilla now stores "unknown" data as straight up nbt

#

and is where the pdc is stored

#

that is 100% intentional

tender shard
#

but the again-serialized deserialized data is exactly the same as the original serialized, except with the appended custom part

#

so I wonder what that "custom, unknown data" is supposed to be

lost matrix
tender shard
#

shouldn't the "custom" part either be included in the original ItemStack.toString(), or not show up in both?

#

the NMS itemstacks seem to be equal, seems to only happen after calling CraftItemStack.asBukkitCopy

#
[16:13:18] [Server thread/INFO]: {components:{"minecraft:custom_data":{PublicBukkitValues:{"jefflib-nmstest-plugin:prevent-stacking":"6bfb6302-c3f9-4f25-aab5-04923057b5a5"}},"minecraft:custom_name":'{"extra":[{"bold":false,"color":"red","italic":false,"obfuscated":false,"strikethrough":false,"text":"JeffLib NMSTest Item","underlined":false}],"text":""}'},count:2,id:"minecraft:wooden_sword"}
[16:13:18] [Server thread/INFO]: {components:{"minecraft:custom_data":{PublicBukkitValues:{"jefflib-nmstest-plugin:prevent-stacking":"6bfb6302-c3f9-4f25-aab5-04923057b5a5"}},"minecraft:custom_name":'{"extra":[{"bold":false,"color":"red","italic":false,"obfuscated":false,"strikethrough":false,"text":"JeffLib NMSTest Item","underlined":false}],"text":""}'},count:2,id:"minecraft:wooden_sword"}

NMS itemstacks / compound tags are the same (first line is serialized item (itemstack -> compound tag -> getAsString), second line is turning it back into a compound tag, then itemstack, then compound tag -> getAsString again), so it must be sth wrong in CraftItemStack.asBukkitCopy

slender elbow
#

are you toString'ing the bukkit IS?

#

but if it contains any other non-pdc data it will be stored there

eternal night
inland nova
#

I found this plugin
https://github.com/bartenbach/FoundDiamonds

It works on 1.20.4 but I need to figure out how to modify it to work with deepslate diamond ore.

When I try to add deepslate_diamond_ore to the config nothing happens

The repo is pretty old so I doubt the original creator is going to be adding said functionality anytime soon

GitHub

🔷 Ore announcer, rewards, and anti X-ray. Contribute to bartenbach/FoundDiamonds development by creating an account on GitHub.

slender elbow
#

friendlybaron used to make minecraft plugins?

#

what

inland nova
#

I guess so

#

long long time ago

#

I would mod it myself but idk anything about making or editing plugins haha

lost matrix
inland nova
#

nope

#

it just works for regular diamond ore

#

and that's it

lost matrix
#

You need to get one of those two messages when you enable the plugin.

#

Check which one it is

icy beacon
#

Maybe compiling it with a bumped spigot version would work? It's coded against 1.13.2. Though if you're running a proper version then the implementation of Material should work properly... Idrk I'd compile against 1.20.4 or whatever you're using and see then

inland nova
lost matrix
#

In your console or log file

inland nova
#

this is all I get

#

should I mine an ore and see what it says then?

icy beacon
chrome ferry
#

im assuming there is not a way to check of AttemptTameEvent?

quaint mantle
inland nova
#

this is when I mine regular diamond ore

#

deepslate shows nothing in console

icy beacon
#

is that a thing?

chrome ferry
#

no

icy beacon
#

Then just check PlayerInteractEvent with necessary conditions

chrome ferry
#

fair enough

quaint mantle
icy beacon
#

Oh yes

#

This ^

#

Mb

lost matrix
chrome ferry
#

hmm is there a website full of tamable entites and their required items?

inland nova
lost matrix
#

In that case you might want to look for a newer version of this

icy beacon
inland nova
chrome ferry
inland nova
#

do I just copy that line of text and replace DIAMOND_ORE with DEEPSLATE_DIAMOND_ORE
and rebuild it?

chrome ferry
#

might want to check for ||

inland nova
#

I just need to edit the plugin I already have and add deepslate functionality

lost matrix
#

As far as i can tell, the plugin should work with deepslate ores if you just throw them in the config

inland nova
#

I did that

#

still doesn't work

#

I assume because it was built with a version of spigot where deepslate wasn't even a concept yet

chrome ferry
#

how do i set the owner of an ocelot

chrome ferry
icy beacon
quaint mantle
chrome ferry
chrome beacon
shadow night
chrome beacon
#

not having it's api version set

slender elbow
#

ocelots cannot be tamed

#

cats can

chrome ferry
#

oh

#

i thought they could

#

ok

slender elbow
#

that used to be the case like 7 years ago

chrome beacon
#

^^

chrome ferry
#

ah

#

i dont play mc much

#

lol

slender elbow
#

until they added cats as a separate entity, they spawn in villages now and those can be tamed

young knoll
#

And now ocelots do… nothing

icy beacon
#

yall remember the release of 1.13 it was wild

young knoll
#

Poor things got done dirty

chrome ferry
icy beacon
young knoll
#

#JusticeForOcelots

lost matrix
inland nova
#

the problem is there is no deepslate

#

when I add deepslate

#

nothing happens

#

I'm assuming the plugin doesn't know what deepslate diamond ore even is

slender elbow
#

pretty sure legacy plugins can't get new materials from valueOf etc

#

only the LEGACY_* ones

quaint mantle
slender elbow
#

because

inland nova
#

this is frustrating qwq

chrome ferry
#

easy fix

young knoll
#

Dis why you add api version

icy beacon
chrome ferry
#

no

#

just add api-version to plugin.yml

inland nova
icy beacon
#

Or that yes

#

That can be done without even recompiling

chrome ferry
#

open .jar

icy beacon
#

Just dig into the jar file and change its plugin.yml

icy beacon
lost matrix
icy beacon
shadow night
quaint mantle
#

Or change spigot src to auto-detect api version 😈

young knoll
#

tf is a SensibleTrapBlock

inland nova
#

where would I put API version

#

and what version do I put XD

icy beacon
#

Anywhere without indentation

#

I think api-version: 1.13 should be fine

#

Put it at the 8th line

inland nova
#

ok done

#

adding it to server now

#

lets see what breaks

icy beacon
quaint mantle
#

It does, setting upper version is usually because you are using API which was added after 1.13

lost matrix
quaint mantle
#

For legacy material support is just fine

icy beacon
#

Pro-tip: don't download .jar files from strangers, unless they're smile or optic

trail coral
#

how do NBTTAGS work in 1.16.5+? like changing armorToughness for an armor piece etc

young knoll
#

Same way they work before afaik

#

But we have api for that

trail coral
young knoll
#

yes? lol

inland nova
trail coral
#

what

#

i didnt know

#

can you show me the api

young knoll
#

Items or entities?

lost matrix
trail coral
inland nova
#

I wonder what kind of world we would be in if API's weren't a thing

trail coral
lost matrix
young knoll
#

CTRL F "attribute"

trail coral
#

alright thanks man doing this really sucked in legacy versions

young knoll
#

Did we not have api for that in 1.12?

#

oof

trail coral
#

nope

#

had to use nms

young knoll
#

?1.12

#

Aww

lost matrix
inland nova
#

bruh
it still doesn't work
😭

young knoll
lost matrix
inland nova
lost matrix
#

Then its not in your config

#

Also the version is wrong

icy beacon
#

Please ensure the spelling: DEEPSLATE_DIAMOND_ORE

lost matrix
inland nova
#

I misspelled it

#

I went in and fixed it now it shows in console

#

lets see if it works in game

#

😄

#

tysm

chrome ferry
tender shard
inland nova
#

I wonder if it works for ancient debris as well

lost matrix
#

Works for every block in the game

inland nova
#

sick

#

thank you

icy beacon
inland nova
#

thanks

lost matrix
inland nova
#

we'll just forget the extra S

#

XD

icy beacon
#

xD

#

Actually this could be fixed quite quickly one sec

icy beacon
quaint mantle
#

can i change this property of an item on my plugin?

lost matrix
quaint mantle
lost matrix
#

idk what this is supposed to mean...

trim lake
#

I added some attribute to armor but it take a way default MC armor attribute is that intended? How can I prevent that?

peak depot
#

whats the best way of setting block in a bigger area at once?

#

like say a 50x50x25 area

young knoll
#

Material has a getDefaultAttributes method

trim lake
gloomy ocean
#

How do I give myself an amethyst shard with custom model data?

young knoll
#

Make itemstack
get meta
setCustomModelData
set meta
add item to player inventory

gloomy ocean
#

Andd

#

How do I do all that

#

😭

lost matrix
peak depot
#

ItemStack is = new ItemStack(Material.YOURMAT)

gloomy ocean
#

I don't code 😭

peak depot
#

first step

lost matrix
gloomy ocean
icy beacon
#

You maybe can, but that sounds like it's under #help-server 's jurisdiction

gloomy ocean
#

k

trim lake
valid burrow
#

I need a mysql pioneer to help me with this structure

#

anyone willing to sacrifice themselves

lost matrix
#

Serialize everything into a giant blob and have only two columns: Id and blob

peak depot
#

is there a god dam example of setting blocks with worldedit api (not 1.8)

peak depot
#

but where is setting blocks

lost matrix
#

Im not a search engine btw

peak depot
#

but hate to break it but that is not api thats general worldedit commands thats my problem

#

I was on that website to

lost matrix
peak depot
#

you send the link to the normal thing

#

also still it doesnt explain how to get a area xyz to x2, y2, z2 and set the block inside of there

lost matrix
#

I just skimmed the api right now. It has everything you need.
The selection is a Region on which you apply a single block pattern.

#

Let me see if i can write a simple example real quick...

trim lake
#

Why is this not working?

System.out.println("attributes: " + helmet.getType().getDefaultAttributeModifiers(EquipmentSlot.HEAD));
                AttributeModifier healthModifier = new AttributeModifier(MaskManager.HEALTH_ATTRIBUTE_UUID, "mask_health", effectValue*2, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HEAD);
                helmetMeta.addAttributeModifier(Attribute.GENERIC_MAX_HEALTH, healthModifier);
                helmet.setItemMeta(helmetMeta);
                System.out.println("attributes set: " + helmet.getItemMeta().getAttributeModifiers());
                ItemMeta meta = helmet.getItemMeta();
                helmet.getType().getDefaultAttributeModifiers(EquipmentSlot.HEAD).entries().forEach(entry -> meta.addAttributeModifier(entry.getKey(), entry.getValue()));
                helmet.setItemMeta(meta);
#

When I will not aply default attribues only my healthModifier it will not give armor to player only healths.

proper cosmos
#

PotionEffectType.HARM is actually strenght?

acoustic pendant
#

i think strenght is STRENGHT

proper cosmos
#

INCREASE_DAMAGE

lost matrix
# peak depot you send the link to the normal thing

There you go

  public void fillWithBlock(Location cornerA, Location cornerB, BlockData blockData) {
    World world = BukkitAdapter.adapt(cornerA.getWorld());
    BlockVector3 vecA = BlockVector3.at(cornerA.getX(), cornerA.getY(), cornerA.getZ());
    BlockVector3 vecB = BlockVector3.at(cornerB.getX(), cornerB.getY(), cornerB.getZ());
    Region region = new CuboidRegion(vecA, vecB);

    try (EditSession editSession = WorldEdit.getInstance().newEditSessionBuilder().world(world).maxBlocks(1000).build()) {
      try {
        editSession.setBlocks(region, BukkitAdapter.adapt(blockData));
      } catch (MaxChangedBlocksException e) {
        throw new RuntimeException(e);
      }
    }
  }

Let me know if this works

peak depot
acoustic pendant
lost matrix
lost matrix
dawn flower
#

can u make custom colored spawn eggs

proper cosmos
#

so ye

#

It's "outdated"

young knoll
#

Yeah we renammed constants recently

#

by that I mean 1.20.5

lost matrix
#

Doesnt sound recent to me. 1.20.5 has been out for a while.
ETA on 1.20.6 pls or riot

peak depot
dawn flower
acoustic pendant
worthy yarrow
dawn flower
#

goddamn it

worthy yarrow
#

yeahhhh

dawn flower
#

minecraft should make it colorable tbh

acoustic pendant
worthy yarrow
proper cosmos
lost matrix
# peak depot I want to fill a area (the players selected) with a random pattern of stone and ...

Ok this was a bit tricky to figure out. The documentation is kinda bad.

  public void fillWithBlock(Location cornerA, Location cornerB) {
    World world = BukkitAdapter.adapt(cornerA.getWorld());
    BlockVector3 vecA = BlockVector3.at(cornerA.getX(), cornerA.getY(), cornerA.getZ());
    BlockVector3 vecB = BlockVector3.at(cornerB.getX(), cornerB.getY(), cornerB.getZ());
    Region region = new CuboidRegion(vecA, vecB);

    RandomPattern randomPattern = new RandomPattern();
    Pattern coalOre = new TypeApplyingPattern(world, BukkitAdapter.adapt(Material.COAL_ORE.createBlockData()));
    Pattern stone = new TypeApplyingPattern(world, BukkitAdapter.adapt(Material.STONE.createBlockData()));
    randomPattern.add(coalOre, 0.5);
    randomPattern.add(stone, 0.5);

    try (EditSession editSession = WorldEdit.getInstance().newEditSession(world)) {
      try {
        editSession.setBlocks(region, randomPattern);
      } catch (MaxChangedBlocksException e) {
        throw new RuntimeException(e);
      }
    }
  }

I just eyeballed this one. Tell me if it works.

icy beacon
#

Would it be a good decision to only support the latest Spigot version for a plugin?

#

Would I be losing a lot of users?

worthy yarrow
#

define latest

#

1.20+?

icy beacon
#

Latest stable release

#

1.20.5

worthy yarrow
#

no

icy beacon
#

No to which question

worthy yarrow
#

Should probably run backwards compat up to like 1.14 imo

lost matrix
peak depot
icy beacon
#

There are two

icy beacon
worthy yarrow
icy beacon
#

I'm currently supporting 1.19+ and I'm seeing that in perspective, my plugin will be working much better and with cleaner code if I support the current latest version (1.20.5 only)

#

And given that API changes are always happening it's sometimes painful to support non-latest versions

lost matrix
#

I think there are a few dividing points which had major API changes that are really just too useful to throw away.
So 1.8 - 1.12 | 1.13 - 1.16/17 | 1.17 - 1.20.4 | 1.20.5+
I would pick one of those regions for supporting a plugin

icy beacon
#

E.g. when they break up Material I'll probably drop the previous versions

worthy yarrow
#

Yeah but you know people and their "stuck with ancient concepts" ie: 1.8 pvp

icy beacon
#

But for this particular pluginn

#

1.20.5+ is just looking very bright

worthy yarrow
#

If it needs to be using the new stuff from 1.20.5 then sure

#

Otherwise just keep it pre 1.20.5 for now

icy beacon
#

It would be good to do that

slender elbow
worthy yarrow
#

And wait til we get even more api updates

#

1.20.5 - some version is gonna be a hotspot for plugin support thats for sure

icy beacon
#

And tbh I'm gonna spend like 2-3 more months working on this update anyway so maybe something else comes out in the meantime

#

So yeah I guess I'm switching to 1.20.5+

#

Ty 🙂

worthy yarrow
#

No worries

slender elbow
#

yeah it's pretty nifty

worthy yarrow
#

Would you guys be upset if I sent 4 clips

lost matrix
#

I never went too deep into worldedit bc i hate 3rd party plugins

lost matrix
icy beacon
#

Geez the BuildTools GUI takes its sweet time to load up

worthy yarrow
lost matrix
#

Im gonna walk by doggo now anyways. Do what you must.

lost matrix
#

SPAM! Ban this guy!

icy beacon
#

Not the embeds though that's a wall 💀

worthy yarrow
#

D:

icy beacon
worthy yarrow
icy beacon
#

Remove the embeds though 🙏

worthy yarrow
#

Show me how D:

icy beacon
#

There... should be an "X"?

lost matrix
#

I like them. Summer is a bit barren tho

worthy yarrow
#

breh you want people to just click on links

worthy yarrow
#

fine

worthy yarrow
# lost matrix I like them. Summer is a bit barren tho

They are all gonna have multiple visual effects, heavy season conditions / light, etc. summer is gonna be the most barren for visuals tbf, I planned on having some sort of like sweating and if you get hot enough sometimes you'll catch on fire, etc... but that's more to come when I get the temperature system written

#

Autumn particles are only spawned when you're under a tree as well

worthy yarrow
young knoll
#

Change biomes

#

It looks cool

native ruin
#

When in a runnable that ever 5 ticks I do Enitity.isOnGround()
I'm having the issue with dolphins flailing on the ground and keep jumping up and thus never meeting the condition

worthy yarrow
# young knoll It looks cool

Well I would but the server this is getting written for has custom biomes induced by a datapack so I'm not sure forcing biomes really helps in this case?

#

Also considering this, is there a way to give a sort of overcast / fog visual?

#

Without having to set the world to storming

young knoll
#

You can still mess with biomes

#

Packets

worthy yarrow
#

Can I like mask the biome as it were?

young knoll
#

?

worthy yarrow
worthy yarrow
vast thunder
#

Hi all! Please tell me how to make a fake online in the list of servers?

young knoll
#

I just inject custom biomes with whatever colors I want

#

And use those

worthy yarrow
young knoll
#

A bit of registry jank

#

kek

soft flame
#

@valid burrow lets move here

remote swallow
#

?paste the full class, removing any login info

undone axleBOT
soft flame
#

so should i just delete the line

remote swallow
#

no replace the string

soft flame
#

i mean, for the driver class name

#

he said it's deprecated

remote swallow
#

just show the whole class for now

soft flame
#

old junk from 2 years ago, i'm just coming back in spigot dev

remote swallow
#

?paste the error and the MySQL class

undone axleBOT
remote swallow
#

preferably on seperate pastes

soft flame
#

yes 2s

#

idk why but the paste tool didnt work for the class

remote swallow
#

this is being set as soon as you create the class which is happening before you init the connection

#

create the instance of mysql after you create the data source

soft flame
#

why was it working before then?

remote swallow
#

no idea

soft flame
#

ok i tried creating a new instance of mysql after the initConnection method is called

#

i still have the same error

#

perhaps i should just use something else than hikari for db queries xd

pliant topaz
#

Is it possible to get all the players who currently have a specific gui opened?

#

(instead of going over every player)

valid burrow
#

nope

#

you can cache it

pliant topaz
#

i'll try that, thx

umbral ridge
valid burrow
gilded nest
#

Hello, quick question. I´ve satarted developing a plugin on 1.20.5 with a very simple custom inventory that i think should work in any other version, but now im getting an error involving clientbound packets.
Exact Error: Internal Exception: io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:container_set_slot'
Is there a knonw fix for this or should I report it on the Bug Tracker?

young knoll
#

What is output of /version

gilded nest
#
[22:01:35] [Server thread/INFO]: This server is running CraftBukkit version 4096-Spigot-b698b49-8d3e67d (MC: 1.20.5) (Implementing API version 1.20.5-R0.1-SNAPSHOT)
[22:01:35] [Server thread/INFO]: Checking version, please wait...
[22:01:36] [Thread-8/INFO]: You are 11 version(s) behind
#

With that 11 posterior versions, I guess i should update to the most recent version right?

#

but its the same API version as the plugin

young knoll
#

yes

#

Doesn't matter, that's 11 version of bug fixes

gilded nest
#

how do I update the server? Reinstalling it entirely?

#

I´ve never done it before

blazing ocean
#

replace the jar

worthy yarrow
#

Oh coll you have put me down a rabbithole and I cannot climb out

blazing ocean
#

o.O

worthy yarrow
#

Packets are quite in depth D:

gilded nest
undone axleBOT
blazing ocean
#

you have to build it yourself due to copyright issues

gilded nest
#

so basiccally installing "another" server?

blazing ocean
#

wouldn't call it that

worthy yarrow
#

It's more like

blazing ocean
#

just remove the old jar and add the new one

worthy yarrow
#

the backend of the server ig?

blazing ocean
#

i would call it

#

UPDATING

worthy yarrow
#

I thought he meant like the server jar

blazing ocean
#

yeah

young knoll
worthy yarrow
#

That's what I am using

blazing ocean
#

packetevents my beloved ❤️

gilded nest
blazing ocean
#

love you retro

blazing ocean
gilded nest
#

ok

worthy yarrow
#

that's exactly what it's doing

#

So is it a bad thing to make a packetcontainer method for each of my seasons, and call those methods anytime needed to manipulate the terrain / environment?

public static void modifyBiomeColors(){
        ProtocolManager manager = ProtocolLibrary.getProtocolManager();
        manager.addPacketListener(
                new PacketAdapter(seasons, PacketType.Play.Server.MAP_CHUNK) {
                    @Override
                    public void onPacketSending(PacketEvent event) {
                        event.setCancelled(true);
                        SeasonsList.Seasons currentSeason = SeasonsManager.getInstance().getCurrentSeason();
                        Player player = event.getPlayer();
                        switch (currentSeason){
                            case SPRING:
                                manager.sendServerPacket(player, springPacket(player));
                                break;
                            case SUMMER:
                                manager.sendServerPacket(player, summerPacket(player));
                                break;
                            case AUTUMN:
                                manager.sendServerPacket(player, autumnPacket(player));
                                break;
                            case WINTER:
                                manager.sendServerPacket(player, winterPacket(player));
                                break;
                        }

                    }
                }
        );
    }```
young knoll
#

Depends what it does

upper hazel
#

would there be more benefits to moving all the data logic into annotations instead of objects and classes?

#

like spring

worthy yarrow
# young knoll Depends what it does

For winter/autumn, it's going to send fake blocks to better visualize that it's winter / autumn. ie: Winter = snowy blocks, leaves with snow, etc : autumn = multiple colors for tree leaves, better particle visuals (if it's possible to make something better than cherry leaves anyway)

#

I haven't thought of much other effects other than perhaps an overcast or fog of sorts

polar forge
#

Hey guys

#

Why does it expect a “;”

#

If I already wrote a bracket

#

And, the s stands for string

#

I followed a tutorial

#

What’s the problem with this

tender shard
#

you forgot the variable name

polar forge
#

Where

tender shard
#
for(String NAME : ... )

you're missing the NAME

#

in your case, probably "s" (bad name, btw)

polar forge
#

Oh

tender shard
#

should rather call it "key"

polar forge
#

And with the ;?

#

What’s the problem with that

tender shard
#

that should be fixed once you change String : homeConfig... to String s : homeConfig...

#

the error message is just confusing

chrome beacon
#

Yeah it's getting confused because the syntax is wrong

polar forge
#

Ok I repaired it and as u said it automatically corrected itself

#

Thx <33

#

Another problem tho

#

What’s the problem with this? I think it’s maybe I didn’t register the class in the main class?

#

It’s this the issue?

tender shard
#

No, you didnt implement onCommand method

worthy yarrow
#

Just hover over it and it should give you an option to implement the missing method

tender shard
#

Hover over the class name and click on „implement methods“

chrome beacon
#

They did a typo

#

OnCommand instead of onCommand

polar forge
worthy yarrow
#

o

polar forge
#

Oh lmao

#

True

worthy yarrow
#

lowercase the O in on

chrome beacon
#

Line 20 looking at your error message

tender shard
chrome beacon
#

You should read those

#

Quite useful

polar forge
#

Thx guys <333

tender shard
#

Did you rename your existing method or click on „implement methods“ though?

polar forge
#

I just corrected the typo and every error disappeared

tender shard
#

Yeah so you renamed the method

#

Good, that’s the correct solution

peak depot
#

how can I get the actuall name of an Item with the translateKey?

young knoll
#

You need to send it to the client

#

I don't think the server has any language files

echo basalt
#

You can get default stuff

#

I'd still just use translatable components

#

like everywhere

young knoll
#

Oh

#

How do you get the default (I assume english)

echo basalt
#

I mean

#

Some people edit their .jsons

#

Just have a builtin en_us.json

young knoll
#

True

#

Set up a server with all the vanilla lang files

#

Kek

echo basalt
#

they're annoying as hell to get

young knoll
#

Hence the server

#

You think Mojang would come after ya for rehosting lang files?

vast ledge
#

Yea probably

slender elbow
#

i mean, it is their assets :p

#

however

#

they are on crowdin

young knoll
#

Does the client ship with them all

#

Or grab them on demand

echo basalt
#

It's a mix

#

You need to open a big ass .json that tells you where things are at

#

And then you open up the file in winrar

autumn cave
#

What is the purpose of the HumanEntity class? Is a HumanEntity always a Player? I see that the Player is supposedly the only implemented HumanEntity class/interface. Can I suppose HumanEntity is always a Player or not?

vast ledge
#

An NPC can also be a Human entity

autumn cave
#

What is an 'NPC'? A fake player, like in the Citizens plugin?

vast ledge
#
Represents a human entity, such as an NPC or a player
young knoll
#

In the current context of the game

autumn cave
#

I know. But what is an 'NPC'?

young knoll
#

A HumanEntity is always a player

vast ledge
#

non**

autumn cave
young knoll
#

It exists because Mojang has an equivalent class

vast ledge
young knoll
#

iirc HumanEntity is equal to Mojang's Player while Player is equal to ServerPlayer

vast ledge
#

Yea

#

Spigot Player = Bukkit Server Player
Human Entity = Mojang Player

vast ledge
soft spire
#

How can I "get" a chest to which a sign is attached?

vast ledge
#

Ehh

#

A bit more?

young knoll
#

Get which face the sign is attached to and then offset by that

vast ledge
#

Info

#

Do you just want to go through the world looking for chests with signs?

sullen marlin
#

sounds like a lonely journey

vast ledge
#

Yea

#

and a laggy one

sullen marlin
#

steve wandering the world just looking for signs

#

is it a sign? is it a chest? is it a chest with a sign?

vast ledge
#

They should add a Chest Sign

young knoll
#

Signcraft

vast ledge
#

Just like the chest boat

#

built in sign

young knoll
#

What about a sign boat

vast ledge
#

Im just imagining a massive sign post on the back of a boat rn

sullen marlin
#

someone hire this man

vast ledge
#

Somebody should add a method to serialize the Inventory :-:

young knoll
#

You can

vast ledge
#

I commiting arson

young knoll
#

BukkitObjectInput/OutputStream

sullen marlin
#

why do people use that method

#

/ class

vast ledge
sullen marlin
#

it's literally just a worse version of everything

young knoll
#

What else am I gonna use :c

vast ledge
# vast ledge

It looks fine in chat, but in the actual file, it just dies :(

sullen marlin
young knoll
#

lol

#

I use it for actual binary

vast ledge
#

But most people dont

#

I could turn the entire text into a garbeled mess

sullen marlin
vast ledge
#

Yea but thats breaking for sum reason

umbral ridge
sullen marlin
#

your serialise method should be Map<String, Object>

#

then just let bukkit handle it

vast ledge
#

I need to know where in the inventory the item was tho

young knoll
#

Could add that to the map

vast ledge
#

Thats why i had <Object, Integer>

young knoll
#

Why not store it in the String Object map

vast ledge
#

wdym?

young knoll
#

Items serialize into a Map<String, Object>

#

You can add the slot to said map

vast ledge
#

Map<String, Integer>

#

Why not use that

sullen marlin
#

backwards at the very least

vast ledge
#

I mean..

#

That is true

young knoll
#

That should work

vast ledge
#

Thats the Function

#

Thats the log

#

And thats the death

sullen marlin
#

import java.util.LinkedHashMap;
import java.util.Map;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;

public class InvTest implements ConfigurationSerializable
{

    private final ItemStack[] inventory;

    public InvTest(Inventory inventory)
    {
        this.inventory = inventory.getContents();
    }

    public InvTest(Map<String, Object> obj)
    {
        this.inventory = new ItemStack[ (Integer) obj.get( "size" ) ];

        Map<String, Object> items = (Map) obj.get( "items" );

        for ( Map.Entry<String, Object> item : items.entrySet() )
        {
            inventory[Integer.parseInt( item.getKey() )] = (ItemStack) item.getValue();
        }
    }

    @Override
    public Map<String, Object> serialize()
    {
        Map<String, Object> result = new LinkedHashMap<>();

        Map<String, Object> items = new LinkedHashMap<>();
        for ( int i = 0; i < inventory.length; i++ )
        {
            ItemStack item = inventory[i];
            if ( item != null )
            {
                items.put( Integer.toString( i ), item );
            }
        }

        result.put( "size", inventory.length );
        result.put( "items", items );

        return result;
    }
}
#

untested and garbage

vast ledge
#

Whats the point of using a linked hash map against a normal hashmap?

young knoll
#

Maintains order

vast ledge
#

Good to know, does it have any down sides, like requiring more processing power?

sullen marlin
#

then you can do stuff like conf.set( "kit.items", invTest);

#

just make your whole Kit class ConfigurationSerializable really

worthy yarrow
#

https://paste.md-5.net/rucucanale.cs

Ok well here goes, my last 2 hours have just been fiddling with this packet manipulation class for autumn effects... am I on the right track or completely lost?

quiet ice
#

Furthermore it requires more memory to maintain, but that is the same problem worded differently

young knoll
#

What are these magical bytes you are adding for leaves

worthy yarrow
#

Supposed to be colors haha

#

I don't really understand how to manipulate these packets man

young knoll
#

That's...

#

Not how it works

worthy yarrow
#

I didn't think so

young knoll
#

Hang on let me do some digging

worthy yarrow
#

Ah I knew I was completely lost

young knoll
#

?paste

undone axleBOT
young knoll
#

This is my code for replacing biomes

soft spire
vast ledge
young knoll
vast ledge
#

just listen for the blockplace

#

or interact

worthy yarrow
young knoll
#

The wrapper stuff makes things much easier

soft spire
vast ledge
#

Bro

#

BlockPlaceEvent

#

Check if adjacent block is chest

young knoll
#

Since you don't have to deal with the encoding on the packet, PacketEvents takes care of that for you

vast ledge
#

No need to get agressive

soft spire
#

I was not being aggressive sir/ma'am

#

It was just a simple question

worthy yarrow
#

Live & learn D:

vast ledge
# soft spire It was just a simple question
@EventHandler
public void onBlockPlaceEvent(BlockPlaceEvent event){
  if(event.getBlock().getType() != Material.YOUR_SIGN) return;
  if(event.getClickedBlock().getType() != Material.YOUR_CHEST) return;
  Bukkit.getConsoleSender().sendMessage("Hooray, Ive just made a SignPlaceOnChestEvent")
}
stone bramble
#

been using the Minecraft Development plugin in IntelliJ and it's not updated to include 1.20.5 yet, and I know that it's out and ready to be used, could someone help me set up a project using it? I'm impatient and wanna mess around with the new features

vast ledge
#

Create Project on 1.120.4

#

1.20.4*

stone bramble
#

did that already

vast ledge
#

Are you on gradle or maven?

#

For maven, find your pom.xml
For gradle, find you build.gradle

stone bramble
#

ive changed the maven dependency to 1.20.5-R0.1-SNAPSHOT already but the new attributes arent showing up

vast ledge
#

or whatever you're using

stone bramble
#

usin maven

#

ty

vast ledge
#

Does it work?

stone bramble
#

yep

#

ty

worthy yarrow
young knoll
#

What version

worthy yarrow
#

Should I be using retrooper's?

rough ibex
#

You can use either, it is ultimately your choice

worthy yarrow
#

(I think, I cannot find it)

rough ibex
#

no idea then

young knoll
#

I did specifically say PacketEvents

#

So I was referring to PacketEvents

#

Protocollibs wrappers are old and minimal to begin with

worthy yarrow
quaint mantle
#

How do I get a pottioneffecttype in 1.20.5?

young knoll
#

Same way you did in 1.20.4

quaint mantle
#

?

#

valueOf doesn't work

#
 @Deprecated
    @Contract("null -> null")
    @Nullable
    public static PotionEffectType getByKey(@Nullable NamespacedKey key) {
        return key == null ? null : (PotionEffectType)Registry.EFFECT.get(key);
    }```
#

getByKey is deprecated

young knoll
#

It does but the names have been changed

remote swallow
#

registry

young knoll
#

So yeah use the registry

remote swallow
#

coll i got a drill today

young knoll
#

What’s that

#

Is that some C++ library

remote swallow
#

you dont know what a drill is

young knoll
#

Is that the icon

#

Python library?

remote swallow
#

no

#

thats the thing

slender elbow
young knoll
#

That doesn’t look like a library though

sullen marlin
#

I've got a Makita pew pew

remote swallow
#

black and decker

young knoll
#

Is that the actual name

remote swallow
#

it was the cheapest trustable brand

sullen marlin
#

The problem with drills is the drill bits

remote swallow
#

we got a 109 bit set too

sullen marlin
#

Like seriously all the drill bit at our big box hardware store are shit

remote swallow
#

one of these

sullen marlin
#

If you're just drilling wood they're probably ok

remote swallow
#

its got just about everything

sullen marlin
#

But anything else, good luck

worthy yarrow
young knoll
#

What if I have to drill through the fabric of space

remote swallow
#

tough

worthy yarrow
#

Then contact Elon or Nasa

#

That's above my paygrade sir

sullen marlin
#

Thanks for the tip

worthy yarrow
#

Lotta bits man

young knoll
#

Get pure titanium diamond tipped bits

worthy yarrow
#

$160 a bit

quaint mantle
#

How can I detect if server is running 1.20.5 or up?

#

Like, what's the correct way of doing it?

young knoll
#

Bukkit#getVersion was it

#

1 sec

#
public static String getServerVersion() {
        String version = Bukkit.getServer().getBukkitVersion();
        if (version.contains("-")) {
            return version.substring(0, version.indexOf('-'));
        }

        return version;
    }```
#

Tis what I use

undone axleBOT
stone bramble
#

what would be the best method of editing the same attribute modifier object in multiple modifier collections? would prefer to keep it to one loop

soft flame
worldly ingot
stone bramble
#

if i verify w forums can i send images here

#

cuz i have code that works for what i want it to do but its not ideal

lost matrix
young knoll
undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

slender elbow
#

pretty sure attribute modifiers are immutable

lost matrix
stone bramble
# lost matrix Question is a bit tricky. Generally if you edit an object, and it is part of mul...
        AttributeModifier a = new AttributeModifier("scalecmd", (scale-1) * -1, AttributeModifier.Operation.ADD_SCALAR);
        AttributeModifier aInvert = new AttributeModifier("scalecmd", (scale - 1) * -1, AttributeModifier.Operation.ADD_SCALAR);

        for(AttributeModifier i : Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_SCALE)).getModifiers()) {
            if (i.getName().equals("scalecmd")) {
                player.getAttribute(Attribute.GENERIC_SCALE).removeModifier(i);
                player.getAttribute(Attribute.GENERIC_JUMP_STRENGTH).removeModifier(i);
                player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).removeModifier(i);
                player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).removeModifier(i);
                player.getAttribute(Attribute.PLAYER_ENTITY_INTERACTION_RANGE).removeModifier(i);
                player.getAttribute(Attribute.GENERIC_STEP_HEIGHT).removeModifier(i);
                player.getAttribute(Attribute.GENERIC_SAFE_FALL_DISTANCE).removeModifier(i);
                break;
            }
        }
        for(AttributeModifier i : Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_FALL_DAMAGE_MULTIPLIER)).getModifiers()) {
            if (i.getName().equals("scalecmd")) {
                player.getAttribute(Attribute.GENERIC_FALL_DAMAGE_MULTIPLIER).removeModifier(i);
                break;
            }
        }

        player.getAttribute(Attribute.GENERIC_SCALE).addModifier(a);
        player.getAttribute(Attribute.GENERIC_JUMP_STRENGTH).addModifier(a);
        player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).addModifier(a);
        player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).addModifier(a);
        player.getAttribute(Attribute.PLAYER_ENTITY_INTERACTION_RANGE).addModifier(a);
        player.getAttribute(Attribute.GENERIC_STEP_HEIGHT).addModifier(a);
        player.getAttribute(Attribute.GENERIC_SAFE_FALL_DISTANCE).addModifier(a);
        player.getAttribute(Attribute.GENERIC_FALL_DAMAGE_MULTIPLIER).addModifier(aInvert);
    }```
soft flame
#

i just set it now, ill see if it works

stone bramble
#

i just noticed some errors oops

soft flame
stone bramble
#

i have tested it and that code does work for what i want it to do

#

but i feel like its not ideal

young knoll
#

You can loop over a set of attributes

#

Either the entire values array (I think it’s an enum?) or your own collection

lost matrix
#

I dont even understand the general logic of that code...

stone bramble
#

i am an idiot so it makes sense

#

i barely know java lol im making this for fun

young knoll
#

Looks like they want to remove the modifier from a bunch of attributes

#

And then add a new one

stone bramble
#

remove and replace ye

lost matrix
#

But they check for modifiers on one attribute, and then proceed to throw modifiers on unrelated attributes if the former contained a certain modifier...

stone bramble
#

if i can just edit the object across all the collections thatd be better

young knoll
#

I would just have a set of attributes you care about and then loop over that

young knoll
stone bramble
#

the attribute modifiers are all the exact same object with the same name

young knoll
#

Even if they do have a modifier with the same name and uuid, idk if they implement .equals

#

The ones you add are, but they won’t be the same object when you want to remove them later

stone bramble
#

yes, which is why i iterate through looking for the name i set, then take that object and remove it

#

when the for each hits the object with the "scalecmd" name it'll stop and delete the object from all the collections

young knoll
#

I guess they do have a proper .equals then

#

That’s good

stone bramble
#

lemme verify and send a screenshot for readability

lost matrix
#

I would create a Set of Attributes that are affected, then iterate over all of them, and simply remove then add the modifier to them.

  private static final Set<Attribute> SCALE_ATTRIBUTES = Set.of(
      Attribute.GENERIC_SCALE,
      Attribute.GENERIC_JUMP_STRENGTH,
      Attribute.GENERIC_MOVEMENT_SPEED,
      Attribute.PLAYER_BLOCK_INTERACTION_RANGE,
      Attribute.PLAYER_ENTITY_INTERACTION_RANGE,
      Attribute.GENERIC_STEP_HEIGHT,
      Attribute.GENERIC_SAFE_FALL_DISTANCE
  );

  private static final String SCALE_MOD_NAME = "scalecmd";

  public void changeScaleAttributes(Player player, double scale) {
    double scalar = (scale - 1) * -1;
    AttributeModifier.Operation operation = AttributeModifier.Operation.ADD_SCALAR;
    AttributeModifier mod = new AttributeModifier(SCALE_MOD_NAME, scalar, operation);
    SCALE_ATTRIBUTES.forEach(attribute -> {
      AttributeInstance instance = player.getAttribute(attribute);
      instance.removeModifier(mod);
      instance.addModifier(mod);
    });
  }

There is no real harm in simply calling removeModifier no matter what.

young knoll
#

You could create the instance outside the loop

#

But yeah

stone bramble
#

so basically this is just the same thing as what i did but rewritten to be less cluttered and awful?

lost matrix
#

Im still mad at the ADD_SCALAR name for this operation...

young knoll
#

Tbh I don’t remember what it does

#

I only know the other 2

lost matrix
#

ADD_NUMBER adds a number where ADD has an arithmetic meaning.
ADD_SCALAR multiplies a number where ADD has a semantic meaning.
Its confusing af

#

"Im adding this scalar to a matrix" technically makes sense, but 'add' doesnt mean '+' in that scenario.

young knoll
#

I just checked the wiki

#

Explanation there is better for my smooth brain :p

#

For every modifier, multiplies the current value of the attribute by (1 + x), where x is the amount of the particular modifier. Functions the same as Operation 1 if there is only a single modifier with operation 1 or 2. However, for multiple modifiers it multiplies the modifiers rather than adding them. For example, modifying an attribute with {Amount:2,Operation:2} and {Amount:4,Operation:2} with a Base of 3 results in 45 (3 * (1 + 2) * (1 + 4) = 45).

lost matrix
#

Send. My brain is smoother if this is a contest btw.

lost matrix
#

Not ADD_SCALAR

young knoll
#

Uhh

#

Idk the wiki calls it multiply

#

add, multiply, and multiply base

lost matrix