#help-development

1 messages · Page 955 of 1

echo basalt
#

I wonder if you can spectate display entities

lost matrix
#

Was thinking that as well. The teleport interpolation might work while spectating.

agile quiver
#

Can I make smooth animation with that like not a tp ?

echo basalt
#

Hm

lost matrix
echo basalt
#

Camera movements bad but regular velocity good

agile quiver
#

Ok thx

cinder abyss
#

No one knows? (yeah, Queens of The Stone Age)

hybrid spoke
#

but head movements are weird on armorstands

lost matrix
#

You might be able to modify the name of merchant inventories with packets

hybrid spoke
#

you'll have to make your own

#

or packets but thats ugly

cinder abyss
#

humm okay thanks

echo basalt
#

InventoryView#setTitle no?

junior cradle
#

You know how to work with them?

lost matrix
#

I can probably cook something up

junior cradle
lost matrix
#

Let me take a look at the protocol real quick and well see then

junior cradle
#

My test code

public static void createNpc(@NotNull Player player, @NotNull EntityType type) {

        final PacketContainer packet = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);

        packet.getIntegers().write(0, 2004); // Entity ID.
        packet.getEntityTypeModifier().write(0, type); // Set EntityType.


        // Set location.
        packet.getDoubles().write(0, player.getX());
        packet.getDoubles().write(1, player.getY());
        packet.getDoubles().write(2, player.getZ());

        // Set Direction.

        float yaw = player.getYaw();
        float pitch = player.getPitch();
        packet.getBytes().write(0, (byte)((int)(yaw * 256.0F / 360.0F)));
        packet.getBytes().write(1, (byte)((int)(pitch * 256.0F / 360.0F)));



        try {
            Anarchy.getProtocol().sendServerPacket(player, packet);
        } catch (Exception e) {
            Anarchy.getInstance().getSLF4JLogger().error("Send player packet NPC.", e);
        }
    }
lusty flax
#

the prefix is under 16 chrs tho, or do you mean that thats total including name? cus it was working fine yesterday and i dont think i changed anything that would effect it

