#development

1 messages ยท Page 43 of 1

forest jay
#

nevermind, I found it

dusty frost
#

nice

stuck hearth
#

Me when I read documentation

forest jay
#

I had to use different documentation (ChatGPT)

#

How can I take the Kyori Component and make it a BaseComponent? (I need that for some book stuff I am doing)

dusty frost
#

im ngl i don't even know what a BaseComponent is lol

forest jay
#

Idk the difference, but it matters ig

dusty frost
#

in what scenario even is this lol

#

did you not just use like Component.text(), etc.

forest jay
#

um, its a little weird.

stuck hearth
#

Might be worth joining the kyori guild as well

dusky harness
#

BungeeComponentSerializer

#

you might need to shade it

forest jay
#

yeah, I found this: ```java
String legacyJson = LegacyComponentSerializer.legacySection().serialize(kyoriComponent);
BaseComponent[] spigotComponents = TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', legacyJson));

dusky harness
#

uhhhhhh

#

that'll remove all hover etc

dusty frost
#

yeah that just serializes it into legacy formatting and then back

dusky harness
#

smth like adventure-text-serializer-bungee

forest jay
#

oh wait no

#

captured wrong one

dusky harness
#

platform is for bungee plugins

forest jay
#

Worked like a charm ๐Ÿ™‚

dense drift
#

Fyi adventure has a page on their wiki about migration

wind tapir
#

Hello, I have a problem concerning Nametag edit API, I tried to edit the prefix with this
NametagEdit.getApi().setPrefix(player, prefix); but the nametag doesn't change, there is no error in the console btw, thanks for your help

atomic trail
#

Is it possible to have no identifier for a placeholder when creating an expansion?

#

Or well it is I just dont know how

broken elbow
#

why tho?

atomic trail
#

I just want the placeholder to be %title%, I mean I guess it could be %menu_title% or something, but now I just want to know how it's possible lol

dense drift
#

no it is not

atomic trail
#

Oh, but many plugins uses placeholders like just %player% etc?

#

I guess they just format those within the plugin without the API

dense drift
#

exactly

atomic trail
#

Ah alright

dense drift
#

you can simply use minimessage

atomic trail
#

Can minimessage also handle placeholders? Didn't know

dense drift
#

not in the same was as papi, but you can pass them to MiniMessage#deserialize

grand zodiac
minor summit
#

based

grand zodiac
#

anyone who stars the repo gets my everlasting servitude ๐Ÿ™

minor summit
#

done

grand zodiac
#

THANK YOU ๐Ÿ™๐Ÿ™๐Ÿ™

stuck hearth
#

How did you test it

grand zodiac
river solstice
grand zodiac
#

Uh

#

Uhhhhh

#

So I uhhh

#

Uhhhhhhhhhhhhhhhhhhhhhhhhh

#

According to my lawyer its confidential and I can't say due to NDA

forest jay
#

I am learning css, and I want a style to only apply if the element doesn't have an input child. I know the :not selector exists, but how can I use it to check if it doesnt have an input child?

dense drift
#

parent:not(:has(child)) according to the internet

honest spoke
#

Does anyone happen to know how I can pass the --imageName=xyz argument to a gradle task, from within a gradle task?

minor summit
#

i don't

honest spoke
#

Thanks Emily

minor summit
#

anytime

fading stag
# honest spoke Does anyone happen to know how I can pass the `--imageName=xyz` argument to a gr...

To pass the --imageName=xyz argument to a Gradle task from within a Gradle task, you can use the project.exec() method to execute a command-line process with the desired arguments.

Here's an example:

task myTask {
    doLast {
        def imageName = "xyz"
        project.exec {
            commandLine "gradle", "myOtherTask", "--imageName=${imageName}"
        }
    }
}

In this example, the myTask Gradle task uses the project.exec() method to execute the gradle command-line tool with the myOtherTask task and the --imageName=xyz argument.

You can modify this example to use your own task name and argument values as needed.

#

ChatGPT is still our friend

minor summit
#

bro

#

no

#

no

#

nonono that is fucking hideous

atomic trail
#

Is it possible to get an object from a string, so like I have the string sword and an itemstack called sword. Can I directly convert the string to the object or do I need to just check using if statements?

atomic trail
#

Yeah ig, but is it possible to do that? I've been wondering for a while lol

#

To do what I said

#

I know the map is ofc

#

So I can use "sword".getItemMeta() pretty much

#

If that makes any sense

pulsar ferry
#
val itemMap = mapOf("sword" to ItemStack(Material.DIAMOND_SWORD))

fun String.getItemMeta(): ItemMeta? = itemMap[this]?.itemMeta

"sword".getItemMeta()

:D

atomic trail
#

I don't really understand the code tbh lol

#

I understand the map part

#

But after that I dont

dusky harness
#

If you don't want to store a map

atomic trail
#

Hmm yeah it's because I'm storing them in config but I should probably just use the setItemStack function on config

#

And getItemStack ofc

#

Strings are just easier to customize

#

I'll just make a map lol, thank you

proud pebble
#

i have an enum of enchantID, a parameter of this enum is an enchant object, which has a parameter of enchantID, for some reason EnchantID is returning null even tho i specified the enchantID inside of the class in its constructor, any idea why?

#
JACK_HAMMER(new JackHammer(),21), //enum

public JackHammer() {
        super("Jackhammer", EnchantType.JACK_HAMMER, List.of("Has a chance to break an","entire layer of your mine"), 1000, CurrencyType.TOKENS,   true);
    }
dusky harness
#

An alternative is to put the Class as a parameter in the enum
Then initialize the classes in like onEnable to return them in a method

proud pebble
#

im assuming theres s reason that im not currently understanding as to why this is the case

dusky harness
#

U can try using intellij debugger but idk

#

I'd think it give some error though not null

#

ยฏ_(ใƒ„)_/ยฏ

minor summit
#

to create JACK_HAMMER, you first require an instance of JackHammer, so you go create it, but it asks for the JACK_HAMMER enum constant, which isn't yet created (it's in the process of being created), so it'll be null

limpid ravine
#

How i can check if item taked from creative inventory? (Api 7.2)

pulsar ferry
#

Api 7.2?

dusky harness
#

๐Ÿ’€

dense drift
limpid ravine
#

Api 7.2 is that bad compared to 8.0?

dense drift
#

Are you talking about sponge or what?

limpid ravine
#

I about sponge

dense drift
proud pebble
#

before i had a map of EnchantID,Enchant but that required me to make sure i always added each enchant to the map

#

like it worked

#

i just wanted something to make sure that EnchantID always linked to the Enchant object

#

which is how i came up with just having them in the EnchantID enum

dense drift
#

Perhaps you can have a lazy init (idk if it is the right therm) for EnchantmentEnum#enchantment on the getter

Enchantment getEnchantment() {
  if (this.enchantment == null) {
    this.enchantment = (get the value from somewhere);
  }
  
  return this.enchantment;
}```
feral raptor
#

what is the purpose of a combine function in a mutable reduction operation?

proud pebble
feral raptor
dense drift
#

d;jdk stream#collect

