#help-development

1 messages · Page 408 of 1

tardy delta
#

yes it is possible

bright spire
#

Thats weird, I always have the same issue where it doesn't execute with no errors or messages.

#

Thanks

hardy spoke
#

I have searched for a week now and I can't find any up to date information on how to generate Minecrafts Structures in my custom World Generation. I have tried using the Block Populator but I wasn't able to get it to work.

quaint mantle
#

How can I get blocks swam with Statistic.SWIM_ONE_CM?

chrome beacon
#

1 block = 1m
1m = 100 cm

tardy delta
#

is there a site that translates the wiki.vg packet name to mojang ones?

quaint mantle
cold field
dire marsh
#

I don't believe there is

tardy delta
#

oh man this naming is confusion, on mojang Clientbound refers to the fact thats its sent to the client, on minestom client refers to the fact it is received from the client 💀

tardy delta
#

sent to and received from is not the same thing

tall dragon
#

im not familiar with minestom, are u programming client side there then?

tardy delta
#

no

tall dragon
#

but the server sending it to the client and the client receiving it means the same thing to me

#

in both cases they go from server -> client

tardy delta
#

the naming is just confusing

#

when i hear client i think of clientbound

tall dragon
#

fair enough

modest garnet
#

how do i use percentage chance. e.g. 20% you get a diamond from a crate

tall dragon
#

you can use multiple approaches. for example ThreadLocalRandom to generate a random number

modest garnet
#

for example this is my items.yml the chances will be changed ofc

tall dragon
#

well you would just generate a number for each item

modest garnet
#

huh? are there any public gits?

tall dragon
#

im not sure what u mean. its really simple.

#

for example ThreadLocalRandom.current().nextInt(100); this would generate a random number between 0(inclusive) & 100(exclusive)

modest garnet
#

i understand that part

tall dragon
#

okay. so whats the problem.

river oracle
#

Struggling with weighting items? For crates?

modest garnet
#

but lets say i have a diamond = 10% and emerald = 20% do i just do if (int <= 20 && int > 10)??

tall dragon
#

right so u want a weight system

modest garnet
#

huh

tall dragon
river oracle
tall dragon
#

depending on their chance?

modest garnet
#

yes

tall dragon
#

well then you'd want a weight system

#

bassically what was sent above in the link

river oracle
#

Looks like a similar solution

tall dragon
#

nah actually i did it myself and it happens to be very similar lmao

desert tinsel
#

Why do I get this error: C:\Users\ursua\Development\Minecraft Server\plugins\BaseCreator/test.schematic [18:51:27] [Server thread/ERROR]: Error occurred while enabling BaseCreator v1 (Is it up to date?) java.lang.IllegalArgumentException: Plugin already initialized! at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:225) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:53) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?] at me.xsenny_.basecreator.BaseCreator.<init>(BaseCreator.java:5) ~[?:?] at me.xsenny_.basecreator.BaseCreator.onEnable(BaseCreator.java:15) ~[?:?]?

static ingot
#

java.lang.IllegalArgumentException: Plugin already initialized!
🤔

desert tinsel
#

yes but why?

#

uh

tall dragon
#

either a duplicate plugin in your plugin folder, you have multiple classes extending javaplugin, or you are creating another instance of your main class

#

idk which

desert tinsel
#

I had 2 somehow

#

no, I didnt

#

ah, I missed a class

static ingot
#

what

#

lol

modest garnet
tall dragon
#

correct

#

and in my case that is a double

tall dragon
#

It depends on the amount of items and the weight of other items

modest garnet
#

ok so how do i make its have a 20% chance to be picked thats what my question was

vague dawn
#

Hello, can someone help me? i am "new" to spigot coding and what happen:

I have created a cmd where i am trying to target player by their name - Bukkit.getServer().getPlayerExact(playerName);

Everything works fine, but when sender of the command write player name, which is currently not online - not on the server, i want to send the sender some message, but it keep throwing me error.. sorry for my english

Picture: https://pasteboard.co/hkuKlmHJFoZd.png

tardy delta
#

do a null check

#

first guess

desert tinsel
#

I tried to use World edit api to load and paste a schematic, all works well, but I get these messages in console, why?

[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.maxHealth'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.knockbackResistance'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.movementSpeed'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.followRange'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.maxHealth'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.knockbackResistance'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.movementSpeed'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.followRange'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.maxHealth'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.knockbackResistance'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.movementSpeed'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.followRange'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.maxHealth'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.knockbackResistance'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.movementSpeed' . . .
tall dragon
vague dawn
tardy delta
#

ye

vague dawn
#

ehm, how? 😄 do you want me to send full cmd code?

tall dragon
tardy delta
#

sent the relevant lines

vague dawn
#

i am using if (target == null) {..}

tardy delta
#

check that before you call target.getLoc

#

if target were null your code already crashed

vague dawn
#

i have add the targetloc now, when it was not there, same problem

#

the targetloc is only to play sound

tall dragon
vague dawn
#

even if a delete the targetloc, still error

tardy delta
#

recompile bruh

sick epoch
#

Hello ! I've a problem :
I want to write in a file the characteristics of players but i don't know how to do that

vague dawn
#

i only click run, it is not enough?

sick epoch
vague dawn
sick epoch
#

if someone can help me

tardy delta
#

also need to replace plugin and restart server

vague dawn
#

yep, xd

#

i know this

#

do you want to send the error?

#

this error appears only if i write the name of player who is not online

tardy delta
#

target is null as i said

tall dragon
#

And he also said to do a null check

tardy delta
#

does anyone knows the mojang name of this packet

vague dawn
#

yes, of course, but how to instead of error send the sender of the cmd message - sorry, but player xx is not online

tardy delta
#

this doesnt seem to hold much so idk if its this one

#

do the location call after the null check i said

vague dawn
#

i will try it

#

and let you know

vague dawn
tall dragon
tardy delta
#

man i saved a bunch of packet translations and i didnt save the file

sick epoch
#

can someone help me ? :)

tardy delta
#

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

sick epoch
#

?ask I've a problem :
I want to write in a file the characteristics of players like custom exp and name, but i don't know how to do that

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!

tardy delta
#
BukkitWiki

The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...

vague dawn
#

do you thing that i can just try to catch the exception and print message to sender?

tardy delta
#

learn how to do a null check

vague dawn
#

okey, i will try, thx for help

vague dawn
tardy delta
#

i clearly dont have any of that shit

tardy delta
#

other mappings ig

sick epoch
tardy delta
#

idk check my github

#

🤔

chrome beacon
undone axleBOT
tardy delta
#

ah ClientboundRecipePacket in mojang stuff

#

idk im working with that mcp-reborn stuff

chrome beacon
#

Why MCP Reborn ?

vague dawn
undone axleBOT
tardy delta
#

?paste code

undone axleBOT
vague dawn
#

check it, i have no idea whats wrong

#

i have // the target location

chrome beacon
#

Decompiled Minecraft based on the Forge toolchain

tardy delta
tawdry parcel
#

Why is that event not working?
ChatLink.java:

package com.koner.the5utils.chat;

import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;

public class ChatLink implements Listener {
    @EventHandler
    public void chatLink(AsyncPlayerChatEvent event) {
        event.setMessage(event.getMessage().replaceAll("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))", ChatColor.BLUE + "$1"));
    }
}
```In the Main.java:
```java
        getServer().getPluginManager().registerEvents(new ChatLink(), this);
tardy delta
#

uh oh

#

wtf is that even supposed to do? replace ip addresses?

#

atlaest use a Pattern

vague dawn
#

i am calling target.xx, but when its null ofcourse there is no one to add the healths, thats caused the error... i think?

#

target.setHealth(20)

tawdry parcel
tawdry parcel
vague dawn
tardy delta
#

it does but you are compiling a regex on every invocation

worldly ingot
#

It does, but it recompiles it every time

tardy delta
#

ninjad you

worldly ingot
#

And for an expression that large, that's expensive af

