#help-development

1 messages · Page 1278 of 1

thorn isle
#

at least it's an actual attribute now so we don't need to fuck with jump boost effects

chrome beacon
#

true

worthy yarrow
#

Wait so attributes like that actually affect rather client sided actions?

cedar marlin
#
        /*
         * (Blocks_Per_n_ticks / tick) * 20 = Blocks per Second
         *
         */
        Bukkit.getScheduler().runTaskTimer(Main.getPlugin(), () -> {
            if (!player.isOnline()) return;
            double speed = player.getLocation().distance(playerLocationHashMap.get(player).clone());
            double BLOCKS_PER_SECOND = (speed / tick) * 20;

            flyspeedHashMap.put(player, (short) BLOCKS_PER_SECOND); // CAN BE IGNORED

            String title = String.format("%.2f", BLOCKS_PER_SECOND) + "B/s";
            bar.setTitle(title);
            bar.setProgress(BomberJetRules.setBossBarProgress(BLOCKS_PER_SECOND));
            bar.setColor(BomberJetRules.setBossBarColorRules(BLOCKS_PER_SECOND));

            playerLocationHashMap.put(player, player.getLocation().clone());
        }, 0, tick);```

I'm trying to calculate the velocity of a player. It works fine but I face spikes during the process e. g in a constant flying speed the BossBar drops by 2 Blocks and goes back to the actual speed.
lean pumice
#

hey, LegacyComponentSerializer.legacyAmpersand().serialize give me the component with &a, &7 etc.. i want it with the real hex color, how i have to do?

worldly ice
lean pumice
worldly ice
#

that is paper api

#

this is the spigot discord

lean pumice
#

ah, spigot don't use component for new versions? sry

worldly ice
#

it does in some areas but it's not compatible with what paper uses

lean pumice
#

okok tnx

cedar marlin
sly flint
#

hey guys i want to change my project version
in intellij
how?

paper viper
gentle inlet
#

how can I cancel the book and quil gui opening when clicking a book as I did canceled the interaction event but it didnt work?

echo basalt
#

yooo batarong pfp

sullen marlin
#

Isn't it client side

chrome beacon
#

I believe it is

sacred cedar
#

hey does somebody know where the damage is calculated when the player/entity is wearing armor?

sullen marlin
#

Just search for EntityDamageEvent or something

sacred cedar
#

i did but i didn't find what i was looking for
i am looking for the method where it limitates the maximum armor value wich is caped at 30 but i want to increase it a bit and everything i am trying isn't working

vocal cloud
#

doing the calculation yourself is probably a better idea imo.

worthy yarrow
#

.getDamage in entityDamageEvent returns the calculated value, you can check item attributes of which are needed ie: armor

fathom dirge
#

Quick question. I'm working on a plugin that adds custom enchantments to the game that behave exactly like vanilla ones (as in being in the enchantment table etc...). I was wondering if you guys know a way to make an enchantment table still show possible enchantments even tho the item might not be enchantable. For example if i put a gold block into the enchantment table it should still send the possible enchantments of that item. Do i need to alter a value with NMS that makes it so the game thinks every item is enchantable?

young knoll
#

Probably something to do with tags now

worthy yarrow
rugged fern
#

Hey any idea why i got this error on bungeecord with maven? i shaded the language module but its still not working: 23:12:21 [INFORMATION] [/127.0.0.1:48288] <-> InitialHandler has pinged 23:12:23 [WARNUNG] Error dispatching event ChatEvent(super=TargetedEvent(sender=ItzYami04x, receiver=net.md_5.bungee.ServerConnection@66fdbf52), cancelled=true, message=/pl) to listener net.sabermc.module.commandblocker.listener.ChatListener@5296f00c java.lang.NullPointerException: Cannot invoke "net.sabermc.module.language.LanguageModule.getLanguageManager()" because the return value of "net.sabermc.module.language.LanguageModule.getInstance()" is null at net.sabermc.module.commandblocker.listener.ChatListener.onChat(ChatListener.java:26) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:565) at net.md_5.bungee.event.EventHandlerMethod.invoke(EventHandlerMethod.java:19) at net.md_5.bungee.event.EventBus.post(EventBus.java:49) at net.md_5.bungee.api.plugin.PluginManager.callEvent(PluginManager.java:448) at net.md_5.bungee.connection.UpstreamBridge.handleChat(UpstreamBridge.java:223) at net.md_5.bungee.connection.UpstreamBridge.handle(UpstreamBridge.java:207) at net.md_5.bungee.protocol.packet.UnsignedClientCommand.handle(UnsignedClientCommand.java:36) at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:151) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:293) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:359) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1429) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:793) at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.handle(AbstractEpollChannel.java:479) at io.netty.channel.epoll.EpollIoHandler$DefaultEpollIoRegistration.handle(EpollIoHandler.java:307) at io.netty.channel.epoll.EpollIoHandler.processReady(EpollIoHandler.java:489) at io.netty.channel.epoll.EpollIoHandler.run(EpollIoHandler.java:444) at io.netty.channel.SingleThreadIoEventLoop.runIo(SingleThreadIoEventLoop.java:204) at io.netty.channel.SingleThreadIoEventLoop.run(SingleThreadIoEventLoop.java:175) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:1073) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.base/java.lang.Thread.run(Thread.java:1447)

fathom dirge
#

you can just fetch them

worthy yarrow
rugged fern
# drowsy helm Can we see your Code

import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.ChatEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import net.sabermc.module.commandblocker.CommandBlocker;
import net.sabermc.module.language.LanguageModule;

import java.util.List;

public class ChatListener implements Listener {

    List<String> commands = List.of("/pl", "/plugins", "/version", "/help", "/v");

    @EventHandler
    public void onChat(ChatEvent event) {
        ProxiedPlayer proxiedPlayer = (ProxiedPlayer) event.getSender();

        if(!proxiedPlayer.hasPermission("commandblocker.bypass")) {
            String[] args = event.getMessage().split(" ");
            if(commands.contains(args[0].toLowerCase())) {
                event.setCancelled(true);
                proxiedPlayer.sendMessage(TextComponent.fromLegacy(CommandBlocker.getInstance().getPrefix() +
                        LanguageModule.getInstance().getLanguageManager().getMessage(proxiedPlayer.getUniqueId(),
                                "commandblocker.message")));
            }
        }
    }

}
fathom dirge
#

or at least try haha

worthy yarrow
#

Oh I saw a thing

#

Sec

sacred cedar
drowsy helm
#

are you using onEnable to initialise it?

young knoll
#

In modern versions you should be able to make any item enchantable

#

With NMS shenanigans

fathom dirge
#

Yeah thats what i thought as well

#

so lets try to do that without breaking the game

#

But just wanted to ask in case there was an easy workaround implemented in spigot

rugged fern
# drowsy helm are you using onEnable to initialise it?
package net.sabermc.module.language;

import net.sabermc.module.language.commands.LanguageCommand;
import net.sabermc.module.language.listener.LoginListener;
import net.sabermc.module.language.manager.LanguageManager;
import net.sabermc.moduleSystem.ModuleSystem;
import net.sabermc.moduleSystem.module.Module;

public class LanguageModule extends Module {

    private static LanguageModule instance;
    private String prefix = "§7[§bLanguage§7] §7";
    private LanguageManager languageManager;

    @Override
    public void onStart() {
        instance = this;

        languageManager = new LanguageManager();
        languageManager.init();

        ModuleSystem.getInstance().getProxy().getPluginManager().registerCommand(ModuleSystem.getInstance(), new LanguageCommand());
        ModuleSystem.getInstance().getProxy().getPluginManager().registerListener(ModuleSystem.getInstance(), new LoginListener());

    }

    @Override
    public void onStop() {}

    public static LanguageModule getInstance() {
        return instance;
    }

    public LanguageManager getLanguageManager() {
        return languageManager;
    }

    public String getPrefix() {
        return prefix;
    }
}
``` but im initialized the getInstance method
worthy yarrow
drowsy helm
fathom dirge
#

without actually checking its possible enchantments

young knoll
#

Yeah you gotta add the item to one of the enchantable tags

worthy yarrow
#

^

#

There’s gotta be something better even if it is nms cuz that just means you have to apply all tags to every item right?

fathom dirge
#

wait is there a tag that stores all enchantable items?

#

or materials i should say

young knoll
#

There are a bunch

rugged fern
#

here it loads the modules: ```java
public void loadModules() {
try {
File[] array = this.dir.listFiles();
if (array == null) {
System.err.println("No modules found!");
} else {
for (File file : Arrays.stream(array).filter(Objects::nonNull).filter(this::checkJarFile).collect(Collectors.toList())) {
JarFile jarFile = new JarFile(file);

                try {
                    JarEntry entry = jarFile.getJarEntry("module.yml");
                    Preconditions.checkNotNull(entry, "Addon must have a module.yml");
                    InputStream in = jarFile.getInputStream(entry);

                    try {
                        ModuleDescription description = new ModuleDescription(ConfigurationProvider.getProvider(YamlConfiguration.class).load(in));
                        this.initializor.initModule(file.getName(), description);
                    } finally {
                        if (Collections.singletonList(in).get(0) != null) {
                            in.close();
                        }
                    }
                } finally {
                    if (Collections.singletonList(jarFile).get(0) != null) {
                        jarFile.close();
                    }
                }
            }
        }
    } catch (Throwable var18) {
        try {
            throw var18;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}```