worthy yarrow
#
public static void runChickenTasks() {
        new BukkitRunnable() {

            @Override
            public void run() {
                for (Player player : Bukkit.getOnlinePlayers()){
                    PetRegistry.getChickenPets().forEach(((uuid, chickenPet) -> {
                        if (isPetInsideInventory(player, uuid)){
                            PetLevelSystem.addExperience(uuid, 1, chickenPet);
                        }
                    }));
                }
            }
        }.runTaskTimer(CoolPets.getPlugin(CoolPets.class), 20L, 20L);
    }```
Is this correct usage of a runnable?
echo basalt
chrome beacon
#

?scheduling

undone axleBOT
echo basalt
junior cradle
chrome beacon
#

Just use Citizens

#

You don't need to reinvent the wheel

echo basalt
#

Ew no

junior cradle
echo basalt
#

Give me a sec getting out of bed

junior cradle
junior cradle
lost matrix
# junior cradle I don't know how to work with packages, I'm doing it for the first time

I hard eyeballed some of those. Let me know if it works:

  public PacketContainer createVillagerMetaPacket(int entityId, VillagerType type, Villager.Profession profession, int traderLevel) {
    PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);

    packet.getIntegers().write(0, entityId);

    List<WrappedDataValue> dataValues = new ArrayList<>();

    WrappedVillagerData.Type wrappedType = WrappedVillagerData.Type.valueOf(type.toString().toUpperCase());
    WrappedVillagerData.Profession wrappedProfession = WrappedVillagerData.Profession.valueOf(profession.toString().toUpperCase());

    WrappedVillagerData wrappedVillagerData = WrappedVillagerData.fromValues(wrappedType, wrappedProfession, traderLevel);
    WrappedDataWatcher.Serializer villagerSerializer = WrappedDataWatcher.Registry.get(WrappedVillagerData.class);

    dataValues.add(new WrappedDataValue(18, villagerSerializer, wrappedVillagerData));

    packet.getDataValueCollectionModifier().write(0, dataValues);

    return packet;
  }
echo basalt
#

yeah looks about right

lost matrix
#

I hate what i did for the enum conversion. But i couldnt find a mapper for them

worthy yarrow
echo basalt
#

It's fine

#

I'd prob make my own converter though

worthy yarrow
lost matrix
#

Hm. I think the WrappedVillagerData needs to be converted to an nms object first...

echo basalt
#

Also I don't think your conversion is gonna work

echo basalt
junior cradle
lost matrix
#

Ah, thats the nms type. Woops

#

Its Villager.Type

junior cradle
echo basalt
#

is it really gon work

lost matrix
#

Its a conversion from bukkit to PLibEnumWrapper. Not from bukkit to nms.
So it might work.

echo basalt
#

wait that's the wrong one

#

that's 1.13 villager wtf

#

transitive deps go brr

#

yeah we good

junior cradle
echo basalt
#

Your conversion will probably work fine

echo basalt
echo basalt
#

The modern entity metadat packet just takes 2 fields:

  • Entity ID (int)
  • Data values (List<DataValue>)
#

You send it after sending the spawn packet

#

IDeally both in the same tick

lost matrix
#
  public PacketContainer createVillagerMetaPacket(int entityId, Villager.Type type, Villager.Profession profession, int traderLevel) {
    PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);

    packet.getIntegers().write(0, entityId);

    List<WrappedDataValue> dataValues = new ArrayList<>();

    WrappedVillagerData.Type wrappedType = WrappedVillagerData.Type.valueOf(type.toString().toUpperCase());
    WrappedVillagerData.Profession wrappedProfession = WrappedVillagerData.Profession.valueOf(profession.toString().toUpperCase());

    WrappedVillagerData wrappedVillagerData = WrappedVillagerData.fromValues(wrappedType, wrappedProfession, traderLevel);

    Class<?> nmsType = WrappedVillagerData.getNmsClass();
    Object nmsObject = wrappedVillagerData.getHandle();

    WrappedDataWatcher.Serializer villagerSerializer = WrappedDataWatcher.Registry.get(nmsType);

    dataValues.add(new WrappedDataValue(18, villagerSerializer, nmsObject));

    packet.getDataValueCollectionModifier().write(0, dataValues);

    return packet;
  }

Here is the packet using the unwrapped nms object. I think this is the right way.
But try the other impl first.

echo basalt
#

you don't need to get a serializer for the nms type

#

Pretty sure

lost matrix
#

Im pretty sure that you need for some types.

#

Someone had this problem yesterday

echo basalt
#

No, just that most wrapped types have their own get method

junior cradle
#

@echo basalt @lost matrix
You are cool, how do you know that?
I don't understand anything about it (
Could I PM you for some similar package information?

echo basalt
#

Instead of getting the serializer for WrappedChatComponent you call getChatComponentSerializer

lost matrix
hybrid turret
#

after setting my skin with the PlayerProfile class, it won't show the new skin.
Code:

PlayerProfile profile = player.getPlayerProfile();
PlayerTextures textures = profile.getTextures();

try {
  textures.setSkin(new URL("https://textures.minecraft.net/texture/21534c9bea4a10745128f0d7d5bd8fb1848ac82c793323be5c0612a91dd58bbd"));
  profile.setTextures(textures);
  sender.sendMessage("Changing skin should have worked.");
} catch (MalformedURLException ignored) {
  sender.sendMessage("Changing skin failed.");
}
echo basalt
#

whatever trial and error

#

But if there's a method use the method

junior cradle
# echo basalt Experience, just ask here

It's just that mobs have many different functions, for example, invulnerability, gravity, placing an object in the hand, and so on. I would like to know how it can be done or where I can find out such data so that I can do it myself and not distract you

echo basalt
lost matrix
hybrid turret
echo basalt
#

Well..

#

You set the profile

#

And then you respawn the player

#

It'll flicker a bit iirc

hybrid turret
#

yeah i mean the packet sending lmao

#

oops

lost matrix
#

try player.spigot().respawn() first

hybrid turret
#

oh that sounds a lot simpler

#

nope

echo basalt
#

Alright packet time

hybrid turret
#

o_o

echo basalt
#

Allow me to pull up some cursed 5 year old code

hybrid turret
#

In germany we would say: "Tu' dir keinen Zwang an."

#

(I hope Illusion is not german, otherwise this would be kinda weird now)

echo basalt
hybrid turret
#

yeah i knew that

#

could've been that both of u are lol, yk?

echo basalt
#

Nah I'm portuguese

junior cradle
#
[00:29:51 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'npc' in plugin FOX-ANARCHY v1.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R2.CraftServer.dispatchCommand(CraftServer.java:1005) ~[purpur-1.20.2.jar:git-Purpur-2091]
        at org.bukkit.craftbukkit.v1_20_R2.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[purpur-1.20.2.jar:git-Purpur-2091]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:265) ~[purpur-1.20.2.jar:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:338) ~[?:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:322) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2279) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2239) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.20.2.jar:git-Purpur-2091]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
#
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1351) ~[purpur-1.20.2.jar:git-Purpur-2091]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:193) ~[purpur-1.20.2.jar:git-Purpur-2091]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1328) ~[purpur-1.20.2.jar:git-Purpur-2091]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1321) ~[purpur-1.20.2.jar:git-Purpur-2091]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1299) ~[purpur-1.20.2.jar:git-Purpur-2091]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1187) ~[purpur-1.20.2.jar:git-Purpur-2091]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[purpur-1.20.2.jar:git-Purpur-2091]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NullPointerException: field
        at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:921) ~[guava-32.1.2-jre.jar:?]
        at com.comphenix.protocol.reflect.accessors.MethodHandleHelper.getFieldAccessor(MethodHandleHelper.java:83) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.reflect.accessors.Accessors.getFieldAccessor(Accessors.java:84) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.wrappers.EnumWrappers$FauxEnumConverter.getGeneric(EnumWrappers.java:972) ~[ProtocolLib.jar:?]
#
        at com.comphenix.protocol.wrappers.EnumWrappers$FauxEnumConverter.getGeneric(EnumWrappers.java:953) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.wrappers.WrappedVillagerData.fromValues(WrappedVillagerData.java:53) ~[ProtocolLib.jar:?]
        at ua.imfoxter.mc.foxanarchy.sections.npc.edit.NpсPackets.createVillagerMetaPacket(NpсPackets.java:61) ~[FOX-ANARCHY-1.0-all.jar:?]
        at ua.imfoxter.mc.foxanarchy.sections.npc.edit.NpсPackets.createNpc(NpсPackets.java:40) ~[FOX-ANARCHY-1.0-all.jar:?]
        at ua.imfoxter.mc.foxanarchy.sections.command.npc.CommandNpc.execute(CommandNpc.java:40) ~[FOX-ANARCHY-1.0-all.jar:?]
        at ua.imfoxter.mc.foxanarchy.sections.command.Command.onCommand(Command.java:50) ~[FOX-ANARCHY-1.0-all.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
        ... 23 more
hybrid turret
echo basalt
#

?paste

undone axleBOT
echo basalt
#

plox

hybrid turret
#

oh god

#

so much stacktrace

#

thanks for the code, illusion, i think i understand

junior cradle
#
final PacketContainer villagerMetaPacket = createVillagerMetaPacket(2004, Villager.Type.JUNGLE, Villager.Profession.ARMORER, 0);


        try {
            Anarchy.getProtocol().sendServerPacket(player, villagerMetaPacket);
        } catch (Exception e) {
            Anarchy.getInstance().getSLF4JLogger().error("Send player packet NPC.", e);
        

public static PacketContainer createVillagerMetaPacket(int entityId, Villager.Type type, Villager.Profession profession, int traderLevel) {
        PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);

        packet.getIntegers().write(0, entityId);

        List<WrappedDataValue> dataValues = new ArrayList<>();

        WrappedVillagerData.Type wrappedType = WrappedVillagerData.Type.valueOf(type.toString().toUpperCase());
        WrappedVillagerData.Profession wrappedProfession = WrappedVillagerData.Profession.valueOf(profession.toString().toUpperCase());

        WrappedVillagerData wrappedVillagerData = WrappedVillagerData.fromValues(wrappedType, wrappedProfession, traderLevel);
        WrappedDataWatcher.Serializer villagerSerializer = WrappedDataWatcher.Registry.get(WrappedVillagerData.class);

        dataValues.add(new WrappedDataValue(18, villagerSerializer, wrappedVillagerData));

        packet.getDataValueCollectionModifier().write(0, dataValues);

        return packet;
    }
lost matrix
#

I see the problem. One moment

hybrid turret
#

wait a second, let's say i shamelessly copied those methods @echo basalt (hypothetically ofc), should i be able to access all those classes if i have nms "enabled"?

#

Bc it cant find SkinData or ClientboundPlayerInfoPacket

echo basalt
#

SkinData is my own thing

hybrid turret
#

ahhhhhhhhhhhhhhhhhhhh

echo basalt
#

Rest yeah you need to have it remapped

hybrid turret
#

i just thought that

#

damn

echo basalt
#

?nms

hybrid turret
#

i did that, i was just confused. thought SkinData was a spigot thing loll

#

What about ClientboundPlayerInfoPacket?

echo basalt
#

Just found this comment on this old repo

#

fuck

echo basalt
hybrid turret
hybrid turret
#

that's all i can find

pliant topaz
#

InventoryClick

echo basalt
#

Yeah so uh

#

InventoryClick's state is set BEFORE the event goes through

echo basalt
#

This is 1.18 code

civic sluice
hybrid turret
#

oh thanks

pliant topaz
hybrid turret
#

there is no Action.REMOVE_PLAYER tho

echo basalt
#

Maybe

#

What I usually do is cancel the event and run the updates myself

civic sluice
hybrid turret
civic sluice
#

ClientboundPlayerInforRemovePacket

lost matrix
#

@junior cradle So this is throwing an exception. Which indicates that we might have encountered a bug in ProtocolLib

#

Unless...

#

Wait let me double check sth

civic sluice
hybrid turret
#

but tbh respawn() should work as far as i understand the CraftPlayer code

#

wtf

junior cradle
#

Maybe the problem is in the id entity?
Did I come up with it randomly? 2004

brittle geyser
#

Binvix hello

lost matrix
brittle geyser
#

How to get highest block (not bedrock) in nether?

lost matrix
echo basalt
#

unless you want roof

brittle geyser
lost matrix
brittle geyser
#

What is height map and can i use it for resolve my question

hybrid turret
#

anyway, fuck it for today. it's like almost 12am i got work tomorrow. gnight yall

lost matrix
junior cradle
brittle geyser
#

The highest block that blocks motion or contains a fluid.
MOTION_BLOCKING,
The highest block that blocks motion or contains a fluid or is in the
MOTION_BLOCKING_NO_LEAVES,
The highest non-air block, solid block.
OCEAN_FLOOR,
The highest block that is neither air nor contains a fluid, for worldgen.
OCEAN_FLOOR_WG,
The highest non-air block.
WORLD_SURFACE,
The highest non-air block, for worldgen.
WORLD_SURFACE_WG,

pliant topaz
#

ty soooo so much

hybrid turret
kindred sentinel
#

I want to generate a server resource pack using plugin, is there any examples/tutorials? Cause I dont even know where to start

hybrid turret
#

ping me once you answer. i'll see it tomorrow, thanks <3
@civic sluice

lost matrix
topaz cape
topaz cape
# topaz cape has anybody managed to get http://hotswapagent.org to work on their mc plugin? ...
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007fffd6a6ac46, pid=13976, tid=16496
#
# JRE version: OpenJDK Runtime Environment AdoptOpenJDK (11.0.10+5) (build 11.0.10+5-202103242225)
# Java VM: Dynamic Code Evolution 64-Bit Server VM AdoptOpenJDK (11.0.10+5-202103242225, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# V  [jvm.dll+0x46ac46]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Ahmed\Desktop\Sprac test\hs_err_pid13976.log
#
# If you would like to submit a bug report, please visit:
#   https://github.com/AdoptOpenJDK/openjdk-support/issues
#```
topaz cape
kindred sentinel
young knoll
#