vague dawn
#

thx so much

tardy delta
#

did you even replace the jar?

vague dawn
#

yes

#

recompiled the code, and the new .jar put to plugin folder and restart server

tawdry parcel
# tardy delta atlaest use a Pattern

like that?

public class ChatLink implements Listener {
    @EventHandler
    public void chatLink(AsyncPlayerChatEvent event) {
        Pattern pattern = Pattern.compile("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))");
        event.setMessage(event.getMessage().replaceAll(pattern.pattern(), ChatColor.BLUE + "$1"));
    }
}
tardy delta
#

put it outside the method

vague dawn
remote swallow
#

Private static final too

tardy delta
#

bruh cant you find Enum#values anymore?

vague dawn
#

i am so sorry, but i do not know if you are talking to me or not

quaint mantle
#

Paying 100 usd to someone who makes me a spigot plugin for 1.19.3 that contains hungergames. Dm me

tardy delta
#

?services

undone axleBOT
tardy delta
#

man what am i doing with my life

#

should probably redo that in a md file

ivory sleet
desert tinsel
#

How to get a list of blocks that will be replaced by a schematic with worldedit api?

vague dawn
#

btw the problem was with getExactPlayer();

desert tinsel
#

I asked 🙂

tardy delta
#

im banned there smh

dusty herald
#

banned where

tardy delta
#

enginehub

dusty herald
#

👀

small hawk
#

What is the best approach to create case loot chance-drop system, u know like:

TOTEM: 10%
DIRT: 90%
BEACON: 1%
...
...

Player should always get something, not a chance to leave empty-handed.

dusty herald
#

you could just slap them all into an arraylist and shuffle it 😂

small hawk
#

u mean 90 occurrences of dirt in arraylist hah ?

dusty herald
#

but it wouldn't really give you a percentage of randomness

desert tinsel
worn tundra
#

Works like a charm

small hawk
#

i'll give it a try, tysm

dusty herald
#

i dont really do chances, i just Collections#shuffle

tender shard
#

NotNull

small hawk
worn tundra
#

(Not null)

tardy delta
#

there are actually people that code like that

modest garnet
worn tundra
#

Outputs E

#

the generic thing you put in it

modest garnet
#

amazing this is just what i was looking for ty

tawdry parcel
# tardy delta put it outside the method

like that?

public class ChatLink implements Listener {
    Pattern pattern = Pattern.compile("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))");
    @EventHandler
    public void chatLink(AsyncPlayerChatEvent event) {
        event.setMessage(event.getMessage().replaceAll(pattern.pattern(), ChatColor.BLUE + "$1"));
    }
}
```Because it's still not working \:C
worn tundra
#

regex 😵‍💫

tardy delta
#

use Matcher

#

<= radius * radius

#

ye

worn tundra
#

player#spawnParticle

tawdry parcel
# tardy delta use Matcher

like that?

public class ChatLink implements Listener {
    Pattern pattern = Pattern.compile("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))");
    @EventHandler
    public void chatLink(AsyncPlayerChatEvent event) {
        String url = pattern.matcher(event.getMessage()).group(1);
        event.setMessage(event.getMessage().replaceAll(pattern.pattern(), ChatColor.BLUE + url));
    }
}
tardy delta
#

Matcher#replaceAll?

brisk estuary
tardy delta
#

shaded it?

brisk estuary
#

it was working the last time I tested it

#

idk why it isn't working now

modest garnet
eternal oxide
#

you try to get a plugin instance in a static way

#

runs too early

small hawk
signal kettle
#

Hello, I want to change block that get burned on to another one, but I tried everything that came to my mind and after block get burned then he just disapear like normal, any idea?

signal kettle
#

e.g

public class AshListener implements Listener {

    private final Plugin plugin;

    public AshListener(@NotNull Plugin plugin) {
        this.plugin = plugin;
    }

    @EventHandler
    public void OnBlockBurn(final BlockBurnEvent event) {
        Block block = event.getBlock();

        block.setType(Material.DIAMOND_BLOCK);
    }
}
sterile axle
#

It won't be really accurate, since the generator is not truly random but pseudorandom, but you can generate a pseudorandom number between 0 and 1 (exclusive upper bound, so max 0.999), multiply by 100% to get a percentage between 0% and 99.9% and then figure out which item you will give based on that

#

oh i was hella scrolled up, jesus

#

ignore me

remote swallow
#

discord strikes again

dry yacht
#

And you're sure that the message looks as expected if you just print it through a call to sendMessage?

#

I think the component should have a very verbose toString implementation, try printing that real quick.

#

Damn that string is messed up, D:

#

It's messed up way before you pass it into the component, so the component has nothing to do with it

#

How did you accumulate so many color codes

#

The ö is also already not encoded properly

#

definitely, :D. To me, this is just a huge black box, and it wouldn't be that far fetched if it actually does that to the string. Can you try printing without ColorAPI.process once?

#

Oooh, the "§x§f§f§a§a§0§0" is supposed to be an encoded rgb color somehow, but I really wonder how that's supposed to work. If there's no other processor in the line that takes care of this notation, it'll end up as the latest color for the client, which is 0 - black.

#

And the ö is already messed up, seems like a file/config problem to me.

tender shard
#

it should use UTF8 automatically, unless you do some weird things with Streams or Readers or Writers or sth without specifying the charset

dry yacht
#

What OS are you on? Can you check the file encoding somehow?

eternal oxide
#

Your file is not UTF8 in yoru jar so it never gets saved as UTF8

dry yacht
#

new InputStreamReader(getResource(""), StandardCharsets.UTF_8);

#

Try adding that parameter

tender shard
#

does it claim to be UTF-8 in your IDE?

dry yacht
#

I don't know what it defaults to...

#

Better be explicit

graceful oak
#

Having this issue where im trying to send a packet to a craftPlayer but when doing the CraftPlayer.getHandle. then I dont get the playerConnection to send it in not sure if im doing something wrong but I have all the imports did something change from prev versions or am I doing something wrong.

https://pastebin.com/9eCDE5gh

Note: Its ok if my code doesnt work or im doing something wrong if you wanna give me a tip thats cool but im just starting to play around with packets and mining speed so im just doing some testing.

tender shard
#

btw what's the purpose of loading, then saving the config?

#

why not just use saveResource() ?

#

no, it just overwrites your existing file with the included one

dry yacht
#

Haha :D, that's a whole other topic, xD.

tender shard
#

i don't know

#

usually you want to load your included file through the stream, THEN additionally load the existing file, and THEN save it

dry yacht
#

Because the hex color lib is just straight up broken

tender shard
#

basically you could just do it like this:

Config myConfig = new Config("messages.yml");
myConfig.save();
dry yacht
#

But great that utf-8 works now

tender shard
#

no idea what you mean

#

if you have an old file that misses a new key, you load the old file, and get the default value for the new key from your included config. then you save it so it includes both, the old already changed keys, and they new default key

dry yacht
#

No matter what you do, if you only load the baked in resource and then save immediately, without any migration steps in between, you'll overwrite the user's changes.

tender shard
copper scaffold
#

after rejoining my server my created npc isn't looking at me anymore. Has someone a advice for me to make that work again?

Player p = e.getPlayer();

        Main.getInstance().getNpcs().stream()
                .forEach(npc -> {
                    Main.getInstance().log("2");
                    //The location of the NPC
                    Location loc = npc.getBukkitEntity().getLocation();
                    Main.getInstance().log("3");
                    //Calculate a new direction by subtracting the location of the player vector from the location vector of the npc
                    loc.setDirection(p.getLocation().subtract(loc).toVector());
                    Main.getInstance().log("4");

                    //yaw and pitch used to calculate head movement
                    float yaw = loc.getYaw();
                    float pitch = loc.getPitch();

                    Main.getInstance().log("5");
                    //get the connection so we can send packets in NMS
                    ServerGamePacketListenerImpl ps = ((CraftPlayer) p).getHandle().connection;

                    Main.getInstance().log("6");

                    //used for horizontal head movement
                    ps.send(new ClientboundRotateHeadPacket(npc, (byte) ((yaw%360)*256/360)));
                    //used for body movement and vertical head movement
                    ps.send(new ClientboundMoveEntityPacket.Rot(npc.getBukkitEntity().getEntityId(), (byte) ((yaw%360.)*256/360), (byte) ((pitch%360.)*256/360), false));

                });
dry yacht
#

You do understand why it's black tho, from the console log, right?

#

Just to maybe clear things up a bit: That implementation cannot work at all, as you can't format hex colors into a plain string. You'd need to set the color on the component itself, so if you're not using some sort of custom components and there is nothing else down the line which would pick this weird notation up and process it into the corresponding json field, it's not gonna work.

#

Wait, normal chat messages actually display as proper RGB?

#

I'm going to need to try something real quick on my local host, xDD

tawdry parcel
dry yacht
quaint mantle
#

I'm trying to remove x amount of items of type from an inventory

#

I've tried ```java
player.getInventory().remove(new ItemStack(material, x));