worthy yarrow
rugged fern
# rugged fern here it loads the modules: ```java public void loadModules() { try {...

and here its triggers the onstart method ```java
public void initModule(String file, ModuleDescription description) {
try {
URLClassLoader classLoader = new URLClassLoader(new URL[]{this.moduleManager.findModule(file).toURI().toURL()}, this.getClass().getClassLoader());
Class<?> clazz = Class.forName(description.getMain(), true, classLoader);
if (clazz.isEnum() || clazz.isInterface()) {
return;
}

        Object instance = clazz.newInstance();
        if (!(instance instanceof Module)) {
            return;
        }

        Module module = (Module)instance;
        module.onStart();
        this.moduleManager.getModules().add(module);
    } catch (Exception var7) {
        System.err.println("Error enabling... " + description.getName() + " - " + description.getMain() + " - " + description.getVersion());
    }
}```
thorn isle
#

and why are you trying to reinvent the plugin system

fathom dirge
# young knoll There are a bunch

but do you mean the list specific to a certain enchantment cause that i know off, but i should be able to alter a set of materials that store in general if that material is enchantable

drowsy helm
#

Yeah this is completely unnecessary

fathom dirge
#

Btw is there a list somewhere where i can find all minecraft tags?

drowsy helm
#

plus since it's shaded it won't have a jar, so it won't be loaded

fathom dirge
#

or docs

young knoll
#

There isn’t a generic enchantable tag

rugged fern
# rugged fern and here its triggers the onstart method ```java public void initModule(Stri...

and here its load the modules: ```java
@Override
public void onEnable() {
instance = this;
this.getDataFolder().mkdirs();
this.moduleManager = new ModuleManager();
databaseAdapter = new DatabaseAdapter();
getProxy().getConsole().sendMessage(TextComponent.fromLegacy("§8[§bModuleSystem§8]: §7Trying to start..."));
loadModules();
}

private void loadModules() {
    getProxy().getConsole().sendMessage(TextComponent.fromLegacy("§8[§bModuleSystem§8]: §7Loading modules..."));
    getModuleManager().loadModules();
    if(ModuleDescription.DESCRIPTIONS.isEmpty()) {
        getProxy().getConsole().sendMessage(TextComponent.fromLegacy("§8[§bModuleSystem§8]: §cFailed to load modules: No modules found."));
    }
}```
drowsy helm
thorn isle
#

mm yes sending messages to the console sender

drowsy helm
#

you're sort of foot gunning yourself

#

also yes, use logger not sendMessage

young knoll
#

I think minecraft:enchantable_durability is the most generic tag

rugged fern
worthy yarrow
#

Blocks have durability now right? Isn’t it in relation to the stack size?

drowsy helm
#

Is that the shaded one though?

young knoll
#

Presumably you can just add whatever to that and then manually remove unbreaking in the PrepareEnchantingEvent

rugged fern
#

the shaded one is a seperate module called CommandModule and thats loaded aswell

drowsy helm
#

Idk it’s really hard to tell man

#

If you have such an elaborate system you should have measures of testing and debugging it

fathom dirge
drowsy helm
#

I cant tell you much without going through the whole thing

worthy yarrow
#

I thought the all tag got deprecated

young knoll
#

It’ll load it

#

But it won’t do anything

#

The actual enchantments themselves control what items they can be applied to

#

Idk if just registering a custom enchantment that can be applied to an item will make that item be valid in the enchanting table

fathom dirge
#

Well no it doesn't cause thats what i'm trying to solve xD

#

registering the enchantment and setting supported items works fine

worthy yarrow
#

Sounds like you found yourself a free pr

young knoll
#

Did you set the enchantment to appear in the table

fathom dirge
#

yeah

young knoll
#

There’s a tag for that

fathom dirge
#

yeah the in_enchantment_table i think

#

and i set that yeah

#

The enchantment table works fine for any items that are enchatable in the base game

#

just not for other items

#

e.g. gold blocks

drowsy helm
fathom dirge
#

I'll just try adding gold block to the enchantable/durability tag for now and see what that does

drowsy helm
#

(Which your get instance should be checking for anyway)

worthy yarrow
fathom dirge
#

I don't think i do tho? Cause that tag stores item types

#

correct me if i'm wrong, but if i add gold_block to enchantable/durability, then when i add gold_block in the enchantment table it will check if its enchantable, then see it is by checking enchantable/durability. Then send back the enchantments of gold_block in the enchantment table

#

Thats what im hoping at least

worthy yarrow
#

I mean in the sense that you’re not just handling a single block/type, you’d still have to tag every possible item that you’d want enchants to show up for if I’m understanding

fathom dirge
#

prob just coping lol

worthy yarrow
fathom dirge
#

yes

#

but thats no problem

#

in my system at least

worthy yarrow
#

No it’s not a problem, just feels like it’s a lot of work for the use case

fathom dirge
#

I mean i'm trying to build a custom enchantment builder for players with as little work as possible

#

I can send you a youtube video of what i already have if you're interested

#

and in my use case the user just specifies the item types the enchanment should go on

#

then i just register them

worthy yarrow
#

I mean if you can use the api over nms… api always but still

fathom dirge
#

not a lot of work

fathom dirge
fathom dirge
worthy yarrow
#

Manually adding all types just to get possible enchants to show up, I figure you can “mask” the item in the table with some item that would show all the possibilities… might be easier

fathom dirge
#

registering enchantments for example

young knoll
#

Yeah idk how the game determines if an item can be enchanted

#

I figured there would be a generic tag but I guess not

fathom dirge
#

just gonna test some stuff out

#

i'll let you know the results if i figure something out

fathom dirge
#

@young knoll @worthy yarrow i finally figured it out. It's actaully really not that difficult once you know it.
You just need to add the DataComponents.ENCHANTABLE to the DataComponentMap. You do need reflection to set the newly built componentmap, but otherwise i think its quite safe.

// Example for GOLD BLOCK
DataComponentMap.Builder builder = DataComponentMap.builder();
builder.addAll(Items.GOLD_BLOCK.asItem().components()); // Copy old entries
builder.set(DataComponents.ENCHANTABLE, new Enchantable(10)); // Add new entry
DataComponentMap updatedMap = builder.build();

Reflex.setFieldValue(Items.GOLD_BLOCK.asItem(), "components", updatedMap);
#

I wonder what other cool stuff you could do by adding other DataComponents to items tho

young knoll
#

Tbf I don’t know much about DataComponents

#

Seems like they are components built in to items?

#

Seems you can also set it per item stack

echo basalt
#

Where you have the base type and amount, everything else being controlled by components

young knoll
#

Yeah I know that

#

But this seems to be something on the internal item field itself

#

So I assume it’s some kind of default component list

thorn isle
#

the prototype

#

the item definition itself has a set of item components which define all of the "material's" behavior, e.g. a stone pickaxe will have the Tool component

#

on top of that, item stacks will "patch" the component map with additional components, e.g. the durability of the iron pickaxe is in the patch which is applied on top of the "prototype" provided by the item definition

young knoll
#

Yeah makes sense

tacit juniper
#

Hello, I'm a little lost with how to do this and I'm wondering if one of y'all can help. I'm trying to make a stat that increases the speed to mine blocks. but I can't figure out how to increase the speed to mine blocks. any ideas?

slender elbow
#

you can add attribute modifiers to the player for the block_break_speed or mining_efficiency attributes

surreal talon
#

Hi , is there any simple way to get free project for get better resume and upgrading my experience and more learning in projects ?

weak wasp
#

You can just come up with your own plugins, that is free and gives you experience.
Or you could always offer free development services on the forums and see if anyone contacts you.

#

?services

undone axleBOT
worthy yarrow
nova notch
#

just be like everyone else and remake hypixel skyblock but shittier

echo basalt
#

or donutsmp

zealous pier
#

Hey guys what is the best spigot-repo to use for creating plugins for mc 1.20.1 i can only find 1.20.1-R0.1 SnapShot is there any newer one or more stable one for 1.20.1 Spigot Api ?

paper viper
#

Yes, use 1.21.5

#

1.21.5-R0.1-SNAPSHOT

zealous pier
#

hmm nvm i tried that 1.21.5 but i am still geting my error's i was told it was because of spigot api do any of you know how to fix this error here
[ERROR] /C:/Users/IdeaProjects/NoName/src/main/java/com/nnn/nnnsn/commands/AddCommand.java:[38,42] cannot find symbol
symbol: method hasCustomName()
location: variable heldItem of type org.bukkit.inventory.ItemStack
[ERROR] /C:/Users/IdeaProjects/NoName/src/main/java/com/nnn/nnnsn/commands/AddCommand.java:[38,69] cannot find symbol
symbol: method getCustomName()
location: variable heldItem of type org.bukkit.inventory.ItemStack