uneven lanternBOT
#
R collect(Supplier supplier, BiConsumer accumulator, BiConsumer combiner)```
Description:

Performs a mutable reduction operation on the elements of this stream. A mutable reduction is one in which the reduced value is a mutable result container, such as an ArrayList, and elements are incorporated by updating the state of the result rather than by replacing the result. This produces a result equivalent to: ```java
R result = supplier.get();
for (T element : this stream)
accumulator.accept(result, element);
return result;


Like [`reduce(Object, BinaryOperator)`](#reduce(T,java.util.function.BinaryOperator)), `collect` operations can be parallelized without requiring additional synchronization.

This is a [terminal operation](package-summary.html#StreamOps).
Returns:

the result of the reduction

Parameters:

supplier - a function that creates a new mutable result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time.
accumulator - an associative, non-interfering, stateless function that must fold an element into a result container.
combiner - an associative, non-interfering, stateless function that accepts two partial result containers and merges them, which must be compatible with the accumulator function. The combiner function must fold the elements from the second result container into the first result container.

feral raptor
#

yeah, I've read the javadocs -- I get how it works but I don't understand how the combiner param does anything beneficial

The equivalent code they provided can literally be done with just collect(supplier,biconsumer)

R result = supplier.get();
for (T element : this stream)
accumulator.accept(result, element);
return result;
dense drift
feral raptor
#

hmm..

#

but I mean, why couldn't I just "add the comma" during the initial accumulator expression?

#

collect.(StringBuilder::new, (a,b) -> a.append(",").append(b))

#

do you see what I'm saying?

dense drift
#

yeah

pulsar ferry
#

Why not collect(Collectors.joining(","))?

feral raptor
#

just learning how to use it first

dense drift
#

yeah tbh I don't understand kek

grand zodiac
dense drift
#

you are probably not meant to use it directly and instead use Collectors#something

dense drift
grand zodiac
#

Well curl is the way you access their API

icy shadow
#

not the curl string concatenation ๐Ÿ’€

#

thats not how it works

dense drift
#

they probably have an example with curl because it works anywhere (windows, linux, mac)

proud pebble
#

ive come up with some bandaid fix, added a Class<?> for EnchantID which uses Enchant.class then in the static block it then calls

for (EnchantType type : values()) {
  try {
      type.lunixEnchant = (LunixEnchant) type.lunixEnchantClass.getDeclaredConstructor().newInstance();
  } catch (Exception ignored) {
  }
}

should hopefully work, might not dont know

icy shadow
#

curl is just 1 interface for http requests, not one that's very suited for code

#

i also dont think that will work on a lot of windows systems lol

feral raptor
grand zodiac
feral raptor
#

I guess I'll just accept the redundancy and move on

dense drift
icy shadow
grand zodiac
grand zodiac
icy shadow
dense drift
grand zodiac
#

no I meant to reply to the "thats not how it works"

#

i run linux anyway so

#

i have no clue if itd run on windows or not

icy shadow
#

then im afraid thats not what "thats not how it works" means

grand zodiac
#

oh alrighty

#

sorry I imissunderstood

icy shadow
#

all g

proud pebble
icy shadow
#

but like me & gaby said already, curl is just http requests, there are better cleaner ways of doing http requests in java

#

and i think curl isnt installed by default on windows so yeah it probably wont work

grand zodiac
#

fair fair, I'll update it to use http requests later

icy shadow
#

ty

feral raptor
dense drift
#

bm do you know more about Stream#collect? I'm curious how it works but I don't really understand ๐Ÿ˜ต

icy shadow
#

yes

#

well

#

probably

dense drift
#
     *     R result = supplier.get();
     *     for (T element : this stream)
     *         accumulator.accept(result, element);
     *     return result;```
the jdk has this in the documentation, which is straight forward, but the way the combiner works is not clear
icy shadow
#

the combiner is for when you have a parallel stream

feral raptor
#

^

dense drift
#

is it? think

icy shadow
#

yes

dense drift
#

it makes sense though, because of the addAll

icy shadow
#

lets say you have a very big parallel stream. rather than doing the collecting sequentially you can break the stream into "chunks", collect each chunk, then combine the results using the combiner function

feral raptor
#

Ahh I see..

#

thanks

icy shadow
#

np

grand zodiac
icy shadow
#

um

dense drift
#

no

#

I don't think many of us have such kinks

icy shadow
#

im not really sure what a user of this plugin would want lol

#

yeah lmao

grand zodiac
#

its for the funny

#

i swear

dense drift
#

the more damage you take, the higher the shock is idk

icy shadow
#

B.A.A.S - Too many caps!
No need to shout.
Barry's Anti Abuse System | v1.4.7

dense drift
#

so if you die in game you may as well die irl

icy shadow
#

yeah make it kill you lmfao

grand zodiac
#

oh shit yeah good idea

icy shadow
dense drift
#

the ultimate hardcore gameplay

dense drift
#

"Minecraft but if I die in game I die IRL too" ๐Ÿคฃ

grand zodiac
#

ill 3d print a gun, add some of my random mechanical stuff i have no idea how to use but ill figure it out inside, make a working gun, then make the plugin cause the gun to fire

#

wait am i allowed to say that

icy shadow
#

probably

grand zodiac
#

okay good i was worried for a sec because i remembner someone getting banned from discord for saying that lol

grand zodiac
icy shadow
#

well

#

we're not discord

grand zodiac
#

its for the meme ๐Ÿ˜ญ

icy shadow
grand zodiac
#

its literally just a config and an eventlistener

icy shadow
#

"please give me suggestions for my plugin guys i promise i dont actually care about it though"

grand zodiac
#

LOOK ๐Ÿ˜ญ

icy shadow
#

no judgement it's just a lil sus

grand zodiac
#

its a meme i swear ๐Ÿ˜ญ

icy shadow
#

if you say so

grand zodiac
#

fuck you ๐Ÿ’€

icy shadow
#

if it involves electric shocks, i'll pass thanks

#

am i allowed to say that

#

hopefully

stuck hearth
#

How did you test it tho

icy shadow
#

that is a very good question

dense drift
#

you need a fork and a live socket

crisp oar
#

Is there an event for when someone uses /papi reload?
Whenever I do it, it breaks my plugin's placeholders

grand zodiac
stuck hearth
#

๐Ÿง

buoyant scarab
#

?

cerulean birch
#

how fast are plugin -> localhost mysql interactions? i.e if data is stored on the db, is it worth putting effort into caching that data?

buoyant scarab
tired olive
cerulean birch
#

so effectively if each time data is needed, it is requested directly from the database, it's fine?

dusky harness
buoyant scarab
dusky harness
cerulean birch
dusky harness
cerulean birch
#

lol

dusky harness
#

so I can't really give a lot of advice

#

๐Ÿฅด

cerulean birch
#

that is what i do rn

dusky harness
#

what objects are you storing?

#

if it won't be a huge amount then caching shouldn't be too bad

#

i think?

cerulean birch
#

imagine groups of users, each group has other data attached such as roles, descriptions, bank balances, etc

#

my main desire to switch to sql

#

is bc the relational aspect feels like it will make it so much easier

dusky harness
#

๐Ÿค” interesting

cerulean birch
#

like its a lot easier to filter data and stuff

onyx robin
stuck hearth
#

What exactly is the issue

onyx robin
#

oh nvm, maybe I know how to do it

dense drift
#

You can simply use paper's itemstack (de)serialize methods. ItemStack#deserializeAsBytes and #serializeAsBytes

#

d;paper ItemStack#serializeAsBytes

uneven lanternBOT
#
@NotNull
public @org.jetbrains.annotations.NotNull byte[] serializeAsBytes()```
Description:

Serializes this itemstack to raw bytes in NBT. NBT is safer for data migrations as it will use the built in data converter instead of bukkits dangerous serialization system.

Returns:

bytes representing this item in NBT.

spiral mural
#

Hey, trying to find a way to support custom fonts (resource pack) and image prefixes for my chat plugin but all I can find on that is related to item model data, which has little to nothing to do with how it's handled in chat as far as I can tell?

stuck canopy
#

how can I get the ItemStack from RecipeChoice in a Recipe as the RecipeChoice#getItemStack is deprecated

proud pebble
stuck canopy
proud pebble
#

ofcourse check if they are instanceof materialchoice or exactchoice, then cast them and use their getItemStack() method

#

since they arent deprecated

stuck canopy
#

ohh I see

#

thanks

flint kernel
#

If have an enum with assorted permissions that I want to store a set of in a database for each player, how should I store that in the database?

e.g. a chmod style system where there can be multiple permission flags associated with each entity

enum Permission {
    READ,
    WRITE,
    EXECUTE;
}

Im considering using the bitmap value in database with enumset in code.. is this sound?

river solstice
#

well there are a lot of ways to do it

#
public enum Permission {
    READ(1),
    WRITE(2),
    EXECUTE(4);

    // ...
}

public void save(Player player, Set<Permission> permissions) {
    int encodedPermissions = 0;
    for (Permission permission : permissions) {
        encodedPermissions |= permission.getValue();
    }

    // .. save
}

public Set<Permission> get(Player player) {
    int encodedPermissions = // .. load
    Set<Permission> permissions = new HashSet<>();
    for (Permission permission : Permission.values()) {
        if ((encodedPermissions & permission.getValue()) != 0) {
            permissions.add(permission);
        }
    }
    return permissions;
}
flint kernel
#

That looks roughly like what I was planning yeah, I just wanted to make sure the idea itself was sound

#

That there's not some glaring obvious reason I shouldn't use this

river solstice
#

well I don't really see any issues with it, though there might be better ways of doing it

#

You could also create a permission table and point user to it via a foreign key

#

You could also store it in a list form in the player table, ex. ['r', 'w', 'x'] or just a string separated with commas or anything else 'r,w,x'

flint kernel
#

The only alternative im aware of would be having a one (player) to many (permission) database structure, but Im not a fan of that idea

flint kernel
#

My main worry for the bitmap option is needing to maintain the ordinal mapping correct for the enum

minor summit
#

well the ordering of the enum itself wouldn't matter so long as you always have READ(1) and WRITE(2), 1 will always be 1 and 2 will always be 2 no matter if READ comes before or after WRITE in the enum listing

river solstice
flint kernel
#
public enum Permission {

    READ(1),
    WRITE(2),
    EXECUTE(3);

    private static final Permission[] PERMISSIONS = values();
    private final int bitset;

    Permission (final int bit) {
         this.bitset = 1 << bit;
    }

    public static Set<Permission> fromBitMap(final int bitmap) {
        final Set<Permission> permissions = EnumSet.noneOf(Permission.class);
        for (final Permission permisson :  PERMISSIONS) {
            if ((bitmap & permission.bitset) != 0) {
                permissions.add(permission);
            }
        }
        return permissions;
    }

    public static int toBitMap(final Set<Permission> permissions) {
        int bitmap = 0;
        for (final Permission permissions : permissions) {
            bitmap |= permission.bitset;
        }
        return bitmap;
    }

}

No idea if that came out right, I'm writing on my phone

#

Does that look right?

#

Idk if I got the terminology right, never screwed with bits like this before

minor summit
#

looks good

#

also why are you writing that on your phone

#

this man is insane

tight junco
#

writing all of that on a phone is actually psycho

river solstice
#

one question is why do you have a static permission field

#

Permission.PERMISSIONS?

#

just use Permission.values() fingerguns

river solstice
#

since the sum of read and write is also 3

hoary scarab
#

Can't you just use .ordinal()?

past ibex
#

Why would you abuse a database like this

#

in three separate columns is the proper way.

#

You will have a fun time doing statements like WHERE permissions.permission == 1 or 3 or 7

tired olive
flint kernel
past ibex
#

still not proper database usage

river solstice
#

what's the proper usage if not to store data ๐Ÿค“

past ibex
#

the ability to lookup data too

flint kernel
past ibex
#

like all players who have the READ permission for permission X

#

what do you mean third column - what type of database is this

river solstice
past ibex
#

please don't store player_name and uuid in the same table repeatedly

#

that's not proper SQL

#

You should make a separate table for player_name to uuid with UUID as primary key

river solstice
flint kernel
past ibex
past ibex
river solstice
past ibex
#

fine but you will have fun updating a player's name

flint kernel
#

In my actual use case there'd be a 3 column uniq constraint

past ibex
#

technically two players can have the same name in minecraft

river solstice
tight junco
#

WAIT NO

#

i read it wrong

#

clout denied

flint kernel
river solstice
#

to select players/rows with specific permission?

flint kernel
#

Yeah but I'd have to somehow bitwise convert in the query no?

#

To check

past ibex
#

you can't do bit operations in a query

flint kernel
#

Figures but then I'm even more confused

#

My idea so far for this is one-to-one:
account,entity,permission_value

unique constraint on account and entity together

alternative, which i thought about and which I think is what your suggesting, was one to many
account,entity,permission_name

with unique constraint on account, entity and permisson together

#

My main concern with the alternative one though is:
I either need to make a SQL query direct when the modification is being made, or delete all existing permissions before inserting the updated ones when saving later

#

Neither of which are very appealing to me

flint kernel
steep owl
#

Hey! I'm currently trying to implement an PAPI Extension:
This is my class: https://haste.base2code.dev/ujitakayen.kotlin
In my onEnable() I call the following: new PlaceHolders(this).register();
PAPI also registers the plugin:
[PlaceholderAPI] Successfully registered expansion: caseopening
However placeholders are not available - the method onPlaceholderRequest is not being called.
Am I missing something?
(Please ping on answer)

tight junco
#

Use the onRequest method

#

and maybe set the canRegister option to true

#

and make sure that your placeholder begins with %caseopening_<jewlery>% or %caseopening_cases.<something>%

terse pagoda
dusky harness
dusky harness
vernal ledge
#

hello i need help

Error : ```Cannot invoke "java.sql.ResultSet.next()" because "rs" is null



Code : https://mclo.gs/il1D7zh
tight junco
#

check if the result set is null

vernal ledge
#

but it's not that's the funny thing

tight junco
#

but it is

vernal ledge
#

es ist ja ResultSet rs = MySQL.getResult("SELECT * FROM OnlineTime ORDER BY Time DESC LIMIT 10");

icy shadow
#

That doesnโ€™t mean it canโ€™t be null

#

Show what the getResult method looks like

vernal ledge
#
        if (isConnected()) {
            try {
                return connection.createStatement().executeQuery(query);
            } catch (SQLException exception) {
                exception.printStackTrace();
            }
        }
        return null;
    }```
icy shadow
#

well

#

I think thatโ€™s the question answered

#

isConnected is clearly false

#

Also for what itโ€™s worth this is not a very good way of doing this. Use a connection pool library like HikariCP and just open and close connections on-demand

vernal ledge
#

oh sorry was my mistake just saw it xD

dusky harness
#

also don't you have to close the value returned by createStatement?

#

memory leak ๐Ÿ™ƒ

raw topaz
#

i get error "Unable to parse placeholder.." on a deluxetags tag, a space anywhere fixes it, but i do not want a space there. it doesnt show the colors

feral raptor
#

anyone have a fairly simple example of parallelism I can practice implementing?

#

i.e something like getting the factorial of a very large number (already done that)

torpid raft
#

count how many consecutive odd prime numbers there are in the first 1 million natural numbers

#

eg. 5 and 7 are consecutive odd primes, but 7 and 9 are not

#

@feral raptor

minor summit
#

why odd prime numbers?

#

what's wrong with 2?

feral raptor
torpid raft
#

i guess you coulddddd do that in parallel though

minor summit
#

that is not what i'm asking

#

why exclude 2 squint

torpid raft
#

because it's not odd ๐Ÿ˜Ž

#

which makes it cringe

minor summit
#

excuse you it's unique

torpid raft
#

nah it needs to conform

#

how dare it try to be different

minor summit
#

it didn't even have to try

stuck canopy
#

is there a way I can remove the underwater mining speed penalty for a player?

#

I am trying to achieve what the aqua affinity enchant does

minor summit
#

I know one person that I suspect knows the answer to that

minor summit
#

yes

stuck hearth
#

I'm not sure

minor summit
#

I am

stuck hearth
#

Hmm ok

#

What's your language of choice these days?
Scala?

minor summit
#

uh i haven't been doing a lot of programming lately, at least not that isn't in existing projects

stuck hearth
#

Any particular reason that might be?

past ibex
#

doesn't depth strider help with this?

tight junco
#

depth strider is movement speed

#

aqua affinity is mining speed

spiral prairie
#

im really puzzled on this:
i have a mailcow container and a roundcube one, and i want when i access mail.domain.tld to get to roundcube (and working) and only when i access /admin, i want to be redirect to the mailcow container to the admin interface. (nginx btw)
everything i have tried resulted in either both breaking or the admin interface not being accessible anymore

spiral mural
#

Hey, I got an issue with fetching a list in config..

        String configPath = "Skins." + itemName;
        ConfigurationSection skinSection = Skinify.getInstance().getConfig().getConfigurationSection(configPath);
        if (skinSection != null) {
            List<String> skinValues = skinSection.getStringList("");
            for (String skinValue : skinValues) {
                if (skinValue != null && !skinValue.isEmpty()) {
                    return true;
                }
            }
        }
        return false;
    }```

```Skins:
  BOW:
    - 4601
    - 34332
  DIAMOND_AXE:
    - 4601
    - 53244
  DIAMOND_HOE:
    - 4601
    - 5344
  DIAMOND_PICKAXE:
    - 4601
    - 1234
  DIAMOND_SHOVEL:
    - 4601
    - 1233
  DIAMOND_SWORD:
    - 4601
    - 3012```

It returns null somehow?

but this one prints System.out.println(Skinify.getInstance().getConfig().saveToString()); the entire config and it's there ๐Ÿ˜‚ am checking item in hand ```skins.isSkinDefined(player.getItemInHand().toString())``` and it returns DIAMOND_SWORD
dense drift
#

skinSection.getStringList("") is not a proper call

#

if you use config.get("Skins." + itemName) will get you a List, not a ConfigurationSection

#

so if you want the skins of an item, just do config.getStringList("Skins." + itemName);

spiral mural
#

yes, makes sense ๐Ÿ˜‚

#

still not returning correct public boolean isSkinDefined(String itemName) { String configPath = "Skins." + itemName; List<String> skinValues = Skinify.getInstance().getConfig().getStringList(configPath); return !skinValues.isEmpty(); } returns false on the diamond_sword I am holding ?

#
            if(skins.isSkinDefined(player.getItemInHand().toString())) {
                MenuUtilities menuUtilities = Skinify.getInstance().menuUtilities(player);
                menuUtilities.setItem(player.getItemInHand());
                new skinGUI(Skinify.getInstance().menuUtilities(player)).open();
            } else {
                player.sendMessage(Messages.chatMessage("error_invalid_item"));
            }``` the println prints ```  BOW:
  - 4601
  DIAMOND_AXE:
  - 4601
  DIAMOND_HOE:
  - 4601
  DIAMOND_PICKAXE:
  - 4601
  DIAMOND_SHOVEL:
  - 4601
  DIAMOND_SWORD:
  - 4601``` so I am super confused ๐Ÿ˜‚
dense drift
#

ah, that toString() is not giving you DIAMOND_SWORD but much more stuff. you want getItemInHand().getType().name()

spiral mural
#

worked โค๏ธ appreciate it! ๐Ÿ˜„

dense drift
#

np

rugged bane
#

I'm looking to dive into NMS again after a few years, back in the day you had to source dive to find what a, b etc were. These days I know Mojang maps exist, how does one setup a project with the mappings? So I can use NMS stuff with the proper names

dusty frost
#

Paperweight is the best way, they provide mappings and stuff super easy

rugged bane
#

Ah godsend, thank you!

spiral prairie
#

poor chazza going down the plugin rabbithole again

rugged bane
#

its changed so much ๐Ÿ˜‚ nms used to be reflection with the alphabet

spiral prairie
#

yup

#

and a lot of praying

rugged bane
#

๐Ÿ˜‚

#

trying to revive and modernise an old project

spiral prairie
#

i feel you

still elm
#

anyone knows what event is called when players swap armors by right clicking?

tight junco
#

PlayerArmorStandManipulateEvent or PlayerInteractAtEntityEvent

dusky harness
#

but he said "swap" so idk

tight junco
#

oh

#

wait

#

nevermind

#

yeah thats just playerinteractevent and hoping for the best

dusky harness
#

๐Ÿ’€

dusky harness
tight junco
#

paper may have an event for it

#

PlayerArmorChangeEvent in paper api

#

look at that

#

incredible

dusky harness
#

paper ๐Ÿ˜Œ

dense drift
#

paper saves the day as always

stuck hearth
#

ChangeInventoryEvent when

dense drift
#

What packets do I need for client side item lore? I know there's smth like "item/slot meta" but is that enough?

minor summit
#

yes

pulsar ferry
#

Client sided item lore? Why?

dense drift
#

for custom enchantments, adding the name and level to the lore is the most painful part because it can be modified by a dozen other plugins

pulsar ferry
#

Fair, good luck on your journey korisalute

dense drift
#

only if the client could just render the enchantments smh

stuck hearth
#

Wouldn't that make you the plugin modifying it over the dozen others or are you adding compatability?

dense drift
#

what I have rn in mind is to take the lore and display it to the player with my enchantments appended to it

#

easier said that done, will see how it goes

stuck hearth
#

Ah interesting.
I'll keep an eye out in showcase ๐Ÿ‘€

dense drift
#

๐Ÿซ 

rare grotto
#

Whoops

dense drift
stuck hearth
#

Hmmm

river solstice
#

Test1

dense drift
#

I swear, after you get enchantment to be displayed on the item you have like 50% of the plugin done kek

spiral prairie
dense drift
hard ice
lyric gyro
#

is it possible to redirect to a link right after clicking a GUI item in Deluxemenus, if so how

pulsar ferry
hard ice
#

Someone can give me the repository and dependency of Guilds ? The one on the wiki is not working

dense drift
hard ice
dense drift
#

works fine for me

hard ice
dense drift
#

well, are you using the jar or the maven dependency ??

hard ice
dense drift
#

ok

dense drift
#

I need some input here. So I have this Mob Coins system with modifiers (different things that can influence the chance and the amount of drops - potion effects, enchantments on weapon, permissions, etc.), all good so far, the problem I'm facing is how to decide what type of coin should be dropped in the first place (there's Common, Rare and Epic coins, each having a different base chance).