tawdry parcel
# tardy delta Matcher#replaceAll?

you mean like this:

public class ChatLink implements Listener {
    Pattern pattern = Pattern.compile("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))");
    @EventHandler
    public void chatLink(AsyncPlayerChatEvent event) {
        Matcher matcher = pattern.matcher(event.getMessage());
        event.setMessage(matcher.replaceAll(ChatColor.BLUE + matcher.group(1)));
    }
}
quaint mantle
#

Oh

#

Thanks

trail oriole
#
String message = colorPrefix + "■ " + ChatColor.RED + player.getDisplayName() + " §r» " + event.getMessage();
event.setFormat(message);```
Why does the red chat color not work on OP players but does for everyone else ? (the rest of the message formatting works)
tardy delta
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

tardy delta
#

essentials?

dry yacht
#

I'm actually weirded out beyond repair right now, lol. This "§x§f§f§0§0§0§0Hello, world!" turns into the component "{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"#FF0000","text":"Hello, world!"}],"text":""}", which is then sent to the client. How?! Is that standard notation? I really don't think so, does the server process this on not-already-"componentized" messages? That would explain why it doesn't work on the component.

trail oriole
#

not working as in being white instead of red

tardy delta
#

§x§f§f§0§0§0§0 cmon man

dry yacht
#

Well, hex colors just aren't really native, that's what I'm working on fixing at the moment, btw, lol

#

But that project is way too experimental to be ready soon

tardy delta
#

saying minecraft uses components internally too 💀

tawdry parcel
#

Why doesn't this code make URLs blue?

public class ChatLink implements Listener {
    Pattern pattern = Pattern.compile("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))");
    @EventHandler
    public void chatLink(AsyncPlayerChatEvent event) {
        Matcher matcher = pattern.matcher(event.getMessage());
        if (matcher.find()) {
            event.setMessage(matcher.replaceAll(ChatColor.BLUE + matcher.group(1)));
        }
    }
}
dry yacht
tardy delta
tardy delta
onyx fjord
#

C# conventions are so bad

dry yacht
#

I'm planning on allowing custom notation along the lines of "§#RRGGBB" everyhere, no matter if tab, scoreboard, lore, name, chat, action-bar, etc. I'm also planning on auto-fallback colors for via backwards and the like, based on the client version.

tardy delta
dry yacht
tardy delta
dry yacht
#

javae

#

It is, and I'm very, very close.

#

No idea if it's actually useful tho.

tender shard
#

this syntax makes me shiver every time

tardy delta
#

i just use #RRGGBB and it works fine when i translate it

remote swallow
#

wat

dry yacht
tardy delta
#

chat event

onyx fjord
tender shard
dry yacht
#

I want to translate straight in the core.

tender shard
onyx fjord
#

It looks so wrong

tardy delta
#

thats valid

#

non static inner class

dry yacht
#

Wait

remote swallow
dry yacht
tender shard
#

check out the first class I sent

#

WeightedElement is an inner class of the "list"

tender shard
#

hence one cannot just do new SomeClass.InnerClass(...) but one needs to do mySomeClass.new InnerClass(...)

tardy delta
#

the idea of exposing non static inner classes hurts me tho

tender shard
#

because the inner class depends on the SomeClass instance

tender shard
#

everytime the WeightedElement's weight is changed, it must call a method of the outer class

dry yacht
tender shard
#

oh yeah well it works the other way around, no clue why

#

oh I know why

#

because "list" could be another class

#

if one had a class called "list" and a variable called "list", one wouldn't know whether new list.InnerClass is actually an inner class of the already existing instance called "list", or whether it's a static inner class of the class called "list"

tardy delta
#

does spigot have smth like Recipe#getResult?

tender shard
#

yes

#

it's called Recipe#getResult()

tardy delta
#

minestom doesnt have it 💀

dry yacht
tender shard
#

probably very rare but since java isn't kotlin, this syntax is needed lol

tardy delta
#

me messing with internal stuff

#

all those impl classes are mine 💀

#

just copying mojang code now lol

dry yacht
tardy delta
#

uhh ig not

#

i should make a fork then

#

and i have no clue how that would work with maven and stuff

#

like when i make a fork, can i still use a maven dependency?

#

if i dont have it hosted somewhere

tender shard
#

mvn install installs it to your local repo

tardy delta
#

and how would i use it in my code then?

tender shard
#

like always

tardy delta
#

and how does maven know whether to pick the original dependency or my forked one?

tender shard
#

if you mvn intall it with the same name and version as the original, only your forked version is in your repo

#

usually you'd add a classifier or change the version or group id for your fork

#

e.g. <artifactId>whatever-myfork</artifact>

#

I would just change the groupid from the official one to me.mfnalex or sth

tardy delta
#

and i just do sync fork every now and then?

tender shard
#

yeah

tardy delta
#

lemme watch some tutorials, i dont want to break stuff again 💀

#

somehow have to get this code into ij now, just git clone ig

ivory sleet
#

i like

tardy delta
#

i dont like when the interface doesnt have stuff i need

#

also i dont understand why they made some stuff in recipes mutable

#

them writing getResult in every subclass but they couldve just put it in the interface

analog thicket
#

Okay so, I have this right here. As shown in the video, I've been trying to make them rotate faster after the first animation. My problem is they all clump together instead of rotating separately. (I have them all in a list)

#

Any help would be appreciated.

#

I've tried looping through the list and teleporting them that way, but that's when they clump together.

tardy delta
dry yacht
#

What's that fancy tool called? It's auto-generating, right?

hazy parrot
#

i think its embedded into intellij

#

ultimate

tardy delta
remote swallow
#

ultimate

#

smh

tardy delta
#

idk if its an ultimate feature

remote swallow
#

it is

tardy delta
#

ah yes

fallen fjord
#

how do I use ProfilePublicKey?

#

as in new ProfilePublicKey()

#

it says var0

#

and .a

sullen marlin
#

?xy

undone axleBOT
eternal oxide
#

ProfilePublicKey comes from Mojang for chat authentication

fallen fjord
#

so just put it as null?

sullen marlin
#

?xy

undone axleBOT
fallen fjord
#

?xy ProfilePublicKey

undone axleBOT
noble crown
#
analog thicket
#

It isnt possible to teleport a list of armorstands right?

eternal oxide
#

he's saying why are you asking? for what reason

noble crown
#

okay, I'll try it when I can

fallen fjord
#

put ProfilePublicKey as null?

sullen marlin
#

why do you need this variable

eternal oxide
#

why do you want to create a key?

fallen fjord
#

EntityPlayer

eternal oxide
#

use more words

fallen fjord
#

i need ProfilePublicKey for EntityPlayer as the 4th var

#

/statement

tardy delta
eternal oxide
#

to create an NPC or what?

fallen fjord
#

ye

dry yacht
tardy delta
#

what the-

dry yacht
#

Clean enough, right? LOL

tardy delta
#

i dont even have a screen big enough to see all of it

fallen fjord
#

same

eternal oxide
#

then so long as you block any packets yes pass null

tardy delta
#

mojang recipes aint that bad, they are only confusing as hell

fallen fjord
#

but does that also mean i cant click it?

#

to do something

eternal oxide
#

not related

fallen fjord
#

alr

eternal oxide
#

to click it you need to spawn it

tardy delta
#

man im still trying to get recipes working

#

deeping into the inner workings of the client cuz i cant seem to figure out what recipe variant is being used

#

well recipes work actually, only need the crafting

#

i cant even craft anything manually so cant confirm you that

#

i can confirm you that everything was red though

analog thicket
tardy delta
#

no cuz i havent implemented the clicking yet

analog thicket
#

?paste

undone axleBOT
analog thicket
tardy delta
#

like how would i be able to figure out if a player crafts sticks with wooden planks, spruce planks etc recipe_id will just be minecraft:sticks or smth

#

and some people have confirmed me that no packet is being sent when the item preview appears on the crafting grid

#

and i have no idea where to look how to client does it lol

dry yacht
#

I'd love to help, but I have never even used the preview feature, lol

tardy delta
#

idk what its called

#

i mean the items showing up whenever you click on a recipe

#

idk if that red is default behaviour

#

my idea was to detect what item is being shown and check if the player has enough items before clicking on the result slot

daring lark
#
java.lang.ClassCastException: class me.placek.rdcakelib.listener.inventory.CakeInventoryClickListener cannot be cast to class java.util.EventListener (me.placek.rdcakelib.listener.inventory.CakeInventoryClickListener is in unnamed module of loader 'RDCakeLib.jar' @2c568683; java.util.EventListener is in module java.base of loader 'bootstrap')```
why am i getting this error
#
 if(clazz.isAnnotationPresent(ListenerComponent.class)) {
                    EventListener listener = (EventListener) clazz.getDeclaredConstructor(plugin.getClass()).newInstance(plugin);
                    Bukkit.getPluginManager().registerEvents((Listener) listener, plugin);
                }```
remote swallow
#

its not EventListener, its just Listener

daring lark
#

CakeInventoryClickListener extends EventListener

tardy delta
#

java.util.EventListener is smth else then

daring lark
#

oh thanks

#

wrong import

remote swallow
#

use implements Listener

daring lark
#
public abstract class EventListener<T extends JavaPlugin> implements Listener {
    protected final T plugin;
    protected final RDCakeLib rdCakeLib;

    public EventListener(T plugin) {
        this.plugin = plugin;
        this.rdCakeLib = RDCakeLib.getPlugin(RDCakeLib.class);
    }

    public void register() {
        Bukkit.getPluginManager().registerEvents(this, plugin);
    }
}```
#