[INFO] 2 errors

drowsy helm
paper viper
#

Oh I didn't realize you're using 1.20.1...

#

But you should probably update to 1.21.5

sly topaz
#

anyhow, if you want to work with 1.20.1 then using the spigot repository is fine, that'll have the latest available version for spigot 1.20.1 (whenever that was released)

#

make sure to set your api-version to 1.20 as well as using 1.20.1 API in your build script

dawn flower
#

is there a way to set blocks faster than fawe api? fawe api is fast but i want to change 4.5m blocks in the blink of an eye (i saw some server doing that)

#

it doesnt have to calculate lighting and all that stuff because all players have night vision anyways

young knoll
#

Fawe is pretty much doing that

dawn flower
#

wait i noticed this
.relightMode(RelightMode.OPTIMAL)

if i make it NONE will it perform better

young knoll
#

?tas

undone axleBOT
dawn flower
#

i cant really tell

#

nvm it's way faster

blazing ocean
#

Yeah but it also won't relight

dawn flower
#

how do i run code after it fills the regions?

#

i want to teleport players to the surface after it's done

thorn isle
#

better ask in their discord probably

#

supposing they have one, dunno

dawn flower
#

oh they have

sly topaz
#

EditSession#close is blocking so that should do

dawn flower
mortal hare
#

my take: multiversion plugin jars are awful

#

it should be CI/CD pipeline jobs to version packages to specific minecraft versions

#

instead of developers with nasty reflections and leaky abstractions for multiple minecraft versions that might not make sense

sly topaz
#

it'd be fine if Spigot supported modules for example

mortal hare
#

i wouldnt even say that wouldnt be awful if it did support it. Look when you're configuring your own server, you are as a sysadmin of server software responsible for managing versions of plugins and other software

#

instead you bake in some bloat into your whole plugin just to make that not an issue for a sysadmin

#

worst of all sometimes you have to do compromises for features since newer versions of minecraft clients support better features usually and you need to downgrade your own plugins because something doesnt work in backwards compatible way

sly topaz
#

it'd be more reasonable if 50% of the people using these plugins weren't kids

#

but sadly that isn't the case, so you got to make it as dumbed down as possible

mortal hare
#

but it wasnt that a case in the old days of craftbukkit

#

each minecraft plugin had its own specific mc server version and package for each server version the plugin supported

#

something changed during the start of spigot's timeline around 2013-2014 that made multiversion jars popular

sly topaz
#

well, the bukkit frontend encouraged per-version jars, while spigot's one encourages single-jar downloads

#

the same way it's much more common in modrinth to have per-version jars since the platform encourages that

wet breach
wet breach
ripe urchin
#

Hey I saw that this method is marked obsolete. What is the "up to date" way to send a message to a player?

drifting halo
#

see first "see also"

young knoll
#

?whereami

ripe urchin
#

ah okay

#

yeah I'm using components now just noticed the obsolete tag on the older text

#

I just don't like how many inline methods the components have so I might just make a wrapper util

sly topaz
ripe urchin
#

Could you send me a link to the docs?

sly topaz
#

if it is just for sending chat messages, you can use Player#sendRichMessage and you don't have to deal with all the bs that is setting up the MM serializer

#

but there should be documentation about that as well in the API page under MiniMessage section as well

thorn isle
#

personally unless i need hover/click events or rgb colors i always stick to the legacy string color codes

ripe urchin
#

alright I'll take a look. I can deal with the components system but I'll write a small wrapper class to reduce the amount of methods

sly topaz
#

the methods in adventure are meant to be statically imported so that they look less verbose-ish

#

it might not seem like it makes much difference, but it does. Take for example:

player.sendMessage(Component.textOfChildren(
  Component.text("This is a layered message", NamedTextColor.RED), 
  Component.newLine(), 
  Component.text("Click here to run /home").clickEvent(ClickEvent.runCommand("/home"))
);

vs:

player.sendMessage(textOfChildren(
  text("This is a layered message", RED), 
  newLine(),
  text("Click here to run /home").clickEvent(runCommand("/home"))
);
ivory sleet
#

does the api itself recommend to statically import as per the docs?

sly topaz
#

I am sure I’ve seen adventure people recommend it on discord but I don’t think they explicitly mention it anywhere

mortal hare
#

i wonder if there's any successful attempts of syncing player inventories with a database which are not buggy

#

the reason i dont do free plugins anymore

wet breach
#

but it can be done

#

unless you justt want a copy of their inventory in DB

#

which is real easy to do

mortal hare
#

im thinking of trying to make a hybrid server network where one server is custom one made through minestom and another is NMS based one, basically one server is for mostly custom stuff and nother for SMP stuff

#

they're both technically part of one server but would be in a network of a sense

chrome beacon
#

minestom + fabric

mortal hare
#

but that's sounds complex to do with NMS

#

i just cant seem to find any good syncing solutions between minestom and NMS one

#

that would involve lots of NMS hacking with mixins i guess

chrome beacon
#

If you want to use a mixin you could just put one where it loads the playerdata

#

and make it grab inventory from db there

mortal hare
#

its still sooo messy

#

and i see many edge cases where it could be exploited

chrome beacon
#

like what for example?

mortal hare
#

oh loading maybe be easy but what about persisting existing inventories

elder gulch
#

Hello. I don't mean to bother anyone but can any developers read this and let me know.

chrome beacon
#

?services

undone axleBOT
elder gulch
#

Thank you

#

My apologies

chrome beacon
mortal hare
warm mica
wet breach
#

I just don't worry about reviews ever

chrome beacon
wet breach
#

funny how some seem to live for those 5 stars

chrome beacon
#

might take a while if the server has a ton of players, but it's probably fine since it's only being done once

#

alternatively just check the file as a fallback when missing in db

wet breach
#

server start up times really shouldn't be a concern

mortal hare
wet breach
#

its quite normal for game servers to have start up times of 5 minutes

chrome beacon
#

instead of on file

umbral ridge
mortal hare
#

i guess yeah, but what if lets say player switches from one server to another and he wants to keep the same inventory across servers, that means i need some kind of in memory database server

#

this seems like a solution to a problem where a inefficient monolith would be better

wet breach
#

not really

umbral ridge
#

just store all the slots in the db with raw itemstack

#

easy peasy lemon squezy

wet breach
#

make use of limbo mode

chrome beacon
mortal hare
umbral ridge
#

use some logic and make it work

wet breach
#

limbo mode is where you put them in an area temporarily until data that is absolutely needed is obtained to then set them free into the server

wet breach
#

its hilarious how some concepts have been forgotten magically

umbral ridge
#

this is like asking how to code in java... learn it yourself.. code.. debug.. learn.. plan before you do a big project

wet breach
wet breach
#

when reality is, no one really has an issue waiting in some temp area for a few minutes at most

mortal hare
#

wdym by in area temporarily

chrome beacon
#

while it grabs data from db

mortal hare
#

oh

umbral ridge
wet breach
# mortal hare wdym by in area temporarily

you make an area or world in the server where players can be placed and can't interact with the normal stuff in said server until data you absolute need is loaded for them

chrome beacon
#

Probably overkill though since getting it shouldn't take that long

wet breach
#

once that happens, you then teleport them to the place they are allowed after that

mortal hare
#

yeah that's not the problem i already do this

#

the problem i can see is that i dont see really good solution to build the glue code to NMS

wet breach
#

ok, then switching servers shouldn't really be an issue

mortal hare
#

its all looking hacky as shit

umbral ridge
#

serializing a inventory in db shouldnt take longer than a few ms

wet breach
#

everything is always hacky

#

at first anyways

umbral ridge
#

use prelogin event

#

think a little

wet breach
#

handy for other scenarios like if your DB server went down or the connection died etc

#

then you don't just have players running around with all kinds of stuff because everything is erroring lmao

mortal hare
# umbral ridge use prelogin event

i know that, im just thinking for a solution that would help to sync the inventories when switching between servers on the network, like maybe persist changes on some kind of server switch event

#

i've never worked with proxy plugins

#

tbh

chrome beacon
wet breach
#

and allowing them to be in a temp area lets them talk and maybe do some things while stuff gets fixed etc

chrome beacon
#

It won't take more than like 5 seconds

#

people can wait that long

wet breach
#

that isn't what I meant

#

I meant its handy to have such areas for your worse case scenarios

#

IE, DB died for some reason

chrome beacon
#

I just wouldn't let the player in since there's no point in doing so if db is down

mortal hare
#

also i see more problems to it, if i want to sync inventories between minestom and nms i need to register every single item on the game

#

i feel like its just easier to use fabric or paper altogether without any minestom

wet breach
#

sure we have our differences in how to handle that

#

I have no issues letting players connect and chatting in the common area that has nothing to do with the rest of the server until stuff gets fixed 😛

#

where as you, would rather let them be stuck on loading screen for however long that takes

#

until they realize they need to force close MC or hit the x button

chrome beacon
#

You'd cap it ofc

#

If it fails give them an message to try again later

wet breach
#

yeah as I said differences in how to handle such things is all

#

both are valid

chrome beacon
#

I mean your solution probably is the better way of doing it, it's just not worth the time to implement when you're just getting started or have a small player base

mortal hare
#

it would be cool for mojang to implement in the client server sided prelogin status messages that could update whilst connecting to the server

#

something like ping based animated motds we had in 1.7 era

zealous scroll
#

Any idea why this piece of code is erroring at hasItemMeta?

#

Line 134

opal orchid
#

Hi! I have a question, is there any plugin for npc besides citizens that is paid? for spigot 1.20+

echo basalt
#

you want a paid npc plugin that is not citizens?

#

odd

#

citizens is free you just need to look at the description

mortal hare
urban cloak
#

now i have a redis server to store inventories. in the velocity preconnect event i publish a redis message requesting the inventory of the connecting player to be saved and read it from redis on the backend server as soon as they connect

#

in the time between saving the inv to redis and disconnecting you can theoretically dupe items but thats veryy unlikely and i dont know a way to circumvent this without modifying either minecraft or velocity substantially

mortal hare
#

did you just exposed a dupe for your server on a public discord server :D?

#

i mean that's very hard to pull off and requires timing

#

you can probably make a mod which drops an item by sending a packet before disconnecting from the server

#

and now you have the same item on server B since you captured snapshot of inventory before disconnecting and on server A you still have the original item dropped

urban cloak
#

well you are disconnected by velocity so its even harder to pull off

#

if your client disconnects, you get disconnected from velocity

urban cloak
#

if youre on 1.20.5 and have access to the transfer feature i would just put the inventory in a cookie

opal orchid
# echo basalt citizens is free you just need to look at the description

:/

[16:22:23] [Server thread/ERROR]: Error occurred while enabling Citizens v2.0.38-SNAPSHOT (build 3806) (Is it up to date?)
java.lang.NoClassDefFoundError: org/bukkit/craftbukkit/v1_21_R4/boss/CraftBossBar
    at Citizens-2.0.38-b3806 (1).jar/net.citizensnpcs.nms.v1_21_R4.util.NMSImpl.<clinit>(NMSImpl.java:2746) ~[Citizens-2.0.38-b3806 (1).jar:?]
    at java.base/java.lang.Class.forName0(Native Method) ~[?:?]
    at java.base/java.lang.Class.forName(Class.java:534) ~[?:?]
    at java.base/java.lang.Class.forName(Class.java:513) ~[?:?]
    at io.papermc.reflectionrewriter.runtime.AbstractDefaultRulesReflectionProxy.forName(AbstractDefaultRulesReflectionProxy.java:68) ~[reflection-rewriter-runtime-0.0.3.jar:?]
    at io.papermc.paper.pluginremap.reflect.PaperReflectionHolder.forName(Unknown Source) ~[paper-1.21.jar:1.21-130-b1b5d4c]
    at Citizens-2.0.38-b3806 (1).jar/net.citizensnpcs.api.util.SpigotUtil.lambda$getMinecraftPackage$1(SpigotUtil.java:175) ~[Citizens-2.0.38-b3806 (1).jar:?]
    at Citizens-2.0.38-b3806 (1).jar/net.citizensnpcs.api.util.SpigotUtil.getMinecraftPackage(SpigotUtil.java:180) ~[Citizens-2.0.38-b3806 (1).jar:?]
    at Citizens-2.0.38-b3806 (1).jar/net.citizensnpcs.Citizens.onEnable(Citizens.java:326) ~[Citizens-2.0.38-b3806 (1).jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
echo basalt
#

mandatory

#

?whereami

echo basalt
#

Probably looking at a 1.21.5 build you'll find the right one eventually

opal orchid
#

You say spigot is better than paper?

echo basalt
mortal hare
#

i wonder if someone tried to port glowstone server parts to minestom

chrome beacon
#

If seen people use vanilla parts but not glowstone 🤷‍♂️

urban cloak
#

i cant just "lock" a players inventory

echo basalt
#

The lock would interrupt the loading process if a save is occurring

urban cloak
#

this is no concurrency issue in the database

#

read the issue again

echo basalt
#

it's a latency issue

urban cloak
#

its the fact that minecraft allows modification to the inventory on the old server while the player is already connected to the new server

#

which would be hard to circumvent

thorn isle
#

push the inventory once the player has disconnected

#

use a lock to prevent it from being loaded on the new server (blocking in async prelogin) until the old server is done pushing it

urban cloak
#

blocking in prelogin doesnt help because the player wont disconnect from their old server until they are connected to the new one.
and i need the inventory as soon as the player connectes because overwriting it once its available might have other bad side effects

thorn isle
#

i'm fairly certain the player disconnects from the old server before they can start logging into the new server

eternal oxide
thorn isle
#

that's what the lock is for

eternal oxide
#

yes but you can;t place a lock which is detectable by the second server in time

#

DB has not updated

thorn isle
#

sure you can

urban cloak
#

you can, im doing it this way right now and it works even on localhost with no delay

eternal oxide
#

The safest way is to give them a blank inventory on join for a few seconds

urban cloak
#

what if they collect an item in this time, its gone then

eternal oxide
#

you are talking fractions of a second.

urban cloak
#

all this is so much more complicated just to fix a highly unlikely dupe

thorn isle
#

just use a lock for it, databases support transactions and locking primitives

eternal oxide
#

or delay every player in the pre login to give the db time to update

thorn isle
#

e.g. you can have the server the player is on lock the row holding the inventory data such that other servers can't use it until the lock is released

#

when the player disconnects, push changes and release the lock; the destination server will block the prejoin event until the lock is released, and will get the freshly pushed data, and locks the row for itself in an atomic transaction

urban cloak
orchid tide
#

I'm sorry for asking dumb question but tell me in one sentence what u tryin to do? (don't want to read it all lol)

eternal oxide
#

Pretty sure when the disconnect event fires the player is already gone/negotiation with the other server

urban cloak
#

sync inventories between servers connected via a proxy

urban cloak
eternal oxide
#

yes

thorn isle
#

if the disconnect happens after the connect, then dunno, i don't see any way of actually doing it cleanly in such a case

eternal oxide
#

so you can;t lock the db as theyt are already gone

#

add a delay on every pre connect

thorn isle
#

that won't work either if the player is still connected to the origin server

#

as their inventory may still be undergoing changes

eternal oxide
#

give the old server time to lock/update the db

thorn isle
#

it'll only be safe to save once the player is disconnected

#

but if disconnection happens after connection to the new server, then by definition you're already on the new server before that happens

eternal oxide
#

yep

thorn isle
#

so waiting won't help here

#

if you wait for 10 seconds in prelogin, the player just stays connected to the old server for 10 seconds longer

#

the race is unaffected

eternal oxide
#

it will. it gives the old server time to run the event and update teh db,. The new server delays the login, then fetches the updated inven

thorn isle
#

yes, but you can't save before the player is disconnected

#

not an issue of time

#

if you save before disconnection, you risk missing changes being made to the inventory and duping/losing items

eternal oxide
#

the two servers do not sync. the disconnect fires after the player has left but during the new server login

#

its litterally the proxy droping the connection to the old server and routing to the new

thorn isle
#

if you can get the player to disconnect from the origin server before they complete login on the destination server, it will work, but this has nothing to do with waiting in prelogin

#

if you can't, you need to jump through additional hoops

urban cloak
#

i am actually not sure if they disconnect first when blocking prelogin, but i assume they dont because you probably cant reconnect them to the new server then

orchid tide
#

wait so different servers same inventory

thorn isle
#

we can't really sync after prelogin either without blocking the server thread of the destination server for the db query, though that's probably acceptable if the db is on the same machine

orchid tide
#

is it like horizontally scaled or completely different concept server?

thorn isle
#

an option is to toss the player to an intermediate server first so that they disconnect from the origin server, and then send them to the destination server, but this seems overkill

orchid tide
#

yeah well. you could send him to kind of a lobby. he won't notice it probably

#

but yeah. it would work.

urban cloak
#

they will definitely, you get the loading screen twice

#

and with mods that takes ages

orchid tide
#

good point.

thorn isle
#

this is somewhat suboptimal but you could listen to and cancel inventory interactions/item pickup manually after saving the inventory, to prevent it from being changed

orchid tide
#

what about a fast in memory db?

#

like redis for example.

thorn isle
#

well i mean the issue sort of is that the inventory is loaded and mutable on two servers at the same time during the transfer (supposing origin-disconnect really does fire after target-connect)

#

doing things faster or imposing delays isn't going to help with that

urban cloak
#

well the disconnect does fire after connecting, because i tried the save aproach first, what i dont know is if it fires after when prelogin takes longer

echo basalt
#

block inventory modification until it's loaded

thorn isle
#

or after it's saved

#

either works

#

kill the player before transferring them 🤡

orchid tide
#

yeah. well like i said. minecraft doesn't give you a simple solution, go outside the box.

urban cloak
orchid tide
#

connect each player to a redis, use locks to prevent mutation of the inventory

echo basalt
#

And you didn't consider the latency between your instance and redis?

orchid tide
#

unlock it once the target server read it (locked for source server)

#

and vice versa

#

yeah well depends

#

same machine? no

#

different machines yes

echo basalt
#

If you're opening a new connection to redis it can take 50ms

#

reusing a connection can make that 1ms

#

Your test is being influenced by external factors

orchid tide
#

reusing the connection would be more optimal

urban cloak
#

locking on redis doesnt help because minecraft will still modify the inventory, weve discussed this thrice by now

echo basalt
#

Then prevent it

orchid tide
#

my bad

thorn isle
#

it is true that the disconnection is delayed at least on velocity, idk about bungee, since if you try connecting to e.g. a whitelisted backend, you won't disconnect, fail to connect, and reconnect to the origin server; you just get a message in chat with the disconnection message

#

i.e. you stay connected to origin despite trying to connect to the target

echo basalt
thorn isle
#

i'm not sure exactly at which point you do get disconnected from origin

urban cloak
orchid tide
echo basalt
#

Inconclusive

thorn isle
#

is there a phase in between those where

  • the target server inventory is not yet accessible for modification
  • we can block asynchronously (without halting the main thread) to wait for origin server to save and receive the saved inventory from the db?
#

an option is the PlayerJoinEvent on LOWEST priority, at which point other plugins are relatively unlikely to yet fiddle with the inventory, but that's sync and blocking that for a millisecond or longer is haram

orchid tide
#

i would listen for the quitevent on source then somehow communicate to target that the source is done and saved everything and then target would get the info. might not be the best idea tho.

#

including locking it (would take some implementation with other plugins that access inventory)

urban cloak
#

if you lock it you dont need the other stuff

orchid tide
#

what instead of going server level we go proxy level. and "transfer" the inventory from proxy level when the player switches?

#

we would get rid of the communicating thing

urban cloak
#

the inventory still exists modifiable on the old server

thorn isle
#

personally i vouch for killing the player after saving the inventory so it can't be changed between saving and disconnection, and blocking on async prelogin on the destination server

#

if only because killing the player would be 🤡

#

alternatively, uh, i think if you manually kick the player from the origin server and then control the "fallback" functionality on velocity side, you can have the player disconnect from origin before even starting to connect to the target

urban cloak
#

hmmmmm

thorn isle
#

since by the time velocity realizes the player is kicked, the player is already kicked

#

this'd be incompatible with any proxy plugins manually sending players around as well as the default /server command etc. so not ideal either, however

#

but taking care of those might be easier than taking care of all inventory interactions

#

the most robust and probably straight-forward way is just to have an intermediate lobby server in between, but that does still seem like overkill and does suffer from increased loading times

urban cloak
#

if anyoone ends up duping i can think about this but for now its fine enough

shut field
#

I’m using a block display and I am using “block#getData” but when I try to display the block over the current block it doesn’t fully work for items like bamboo where they aren’t necessarily at the center location of their block. I kinda understand that, because I am spawning the display on the center of the block, but does anyone know how to spawn it sometimes off center if it is something like bamboo which isn’t centered?

opal orchid
#

Hi, I have spigot 1.21, what npc plugin is compatible with this version?

chrome beacon
#

Citizens

mortal hare
#

is there any hack to adjust draw order of container titles in minecraft?

#

im kinda new into resource packs, and first initial thought was core shaders, but i cant find anything particularly useful related to draw order

umbral ridge
thorn isle
#

hire third world country children to roleplay as npcs on the server

#

it's like chatgpt but cheaper

wet breach
thorn isle
#

make an offer

mortal hare
#

its not a problem for me as i do have 32 gb of ram

#

but man is it sad to see such ram usage

remote swallow
#

you should see my ram usage atm

#

ive been maxing out the 32gb so much

mortal hare
#

wtf are you doing?

#

running local mc server?

#

and blender at the same time?

thorn isle
#

i hate multi process browsers

mortal hare
#

someone should bring tiling windows into browsers

thorn isle
#

my firefox processes take up 25gb memory in total, though not all of that is in the active working set

remote swallow
#

kmp dev

mortal hare
#

that way there wouldnt be 50 tabs opened at the same time because you forgot it

thorn isle
#

it's not even an issue with the number of tabs, it's just monkey tier programming

remote swallow
#

dockers running, ktor server, android qemu, idea, firefox, spotify and discord

thorn isle
#

my old single-process browsers like palemoon run on under 2gb for hundreds of tabs

remote swallow
#

like just a bit of ram is being eaten rn

mortal hare
#

it was all stuttery for no reason

thorn isle
#

well it's old and mostly single threaded

#

but i'd still take it any day of the week on older hardware where you can't run shit on 32 cpu cores and throw 32gb of ram at it

mortal hare
#

the thing is i dont remember older pcs struggle that much with performance even if they were low tier compared to today

#

i feel like today's software is enshittified in a way that even basic functionality needs like mid tier pc to even work properly

#

windows xp could run on 64 mb of ram

#

512mb of ram were standard

thorn isle
#

for sure, for my low end machines i still use palemoon and other, older and lightweight software

wet breach
#

is the problem

thorn isle
#

half of the software r&d cost nowadays is dumped on the user in the form of "get more cpu cores to run the embedded browser so we don't have to figure .net"

mortal hare
#

i feel like its all agile's fault

wet breach
#

basically since it is no longer for PC's to have 8-16GB on average

#

they stopped optimizing memory usage

#

and then games bloated into the hundreds of gigs because internet speeds got better so they stopped optimizing and basically no patching happens, just download the game again

mortal hare
wet breach
#

in other words developers became lazy

mortal hare
#

thats sad

wet breach
#

indeed

mortal hare
#

cool apps were my primary point of choosing this field. I had the influence from my relatives who worked with computers mostly sysadmin but man it was fun to grow up with him, and now it feels its all gone

wet breach
#

it irritates me when updates can be just mere megabytes instead of just redownloading the entire game again. Or that applications that are supposed to be not resource intensive are in fact resource intensive IE browsers

mortal hare
#

funnily enough i like torrents not because you can pirate things but because you can select what you can download 😄

thorn isle
#

it's not even devs being lazy, it's corporate being greedy; dev time costs and when optimization is optional you won't want to pay for it

mortal hare
#

i sometimes download through torrents just because it saves data for me since i dont need readme files, sdks and other shit

worthy yarrow
wet breach
#

vcs2 answered it other then devs being lazy

mortal hare
#

agile prefers half-baked products instead of flushed-down ones

worthy yarrow
#

So it takes more work to apply a patch over the whole code base instead of a small snippet or what have you

wet breach
#

but it really did start with devs being lazy though and not corporate greed. Someone somewhere had the idea to shave time to just not optimize the patching etc

#

and just full send it

wet breach
#

other then some bandwidth being used up

mortal hare
wet breach
#

the developers shaved "time" but really didn't

wet breach
#

and is basically the best way to go about patching usually

mortal hare
#

i guess maybe that breaks signature checks

#

thus anticheats freak out

topaz cape
#

hello.. i got a question 🙋‍♂️

minecraft sends/used a multiplayer.message_not_delivered message through SYSTEM_CHAT packet when a message is not delivered

did that by chance change in 1.21.5? (or maybe 1.21+)

mortal hare
#

but if you send correct signature with the patch it shouldnt right

wet breach
#

it doesn't, its just an extra step when you release an update though because you still have to compile

#

the update

#

at least 1 time

#

and then you can diff

#

but instead of doing that extra step they just compile and send

worthy yarrow
#

Well like eve for example, they have a client launcher and whenever an update occurs it just applies the patch over whatever bit they changed instead of reinstalling all files, is this easier because of the fact they introduced a launcher? or is the application of the patch still the same either way

thorn isle
#

you need software on the receiving end to actually do the patching

worthy yarrow
#

...well after thinking about it, steam is a launcher in itself so I guess it makes sense that it could be considered laziness

thorn isle
#

i.e. you need foresight

#

and when RAAAAH deadline the day after tomorrow massive crunch time you don't have foresight

#

you just ship it out as-is and worry about it later

worthy yarrow
#

Yeah I suppose

#

just seems like little work to make things easier on everyone

#

I figure with a legit patch system though, you'd also be introducing more security when it comes to the code base... not that it's exactly needed per se

#

I also know little of genuine game dev 🤷‍♀️

winter jungle
#

Someone knows why the whole chat-system breaks if i set the minecraft.command.me permission to false and use /me?

sullen marlin
#

Does it still break if you rejoin the server / use player.updateCommands

wet breach
#

eve online was released in 2006 if I remember right

#

so xp was still prevalent and windows vista wasn't released until 2007

topaz cape
#

maybe the message is client-sided now

winter jungle
south ibex
gray saddle
#

found a fix to this i think, just cancel sneaking while in vehicle

#

i dont know if this is necesary but as a precaution the player gets demounted and remounted after the event is cancelled

fathom dirge
#

I've been working on this plugin that lets the user define enchantments and then register them in the game so they work exactly like vanilla ones. What i've been working on now is that they can specify what are the "targets" for the enchantments. This is a list of strings that represents item or block tags (e.g. minecraft:swords, minecraft:gold_block, minecraft:enchantable/durability...). Using NMS i then get the references to those Item Holders and add them to my custom enchant tagkey for "target" items. Everything works fine, but i feel like right now the code is not optimal at all. https://gist.github.com/LGDTimtou/a7e18c87fe7addac0cbbce5a6b6786fb

#

I first look through the ITEMS registry and then if i can't find them in there (because its a block for example) i look through the block registry. I was just wondering if there are any NMS gods here that could tell me if i'm just doing some redundant stuff and maybe make this code less bloated.

smoky anchor
#

Ok but why, datapacks already can define custom enchantments

torn shuttle
#

for when your death chest needs that extra zing

fathom dirge
#

and also just way more flexibility

smoky anchor
#

I don't see why you couldn't

smoky anchor
fathom dirge
#

"supported_items: Any number of item(s) (an [String] ID, or a [String] tag with #, or an [NBT List / JSON Array] array containing [String] IDs) — Items on which this enchantment can be applied using an anvil or using the /enchant command."

#

items aren't blocks or other

fathom dirge
#

Not really that flexible to me

#

But i mean its kinda besides the point i was just asking if someone knew a way to fetch the Item Holders in a cleaner way xD

smoky anchor
smoky anchor
fathom dirge
#

I did find a way to alter that behaviour, but thats another thing that wouldn't be possible with datapacks

smoky anchor
fathom dirge
#

I mean if you click on the "items" it refers you to that link i sent you which doesn't show any blocks

#

and blocks and items have a different registry assigned to them

#

so the item and blocks tags are seperated as far as i know

#

i'm almost certain that you can't make enchantments for blocks without changing NMS behaviour

smoky anchor
#

the item for blackstone has "enchantments" component
so it can hold enchantments

#

I guess you're right with the enchantable component tho
That does require NMS to set by default

smoky anchor
fathom dirge
#

I see, thank you. The problem was that with the code i had right now when i tried to search for a tag in the ITEMS registry (e.g. grass_block) it didn't find it

#

so thats why i went to look in the BLOCKS registry where it does find it

torn shuttle
#

not my worst work

#

I think that looks pretty neat for a death chest

rough ibex
#

Very angelic

fluid goblet
#

so i need help to fix this class thing were if i touch water i get damage but when i choose the class it no work'-'

rotund ravine
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

fluid goblet
#

// For Lava Walker effects
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {

    Player player = event.getPlayer();
    if (!org.sportymp3.starter.RacesCommand.getPlayerRace(player).equalsIgnoreCase("lava walker")) return;
    Location loc = player.getLocation();

    // Fire damage boost - check if player is on fire
    if (player.getFireTicks() > 0) {
        // Apply effects with proper duration and show particles
        player.addPotionEffect(new PotionEffect(PotionEffectType.STRENGTH, 100, 0, true, true));
        player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 100, 0, true, true));
    } else {
        // Only remove if they have the effects
        if (player.hasPotionEffect(PotionEffectType.STRENGTH)) {
            player.removePotionEffect(PotionEffectType.STRENGTH);
        }
        if (player.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) {
            player.removePotionEffect(PotionEffectType.FIRE_RESISTANCE);
        }
    }

    // Water/rain damage
    if (player.isInWater()) {  // Better check for water
        player.damage(2);
        return;  // Skip rain check if in water
    }

    // Rain damage check
    if (player.getWorld().hasStorm()) {
        // Check if player is exposed to sky (more accurate than highest block check)
        if (player.getLocation().getBlock().getLightFromSky() == 15) {
            player.damage(1);
        }
    }
}
rotund ravine
#

