#help-development

1 messages · Page 636 of 1

lost matrix
#

Yeah you need to know the width of each font character from the previous line

daring schooner
#

Like, when the resolution changes, doesn't it break the text

sage patio
#

nope

daring schooner
#

That's nice

sage patio
#

thanks

daring schooner
#

I think mojang need to rework the way action bars work. We should be able to render string in the user screen

#

or add multiple action bars without any weird work around

#

it would improve the non-modded experience

sage patio
#

is there anyway to get the saturation amount of a food?

#

from an itemstack

fallen grove
#

hello, I have a resource waiting for approval 10 days now, is that normal?

lilac dagger
#

yes ^

storm granite
#

is there a optimal way to set lots of blocks at once, at the moment im using a loop and world.setBlockData(location, material.createBlockData());

lilac dagger
#

send them without physics

#

but it's up to you

storm granite
#

just anything is helpful, sending without lighting updates, block updates, batching, anything

lilac dagger
#

setBlock(type, false, false)

sullen marlin
#

and cache blockdata in a variable

lilac dagger
#

and that ^

quaint mantle
#

What packet can I send for it to send an advancement toast?

icy beacon
iron palm
#

Hello it seems that Mountain based biomes are removed in nms 1.18.2 Biomes class how can i get em?

storm granite
eternal oxide
#

its not

storm granite
spark lynx
eternal oxide
#

?fork

undone axleBOT
#

SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.

kind hatch
lilac dagger
lilac dagger
#

with Block#setType(material, false, false)

#

or BlockState#update(false, false)

grim ice
#

funny how people are so sad about how MD5 has collisions

#

even though the chance for a collision is one in a quattuordecillion

#

lmao

#

and most platforms dont even have 1/10 of that in passwords

cinder abyss
#

Hello, I have a class who extends ServerPlayer (Mojang Mapping), how can I change his skin ? (1.20.1)

iron palm
#

what is RegistryLookupCodec name in mojang mappings it seems screamingsandals isnt right

lilac dagger
#

add the value and signature

sterile breach
#

to store a map that acts as cache. I put it in my hand with on enable?

lost matrix
sterile breach
#

I was wondering between a manager and the main

sterile breach
#

ah google traduction**

#

^^

cinder abyss
# lilac dagger add the value and signature

I made this :java public static boolean setSkin(GameProfile profile, UUID uuid) { try { HttpsURLConnection connection = (HttpsURLConnection) new URL(String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false", UUIDTypeAdapter.fromUUID(uuid))).openConnection(); if (connection.getResponseCode() == HttpsURLConnection.HTTP_OK) { String reply = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine(); String skin = reply.split("\"value\":\"")[1].split("\"")[0]; String signature = reply.split("\"signature\":\"")[1].split("\"")[0]; profile.getProperties().put("textures", new Property("textures", skin, signature)); return true; } else { System.out.println("Connection could not be opened (Response code " + connection.getResponseCode() + ", " + connection.getResponseMessage() + ")"); return false; } } catch (IOException e) { e.printStackTrace(); return false; } }But when I package my maven project, I don't get the new version of my plugin, how can I fix it ?

sterile breach
#

in my main file

#

on enable

cinder abyss
cinder abyss
sterile breach
#

oui oui je sais^^

#

d'habitude je m'en sers pas trop^^

cinder abyss
sterile breach
#

bas je vois sa

cinder abyss
#

wordreference et deepl lorsque j'ai vraiment du mal

#

mais je commence à avoir un anglais acceptable pour discuter ici en impro 😄

sterile breach
#

pour stocker une map qui fait office de cache, mieux vaut la stocker dans le main ou dans un manager ?

sterile breach
cinder abyss
cinder abyss
sterile breach
#

bas je peut aussi mais souvent je passe par de la trad pour pas perdre de temps

sterile breach
#

to store a cache (map). DO I store it in my main class or my manager?

slim pier
#

When using p.setDisplayName(String) to change the name in Minecraft version 1.19.4 or higher, this error occurs. Help me

#
java.lang.IllegalStateException: Missing key in ResourceKey[minecraft:root / minecraft:chat_type]: ResourceKey[minecraft:chat_type / minecraft:raw]
    at net.minecraft.core.IRegistry.e(SourceFile:88) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at net.minecraft.network.chat.ChatMessageType.a(ChatMessageType.java:59) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at net.minecraft.network.chat.ChatMessageType.a(ChatMessageType.java:49) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at net.minecraft.server.network.PlayerConnection.chat(PlayerConnection.java:2121) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at net.minecraft.server.network.PlayerConnection.b(PlayerConnection.java:2189) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at net.minecraft.server.network.PlayerConnection.lambda$17(PlayerConnection.java:1895) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
    at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]```
cinder abyss
cinder abyss
slim pier
#

how to use??

cinder abyss
#

I'm not very good in nms, but maybe I can help you

slim pier
#
package com.qm.customname.System.Command;

import org.bukkit.WeatherType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class NameCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player p = (Player) sender;

        if(p.isOp()) {
            if (args.length == 0) {
                p.sendMessage("/nickname <player> <name>");
            } else if (args.length == 2) {
                if(args[0]!=null) {
                    p.setDisplayName(args[1]);
                    p.setPlayerListName(args[1]);
                }
            }
        }

        return false;
    }
}```
icy beacon
#

why do you need the player argument if you do not use it

#
  1. you are casting sender to Player, but you are not checking if sender is player (instanceof). this can and will lead to errors if this command is executed from the console
  2. the <player> argument in your command (args[0]) is not used, you just change the command executor's name instead
slim pier
#
package com.qm.customname.System.Command;

import org.bukkit.WeatherType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class NameCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player p = (Player) sender;

        if(p.isOp()) {
            if (args.length == 0) {
                p.sendMessage("/nickname <player> <name>");
            } else if (args.length == 2) {
                if(args[0]!=null) {
                    Bukkit.getPlayer(args[0]).setDisplayName(args[1]);
                    Bukkit.getPlayer(args[0]).setPlayerListName(args[1]);
                }
            }
        }

        return false;
    }
}```
cinder abyss
#

????

icy beacon
#

no

  1. don't call the method twice, cache it inside a variable
    Player target = Bukkit.getPlayerExact(args[0]);
  2. check whether it's null
    if (target == null) return
#

and you are still not checking whether the command executor is Player, but you blindly cast

slim pier
#
package com.qm.customname.System.Command;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class NameCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(sender instanceof Player) {
            Player p = (Player) sender;
            Player target = Bukkit.getPlayer(args[0]);
            if(target == null) return false;

            if (p.isOp()) {
                if (args.length == 0) {
                    p.sendMessage("/nicname <player> <name>");
                } else if (args.length == 2) {

                    target.setDisplayName(args[1]);
                    target.setPlayerListName(args[1]);

                }
            }
        }

        return false;
    }
}```
icy beacon
#