With one coin is easy because the start point is the base chance for the type of entity that was killed
The current logic is: get the chance for the entity that's killed > go through each modifier > use the final chance > if the player is lucky enough go through each modifier to calculate the amount of coins > give the coins

hard wigeon
#

How is reflection performance wise?

#

I have a project that uses a bit more reflection than I'd like (It unfortunately has to)

pulsar ferry
#

Depends on how you use it

hard wigeon
#

just calling small functions

pulsar ferry
#

In your case, probably bad
If you cache the lookup it can be very fast

minor summit
#

you are DOOMED

hard wigeon
#

lol

#

I'm lucky it doesn't run too often then I guess

#

I'll cache the things I can though, like icon & description I guess

#

and hope for the best

dense drift
#

JavaPlugin#getDescription is public though

hard wigeon
#

oh f*

#

I'm dumb

#

that one I didn't need reflection for

#

a bunch of other ones I do though

minor summit
#

why aren't you making use of the regular onEnable/onDisable etc

dense drift
#

also, can you not make a Module interface that will be implemented by those plugins and call the methods directly?

hard wigeon
#

so the plugin enables with onEnable

#

but the twist enables when selected in the GUI

hard wigeon
#

so each plugin has the same code, but relocated

dense drift
#

why

hard wigeon
#