And where do u set the race

fluid goblet
#

in a command

rotund ravine
#

?paste

undone axleBOT
rotund ravine
#

Please for both

fluid goblet
#

eh

#

im new to this so plz i small brain

#

make simple

smoky anchor
#

paste stuff
click save
send link

smoky anchor
#

Why do you need to qualify this "org.sportymp3.starter.RacesCommand"
*looks at imports*

#

I feel like one of those is wrong

thorn isle
#

this is why we use enums

smoky anchor
#

yep, that's the problem, you set "lavawalker" and check for "lava walker"

#

I forgot, this is bad right

thorn isle
#

it's not ideal

smoky anchor
#

Also, these two classes are a mess. They do too much.
I don't think the command should hold the data

fluid goblet
fluid goblet
#

pure sleep at last

#

thank you🥹

#

cant belive a space bar is wat cooked me

smoky anchor
fluid goblet
#

ill work on the area one later

fluid goblet
#

but as of rn ima test it the go to bed

smoky anchor
#

And write the imports normally, don't use so much *

fluid goblet
#

ok ill do that

#

IT WORKS

#

SLEEP AT LAST

#

thank you

onyx fjord
#

which java method provides mathematical rounding?

#

.5 up .4 and below down

#

oh

#

wtf

young knoll
#