no

#

put the target inside args.length == 2

#

because args may be empty, but you still call args[0] without checking

slim pier
#
package com.qm.customname.System.Command;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class NameCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(sender instanceof Player) {
            Player p = (Player) sender;

            if (p.isOp()) {
                if (args.length == 0) {
                    p.sendMessage("/nickname <player> <name>");
                } else if (args.length == 2) {
                    Player target = Bukkit.getPlayer(args[0]);
                    if(target == null) return false;

                    target.setDisplayName(args[1]);
                    target.setPlayerListName(args[1]);

                }
            }
        }

        return false;
    }
}```
icy beacon
#

looks good

slim pier
#

ok thanks

hybrid sapphire
#

Can anyone help me

icy beacon
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

hybrid sapphire
#

Im getting "cannot find symbol 'PlayerName' " and "cannot find symbol 'W' "

icy beacon
#

?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.

hybrid sapphire
#

this is the error im getting ;

icy beacon
#

it says exactly what the error is

#

you don't have the variable playerName in scope

#

same for the variable w

lilac dagger
cinder abyss
#

well I've found

#

when I delete the previous jar it's working

#

strange

lilac dagger
#

Set a final name in build

hybrid sapphire
#

its weird cuz i never got that error it was only after i fixed the maven dep

lilac dagger
#

It'll always have that final name even without cleaning

icy beacon
#

there's literally not a variable named playerName in the scope of the function

#

how do you expect it to work

cinder abyss
# lilac dagger Set a final name in build

where ?xml <build> <directory>../target</directory> <!-- Build it one level up, because it is the one we care about --> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.5.0</version> <configuration> <relocations> <relocation> <pattern>org.bstats</pattern> <!-- Replace this with your package! --> <shadedPattern>fr.paulem.external.bstats</shadedPattern> </relocation> </relocations> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

#

oh ok <finalName>alot</finalName>

#

now it is xml <build> <directory>../target</directory> <!-- Build it one level up, because it is the one we care about --> <finalName>alot</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.5.0</version> <configuration> <relocations> <relocation> <pattern>org.bstats</pattern> <!-- Replace this with your package! --> <shadedPattern>fr.paulem.external.bstats</shadedPattern> </relocation> </relocations> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

cinder abyss
tender shard
#

why did you add ../target?

#

did you add this to a module's pom?

cinder abyss
tender shard
#

so this is your dist module?

cinder abyss
#

ALOT-maven

  • alot (main module)
    • target
  • other modules...
  • target (used for single module)
cinder abyss
tender shard
#

then it looks ok

cinder abyss
tender shard
#

I never use run configurations, I just double click on "package" in the maven tab

manic furnace
#

Whats the reason to use scoreboard-packets and not the official bukkit scoreboard?

cinder abyss
onyx fjord
#

for it

tender shard
#

however if you always wanna copy the file to ../target, I would not use a profile. Also note that the profile is now per module but you probably want to run packag eon the parent pom

eternal oxide
#

The only reason is to have player specific team colours

tender shard
#

yeah in that case I'd move the <configuration> directly into the maven-jar-plugin as in the "lazy method" in my blog post

#

like this

#

the profile is only there to not cause issues if someone doesn't have a path called C:\MytestServer\whatever

cinder abyss
#

well ?```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<!-- Replace this with your package! -->
<shadedPattern>fr.paulem.external.bstats</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
    <profile>
        <id>export-to-target</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <outputDirectory>../target</outputDirectory>
                        <finalName>alot</finalName>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>```
tender shard
#

add the amven-jar-plugin directly into <build><plugins>

cinder abyss
#

okay

tender shard
#

then delete the whole <profiles> section, you don't need it in this case

cinder abyss
# tender shard then delete the whole <profiles> section, you don't need it in this case

resultxml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <outputDirectory>../target</outputDirectory> <finalName>alot</finalName> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.5.0</version> <configuration> <relocations> <relocation> <pattern>org.bstats</pattern> <!-- Replace this with your package! --> <shadedPattern>fr.paulem.external.bstats</shadedPattern> </relocation> </relocations> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

#

well... 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 80, column 21 It is highly recommended to fix these problems because they threaten the stability of your build. For this reason, future Maven versions might no longer support building such malformed projects.

tender shard
#

to the jar plugin

cinder abyss
cinder abyss
# tender shard to the jar plugin
<groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <outputDirectory>../target</outputDirectory>
                    <finalName>alot</finalName>
                </configuration>```
tender shard
#

yes

cinder abyss
#

okay thanks 😄

tender shard
#

now run mvn clean package on the parent and it should work

cinder abyss
#

working 👍

#

thanks 😄

#

so easy herobrine

manic furnace
#

Any ideas how to advertise a plugin well?

eternal oxide
#

A good plugin advertises itself

daring schooner
#

Create proved it

quiet ice
#

Yeah, I don't think there is a particular need for advertising

buoyant viper
#

corporate buzzwords, pretty pictures, and the rule of 3

daring schooner
quiet ice
#
  • Write a good plugin
  • Give proper support
  • Don't disappoint
#

And in minecraft space that also includes supporting each and every version

#

\s

buoyant viper
#

even 1.4

fluid river
#

1.3.7

#

1.2.5

buoyant viper
#

1.0

fluid river
#

1.4.6

#

1.5.2

#

1.6

#

1.7

#

1.8

#

1.8.8 ofc

#

?18

#

?188

#

fuck

buoyant viper
#

?1.8

fluid river
#

i forgor

undone axleBOT
fluid river
#

thanks

#

1.8.8, 1.12, 1.19, 1.20

#

Guys i need the most funny idea for a plugin after my pen-is ban

young knoll
#

Ur what

quaint mantle
daring schooner
fluid river
#

same

fluid river
daring schooner
#

Industrial Craft was crazy back then

#

now we got create

fluid river
daring schooner
#

damn

fluid river
#

forgot the name

#

where you could make yourself a giant or a gnome

daring schooner
#

OH

#

YEAH

fluid river
#

gnomes could use leaves as paraglider

#

Or a parachute

fluid river
#

should the server crash tho

daring schooner
#

I think the mod i most enjoyed was buildcraft

#

I started coding because of Computer Craft

fluid river
#

Haha i feel so old

daring schooner
#

a loong time ago

fluid river
#

CC, BC, IC

#

linking pipes around 1kx1k block area

daring schooner
#

Red Power was a big one tho

fluid river
#

factorio in mc

daring schooner
#

Logistic Pipes

fluid river
#

hmm

daring schooner
fluid river
#

how do i block the main thread without making the server crash tho

#

won't it like auto-disable itself or smth

buoyant viper
#

very precisely timed thread sleeps AbsoluteHalal

fluid river
#

shit

buoyant viper
#

idk

fluid river
#

i need help

#