why to which part?

#

the relocating?

dense drift
#

cant the core provide the api?

hard wigeon
#

There is no core

#

that's the whole thing

dense drift
#

TwistCore

hard wigeon
#

yeah that's shaded into every plugin

#

maybe poor naming

minor summit
#

if the whole thing is relocated.. couldn't you, just, refer to LocalModule.class normally?

dense drift
#

if it is shaded in each plugin, how do you access the GUI?

hard wigeon
#

/twist is registered by the "manager" that is decided on load via communication between all of them

#

and it runs the GUI

#

and connects to the other ones

hard wigeon
#

as far as I'm aware atleast

#

and the major issue is communicating between the relocated instances

dense drift
#

I would personally have this core thing as a plugin

pulsar ferry
#

Why does core need to be relocated?

minor summit
#

this seems like a terrible design ngl

pulsar ferry
#

Yeah

hard wigeon
#

Well how else would I make a mainplugin-less module system like this?

#

since this does work, like I have a working copy running

dense drift
#

What's the issue with having a main plugin that controls the rest?

#

it makes more sense that all plugins sharing the main logic

pulsar ferry
#

Or just make all the modules plugins at that point

hard wigeon
#

they are plugins

#

too

hard wigeon
pulsar ferry
#

But if they are all using the same "core" why does it need to be relocated anyways? Will you ever have different core versions on each of them? That's sounding even worse