No

kindred sentinel
#

Hm

young knoll
#

You need to spin up a little http server

lost matrix
#

Im starting a simple http server and serve it

kindred sentinel
#

Like plugin is making resource pack spinning up server loading there a resource pack, and use it after that?)

lost matrix
#

Sure, you can start an http server in java, lol
Thats one of the main use cases for java in the first place

kindred sentinel
#

Ok thanks!

echo basalt
#

good ol' jetty

worthy yarrow
#

https://paste.md-5.net/vonusulula.java

So I've got a preexisting itemstack (chicken_pet), every second that it's in a players inventory I have to modify it's meta to update the exp and level. What I'm wondering is if the process of this function thread safe?

echo basalt
#

Thread safety in itemstacks cringe

#

why is everything static

inner mulch
worthy yarrow
#

The thing I'm concerned about is after the modifications, I have to reinstate the itemstack to players inventory

lost matrix
#

Im doing it the good old fashined way XD

echo basalt
inner mulch
#

what?

inner mulch
worthy yarrow
#

Unless I'm dumb, I thought runTaskTimer was not ran on main thread?

#

Or wait

inner mulch
#

runTaskTimerAsync is not on main thread

worthy yarrow
#

thats the

#

async

#

yeah

#

I forgot

hybrid turret
worthy yarrow
civic sluice
lost matrix
#

I mean... that still pretty recent, no?

worthy yarrow
#

And even then what significant changes occurred between these periods

lost matrix
#

lots of API

worthy yarrow
#

Maybe deprecation of methods but beyond that anything else?

#

Majority is quite similar aint it?

civic sluice
hybrid turret
#

Ph

#

Oh

hybrid turret
naive meadow
#
            new BukkitRunnable() {
                @Override
                public void run() {
                    try {
                        Islands dbIsland = islandsDao.queryForId(islandUUID);
                        if (dbIsland == null) {
                            dbIsland = new Islands(islandUUID, 1);
                            islandsDao.create(dbIsland);
                        } else {
                            if (dbIsland.getMinionCount() <= plugin.getConfiguration().getIsland().getMinionLimit()) {
                                dbIsland.setMinionCount(dbIsland.getMinionCount() + 1);
                                islandsDao.update(dbIsland);
                            } else {
                                Bukkit.getScheduler().runTask(plugin, () -> {
                                    event.setCancelled(true);
                                    player.sendMessage(MiniMessageUtils.colorize(plugin.getConfiguration().getIsland().getReachedLimit().replaceAll("\\{PRFX}", plugin.getConfiguration().getPrefix()).replaceAll("\\{COUNT}", plugin.getConfiguration().getIsland().getMinionLimit().toString())));
                                });
                            }
                        }
                    } catch (SQLException exception) {
                        plugin.getLogger().severe(exception.toString());
                    }
                }
            }.runTaskAsynchronously(plugin);
``` Hi i am making a plugin and I want to cancel an event. ReachedLimit message getting sent to the player but event is not getting cancelled, I think problem is about async and sync tasks but iI cant find what causes it.
#

If I remove all the code and only put event.setCancelled(true); it gets cancelled normally.

lost matrix
#

Is there a way to prevent anonymous classes without making a class final?
Because i would love to PR that to spigot for BukkitRunnable right about now.

lost matrix
#

You cant retrospectively cancel an event

inner mulch
naive meadow
lost matrix
ivory sleet
#

u seal it and then delegate to some subclass

#

Far from perfect

#

And may have retrocompat issues

#

but yea

#

Just off my head

lost matrix
#

I just want those monster anonymous classes to stop distilldowo

ivory sleet
naive meadow
lost matrix
#

Which problem exactly?

civic sluice
naive meadow
lost matrix
# naive meadow Problem is I cant cancel the event.

And you never will unless you completely change your approach.
Either you prevent any IO (like database access)
or you always cancel the event and update the result manually after checking async. (Which will appear like lag depending on the event)

worthy yarrow
#
public static void addExperience(UUID petId, int xp, ChickenPet chickenPet, Player player) {
            int slot = findPetInInventory(player, petId);
            if (slot >= 0) {
                int currentXP = petExperience.getOrDefault(petId, 0) + xp;
                petExperience.put(petId, currentXP);
                int newLevel = calculateLevel(currentXP);

                ItemStack item = player.getInventory().getItem(slot);
                ItemMeta meta = item.getItemMeta();
                List<String> lore = new ArrayList<>();
                lore.add(ChatColor.GRAY + "Experience: " + currentXP);
                lore.add(ChatColor.GRAY + "Level: " + newLevel);
                meta.setLore(lore);
                item.setItemMeta(meta);

                player.getInventory().setItem(slot, item);

                if (newLevel > chickenPet.getPetLevel()) {
                    player.sendMessage(ChatColor.GREEN + "Your Chicken Pet has leveled up to level " + newLevel + "!");
                    chickenPet.setPetLevel(newLevel);
                }
            }
    }```
naive meadow
civic sluice
lost matrix
naive meadow
lost matrix
naive meadow
#

a player needs to place minion

#

so chunks will be loaded

lost matrix
#

Then dont do any DB requests like that.
When the player joins, load all his data from your DB into memory and use it sync.
When he quits, save it back to your DB.
No reason for random database lookups on runtime.

worthy star
#

hi

naive meadow
worthy star
#

im making quests thing
i want to have a certain block for mining quests, should i use Material, Block or ItemStack