i mean i can just sysoutprintln and thread.sleep

daring schooner
#

Why you need to stop the main thread 😵‍💫

fluid river
#

in an infinite loop

young knoll
#

Just hack the watchdog so it doesn’t kill the server

#

Kek

daring schooner
#

Be a politician and fake it :)

fluid river
#

can i somehow make my plugin load last or first

#

of all plugins

#

idk maybe some plugin.yml tricks

eternal oxide
#

no

fluid river
#

like load: POSTWORLD

#

cuz i guess there are not tons of plugins which also load postworld

eternal oxide
#

default is postworld

young knoll
#

That’s nearly every plugin

#

^

cinder abyss
#

Hello, how can I add a ServerPlayer to the players tablist ?

fluid river
eternal oxide
#

send the addEntitypacket

fluid river
daring schooner
fluid river
#

didn't know that

daring schooner
#

Same as creating an NPC

#

Kody have a really good tutorial on Mojang Mappings

cinder abyss
daring schooner
#

Try ClientboundAddEntityPacket

#

You need to create an game profile

#

with a random uuid and the custom name

#

imma code it

#

wait

#

I don't think the packet i said does it 😂

cinder abyss
daring schooner
#

coding time

cinder abyss
#

@daring schooner

daring schooner
#

Im taking a look

cinder abyss
#

okay

daring schooner
#

Intellij and Spigot are completely using my RAM so my chrome is crashing lol

fluid river
eternal oxide
#

ClientboundPlayerInfoPacket and ClientboundAddPlayerPacket will show it

daring schooner
#

Are you setting the custom npc pos?

cinder abyss
fluid river
#

ahaha it also blocks stop command

cinder abyss
quaint mantle
daring schooner
#

Is the entity spawning?

cinder abyss
#

well, I killed them but they are spawning

eternal oxide
#

if the entity is spawnign there is no way (with that code) it's not added to the list

fluid river
#

nooooo

cinder abyss
#

there is only me

daring schooner
daring schooner
#

Can you paste a case of use

#

where you pass the gp

#

and other informations

cinder abyss
# daring schooner and other informations
public static @Nullable IHerobrine createHerobrine(Location loc, String name) {
        System.out.println(LibVersion.getVersion(VersionMethod.SERVER));
        return switch (LibVersion.getVersion(VersionMethod.SERVER).toString()) {
            case "1.20.1", "1.20.0" -> Herobrine_1_20_1.createHerobrine(loc, name);
            case "1.19.4", "1.19.3" -> Herobrine_1_19_4.createHerobrine(loc, name);
            case "1.18.2" -> Herobrine_1_18_2.createHerobrine(loc, name);
            case "1.17.1" -> Herobrine_1_17_1.createHerobrine(loc, name);
            default -> null;
        };
    }```
fluid river
#

any ideas how can i do this

daring schooner
#

ClientboundPlayerInfoPacket?

cinder abyss
fluid river
#

i wanna stop the main thread

cinder abyss
fluid river
#

and only do Loading...

cinder abyss
cinder abyss
fluid river
#

look at the message above

daring schooner
#

yeah yeahh

fluid river
#

the plugin which just infinitely spams Loading

daring schooner
#

just trying to find something wrong lol

#

The code looks correct

fluid river
#

and blocks everything

daring schooner
#

but it isn't

cinder abyss
daring schooner
#

😵‍💫

cinder abyss
fluid river
#

bruh

#

that was "funny plugin idea"

#

i'm just testing it

#

and well, using thread.sleep on the main thread doesn't work sadly

#

well i can also just cancel all events

#

and say Loading on every player join or move or smth

cinder abyss
#

well...

fluid river
#

tho console would spam something anyways

daring schooner
#

I know this sound kinda stupid. Did you try to restart the server

#

lol

fluid river
#

who

daring schooner
hazy parrot
#

If you block main thread server probably wouldn't work much longer

fluid river
#

it just breaks bro

#

))

hazy parrot
#

What is even point of it lol

fluid river
#

fun

cinder abyss
daring schooner
fluid river
#

i just want "Loading..." forever

cinder abyss
fluid river
#

what else can i do to fuck everything up but be able to spam loading

#

in console

hazy parrot
#

That seems malicious tbf

fluid river
#

bruh it's personal

#

malicious to me ig

#

will crash my pc fr

cinder abyss
fluid river
#

nice

cinder abyss
#

I added java connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED, this));

daring schooner
#

Oh, that's new

fluid river
daring schooner
#

i didn't knew it existed

quaint mantle
fluid river
#

how

daring schooner
#

well an apple a day, keeps new nms giberrish away

#

@fluid river if you have success in your development. I'll personally try to sell it to elon musk

#

The man that stopped time

fluid river
#

i sadly don't know what to do

fluid river
quaint mantle
#

X plugin

daring schooner
#

lol

cinder abyss
fluid river
#

infinite loading screens for minecraft

#

cute bunny twitter videos -> cute bunny x videos

daring schooner
daring schooner
fluid river
#

💀

quaint mantle
#

💀

cinder abyss
#

elon is the most hated guy in the world I think 💀

daring schooner
#

Oh, idk i like elon

#

I don't get why people are mad about a stupid bird

#

lmao

fluid river
#

i still need help

daring schooner
#

Damn i might just start a war

cinder abyss
#

well, for me it is twitter, and elon is elon, not more.

fluid river
#

how to sleep main thread without killing the server

cinder abyss
fluid river
#

i mean it would have some time to operate

quaint mantle
cinder abyss
#

make your plugin on another thread and stop it, you'll stop your plugin main thread

daring schooner
fluid river
#

i need to stop the servers main thread

#

basically pause it 9999 times and spam loading

young knoll
#

You need to kill or trick the watchdog

fluid river
#

and let it go after long load

#

how?

cinder abyss
#

is he okay ??

fluid river
#

that's how i usually sleep

eternal oxide
#

wrong lookat code

cinder abyss
sterile breach
#

Hi, on my server stop, i need to convert all my data in cache in the database, but if i do it in async. Thats don't work because the plugin got disabled before and i get an error. then what is at the stoping if I do it synchronously it doesn't matter, no?

eternal oxide
#

new ClientboundRotateHeadPacket(npc, (byte) Math.floor(npc.getYHeadRot() * 256f / 360f));

fluid river
#

what does main thread actually do after Enabled (99s took)

#

I mean i can just kill everything in it

#

so it just does nothing

#

and there will be place for my loading stuff

warm mica
young knoll
#

The main thread does pretty much everything

fluid river
#

How would scheduler help me with blocking the main thread from everything except my plugin

fluid river
daring schooner
fluid river
#

as i said i can stop all events

#

and probably block all input commands

#

but it would still do something

warm mica
fluid river
#

Basically i want this

daring schooner
fluid river
#

and after that just
Loading... Loading... Loading...

#

infinitely

eternal oxide
#

seems pointless. You may as well fire up your own console and spam sysout

fluid river
#

but i want it as mc plugin

#

not a standalone console app

eternal oxide
#

waste of time

fluid river
#

i know

#

but still

eternal oxide
#

There is no "still"

fluid river
#

i wanna do this

#

if it's possible i want to find out how can i do this

eternal oxide
#

Its seriously a waste of time with no beneficial outcome or knowledge to learn from it.

warm mica
#

Have a repeating scheduler with 1 tick that calls Thread.sleep for 5 seconds

sterile breach
#

Hi, on my server stop, i need to convert all my data in cache in the database, but if i do it in async. Thats don't work because the plugin got disabled before and i get an error. then what is at the stoping if I do it synchronously it doesn't matter, no?

fluid river
#

i thought about it

#

lemme actually try it out

fluid river
#

nobody is playing

#

so you can just do it sync

hazy parrot
hazy parrot
#

No point in it

sterile breach
fluid river
#

fun-killer

sterile breach
#

okay thanks

hazy parrot
#

You should periodically save your data anyway

#

Not just on Disable

warm mica
#

You're doing something wrong if you have to save that much data when stopping the plugin

hazy parrot
#

What if server crash. All your data is yeeted

cinder abyss
#

is nms' ServerPlayer considered like a real player ?

sterile breach
#

no player data is saved when a player leaves the server. moreover, these are not very important data (just player'settings (if player wnat receive chat for exemple))

cinder abyss
eternal oxide
cinder abyss
#

I think it's client side because when I disconnect and reconnect, it disappears

eternal oxide
#

nmsWorld.addNewPlayer(npc);

fluid river
cinder abyss
pale cedar
#

Anyone help me

cinder abyss
young knoll
#

Huh

#

I didn’t know you could actually add fake players to the world

fluid river
#

well i did it

#

but there is one small problem

pale cedar
#

Anyone know why minions skin not showing

fluid river
#

after thread.sleep is done, there is some time until the timer goes again

#

and in that 1 tick all console commands actually work

#

server processes all of the commands i typed while thread was sleeping

#

in 1 tick

#

well i like it anyways

quaint mantle
fluid river
#

just put that in config.yml resource?

quaint mantle
#

yeah i did

fluid river
#

or what

quaint mantle
#

so if i have it in resources/config.yml i don't need that?

fluid river
#

i mean what are you trying to automate

quaint mantle
#

i don't want to do config.addDefault() every time a new key is added

cinder abyss
quaint mantle
#

so is it possible?

fluid river
#

who adds the keys tho

eternal oxide
fluid river
#

well you do it with addDefault or manually in config.yml anyways

eternal oxide
#

it will if you don;t have a null send

#

void

fluid river
#

code won't auto-complete

quaint mantle
fluid river
#

you do it in 1 place only tho

quaint mantle
#

I have a config.yml in the resources file

#

you can see if you go to the github link i specified

fluid river
#

just put everything there lol

eternal oxide
fluid river
#

and forget about addDefault

quaint mantle
#

what

#

why?

#

oh

#

so basically you can have everything in config.yml

fluid river
#

yes

quaint mantle
#

and you don't need to add it with addDefault

fluid river
#

and never use addDefaults

#

Tho you would need saveDefaultConfig() to actually copypaste yml file from jar to plugin folder

quaint mantle
#

config = getConfig();
saveDefaultConfig(); both of this plus resources/config.yml are the whole thing i need to have a config.yml

fluid river
#

with all data you typed in ide

#

config.yml

cringe: true
integ: 1

plugin

public void onEnable() {
    saveDefaultConfig();
}```
quaint mantle
#