dense drift
#

if they are using mods they are certainly used to dependencies

hard wigeon
#

yeah, since what if someone has an old one and a new one?
With this system, it chooses the newest version to be the "manager", and the manager is just backwards compatible

hard wigeon
#

I know from experience ._.

dense drift
#

Ok Fred

hard wigeon
#

Maybe I'm solving something that doesn't need to be solved

#

I don't know

dense drift
#

yeah seems like

hard wigeon
#

but my alternative solutions in the past never worked

#

that's why I went this path

pulsar ferry
#

Sounds like this would work much better with a core plugin, think of it like papi and the extensions

dense drift
#

I would prioritise the development process than the stupid users that can just restart the server once they see a big ass warning saying "You need X plugin"

hard wigeon
#

well it's not like it's much harder to do this system than that one, it only took me like 2 hours to make :p
but I actually lose time in the long run with the amount of people there are who don't read the warning

hard wigeon
#

I guess I just need to decide what I care most about

stuck hearth
#

You're welcome

dense drift
#

๐Ÿซต

hard wigeon
#

That's an emoji!?

#

I've never seen that

#

wild

dense drift
#

twitter emojis looking weird as always

stuck hearth
#

Break her finger

shy canopy
dense drift
stuck hearth
#

And if a list doesn't have a creature it doesn't spawn anything?

#

Or rather, a creature doesn't have to be in all 3 lists right?

dense drift
#

Yeah it will only consider the entities that are listed. If zombie is not listed on the list of the epic coin it will not drop that type of coin, only common or rare

stuck hearth
#

LGTM.
Another design I considered was

entity:
   common: 50
   rare : 35

but I think yours is more clear for sure.

dense drift
stuck hearth
#

drops looks a little redundant, but I like it

dense drift
#

yeah there will be more stuff added to the coins

stuck hearth
#

makes sense

dense drift
#

looking good
Luck 4, Bad Luck 2 and Looting 3

pulsar ferry
#

Luck 2 + bad luck 2, you have 50% chance to double your diamonds and 50% to immediately die

dense drift
#

technically they would cancel each other I guess (+2 + -2) ๐Ÿคฃ

stuck hearth
#

That depends if you consider luck to have the same weight as bad luck.
Personally I think bad luck weighs more

dense drift
#

fair

#

what I have is just for testing anyways

stuck hearth
#

It's neat

dense drift
#

Probably a dumb question, but I wonder if using floats instead of doubles for chances would be considered a "premature optimisation" or is a justified use?
100% is 1.0d and 0% is 0.0d and the max number of decimals will be probably around 7, so something like 0.9912345 for 99.12345%

past ibex
#

what?

#

are you comparing it to a double?

dense drift
#

I forgot to mention that, yes, I currently use doubles to represent the chances, sorry.

minor summit
#

aaand.. what would that be optimising for?

dense drift
#

Do you mean what the chances are for?

minor summit
#

No

#

You are asking if it would be considered a premature optimisation, what would you be optimising for by doing that?

#

Code maintenance? CPU usage? memory footprint?

dense drift
#

Resources usage in general

#

Thinking more about it, it is not gonna do anything probably thinkfused since the only values stored on a long therm are the default chances for each mob type (so maybe around 100 values on a bigger setup) which is equal to 0 in comparison to other systems

minor summit
#

I wouldn't bother

dense drift
#

yeah

minor summit
#

Even if you have two million doubles lying around, that's going to be 16 MB + change

dense drift
#

damn, 16MB?

