#help-development

1 messages · Page 756 of 1

quaint mantle
#

but java also supports vars

#

why not use them

#

it makes code cleaner

tall dragon
#

in your opinion

quaint mantle
#

and also using final should make JIT/GC an easier job

lost matrix
#

I disagree. Inferred types can be obstructive.

tall dragon
#

i like seeing the Type right away

quaint mantle
ivory sleet
#

var is inferred and written out during compilation

quaint mantle
#

so it doesnt really changes anything at the end right?

ivory sleet
#

Correct

#

I mean I know there is some magic around anonymous types

lost matrix
#

You cant use features of a specific IDE to argue for code quality

quaint mantle
#

and i think what i wrote looks better becuz everything is on the same line lol

ancient plank
#

Wat if youw coconspiwatow doesn't uwse intewwij doe

ivory sleet
#

Since
var x = new Object(){
Object y;
};

x.y is valid here

quaint mantle
#

yep

lost matrix
quaint mantle
#

and you can clearly see the type

#

which is object lol

lost matrix
#

Ah wait, its adelemphii...

quaint mantle
#

also what the hell is this syntax

lost matrix
#

🐦

young knoll
#

banned

ancient plank
#

It's mwy hawwoween costume

quaint mantle
#

you can do this???

ancient plank
#

myews

lost matrix
ivory sleet
#

var allows
intersection types
variable types
anonymous types

lost matrix
#

Look how var confused you there

ivory sleet
#

But rejects null types

quaint mantle
lost matrix
#

This guy is trolling

ivory sleet
#

lol well I guess you could say that

quaint mantle
#

i mean they do something like this

#

but i never knew you can use var like this 😭

lost matrix
#

In js nothing matters and everything is an illusion.
They dont do anything.

ivory sleet
#

I use it in multithreading all the time to control weak, soft and phantom references mostly else there is little reason to use (unless you want like an effectively final variable)

quaint mantle
#

thats cool

#

i dont really do multi threading however i seen horrors of low level multi threading in rust

#

except throwing Stream.parallelStream

ivory sleet
#

yeah, well java is kinda nice at it, but once you wanna optimize things to get a higher throughput it becomes a mess

kindred sentinel
#

how to require permissions for commands? Is there any guide?

young knoll
#

Easiest way is to give them a permission in your plugin.yml

lost matrix
quaint mantle
#

weak means that the value stops existing after becoming null i think

primal ermine
#

hi, I've asked earlier about custom heads in 1.20.2, as base64 method seems to no longer work. Now I'm using setOwnerProfile, but it's not loading any textures - I'm seeing only cached heads from earlier versions, other players see all heads as steve/alex. Am I doing something wrong? :?

kindred sentinel
lost matrix
young knoll
kindred sentinel
young knoll
#

yes there

kindred sentinel
#

Ohh

#

sorry

lost matrix
kindred sentinel
#

i got it

young knoll
#

permission: plugin.fart

kindred sentinel
#

yeaaah i understood sorry

quaint mantle
#

im not an onion

lost matrix
ivory sleet
#

let’s say you wanna avoid ReentrantLock or synchronized (since they’re by implementation equivalent almost, except ReentrantLock has fairness and is a bit more object oriented) then the other option is to go with StampedLock, and perhaps use optimistic locking for reads as an example, this is much more bug prone and needs a lot more testing, let’s say you wanna go without locking, yet you don’t wanna use volatile since it enforces cache flushes and memory order effects that greatly impact performance, that your only option is VarHandle, where you use weaker types of memory ordering effects, but at the cost of being much more bug prone

lost matrix
#

I was just asking bc i would rather use an atomic ref than sharing objects through an array or anonymous object

ivory sleet
#

Problem with atomic ref is that it uses volatile

ivory sleet
#

And volatile enforces cache/registry flushes

#

And it enforces memory order effects by the semantics of volatile

quaint mantle
#

too many magic words

lost matrix
#

Doesnt it prevent caching in the first place?

ivory sleet
#

Ugh, well sorta, it makes sure the value is always up-to-date

#

Because of the aforementioned 2 things it guarantees

lost matrix
#

Well, ok you loose some CPU optimizations either way.
There should be something cooler for creating a shared scope other than anonymous classes tho...

ivory sleet
#

so doing a compare and swap implementation becomes possible with it (assuming you wanna update a variable based on its previous value concurrently)

ivory sleet
#

I mean we had MutableObject from apache

#

But apache is gone now right?

lost matrix
#

i think so

ivory sleet
#

Anyway for a spigot plugin, one can prob use volatile just fine lol

lost matrix
#

In spigot anything goes. lol

#

Reminds me to read a few of the newly released plugins again 🙂

lost matrix
primal ermine
lost matrix
#

Just sort by submission date, look for one without a picture and you often get a bonus read if they use a foreign language.
Preferably with an angry one start review.

quaint mantle
#

huh

lost matrix
young knoll
#

I think they are using it

lost matrix
#

No idea what he means by base64

young knoll
#

base64 of the url

lost matrix
#