hm alright tysm

fluid river
#

after that you will have config.yml in plugins/yourPlugin

quaint mantle
#

why doesn't the wiki have this?

fluid river
#

with all that cringe data you wrote in resource config

cinder abyss
fluid river
#

ive never seen a guy who used addDefault

quaint mantle
#

idk i've been using it for a while just because spigot wiki has them and no one has bothered to change it so far

fluid river
#

saveDefaultConfig() is as old as bukkit isn't it?

eternal oxide
#

yes

fluid river
#

so well idk why wiki forces you to use addDefault

#

if you can just manually place everything you need in config.yml resource

eternal oxide
#

link?

sterile breach
#

hi,

if i get the title of an item and i check if it is equale to §2a

if i have set the title to chatcolor.dark_green, i got true?

fluid river
#

well i guess addDefault can be useful if you are not familiar with yaml syntax

#

cuz bukkit's yaml has "mylist.var-one"

#

which translates to

mylist:
  var-one: 1
quaint mantle
#

hm

fluid river
#

you cannot use get("mylist.var-one") with default snakeyaml impl

quaint mantle
#

yeah im definitely dumb

fluid river
#

literally first line

quaint mantle
#

yea thats why i said im dumb

fluid river
#

)

#

alr gtg

sterile breach
#

hi,

if i get the title of an item and i check if it is equale to §2a

if i have set the title to chatcolor.dark_green, i got true?

fluid river
#

cya

undone axleBOT
quaint mantle
#

i decided to read further which ended up in this situation

fluid river
#

why don't you just check item.getItemMeta().getDisplayName().equals("§2a")?

#

without this ChatColor.SHIT thing

hazy parrot
#

Or just don't check items by title

icy beacon
#

i have a bungee plugin that i would also want to function as an api. this means that i would want to call methods in my spigot plugin that would be executed by the bungee plugin. if it were two spigot plugins, i'd have no trouble setting it up, because i've already worked with those apis, but i'm not sure how to go about this case?
can i somehow fetch the bungee plugin instance inside of my spigot plugin? if so, it's a piece of cake to call the api methods afterwards, if i just set the api scope to provided it should call the methods from the bungee plugin

eternal oxide
#

you can;t

quaint mantle
icy beacon
#

welp shit

eternal oxide
#

Plugin messaging channels

icy beacon
#

oh actually yeah

#

i can communicate a method call with a message

quaint mantle
#

You can create adapter plugin for spigot

icy beacon
#

like a spigot plugin that functions as a convenience api for sending the messages?

#

yeah i think that's the way to go actually

eternal oxide
#

no point in over-complicating it

icy beacon
#

hm?

#

do you have another idea?

#

i don't see another way haha

eternal oxide
#

implement PMC in yoru plugin

#

no point in abstracting to yet another API in another plugin

icy beacon
#

well the api is not going to be used only by this particular plugin

#

there are going to be multiple

#

why not conveniently separate the api calls from the plugins then?

eternal oxide
#

its literally a send and a listener. no point in a plugin for that

icy beacon
#

i know, i'm just saying that the bungee api is going to be used by multiple plugins. if i were to not abstract into a separate spigot plugin, i'd have to copy my logic into each of them

#

don't you think so?

eternal oxide
#