torpid raft
#

you should use bytes

#

and implement your own IEEE format

#

3 bit exponent and 5 bit mantissa ๐Ÿ˜

dense drift
#

smh Ivan don't mock me kek

torpid raft
#

but think of the gainsss

dense drift
#

:p

stuck hearth
#

Bitwise operations can be pretty fast

minor summit
#

no they cannot

icy shadow
#

i forbid it

stuck hearth
#

Nevermind, autoboxing is fast

icy shadow
#

proof?8

stuck hearth
#

Int -> Integer = 500speed
Bitwise -> ??? = 2 speed maybe?

pulsar ferry
#

It would be at least 5

dark garnet
#

hi, im listening to BlockPlaceEvent and i wanna get the block material thats being "replaced" (vines, light blocks, air, etc...), what would i use to get that? would i just get the block at the BlockPlaceEvent#getBlock's location?

#

im blind ๐Ÿ™ƒ

cerulean birch
#

anyone have suggestions for inventory api/frameworks for 1.19.4 that are easy to use

cerulean birch
#

ye

dusky harness
cerulean birch
#

just need something that can make reasonably good pagination systems

#

ty

dusky harness
minor summit
#

not like that makes a difference

dusky harness
#

ye ik

#

but

#

it's got pagination

#

๐Ÿ‘

cerulean birch
#

will try out

marble nimbus
#

I have a quick question, using player.openInventory with target.getInventory(), what is the result?
Will I see the hotbar or only the actual inventory contents?
I am having some pc troubles, so I can't properly test rn.

dense drift
#

you will only see the 4 rows I think

marble nimbus
#

so it will include the hotbar?

dense drift
#

no

thorn cape
#

So I'm having issues trying to implement minecraft horns in my plugin for 1.19.2. It would appear that MusicalInstrumentMeta class is not in the 1.19.2 api but the horn items are. Anyone know what I can do to remedy this?

edgy lintel
#

hey ahve you checked the latest aopburo

marble nimbus
# dense drift no

I just tested it, and it actually does include the hotbar. I was also pretty sure it doesn't, oh well learned something new ๐Ÿ˜„

dense drift
#

wait for real?

pulsar ferry
#

And the armor content too, it's the inventory items, hotbar items, and armor content

dense drift
#

damn i could swear it is only the inventory

marble nimbus
#

you sure?

#

the inv I get is 4 rows

#

so 3 inv 1 hotbar

minor summit
#

which is why some invsee plugins have separate commands for viewing the main inventory and viewing the armour, and mirror the items between inventories

#

calling openInventory with a player inventory is fucked

past ibex
#

The 0th slot of the player inventory is their crafting results...

#

1-4 is crafting slots, 5-8 armor, 36-44 is their hotbar, 45 offhand

#

it's a mess

#

or at least it isn't meant to be used by humans

#

Or well, that's how they are defined in the protocol. Bukkit uses an entirely different set of ID's such as 0-8 mapping to hotbar instead of 36-44

minor summit
#

the inventory api is fucked

dense drift
#

bukkit api*

vestal talon
#

there's any lua programmers here?

vestal talon
#

lolll

#

is there lua programmers though?

broken elbow
#

maybe? why?

dusky harness
#

do BukkitTasks run at the beginning or end of ticks?

#

specifically before or after commands

spiral prairie
#

commands run when theyre run

dusky harness
#

like how Bukkit.getScheduler().runTask doesn't run the task on the same tick

icy shadow
spiral prairie
#

ok

minor summit
spiral prairie
#

help dkim then brister

icy shadow
spiral prairie
#

thats awesome

minor summit
#

it would've been faster to just open the code and see lmfao

dusky harness
icy shadow
#

as far as i can tell packet processing is the first thing that happens

broken elbow
dusky harness
#

aw so chat's first?

icy shadow
dusky harness
#

๐Ÿ’€

minor summit
#

how about you fix it? lol

broken elbow
# icy shadow why not?

you and tanguygab might be the only people to still have that role. cherish it and take care of it. it is your son

icy shadow
#

honoured

dense drift
#

there's 4 @broken elbow

dusky harness
#

what is that channel?

spiral prairie
#

role settings

dense drift
#

lol dkim

minor summit
#

lol dkim

broken elbow
minor summit
#

you got access to the member list

dusky harness
dense drift
#

it is the Members list

minor summit
#

and you can "filter" by role

dusky harness
#

oh

broken elbow
#

wait

#

that exists?

#

I've never used that feature

dense drift
#

noob

broken elbow
#

how do I do it?

icy shadow
#

@dusky harness nevermind it's the other way around

#

i believe

spiral prairie
#

wow brister KEKW_laugh

dusky harness
#

YAy

#

no dupe

#

๐Ÿ˜ƒ

icy shadow
#

i accept no responsibility for anything that may happen if im right / wrong

spiral prairie
#

xD

#

but that seems correct to me

icy shadow
#

it seems intuitively correct yeah

#

but cb code is a mess

minor summit
#

truly

icy shadow
#

theres a very decent chance i missed something

spiral prairie
#

those guys didnt even get paid, did they?

minor summit
#

nah you're probably right

pulsar ferry
minor summit
#

creep

icy shadow
#

@dusky harness easy way to confirm, run a server with a debugger and stick breakpoints on both lol

#

problem solved

minor summit
# icy shadow

are those two called in the same method (tickChildren)?

spiral prairie
minor summit
#

then yeah bukkit tasks run before packets are processed lol

icy shadow
#

ez

dusky harness
#

๐Ÿ‘

burnt dagger
#

Can anyone assist?

for (Map.Entry < String, List < String >> entry: friends.entrySet()) {
    String pl = entry.getKey();
    List < String > friends = entry.getValue();
    player.sendMessage(Bukkit.getPlayer(UUID.fromString(pl)).getName() + "'s friends:");
    for (String friend: friends) {
        player.sendMessage("- " + Bukkit.getPlayer(UUID.fromString(friend)).getDisplayName());
    }
}

Trying to output a players friend list, but instead it is outputting every key of the hashmap.

icy shadow
#

wdym?

#

also you should probably just use UUIDs in the hashmap key & value rather than strings, it'll be faster and it's safer

burnt dagger
#

So I am trying to output a players friends list (/friend list) - but instead it outputs all players friend lists

#

Okay

icy shadow
#

ah

#

well, that's to be expected given that you're looping over friends

#

you probably want to do friends.get(playerUUIDOrWhatever) instead

#

and then loop over the list from the result

burnt dagger
#

friends.get(UUID).entrySet()?

icy shadow
#

no

#

if friends is a Map<String, List<String>> then friends.get(String) is a List<String>

#

you dont need entrySet

#

that gives you all the entries

burnt dagger
#

oh, so just do for(UUID entry : friends.get(playerUuid)), correct?

#

I don't need the second for loop

icy shadow
#

yup

burnt dagger
#

okayyy

#

thank you!

#

also, what is the replacement for #sendMessage?

#

I have been out of development for a few years

#

Something like components i think?

icy shadow
#

if you want to support spigot then you'll probably still need to use sendMessage, or add the adventure dependency manually and shade it

#

if you only care about paper, then just #sendMessage(Component) (compile against paper-api rather than spigot-api)