#

for private Block block;

#

and this

        public QuestBuilder setBlock(Material material) {

        }``` im making a builder pattern for it so..
lost matrix
#

Use BlockData or Material

worthy star
#

alright thx

#

whats better?

#

iirc they're almost the same

#

no?

junior cradle
#

@lost matrix Did it work?

lost matrix
# worthy star no?

Depends on how granular this needs to be.
The most modular approach would be adding a Predicate<Block> to be honest.
But you probably want a simple quest system. So Material should be fine.

lost matrix
echo basalt
#

I don't like this structure

worthy star
#

why not

lost matrix
#

Let him cook

echo basalt
#

sure I guess let him cook

naive meadow
worthy star
#

._.

echo basalt
#

But ideally you should have an aggressive separation of concerns

worthy star
#

i think i'll do burnt food

lost matrix
#

Peridocally save it to minimize risk

echo basalt
#

For a quest system to be nice you need to split it into

  • Quest objectives
  • Quest Metadata (display name whatever)
  • Quest requirements (Permissions, playtime, previous quests complete)
  • Quest rewards (Commands / Items / Whatever)
#

And you can add more fancyness to it like restrictions (You have an hour to complete this)

worthy star
#

an hour!!!!!???

echo basalt
#

an hour to complete a quest

worthy star
#

should i make a class for each thing?

echo basalt
#

or an objective

#

whatever

#

Yes

worthy star
wary harness
#

Recomendation for good GUI lib ?

echo basalt
#

Each objective should be able to render its progress for a given player

#

And some other stuff

lost matrix
#

?gui

lost matrix
#

Or something like Triumph. But ive gotten out of touch with libraries honestly.

echo basalt
lost matrix
#

Wait, no trigger type? When do track the progress?

echo basalt
lost matrix
#

startTracking probably registers it somewhere...

worthy star
#

is that a plugin you have?

echo basalt
#

I was gonna make it open source as part of like a job interview thing

#

and then I got commissioned to make a quest plugin that was basically 1:1 but needed a couple changes

#

which was mostly just nuking all the menus and making it linear

#

so I said fuck it and cashed in

lost matrix
echo basalt
#

Correct

#

And when I reload I dispose the event bus, create a new one and do stuff

#

I can also dispose individual uh

#

subscribed listeners

worthy star
#

dam whats your mc dev experience

#

or java

echo basalt
#

a few years

lost matrix
#

Im not gonna throw SOLID at you for this...

echo basalt
lost matrix
#

But i would argue that the single responsibility is cowering in a corner right now

echo basalt
#

Yeah the objective system is a little dubious but the end result is fairly clean

#

rest is flawless though

lost matrix
#

It looks nice

echo basalt
#

I also have an item filter system for a lot of the uh

#

item related objectives

#

I overengineered the fuck out of it

river oracle
lost matrix
#

I hope they all inherit from Predicate<ItemStack>

echo basalt
#

They do

lost matrix
#

Alright

echo basalt
lost matrix
#

This is important for serialization

echo basalt
#

(who's gonna serialize a predicate)

lost matrix
#

If you want to serialize an item quest objective, then it probably contains a Predicate<ItemStack>.
Which can be serialized if its an actuall runtime implementation.

echo basalt
#

who's gonna serialize an objective

#

whatever there are crazy people for everything

lost matrix
#

I guess you could just keep your server running forever?

echo basalt
#

Quests are loaded once?

#

They're uh

#

configurable

lost matrix
#

What if you want to dynamically...

#

Wait what?

#

I see

echo basalt
lost matrix
#

So nobody has an instance of a Quest, they just have the progress for that quest. (which gets thens serialized)

echo basalt
#

Correct

#

Quests and objectives are loaded once

lost matrix
#

Works if you dont have quests generated on runtime. Really depends on the server concept.

echo basalt
#

You can just have multiple quests set up and then set them on demand?

#

No clue what you mean by runtime generated quests

#

I did want to make a quest menu and it'd just create objectives that could then dump their settings on a config

lost matrix
#

Eg daily random quests. Which could have compond objectives.

civic sluice
#

configure & reload quests

echo basalt
#

Quest reloading is a thing

#

Compound objectives can be made by just proxying stuff

#

Randomly generated quests uh yeah you just make a factory method that generates settings within the allowed params

#

Per-player objectives yeah that gets more complicated

lost matrix
#

Someone has experience with GANs or VAEs? Im thinking about applying latent diffusion on a voxel space.
Basically instead of generating images with text, you would generate buildings, trees etc using a prompt.

#

But im uncertain about the auto encoding into latent space and how to create semantic groups in it for interpolation

#

Ill ask my ML prof tomorrow if i can hog the Leibniz data center GPUs for this XD. They are unused for the next few weeks.

echo basalt
#

imagine having experts around you smh my head

#

Why use research equipment when I can convince the customer to install a 4090 in prod

lost matrix
#

lul

#

Yeah generation might be a problem honestly. Diffusion on CPUs is slow af.

#

Maybe if i have a really small latent space.

#

Well see. Im gonna hit the hay. See ya

remote swallow
#

dont hit the hay

#

what did it do to you

worthy star
#

yo smile, is this something private or an api you have for subcommands?

remote swallow
#

looks like acf

worthy star
#

acf?

remote swallow
worthy star
#

yup

#

i just checked source code and it is

#

A modern approach to inventory GUIs isn't an api?

#

lol

hybrid turret
#

No it‘s basically a tutorial

oblique kettle
#

hi, is there any way to check whether a PlayerInteractEvent directly results in a block place?

young knoll
#

Not easily

#

You’d have to check if the held item is placable, and then if the placement location is valid

echo basalt
#

What's the end goal?

young knoll
#

Because you use the text field for text displays

warped shell
#

yes but it is a Nameable so why wont it show?

young knoll
#

I don’t think any display entities show their custom name

warped shell
#

ye but i want to know why...

#

the text fields are nice and all but i kinda dont wanna have to remake what already works

young knoll
#

Idk ask Mojang

topaz cape
#

People I can't get hotswap to work on my machine

#

tried 1.8.8 - 1.20.4

#

not all in between just both those vers

#

tried java 17 and 11

#

nothing works

#
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff800a1552a, pid=5784, tid=12316
#
# JRE version: OpenJDK Runtime Environment JBR-17.0.10+1-1087.23-jcef (17.0.10+1) (build 17.0.10+1-b1087.23)
# Java VM: OpenJDK 64-Bit Server VM JBR-17.0.10+1-1087.23-jcef (17.0.10+1-b1087.23, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# V  [jvm.dll+0x4d552a]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
JNI global refs:
JNI global refs: 113, weak refs: 22797

JNI global refs memory usage: 1539, weak refs: 229865```
#

always this

echo basalt
#

you can just

#

not

topaz cape
#

not wot

echo basalt
#

use it?

topaz cape
#

not hotswap?

tacit inlet
#

hi i'm working on playerrespawnevent with folia but nothing works, do someone knows why?

echo basalt
#

this isn't the right place to ask for paper stuff

topaz cape
#

do you have an alternative?

carmine mica
#

what kind of changes are you doing that you are trying to hotswap

echo basalt
#