no

unborn sable
#

How would I turn a plugin I made into an api to use in other plugins

icy beacon
#

"don't repeat yourself"?

#

or "write everything twice" xD

eternal oxide
#

unless you have a dozen or so plugins, all you are doing to sendinga packet for a request

icy beacon
eternal oxide
#

PMC is already an API. You are talking about wrapping an existing API in your own API so you can save a handfull of lines of packet info per plugin

icy beacon
#

haha, fair enough

eternal oxide
#

how many method calls are you needing to query on bungee?

icy beacon
#

uhh the api contains maybe 25-30 methods

eternal oxide
#

all of those have to be accessed via PMC?

icy beacon
#

i guess so, if there's no other way

livid dove
#

I mean I'd say sod all these guys off, and actually try it.

If it works for you, cool. If not, you can share why it's a bad idea in a spigot thread.

We are dev help, not dev "tell you how to make ur plugin"

icy beacon
#

i'm going to request a method call via pmc, bungee will listen to it and execute the method

icy beacon
#

i'm just a newbie with bungee yet

eternal oxide
#

If you are using 20-30 methods on teh Bungee plugin I'd begin asking if yoru bungee plugin is doing more than it needs to

livid dove
eternal oxide
#

bungee plugins are generally very light as bungee is simply a proxy

icy beacon
livid dove
#

Imho, just write the dang thing and then get a code review

#

Worst that'll happen is its shit

icy beacon
#

i think i'll just do my initial way of separating the api into a separate plugin, if it's inconvenient i'll just put it back inside the plugin

livid dove
#

Sweet

#

Good lad

eternal oxide
#

I'd say get it workign in one spigot plugin

icy beacon
#

don't think it's possible in my case

#

thanks everyone for help, i'll get coding 🙂

eternal oxide
#

theres nothing to change on the bungee end if you decide to abstract it to anothe rplugin

livid dove
#

No worries. Keep elgars advice in mind and document the whole process and make an informative spigot thread out of it, one way or another

icy beacon
#

cya!

livid dove
#

Good lad. Happy coding!

#

Now as for you @eternal oxide ... let 👏 them 👏 cook! 👏 🤣

Jk ofc.

onyx fjord
#

let them do the dumb shit!

livid dove
#

🤓

#

Think im gonna make that plugin jam thread this week too

onyx fjord
#

is making plugin instance a singleton a good idea

kind hatch
#

It's already a singleton no?

onyx fjord
#

this is what i mean

#

im thinking this vs DI

ivory sleet
#

thats fine

#

but it may break against concurrent accesses of getInstance

livid dove
ivory sleet
#

myea thats the easiest way

iron palm
#

are nms codes that are using nms package without the version package compatiable to each other?

carmine mica
#

No, never

iron palm
#

damn

carmine mica
#

NMS isn’t guaranteed to be compatible with the next build of spigot from the previous build. It could change 2 times in a day

austere cove
ivory sleet
#

yeah... well. You should always have a really good reason if you wanna use a static singleton

#

since it does compromise a lot of design and flexibility

livid dove
austere cove
#

that implementation is bad

livid dove
iron palm
ivory sleet
iron palm
#

wont it change in mojang mappings?

echo basalt
#

just DI everywhere and don't bother about it

livid dove
onyx fjord
echo basalt
#

Yeah

carmine mica
onyx fjord
#

🤔

ivory sleet
#

managers, or more professionally known as high level facades have no correlation to being singletoned, or multitoned for that part

echo basalt
ivory sleet
#

myea not always

echo basalt
#

yeah sometimes it's a list wrapper

iron palm
ivory sleet
#

then u have a repository, or registry facading class

iron palm
#

😭

ivory sleet
#

but yea

#

it can be at times def

#

just not a must

livid dove
#

So you don't think a class that should have only one instance as it's a dang manager... would benefit from a singleton design pattern...

echo basalt
#

nah

ivory sleet
#

buddy

livid dove
#

Pal

ivory sleet
#

manager does not mean its gonna be one instance

echo basalt
#

only time i make static instances is with uhh

#

mongodb codecs and even then I'm icky about it

#

icky but eh

ivory sleet
#

looks fine

livid dove
opal juniper
#

gotta love edna mode

ivory sleet
livid dove
#

All in favour of chocolate changing their name to Edna mod

echo basalt
#

more about coupling n shit

livid dove
#

Choco

ivory sleet
#

manager is just a term for a high level facade

echo basalt
#

conclure is the guy when it comes to theorical java

#

man knows every single term

#

in theory

livid dove
#

*and considering they coined the damn pattern 😅

ivory sleet
#

what are you even on about

livid dove
#

I trust conclube very much so. Very much respect him. But I'm currently reading the printed words of the 4 mad lads who wrote these patterns to page...

onyx fjord
#

PoolImporterDescriptorContextManagerPolicyClientManager

austere cove
#

where abstract and factory

onyx fjord
#

IAbstractPoolImporterDescriptorContextManagerPolicyClientManagerFactoryImpl*

livid dove
onyx fjord
#

cant forget the c# I

onyx fjord
#

HAHA

lilac dagger
#

Nvm

onyx fjord
#

knew it!

livid dove
onyx fjord
#

I really annoys me

#

internally

ivory sleet
#

they talk about the canonical singleton pattern

echo basalt
#

every time I look at this I feel like I fell in the trap of enterprise code

ivory sleet
#

manager is not a pattern they really talk about canonically

onyx fjord
#

most premium resource devs make everything static

ivory sleet
#

as its just a facade at the end

onyx fjord
#

thats why we should too

#

to be premium

echo basalt
#

yeah 90% of premium plugins are absolute garbage

quaint mantle
#

How do I call event async?

fluid river
#

hu taged me

worldly ingot
#

By calling the event asynchronously

#

Just be sure to pass async as true in the super constructor of Event

fluid river
opal juniper
echo basalt
livid dove
#

Ima leave this to an excerise for the avid reader and call it a day.

Agree to disagree conclube. I'm not gonna make a big song and dance over this lmao. Legit no beef mate.

opal juniper
#

that’s what i mean, it’s a pain lol. Why support so many tho. Normally there is just SQLite & MySQL

onyx fjord
#

java books

#

i dont have one 😭

opal juniper
#

biggest waste of money

echo basalt
#

Like specifically asked for it

opal juniper
#

fair

livid dove
#

Book

echo basalt
#

it uses a slightly different driver

ivory sleet
#

thats singleton

#

not manager

echo basalt
#

Instead of mediumblob it's bytea in postgres

livid dove
echo basalt
#

looks braindead but works

ivory sleet
#

yes but it has nothing to do with managers

echo basalt
#

ignore how the island data is literally just the same as a islandid <-> ownerid relationship

ivory sleet
#

it just happens to be so that windows manager was named as an example

#

it does not even remotely imply managers are to be single instanced