burnt dagger
#

can you support both?

dusky harness
#

paper supports spigot api

#

so if you depend on spigot-api

#

it should work on both

burnt dagger
#

So building against spigot-api should be good for paper, what about purpur and the other little ones?

#

Im currently building against paper, but testing on purpur.

dusky harness
#

basically if you build against a fork, it'll only work for that fork and the ones below

#

bukkit -> spigot -> paper -> purpur/pufferfish/airplane/etc

burnt dagger
#

okay easy day

#
for (UUID entry: friends.get(player.getUniqueId())) {
  player.sendMessage(player.getName() + "'s friends:");
  player.sendMessage("- " + Bukkit.getPlayer(entry).getDisplayName());
}

Brister, something like this should work right?

#

oh wait lol

dense drift
burnt dagger
#

Hell yeah, it works

#

thank you!

icy shadow
# burnt dagger can you support both?

yeah the others have said, but the tldr is if you build against spigot, you'll support basically everything but miss out on some of the nice things. the more nice things you enable, the less compatible your plugin is

minor summit
#

folia trollface

restive hedge
#

why when I do a /papi reload, the placeholder I created in my plugin stops working?

mental cypress
#

You probably didn't set persist to true. It's on the wiki somewhere.

restive hedge
#

thanks

queen swift
#

does anyone know skripts very well!

#

@bright pier

#

could you help?

minor summit
#

not to disappoint but I don't know a single person in here that is particularly well-versed in skript

#

they have a discord, should prolly ask there

stuck hearth
#

Emily doesn't know a single person, yet is a single person.
Curious

warm steppe
#

๐Ÿ’€

warm steppe
queen swift
dense drift
#

There's a server made special for skript, join it

queen swift
#

command /spawn [<player>]:
aliases: hub, lobby
permission: spawn.spawn
permission message: &cSorry, but you don't have permission to execute this command!
description: Teleport you to spawn.
trigger:
if {spawn} isn't set:
message "&4Error:&c spawn is not set!"
stop
else:
argument 1 is not set:
wait 5 seconds
teleport player to {spawn}
message "&6Teleporting..."
else:
if sender has permission "spawn.spawn.others":
if argument is online:
teleport argument to {spawn}
if sender is a player:
message "&6You have been teleported to spawn by &c%player%&6." to argument 1
if sender is not a player:
message "&6You have been teleported to spawn by &cConsole&6." to argument 1
teleport player to {spawn}
else:
message "&cSorry, but you don't have permission to execute this command!"

#

it doesnt look right eather

queen swift
dense drift
worn jasper
#

๐Ÿคฎ who said the s word

#

shame on you

dry scaffold
#

Hello, possibly a basic question, unsure. Looked through the wiki and pins but it's possible I passed over an answer.
Is there a simple way to be able to use both mini-message and PAPI at the same time? Or am I stuck having to kinda parse them separately and combine them in a weird convoluted way

#

I'm trying to support PAPI in my plugin messages, but my entire plugin is using minimessage right now

dry scaffold
#

omg thank you so much

dense drift
#

np

rugged bane
#

Anyone got an example github repo where they've published a library/module to Maven Central? Trying to publish something with build.gradle and it's been a nightmare to setup

broken elbow
#

you can look at chatchat. that's what the last 4-5 commits are for.

rugged bane
#

Ah really, thank you! It's been such a head fuck

rugged bane
#

Ah thank you, making progress..

Execution failed for task ':sdk:publishMavenPublicationToOssrhRepository'.
> Failed to publish publication 'maven' to repository 'ossrh'
   > Could not PUT 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/net/analyse/sdk/2.0.0/sdk-2.0.0.jar'. Received status code 401 from server: Unauthorized

* Try:

Now got to figure why its not letting me

broken elbow
#
  1. bad credentials maybe?
icy shadow
#
  1. lol
broken elbow
#

lmao

icy shadow
#
  1. aaaa
#
  1. g
broken elbow
#
  1. test
#
  1. test
#

ok so 3 digits?

#
  1. test
#

I guess so

#
  1. test
pulsar ferry
#
  1. does it not work with more?
icy shadow
#
  1. fff
broken elbow
#

3+ digits

icy shadow
#

lmao

pulsar ferry
#

lmao

icy shadow
#
  1. oh
broken elbow
#
  1. test
icy shadow
#

๐Ÿ˜ญ

broken elbow
#

wtf

pulsar ferry
#

10000000000. wtf is this lmao

broken elbow
#

I made it 5 0's and it made it only 1

#
  1. test
#
  1. test
pulsar ferry
#

10000000000. test

broken elbow
#

124214.21412412.21412

pulsar ferry
#

1000000000. test

broken elbow
#
  1. 1412412
pulsar ferry
#

The limit is 9999999999

broken elbow
#
  1. test
#

why does it remove leading 0s?

#

000

#
  1. test
icy shadow
#

10000000000. f

pulsar ferry
#

2147483647. maybe it's int limit?

#

2147483648. maybe?

#

It is!

icy shadow
#

odd that it's int limit if it's js

broken elbow
#

but why 3 digits at minimum?

icy shadow
#
  1. b
#

it's not

pulsar ferry
#

Anything more than 1 goes left

broken elbow
#

wait how? I tried that

icy shadow
#
  1. this is different to
    1. this
broken elbow
#
  1. test
#
  1. test
icy shadow
#

it's a different font

broken elbow
#

oh

#

oh it is

icy shadow
#

it's just longer ones fuck it up

broken elbow
#

I guess they're trying to add lists?

pulsar ferry
#

This is so dumb lmao

broken elbow
#

090

#
  1. test
icy shadow
#

it's supposed to be yeah like

  1. a
  2. b
  3. c
dense drift
#

a. Hey

broken elbow
#

10a. test

#

a10. test

#

abc. test

#
  1. test
#

At first I thought it is just broken on my side lmao since I just updated the nvidia drivers and haven't restarted yet

pulsar ferry
#

Oh mobile it looks like "๏ฟฝ๏ฟฝ๏ฟฝ" for me

broken elbow
#

lmao. let me check

dense drift
#

it might be a leaked feature from forums

#

because lists work on the first post from forums

broken elbow
#

just more space between lines

pulsar ferry
#

Also it doesn't work on dms thonk

broken elbow
#

I mean it doesn't work in your guild either

dense drift
broken elbow
broken elbow
#

lmao

#

999999999999999999999999999999999999999999. 0

dense drift
broken elbow
#

so whenever you go over int limit it goes back to 1?

pulsar ferry
#

Lmao

dense drift
#

๐Ÿคฃ

broken elbow
#

only when you reply ๐Ÿคฃ

dense drift
#

probably because it can't increment over int max xD

#

funny

broken elbow
#

indeed

dense drift
#

-401. Test

broken elbow
#

-999999999999999999999999999999. test

#

no negative

pulsar ferry
#

011010000110100101100100011001000110010101101110. Test

broken elbow
#

that would've been even funnier

pulsar ferry
#

Haha that's a fun one

dense drift
#

๐Ÿคฃ

broken elbow
#

oh. it actually worked with a leading 0

#

kinda

dense drift
#

im curious how the chat will look when this gets fixed xD