Well you're asking for jvm crash help on a minecraft development server

carmine mica
#

all long as they aren't method additions/deletions, the regular debugger in intellij attached to the normal java process works fine

topaz cape
#

thats all

carmine mica
#

you don't need anything "extra" for that

topaz cape
#

no im testing with that so I can add all the methods i want

#

😄

carmine mica
#

I haven't bothered setting up using jetbrains' runtime directly, but apparently if you use it, you can do that

topaz cape
#

im already running the JBR jdk

carmine mica
#

XX:+AllowEnhancedClassRedefinition

topaz cape
#

got that already

carmine mica
#

well idk, I was just reading that from a medium article. I've never set it up myself

#

idk if remote debugger or direct matters here

#

also the usual situation with relocations and what not not working with debugging

young knoll
#

I attach remotely and it works fine

#

Using the jetbrains jdk 17 and the jetbrains runtime stuffs

inner mulch
#

How do ppl save minigame maps to a database

worthy yarrow
#

If I iterate through all online players inventories to check for my custom items async, is that alright?

inner mulch
#

I dont think you can do thqt async

worthy yarrow
#

hmm

#

Is it a bad idea to iterate through all inventories on a task even if I'm only doing minimal functions

inner mulch
#

Depends on how often and what ur doing there

echo basalt
inner mulch
#

Ok, so not worth it to code it by myself?

echo basalt
#

uh no

worthy yarrow
#
public static void managePlayersWithPets(){
        new BukkitRunnable() {
            @Override
            public void run(){
                List<Player> currentPlayersWithPets = new ArrayList<>();
                for (Player player : Bukkit.getOnlinePlayers()){
                    boolean hasPet = getChickenPets().entrySet().stream().anyMatch(entry -> isPetInInventory(player, entry.getKey()));
                    if (hasPet) {
                        currentPlayersWithPets.add(player);
                    }
                }
                playersWithPets.clear();
                playersWithPets.addAll(currentPlayersWithPets);
            }

        }.runTaskTimer(CoolPets.getPlugin(CoolPets.class), 20L, 300L);
    }```
I'm creating a list, adding all players found with a pet, clearing a constant list, and adding all players with a pet to the constant list. Every 15 seconds
inner mulch
#

I wouldnt track pets like that

worthy yarrow
#

like a cosmic soul gem?

inner mulch
#

Idk whats that?

worthy yarrow
#

It's a pvp gem where you use souls to allow activation of certain enchants

#

But in the sense of tracking activation of soul use, you right click

inner mulch
#

Ok

#

In conclusion, i wouldnt recommend using a runnable for that. You could also track it on item pickup it serms like your pets are Items, check if some1 has picked up a pet and then add them

#

This would be much more efficinet

#

Or track the inv changed overall wenn using chests

worthy yarrow
#

The point was to avoid having to write these things haha

worthy yarrow
#

I was thinking of just doing inventoryClickEvent, any time you right click -> toggle on/off, I wasn't sure how to detect right clicking it in your hand? PlayerInteractEvent?

visual laurel
#
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event){
        Player p = event.getPlayer();
        GameState currentGameState = plugin.getGameState();
        if (currentGameState.toString().equals(GameState.SEEKING.toString())){
            plugin.getLogger().info("Equal");
            p.setGameMode(GameMode.SPECTATOR);
        }
    }```

Why is this outputting Equal in console but not switching their gamemode to spectator?
glad prawn
#

try set on next tick 🤷‍♂️

visual laurel
#

👍 ill try that

dawn flower
#

is this the best way to tell the difference between a fake block and a real block? i know that if i do location.getBlock it'll be AIR for fake blocks and whatever for real blocks but my packet listener isn't fast enough to call the event before the block is gone so it's always AIR
https://paste.md-5.net/amijoduxat.cs

valid burrow
dawn flower
#

if (currentGameState == GameState.SEEKING)

dawn flower
dawn flower
glad prawn
#

🤔

agile anvil
#

And does that mean that you're using the hashmap async?

dawn flower
# agile anvil Are you checking that async?

i was calling the event synchronously before so when the listeners received the event the block would already be gone but now since it's async it gets called before the block is gone so i can check if the block at that location is air which means it's a fake block

#

without using hashmaps

#

if that makes any sense

#

wait what? in a project 'PlayerEvent(Player, boolean)' is public and in the other project it isn't

#

both use 1.20.1

#

oh that's spigot and that's paper oops

quaint mantle
#

Can someone tell me how to deal with java.lang.NoClassDefFoundError: org/apache/commons/collections4/map/ReferenceMap?
It think has to do with the dependency, but neither implementation nor compile works rn. I already had this a few years ago and fixed it with using shadowing, but I dont know how it works in the newer gradle versions.

agile anvil
quaint mantle
agile anvil
#

How do you build your project?

#

Do you use the shadow graddle task?

quaint mantle
#

just with gradle build task

agile anvil
#

I haven't use shadow with graddle but I think there is a shadowJar task

quaint mantle
#

ah i restartet eclipse and now there is a shadowJar task. but it still doesnt work sadly

tidal glacier
#

Hey @quaint mantle

#

Heyv@agile anvil

quaint mantle
agile anvil
#

Can you open your generated jar file with a zip software and check if the apache collections is included in it?

tidal glacier
#

Hey, actually I need a little help in plugin translation

#

I can even pay

valid burrow
#

makes your life 10x easier

hybrid turret
#

felt

hybrid turret
valid burrow
#

what do you need

quaint mantle
blazing ocean
valid burrow
blazing ocean
#

idk i'm having fun with gradle

upper hazel
#

what better stream api or removeIf in bukkit

quaint mantle
blazing ocean
#

has always usually worked for me

#

except for when I switched to the kotlin diesel

quaint mantle
#

do u know by any chance how shadowing works?

blazing ocean
#

you set your tasks to depend on shadowJar and reobfJar

#
tasks {
    named("assemble") {
        dependsOn("shadowJar")
        dependsOn("reobfJar")
    }
}
quaint mantle
blazing ocean
#

uh it might be a paperweight userdev thing i'm using

#
shadowJar {
    relocate 'a', 'b'
    //minimize()
}

tasks.assemble {
    dependsOn shadowJar
    dependsOn reobfJar
}
#

this is how it would look in groovy ^^

#

you can use minimize() but it can break reflection-y stuff

blazing ocean
quaint mantle
#

cant I also use ?

    enableRelocation true
    relocationPrefix "..."
}
blazing ocean
#

what

#

is that grotlin

quaint mantle
#

isnt it?

#

just thought about that

blazing ocean
#

it looks like groovy + kotlin together

#

but weird

quaint mantle
#

ah ur right wait

#

but for some reason eclipse doesnt cry when reloading

#

it just still doesnt work lol

blazing ocean
#

can you send me your current setup

quaint mantle
blazing ocean
#

;-;

#

first up, you're using kotlin script in groovy

#

second up, you're using it wrong

quaint mantle
#

sadge

blazing ocean
#
tasks.named('assemble') {
    dependsOn("shadowJar")
}
 
tasks.named('shadowJar') {
    enableRelocation true
    relocationPrefix "///"
}
shadowJar {
    relocate 'a', 'b'
}

tasks.assemble {
    dependsOn shadowJar
}
#