hmmm...

tardy delta
#

you only need the plugin for registering itself?

sullen marlin
tardy delta
#

minestom

#

lemme check if thats vanilla behaviour

remote swallow
#

minestom

tardy delta
#

more digging into mojang stuff ig

#

chatgpt is kinda useless for this one cuz it only agrees on what i say even thought its wrong

#

craft it manually 🤓

#

that stick adding thing is somthing i added myself though

quaint tapir
#

Im trying to make mobs not drop any items
event.getDrops().removeAll(event.getDrops()); I did this but it doesn't work

#

anyone help?

tardy delta
#

it says 2, my item just stays there

#

aint doing anything as i said cuz the server has to handle the recipe request

#

when a user clicks on an item i get a packet that tells what recipe id the user wants to craft, no issues with that only figuring out what variant they want

#

uhh custom? ig so

#

depends what you mean with custom

#

everything is packet based

tardy delta
#

the recipe manager just prepares a packet with all recipes that should be unlocked (set them all to true for testing) and it tells to client to unlock them in the crafting bench

quaint tapir
#

if I give the mob other custom drops will it remove those?

#

I just want zombies to not drop rotten flesh

#

I gave them custom drops

tardy delta
#

dunno why 3 click window packets are being sent instead of 1 when i place a material in the grid tho

#

time to rewrite the recipe manager from the ground up

#

and the recipe classes cuz those are weird

dry yacht
#

Which one are we talking about? xD

quaint tapir
#

` Wither wither = location.getWorld().spawn(location, Wither.class);
wither.setCustomName(ChatColor.DARK_RED + "Wither" + ChatColor.WHITE + " ( " + ChatColor.GREEN + "4000" + ChatColor.WHITE + " )");
wither.setCustomNameVisible(true);
Attributable witherAt = wither;

    AttributeInstance damage = witherAt.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
    AttributeInstance health = witherAt.getAttribute(Attribute.GENERIC_MAX_HEALTH);
    AttributeInstance speed = witherAt.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
    speed.setBaseValue(10);
    health.setBaseValue(4000);
    wither.setHealth(4000);
    damage.setBaseValue(100);`

I'm unable to change the health and damage of withers
I've done this for other mobs and it works but for withers it doesn't
Can any1 help?

tardy delta
#

what line lol

twin venture
#

hi , i have this issuse while playing with packets xd

  • lootbox spawn 100%
  • rotation 100%
  • click lootbox 1.8 done / 1.19.3 done (Need to do it for 1.16.5 , and other versions).

my problem is :
Unhandled exception occured in onPacketReceiving(PacketEvent) for SkyPvP
java.lang.ExceptionInInitializerError: null
at com.comphenix.protocol.events.AbstractStructure.getEnumEntityUseActions(AbstractStructure.java:614) ~[?:?]
at dev.skypvp.SkyPvP$1.onPacketReceiving(SkyPvP.java:166) ~[?:?]

code :

tardy delta
#

i clearly cant read

twin venture
#

ofc the problem is for 1.16.5 spigot

analog thicket
#

Is it possible to teleport a list of armor stands without looping them?

dry yacht
#

Oh, right. I guess I'm too inexperienced with villagers, as I never ran into this problem. What behaviour would you expect from the GUI, if it's still in vanilla state and doesn't know about custom tags? Or do you mean that it strips of custom tags somehow, when sending interacted items back to the server? :-:

analog thicket
#

Can't get it to work :/

#

They just clump together..

remote swallow
#

no

#

minecraft is single threaded so you would pause the main thread

hazy parrot
#

you probably dont ever want to sleep thread

remote swallow
#

that or scheduler

#

nah

hazy parrot
#

BukkitScheduler