onyx fjord
#

i dont think a manager ive made ever had two or more instances

ivory sleet
#

you need to re-read that

opal juniper
ivory sleet
opal juniper
#

different pattern to what i’d do

ivory sleet
#

just that u didnt name them manager

#

but u prob had some facade classes

onyx fjord
#

my managers are p much hashmap wrappers

ivory sleet
#

that are just managers

echo basalt
#

It just loads the thing and tests a connection

onyx fjord
#

i just use my own naming for stuff

#

that i think matches what it does

#

at the end of the day i must understand what my code does

ivory sleet
#

yea

#

i can name one example

#

FileConfiguration

#

that can be considered a facade class for some stuff. pretty sure u've had multiple instances of it

echo basalt
#

funny how FileConfiguration implements ConfigurationSection

ivory sleet
#

yea

onyx fjord
#

guess what PlayerMessageData is?

ivory sleet
#

a data transfer

livid dove
#

If its okay can I dm you conclube, I don't want to turn this into a public shit show as I do have one more image from the book to show u mate.

If you have a copy I'd suggest looking on the design patterns relationships on the first page

onyx fjord
#

its a wrapper for a yaml config

echo basalt
#

Something tells me your books are outdated

fluid river
ivory sleet
#

its not like im saying stuff out of guessing

echo basalt
lilac dagger
#

i made a yaml wrapper too 😄

#

this is how the config file looks like

echo basalt
#

ehh

onyx fjord
echo basalt
#

I've done that but it's a bit too much

#

I should put sonarlint on my plugins list tbh

onyx fjord
#

hate it when sonarlint is wrong

onyx fjord
#

so config autogenerates ideally

slender elbow
#

mfw people think singleton means static

onyx fjord
#

and autoupdates

echo basalt
#

Like ehh

lilac dagger
#

yeah, it's super cool

echo basalt
#

I have a method to copy lines to auto-update my configs

onyx fjord
#

does yours generate the config and update it @lilac dagger

lilac dagger
#

yup

echo basalt
#

It just pulls whatever is missing from the builtin resource

lilac dagger
#

loads the values from config first then recreates the config

echo basalt
#

I mostly use it on my messages.yml

onyx fjord
#

rock the microphone

onyx fjord
lilac dagger
#

old yaml doesn't support comments so i couldn't just add them to mine

onyx fjord
#

?

#

do you use snakeyml for it btw?

lilac dagger
#

if i were to support newer versions would be as easy as adding an annotation and write 3 lines of code

#

it's what spigot has

onyx fjord
#

wdym old yamltho

lilac dagger
#

yeah

#

i'm supporting 1.15+

#

and hopefully 1.8.8 too

onyx fjord
#

oh you mean

#

old versions of spigot have older yaml

lilac dagger
#

yes

onyx fjord
#

with no comment support

#

gotcha

#

i see

lilac dagger
#

indeed

onyx fjord
#

u can check for version and just enable that for supported ones tho?

lilac dagger
#

sure but it's also a lot of work adding comments just for the ones using he latest

#

but i might do it

#

i just have to write a bunch of comments

onyx fjord
#

lol i dont wanna look at anybodys code that has such wrapper

#

so i dont copy anyone

cinder abyss
#

Hello, how can I remove the ServerPlayer after he dies ?

echo basalt
#

Send an entity destroy packet

cinder abyss
#

what is the name ?

#

(in 1.20.1)

echo basalt
#

Not sure exactly but I know that it's plural

#

Like ClientboundRemoveEntitiesPacket or something

cinder abyss
#

okay thanks

#

well...

#

it needs a int

#

oh ok

#

it's entities ids

echo basalt
#

bot

vast ledge
#

Please

#

dont

#

advertise

echo basalt
#

?services

undone axleBOT
vast ledge
#

Goto spigot forums

#

yea

river oracle
#

jesus christ holy text wall

ivory sleet
#

message deleted delete

slender elbow
#

thank you conclube for your dedication

ivory sleet
#

:3

echo basalt
#

hmm facing a weird problem right now

icy beacon
#

face the other way

echo basalt
#

I'm making this skyblock system and a feature that people have requested before was the ability to have profiles, so that you can have like 3 islands attached to your account.

My skyblock system just uses island UUIDs that are tied to the player's id, but there are multiple approaches I can take to profile switching:

  • A sort of mapping interface that takes the player and returns its uuid, by default just returning the player's own, but profile plugins can add their own impl that returns the profile id
  • Creating my own player join/quit events that have a player id, which profile plugins can just call with their own profile ids instead
#

I'm also not sure if I should make the invite system tied between the player and the island (/island join ImIllusion) or just create a unique invite code

#

But I'll probably just use the player name honestly, looks cleaner

#

And is a bit more secure

#

I might also just make a bunch of interfaces with default impls and a separate premium plugin for profile switching :)

livid dove
#

If its player related why not skip a step.and make it the players uuid

echo basalt
#

Because the player's UUID is set by mojang

livid dove
#

And?

echo basalt
#

There is only 1 per player

#

What I'm looking for is a sort of selection system where the player can select their own profile id

livid dove
#

Right... so a Map<UUID, Set<Island>> uwu

echo basalt
#

Ehh it's not that simple

livid dove
#

Isn't it?

echo basalt
#

n o

#

Because I'm not going to load 5 different islands when the player joins

#

If the player is only going to play on one of them

cinder abyss
#

Hello, how can I make a ServerPlayer (created from zero) take knockback like a normal player ?

livid dove
#

Erm... classes don't have to load what they contain on load...

#

You ca have a build method in island..

echo basalt
#

It's just not a clean alternative

eternal oxide
livid dove
#

Agree to disagree

echo basalt
#

I might just make a SkyblockPlayer class with a realId, selectedProfileId and maybe displayName

#

And keep it on redis

cinder abyss
eternal oxide
#

?paste

undone axleBOT
flat kindle
#

Is it possible to write objects into yml like in JSON?

eternal oxide
flat kindle
#

or I need to use sections/workaround

cinder abyss
#

source ?

echo basalt
#

Ehh I created a new branch and will try to bodge something up

#

If it looks clean it'll get merged

echo basalt
#

If not it'll get reverted and I'll rewrite it with what I learned

cinder abyss
#