try something like the bottom one

#

you can't use kts in groovy

quaint mantle
#

just by the way. the relocation even worked

hybrid turret
#

?nms (for me)

tidal glacier
agile anvil
#

What do you want to translate ?

tidal glacier
#

my plugin!

hybrid turret
#

ooooh damn i'm out for turkish. no knowledge there, sorry

tidal glacier
#

its in turkish language

#

i want to translate from turkish to english

#

can anyone help?

valid burrow
#

so you need someone that speaks english?

tidal glacier
#

please........

valid burrow
#

sure i can help

tidal glacier
#

but I dont know how to translate

quaint mantle
#

tf

valid burrow
tidal glacier
#

i just have the plugin

#

not source code

tidal glacier
#

i bought from a developer

valid burrow
#

does the plugin have a config for text?

tidal glacier
#

no

#

?

#

dm?

hybrid turret
#

then how would you be translating it? lol

tidal glacier
#

thats a problem

#

if you can make a new plugin

#

whcih translates

#

or do something

quaint mantle
tidal glacier
#

copy code

tidal glacier
valid burrow
#

u can easily get the source from the jar but i wouldnt recommend that

hybrid turret
#

iirc that's copyright infringement

valid burrow
#

ask the dev for the source code

valid burrow
tidal glacier
valid burrow
hybrid turret
#

oh-

#

what

tidal glacier
#

he sold me the mdods but dosent have the source code

#

can anyone help?

valid burrow
#

mods??

#

or plugins

quaint mantle
#

plugin or mod now?

hybrid turret
#

how tf does he not have the source anymore? what kinda dev is that?

quaint mantle
#

a interesting one. would love to see what his room looks like

valid burrow
#

my guess is that its not his plugin lol

tidal glacier
#

i am a youtuber

#

i bought it from my developer

echo basalt
#

But yeah the entire plugin is like 6 classes and all the messages are hardcoded on the main class which is good and bad

tidal glacier
#

This is my main I'd actually @echo basalt

echo basalt
tidal glacier
#

Please @echo basalt

blazing ocean
#

what the fuck happened here

quaint mantle
#

im still frustrating

#

it shadows every apart from apache commons

echo basalt
#

Maven or gradle?

quaint mantle
#

gradle

echo basalt
#

Show build.gradle

quaint mantle
#

okay what

#

I changed nothing and it randomly works now.

#

just got another coffee and tried it again

#

I think I might need a therapy now

valid burrow
#

wdum with prefix? the identifier?

#

well an nbt tag without an identifier wont work

agile anvil
#

Why do you even want to do that?

valid burrow
#

why are u using nbt for that

#

u said to make ur plugins compatible

#

i mean if you have multiple plugins working with the same custom items or the same tasks in general they should just depend on each other on code level

#

makes everything 10 times easier

#

how did you setup nms

#

you need to do more than just adding it to mavne

#

read this

#

?nms

hybrid turret
#

100% forgot to run remapped BuildTools

valid burrow
hybrid turret
#

confused me in the beginning as well but makes total sense

#

I'm trying to store Inventories with items in an sqlite db. I know I somehow have to use JOIN but i can't wrap my head around it ffs

#

tbh maybe i should actually create a relational db model

echo basalt
#

uh

#

yeah prob learn the basics of sql

hybrid turret
#

i know the basics of sql lol

echo basalt
#

Then you should know you don't need a join

hybrid turret
#

if i'm honest this was thinking out loud without thinking why i would write it here

hybrid turret
#

Item table and Inventory table

#

join the items into the inventory, no?

#

(also iirc it was said on this discord lollll)

upper hazel
#

why item.getOwner always null

hybrid turret
#

context?

upper hazel
#

droped item

#

item entity

#

not has owner

hazy parrot
#

Afaik owner is set for example when u use /give but your inv overflow

hybrid turret
upper hazel
#

bruh

hybrid turret
#

Owner is not the one that dropped the item

#

I guess that's Item#getThrower

hybrid turret
hybrid turret
#

as?

valid burrow
#

hash for example

upper hazel
#

oh nice this work

hybrid turret
# valid burrow hash for example

actually now that we're at that topic: hashes.
Are they so unique that they even store the values of an object?

Like: if i were to store an ItemStack as a hash and i would give you said hash, would you be able to create the exact ItemStack object from said hash?

#

wdym by "add"?

#

you have to execute BuildTools by running this command in your command line

agile anvil
#

You have to serialize and deserialize the itemstack

hybrid turret
#

download the BuildTools.jar, use your terminal, to the BuildTools.jar-Location (preferrabely in its own folder bc it will generate several folders and files) and run said command

hybrid turret
agile anvil
#

I was just talking of hashing

#

But indeed SQL databases are not meant for that

#

But serializing an inventory to SQL database would require 3 tables

hybrid turret
#

3?

agile anvil
#

One inventory (id, size, name, ..)
One items (id, type, name, lore, amount, echants, tags, ...............)
One "link" that link item ids to inventory id

gleaming grove
tidal glacier
#

Hi

agile anvil
hybrid turret
agile anvil
#

But we have to admit it's easier

agile anvil
hybrid turret
#

it is easier, but i don't want this to be easy, i want this to be somewhat efficient

hazy parrot
#

There is no reason for linkage table, it's not n:n relation

hybrid turret
#

(which is also the reason that eventually there will be 2 releases of the plugin. one with mysql and one with sqlite)

agile anvil
#

I think the one string would be more efficient

hazy parrot
#

But tbh I would just base64 it

agile anvil
#

Cause you need only one fetch

hybrid turret
#

did that before, did funky things fsr idk why

hybrid turret
#

this fucking inventory thing has been plaguing me for months now lmao

gleaming grove
hybrid turret
#

json isn't meant for data storage

gleaming grove
#

Not json

#

Base64

hybrid turret
#

how would you serialize the inventory with Base64?

#

also that would yet again just be a massive string, no? 🤔

gleaming grove
#

Base64 string would have size at least 100 characters. But that would takes less disk space then X Rows in database

hybrid turret
#

ppl are saying contradicting things AAAH

#

stawp

valid burrow
#

well

#

simple and long answer

valid burrow
#

i have a class for that somewhere but i forgor where exClry

valid burrow
#

he will make you a good method

hybrid turret
#

tbh fuck gpt for coding, lol. made too many shit experiences with it. 3.5 and 4

hybrid turret
#

one question to ByteArrayInputStream#read... i'm guessing it automatically goes to the next index after executing a read statement? (just to understand how things work)

gleaming grove
#

yes, it is iterator

hybrid turret
#

ahhh right

#

iterator 💡

#

thanks

trim lake
#

Hi, Im making new plugin and want to ask for opinion on coding. Plugin will contains some class witch will store some values in map. There is my question: should I make this class static or I should get one instance in main class and access that instance probably with static getter from main class? In past I made class like this static.

valid burrow
#

the only methods and classes that should be static are utils and maybe manager classes

trim lake
#

So second option in my question bascily. Bcs I made some plugin previosly and I made that class static so... I saw most of plugins is not doing like that, thats why I asked.

valid burrow
#

its still better to not make it static

#

you CAN but i wouldnt

trim lake
#

Basicly this is sniped of the class:

private Map<Material, Double> materialValues = new HashMap<>();

    public void setItemWeight(Material material, double weight) {
        materialValues.put(material, weight)
    }

    public double getItemWeight(Material material) {
        return materialValues.get(material);
    }
trim lake
echo basalt
#

Do you see the word static anywhere?

trim lake
#

this is example

#

if that should be static or not

valid burrow
echo basalt
#

It shouldn't

#

And you shouldn't have static getters on your class

#

And I'd advocate for not even having a static getInstance of your main class (singleton)

trim lake
echo basalt
#

And instead just Dependency Injecting everything

valid burrow
gleaming grove
# trim lake depends, that value will be set and getter by command
     public class MyPlugin extends JavaPlugin
    {

  
        @Override
        public void onEnable() {
            PluginStorage storage = new PluginStorage();
            CommandsListener listener = new CommandsListener(storage);
            listener.onCommand();
        }
    }
    
    public class PluginStorage
    {
        @Getter
        private Map<String,Object> map = new HashMap<>();
    }

    public class CommandsListener
    {
        private PluginStorage plugin;

        public CommandsListener(PluginStorage plugin) {
            this.plugin = plugin;
        }

        public void onCommand()
        {
            Map<String,Object> myMap  =plugin.getMap();
        }
    }

You can pass instance object of the class that has this map to your command listener

echo basalt
#

Well no

#

The map shouldn't be held on the main class

gleaming grove
#

yes

echo basalt
#

It should be encapsulated by another class

valid burrow
#

thats what he says hes doing lol

#

he never said its in the main

echo basalt
#
public class MyPlugin extends JavaPlugin {

  private MyManager myManager;

  @Override
  public void onEnable() {
    this.myManager = new MyManager();
  }

  public MyManager getMyManager() {
    return this.myManager;
  }
}

public class MyManager {

  private final Map<UUID, Whatever> dataMap = new ConcurrentHashMap<>();

  public Whatever getWhatever(UUID playerId) {
    return this.dataMap.get(playerId);
  }

  ...
}
trim lake
# echo basalt And I'd advocate for not even having a static getInstance of your main class (si...

hmmm, I was thinking to do in main class like this:

    private static RealWeight plugin;
    private static WeightManager weightManager;

    @Override
    public void onEnable() {
        // Plugin startup logic
        plugin = this;
        weightManager = new WeightManager(plugin);

        this.saveDefaultConfig();

        this.getCommand("weight").setExecutor(new WeightCommand(this));
        this.getCommand("inventoryweight").setExecutor(new InventoryWeightCommand(this));



    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }

    public static RealWeight getInstance() {
        return plugin;
    }

    public static WeightManager getWeightManager() {
        return weightManager;
    }

or just make that #getWeightManager to not static. I would use RealWeight.getWeightManager() in other classes but thats probably bad practice

trim lake
echo basalt
#
public class MyListener implements Listener {

  private final MyPlugin plugin;

  public MyListener(MyPlugin plugin) {
    this.plugin = plugin;
  }

  @EventHandler
  public void onWhatever(WhateverEvent event) {
    this.plugin.getMyManager().getWhatever(...);
  }
}
valid burrow
valid burrow
#

please save default config first

#

i bet theres stuff in your config you need so

#

if you save it last

#

that

#

kinda doesnt make sense loo

trim lake
#

Its good enought if I send my main class for ex. to CommadClass and then I will do in command class like this:

private final RealWeight PLUGIN;

    public InventoryWeightCommand(RealWeight plugin) {
        this.PLUGIN = plugin;
    }

    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
        PLUGIN.getWeightManager(); //DO SOMETHING WITH THAT
        return false;
    }

its thaat oke<

valid burrow
#

why is your onCommand listener in your main

trim lake
valid burrow
#

why not before the manager if i may ask always easiest to place it first

trim lake
trim lake
valid burrow
trim lake
trim lake
#

nop lol

valid burrow
#

thought this was 1 class

trim lake
#

nop that private final RealWeight is variable so I will be able acces plugin in that class

valid burrow
#

mhmhm

trim lake
#

I need to get that manager thats why Im sending instance of RealWeight to command class

trim lake
#

so I did that wrong when I made my previous plugins and class like this was static lol, thanks that why I asked to not make same mistake again

#

and probably in that case... I will not need getInstance() thats bad practice as well isnt it? if not I can do RealWeight.getInstance().getWeightManager() in other classes but I guess thats wrong as well

#

So I was doing thinks wrong lol. Thanks guys for info!

#

Btw. It is wrong if I will save data from .yml file to Map? Or its okey to access that file every time to get something? Someone told me Im saving values twice basicly If I will put it in the map

inner mulch
#

Cache them

#

Access the file on plugin start

trim lake
#

so its good to put them to map? oke thanks

inner mulch
#

Yes

shadow night
#

Just use the FileConfiguration class?

inner mulch
#

You should probably impl a command to reload thr values tho so the config can be chsnged on runtime

hybrid turret
#

why would you need that if you store them in a map anyway?

trim lake
inner mulch
#

No

#

Cache it

trim lake
trim lake
shadow night
#

Use the FileConfiguration class to store your config

#

Using a map is overcomplication of simple things

hybrid turret
#

ohh

#

that's what you meant by update command

trim lake
hybrid turret
#

i see, i misunderstood

shadow night
inner mulch
#

I would still use maps

hybrid turret
#

i agree

shadow night
hybrid turret
#

maps are quickkkk

inner mulch
#

Maps better

shadow night
#

The FileConfiguration class exists for the purpose of making config files easier

inner mulch
#

Ok

shadow night
#

Storing it in a map is absolutely pointless

trim lake
#

I had same fight with someone who said: "but that values are already in ram and u are basicly saving them twice"

hybrid turret
#

Also why FileConfiguration instead of YamlConfiguration? I suppose we're talking about yaml files?

shadow night
#

And that thing most likely stores a map internally too, so you are just making things harder by using a map

hybrid turret
#

YamlConfiguration is also from bukkit

shadow night
#

Just use FileConfiguration

inner mulch
#

Maps

#

Hashmap

shadow night
#

Store the FileConfiguration in a variable, retrieve it whenever you need access to the config and override it whenever you call a reload command or whatever

trim lake
inner mulch
#

Just use a map

#

Looks cleaner

#

Than .getint

shadow night
#

Lol no

inner mulch
#

Or somethign

shadow night
#

You are literally overcomplicating stuff for no reason

#

There are classes that do everything for you

#

It makes no sense to use a map

inner mulch
#

Ok

hybrid turret
#

oh god, just ping illusion or 7 at this point lmao

shadow night
#