analog thicket
remote swallow
#
Bukkit.getScheduler().runTask(JavaPlugin, () -> {
    //code
});```
dry yacht
#

If you're in your own thread, sure.

remote swallow
undone axleBOT
twin venture
#

any idea on how i can do this for : 1.16.5 ?
EnumWrappers.EntityUseAction action = event.getPacket().getEntityUseActions().read(0);
if (action == EnumWrappers.EntityUseAction.INTERACT_AT) {

using PacketType.Play.Client.USE_ENTITY / protocollib

#

nvm figured it out ..

analog thicket
#

Yep and my brain isn't mathing -.-

#

Can't get this shit to work -.-

crude flint
#

Hello, did someone can help me with messages between Spigot and a velocity proxy ?

#

this is the code in Spigot:
`public void sendCreateServer(UUID owner, Player player, String gameType) {
// Création d'un flux de données pour envoyer les informations
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(stream);

    try {
        // Écriture des informations dans le flux
        out.writeLong(owner.getMostSignificantBits());
        out.writeLong(owner.getLeastSignificantBits());
        out.writeUTF(player.getName());
        out.writeUTF(gameType);

        // Envoi du paquet de données sur le canal personnalisé
        player.getServer().sendPluginMessage(INSTANCE, "bungeecord", stream.toByteArray());
    } catch (IOException e) {
        e.printStackTrace();
    }
}`

and this in the Velocity proxy:
`@Subscribe
public void onPluginMessage(PluginMessageEvent event) {
if (event.getIdentifier().getId().equals("bungeecord")) {

        ByteBuffer buffer = ByteBuffer.wrap(event.getData());
        UUID owner = new UUID(buffer.getLong(), buffer.getLong());
        String playerName = StandardCharsets.UTF_8.decode(buffer).toString();
        String gameType = StandardCharsets.UTF_8.decode(buffer).toString();

        PRX.get().getServerManager().createServer(PRX.get().getProxyServer(), GameType.getGameType(gameType), owner);
    }
}`
tardy delta
#

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

oblique kettle
#

how can I reset all dimensions and world without restarting my server? I've tried

  • kicking all players
  • unloading world
  • delete world folder
    but despite these steps the world still remains
#

I'm using 1.19.3 spigot

eternal oxide
#

you can't delete any of the main worlds

#

only unloaded worlds

drowsy helm
#

oops misread

buoyant viper
analog thicket
#

Oh shit i forgot to take a walk with my tree too

dry yacht
buoyant viper
#

i love my printer bc it never stays connected to the wifi

#

and u need to reboot the whole thing because it bricks up for no reason

#

but u actually need to unplug the power cable bc the power button is useless 99.99% of the time

tender shard
analog thicket
#

I think my Watermelon is about to commit sins

remote swallow
#

my loft about to eat his dinner

analog thicket
tender shard
#

new CraftCactus();

remote swallow
#

(real)

dry yacht
# buoyant viper and u need to reboot the whole thing because it bricks up for no reason

Ah yes, welcome to modern firmware. I keep mine plugged in over ethernet to avoid this trouble, xD. It still has this super stupid firmware bug where images sent from the phone are trying to access the second paper tray (why you need two is beyond me), while images sent from the computer work just fine with the main tray. Guess what, happened after I was trying to fix another bug with a firmware update, ;).

buoyant viper
#

we cant move the printer either bc i think its connected to the phone line for faxing

#

and the router is across the house, also not moveable because of where our cable comes in

remote swallow
#

why do you fax stuff

dry yacht
#

Maybe because it's actually reliable and you know that the other party received it, xD. Not like "uh, I never got that mail, what are you talking about?"

buoyant viper
#

i rarely print anything

#

but i always have to unfuck the printer when something happens

remote swallow
dry yacht
tender shard
#

e-mail is just considered text form, not written form

remote swallow
#

true ig

quaint tapir
#

Whats the easiest way to make custom durability for items
Is there a built in way to increase the durability of items?

tender shard
#

also with fax you got proof that it actually got delivered. emails could just go to spam folder (gmail), not get accepted at all (t-online) or the recipient's email server answers with "yes, accepted" but never actually delivers the mail (microsoft)

#

"microsoft blackhole"

buoyant viper
#

gonna charge my family 99¢ everytime they need help with tech

dry yacht
dry yacht
buoyant viper
#

same

remote swallow
#

anyone know of a decent language/translation lib that lets you define languages/auto determins what languages are supplied in X dir?

echo basalt
#

make your own

#

it's like

#

15 lines

remote swallow
#

effort

echo basalt
#

it's literally 15 lines

remote swallow
#

only wanna do that if nothing exists

modest garnet
#

hey is there anyway i can use another plugin a in the server that doesnt have an api to use its functions

ivory sleet
ivory sleet
#

u can probably just do stuff thru the plugin's main class instance

modest garnet
hazy parrot
#

and cast it to that plugins class

modest garnet
hazy parrot
drowsy helm
remote swallow
#

i did??!?!

#

send again

remote swallow
drowsy helm
#

paper supporter

remote swallow
#

ah

remote swallow
#

using it for a plugin, that they get to choose language for. kinda dont want to force choose the language

ivory sleet
#

well, u should use resource bundle api

remote swallow
#

ill check it out

warm mica
young frost
#

Does anyone have a plugin where random players can make kits other players cant see the kits and just the player who made them can they can also claim the kits yk

young frost
#

😦

drowsy helm
#

thankyou for posting in every channel

warm mica
graceful oak
#

Is there a way to check if the player stopped a blockDamageEvent?

drowsy helm
#

yteah abort

#

^ that one

graceful oak
#

Thanks

terse pumice
#

It appears to be under material unlike the majority of BlockData instances that are data.type

analog thicket
terse pumice
#

ooh it's dancing

#

i've seen a similar bug to this before

#

it's a rendering error that i don't believe can be fixed

analog thicket
#

theres no way

#

how the hell

#

can i do it then -.-

dry yacht
#

I don't think so that it is, that sounds pretty odd

analog thicket
#

Yep but i seriously dont know why it should do it

#

Ive even tried adding delays on like 20 secs, but its the same speed lol

dry yacht
#

It's gonna be pretty much impossible for anybody else but yourself to spot the mistake as long as it's not locally reproducible. This could literally be a million different things.

dry yacht
#

I don't see another way to help you, :/. If I'm going to get side tracked again and implement this from scratch myself, it'll not only likely not fit into your system, but take quite some effort, xD

analog thicket
fickle ivy
dry yacht
fickle ivy
#

What about putting where they come out in one function them where they rotate in another then just have it repeat the one where they rotate over and over?

analog thicket
#

if im understanding correcly.

fickle ivy
modest garnet
#

any open to review my code to check my efficiency etc

analog thicket
#

there is a loop for every armorstand

dry yacht
#

The method is already out of the loop?

analog thicket
#

Oh

#

Wrong one then lol

dry yacht
#

What's stand then even? Are you shadowing some stand variable in the loop?

analog thicket
#

Well the jumpy stuff happends when i put it in there..

dry yacht
#

Yeah, because you're using a whole other variable

#

I cannot help you without knowing what's above that

analog thicket
#

ill send 2 secs

dry yacht
#

It's very, very likely just a logic issue, rather than a rendering bug

analog thicket
#

There is lots of improving still to do.. its just in testing fase..

dry yacht
#

Ugh, that hurts my head, :-: It's such a ratsnest, haha

analog thicket
#

Yeeep

#

i know

#

It was worse later today lol

dry yacht
#

Yeah, I think I know your issue, but I don't know how I would fix that

#

To be honest, it'd be faster just starting over with what you know now

analog thicket
#

Hmm what the issue?

#

The giant ratsnest?

#

Haha

dry yacht
#

Man, I don't even know how to put it into words, xD. You've made it so much more complicated than it needs to be... :/.

I also don't know what animation you want to play, but you need to think about each armor stand individually. Then, have each one do the circle at another point in time.

analog thicket
#

Probs the spawn part

dry yacht
analog thicket
#

You're right. Got any ideas on what to simplify?

#

Other than the spawn part?

dry yacht
#

I'm really bad at communicating that, :/. I'd probably make up most of it on the way, but I'd try to have as many reusable medium-sized functions as possible to then compose the final animation as clean as humanly possible.

analog thicket
dry yacht
#

What do you want the animation to look like? They're in essence only moving on a circular path, just phase-shifted, right? So basically each with a delay.

analog thicket
#

Yep, then after I want it to rotate 360 degrees a bit faster, then remove all except the one above the chest. Then make some kind of particles, then a reward.

#

If that makes sense

dry yacht
#

You had the rotation tho, so I guess you want them to go back to the top before you despawn them, and that doesn't work?

analog thicket
#

Yeah, the first part. But after that I want to make it look like its choosing a random armor stand, which is the part where it goes around fast in a circle. This is the part that i can't get to work.

remote swallow
#

what would the best method to get all the files/resources in a folder in a plugins resources, eg i have

resources
-languages
--file.yml
--file2.yml
--etcetc

which method would be better to get the files

dry yacht
#

I don't think there's a way to do that without looking at your jar file at runtime.

terse pumice
#

How can I check if a block is a pressure plate that is powered? I have tried a couple things but have had no luck so far

dry yacht
sullen marlin
#

look at javadocs, look at pressure plate, look at blockdata

#

?jd

terse pumice
sullen marlin
#

its Powerable now

#

blockdata

terse pumice
#

Tried that too

#

didn't work

sullen marlin
#

?paste

undone axleBOT
sullen marlin
#

share code

terse pumice
#

ahh you want the code

#

LOL

sullen marlin
#

weighted pressure plate is different to pressure plate

terse pumice
#

🤯

sullen marlin
#

weighted plates are AnaloguePowerable, as per javadocs

terse pumice
#

Wouldn't have thought of that

#

thank you

sullen marlin
#

getPower > 0

remote swallow
#

forge and spigot be like

modest garnet
#

any open to review my code to check my efficiency etc

sullen marlin
#

share and see?

ivory sleet
modest garnet
#

not complete yet waiting for core

graceful oak
#

For nms Im really new to it and just playing around with it I know there is some sort of spigot version where they rename everything from the a b c d and so on is that a thing for 1.19 and how would I obtain the renamed version or am I thinking of something else because right now all I am seeing is letters and I wanna make sure I am doing the correct things

remote swallow
#

that would be remapped mojang

#

?nms explained on here

graceful oak
#

thank you

sullen marlin
#

code seems ok, though not super java-y (eg lowercase classes)

#

also you never register your events yet

remote swallow
#

i dont think those are util classes, more of managers/handlers

drowsy helm
#

nitpick but annotations should be above declaration not inline

drowsy helm
#

funky

sullen marlin
#

yeah but the constructor method is never called in main class

buoyant viper
graceful oak
#

Im trying to find out what PacketPlayOutBlockBreakAnimation was renamed to in the nms remapping and if you know the answer how would I go about finding out information like this in the future?

remote swallow
sullen marlin
#

?jd

worldly ingot
#

Kind of reminds me... I need to add a new method there that accepts an Entity

#

sendBlockDamage(Location, float, Entity), or (Entity, Location, float)

remote swallow
#

what would it do

#

like other entitites?

worldly ingot
#

More than one entity can damage a block at a time

#

So multiple overlapping damages basically

remote swallow
#

ah

#

we should also get a World.sendBlockChange(Location, float, Entity...)

worldly ingot
#

What for?

remote swallow
#

sending block changes to multiple entities

#

is that one float?

#

thought that was material data or something

worldly ingot
#

Not sure what you mean

worldly ingot
#

Yeah but like... why would it need an Entity?

remote swallow
#

my brain didnt think that far

#

unless path finding would change, so entities would need to fake see it

worldly ingot
#

Not quite how that works lol

#

Buddy I think it's late for you KEKW

remote swallow
#

yeah

#

probably

buoyant viper
#

minecraft needs multiple people mining 1 block to mine faster

analog thicket
#

@dry yacht Kind of got it fixed, but there are still a few things to fix! And its ALOT simpler now.

sullen marlin
#

Looks fancy

#

Well done

analog thicket
#

Thanks!

rough ibex
#

Reminds me of hypixel's mystery vaults

analog thicket
#

How do they look?

steady moth
dry yacht
tawdry parcel
#

Why is ChatEvent#setMessage not working?

public class ChatLink implements Listener {
    @EventHandler(priority = EventPriority.HIGHEST)
    public void chatLink(AsyncPlayerChatEvent event) {
        event.setMessage("test");
    }
}
tawdry parcel
#

With that code my server outputs (first picture) ```java
public class ChatLink implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void chatLink(AsyncPlayerChatEvent event) {
event.setMessage("Not working!");
event.getPlayer().sendMessage(event.getMessage());
}
}