Well its just this weird nbt string {{"textures": { "url" : "some urls" ... or whatever.
No need for that

young knoll
#

It's http://textures.minecraft.net/texture/<base64>

#

wolf head

lost matrix
#

This... is the ID of the texture. What should be base64 encoded in this URL?

young knoll
#

It is base64

lost matrix
#

Alright. Whats encoded there.

young knoll
#

Ah wait no, the entire url can be base64 encoded

#

Which looks like this

#

eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjhkNDA4ODQyZTc2YTVhNDU0ZGMxYzdlOWFjNWMxYThhYzNmNGFkMzRkNjk3M2I1Mjc1NDkxZGZmOGM1YzI1MSJ9fX0=

lost matrix
#

The base64 String which are usually shared look like this decoded:

{"textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/ef13b7b3d50e072c5d1b3c5121ea2e59e21fddfa5386cc0cf6ee131983a25e45"}}}
young knoll
#

yeah

#

Sorry the url part is just an id

lost matrix
#

All good

primal ermine
#

Ok, so with a bit modified code to get it as itemstack instead of block, it's still showing me only cached skins :/

    public ItemStack generateSkullWithURLTexture(String URLTexture) {
        ItemStack item = new ItemStack(Material.PLAYER_HEAD);
        SkullMeta skull = (SkullMeta) item.getItemMeta();
        PlayerProfile owningProfile = Bukkit.createPlayerProfile(UUID.randomUUID());
        URL yourSkinUrl = null;
        try {
            yourSkinUrl = new URL("http://textures.minecraft.net/texture/" + URLTexture);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        PlayerTextures textures = owningProfile.getTextures();
        textures.setSkin(yourSkinUrl);
        owningProfile.setTextures(textures);
        skull.setOwnerProfile(owningProfile);
        item.setItemMeta(skull);
        return item;
    }```
desert tinsel
#
@EventHandler
    public void onEntityDamage(EntityDamageByEntityEvent event) {
        if (event.getDamager() instanceof Player && event.getEntity() instanceof LivingEntity) {
            Player player = (Player) event.getDamager();
            LivingEntity entity = (LivingEntity) event.getEntity;
            if (event.getCause() == EntityDamageEvent.DamageCause.PROJECTILE) {
                //do things
            }
        }
    }``` is this gonna work to see when a player shoots someone?
young knoll
#

No

#

The damager will be an arrow

#

The shoort of said arrow will be the player

desert tinsel
#

then how should I do it?

young knoll
#

Check if damager instanceof Arrow

#

Check if arrow shooter instanceof Player

desert tinsel
#
@EventHandler
    public void onEntityDamage(EntityDamageByEntityEvent event) {
        if (event.getDamager() instanceof Arrow a && event.getEntity() instanceof LivingEntity && a.getShooter() instanceof Player player) {
            Entity entity = event.getEntity();
            if (event.getCause() == EntityDamageEvent.DamageCause.PROJECTILE) {
                //do things
            }
        }
    }``` so I dont need event.getCause then?
young knoll
#

Don't think so

desert tinsel
#

thx

lost matrix
# desert tinsel ```java @EventHandler public void onEntityDamage(EntityDamageByEntityEvent e...

This would be the naive approach

  @EventHandler
  public void onDamage(EntityDamageByEntityEvent event) {
    Entity defender = event.getEntity();
    Entity attacker = event.getDamager();

    Player defendingPlayer;
    Player attackingPlayer;
    
    if(!(defender instanceof Player)) {
      return;
    }
    
    defendingPlayer = (Player) defender;
    
    if(attacker instanceof Projectile projectile) {
      ProjectileSource source = projectile.getShooter();
      if(!(source instanceof Player)) {
        return;
      }
      attackingPlayer = (Player) source;
    } else if(attacker instanceof Player) {
      attackingPlayer = (Player) attacker;
    } else {
      return;
    }
    
    attackingPlayer.sendMessage("You attacked " + defendingPlayer.getName());
    defendingPlayer.sendMessage("You got attacked by " + attackingPlayer.getName());
  }
young knoll
#

I just assumed they only cared about arrows and not melee

keen star
#

hey i am using nms on minecraft 1.20.1 with spigot using mojang-remapped maven but i only can use it in my server using SpecialSource and that make the shaded with remapped special jar so how can i make plugin can be shaded with dependcies and remapped by SpecialSource?

kind hatch
#

Make sure you include the maven plugin that md provided so that the mappings can be turned back into the obfuscated values once compiled.

lost matrix
#

*If you use the SpecialSources plugin

keen star
lost matrix
kind hatch
#

Make sure you include the plugin. https://paste.md-5.net/uleqazexug.xml
Replace the values with the mc version you are using. Then just clean package. It should produce a jar file that the server can use.

river oracle
#

opening a lectern UI is so weird

#

though this could be useful

young knoll
#

why is there such a delay

river oracle
#

its my test command

keen star
young knoll
#

Ah okay

river oracle
#

I put the open in a 2 second runnable delay

young knoll
#

I was worried the code was actually that slow :p

river oracle
#

lol That'd be scary

desert tinsel
#

and just defending entities, not players

river oracle
#

lol

keen star
#

wait

#

thenLater

#

non need runnable?

young knoll
#

That probably is a runnable

lilac dagger
#

it's not an actual method

keen star
#

ohhh

river oracle
#
    public static void thenLater(Runnable runnable, long multiplier) {
        Bukkit.getScheduler().runTaskLater(instance, runnable, 20L * multiplier);
    }```
young knoll
#

Just a custom static method they made

keen star
#

i suck ,sorry

young knoll
#

Yeah

river oracle
#

Coll this new Container API is awesome

#

creating InventoryViews and not having to open them is lit asf

young knoll
#

So it's like virtual entities

#

But now it's virtual inventory views

#

kek

river oracle
#

kind of but you can view the containers

#

also Virtual Containers are non functional

#

because Containers themselves don't tick

young knoll
#

ah

#

Virtual entities also don't tick :p

river oracle
#

e.g. things that aren't possible are working furnaces, brewing etc

#

because that would require a block in the world to tick

young knoll
#

Yeah

#

Or manually ticking the ui somehow

#

Wait, could I make a furance ui and tick it via a scheduler

#

Or is that not possible

river oracle
#

essentially you'd need to create its tile entity

#

then tick it manually

young knoll
#

ah

lilac dagger
#

wait, does this mean that Bukkit#createInventory ticks?

river oracle
#

Bukkit#createInventory doesn't work for furnaces

#

the furnaces don't work

#

it does create a FurnaceInventory though

#

I tested it, I mean I haven't changed that API and the furnaces don't work

keen star
#

and use 1 glass_pane to make like how long it burn

young knoll
#

Yeah you can do that

#

You could make an actual furnace UI work with some NMS

river oracle
young knoll
#

^

river oracle
#

something like that just isn't ideal for actual API though

lilac dagger
#

oh so the containers actually tick but not bound to world

river oracle
#

the container is simply what it looks like

young knoll
#

and if you have one that isn't bound to a tile entity

lilac dagger
#

hmm

young knoll
#

It no tick

lilac dagger
#

so doesn't that mean both container and createinventory are the same then?

river oracle
#

createInventory is ambiguous for what is and isn't a container

#

it is a meshing of Inventories and Containers and it should be phased out

#

lets think of an example. For example AnvilInventory
CraftAnvilInventory actually has ContainerAnvil as a parameter. Which is a no no, because Inventories shouldn't have a clue about the data the Container has. Think of a Container as what happens when you're viewing the Inventory. The Inventory is as simple as the contents the Container has

uncut needle
#

Is there a way to check if a instanced class had run a function and then run a function in the class where it was instanced?

twin venture
#

Hello , anyone good with gson , json?
i have a bit of a problem , so each time i add something new to the plugin inside the settings.json , i must delete the version on the server and let it recreate the new one , how i can make it so it auto-update?

hushed spindle
#

go through the jar's settings json and add to the file what the jar has and it doesnt

twin venture
#

iam doing something like this to load it

hushed spindle
#

you can get one of your jar's files with


InputStream defaultStream = plugin.getClass().getResourceAsStream("/settings.json");
twin venture
chrome beacon
#

so uh why json

#

and not yaml for config

river oracle
#

json is just better

#

shhh

ancient plank
#

youw awe a wiar

lilac dagger
#

json is better in some cases only imo

twin venture
#

i just liked the design of the file that's all

river oracle
#

in most cases :3

twin venture
#

that's why i went with json

lost matrix
#

json is better at storing data and yml is better for configuration files imo

ancient plank
#

Ya

young knoll
#

Use NBT files for data storage!

#

:p

lost matrix
#

You mean mojang-json

young knoll
#

It's a binary format

#

So no

#

SNBT would be mojang-json

remote swallow
#

ur a snbt

lost matrix
#

myeah

#

^ what he said

sterile breach
#

hello, with protocolelib, PacketType.Play.Server.TAB_COMPLETE also works for PlayerCommandSendEvent?

twin venture
#

uhh , so what i can do i liked the converstion you guys did but i still don't know what to do?

chrome beacon
lost matrix
#

With Gson you can just merge

#

No checking needed

chrome beacon
#

No need to write to the file if there are no changes

mortal hare
#

yay my script finally decodes something into readable form, now what's left is to handle tcp exceptions

hazy parrot
#

is that powershell script

mortal hare
#

yes

hazy parrot
mortal hare
#

i've made a cmdlet for powershell to get the minecraft server status

#

i was forced to do it in powershell dont blame me

chrome beacon
#

What IDE is that

mortal hare
#

Powershell ISE

#

its built into windows

chrome beacon
#

ah

eternal night
kindred sentinel
#

i understood

#

sorry

sweet flax
#

?nms

sweet flax
#

what was that page where u can see difference between spigot and mojang mappings after using mapper

young knoll
#

?mappings

undone axleBOT
quaint mantle
lilac dagger
#

it's not that bad for users but still

#

yaml is king

quaint mantle
#

yaml is worse

#

it looks worse

#

it has less stuff

eternal night
#

toml screeching in confusion when you ask for that nested block

lilac dagger
#

i never felt like yaml was missing anything really

eternal night
#

I love 0 visual feedback of data relation in my config lang

quaint mantle
#

thats why just use native solutions is better

#

use .properties

eternal night
#

invent your own format is actually king

river oracle
#

I invented my own format for lang files

#

its cursed

eternal night
#

I'd say I am surprised but like

#

not really

river oracle
#
command.no.permission=%red%You do not have permission to execute this command
command.player.required=&red&You must be a player sender to execute this command
command.no.group=&red&You are not in a group that can be valued please join one in order to calculate worth
scan.current=&red&You are already scanning you must wait until your current scan finished until you scan again
scan.start.self=&gold&Started a scan this could take a while
scan.start.all=&red&The server has begun recalculating all town values, you won't be-able to calculate your worth until this has finished
scan.complete.self=&green&Finished scanning your group, your worth is now {worth}
scan.complete.other=&green&Finished scanning {group} their worth is now {worth}
menu.top.title=[Group Top](dark_gray)
menu.top.background.name=
menu.top.skulls.filled.name=[{group}](gold !italic)
menu.top.skulls.filled.lore=[Worth: {worth}](green !italic)
menu.top.skulls.empty.name=[Not Filled](red !italic)
menu.overview.title=[Group Worth Overview](dark_gray)
menu.overview.background.name=
blocks.iron_block.name=[Iron Block](white !italic)
blocks.iron_block.lore=<[Amount: {amount}](!italic)><[Total Value: {value}](!italic)>
blocks.gold_block.name=[Gold Block](yellow !italic)
blocks.gold_block.lore=<[Amount: {amount}](!italic)><[Total Value: {value}](!italic)>
blocks.diamond_block.name=[Diamond Block](aqua !italic)
blocks.diamond_block.lore=<[Amount: {amount}](!italic)><[Total Value: {value}](!italic)>
blocks.emerald_block.name=[Emerald Block](green !italic)
blocks.emerald_block.lore=<[Amount: {amount}](!italic)<[Total Value: {value}](!italic)>
blocks.spawner_pig.name=[Pig Spawner](light_purple !italic)
blocks.spawner_pig.lore=<[Amount: {amount}](!italic)><[Total Value: {value}](!italic)>
blocks.spawner_blaze.name=[Blaze Spawner](gold !italic)
blocks.spawner_blaze.lore=<[Amount: {amount}](!italic)><[Total Value: {value}](!italic)>
shadow night
#

I use json for everything and everywhere

icy beacon
#

Json is super convenient and human readable

#

I agree

river oracle
#

:basically lol

#

sept hte lists are <item1><item2>

#

I'm too lazy to include proper lists into my parser

twin venture
#

hi , so after further reaserch about the topic , i couldn't find any links or anythink that can help me out with it [auto set missing values in old json file!]

#

i only found yaml , and that would not help .

hazy parrot
#

iterate through new json object entries and !if oldJson has propertyName add property

#

idk if there is anything built in into gson

kindred sentinel
#

How to check if player is in the group of luckperms?

twin venture
hazy parrot
#

that whole instanceof and cast is redudant i think

#

also i assume you never saved new json object into file ?

twin venture
#

i dont think so , this is how its loading :

worldly ingot
# twin venture

Oh how nice switch expression pattern matching would be here LewCry

switch (defaultValue) {
    case JsonElement element -> data.add(fieldName, element);
    case String string -> data.addProperty(fieldName, string);
    case Number number -> data.addProperty(fieldName, number);
    case Boolean value -> data.addProperty(fieldName, value);
    default -> throw new UnsupportedOperationException("Unexpected value type.");
}```
#

We love J21

twin venture
#

is that in java 21 xD?

worldly ingot
#

Sorry. Fantasizing. Ignore me lol

#

Yeah

twin venture
#

well is it backwards complatable?

worldly ingot
#

No :p 21+

twin venture
#

😦

quaint mantle
river oracle
#

maybe next update they wil

quaint mantle
#

i mean, i enforce on users to use java 21 :p

#

if they use my shit

worldly ingot
#

Seems like an annoying hurdle for some

twin venture
#

what i can do in my use case?

quaint mantle
#

also if you are running server at least know how to install java right?

river oracle
#

I use same java MC requires

#

no more no less

#

if a plugin required me to change java versions I'd just throw it to the road its not worth the seconds to switch my sdk

river oracle
#

I use sdk man IK

#

its just not worth my time

quaint mantle
#

then why r u using sdk if you dont want to switch tools, thats the whole point of sdkman

sick edge
#

Hi, I have an Inventory of Type Crafting but for some reason I cant use the recipe book (when clicking the recipes are not shown)
but for example with my Furnace inventory it works...
Any ideas?

eternal oxide
#

I only go back as far as java 10 now

quaint mantle
#

and all the plugins will work with java 21

kind hatch
#

Java 10?

quaint mantle
#

no one uses java 10 nor java 9

twin venture
#

soo , any idea on how i can fix it ,-,

kind hatch
#

People still use that?

quaint mantle
#

idk

eternal oxide
#

well 11 really, but will work on 10

twin venture
quaint mantle
#

java 8 shouldnt be used

river oracle
quaint mantle
#

WorkBench

sick edge
#

But the book still doenst work

quaint mantle
#

minecraft refers to it crafting tho

#

not workbench

river oracle
#

what are you doing with teh bgook

river oracle
sick edge
#

I just want something so people can look up recipes but in the inventory when clicking on the book and then on a recipe the recipe doesnt show up

river oracle
twin venture
#

still struggling ..

dry patrol
#

Hi guys, do any of you know how I can get around this accepting only Bukkkit ChatColor? Or does anyone know another way to change the color from player name to RGB colors? 😄 admin.setColor(ChatColor.of("#634125"));

eternal night
#

spam ping choco to bring component support into the rest of the API

#

until then, well

#

there is spigot's RGB syntax, which is great for bleaching your eyes out

#

§x§6§3§4§1§2§5

dry patrol
#

How do I apply this then with setColor? 😮

eternal night
#

Well

#

ehm

#

oh shit is this teams KEKW

dry patrol
#

😐

eternal night
#

so teams don't support anything but the inbuilt colours iirc

#

so that method actually makes sense KEKW

dry patrol
#

hm okay 🥲

eternal night
#

idk if the team prefix still bleeds over

#

you might be able to use that

river oracle
#

guys don't get rid of legacy it still makes sense

#

I hate the enchantment table

        this.creator.put(MenuType.ENCHANTMENT, custom((i, playerinventory) -> new TileInventory((syncId, pi, entityhuman) -> construct(ContainerAnvil::new).apply(syncId, pi), IChatBaseComponent.empty())));
#

so much code just so it works

eternal night
river oracle
#

not that many exceptions with MenuType though surprisingly

eternal night
#

I am sure the PR graveyard will be happy uwu

river oracle
#

it will be

river oracle
#

and yk what I will merge with master every update :P

eternal night
#

KEKW Ping me once you open the PR, I am sure paper peeps are interested in it as well

river oracle
#

I did

#

already

#

its draft though

eternal night
#

oh

#

ping me when its ready obviously

river oracle
#

ahh okay

eternal night
#

draft PRs pft

#

who has the time

river oracle
#

tryna get feedback tbh

#

wanna make sure I'm not doing some fucked up shit without knowing

eternal night
#

I might give it a look tomorrow then

#

I got some time

river oracle
#

trying to fix teh AnvilInventory

#

almost killed me

eternal night
#

Yeaaa

river oracle
#

i did it

#

but it hurt

#

and its not good

eternal night
#

o:O

river oracle
#

lets just say

#

lazily updating the container

#

for all viewers

eternal night
river oracle
#

yeah not my proudest moment but the only other solution is to just

#

remove the other AnvilInventory and make a new one

#

Lets just say I prevented the same mistake with EnchantInventory luckily

young knoll
#

Paper tryin to steal our PRs again?

#

smh my head

river oracle
#

nah not getting this one I got it on lock

#

paper is going to do it better 😭 but its okay

#

I'm doing it for upstream

eternal night
#

We don't wanna steal the PR xD But with larger rewrites we obviously have an intrest that it lands well on upstream too

river oracle
#

nah guys this is a small PR don't worry

#

its like 1 class pretty much

eternal night
#

okay but that does look dope

#

Noice

#

(the general concept of it)

river oracle
#

yeah lots of stuff to iron out

#

maybe move around some things. The hardest part of this is to figure out Virtual Inventories

#

I didn't realize CraftBukkit had other API for seeing container data. too bad it is not very good. Just threw Deprecated tag on that

eternal night
#
- public abstract class InventoryView {
+ public interface InventoryView {
#

I wonder how many plugins are gonna get fucked

#

not your fault, they are not allowed to implement API types xD

#

but like

#

I am sure some fucker out there is

river oracle
#

I remember when I added a non default method to InventoryView we actually got a PR about it

#

that surprised me

#

like who TF extends InventoryView and why

eternal night
#

lmao

#

see

maiden thicket
#

whoever extends inventoryview is on the spectrum

#

🙏🏽

eternal night
#

whenever I have these questions of "who the fuck woul do something so increadibly hacky and dumb"

#

I generally ping @covert valve

maiden thicket
#

maybe above and beyond

covert valve
#

whats up lynx how can i curse things

eternal night
#

LMAO xD

maiden thicket
#

give us exploits

eternal night
#

can you come up with fun reasons on the spot to extend InventoryView

covert valve
#

no

river oracle
#

it'll be cursed

eternal night
#

okay nice

#

that is a good sign xD

#

if auxilior cannot come up with something cursed on the spot

covert valve
#

whenever I do weird things with the API its not for the sake of being cursed, it's to make things have a clean developer / user experienced

eternal night
#

das good

#

I saw this man extend Block

maiden thicket
#

💀

eternal night
#

so like, you know he is crazy

maiden thicket
#

me when i extend OfflinePlayer

covert valve
#

i've never extended block

eternal night
#

You implemented it KEKW

covert valve
#

i was considering extending block and then promptly realised it was a bad idea

eternal night
#

the consideration is enough

covert valve
#

yeah i threw that idea out of the window when i realized it wouldn't even work

eternal night
#

you will forever be my goto curse guy

covert valve
#

thanks lynx x

eternal night
river oracle
#

I accidently made a change to the ContainerSmithing patch now I can't undo it 😭

remote swallow
#

try harder

eternal night
#

skully btw I think Preconditions.checkNotNull was a trap

river oracle
#

wait wait I think i fixed it

#

lets go

eternal night
#

not too sure

#

but iirc it throw NPE

#

not IllegalArgument

#

which, kinda defeats the point

remote swallow
#

ill preconditions you

young knoll
#

I was told in the past to avoid it

#

so ¯_(ツ)_/¯

eternal night
river oracle
#

its annoying because checkArgument is longer

eternal night
river oracle
#

if I wanted to throw an NPE I'd use Objects#requireNonNull

young knoll
#

Pain

eternal night
#

tags exist ?

#

wtf is that

covert valve
#

a bunch of materials basically

young knoll
#

Tags only exist for some

#

Also

#

Tags are not static and can be fucked with

eternal night
#

the tags are backed by the internal registries KEKW

young knoll
#

mhm

#

Which can be modified by datapacks

#

Would it be stupid for a datapack to assign the wool tag to an egg? yes

eternal night
#

I mean yea but wouldn't you want to recognize datapack changed stuff

young knoll
#

Do I trust them, no

#

Ehh maybe

#

Okay that gets rid of 2/4 sets

#

yay...

eternal night
icy beacon
#

How can I iterate through every child node of a BasicConfigurationNode in Configurate ? I tried using node.childrenList() but that does not appear to be the correct solution. What I'm trying to accomplish:

{
  "messages": {
    "message1": "value",
    "message2": "value"
  }
}

I've got the messages node and I now want to iterate through every message and get both the key and the value of it. I'm using this code which, according to debug, does not iterate through anything (probably because I misunderstand childrenList):

  for (message in primaryNode.childrenList()) {
      // i debugged values of message.key() & message.string before I null-checked them and I got
      // nothing from that debug, so i'm sure that childrenList is just not what I'm looking for
      val termName = message.key()?.toString() ?: continue
      val termValue = message.string ?: continue
  }
#

Please please please ping me if you answer because I'm going to bed. Thx ^^

slender elbow
sterile breach
lost matrix
sterile breach
lost matrix
river oracle
#

you just need to resend the list

#

Player#updateCommands() should resent the command list

#

Update the list of commands sent to the client.

sterile breach
# lost matrix Are you sure that commands removed from the command list are still sent to the c...

yes i am not sur but I knwo that exist client to get plugin list without query /plugin command and here
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerCommandSendEvent.html
"Commands may be removed from display using this event, but implementations are not required to securely remove all traces of the command. If secure removal of commands is required, then the command should be assigned a permission which is not granted to the player."
I deduce that this is what provides the list of plugins but I am not sure

my questions Is what packet i have to listen? tab complete? (i am not sur)

lost matrix
orchid gazelle
#

hi, anybody of you guys knowing what Transformation I have to do to apply a constant velocity to my ItemDisplay?

#

I could do rotation, I do know how that works too, but I actually want it to move

lost matrix
#

Translation

#

A Transformation consist of

  • Rotation
  • Translation
  • Scale
orchid gazelle
#

I tried to just set the Translation to move it, but it is more of a teleportation and not moving

#

(I also set the Interpolation properly)

#
        ItemDisplay bulletDisplay = player.getWorld().spawn(projectionPoints.get(1), ItemDisplay.class);

        ItemStack is = new ItemStack(Material.ARROW, 1);
        ItemMeta meta = is.getItemMeta();
        meta.setCustomModelData(1);
        is.setItemMeta(meta);

        bulletDisplay.setItemStack(is);
        bulletDisplay.setInterpolationDelay(-1);
        bulletDisplay.setInterpolationDuration(40);

        Transformation transformation = bulletDisplay.getTransformation();
        transformation.getTranslation().x = 3;

            bulletDisplay.setTransformation(transformation);

This is my code, all that happens is it spawning 3 blocks more to the X

thin iris
#

im trying to set the meta's display name with components but it says it needs a string and not components, how can i fix this?

SPRAYCAN = new ItemStack(Material.IRON_HOE);
ItemMeta meta = SPRAYCAN.getItemMeta();
meta.setDisplayName(Component.text("Spraycan", NamedTextColor.GRAY, TextDecoration.BOLD));
young knoll
#

You don't

#

There is no API for that yet

#

And I don't think there is api to decompontify a component

carmine mica
young knoll
#

I'm surprised MD hasn't kicked you more

glad prawn
#

his bio say it all

orchid gazelle
#

isn't that literally normal bukkit api?

young knoll
#

No

#

We don't have api to set item naem with components

orchid gazelle
#

ahhh ok

young knoll
#

Choco PR is still open

#

Therefor spam @worldly ingot about it

#

kek

quiet ice
#

It sucks that adventure's bukkit bridge doesn't support that

young knoll
#

I just use the legacy serializer

quiet ice
#

But eh, that bridge is useless and I really wonder which moron decided it would be a great idea to work with it

orchid gazelle
quiet ice
#

To be honest that is true though

carmine mica
#

lol what? who is disrespectful?

orchid gazelle
quiet ice
#

Using bungee-chat isn't that much of a great idea, and if you stumble on one of it's shortfalls you should not be suprised

carmine mica
remote swallow
#

machine

#

why do you have 2 accounts here

carmine mica
#

?

#

is this the guy that is "impersonating" me?

remote swallow
carmine mica
#

yeah, idk who tf that is

#

y'all should ban them

#

cause they took a name close to my username and their nickname is my real name

#

and they didnt have a similar name pre-discord username change

remote swallow
#

@worldly ingot do the ban or something

ivory sleet
#

guys this is hardly the channel to discuss these matters

quiet ice
#

Which matters?

ivory sleet
#

you can dm me epic if u feel like a user is breaking a rule

orchid gazelle
#

why tf is Interpolation not working

#

you are fucking supposed to do it SLOWLY and not teleport yourself 3 blocks ahead

remote swallow
young knoll
#

Wait

#

How do you change a block type without resetting its data

quiet ice
#

That is an oddly specific question to which I wouldn't even know there is a clean answer. You could just get and set the NBT (however that works), but carrying it over directly may not be possible unless you preserve the tile entity along with it

young knoll
#

No no not the nbt data

#

spigot BlockData

#

Aka the states

quiet ice
#

So you mean like changing an oak to a spruce fence unsafely?

young knoll
#

Pretty much

young knoll
#

Probably resets the data

#

But we can try

quiet ice
#

?stash

undone axleBOT
young knoll
#

Yeah it does

carmine mica
#

the block type is part of the BlockState

#

nms BlockState has a final field for the blocktype. You'd have to copy stuff over

young knoll
#

I was expecting there to be something like BlockData#copyFrom(BlockData)

carmine mica
#

you can use the string methods to do that probably

orchid gazelle
#

Anybody having an idea why the Transformation is happening INSANTLY instead of slowly with 40 ticks?

        ItemDisplay bulletDisplay = player.getWorld().spawn(projectionPoints.get(1), ItemDisplay.class);

        ItemStack is = new ItemStack(Material.ARROW, 1);
        ItemMeta meta = is.getItemMeta();
        meta.setCustomModelData(1);
        is.setItemMeta(meta);

        bulletDisplay.setItemStack(is);
        bulletDisplay.setInterpolationDuration(40);
        bulletDisplay.setInterpolationDelay(-1);

        Transformation transformation = bulletDisplay.getTransformation();
        transformation.getTranslation().set(3, 1, 0);

            bulletDisplay.setTransformation(transformation);
young knoll
#

mmm I'll try the string methods

orchid gazelle
#

yes

quiet ice
#

Yeah then sorry I have no clue what this is.

orchid gazelle
#

where you cannot find a single dip-shit of documentation ANYWHERE

young knoll
#

Nope that doesn't work

#

.merge says no if they don't have the same type

quiet ice
#

Are you sure you can use -1 as a delay?

orchid gazelle
#

I tried all different amounts of delays lol

quiet ice
carmine mica
young knoll
#

Ah I see

#

Seems a bit annoying but yeah

quiet ice
#

You may want to set a teleport duration @orchid gazelle though idk if that really works

orchid gazelle
#

it's not a teleportation

#

it's a Translation

quiet ice
#

No, I mean teleport

orchid gazelle
#

what?

#

well I can try

quiet ice
#

You know, this is mojang code

orchid gazelle
#

oh lol

quiet ice
#

God knows if there is some dumb prerequisite you need to apply

orchid gazelle
#

I thought this was some Spigot stuff on Server-Side

quiet ice
#

Why would spigot integrate such a feature by default?

orchid gazelle
young knoll
#
    private BlockData changeType(Block from, Material to) {
        String data = from.getBlockData().getAsString(true);
        data = data.replace(from.getType().getKey().toString(), to.getKey().toString());
        return Bukkit.createBlockData(data);
    }
#

Janky hack mate

#

But it works

quiet ice
#

Yeah then I am out of ideas sadly

orchid gazelle
#

hmmm

timid hedge
#

How do i add reflections as a dependency to eclipse? i dont have a pom.xml and i cant find a jar download so i can add it as a lib

glad prawn
#

create a maven project guys?

timid hedge
#

Isnt there a jar download for it? i cant find anything and i just want to add it as a lib

young knoll
#

Reflections as in

timid hedge
#

But i am getting a error

young knoll
#

org.reflections:reflections?

ivory sleet
#

yea thats what they mean

quiet ice
young knoll
#

There's a jar here

quiet ice
young knoll
quiet ice
#

I really need to follow up on my resolver-as-a-service idea one day...

timid hedge
#

Does anyone know why Vector4f is giving a error?

orchid gazelle
quiet ice
#

Or was it JOML?

timid hedge
quiet ice
#

Yes. I really recommend you to not use Eclipse JDT as build tool though. The Maven integration is godsend already.

young knoll
orchid gazelle
#

wait that actually makes sense

#

gimme a sec

quiet ice
young knoll
#

Joml is part of spigot

lilac dagger
#

misread it

young knoll
#

Unless you are on old api

hushed spindle
#

how can i translate spigot blockdata to nms blockdata

quiet ice
#

Or they are not using the shaded jar...

hushed spindle
#

rather whats the best way because i assume just doing new BlockData() is not great

young knoll
#

getState -> cast to CraftBlockState -> getHandle

hushed spindle
#

oh you can just cast? cool

young knoll
#

Mhm

hushed spindle
#

epic thanks

orchid gazelle
#

YOU GENIUS I LOVE YOU COLL

#

YOU LEGEN D

#

COLL IS THE BEST

young knoll
#

So wait did it work or didn’t it

orchid gazelle
#

first it didn't work

#

you gotta set Transformation AND the Interpolation-Duration and Delay a tick later

#
        Bukkit.getScheduler().runTaskLater(LoopCityScript.plugin, new Runnable() {
            @Override
            public void run() {
                bulletDisplay.setInterpolationDuration(40);
                bulletDisplay.setInterpolationDelay(-1);

                Transformation transformation = bulletDisplay.getTransformation();
                transformation.getTranslation().set(3, 1, 0);

                bulletDisplay.setTransformation(transformation);

            }
        }, 1);

so it looks like this

young knoll
#

Yes that was what I meant :p

#

The game just skips interpolation if you change it on the same tick the entity is spawned

orchid gazelle
#

well but actually, that's pretty bad

#

because 50ms (=1 Tick) is literally the entire time the Displayentity will even exist

lost matrix
#

Have you tried setting the interpolation in the spawn callback?

young knoll
#

That’s what they did originally

orchid gazelle
#

yes

orchid gazelle
hushed spindle
#

ah no i should be more specific, im trying to get a tool's destroy speed on a specific material and not block and nms ItemStack requires a blockstate for that method. can i get a block state from a material?

lost matrix
young knoll
#

Ah they didn’t use the consumer at first mb

#

I doubt it changes anything but you could try it

hushed spindle
#

shouldnt the delay be positive

#

or 0

young knoll
#

0 is what I’ve used

#

Idk if -1 changes anything

orchid gazelle
#

Well I somehow need to set the Translation at the same tick...

young knoll
#

Did you try the callback

orchid gazelle
#

No what how?

hushed spindle
#

i gotta ask again because my first question was just wrong, but how can i get a blockstate from a material? or is there another way to get the destroy speed of a tool on a block material

#

wait you set the delay to -1 because you delayed this task by 1 and hoped this would schedule it back a tick?

#

you cant go back in time lol

young knoll
#

And then BlockData has createState

hushed spindle
#

it does not

orchid gazelle
young knoll
#

It does in the latest api

orchid gazelle
hushed spindle
#

well that complicates things

#

i need my stuff to work on 1.17+

young knoll
orchid gazelle
#

nope, doesn't work with Callback

hushed spindle
#

oh im dumb it literally has a getState() method

#

dont know how i missed that

young knoll
#

Wut

orchid gazelle
#

btw. 1 tick is NOT enough delay

#

it does not work with 1 tick

#

or?

young knoll
#

What?

orchid gazelle
#

you need 2 ticks min

sick edge
river oracle
#

are you using Bukkit#createInventory

sick edge
#

Yeah I was

river oracle
#

oh no

#

yeah no that's not a real workbench

sick edge
#

xD

#

But for furnace its ok?

river oracle
#

its literally just a chest inventory with 10 slots

river oracle
#

pretty sure that furnace doesn't work

sick edge
#

Ok but I dont need it to work only for the recipe book but thx I'll keep it in mind for the future

river oracle
#

oh wait I know why

#

okay its really weird are you ready for the reason

sick edge
#

ye

river oracle
#

okay basically in Minecraft their are things called MenuType's if you look at NMS you will know its pretty different from InventoryType. What Bukkit#createInventory does is attempt to just get you a MenuType (which is only how the container looks). It does this well, as you know. However, Some things bukkit calls an Inventory aren't really an inventory. For example the Workbench. It isn't actually an Inventory only a container. Under the hood the conversion map converterMap.put(InventoryType.FURNACE, new CraftTileInventoryConverter.Furnace()); creates a NMS inventory furnace so it has its recipe book properties. However, the workbench only creates a generic inventory with 10 slots

#

if you need the recipe book from a custom inventory you can do it but its wacky

#

you essentially need to create the Container from NMS and then grab the BukkitView

#

then you can open it for the player

young knoll
#

Is this why openWorkbench exists

river oracle
#

yes

sick edge
#

Ok I see thx for the good explanation 🙂
Probably the case because the furnace is also usable by multiple people and a storage option

river oracle
young knoll
#

Instead of just create inventory

sick edge
#

Glad i found it

river oracle
#

Inventories have Storage

#

but not every Container has an Inventory

river oracle
young knoll
#

I see

river oracle
#

what really needs to happen is InventoryType needs to go die in a pit

#

oh

#

sorry idk what happened my fingers just went out on their own

#

also another fun fact, not every container has a MenuType

#

for example the Horse and LLama chest, as well as the Player

quaint mantle
river oracle
#

are you shading some dependency you're not supposed bte shading

#

or

#

not shading a dependency you are supposed to be shading

quaint mantle
#

bstats?

#

but i added the class manually

river oracle
#

idk what that means

#

so that sounds scary

quaint mantle
#

what

river oracle
#

aare you compiling correctly?

quaint mantle
#

yes

lost matrix
#

You can just copy paste the bstats class into your plugin and create an instance. Shouldnt be an issue.
I would say you just recompile and try again

quaint mantle
#

i tried 4 other times

lost matrix
#

Alright. Open your compiled jar (its essentially just a zip file) and check if the class is there

#

lol/aabss/eventcore/commands/MainCommand

quaint mantle
#

yeah its there

lost matrix
#

Do you hava a static block in your class or eager initialized fields?

quaint mantle
#

in main command?

lost matrix
#

Yeah. Post the MainCommand here if you dont mind

#

?paste

undone axleBOT
quaint mantle
lost matrix
#

Ok i dont see an issue in that regard.
Mind showing your onEnable?

#

Do you use EventCore as a dependency in other projects which are also loaded?

quaint mantle
#

only skript

#

and papi

lost matrix
#

Hm. Could you post the exception in a readable format again?

quaint mantle
lost matrix
#

Update your paper version. They had a ton of problems with their new classloader in tha past few weeks.

quaint mantle
#

ok

lilac dagger
#

do they still have issues with plugin's jars being closed?

quaint mantle
#

also dk if it matters but im using api version 1.13

lost matrix
#

How do you compile. Show your pom pls.
This is really really unusual.

quaint mantle
#

i use gradle

lost matrix
#

Show your build file then i guess

quaint mantle
lost matrix
#

Why do you have SkriptLang as an implementation dependency? Doesnt Skript come with that?

quaint mantle
#

idk, thats what the tutorial said to do

quiet ice
#

It should be compileOnlyApi, if anything...

quaint mantle
#

o

lost matrix
#

I mean they dont use the shadow plugin so...

eternal night
#

they have spigot api as an implementation KEKW

river oracle
#

💀

eternal night
#

average skript moment

dry hazel
quaint mantle
#

so what do i do

quiet ice
dry hazel
#

the java plugin works just fine for most things

quiet ice
#

Most, but not all. As you evidently demonstrated

sterile token
#

May i ask here doughts about javascript? Or is only related to java and/or spigot

dry hazel
storm crystal
#

how does item syntax looks like in this case? as in, how I should write to give a specific item, amount with a specific name?

lost matrix
sterile token
storm crystal
#

cuz im a little confused by ItemStack data type

lost matrix
storm crystal
#

just an example would be enough ;<;

lost matrix
# storm crystal cuz im a little confused by ItemStack data type
    Material material = Material.DIAMOND;
    int stackSize = 32;
    ItemStack itemStack = new ItemStack(material, stackSize);
    ItemMeta meta = itemStack.getItemMeta();
    
    meta.setDisplayName("Some cool item name");
    meta.setLore(List.of(
        "Line no 1",
        "Line no 2",
        "etc"
    ));
    
    itemStack.setItemMeta(meta); // Dont forget to set the meta back on the ItemStack
    player.getInventory().addItem(itemStack);

Its essentially just this

storm crystal
#

one more problem

#

I defined "Object[][] dict = new Object[4][2];"

#

in onEnable

#

but I cant access it anywhere

young knoll
#

You can only access it inside onEnable

storm crystal
#

oh

young knoll
#

Because it’s a local variable

storm crystal
#

I didnt want to make it load everytime there is an event

#

that would be kinda meh

lost matrix
#

Uh oh... im seeing a certain command emerging

storm crystal
lost matrix
#

You didnt happen to learn the basics of java before jumping into spigot, did you?

storm crystal
#

I didnt but thats besides the point

lost matrix
#

I think that is the only point to be honest

#

bc an Object[][] should pretty much never occur when writing java.

storm crystal
#

happens lol

#

how else am I supposed to have different data types in array

lost matrix
#

Oh, you should absolutely never have different data types in an array

young knoll
#

Generally the answer to that is

#

Don’t

storm crystal
#

why am I getting this

#

I initialized them in switch cases

river oracle
#

You probably don't have e a default

lilac dagger
#

= null it

#

local variables must be explicit stated

lost matrix
# storm crystal why am I getting this

This means that there is a branch in which your variable has no value.
Make sure to add a default statement in your switch-case to cover
all occasions which are not covered otherwise.

storm crystal
#

its either 0 or 1

lost matrix
#

Show your code pls

river oracle
#

But what if it's not 0 or 1

lost matrix
#

?paste

undone axleBOT
storm crystal
lost matrix
#

You need a default statement there.
Even if it only throws a random exception.

river oracle
#

Just throw then

#

Since it'd be unexpected

lost matrix
#

The compiler cant ensure that the nextInt method only returns 0 or 1

chrome beacon
#

Uh don't detect items by their name

storm crystal
#

dont expect me to automatically know the best answer

lost matrix
#

Its fine for now. Just remember that there are better ways for the next plugin.

river oracle
#

?pdc is generally that way

chrome beacon
quaint mantle
chrome beacon
#

?paste

undone axleBOT
lost matrix
quaint mantle
#

ok 1 sec

lost matrix
#

How the hell did you manage to get upper case packages in your project?

tall saffron
#

Hi i havent touched making plugins in a while i was wondering how to save data of how many times a player entered and if it reaches a certain amount provided in the config do smth an set the value of how many times it entered to 0

lost matrix
quaint mantle
#

they are

#

i have no uppercase packages

tall saffron
lost matrix
quaint mantle
#

mine is showing the same tho

lost matrix
#

Wait nvm. The packages are upper case in actuality

chrome beacon
#

Old jar?

quaint mantle
#

no

#

i just built it

full gull
#

Hi, does anyone know what the initial velocity of an arrow fired at full charge is? I've been searching online for one of my projects but can't seem to find anything other than an experiment that a dude ran. No official sources

lost matrix
full gull
#

Tried but the program im working with is rly strange on my os version so it wont export properly and doesnt apply in game

lost matrix
tall saffron
#

how to save like how many times the player entered the server or how to get that info

#

if like i have that ik how to do the rest

storm crystal
#

well now I am constantly getting "default" item

#

but case code is running cuz server does print Dam 1 or Dam 0

young knoll
#

You need break; at the end of each case

lost matrix
storm crystal
#

wow

young knoll
#

Yay fall through

lost matrix
lost matrix
#

In case you wanna use files

young knoll
#

Or a database if you want to be real fancy

quaint mantle
tall saffron
tall saffron
storm crystal
#

for some reason

lost matrix
lost matrix
#

Remember my comment from 10min ago? 🙂

storm crystal
#

xd

tall saffron
#

Also idk why i imported my old plugin from github and it says it has errors in every code, i formated my pc and only installed intellij does someone know what i am missing?

lilac dagger
#

java

lost matrix
#

Add a jdk to your project

#

File > Project Structure > Something there

lilac dagger
#

or just click download

#

tho would be better if you set your own via path

lost matrix
#

Yeah there is a dw button there as well

storm crystal
lilac dagger
#

i have 3 javas in my path that i switch order as needed

young knoll
#

?pdc

storm crystal
#

pdc?

lost matrix
#

ItemStacks have a data container where you can store a bunch of hidden data and read later

tall saffron
#

Ohh thanks allot to both

storm crystal
lost matrix
#

Try to never repeat yourself. Group code into statements or methods.

storm crystal
solar mortar
#

hey, can someone help and view my code intelji

remote swallow
storm crystal
#

I dont get any of it

remote swallow
#

Instead of calling getpdc.set() every 4 lines make a method with either item stack or item meta as a param and do it there

storm crystal
#

and just check on event if item has this special tag

#

and then do code

#

otherwise just return

#

thats assuming I know how to work with databse

#

I dont

#

but I could learn it that way

young knoll
#

Pretty much

tall saffron
#

it says i need java 17-21 to run a spigot so i can make a local server it says i have java 8 where can i update

tall saffron
#

thx

young knoll
#

?java17

undone axleBOT
young knoll
#

Aye we do have it

warped basin
#

anyone know how I can disable AI for an entity without NMS? I figured I could just edit the NBT data but I've looked everywhere and couldn't figure it out. My best guess is that it has something to do with .setMetadata() but again I don't really know

young knoll
#

Or setNoAi

#

Depends if you still want them to have gravity and collision

warped basin
#

the Entity class doesn't have either of those

young knoll
#

No

#

You’ll need a LivingEntity

warped basin
#

I'm still pretty new to this stuff so this is the first time I've heard of that. thanks for pointing me in the right direction lol

young knoll
#

Ah actually

#

It’s setAi not setNoAi

#

setAi is on LivingEntity, setAware is on Mob

warped basin
#

gotcha

#

so what's the difference anyway? is LivingEntity just a more specific type that doesn't include stuff like item frames and falling sand?

#

actually that's probably exactly what it is lmao

young knoll
#

Yes

#

And mob is even more specific to stuff that has ai

thin iris
#

how does conversation factory work

#

i want to do somethinf where you click an item on a gui, it closes the gui, takes what you typed and then uses that later

young knoll
#

Yeah that’s doable

#

Create a conversation with a single input prompt and then add a cancellation listener that calls back to the gui

thin iris
#

i have no idea how to do that lol 😭

tall juniper
#

Anyone knows how can i saved the last conexion in specific world?

#

like, when i disconected in a specific place and i conected again, spawn in the same place

timber crescent
#

isnt there a better way to do this?

  public void putOrReplace(UUID uuid, CombatLogData data) {
        if (combatLogData.containsKey(uuid)) {
            combatLogData.replace(uuid, data);
        }else {
            combatLogData.put(uuid, data);
        }
    }```
ivory sleet
#

Yep

#

just put

timber crescent
#

and its gonna replace it?

ivory sleet
#

Yep

#

replace - puts value if key is present
put - puts value of key regardless

floral drum
# timber crescent and its gonna replace it?

Yeah you might be thinking of how arraylist's works, allowing duplicate keys/objects. With hashmaps, since the Key is encoded with the hashCode of the object, there is no duplicates possible. So, it would just overwrite the value with the new value.

timber crescent
#

ohhh that makes much more sense i never even knew that

ivory sleet
#

Well there are hash collisions at times, but that’s resolved with K#equals(obj) which is why you never wanna use hashCode() in an equals() implementation in principle

floral drum
#

Yeah good point to put out there

#

I love hashmaps

ivory sleet
#

They’re cool

timber crescent
#

also this, shouldnt i do Collections.singletonList?

    AbilityLog log = new AbilityLog(ability);

        if (!logs.containsKey(uuid)) {
            logs.put(uuid, Lists.newArrayList(log));
        }else {```
ivory sleet
#

Yes that’s fine

#

Or

#

Use an ArrayListMultimap

floral drum
#

yay

ivory sleet
#

computeIfAbsent is usually a very good one with these multi maps

floral drum
#

conclube you know what happened to imajin at all?

ivory sleet
#

Nope :\

floral drum
#

damn

timber crescent
#

uhhhh this is the entire method

public void addAbility(UUID uuid, Ability ability) {
        AbilityLog log = new AbilityLog(ability);

        if (!logs.containsKey(uuid)) {
            
            logs.put(uuid, Lists.newArrayList(log));
        }else {

            ArrayList<AbilityLog> cachedLogs = logs.get(uuid);

            if (cachedLogs.size() >= 5) {
                cachedLogs.remove(0);
            }

            cachedLogs.add(log);

            logs.replace(uuid, cachedLogs);
        }
    }```
ivory sleet
#

No1 does I think

floral drum
#

strange

thin iris
#

if i have one map with an image on it, how do i like spread that image onto a (number)x(number) block like a 5x5

wet breach
floral drum
river oracle
#

he deleted his discord too :(

floral drum
#

it's actually kinda sad how people can disappear like that...

#

without anyone here able to get to him

wet breach
#

and I don't recall them saying anything either

#

it was just after a bit of time people noticed they hadn't been around and they didn't even say bye 😦

umbral ridge
#

How do you get rid of this

#

What's it called?

worldly ingot
#

Code mining I believe

umbral ridge
#

mining? xD

wet breach
# umbral ridge

I don't remember the name you called this, where it kept tracked of usages through out your code

#

I do know its under code refactoring

umbral ridge
#

In Visual Studio it's code lens or something

wet breach
#

or the related

umbral ridge
#

but not in JetBrains

remote swallow
#

inlay hints iirc

worldly ingot
#

Preferences, Code Vision -> Show hints for:

umbral ridge
#

Of course .. Code Vision schnitzel

#

tY

remote swallow
#

idk why you want to disable it, their quite useful

umbral ridge
#

personal preference 🙂

worldly ingot
#

I find them rather annoying, personally. They push your lines down for no reason and make whitespace feel weird

umbral ridge
remote swallow
#

put them on the end then

umbral ridge
#

half of the class gets filled with "1 usage 20 usages 5 usage"

remote swallow
#

like i did

worldly ingot
#

If I want to know how often or where a method is used, I'll freaking search for them in the call hierarchy

umbral ridge
#

yes

#

yes

remote swallow
#

that takes like tripple the effort

worldly ingot
#

It's like 3 key presses D:

remote swallow
#

thats more than 0

worldly ingot
#

Alt + Shift + H in Eclipse is ez

floral drum
#

I'm pretty sure!

remote swallow
#

yup

#

look at this

#

doesnt clutter my whitespace, still shows me what i need to know

floral drum
#

gotta love prison mines plugins!

remote swallow
#

kek

umbral ridge
#

Looking good

#

mine plugin is actually in my todo list too

#

It's hard to do all plugins at once

#

got too many ideas

remote swallow
#

all the existing mine pluings are fucking horrible

#

catamines misses features, mrl is painful to use