(I'm on 1.20.1)

eternal oxide
#

1.19.2, but not hard to update

cinder abyss
eternal oxide
#

no clue as I've not looked ato 1.20

cinder abyss
echo basalt
#

I think I found a neat solution

eternal oxide
#

It looks like they use a key now. You'd have to look in DamageSource to find the one that applies bypass armor

eternal oxide
#

some damage sources ignore armor

cinder abyss
#

so I need to check the damage type ?

#

@eternal oxide

#
public static final DamageSource IN_FIRE = (new DamageSource("inFire")).bypassArmor().setIsFire();
    public static final DamageSource ON_FIRE = (new DamageSource("onFire")).bypassArmor().setIsFire();
    public static final DamageSource IN_WALL = (new DamageSource("inWall")).bypassArmor();
    public static final DamageSource CRAMMING = (new DamageSource("cramming")).bypassArmor();
    public static final DamageSource DROWN = (new DamageSource("drown")).bypassArmor();
    public static final DamageSource STARVE = (new DamageSource("starve")).bypassArmor().bypassMagic();
    public static final DamageSource FALL = (new DamageSource("fall")).bypassArmor().setIsFall();
    public static final DamageSource FLY_INTO_WALL = (new DamageSource("flyIntoWall")).bypassArmor();
    public static final DamageSource OUT_OF_WORLD = (new DamageSource("outOfWorld")).bypassArmor().bypassInvul();
    public static final DamageSource GENERIC = (new DamageSource("generic")).bypassArmor();
    public static final DamageSource MAGIC = (new DamageSource("magic")).bypassArmor().setMagic();
    public static final DamageSource WITHER = (new DamageSource("wither")).bypassArmor();
    public static final DamageSource DRAGON_BREATH = (new DamageSource("dragonBreath")).bypassArmor();
    public static final DamageSource FREEZE = (new DamageSource("freeze")).bypassArmor();
    public static final DamageSource STALAGMITE = (new DamageSource("stalagmite")).bypassArmor().setIsFall();```got them !
eternal oxide
#

No clue I've not looked at teh new registry system

cinder abyss
eternal oxide
#

ok

slim pier
#

When using p.setDisplayName(String) to change the name in Minecraft version 1.19.4 or higher, this error occurs. Help me

#
java.lang.IllegalStateException: Missing key in ResourceKey[minecraft:root / minecraft:chat_type]: ResourceKey[minecraft:chat_type / minecraft:raw]
    at net.minecraft.core.IRegistry.e(SourceFile:88) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at net.minecraft.network.chat.ChatMessageType.a(ChatMessageType.java:59) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at net.minecraft.network.chat.ChatMessageType.a(ChatMessageType.java:49) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at net.minecraft.server.network.PlayerConnection.chat(PlayerConnection.java:2121) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at net.minecraft.server.network.PlayerConnection.b(PlayerConnection.java:2189) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at net.minecraft.server.network.PlayerConnection.lambda$17(PlayerConnection.java:1895) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
    at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
    at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]```
cinder abyss
#

idk where they are registered

#

and to find it I should get all damages messages errorsystem

silver robin
#

i have here a plugin which should hide players' nametags if they are behind a wall https://paste.md-5.net/ikozaxubap.java
the way it works is using packets it tells each client separately about a team which has nametagVisibility: never and in that team it puts players that the client should not see. it works, but i noticed with protocollib that it sometimes sends the packet to update team info (it's different than updating players in that team), even though my code never sends that packet. here is the log: https://paste.md-5.net/gohibifumi.sql
here is the packet (1.16.5 protocol version 754): https://wiki.vg/index.php?title=Protocol&oldid=16657#Teams

is nms or something doing it internally? should i intercept and block these excess packets or will the client dismiss them normally?

cinder abyss
slim pier
# slim pier When using p.setDisplayName(String) to change the name in Minecraft version 1.19...
package com.qm.customname.System.Command;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class NameCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(sender instanceof Player) {
            Player p = (Player) sender;

            if (p.isOp()) {
                if (args.length == 0) {
                    p.sendMessage("/nickname <player> <name>");
                } else if (args.length == 2) {
                    Player target = Bukkit.getPlayer(args[0]);
                    if(target == null) return false;

                    target.setDisplayName(args[1]);
                    target.setPlayerListName(args[1]);

                }
            }
        }

        return false;
    }
}```
cinder abyss
#

what did you entered ?

slim pier
#

/nickname question_mark33 asdf

#

I don't know why that error happened

flint coyote
#

What api-version is set in your plugin.yml?

slim pier
#

1.19.4

kind hatch
#

API version should just be the major version.

flint coyote
#

is that even a valid api version?

kind hatch
#

I.E 1.19

#

Minor versions are considered invalid.

slim pier
#

maybe

Spigot-API 1.19.4-R0.1-SNAPSHOT

flint coyote
#

I said plugin.yml not pom.xml

slim pier
#

1.19

sterile breach
#

Hello, in the inventory object, if i open the same inventory for two players, thes two inventory are considered like equals?

flint coyote
#

well then that's fine. Where did you get the spigot version you are using?

#

On your server

#

Don't do that

slim pier
#

.

flint coyote
#

Compile it yourself

#

And yes what you tried to send is deleted automatically here

slim pier
#

okay

flint coyote
#

It's not a valid or official source for bukkit/spigot and might even contain malicious code

slim pier
#

where can i download bukkit?

kind hatch
#

?bt

undone axleBOT
kind hatch
#

You compile the server jar yourself.

slim pier
#

ok thanks

eternal oxide
#

Build it yourself ^ only safe and legal method

slim pier
#

👍

sterile breach
#

Hello, in the inventory object, if i open the same inventory for two players, thes two inventory are considered like equals?

silver robin
umbral ridge
#

hey

#

What's the difference between these two?

echo basalt
umbral ridge
#

Thanks

echo basalt
#

holy shit I found the limit of Map.of

#

got too many args

flint coyote
#

yes it's 10

#

the method is implemented a bunch of times

echo basalt
#

Yea

#

there's no varargs ok

flint coyote
#

If that wasn't part of java.util I'd probably blame people for writing code like that

echo basalt
#

Time to write something funky

cinder abyss
#

Hello, how can I remove a ServerPlayer from the tablist ?

icy beacon
#
static <K, V> Map<K, V> of(Pair<K, V>... pairs) {
...
}
``` xD
echo basalt
#

ofc my ide caches broke

eternal oxide
#

REMOVE_PLAYER update packet

cinder abyss
echo basalt
#

Nah I just wrote something funky

eternal oxide
#

it's the remove version of ADD_PALYER. one shoudl exist

abstract sorrel
#

What would cause this error?