Math.round?

onyx fjord
#

yea i missed this method lol

#

(int) was my mistake

young knoll
#

Ah, yeah casting truncates

umbral ridge
#

BigDecimal

slender elbow
#

Math.round doesn't always round n.5 up btw :x

#

huh, I must be mistaking this for something else

#

yeah I was confusing this with C# Math.Round where it rounds ties to the closest even number, haven't used C# in over 10 years, mfw

young knoll
#

Didn't know C# was such a hoe for even numbers

mortal hare
#

so im kinda bad at math, maybe you guys can help me with this one. I'm trying to make hollow sphere.

Well i've done it using sin() and cos() multiplications, **the problem is that i want to have it one block thick with culling of non-visible blocks from perspective of inside sphere. **I want it to be as accurate from the inside of sphere, whilst leaving inside of the sphere looking like crap. that way my sphere surface would be one block thick. how can i achieve this kind of shape?

#

i want to sphere to look exactly like this:

#

from outside

#

from inside

vast ledge
#

Can you not calculate a second sphere and remove the blocks on that list from the list of the bigger sphere?

mortal hare
#

i can im just wondering if theres trigonometrical way to do this

slender elbow
#

this is disaster

vast ledge
mortal hare
#

those distances that are marked with arrows are different even if they visually look the best

pseudo hazel
#

youd need to calculate the cells as a grid, not in actual full 3d space, because then it doesnt work anymore

lost matrix
#

Look up midpoint circle algo and Bresenham's circle drawing algorithm

#

Wait, i think i had a pull request for spigot or paper where i proposed discrete shape calculations for something like that.
Let me check if i can find it.

#

?paste

undone axleBOT
lost matrix
zealous scroll
#

I'm currently working on a component-based item system. There exists a BaseItem and an ItemInstance of that base item. Each ItemInstance has their item-specific components serialized (not the base ones) and their custom item key.

I want to make a versioning system that updates items when their BaseItem has changed (a new component, changed values, etc). So far, the hashcode for the BaseItem is serialized into each new ItemStack, but I'd like to know if anyone knows what the best approach to compromise between optimization and full coverage is.

Basically - when should I be updating these items before I lag the server to oblivion? Maybe when a chunk loads I scan every container in the region? Maybe when they're picked up? Has anyone done this before?

worldly ingot
#

I understand it, obviously, but it's so unconventional KEKW

lost matrix
lost matrix
zealous scroll
lost matrix
zealous scroll
lost matrix
#

That looks nice 🙂

zealous scroll
lost matrix
#

Everything that is not useful for the client is stripped. (Eg the pdc).
Im only modifying the lore and name at the moment. The lore is constructed dynamically, based on the "components" of the item.

slender elbow
#

itemstack pdc is sent to the client tho

#

it's chunk/entity(/what else?) pdc that isn't

lost matrix
#

Right, so my mapping removes them from items as well. 🙂

slender elbow
#

well I guess it depends on what you are using menus for

#

in some cases it's fine but certainly not all

lost matrix
#

Hm? Wait, so people add PDCs to ItemStacks to identify them as Buttons in Inventory GUIs.
I would not do that for GUIs because i think that sounds silly. But even then, only the server needs to know that those exist, right?

#

Is there a case where the client needs the PDC of an ItemStack? Maybe in creative when he wants to clone it.

slender elbow
#

well like I said, it depends on what you're using menus for, or maybe how instead of what, say you allow players to pick up and put down and merge items, maybe you want some to be mergeable with some but not others

#

there are cases where it's certainly fine to strip it, it comes down to the specific usage

mellow edge
#

Hello. When do people usually contribute to spigot, right when an update hits or before it?

slender elbow
#