sullen marlin
#

I don't understand

#

What part is not working

#

Message is the message, player name is part of the format

#

Javadocs explain

tawdry parcel
dry yacht
#

@echo basalt

I thought this might interest you as well. Check out how the size changes if I look into the sky, for example.

https://streamable.com/jkccg9

I totally underestimated how much reduction the PacketCompressor actually brings to the table. The map packets would usually be at around 16.5kB, where a really complex map is - after compression - at around 2.5kB-3kB. For UIs and the like, I think 2.5kB max is a safe assumption. My panel was 5x3, thus around 38kB per frame, and I ran roughly 20 fps. 760kB per second, which is ~6Mbit. Panels don't need to run at 20 fps most of the time tho, their refresh rate should be adaptive.

outer sorrel
#

i am trying to send some data to the server the player switches from and to using bungeecord but it only likes to send it twice to the one that the player connects to, why does this happen?

    @EventHandler
    public void onServerChange(ServerSwitchEvent event) {
        ProxiedPlayer player = event.getPlayer();

        ByteArrayOutputStream b = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(b);
        try {
            out.writeUTF("ServerSwitchEvent");
            out.writeUTF(player.getName());
            out.writeUTF(event.getFrom().getName());
            out.writeUTF(player.getServer().getInfo().getName());
        } catch (IOException e) {
            e.printStackTrace();
        }

        player.getServer().sendData("BungeeCord", b.toByteArray());
        event.getFrom().sendData("BungeeCord", b.toByteArray());
    }
sullen marlin
#

Check what getServer and getFr return

outer sorrel
#

the world titles are correct at least. says switched from world other to world hub

#

they are certainly the different servers but the data only gets sent one

#

switched from BungeeServerInfo(name=other, socketAddress=localhost/127.0.0.1:25567, restricted=false) to BungeeServerInfo(name=hub, socketAddress=localhost/127.0.0.1:25566, restricted=false)

#

i tried with just the sendData to the getFrom but it still sends to the one they join

sullen marlin
#

They might leave the other one too soon

outer sorrel
#

ok i got an alt on to test just in case and now it sometimes works?

#

ah yea it might be a loading thing then

regal carbon
#

hey, im confused on how the plugin messaging works between bungeecord to spigot, the bungee plugin is reporting that the message is being sent, but there is no response on the spigot side

sullen marlin
#

youre not using the right channel in sendmessage

#

its queuerestart:queuerestart not QueueRestart

#

also make sure its registered spigot side

haughty storm
#

How can I search for a structure or a biome in my plugin

sullen marlin
#

Search javadocs for locate

#

Structures anyway idk about biome

haughty storm
#

Ok, thx. I'll see if I cand find anything

quaint mantle
#

How can I get block drops from a Material?

sullen marlin
#

?jd

sullen marlin
#

Can’t

quaint mantle
#

Damn

sullen marlin
#

Can get from block and itemstack

worldly mountain
#

How would I go about creating a custom loot table and inserting it into blocks?

quaint mantle
sullen marlin
#

Needs a block in the world sadly

quaint mantle
#

Dang

eternal oxide
#

Currently that also only shows you the possible drops, not the actual drops you will get

#

BlockDropItemEvent tells you what IS dropping

quaint mantle
#

So I'm like checking statistics to check if a player collected enough potatoes and take them from their inventory if that's the case

#

But you can't have Material.POTATOES in your inventory

eternal oxide
#

Statistics will not tell you how many are in their inventory

worldly mountain
#

I tried looking at loot.LootTable but that seems to only be for mobs and even then I can’t figure out how to make it work

quaint mantle
eternal oxide
#

in your Inventory you have only ItemStack

polar atlas
#

can someone explain me this behaviour?

    internal fun setEnchantGlow(value: Boolean) {
        val nmsi = asNMSCopy.invoke(null, itemstack) as net.minecraft.world.item.ItemStack

        val compound = nmsi.getTag() ?: CompoundTag()

        val enchantments = if (compound.contains("Enchantments")) compound.get("Enchantments") as ListTag else ListTag()

        val enchantment = CompoundTag()

        if (value) enchantment.putString("id", "null")

        enchantments.add(enchantment)

        compound.put("Enchantments", enchantments)

        nmsi.setTag(compound)

        Bukkit.getLogger().info(compound.toString()) // {Enchantments:[{id:"null"}],display:{Lore:['[{"translate":"language.region"}]'],Name:'[{"text":"You are from","color":"white","italic":false},{"text":" "},{"translate":"language.region"}]'}}

        itemstack = asBukkitCopy.invoke(null, nmsi) as org.bukkit.inventory.ItemStack

        val nmsi_0 = asNMSCopy.invoke(null, itemstack) as net.minecraft.world.item.ItemStack

        Bukkit.getLogger().info(nmsi_0.getTag().toString()) // {Enchantments:[],display:{Lore:['[{"translate":"language.region"}]'],Name:'[{"text":"You are from","color":"white","italic":false},{"text":" "},{"translate":"language.region"}]'}}
    }