Could not resolve dependencies for project io.github.runtellobama:ArcturusRpg:jar:1.0-SNAPSHOT: Could not find artifact org.spigotmc:spigot:jar:remapped-mojang:1.20.1-R0.1-SNAPSHOT in spigotmc-repo
cinder abyss
#
public void deleteEntity(Player p, ServerPlayer toRemove){
        ServerGamePacketListenerImpl connection = ((CraftPlayer) p).getHandle().connection;
        toRemove.kill();
        connection.send(new ClientboundRemoveEntitiesPacket(toRemove.getId()));
        connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED, toRemove));
}```
icy beacon
abstract sorrel
#

what is the remapped flag again i forgot

icy beacon
#

?nms

abstract sorrel
#

thx

kind hatch
#

--remapped

cinder abyss
# eternal oxide <https://mappings.cephx.dev/1.20.1/net/minecraft/network/protocol/game/Clientbou...

I didjava public void deleteEntity(Player p, ServerPlayer toRemove){ ServerGamePacketListenerImpl connection = ((CraftPlayer) p).getHandle().connection; toRemove.kill(); connection.send(new ClientboundPlayerInfoRemovePacket(Collections.singletonList(toRemove.getGameProfile().getId()))); connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED, toRemove)); }

#

idk if I need to keep ClientboundRemoveEntitiesPacket Thinkeng

#

well, I'll keep all three LUL

young knoll
#

I was going to ask why there was no varargs for map.of

#

But it would require either the same key and value type, or you would have to have a vararg of Map.entry

flint coyote
echo basalt
#

Where they just do instance checks

echo basalt
#

but inheritance would easily break stuff

#

Like a <K, V> Map<K, V> of(Class<K> keyClass, Class<V> valueClass, Object... objects)

flint coyote
misty current
#

i'm using remapped nms on 1.19.4 but some fields or methods throw nosuchmethod/field errors. Do I have outdated mappings or something similar?

zealous osprey
echo basalt
#

profile system turned out clean enough

misty current
#

an example is entityManager in ServerLevel which throws a nosuchfielderror:
Caused by: java.lang.NoSuchFieldError: L

#

apparently when i compile, the field is remapped to L but it's not there at runtime

kind hatch
#

Are you sure your server is actually 1.19.4?

misty current
icy beacon
#

do you use the specialsource-whatever plugin in your pom?

misty current
#
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.19.4-R0.1-SNAPSHOT</version>
            <classifier>remapped-mojang</classifier>
            <scope>provided</scope>
        </dependency>
misty current
icy beacon
misty current
#
<plugin>
    <groupId>net.md-5</groupId>
    <artifactId>specialsource-maven-plugin</artifactId>
    <version>1.2.4</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>remap</goal>
            </goals>
            <id>remap-obf</id>
            <configuration>
                <srgIn>org.spigotmc:minecraft-server:1.19.4-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
                <reverse>true</reverse>
                <remappedDependencies>org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
                <remappedArtifactAttached>true</remappedArtifactAttached>
                <remappedClassifierName>remapped-obf</remappedClassifierName>
            </configuration>
        </execution>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>remap</goal>
            </goals>
            <id>remap-spigot</id>
            <configuration>
                <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
                <srgIn>org.spigotmc:minecraft-server:1.19.4-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
                <remappedDependencies>org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
            </configuration>
        </execution>
    </executions>
</plugin>
#

i really hope it's not

icy beacon
#

try it w/out paper

misty current
#

can I check paper obfuscated fields with its mappings somewhere

icy beacon
#

i'm sending a plugin message to my bungeecord plugin, the message is intended to make a selective query to the database and return a value. however, i have no clue how to receive the value back. my current idea is:

  1. send a message with an ID assigned
  2. wait for the response to come back with that id, put it into a map of <id, response>
  3. a completablefuture is waiting for the map to receive the value with a while-true map, after receiving the value it returns it
    this sounds very very hacky and funky and i feel like the while-true loop would eat performance. are there any better ideas?
eternal oxide
#

the returned message should contain all the information you need to handle it at the client

icy beacon
#

i think you misunderstood me a bit. take a look at the diagram, this is what i'm trying to achieve. when my adapter sends the query, the execution of the method ends. (e.g.)

fun selectiveDatabaseQuery(query: String, vararg parameters: String): Any {
  sendPluginMessage(getPlayerFrom(null), "selectivequery", latestUpdativeQueryID.toString(), query, *parameters)

i sent the request to obtain my data, but i have no way of retrieving it to return it with this very method. i can listen to the incoming messages and get the response, but how would i return it?

icy beacon
eternal oxide
#

if you are talking about between plugins you can just register and listen to events

#

you could even make your API plugin an RSP

icy beacon
#

i don't think we are on the same page. i can of course easily retrieve and send messages, but how would i do it in a smooth flow? when i need to send a message, wait for the result, and return the result, all within one method, how would i accomplish this?

eternal oxide
#

you can't wait

eternal oxide
#

well you could, if you are async

icy beacon
#

yeah i can go async

eternal oxide
#

however your response would come via a different method than your query

icy beacon
#

hm, can you explain the logic you're thinking of? i'll see how i can work with it

eternal oxide
#

what kind of data are you querying? and what do you need to do once it arrives?

icy beacon
#

well, for example it can be the player's locale

#

i just need to return it and work with it

#

actually btw those values are cached in a map if a player has logged on since the server has booted up

eternal oxide
#

So would you always do the same thing every time you received the players locale?

icy beacon
icy beacon
eternal oxide
#

if you always do the same thing then you trigger the same code everytime based upon that data

#

you disconnect your query and response logic

#

ie

#

a player joins and you send a request fo rtheir locale...

#

you do nothign else

icy beacon
#

well, example:

// 1)
val localeName = selectiveDatabaseQuery(QueryType.LOCALE, playerUuid.toString())
// 2) ???
// 3) profit
val locale;
eternal oxide
#

when the response comes its a locale so you perform x,y,z tasks as you just received a locale

icy beacon
#

hm yeah

#

i got a bit lost in the discussion, so how exactly do i retrieve the value?
say, i've sent the request:

selectiveDatabaseQuery(QueryType.LOCALE, playerUuid.toString())

now the adapter has received the locale and it's somewhere in the onPluginMessageReceived:

// :snip:
val locale = ...

what now? how would it be retrieved?

eternal oxide
#

what are you refering to as your adapter?

icy beacon
#

a separate plugin, an abstraction layer which provides the methods that are inside the bungee plugin

eternal oxide
#

your spigot adapter plugin queries your bungee plugin sending who asked, the query type and whatever other data it needs to find the data and return

#

bungee then returns who asked, the type and data

#

your adapter then forwards that to your plugin

#

This is why I said just get messaging working first. Don;t add in the complexity of an adapter

icy beacon
#

yes but forwards how? should i make an event like BungeeResponseEvent and send the data there?

icy beacon
eternal oxide
#

yes youd use an event

icy beacon
gilded tangle
#

Hey, do any of you know how I make RGB colors into a MOTD? Tried it with ChatColor.of("#0ea4e6") but unfortunately it didn't work :/

eternal oxide
#

you can do it all in a RSP (registered Serice Provider)

icy beacon
#

oh, haven't worked with those

#

hm

eternal oxide
#

its basically just a class template

#

your adapter registers it

#

your spigot plugin looks for it and registers any listeners you need

icy beacon
#

oh, sounds convenient

eternal oxide
#

same as most Economy or permission plugin

icy beacon
#

yeah, the only time i've encountered the use of rsp is when i was working with vault