anytime

slender elbow
#

if you want API to be added or fix a bug, you just pop in and do it whenever

mellow edge
#

I would like to contribute if that's possible.

slender elbow
#

?cla

undone axleBOT
slender elbow
#

?stash

undone axleBOT
mellow edge
#

thank you, I think I read the cla once, I will re-read it. If I remember it correctly you need to fill some form and send it?

slender elbow
#

yep

pure dagger
#

why do i need to apply 1 tick delay to change block from BlockGrowEvent
but i dont need to apply the delay in BlockPlaceEvent ?

worthy yarrow
#

What’s the use case

pure dagger
#

you mean what i do with the block?

#

i add CustomBlockData

zealous scroll
worthy yarrow
#

It just looks so smooth, and I may have to “take inspiration” from your math… I’m designing frisbee physics so

pure dagger
zealous scroll
#

that's actually why i had to use an entity vehicle and not interpolate the displays myself

#

because otherwise it flickers

worthy yarrow
pure dagger
#

okay

worthy yarrow
dawn flower
#

whats the safest way to edit an offline player's inventory and enderchest

worthy yarrow
pure dagger
#

placing isnt?

#

its the same with structuregrow, the blocks are placed

#

and you have to add the delay

#

;-;

worthy yarrow
#

Well the place event is already aware of the state the block would be in, grow event the state of the block changes so I would assume that’s why

#

Ie: Applying block data to a block at the exact moment it's already being changed

pure dagger
#

changes?

#

when

worthy yarrow
#

GrowEvent

pure dagger
#

yeha but it changes after the code?

#

i mean i dindt know when to add the delay, i added it everywhere: BlockPlaceEvent, EntityChangeBlockEvent, BlockFormEvent, BlockGrowEvent, StructureGrowEvent, BlockSpreadEvent

worthy yarrow
#

It's a concurrency issue I think, you can't apply block data to the old state of the block which is what the grow event handles... only when the block has been "grown" would you be able to is what I am thinking

#

Resulting in needing a delay before your own additions

pure dagger
#

i mean, i think i understand that, but the placeblockevent should be the same

worthy yarrow
#

I don't think so, like I said the place event wouldn't be modifying the block data other than giving it a location value or something small

#

Even then, I don't think the location is even held in it's data, probably just a field in Block

pure dagger
worthy yarrow
#

Probably only the place event

worthy yarrow
#

I also modify my own calcs like 6 times before the final result is given/applied

echo basalt
#

@blazing ocean you up?

blazing ocean
echo basalt
#

bit late now

blazing ocean
#

smh

fluid goblet
#

brain no work

thorn isle
#

if you just want it to be equippable, consider adding this item component to it instead

echo basalt
# blazing ocean smh

was gonna inquire about adding lang:space.-18 support to my text visitor shit but I figured I can just use the utf characters nexo uses and add those widths to my font data

blazing ocean
echo basalt
#

that's what nexo does

#

cba

prisma raft
#

Is there a good way to instantly load a plugin after making changes? I think it's a bit annoying to have to stop the server, press build, copy the plugin into the plugins folder and start the server again

blazing ocean
#

hotswapping exists but is a bit buggy / annoying sometimes

vital sandal
#

Hmm about this plugin

#

I’m currious how can I reshape player model like that ?

#

Pretty sure you cannot model or texture your own skin into it

young knoll
#

I believe it’s some magic with a player head and core shaders

echo basalt
#

Is there any way to make bukkit's config system not treat .'s like config paths

#

trying to make a font width thing and it's tripping

#

even with getValues

young knoll
#

I think you can do #setPathSeperator somewhere

echo basalt
#

cool shit

#

lemme find an obscure character that won't bite me in the ass

#

let's see if 0x0000 works

prisma raft
sly topaz
young knoll
#

I have gradle set to do that

#

I assume maven can too

sly topaz
#

as far as that question though, you can just add this somewhere:

<build>
  <directory>your/server/folder/</directory>
</build>
prisma raft
#

with "somewhere" being the project tag of my pom.xml?

sly topaz
#

yes

#

it depends on what plugins you might be using though

#

if you're using shadow, you have to set the outputFile in the maven shadow plugin configuration

prisma raft
#

right now I'm just making my own as a test

sly topaz
#

if you're using special source for remapping, then that

prisma raft
#

oh you mean maven plugins

#

It works, thanks

#

it's a bit annoying that it also adds all the extra junk but that's easy enough to ignore

thorn isle
#

antrun to copy the artifact to the plugins dir and run plugman reload pluginname over rcon 🤡

sly topaz
lost matrix
#

Just seutp hotswapping at that point

thorn isle
#

joking aside i do prefer this over hotswapping since it's more representative of what will happen at prod and is still far faster and convenient than restarting the server

#

i.e. any issues you encounter will be more reproducible

prisma raft
#

it creates a bunch of folders ("classes", "generated-sources", ...)

sly topaz
thorn isle
#

i could be, and i could also have state in other classes that get hotswapped

sly topaz
#

it takes some getting used to, if anything. Like you'd expect state to be cleared if you're using to restarting and hotswapping doesn't guarantee that

#

but it is useful as a reminder that you have to manage state anyway so it isn't all that bad

thorn isle
#

that's exactly it yeah; if i'm doing changes to e.g. the config parser, i will then also have to manually reload the config using the new, hotswapped parser code

#

atp it's cleaner to just do a complete reload of the plugin

#

only exception i admit to is debugging things at runtime where you specifically need to make changes without touching state

echo basalt
#

oh look it's smile

#

haven't seen this guy in forever

sly topaz
# prisma raft it creates a bunch of folders ("classes", "generated-sources", ...)

welp, it's probably better to just modify the maven jar plugin configuration then:

<!-- this goes in project.build.plugins -->
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <version>3.4.2</version>
  <configuration>
    <outputDirectory>somewhere</outputDirectory>
  </configuration>
</plugin>
prisma raft
sly topaz
sly topaz
sly topaz
sly topaz
#

that guide doesn't seem to be using any gradle plugins

#

but that guide is really old anyway

thorn isle
#

groovy 🤡

prisma raft
#

yeah, I assumed it was old because it has broken formatting, implying it hasn't been maintained

#

that's why I used the other guide that was on the page, which used maven instead

sly topaz
#

this is how I setup my spigot gradle plugins if it is of any help

#

should probably move the server location to a property tbh

prisma raft
#

oh sorry I meant build

#

obviously my project is a project folder

sly topaz
#

I meant here:

<project>
  <build>
    <plugins>
        ...
prisma raft
#

aah

sly topaz
#

completely unrelated but recently I learnt that you can pass files as JVM flags in java 9+

#

meaning you can do java @jvm.flags -jar server.jar to have a bit more clean of a startup script, jvm.flags being the name of the file

echo basalt
#

@blazing ocean facing weird issues with font spacing

#

Specifically for the uppercase I character

#

seems to like different values depending on how many I's I have

#

If I have 3 I's then a width of 4 is ok

#

If I have 2 I's then I need a width of 6

#

In short the more I's I have the shorter they are?

#

Dunno

blazing ocean
#

because bitmap fonts don't do kerning

echo basalt
#

default font yeah

#

actually

#

not exactly

#

it's almost like the default font BUT with some ascents for menu work

#

the next lines are a bit to the right

blazing ocean
#

odd

echo basalt
#

but they go more to the right the less I's there are

#

no combination of changing lengths fixes it

#

And it's not the characters either because it only happens with roman numerals

#

Regardless of name

#

Everything else renders fine

young knoll
#

Wynncraft

echo basalt
#

type shit

blazing ocean
#

could ask in font magic

#

oh you're not in there

young knoll
#

Smol server

prisma raft
#

Oh there's an extra server for that? lol

prisma raft
buoyant viper
echo basalt
#

No

buoyant viper
#

D:

spice ferry
#

hello how can i add another bar for more amor ?

grand flint
#

real

young knoll
#

Resource pack with font magic

short pilot
#

I think one of my PlayerInteractEvent may be cancelling another before it's even able to fire, does anyone know if this is a thing?