but when i /data get entity @p SelectedItem.tag.Enchantments

[]
smoky oak
#

thats not even java lol

buoyant viper
#

its kotlin

#

which has java interop

eternal oxide
#

why are you using nms just to set a glow?

polar atlas
#

cause why not

eternal oxide
#

because it's pointless and over teh top

smoky oak
#

also itll break with the next update most likely

#

theres a reason apis exist

polar atlas
#

also thats not my question - why is field set to empty array when i invoke asBukkitCopy

eternal oxide
#

if you have a Spigot question we are all ears

smoky oak
#

well i have one

#

is it possible to bypass the << 2 shift when setting biome data

eternal oxide
#

bypass?

smoky oak
#

somewhere in the nms code there's a 2 left shift for setting biome metadata

#

like leaf color n stuff

#

i dont recall the exact code

#

is it possible to bypass that?

#

i was trying to get specific colors into cauldrons, not lakes lol

eternal oxide
#

then mask rather than bitshift

buoyant viper
#

does biome affect cauldron water? i never noticed that

smoky oak
#

wdym mask?

smoky oak
eternal oxide
#

& 0xFF etc to select only the bits you want

smoky oak
#

i

#

doubt thatll work

#

lmc the code

buoyant viper
#

oh hey wait Elgar while ur here

#

#help-server message u authored that class so i assume u wrote it, ur backup date format isnt compatible with Windows file naming, meaning u cant make backups with Towny on windows

worldly mountain
#

How do I make a custom Loot Table and put it into a barrel?

eternal oxide
#

so I probably wrote it, 8 or so years ago

smoky oak
worldly mountain
#

And I have to write a loot table and add it to my plugin resources?

#

Or how does that work

calm falcon
#

Sorry if I'm interrupeting, but I have a quick question. Can the player.getOpenInventory().getTopInventory(); method ever return null?

eternal oxide
#

I just checked my source, I guess I did

grand magnet
#

?paste

undone axleBOT
smoky oak
#

wheres the remapped list again?

#

like where it says what nms path maps to which remapped path

grand magnet
smoky oak
#

uh
could my pom be malformed? I am depending on spigot and spigot-api

calm falcon
#

No idea what's wrong

tall dragon
tall dragon
smoky oak
#

i just cached a chunk and tried to call getHandle

#

im trying to access the biome index but i cannot find it

opal juniper
#

invalidate caches if pom is correct

buoyant viper
tall dragon
grand magnet
smoky oak
#

they mightve changed the code i was referring to earlier. It seems that biomes are internally linked with LevelChunkSection (PalletedContainer<Holder<Biome>>), but i cannot for the life of me figure out wtf palletedContainer does. Apparantly it has an internal class named Strategy, which gives the left shift by which a 'key' for the Holder<Biome> is determined?

It might be possible to provide a custom Strategy but i wouldnt bet on it. NMS is weird...

btw Elgar if ur interested in the paths, here they are

net.minecraft.world.level.chunk.ChunkAccess
net.minecraft.world.level.chunk.LevelChunkSection
net.minecraft.world.level.chunk.PalettedContainer
eternal oxide
#

the shift is to strip lower/higher bytes so you can easily read the value you want

smoky oak
#

refer to my earlier statement, idfk what it does lol. if i remember correctly that shift is 2, so i have to set it to 0 to do 1x1 biomes i assume?

eternal oxide
#

a shift of 2 means its stripping 2 bits

#

Location is the same, you can bit shift to get teh chunk

smoky oak
#

wait a goddamn second

#

that shift is to convert in-container coordinates into a single integer, the size variable gives how many bits the coordinate may have

eternal oxide
#

teh size is how many bits to shift by, so stripping x bits

smoky oak
#

public int getIndex(int var0, int var1, int var2) {
return (var1 << this.sizeBits | var2) << this.sizeBits | var0;
}

#

its not stripping shit

#

its stuffing it into one int

eternal oxide
#

yes it is, its a mask then shift

#

| is a logical or

smoky oak
#

ill revisit this when i have more braincells available

#

some idiot woke me up and now im running on 3 hrs of sleep

eternal oxide
#

🙂

heavy maple
#

Hello! does anyone know how I could make a tempban cmd?

eternal oxide
#

First learn Java

hybrid spoke
heavy maple
#

So I would just for example parse a time given as an argument and provide it in the expiry?

calm falcon
#

Loop over all online players and check every looped player for said permission.
you can use Bukkit.getOnlinePlayers(); to get all online players and Player#hasPermission(String permission); to check for a specific permission.

#

Yep, exactly like that

#

You are welcome

hazy parrot
frank kettle
#

is there a way to find if/where i wrote an exact piece of code in an entire intellij project?

frank kettle
#

shift + f does nothing

hazy parrot
#

Or ctrl shift f

frank kettle
#

worked, thank you

#

I wrote using DecimalFormat in the past and been trying to find where it was to quick copy paste it

#

🤣 was about to re search about it

quaint mantle
#

How can I make custom loot tables for chests?

tardy delta
#

dependencies 💀

smoky oak
tardy delta
#

its an ultimate thing people told me

smoky oak
#

that doesnt answer the question

tardy delta
smoky oak
#

ah

verbal slate
#

Guys, how do I check that there are 2 seconds left before the end of the potion effect?

verbal slate
tall dragon
#

get the time left and compare?

verbal slate
#

Now I have such a check, but I doubt it works:
p.getPotionEffect(effect.getType()) != null && p.getPotionEffect(effect.getType()).getDuration() < 20

tall dragon
#

try and see

verbal slate
#

since duration is measured in ticks, I thought it should work like this: If the duration of the effect = 1 second, then the actions

#

And, I see, it was necessary to specify not 20, but 40 ticks. It works

#

Otherwise, the effect will end

tall dragon
#

is it an ultimate feature i guess?

remote swallow
#

ultimate feature

quaint tapir
#

Does putting all my plugins into 1 plugin make it run faster

#

or is it better to have separate plugins

tall dragon
#

really depends on the plugins ur merging

#

you could for example benefit from having 1 player data wrapper for all playerdata

#

but on its own it would yield minimal performance increase. for not having to load each plugin

frosty cairn
orchid gazelle
#

uhm... so I have a problem but its very hard to describe it. I've got a custom GUI-System. Whenever im closing the inventory, im obviously resetting it(With a HashMap im keeping track of it, key=player value=GUIInventory(Object also containing a Bukkit-Inventory). I am opening a clone of the original, so that the blueprint does not get overwritten. Whenever im reopening it tho, it somehow does NOT reset the items in it. Anybody knowing why?

remote swallow
frosty cairn
#

you don't know what exactly?

orchid gazelle
#

but when im reloading the plugin, its getting reset

remote swallow
heavy maple
#

How could I mute a player?

echo basalt
quaint mantle
#

How can I make custom loot tables for chests?

tardy delta
#

whats that supposed to mean

tardy delta
heavy maple
#

ok

lost matrix
minor garnet
#

is it possible with packets to make a player mount into an entity and send a packet to other players informing the player is crouched?

without causing the player to leave the entity

lost matrix
#

Sure. So the player will see itself mounted on an entity and others see him crouching (not mounted)?
Should be possible. Might cause weird behavior.

quaint mantle
#

Заплачу 1₽ за плагин

lost matrix
#

You try that every day until someone bans you?

quaint mantle
#

Да

minor garnet
#

I would also need to make him stand up too,

lost matrix
#