A map will not give you whatever this is and it will also not let you get values by .get("thing.something.key") but rather .get("thing').get("something").get("key") or something like that

hybrid turret
#

fair point, there IS a map stored in MemorySection

shadow night
#

Yep

hybrid turret
#

touche

shadow night
#

It abstracts the shit away so you don't have to strugle with casts and deseralizations

hybrid turret
#

BUT it's still important to store the value of JavaPlugin#getConfig in a variable to not keep reloading it

shadow night
tired star
#

I have this plugin for pvp that gives certain players the ability to strike lightning. i implemented it using the bukkit's strikeLightning method. Is there a way to disable the AOE damage done by the lightning for the caster? afterall I would like the lightning to do damage all other players except the caster, so I wouldn't like to change the implementation to the strikeLightningEffect and just setDamage

hybrid turret
#

yea

#

just wanted to repeat it so ppl get the point (bc who would scroll all the way up to there)

hybrid turret
#

is it PlayerDamageEvent?

#

It's something like that

tired star
agile anvil
hybrid turret
#

oh shit you're right

#

hmm

tired star
tired star
agile anvil
#

Oh then that's perfect

#

But what if two players launch strike in the same time?

shadow night
#

Since lightning is an entity, couldn't you give it some pdc/metadata to identify the sender?

hybrid turret
hybrid turret
#

it is??

tired star
shadow night
#

Lmao

#

I know that back from the days doing cmd blocks

tired star
#

yea lightning is entity

hybrid turret
#

nms entity tho, no?

tired star
#

nms?

agile anvil
#

indeed

#

bukkit entity

shadow night
#

Doesn't bukkit wrap all entities

hybrid turret
#

i can only find net.minecraft.world.entity.LightningBold

#

ahh

agile anvil
#

Then you can set the causing player @tired star

shadow night
#

??? getCausingPlayer

#

I didn't know that was a thing lol

hybrid turret
#

me neither loll

#

i'm wondering if that's automatically set

agile anvil
#

That's not

hybrid turret
#

probably not?

agile anvil
#

Doesn't require the source

tired star
#

I had a weird problem with that getCausing player so I did the UUID handling a bit differently

shadow night
agile anvil
shadow night
#

¯_(ツ)_/¯

#

Spawn it as an entity

agile anvil
tired star
#

could be

#

but yea thanks for the idea. im too sleepy still :D not enough coffee

shadow night
hybrid turret
#

bro i've been working (more or less) for almost 4 hours lol

tired star
#

couldnt get much sleep

shadow night
shadow night
tired star
#

:DDD

hybrid turret
#

o_o

tired star
#

shes a real woman, trust me

hybrid turret
#

mhm "woman"

#

"she"

#

suuuuuuuuuuuuuuuuuure

shadow night
#

Well

echo basalt
#

o_o

shadow night
#

Give them time, maybe they both are real and will come together lol

hybrid turret
#

that's a great time for illusion to come here hahahahahhaa

hybrid turret
echo basalt
#

this is some interesting programming help

shadow night
hybrid turret
#

but if i'm honst i thought he was joking ^^'

shadow night
tired star
#

:DD

hybrid turret
#

xD

shadow night
#

Lol

echo basalt
#

we should all gather and do a boys trip to thailand

tall dragon
echo basalt
#

ofc it is

#

I legit have bets with people

tired star
#

this is a great community

shadow night
echo basalt
#

where I'm bringing in money by talking about girls I met online and ppl are betting me 50$ I'm getting catfished

hybrid turret
echo basalt
#

easy grocery money right there

echo basalt
#

I am

#

2-0

tall dragon
#

how do you see through them!

hybrid turret
#

lmao

echo basalt
#

I shipped this chick a minecraft tshirt and she sent me a cute pic while wearing it

#

that's proof

#

ezpz

hybrid turret
#

HAHAHA

echo basalt
#

fiddy bucks

shadow night
#

Yk that meme where there are three different guys and they all are on a graph which goes up and then down and then the first is dumb, the middle is average and the third is like some linux hacker

echo basalt
#

And the minecraft store took so long to ship that I got the tshirt for free

tall dragon
#

well how much did the shirt cost

echo basalt
#

P sure I paid a solid uh

#

80$ for 2

echo basalt
#

free fiddy bucks

#

but yeah I got refunded because they took 2 months to ship

echo basalt
#

and never mention getConfig ever again

hybrid turret
#

LOL?

#

why?

tall dragon
#

free tshirt, free 50 bucks AND a cute pic

echo basalt
#

because it shouldn't be a thing

tall dragon
#

bro won

echo basalt
#

hell yeah

echo basalt
hybrid turret
#

you don't format with ctrl + s?

#

or "onSave"?

echo basalt
#

lol no

shadow night
#

ctrl + s does nothing for me

#

Ij moment

echo basalt
#

That'd straight up crash my pc given the amount of times I touch decompiled code

hybrid turret
tall dragon
#

i always do ctrl + alt + l, o when i finish a file as well

shadow night
echo basalt
shadow night
#

I have

echo basalt
#

Have you seen griefprevention's code?

shadow night
#

Prob shit

hybrid turret
#

i constantly hammer down ctrl + s, save the code + automatically format it

echo basalt
#

it's dogshit

#

I had to fork it

#

and make it nice

echo basalt
shadow night
echo basalt
#

I never have to be worried about saving code

hybrid turret
tall dragon
#

cuz intellij keeps that code safe for u without saving ever

trim lake
hybrid turret
shadow night
hybrid turret
#

but it only saves upon tabbing out or changing the working file

#

i have some sort of fucking autism, ican't stand if my code doesn't constantly look nice

#

(let's not talk about my kamehameha-if-phase)

echo basalt
#

Well

#

I don't usually have that issue

#

Because I uh

tall dragon
#

there is a few more events at which it saves

echo basalt
#

write nice code automatically

hybrid turret
echo basalt
#

Yeah that was like a one-off in the last solid 9 years

junior cradle
#

What is the best way to store inventory items in the database?
When the player makes any changes in the inventory or with Bukkit.runTimer() every 1 second?

echo basalt
#

uH

#

When a player logs off?

hybrid turret
#

idk if that's impolite, but how old r u illusion?

echo basalt
#

turned 19 a couple weeks ago

echo basalt
tall dragon
#

i would do every tick ngl

#

gotta keep in sync!

hybrid turret
#

bro is a nerd

echo basalt
#

I've been coding for over a decade

hybrid turret
#

(everyone younger and better than me is a nerd obv)

echo basalt
#

dw about it

hybrid turret
#

you started young young, holy

tall dragon
#

luckily i am older

#

no nerd

echo basalt
#

and you had a childhood, holy

hybrid turret
#

no

echo basalt
#

ayy that's my boy

junior cradle
# hybrid turret EVERY SECOND???

And making a request to the database every second will not load the database
All the more so I will grind everything to base64

hybrid turret
echo basalt
#

It's crazy what years and years and years of experience brings you

#

10 years ago I was writing shitty code

#

Nowadays I am paid pennies to fix even worse code

tall dragon
#

crazy indeed

hybrid turret
#

tbh i also started like when i was 13 or sum

hybrid turret
#

but that's "only" 7

tall dragon
#

10 years ago i was happy without problems

hybrid turret
echo basalt
hybrid turret
#

i'm not that intelligent ig xD

hybrid turret
echo basalt
tired star
#

I dont even remember what I did 10years ago

echo basalt
#

Got paid

hybrid turret
#

OH MY GOD

tall dragon
#

ilussion pov

echo basalt
#

8$

#

to translate it all from turkish to english

#

no packages no code no nun

hybrid turret
echo basalt
#

Only a decompiler and a hatred for the universe

hybrid turret
tired star
#

:d i wouldnt do that unless i would get free kebab or smth +8$

hybrid turret