#
    public void onPlayerInteract(PlayerInteractEvent event) {
        Bukkit.getLogger().info("[DEBUG] onPlayerInteract called");

Tried adding this debug line but it doesnt even print on the second one

smoky anchor
#

isn't ignore cancelled a thing on the annotation ?
could then see if it is cancelled

short pilot
#

ah yes i just saw

#

ill try enabling that

smoky anchor
#

oh wait it does something different
uhm, you sure your event is registered ?

short pilot
#

yes 100%

short pilot
smoky anchor
#

?paste exists, prefferably use this instead of DMing

undone axleBOT
smoky anchor
#

And I don't have time rn

short pilot
#

👍

#

ok found it was caused by Caused by: java.lang.ClassNotFoundException: net.minecraft.world.level.Level

#
ServerLevel world = ((CraftWorld) player.getWorld()).getHandle();

Is this legal in nms

#

actually im quite confused, it's giving me the classnotfound error with the nms level class but i already generated the mappings

blazing ocean
#

are you using paper

short pilot
#

I was using that in a listener to spawn fresh entity and it was indeed working for a while until today

#

no dependencies changed

#
        ServerLevel world = ((CraftWorld) player.getWorld()).getHandle();
        UUID kingdomID = kingdomManager.getPlayerKingdom(player.getUniqueId()).getID();
        double spawnX = clickedBlock.getX() + 0.5;
        double spawnY = clickedBlock.getY() + 1.0;
        double spawnZ = clickedBlock.getZ() + 0.5;

        if (customModelData == 1) { // CustomGuard
            CustomGuard customGuard = new CustomGuard(world, kingdomID, new BlockPos((int) spawnX, (int) spawnY, (int) spawnZ));
            customGuard.setPos(spawnX, spawnY, spawnZ);
            world.addFreshEntity(customGuard);
            customGuard.getBukkitEntity().getPersistentDataContainer().set(EntityTags.MOB_TYPE_KEY, PersistentDataType.INTEGER, 0);
            customGuard.getBukkitEntity().getPersistentDataContainer().set(EntityTags.KINGDOM_ID_KEY,
                    PersistentDataType.STRING, kingdomID.toString());
#

Example

blazing ocean
#

and are you reobfuscating your jar

remote swallow
#

reobfuscatint

short pilot
remote swallow
#

do you use maven or gradle

short pilot
#

gradle

remote swallow
#

do you have patrick's remapper or paperweight with target set to reobf

short pilot
#

i thought paperweight was for paper?

#

i used the buildtools tutorial on the docs way back last summer and it worked

#

nvm looks like i was using patrick remapper indeed

#

ugh this is all so weird as the ClassNotFoundException happens on runtime

#

plugin compiles just fine

remote swallow
#

how are you compiling your plugin

short pilot
#

running the jar build script; i used the intellij plugin to generate and have just been running that for the past few months with no issue

#

ah well ima go to bed and figure it out tomorrow

#

maybe my spigot test server got messed up

blazing ocean
#

use the build task, not the jar task

short pilot
#

weird, i just tested it by making an entirely new test server and it worked

#

i dont even know anymore ;-; im so confused

#

that fixed it and i dont know why anymore

#

i assumed jar would build the project too

blazing ocean
#

all it does is compile the classes and throw them into a jar

#

doesn't run the remapper

ocean gorge
#
public static void setBlackScreen(Player player, float fadeInV, float stayV, float fadeOutV){
        PacketContainer fadeIn = new PacketContainer(PacketType.Play.Server.GAME_STATE_CHANGE);
        fadeIn.getIntegers().write(0, 4);
        fadeIn.getFloat().write(0, fadeInV);

        PacketContainer stayBlack = new PacketContainer(PacketType.Play.Server.GAME_STATE_CHANGE);
        stayBlack.getIntegers().write(0, 5);
        stayBlack.getFloat().write(0, stayV);

        PacketContainer fadeOut = new PacketContainer(PacketType.Play.Server.GAME_STATE_CHANGE);
        fadeOut.getIntegers().write(0, 6);
        fadeOut.getFloat().write(0, fadeOutV);

        try{
            ProtocolLibrary.getProtocolManager().sendServerPacket(player, fadeIn);
            ProtocolLibrary.getProtocolManager().sendServerPacket(player, stayBlack);
            ProtocolLibrary.getProtocolManager().sendServerPacket(player, fadeOut);
        }catch(InvocationTargetException ex){
            ex.printStackTrace();
        }
    }
#

😦

#

how do i set a black screen like it happens in other servers?

drowsy helm
young knoll
#

I was thinking just shove them inside a solid black text display entity

drowsy helm
#

oh yeah thats it

#

aswell

ocean gorge
young knoll
#

Yeah

ocean gorge
#

uhm...

#

great, thanks for the advice, i'll try it right away 😄

quartz cipher
#

Lf some plugin developers if they wanna work with a MC server

chrome beacon
#

?services

undone axleBOT
vital sandal
#

huh

#

why Material have both of these

chrome beacon
#

item and block

vital sandal
#

hmm make sense

young void
molten hearth
#

I love the carrots block

mortal hare
#

just like minecraft item registry does

slender elbow
#

what..

mortal hare
#

nvm

#

that's wrong

#

just checked it offline

slender elbow
#

the names in the Material enum are generated from the registry anyway

eternal night
#

LEGACY_EMILY

slender elbow
#

yeah

remote swallow
#

at this point i would just make item and block type the default

mortal hare
#

at this point i would just get rid of material enums

#

just use the god damn registries

#

its not 1.7 anymore

remote swallow
slender elbow
#

argh i broke the GODDAMN WHEEL!

mortal hare
#

bringing registries in the api would allow to centralize custom items in a way that plugins could register custom items in centralized store and then different plugins could spawn different plugin items without any third party API integration

sly topaz
#

custom items are not a thing so that's not really a concern for a server API

slender elbow
#

yeah no

sly topaz
#

the most custom an item can get is changing its model

eternal night
#

What if you just tell the client anyway

sly topaz
#

doesn't it just yell at you for the registry mismatch

eternal night
#

it'll fully explode yea xD

mortal hare
#

but why though client doesnt support it

#

i mean i dont see a reason why it wouldnt? They can just use behaviour type approach like they did with data driven enchantments

remote swallow
#

because mojank didnt add it as a feature

slender elbow
#

it doesn't support it because the java code required to support it does not exist yet

mortal hare
#

item registries would be cool addition for datapacks for example as it would centralize how would the itemstack gets initialized with what lore and naming and material type, no more messy recipe hacks i see as i big win tbh

#

you can then ./give yourself a custom item by just using a command

#

i see so many possibilities with this if client supported it

sly topaz
#

making custom items would require of a lot of features to be added to datapacks that don't exist yet

mortal hare
#

but datapacks are kinda the future of minecraft

#

i hope they would add this someday

sly topaz
#

they're slowly making every item interaction a form of data component in order to achieve this probably but we're not there yet

eternal night
#

same with custom blocks and entities

#

but to get there, a LOT of work is needed

#

mojang is 100% working towards it but like, needs to be balanced with all the other shit

mortal hare
#

but data driven enchantments gave me hopium

#

recently

eternal night
#

Yea

sly topaz
#

yet nobody on the bukkit derivatives really makes use of them

#

most people just don't bother and use the lore/pdc as that's easier to handle

mortal hare
#

if something is native already api should be updated in a sense to deprecate such behaviour

sly topaz
#

tbf commands on spigot are essentially just a chat event

mortal hare
#

it wraps brigadier in most disgusting way i've seen

sly topaz
#

it has worked for the longest time, can't really say anything about it

mortal hare
#

it doesnt even utilize brigadier's command nodes

#

it puts everything under one command node

#

just for the sake of backwards compat inside the api

sly topaz
#

the implementation side has never been beautiful per se, and it shouldn't be the goal anyway

mortal hare
#

not spigot's fault its just that bukkit api is old

#

and doesnt fit today's mc codebase that well anymore

wet breach
#

some things are just fine the way they are

mortal hare
#

especially since 1.13

#

it started to show its age

sly topaz
#

as long as the API is sensible, and the implementation is made in a way that will consider future changes to the game, I believe it's good enough

#

developers tend to be cleanliness freaks so anyone looking at it might just want to rewrite it all but everyone knows that is never a sensible option

mortal hare
#

spigot would never accept deprecating command api in favour of more like brigadier one

wet breach
#

never a fan of destroying something that works

mortal hare
#

paper already does have experimental support for brigadier

#

but spigot is more conservative in terms of api changes

wet breach
#

so what if paper does

#

they can do whatever they want

#

not sure what paper is doing has any concern of spigot o.O

mortal hare
#

nothing im just comparing this, but rn as it hardforked from it the comparisons would be even drastically bigger as projects move on

wet breach
#

as they should be

#

whats the point of forking if you are not going to really do anything different

sly topaz
#

and md himself has his hand pretty full keeping up with mc releases I imagine

remote swallow
#

and a lot of people dont want to sign the cla to contribute

sly topaz
#

I don't think that's much of an issue

remote swallow
#

i know it is for quite a few people

#

signing away ur rights + personal detains to random australian man

sly topaz
#

the bigger issue is that people get discouraged after a while if a PR doesn't receive attention

sly topaz
#

I'd be surprised honestly, CLAs are pretty common overall

remote swallow
#

i dont think the fact its a cla is an issue just a cla to who is the issue

sly topaz
#

well that'd make me even more surprised since I don't think md has a reputation of doing anything with that information lol

wet breach
slender elbow
#

CLAs are common in big corp, but we're talking about young adults and teens signing that with all the info it entails to John Australia for a Minecraft API

remote swallow
#

its more people just dont like md

#

rather than him doing stuff with the info

wet breach
#

you can't take back something you gave away freely

paper viper
#

I think it’s just a matter of convenience and even though your address is “public information” I wouldn’t just give it away