You cant crouch and stand up at the same time...

minor garnet
#

then you would probably ask me why I do this, it turns out that I need to create a system making players climb stairs (ladder) faster, similar to cs go

minor garnet
lost matrix
#

Why dont you just enhance their speed while on a ladder?

minor garnet
#

and especially if i use player.setVelocity() because this would be stuck on the stairs

untold jewel
#

Does someone know how I would get mojang mappings for my NMS

ocean hollow
#

Is it possible to immediately spawn an invisible armor stand? I just create an armor stand and it is visible for 1 second

kindred valley
#

Custom models

ocean hollow
#

cem?

lost matrix
lost matrix
remote swallow
#

?nms also on here

untold jewel
lost matrix
#

WorldServer is old Spigot mappings iirc

untold jewel
#

I remember there was a website which has everything in both spigot and mojang mappings

#

so you could see what its called in the other one and vise versa

#

Do you know?

lost matrix
untold jewel
#

thanks buddy

#

!

dry yacht
ocean hollow
#

how can i damage mobs near the player? i wrote the code, but for some reason the entity does not have a damage() method

lost matrix
#

You can only damage LivingEntities

ocean hollow
#

sorry, what did you mean?

lost matrix
#
  public void damageNearbyPlayers(Player corePlayer, double damage) {
    for (Entity entity : corePlayer.getNearbyEntities(1, 1, 1)) {
      if (!(entity instanceof Player otherPlayer)) {
        continue;
      }
      otherPlayer.damage(damage);
    }
  }
lost matrix
# ocean hollow sorry, what did you mean?

You cant damage Entities. Items for example are also entities. Or experience orbs.
But you cant damage those. You can only damage an entity if its an instance of LivingEntity.

ocean hollow
#

Oh, thank you 😘

tardy delta
#

isnt there a getNearbyEntities that takes a Predicate<Entity>

lost matrix
#

For World, yes

tardy delta
#

ah

#

hmm i was wondering how smth internally worked but its probably implemented in the vanilla server

#

actually i should look more into how the server handles recipes

pseudo hazel
#

so I am making a small hologram system for my plugins, and I have a HologramManager, is there a like a java trick to force only the manager to be able to create new Holograms?

#

because right now I can just use new Hologram from anywhere if I have the right parameters

#

but then it doesnt get registered to the manager properly

#

right now I pass the manager as a parameter so there is no point to make them yourself, but I was wondering if there was a diferent/better way

ivory sleet
#

no not really, however you can decouple by using an interface for instance

#

or one way is to have package private constructors

#

but that can lead to inflexibility

pseudo hazel
#

if I use an interface how do I create instances of it

#

like a class inside the hologram manager?

worldly ingot
#

You would use an implementation of that interface

tardy delta
#

dammit

remote swallow
#

i dont have those issues

#

use fabric like a normal person with auth me

tardy delta
#

started happening when i began using minestom

remote swallow
tardy delta
#

im not going to use mods

remote swallow
#

why not

tardy delta
#

only slows down stuff

remote swallow
#

no

#

i get more fps with mods than without

tardy delta
#

thats you

remote swallow
#

have you tried it

pseudo hazel
worldly ingot
#

Fabric is rather light weight. You're not going to see any significant increases in load time lol

#

I launch almost exclusively in Fabric

tardy delta
#

i have

remote swallow
#

oh chcoo how does the veinminer client side stuff actually work to communicate with the server

pseudo hazel
#

I use fabric sometimes, but whenever a new version comes out I just download optifine since its faster to set up xD

remote swallow
#

i just dont update

pseudo hazel
#

and then never actually take time to make a fabric setup

remote swallow
#

first is Bukkit.getPluginManager().disablePlugin(JavaPlugin) 2nd is JavaPlugin.saveResource("file.yml", replaceBool)

worldly ingot
#
  1. Bukkit.getPluginManager().disablePlugin()
  2. saveResource()
tardy delta
#

i forgot .set does not do any io 🥹

quaint mantle
tardy delta
#

any way to make this shorter: if (ingredient.items().stream().noneMatch(item -> Arrays.stream(inventoryContents).anyMatch(item::isSimilar)))

quaint mantle
#

The plugin creates a datapack in the datapacks folder and adds the loot table json file there. plugin/data/namespace/loot_tables/loot.json

lost matrix
#

?basics

undone axleBOT
remote swallow
#

an instance of your java plugin, the 2nd is just either an instance of your java plugin or run it in your main class

torn shuttle
remote swallow
#

ur moms basic

small hawk
#

The most effective way to cancel moving items from inventory to inventory will be InventoryClickEvent or InventoryMoveItemEvent, I discovered a bug in my plugin when u click with SHIFT on item, it gets to your Inventory and custom gui closes, so it's copying items. How do i prevent that the best way?

quaint mantle
remote swallow
#

you can etiher use di or a static instance

torn shuttle
remote swallow
quaint mantle
#

And I'd really love to know what the other approaches are

lost matrix
chrome beacon
torn shuttle
#

man I am so close to being able to work on my tower defense plugin again I can taste it

#

looking forward to that

remote swallow
#

lets say i have language.yml in my resources file in my ide and compile that, then if i called saveResource("language.yml", false) it would save that file to my plugins data folder, being called "language.yml"

#

you can also use that with sub folders and different file types

#

so call saveResource("language.yml", false) in your on enable method

lost matrix
#

Are you writing this plugin?

warm galleon
#

do you guys think I should be registering and detecting my custom enchantments through lore or should I be containing them in NBT tags

tardy delta
#

?pdc instead of nbt

warm galleon
tardy delta
#

ah probably nbt then as pdc is an nbt wrapper

pure elbow
#

Hey I have a question, for example I have this in my .yml:

Value:
CoolValue:

CoolValue2:

How do I test if a String is One of this Values

tawdry echo
#

ok, and?

remote swallow
#

that would be invalid yaml im pretty sure

pure elbow
#

like if(fileconfig.getString.all("Value") == String) {

remote swallow
#

that would be a configuration section

#
value:
  value1: coolvalue
  value2: coolvalue2

ConfigurationSection section = config.getConfigurationSection("value")
String value1 = section.getString("value1");
String value2 = section.getString("value2");

pure elbow
#

I mean I have this in my .yml:

Value:
  Value1:
    Hi: 'Lol'
  Value2:
    Hi: 'Lol'
  ... and much more...

and I want to check if my String Is one of the things under Value:
Like if my String is Value1, Then It checks Value1 and Value2 and all others... And if the String is one of them Then we are all happy

pearl oyster
#

Hello o/

I'm here to ask question about spigot web API I use both 0.2V, and V2 and they just have very strange cache times 0.5 has 12 hours hard-coded in php, and V2 returns 30 minutes but data is actually still old even after the 30 minute mark

Sometimes 0.2 returns actually better data then V2

#

I use it for discord-bot to verify user

pearl oyster
#

But it is just not possible with cache set

warm galleon
#

punch

#

:D

remote swallow
pearl oyster
#

Though new one seems to not really work

remote swallow
#

spiget is 3rd party

pearl oyster
#

Ah I see

#

so spigotmc is the correct one?

remote swallow
#

yeah

pearl oyster
#

But it has really long cache

remote swallow
#

you can use spiget but here is the wrong place for support

alpine swan
#

why does this code only remove the item from the player's hand if the player is looking at a block - setting the health and the sound works fine either way

    @EventHandler
    public void clicc(PlayerInteractEvent event){


        if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK){


            if (event.getItem() != null && event.getItem().getType() == Material.MUSHROOM_SOUP){

                Player player = event.getPlayer();

                if (player.getHealth() != 20){
                    player.setHealth(event.getPlayer().getHealth() + 7 > 20 ? 20 : event.getPlayer().getHealth() + 7);
                    player.getWorld().playSound(player.getLocation(), Sound.EAT, 1, 1);
                    player.setItemInHand(null);
remote swallow
#

are you running paper