broken elbow
#

we'll have to wait and see .1

broken elbow
#

I assumed but was to lazy to manually copy it

#

write it*

#

bcz you can't copy from the reply

dense drift
#

hidden?

broken elbow
#

and used that

dense drift
#

ah ok

broken elbow
#

matt leaving easter eggs everywhere

dense drift
#

I thought it was a coincidence

#

fr the ultimate easter egg ๐Ÿคฃ

broken elbow
#

Just like me. I like to tell people that my code isn't broken but that I love leaving easter eggs for them to find

dense drift
#

in form of bugs

broken elbow
#

Yeah. Bugs are nice. They do stuff.

pulsar ferry
#

010110010110111101110101001000000110001101100001011011100010000001100001011011000111001101101111001000000110010101101110011000110110111101100100011001010010000001101101011001010111001101110011011000010110011101100101011100110010000001101001011011100010000001100100011001010110001101101001011011010110000101101100001000000110100001100101011100100110010100100000011000010110111001100100001000000111000001100001011100110111010001100101001000000110000100100000011000100110100101100111011001110110010101110010001000000110110101100101011100110111001101100001011001110110010100100000011101000110100001100001011101000010000001101001011100110010000001101000011010010110010001100100011001010110111000100000011101010110111001110100011010010110110000100000011110010110111101110101001000000111001001100101011100000110110001111001. Test

pulsar ferry
#

Lmao

broken elbow
#

doesn't even show it all

#

so

#

doesn't matter

#

actually

#

they completely removed inspect element?

dense drift
#

try to TTS that message

dense drift
pulsar ferry
dense drift
#

๐Ÿคฃ

broken elbow
#

oh

dense drift
#

it turns into "stop speaking message"

broken elbow
#

there's actually a stop button

#

that's nice

icy shadow
#

๐Ÿ’  ๐Ÿ’  ๐Ÿ’  ๐Ÿ’  ๐Ÿ’ 

dense drift
#

yeah xD

icy shadow
#

ur lucky i dont have tts perms

dense drift
#

huh is that even a thing?

broken elbow
#

diamond shape with a dot inside

broken elbow
icy shadow
#

diamond shape with a dot inside diamond shape with a dot inside diamond shape with a dot inside

dense drift
#

damn

pulsar ferry
#

test0000. test

#

Sad

dense drift
#

I thought it got removed

broken elbow
#

oh it did? maybe idk

pulsar ferry
#

1test2222222222222. test

#

Biggest sad

broken elbow
#

can I really not inspect element even by enabling some developer mode or something?

dense drift
#

probably on browser you can

#

but not in the app anymore

broken elbow
#

oh forgot about the browser

dense drift
#

I wonder how many kids lost their accounts because of that lmao

broken elbow
#

a lot

dense drift
#

damn there's a settings file?

broken elbow
#

works*

#

nice

pulsar ferry
#

55798319027847842452871172500245955255238544258506414229481695316111825737104436684825982659841461529424168786857761782786931. A better hidden message

pulsar ferry
#

Damn too big to see all

broken elbow
#

not on my screen

dense drift
#

skill issue

pulsar ferry
#

Base 10, convert it to base 16 then to text

broken elbow
minor summit
#

hacker !

broken elbow
#

Ah yes

#
  1. test
  2. test
  3. test
  4. test
broken elbow
#

ah yeah. it is an ordered list

#

makes some sense

#

not a lot

#

99999999999999999999. test
242. test
123. test
425. test

broken elbow
dense drift
#

what did you think it was lmao blitz

broken elbow
#

a jar of honey

dense drift
#

ah, I wish it was

minor summit
broken elbow
#

Test

#

Test

#

omg @pulsar ferry

#

@dense drift

#

I just want to be annoying

rugged bane
#

No way, it works already?!

#

test

#

omggg

warm steppe
#

test

test

broken elbow
#
  • list item
  • another list item
rugged bane
broken elbow
#

omg

#

yes

#

finally

#

a better way to scam

warm steppe
rugged bane
#

LOL

warm steppe
#

I saw

#

(didn;t)

minor summit
#

[hi](@broken elbow)

broken elbow
warm steppe
#

hi emily

broken elbow
rugged bane
broken elbow
#

hahahahaha

rugged bane
#

idk what im doing wrong

minor summit
#

kappa

broken elbow
#

you can hide naything

#

not just links?

#

that's funny

#

[how's your day going]( @leaden plume )

#

this shit's hilarious

dense drift
pulsar ferry
#

Damn that's pretty neat

dense drift
#

Has anyone worked with smth like limited stock shops? I need to implement something and idk how to handle transactions. For example, there can be 2 items left in stock, player A buys 1 and player B attempts to buy 2 but only 1 is left.

minor summit
#

basically you need one central authority that processes the transactions

spiral prairie
#

like an SQL database and a single thread

minor summit
#

not necessarily a single thread

#

obviously it'll make the reasoning a ton easier

spiral prairie
#

yup

#

cause race conditions a mf

dense drift
#

So like the methods to access the stock, sell items, etc. are called on the thread where the manager is running?

spiral prairie
#

if you want it easy yes

dense drift
#

I see

dense drift
#
public class ShopTransactionHandler {

    private final ExecutorService executor = Executors.newSingleThreadExecutor();
    private final Queue<Transaction> transactions = new LinkedList<>();

    public void addTransaction(Transaction transaction) {
        executor.submit(() -> transactions.add(transaction));
    }

}```
It this right @minor summit ? ๐Ÿ˜ฌ
pulsar ferry
#

Oh boy transactions

minor summit
#

that is one way of adding stuff to a queue yes

dense drift
#

what would another be? thinkfused

minor summit
#

i mean

#

it depends on what you're gonna do with it then

dense drift
#

Fair

past ibex
#

... this is the weirdest way to synchronize a list's adding

minor summit
#

ยฏ_(ใƒ„)_/ยฏ

past ibex
#

Even Collections.SynchronizedList(new LinkedList<>()); would be faster

dense drift
#

yeah sorry, I haven't done anything like that so far ๐Ÿคฃ

dusky harness
#

i just remember submit swallowing up exceptions

#

and so i switched to execute

minor summit
#

well it returns a Future, you are expected to deal with the Future appropriately

dusky harness
#

ye

minor summit
#

it's not really about "how do i add this to the list", it's about what the hell you are executing

dense drift
#

Ok so what I'm thinking about doing is to add each transaction (aka player attempting to buy an item) to that queue and process them in order to make sure the stock limit is respected

minor summit
#

okay, process them where?

dense drift
#

that's a good question because idk how I'm going to do that ๐Ÿคฃ

#

the idea is to process the transaction in the moment it is created

#

"process" meaning to check the stock and if the player can buy the requested amount of items, to subtract the money from their balance, decrease the stock etc.

minor summit
#

and why not run that in the executor instead of pushing to a queue?

dense drift
#

hmm

minor summit
#

sorry, let me rephrase that

#

you could run that in the executor instead of pushing the element into the queue

dense drift
#

so because it is a single threaded executor it will allow one action to be done at a time? thinkfused

minor summit
#

yes

#

it will queue the tasks, so, there's your queue already, it's the executor itself

dense drift
#

yeah that's fair