#help-development

1 messages · Page 1165 of 1

upper hazel
#

I think I've found a way to get the block data from the mod.

#

just need use BlockData.getAsString

#

i think i will can get material id

trail coral
#

whats the best way to send discord webhooks? i know theres a api for this but i want to understand how to do it myself (I want to send embeds too)

atomic basalt
#

is there any way to get a hash (md5, sha,...) for a plugin file?

zealous osprey
atomic basalt
#

not inside java, i'm trying to make a plugin auto update bash script, but i dont want to download a file that is already up to date

#

but yes, similar to that

#

looking for some http endpoint to fetch a checksum of some sort to keep traffic low.. i dont see such thing in spiget api

eternal night
#

most linux distros come with the md5sum binary

atomic basalt
#

that requires me to download the file first anyway

eternal night
#

OH you mean like, spigot web API

atomic basalt
#

yes

eternal night
#

rather certain that isn't a thing

atomic basalt
#

modrinth has in its http api an attribute that contains file hashes, i'm looking for the same thing for spigot resources

eternal night
#

Given that like, spigot has resources that are downloaded from external sites etc

atomic basalt
#

for those, the hash could simply be undefined

eternal night
#

well but it isn't omegaroll

atomic basalt
#

yea its not because it simply doesnt exist 😄

eternal night
#

lul

atomic basalt
#

making http apis always comes with the duty to keep traffic as low as possible

#

i'm opening a ticket with spiget, maybe they can work something out

#

thanks

eternal night
#

😅 I have my doubts, but gl

trail coral
#

How do i send messages using discord webhooks?

#

with java

atomic basalt
# eternal night 😅 I have my doubts, but gl

of course it would be unfeasible for them, because that would mean they have to at least cache each sum on the first request. imo it would be spigot's duty to implement such thing (or maybe even implement ANY sort of http api :I)

eternal night
atomic basalt
atomic basalt
trail coral
#

oh oh wait theyre discord threads

#

im gonna use this api but i kinda wanted to learn how to do them myself lmao

#

i tried looking at the code but its like 1k lines most files

atomic basalt
#

if you're referring to this section, no those are normal java threads

trail coral
#

I was reffering to this

atomic basalt
#

yea youre right those are discord message threads

trail coral
#

like how sending discord webhooks or whateve r works

atomic basalt
#

my recommendation: don't. writing discord api isnt trivial
on the other side; webhooks are kinda not very complex.
if you really want to make a wrapper for this yourself, check out discord api documentation

trail coral
#

i just wanna put it on my github ngl

tawny remnant
#

Custom Player Heads aren't working anymore?
I came back to developing plugins using the SpigotAPI after about a year and all of a sudden none of my past code seems to work. Its throwing errors that dont even really make sense to me (for example: Caused by: java.lang.NullPointerException: Profile name must not be null)

lilac dagger
#

you can use the playerprofile api

tawny remnant
lilac dagger
#

sure

tawny remnant
#
        UUID uuid = UUID.fromString("b608ab5b-4253-3178-a6dd-9e943a42eb49");

        Block block = chunk.getBlock(x, y, z);
        block.setType(Material.PLAYER_HEAD);

        Skull skull = (Skull) block.getState();

        PlayerProfile profile = Bukkit.createPlayerProfile(uuid);
        PlayerTextures textures = profile.getTextures();

        try {
            URL url = new URL("http://textures.minecraft.net/texture/a79f8c92776d642d119f9e92360b1e5b971e66e61428a3e1b311d8b6185e6");
            textures.setSkin(url);
            profile.setTextures(textures);

            skull.setOwnerProfile(profile);
            skull.update();
        } catch (MalformedURLException ex) {
            throw new RuntimeException("Invalid URL", ex);
        }
    }```
lilac dagger
#

PlayerProfile profile = Bukkit.createPlayerProfile(uuid); you neec a name

tawny remnant
lilac dagger
tawny remnant
#

oh damn i aint ever see that

lilac dagger
#

if it was just one, now it's 2

tawny remnant
#

thank you very much

lilac dagger
#

no problem 😄

lilac dagger
#

am i doing something wrong here?

#

the compression should work no?

#

i get null at decompress

#

compress seems to work, the length is 20

#

i'll read the contents to see if they got compressed

eager ermine
#

I have a question. I have two plugins. One plugin that serves as the core and one plugin that depends on the core.
Both are separate because the core is used on different servers and the other only on one server. The second (survival) depends on the core. Both run on the same server.
Both have the same command declared (in plugin.yaml as well), which is the config cmd. I want the main plugin to execute the core's command handler when I run the command and the first argument is core. However, if the first argument is survival, let the second plugin handle it.
I've already tried to make the first one return false when the first argument is survival, I tried with PlayerCommandPreprocessEvent and it still not working. Does anyone have any suggestions on how to make this work?

lilac dagger
#

you need to have your core handle commands, and register new subcommands from the survival server

eager ermine
spiral light
#

you can use the PlayerCommandPreprocessEvent for sure for things like that.

lilac dagger
#

you can also register a separate command for survival

#

but playercommandpreprocessevent is not the best option for handling commands i think

#

i use it to block commands with it

#

but having it to run commands seems wrong

spiral light
#

it works very well but its complicated

lilac dagger
#

it won't support suggestions for one

eager ermine
# spiral light you can use the PlayerCommandPreprocessEvent for sure for things like that.

but it's not cancelling the event

package kvsilva.whalehound.whalehoundcore.Events;

import kvsilva.whalehound.whalehoundcore.Utils.Messages;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.plugin.Plugin;

import static org.bukkit.Bukkit.getServer;

public class CommandInterceptor implements Listener {

    private Plugin survivalPlugin = null;


    @EventHandler
    public void onCommandPreprocess(PlayerCommandPreprocessEvent event) {
        if(survivalPlugin == null){
            survivalPlugin = getServer().getPluginManager().getPlugin("Survival");
        }
        Messages.log(survivalPlugin != null ? "different from null!" : "its null.");
        Messages.log(survivalPlugin != null && survivalPlugin.isEnabled() ? "its enabled!" : "its not enabled.");
        String[] args = event.getMessage().substring(1).split(" ");

        Messages.log("arg[0]"  + (args.length > 0  ? args[0] : " null "));
        Messages.log("arg[1]"  + (args.length > 1  ? args[1] : " null "));

        if (args[0].equalsIgnoreCase("config") || args[0].equalsIgnoreCase("cfg")) {
            if (args.length > 1 && args[1].equalsIgnoreCase("survival") && survivalPlugin != null && survivalPlugin.isEnabled()) {
                Messages.log("cancelling it!");

                event.setCancelled(true);
                survivalPlugin.getServer().dispatchCommand(event.getPlayer(), event.getMessage());
            }
        }
    }
}

the core is a message printed on the core plugin handler

#

am i missing smth?

spiral light
#

survivalPlugin.getServer().dispatchCommand(event.getPlayer(), event.getMessage());

#

i think you cant run the command from there

#

it will reroute back to the core command i guess

eager ermine
#

ye, thats what its doing

spiral light
#

but why you dont use this code in the sub-plugin and run the code directly ?

eager ermine
# lilac dagger you can also register a separate command for survival

I was thinking of having the command registered in Core, and the command itself, depending on the first argument, would invoke a specific command.

For example:

/config core - Invokes /configcore
/config survival - Invokes /configsurvival

I just thought of this; I haven't tested it yet.

eager ermine
spiral light
#

dont invoke, run the code you want to run in the command

lilac dagger
#

i still think registering features into core from survival is the best idea

eager ermine
#

But that wouldn't make sense for other servers, since in another server those features would all be obsolete, and the code would start to get confusing

lilac dagger
#

well, a core is supposed to have features that are unused by some

#

and used by others

#

look at spigot api for example

#

most plugins won't use all the features it provides

#

but they are there and it makes sense

#

you can also shade the core into the plugin and during shade(i think) you can drop unused classes

eager ermine
#

Yes, but in general, it makes sense for anyone to use. However, if I create a gladiator system (just thought abt smth), putting it in the core wouldn't make sense, even though it would make sense to configure it with the command /config gladiator and use features from the core, no?

eager ermine
lilac dagger
#

you don't need to put gladiator into core, you just need to hook the necessary components that allows you to do /config gladiator something something

#

or i don't know

lilac dagger
#

i have a game engine that i shade into my minigame plugins

#

instead of having a game engine plugin and a minigame plugin

#

the core makes sense if you wanna make multiple plugins on same server tho

eager ermine
#

I plan to create several "small" plugins that would then be used by Survival, and they would all also end up using the core
That's why I haven't combined them and compiled just one... but maybe that's the best option, or I could do that "routing" of the commands from /config core to /configcore and /config survival to /configsurvival lol

worthy yarrow
#

Sounds like survival should rather be the common module

mortal hare
#

then it dynamically dispatches you proper autocompletion and you can do command argument injections externally

lilac dagger
#

i fixed it, i had to flush and set the character set to utf 8

worthy yarrow
#

@lilac dagger Have you dealt with a particular system within a minigame where you had to handle individual turns?

lilac dagger
#

like chess turns?

worthy yarrow
#

Yeah that works

lilac dagger
#

i haven't, but it sounds doable

#

just disable whatever features you don't want your opponent doing on turn change

#

like give a ticket to a team

#

and pass it along

worthy yarrow
#

In the current impl, my thought was to just map uuid -> bool within the "round" object and track turns this way

#

ie: if(isTurn) {} kinda thing

#

My issue with this, is just how to dictate who should go first... in disc golf per hole it's based on whoever scored the best on the previous hole so I guess I have to implement some handling for this

lilac dagger
#

use a list shuffle the list

#

remove from list if a team has been eliminated

#

and pass the ticket this way

#

keep track of current index in round

#

of who has the ticket

worthy yarrow
#

Hmm this would also differ between round types... doublesRound as compared to an FFARound would be a bit weird

lilac dagger
#

you don't need to loop the list, i had an idea but scratched it

#

hmm

worthy yarrow
#
@Override
    public void handleStroke(UUID playerId, String technique, Disc disc) {
        Player player = Bukkit.getPlayer(playerId);
        if (player == null) {
            return;
        }

        if (!this.turns.get(playerId)) {
            player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&4It is not your turn!"));
            return;
        }

        PlayerData playerData = playerDataManager.getDataByPlayer(playerId);
        PlayerSkills skills = playerData.getSkills();
        ScoreCard scoreCard = scoreCards.get(player.getUniqueId());
        scoreCard.trackStroke();
        this.turns.put(playerId, false);

        disc.handleThrow(player, skills, technique, player.getFacing());
    }```

Like as an example, this method should really be "handleTurn" or something
#

I think the ticket idea is good tho

lilac dagger
#

you can handle multiple turns in round as well

#

and if some teams have more than others you can track a getnumberof turns from team

#

you can extend round for this

#

MultipleTurnRound

worthy yarrow
#

So in an ffa round, (and this is just based off my irl experience) whoever wins the previous hole is first up to throw on the next... this is simple enough, it just gets a bit more complex in the doubles round as your team is scored as if you were one person, both of you throw and you take the better one etc... now that I'm typing it out the ticket idea works anyway so I think I'm just yapping at this point lol

lilac dagger
#

yeah the ticket system should work in doubles as well, it depends on how you'll implement it really

worthy yarrow
#

It's the same I think as ffa round considering your team is scored as one person, just give a team the ticket and when all of the team has made their throws, pass the ticket

lilac dagger
#

yup

mellow edge
#

is calling Damagable#damage(amount) on a player also including his armor as a damage reducer?

lilac dagger
#

i never tried the method, you can test it yourself i think

#

just run it with and without the armor

#

see if damage changes

worthy yarrow
#

If you wanted to ignore the armor you could directly modify their health via attribute iirc?

mellow edge
#

I know, I WANT damage reducers to be applied.

worthy yarrow
#

hmm

#

Try that method you mentioned and see if it accounts

mellow edge
#

yeah I will, the problem in NMS is that I cannot find where it is implemented!

worthy yarrow
#

why nms

lilac dagger
#

follow the craftlivingentity

worthy yarrow
#

I feel theres enough api to do this no?

mellow edge
#

no no no

#

I want to look how it is done behind the scenes in NMS but I cannot find where this interface is actually implemented.

lilac dagger
#

you can follow it

#

CraftLivingEntity

mellow edge
#

Ok, thanks.

worthy yarrow
#

@lilac dagger when you say ticket, would you make a ticket object and store with a team/player? And if so tracking the ticket, would you just check to see if a teams/players ticket is not null when it's their turn and then set it back to null after their turn?

lilac dagger
#

a list and an index is all you need

worthy yarrow
#

ah

#

Mkay

lilac dagger
#

you can make a ticket object too, but that's more work than necessary

#

i have something similar to turns here

worthy yarrow
#

Oh wow collections has a shuffle method for me ❤️

#

I was literally about to do that myself lmao

lilac dagger
#

and don't forget to newindex % list.size

#

to always loop

worthy yarrow
#

What do you mean sorry?

lilac dagger
#

it means this way you don't have to check whatever you're over the list size

#

list.get(newIndex % list.size()) //This is the current team

worthy yarrow
#

Is this rather for safety or to get the team's turn index?

lilac dagger
#

safety yeah

worthy yarrow
#

Ah gotcha

lilac dagger
#

but it's not really necessary

#

it depends on the implementation

#

in your case you'll need 2 tickets, one for team, and one that goes through all members of the team

#

this inconsistency makes me mad, why does json allow fromJson to use a Reader parameter while toJson requires a JsonWriter

#

i guess they have to write to it in a specific way, but still

lilac dagger
#

found it

#

now i have to figure out what type of information comes in before in the bytebuf

lilac dagger
#

i think i'll stick to handling the mojang packet instead

#

this is more work than i need for 1 single packet read

#

i'm pretty happy with how it is currently

sly topaz
#

and please don't use the PlayerCommandPreProcessEvent for handling commands you own the code for

eager ermine
#

You're not that late because I was working on other things in the plugin, so that one was on hold xD

eager ermine
eager ermine
sly topaz
#

then again, when you go down this route it means you're essentially creating a command framework so if you're not afraid of dependencies, I'd just recommend going for something like Incendo's Cloud command framework or Jorel's CommandAPI

eager ermine
#

That's actually funny because I've been working on creating the abstraction for my commands to validate arguments, permissions, whether they're optional or not, etc xD

sly topaz
#

given a complex enough command, one naturally finds themselves in that place, yeah

#

but I highly recommend these frameworks as they're battle-tested and work across a bunch of platforms

eager ermine
fervent gale
#

I was curious is this possible in Spigot? If so with minimal spoonfeed would anyone help me figure this out this would be awesome for my server uwu

#

I’ve tried action bar and can’t replicate

sly topaz
fervent gale
#

Dannnng

nova notch
#

doesnt wynncraft do that? so yeah its definitely possible with just resource packs most likely

blazing ocean
#

Wynncraft has a huge custom pack, yes

fervent gale
#

It looks so vanilla even tho it doesn’t

sly topaz
#

I mean, resource packs are vanilla

#

I get what you mean though, they did match the vanilla style pretty well with that prompt

fervent gale
#

i want a nice dialogue system im just lazy for ideas for looks

#

🫠

sly topaz
#

if I didn't know better, I'd have thought it was some bedrock edition feature

nova notch
#

at least for me

fervent gale
#

Ikr

sly topaz
#

eh, it is really not that hard lol

fervent gale
#

It is thooo

nova notch
#

i think in numbers not colors

sly topaz
#

that one is literally just a black overlay

fervent gale
#

Im not that handy with RSP

#

lmao

sly topaz
#

nobody starts being good at something

nova notch
fervent gale
#

And im going broke paying people lol i wanted to code it lol

blazing ocean
nova notch
#

this was harder to make than coding the entire system to generate it

#

wdym

sly topaz
#

eh, maybe not that much color, just the purple feels a little out of place

#

every other color there is pastel-ish but the purple

nova notch
#

point is designing how shit looks is way harder than actually making it function cus theres so many different things to think about

#

anyway

nova notch
sly topaz
#

I tend to disagree, since there's a bunch of tools for designing things like that, the workflow is good

fervent gale
#

I might just need to do an in chat dialogue system 🫠

blazing ocean
nova notch
#

what snapshot then

sly topaz
#

making resource packs in the other hand, you got to do shit by hand, it isn't pretty

nova notch
#

wait

#

1.21.4 my bad

#

forgot we're up to that version now

blazing ocean
#

we arent?

nova notch
#

theres snapshots of it

sly topaz
#

well, if it is a one-sided dialogue, then it is fine I guess

fervent gale
#

Its one sided

abstract totem
#

I'm using this method to get a short position for a MultiBlockChange packet for client side ghost blocks, but because of this i cant place blocks above Y-15. Using protocollib to send the packet, any way around this?

public static short toChunkPosition(Location loc){
        int x = loc.getBlockX() & 0XF;
        int y = loc.getBlockY() & 0XFF;
        int z = loc.getBlockZ() & 0XF;

        return (short) (x << 16 | z << 8 | y);
    }```
sly topaz
#

is there a reason you aren't using the API method for the multi-block change

abstract totem
#

was not aware of it. Is it in 1.21?

nova notch
abstract totem
blazing ocean
nova notch
#

wtf

#

oh right thats the new texture thing

#

forgot about that

#

does it scale the texture based on tooltip size as well?

blazing ocean
#

¯_(ツ)_/¯

young knoll
#

Yes

deep herald
#

how do i register a custom enchantment

sly topaz
#

simplest way to go about it

deep herald
sly topaz
#

yes

#

you can use datapacks in bukkit servers

deep herald
#

idk how to do datapacks

#

how do i register it in a plugin

sly topaz
#

there is no API for it

#

so you'd have to play around with NMS to do it

#

hence why I recommend you just use a datapack, creating one shouldn't be that hard

sly topaz
#

don't know if it has been updated or anything, but should serve you as a base

deep herald
#

cant u extend enchant?

eternal night
#

no

coral sparrow
#

How do i make plugin when player breaks my shield with axe and they can't move or hit like radius 5 blocks

golden tulip
#

How can I remove the Message for a player?

You have no home bed or charged respawn anchor, or it was obstructed

fading drift
#

when a player joins my server they are always sent to the world they last left at

#

is there a way to make sure they are always only sent to one world

#

without just tping them

wet breach
buoyant viper
buoyant viper
#

unless theyve updated recently

fading drift
#

I was just wondering because right now I just tp them and its works but for a second theyre in another world

nova notch
young knoll
#

Yeah I think Wynn still uses chat

#

But you can make those boxes with the action bar and some font magic

sly topaz
fading drift
#

good idea

sly topaz
#

oh wait

fading drift
#

surely thats for deaths right

sly topaz
#

nope, that's when they join

#

read the javadoc

#

you can just set the spawn location there, it shouldn't have the same effect as teleporting on join

fading drift
#

ty

sturdy sand
#

help

#

?paste

undone axleBOT
sturdy sand
sturdy sand
#

?paste

undone axleBOT
sly topaz
sturdy sand
#

a plugin

sly topaz
#

WorldGuard.getInstance().getPlatform().getRegionContainer() this is how you access the RegionContainer

sturdy sand
#

😮

sturdy sand
#

thanks

#

pipipi

sly topaz
# sturdy sand
public boolean isInRegion(Player player, String regionName) {
    var query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
    var regions = query.getApplicableRegions(BukkitAdapter.adapt(player.getLocation()));
    
    if (regions.isVirtual())
      return false; // ?, given the documentation this seems to be the appropriate choice for a method like this, however I'm not completely sure
    for (ProtectedRegion region : regions) {
        if (region.getId().equalsIgnoreCase(regionName)) {
            return true;
        }
    }
    
    return false;
}
#

in any case, you're probably want to ask in the EngineHub discord, they may know better

ruby sky
#

Does YamlConfiguration contain the file's absolute path by any chance?

buoyant viper
spare crypt
#

Wondering if someone can help. I'm tring to create a HoverEvent to show an item, but it doesn't render the name/lore or other tags when building it out. I've seen a few things posted here, on the forums, and elsewhere suggesting to use ItemMeta#getAsString which I'm doing, but it doesn't seem to be working. Has anyone been actually able to figure this out since 1.20.5/6 onward? It seems all posts end with the same general suggestion, but no confirmation that anything actually works. I can't even seem to form a tellraw properly either

    @EventHandler
    public void onClick(PlayerInteractEvent event) {
        ItemStack     item      = event.getItem();
        TextComponent component = new TextComponent("Hover me");
        component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM,
                new Item(item.getType().getKey().getKey(),
                        item.getAmount(),
                        ItemTag.ofNbt(item.getItemMeta().getAsString()))));
        event.getPlayer().spigot().sendMessage(component);
    }
wraith delta
spare crypt
#

Yeah, that does feel unfortunately like the only way to actually do this at this point

wraith delta
spare crypt
#

yup.... especially with all this crazy item stuff coming through. I suppose building it manually works, it just loses the ability to easily display things like damage, nutrition value, attack speed, etc. that would automatically be added if I could find some way to generate a proper NBT string

wraith delta
wraith delta
# spare crypt Yeah, that does feel unfortunately like the only way to actually do this at this...
    private String getItemLore(ItemStack item) {
        ItemMeta meta = item.getItemMeta();
        StringBuilder loreBuilder = new StringBuilder();
        
        loreBuilder.append(getItemName(item) + "\n");

        if (meta.hasEnchants()) {
            meta.getEnchants().forEach((enchant, level) -> {
                String enchantName = enchant.getKey().getKey().replace('_', ' ').toLowerCase();
                enchantName = Character.toUpperCase(enchantName.charAt(0)) + enchantName.substring(1);
                loreBuilder.append(ChatColor.GRAY + enchantName).append(" ").append(ChatColor.GRAY + level.toString()).append("\n");
            });
        }

        if (meta.hasLore()) {
            loreBuilder.append(String.join("\n", meta.getLore()));
        }

        return loreBuilder.toString();
    }
```I did this for the enchants & lore
wary oyster
#

can anyone give me an example of some code using interpolation with display entities? im just seeing methods to set the delay or set the duration not what it should be doing while interpolating (ex. change scale continuously to a specific size from a smaller size)

sly topaz
somber tusk
#

Im running 1.21.1 faction servers and there are tons of crops on my server, causing so many lags. How can I optimize that ? Thank you

sly topaz
#

the interpolation happens on client-side, and there's not much of a way to configure it besides those two properties you mentioned. If you want to do something akin to changing the velocity of the interpolation, you probably want to play around with the interpolation duration mid-interpolation

wary oyster
#

im just not grasping how to use the interpolation methods

sly topaz
#

you see, you don't care about the interpolation

#

you just set the duration you want, aka the velocity

wary oyster
#

yeah but how do you tell it what to do during that time

sly topaz
#

then you just scale up the display entity with the transformation matrix

sly topaz
wary oyster
#

so setting an interpolation makes the next transformation that happens be that interpolation?

#

if so, thats really simple

sly topaz
#

yes

#

yep, it is

wary oyster
#

ok i will try

sly topaz
#

it is so mind-numbingly simple that makes one believe it wasn't Mojang who made such a system lol

#

we're way too used to working around the shit out of vanilla behavior over here in the server side

spare crypt
#

It looks like the getAsString method probably would work, it's just getting stuck in as tag instead of components so it breaks

sly topaz
#

I'd just go for adventure-platform if I were you

spare crypt
#

Yeah... I've been debating.

sly topaz
#
var item = event.getItem();
var nbt = "{\"id\":\"%s\",\"count\":%d,\"components\": %s}"
          .formatted(item.getType().getKey().getKey(), item.getAmount(), item.getItemMeta().getAsString());
var component = new TextComponent("Hover me");
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new BaseComponent[]{ new TextComponent(nbt) })));
event.getPlayer().spigot().sendMessage(component);
#

it seems like the ItemSerializer class needs some updating

#

the representation they're using is the old one, though I'm unsure if it still works that way

wary oyster
#
public static void placeBlock(Location location, Material block, JavaPlugin plugin, Player player) {
        World world = player.getWorld();

        // Adjust location to center the block display within the block space
        Location centeredLocation = location.clone().add(0.5, 0.5, 0.5);

        BlockDisplay blockDisplay = world.spawn(centeredLocation, BlockDisplay.class, display -> {
            display.setBlock(block.createBlockData());
            display.setBillboard(Billboard.FIXED);
            display.setTransformation(new Transformation(ZERO_VECTOR, NO_ROTATION, INITIAL_SCALE, NO_ROTATION));
        });

        // Use a scheduler to set the interpolation parameters and transformation on the next tick
        new BukkitRunnable() {
            @Override
            public void run() {
                // Set the interpolation duration which will affect the next transformation
                blockDisplay.setInterpolationDuration(100); 

            }
        }.runTaskLater(plugin, 1); // Execute this block 1 tick later
        // Trigger the final transformation which should now interpolate plsplsplspls
        blockDisplay.setTransformation(new Transformation(ZERO_VECTOR, NO_ROTATION, FULL_BLOCK_SCALE, NO_ROTATION));

    }
``` idk if im doing this wrong but for some reason it doesnt interpolate it just sets itto full size
spare crypt
sly topaz
#

have you tried doing it without the delayed task at all though?

spare crypt
#

Minecraft's wiki also needs to be updated... it still reflects the tag setup instead of components lol

sly topaz
#

I do wonder if bungeechat has the flexibility to allow one to override the default serializers tho

#

doesn't look to be the case, but one could make do by reflectively changing the field in ComponentSerializer if it ultimately becomes necessary

#

it's just matter of someone hitting up md about updating the ItemSerializer representation anyway

spare crypt
#

I had set up a class that extended Contents, which was closer. The problem was serializing the item down into nbt means it's a string… and putting that directly in the components tag doesn't work because it's expecting a json object instead. I could reparse the string into json, but then all the 0b or 3d whatever was read in as a string because I don't have the serializers registered for those data types. Lol

pure dagger
#

how to make it so when player destroys a block, there appears different block, i made this but it actually made that the diamond block "drops" gold block when mined

if (event.getBlock().getType() == Material.DIAMOND_BLOCK) {
            event.getBlock().setType(Material.GOLD_BLOCK);
        }
#

this is BlockBreakEvent

wary oyster
# sly topaz you need to set the transformation inside the delayed task too, otherwise the in...
public static void placeBlock(Location location, Material block, JavaPlugin plugin, Player player) {
        World world = player.getWorld();

        // Adjust location to center the block display within the block space
        Location centeredLocation = location.clone().add(0.5, 0.5, 0.5);

        BlockDisplay blockDisplay = world.spawn(centeredLocation, BlockDisplay.class, display -> {
            display.setBlock(block.createBlockData());
            display.setBillboard(Billboard.FIXED);
            display.setTransformation(new Transformation(ZERO_VECTOR, NO_ROTATION, INITIAL_SCALE, NO_ROTATION));
        });

        // Use a scheduler to set the interpolation parameters and transformation on the next tick
        new BukkitRunnable() {
            @Override
            public void run() {
                // Set the interpolation duration which will affect the next transformation

                blockDisplay.setInterpolationDuration(100);
                blockDisplay.setTransformation(new Transformation(ZERO_VECTOR, NO_ROTATION, FULL_BLOCK_SCALE, NO_ROTATION));
            }
        }.runTaskLater(plugin, 1); // Execute this block 1 tick later
        // Trigger the final transformation which should now interpolate plsplsplspls


    }

this implementation just sets the block and so does running it outside

pure dagger
sly topaz
wary oyster
#

it just makes it instantly full size

spare crypt
sly topaz
# wary oyster it just makes it instantly full size
private static final Transformation[] FRAMES = new Transformation[]{
                                            new Transformation(ZERO_VECTOR, NO_ROTATION, INITIAL_SCALE, NO_ROTATION),
                                            new Transformation(ZERO_VECTOR, NO_ROTATION, FULL_BLOCK_SCALE, NO_ROTATION)
                                            };
public static void placeBlock(Location location, Material block, JavaPlugin plugin, Player player) {
        var world = player.getWorld();

        // Adjust location to center the block display within the block space
        var centeredLocation = location.clone().add(0.5, 0.5, 0.5);

        var blockDisplay = world.spawn(centeredLocation, BlockDisplay.class, display -> {
            display.setBlock(block.createBlockData());
            display.setBillboard(Billboard.FIXED);
            display.setTransformation(FRAMES[0]);
        });
        // Use a scheduler to set the interpolation parameters and transformation on the next tick
        Bukkit.getScheduler().runTask(plugin, () -> {
                                              blockDisplay.setInterpolationDuration(100);
                                              blockDisplay.setInterpolationDelay(-1);
        }); // Execute this block 1 tick later
        Bukkit.getScheduler().runTaskLater(plugin, () -> blockDisplay.setTransformation(FRAMES[1]), 2);
        // Trigger the final transformation which should now interpolate plsplsplspls


}
#

what about this

#

kinda wonky, but if this doesn't work nothing will

pure dagger
wary oyster
#

i think cuz wrong scope?

sly topaz
#

I just confused the vars, it should be blockDisplay

spare crypt
#

This transformation, can you change values on the original transformation? I wonder if it only interpolates if the transformation is the same object. If it gets replaced, it may ignore the duration

wary oyster
#

oh

#

u edited it

wary oyster
#

no interp

sly topaz
#

now that is weird

#

maybe we're forgetting something here about the interpolation

wary oyster
#

im really looking for someone who has used it before but i cant find anything

#

i saw it in a datapack first and i wanted to implement it

sly topaz
#

I edited the above again

wary oyster
sly topaz
#

it is there tho, did you not copy the whole thing

wary oyster
#

oh mb

#

it still instantly places

sly topaz
#

there's something wrong with your client lol

#

I'll try on my side and get back to you

spare crypt
#

I would set your timers to higher delays just to make things visible. I also saw something mentioning that there might be a cap on the transformation duration. Try something smaller like 40

wary oyster
wary oyster
#

no way

#

now that you say that, i remember that from the video i saw

sly topaz
#

that's so dumb

#

it should be clamped if it is over the limit, not just refuse to work lol

wary oyster
#

its really low random number

#

i forget what it is

spare crypt
#

59 is the max I think?

wary oyster
#

yeah it works

#

but for some reason it doesnt go to full size

sly topaz
#

can you try without delaying it at all

wary oyster
#

yep

#

whoah this is really wierd
it partially does the one i spawn, and then when i spawn the next one, it sets the previous one to full size

sly topaz
#

what

#

so, you spawned one, it for some reason doesn't scale up to its full length, but when you spawn another one, it does?

#

perhaps the client-side calculation gone wrong, you're better off trying it on the vanilla client tbh

wary oyster
#

no media perm its hard to explain

sly topaz
#

you just have to verify your forum account to get media perms

#

anyhow, that does sound like an issue with the client

#

because if it jumps to full size when you spawn the other one, it just means the spawning of another entity is forcing a re-render

#

it probably doesn't matter what you spawn there, it'll still jump to full size

wary oyster
#

well that doesnt really concern me all that much since there will only ever be one at a time

#

however

#

i do need to get it to go all the way to a full block

sly topaz
#

you need to trigger an update on the thing

#

then again, if it doesn't interpolate properly it is all in vain

wary oyster
#

that was the wrong video

wary oyster
sly topaz
#

the thing is, it should

#

the client has all the data to make that calculation properly

#

give me a sec, I'll try it on my side just to be sure

wary oyster
#

for some reason changing the duration value seems to have no effect on the actual duration

wary oyster
lilac dagger
#

does this also returns the item in cursor?

mellow edge
#

no iirc

lilac dagger
#

alright, i'll have to make it then

mellow edge
#

I always checked it seperately

#

because it is not a tile inventory slot

lilac dagger
#

yeah, makes sense

#

worth a shot

maiden kiln
#

The Sound JD mentions that

There may be additional sounds present in the server, for example from a DataPack which can be accessed via Registry.SOUNDS.
But from what I can see on the Minecraft wiki, it seems like sound events are defined in resource packs, which aren't loaded on the server?
Am I missing something? or is that outdated?

blazing ocean
orchid iron
#

does anyone know why portals and clouds are in front of text displays?

sly topaz
orchid iron
#

its already on true

sly topaz
#

if it is true then well, it's see through lol

#

meaning the particles will be in front of it

orchid iron
#

i disabled it now it works

remote swallow
blazing ocean
#

music discs != sounds

sly topaz
#

?nms

blazing ocean
sly topaz
#

I always got those bot commands channel hidden lol, never use them

maiden kiln
blazing ocean
#

probably, but I'm not entirely sure

#

but I believe there's a Player#playSound method with a string arg instead of the sound enum

maiden kiln
#

Oh yeah I know, I was just adding handling for custom sounds then realized halfway that I don't think that's actually a thing

chrome beacon
#

Don't crosspost

kindred sentinel
#

Is there a way to get the most lagging chunks?

young knoll
#

No

#

Not easily

inner mulch
#

where do i find the state of a fence?

chrome beacon
worldly ingot
#

(in which case you're looking for Fence)

inner mulch
#

thanks

harsh ruin
#

How do I put a custom nbt on a ItemStack? I'm using spigotapi 1.20.1

eternal night
#

?pdc

harsh ruin
#

Thanks a lot!

sage patio
#

Hey! I have multiple Kotlin projects, and I’m running into a linkage error when some of them use extension methods or Kotlin lambdas. This happens because the plugins add Kotlin to the classpath multiple times. However, if I try relocating Kotlin, none of the extensions will work or index properly. I think this might be a limitation with ShadowJar.

How can I manage this?

low marlin
#

I'm trying to create a plugin with NMS using maven, however when I try to put the plugin into the server I get the error

Caused by: java.lang.NoClassDefFoundError: net/minecraft/world/entity/monster/WitherSkeleton

This is my pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>me.FlaykertZ.TimeStarFactions</groupId>
  <artifactId>TimeStarFactions</artifactId>
  <version>1.0</version>
  <packaging>jar</packaging>

  <name>TimeStarFactions</name>

  <properties>
    <java.version>21</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <defaultGoal>clean package</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.13.0</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.5.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>

  <repositories>
      <repository>
        <id>spigotmc-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
      </repository>
    <repository>
      <id>sonatype</id>
      <url>https://oss.sonatype.org/content/groups/public/</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>org.spigotmc</groupId>
      <artifactId>spigot-api</artifactId>
      <version>1.21-R0.1-SNAPSHOT</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.spigotmc</groupId>
      <artifactId>spigot</artifactId>
      <version>1.21.1-R0.1-SNAPSHOT</version>
      <scope>provided</scope>
      <classifier>remapped-mojang</classifier>
    </dependency>
  </dependencies>
</project>

And I'm using Intelij with mvn install to create the jar file

#

This is the code

package me.FlaykertZ.TimeStarFactions.customMobs;

import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.ai.goal.RandomStrollGoal;
import net.minecraft.world.entity.monster.WitherSkeleton;
import net.minecraft.world.level.pathfinder.PathType;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_21_R1.CraftWorld;
import org.bukkit.entity.Zombie;

public class witherSkeletonCommander extends WitherSkeleton {

    public witherSkeletonCommander(Location loc){
        super(EntityType.WITHER_SKELETON, ((CraftWorld) loc.getWorld()).getHandle());
        this.targetSelector.addGoal(0, new RandomStrollGoal(this, 0.8D));
        Bukkit.broadcastMessage("test");
    }

}
young knoll
#

?nms

low marlin
#

okay found my issue

#

thanks

inner mulch
#

why do i need to cast?

young knoll
#

Because literal numbers are treated as integers by default

#

(Well, whole numbers)

inner mulch
#

can i show the compiler its a short?

#

like 0f for float

#

or 0l for long

young knoll
#

I don't think there is a shortcut for short

inner mulch
#

ok

young knoll
#

There isn't one for byte either, sadge

inner mulch
#

:(

pseudo hazel
#

cries in (byte) 1

low marlin
#

Trying to make a custom mob with pathfinding with this code

public witherSkeletonCommander(Location loc){
        super(EntityType.WITHER_SKELETON, ((CraftWorld) loc.getWorld()).getHandle());
        this.setPos(loc.getX(), loc.getY(), loc.getZ());

        goalSelector.getAvailableGoals().clear();
        targetSelector.getAvailableGoals().clear();

        this.goalSelector.addGoal(0, new FloatGoal(this));

        this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.8D));

        this.targetSelector.addGoal(1, new HurtByTargetGoal(this));
        this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<Player>(this, Player.class, true));

//        this.targetSelector.addGoal(0, new AvoidEntityGoal<Chicken>(this, Chicken.class, 20, 5.0D, 5.0D));
    }

However when I spawn him it won't attack me if I hurt him nor attack me when he sees me

young knoll
#

You should modify goals in the registerGoals method

#

Or whatever it is

low marlin
#

wdym

young knoll
#

Add your custom goals in registerGoals()

#

See any of the vanilla mob classes for reference

low marlin
#
public witherSkeletonCommander(Location loc){
        super(EntityType.WITHER_SKELETON, ((CraftWorld) loc.getWorld()).getHandle());
        this.setPos(loc.getX(), loc.getY(), loc.getZ());

        goalSelector.getAvailableGoals().clear();
        targetSelector.getAvailableGoals().clear();

        registerGoals();
//        this.targetSelector.addGoal(0, new AvoidEntityGoal<Chicken>(this, Chicken.class, 20, 5.0D, 5.0D));
    }

    @Override
    protected void registerGoals() {
        super.registerGoals();

        this.goalSelector.addGoal(0, new FloatGoal(this));

        this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.8D));

        this.targetSelector.addGoal(1, new HurtByTargetGoal(this));
        this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<Player>(this, Player.class, true));
    }

Like this?

young knoll
#

Yes

#

You also need an attack goal if you actually want them to attack

#

targetSelectors are just for selecting targets

low marlin
#

good to know

#

thanks

sonic stratus
#

Hello, I would like to make sure that my NPC doesn't get recreated every time I reload my server. How can I do that, please?

public void createFarmerNPC() {
        Location location = new Location(Bukkit.getWorld("world"), NPC_X, NPC_Y, NPC_Z);

        farmerNPC = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, NPC_NAME);

        SkinTrait skinTrait = new SkinTrait();
        farmerNPC.addTrait(skinTrait);

        skinTrait.setSkinPersistent(NPC_ID, SIGNATURE, TEXTURE);

        farmerNPC.spawn(location);
    }
blazing ocean
low marlin
#

with the followmobgoal?

quaint mantle
#

If I have a custom packet entities system what's the best way to avoid conflicting entity ids with spigot?

chrome beacon
#

Use nms to increment the internal counter

quaint mantle
#

What class is it in?

chrome beacon
#

Don't remember

quaint mantle
#

nvm-

lilac dagger
#

that's only for static final

blazing ocean
lilac dagger
#

i thought so too, but then i saw npc id

#

and npc x y z

#

even if this coord doesn't change, it's better to be in a config for easy access

#

anyway camelCase is what we java nerds use in our code to define most of our fields

#

actually you nerds, i'm not that smart 😅

sonic stratus
lilac dagger
#

well, it's part of code convention, it can work, but you're making other devs jobs harder to help you

lilac dagger
#

imagine if someone started one line ing everything or named their fields _LiKeThIs

#

i think you have to register the npc in citizens no?

#

this is just for create

#

or maybe it's the id that's getting overwritten

#

actually, i'm not sure why a skin takes an npc id

sonic stratus
#

Yes, it's registered in Citizens. But I can't overwrite the old NPCs because the IDs increment by 1 each time

lilac dagger
#

and you say it doesn't show on rejoin?

#

what happens if you tp between worlds?

#

as far as i know citizens npc once created it's handled by the plugin itself

sonic stratus
#

No, I’m saying that it shows up when the plugin is enabled.

wary oyster
#

Do you guys have any ideas about how id make a pathfinding algorithm for a procedural parkour plugin im making where ive already got a really fast way to know all possible jumps at a specific spot already that can pathfind close to and around pregenerated terrain in an "interesting" way? Where can i read up on something like this? I was thinking maybe i could utilize an ingame mob and simulate its pathfinding to use for a path the parkour should follow

lilac dagger
#

i missunderstood you

#

you can remove the npc upon on disable

#

or keep track of ids and remove them onenable

#

alternatively, you could make your own fake players, but that's gonna require a tracker and packets

sonic stratus
lilac dagger
#

i'm sure there's api to remove npcs by id

#

i assume once created the npc has an id no?

lilac dagger
#

yup, with nms

#

this is how i handle my npcs in my plugins

sonic stratus
#

do you have any example ?

lilac dagger
#

the code is private for now

sonic stratus
#

Originally, I didn't want to use Citizens.

lilac dagger
#

but i could share the packets i use to set an npc visible and invisible

#
        connection = getConnection(player);
        if (isVisible) {
            connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, this));
            connection.send(new ClientboundAddEntityPacket(this, serverEntity));
            connection.send(new ClientboundRotateHeadPacket(this, (byte) (getYRot() * 0.71)));
            connection.send(new ClientboundSetEntityDataPacket(getId(), entityData.getNonDefaultValues()));
            if (list != null) {
                connection.send(new ClientboundSetEquipmentPacket(getId(), list));
            }
            connection.send(new ClientboundAnimatePacket(this, 0));
        } else {
            connection.send(new ClientboundRemoveEntitiesPacket(getId()));
        }```
lilac dagger
#

you could optimise the remove entities packets by doing it in a batch

#

i haven't really seen a easy way for me to do it tho

#

it'd save a bit of bandwith

#

the animate packet is not needed, only if you want to fix the body rotation

sonic stratus
#

Okay, I want to look into it a bit more..

lilac dagger
#

oh yeah, on newer versions, you need to set the connection of the fake player to something otherwise there's a null pointer somewhere

sonic stratus
#

i have any doc ?

lilac dagger
#

there's no documentation for nms

sonic stratus
#

:/

lilac dagger
#

you just need to know what you're doing

#

and trial and error

#

but i did show you how you can set connection

#

you just set it with the player you want it to be visible to

#

i think it was one of these packets that triggered the null pointer

sonic stratus
#

But I'm on 1.21.3, so I don't think it's the same, right?

lilac dagger
#

these are gonna be the same

#

if you're using the mojmaps

#

?mappings

undone axleBOT
lilac dagger
#

what was the link

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
__**Admin:**__

selfrole Add or remove a selfrole from yourself.

__**Cleanup:**__

cleanup Base command for deleting messages.

__**Core:**__

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

__**Downloader:**__

findcog Find which cog a command comes from.

__**Mod:**__

names Show previous usernames, global display names, and server...
userinfo Show information about a member.

__**ModLog:**__

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

__**Permissions:**__

permissions Command permission management tools.

remote swallow
#

?nms

lilac dagger
#

there you go

remote swallow
#

?switchmappings

lilac dagger
#

thank you

lilac dagger
#

or a shortest path algorithm

wary oyster
lilac dagger
#

dijkstra i belive

#

dijkstra can do this actually

#

if you want to make a list of possible jumps

#

and generate terrain based on it

wary oyster
#

I already have a list of jumps that are possible

#

Pregenerated to pick from

lilac dagger
#

two paths, set some random rules and make it find the shortest path

#

and fill it with parkour segments

#

that are actually doable for players

lilac dagger
#

so the last thing is already did

#

you just need to make a cuboid, make random rules, of where to go and where it can't and use dijkstra to find the shortest path or i don't think you even need the shortest path here

#

you probably want the longest path

azure zealot
#

why are the buildtools broken?

raven pulsar
#

buildtools broken on windows, why?

wary oyster
lilac dagger
#

like below the parkour segments?

wary oyster
#

Yeah

lilac dagger
#

or you want to make walls

remote swallow
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.

lilac dagger
#

it all depends on your implementation

raven pulsar
wary oyster
#

Well i was sort of envisioning it being pretty close to the terrain

azure zealot
#
Patching net\minecraft\world\level\World.java
Patching net\minecraft\world\level\WorldAccess.java
Der Befehl "sh" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [C:\Windows\system32\cmd.exe, /D, /C, sh, applyPatches.sh]
    at org.spigotmc.builder.Builder.runProcess0(Builder.java:1042)
    at org.spigotmc.builder.Builder.runProcess(Builder.java:967)
    at org.spigotmc.builder.Builder.startBuilder(Builder.java:679)
    at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:60)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "javax.swing.JButton.getPreferredSize()" 
raven pulsar
remote swallow
#

If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.

lilac dagger
azure zealot
lilac dagger
#

will it use the pregenerated terrain as part of the parkour generator?

remote swallow
wary oyster
#

i was thinking i could possibly use cave carvers at almost sea level to generate paths for me

lilac dagger
#

well, you'd need the information about where a cave starts and ends if it ends

wary oyster
#

I guess yeah

lilac dagger
#

if you have those you could calculate a path in the cave from a place to another

#

you'll need a custom path finding algorithm that takes your parkour segments as each possible point btw

#

now that i think of

#

and somehow not circle back

#

i guess you could make all the nearby points score really high so the path won't try to loop back

azure zealot
wary oyster
#

In the past i made it so that the next jump must be within 30 degrees in the xz plane of the vector between the last 2 blocks

lilac dagger
#

you can use a selection and a start point and end point to define your parkour on the terrain

wary oyster
lilac dagger
#

that's a good idea

#

but what if you want it to go above a previous part of the parkour?

wary oyster
lilac dagger
#

oh so it works

wary oyster
#

This could also be made simpler if i just pick a few maps that would be good for parkour and then place a bunch of markers in it that the pathfinder can choose between

#

So that it goes to and between things in an interesting way

lilac dagger
#

yeah, but it won't be as random anymore

wary oyster
#

Yeah

lilac dagger
#

i don't think a* or dijkstra is best here if you want to make it random

#

you need some sort of snake like algorithm

wary oyster
#

I think they would work well if theres a way we can determine what it means for a cool place to go to would be deterministicly

lilac dagger
#

but they need to be modified for your need

wary oyster
#

Like in an ideal world we consider a jagged peaks biome as a surface represented by some equation, and the interesting part is where its slope is the greatest

tepid crypt
#

where I can learn spigot plugin development fast??

wary oyster
wary oyster
lilac dagger
wary oyster
#

Indeed

lilac dagger
#

and if you plan to go through a jungle biome, someone could just climb vines and skip it all

wary oyster
#

Yes ive considered jungle biomes as being something id rather avoid

#

Because you would just be above ut

tepid crypt
wary oyster
#

Probably only would do mountainous biomes because they are the most interesting and do not have alot of trees

lilac dagger
#

did you consider generating custom terrain?

wary oyster
#

Yea

lilac dagger
#

one that's friendly for parkour?

#

and you have info about start and end and so on

#

so you could snake through

chrome beacon
#

Contains all you need then

wary oyster
#

Can you generate worlds with noise functions that you can analyze mathematically or do you just use the built in stuff in world gen

#

Last time i messed with world gen was 1.18 with datapacks

lilac dagger
#

perlin noise all the way

#

i think even the caves are a variation of perlin noises

chrome beacon
#

You can watch the world gen talk if you're curious

lilac dagger
#

but you need to access the perlin noise information that minecraft uses

#

which i don't think it's easy

wary oyster
#

I should look at axioms plugin code

lilac dagger
wary oyster
#

They do stuff related to slope angle all the time

lilac dagger
#

it's an interesting project, if i ever make a parkour plugin then i'll be more helpful for sure

#

analyzing all the possible options i have and considering each limitation

wary oyster
lilac dagger
#

it's a talk about how mojang generates worlds with perlin noise

wary oyster
#

Oh with henrik

chrome beacon
#

yes

wary oyster
#

Yea i remember watching that a lil while ago

#

Time to watch again

lilac dagger
#

you can make a height map

#

now that i can think of

#

but it won't work for caves

fathom pebble
#

How can I delete a resource loaded by mistake?

blazing ocean
#

what

eternal oxide
#

loaded by mistake?

#

If posted? self report it

fathom pebble
#

But isn't there a way to remove it?

blazing ocean
#

nope

#

only that

eternal oxide
#

you report it and ask for it to be deleted

fathom pebble
blazing ocean
#

no

#

they can see who reported it

fathom pebble
#

@vagrant stratus can you delete my resource ?

blazing ocean
#

._.

fathom pebble
lilac dagger
#

just wait

#

someone will delete your resource in a day or 2

wary oyster
#

what is resource and why are people always asking for it to be deleted

chrome beacon
#

a resource is usually a plugin

#

but you can upload other things on to spigotmc

lilac dagger
#

like skript files

#

don't hate on people using skript 😄

#

it's a nice way to understand the concept of programming

#

like how lines run one after another

#

how variables work and how to schedule tasks

nova notch
#

I've tried skript before

eternal oxide
#

Skript is fine for those not up to setting up a dev environment.

nova notch
#

It is genuinely worse than scratch

#

The syntax is a complete fucking mess too you're better off just learning java

lilac dagger
#

i used skript when it had like 1000 possible things you could do

#

now's probably at like 100000

#

with addons

#

it used to look like natural language which was nice

#

no idea how it looks now

#

i can't seem to find an example

nova notch
#

that's why you're better off just learning java because there's so much more out there as far as tutorials, examples, and other support

lilac dagger
#

you're right

#

this isn't a natural language anymore

wary oyster
#
private static final Transformation[] FRAMES = new Transformation[]{
            new Transformation(ZERO_VECTOR, NO_ROTATION, INITIAL_SCALE, NO_ROTATION),
            new Transformation(ZERO_VECTOR, NO_ROTATION, FULL_BLOCK_SCALE, NO_ROTATION)
    };
    public static void placeBlock(Location location, Material block, JavaPlugin plugin, Player player) {
        var world = player.getWorld();

        // Adjust location to center the block display within the block space
        var x = location.getBlockX();
        var y = location.getBlockY();
        var z = location.getBlockZ();

        Location blockLocation = new Location(world, x, y , z);
        Location centeredLocation = blockLocation.clone();


        var blockDisplay = world.spawn(centeredLocation, BlockDisplay.class, display -> {
            display.setBlock(block.createBlockData());
            display.setBillboard(Billboard.FIXED);
            display.setTransformation(FRAMES[0]);
        });

        /*blockDisplay.setInterpolationDuration(40);
        blockDisplay.setInterpolationDelay(0);

        blockDisplay.setTransformation(FRAMES[1]);

        the above code does not fully scale the display for some reason

*/

        //attempt to hard code
        // Number of animation steps based on the scale increment
        int totalSteps = (int) ((FULL_BLOCK_SCALE.x - INITIAL_SCALE.x) / SCALE_INCREMENT);

        for (int i = 0; i <= totalSteps; i++) {
            final int step = i;
            Bukkit.getScheduler().runTaskLater(plugin, () -> {
                float scale = INITIAL_SCALE.x + SCALE_INCREMENT * step;
                Vector3f currentScale = new Vector3f(scale, scale, scale); // Ensure scale does not exceed FULL_BLOCK_SCALE
                if (currentScale.x > FULL_BLOCK_SCALE.x) currentScale = FULL_BLOCK_SCALE;
                blockDisplay.setTransformation(new Transformation(ZERO_VECTOR, NO_ROTATION, currentScale, NO_ROTATION));
            }, i); // Schedule each step 1 tick apart
        }



        Bukkit.getScheduler().runTaskLater(plugin, () -> {
            blockDisplay.remove(); // Remove the display entity
            world.getBlockAt(blockLocation).setType(block); // Set the actual block in the world
        }, totalSteps-1); // Schedule this to run after enough time for interpolation to complete


    }

i gave up messing with interpolation and just hard coded it

#

it looks fine

blazing ocean
#

is this chatgpt code

wary oyster
#

no but i learn from chat gpt so it probably looks like it

#

also excessive comments ik

blazing ocean
#

"adjust location" hmm ah yes not chatgpt

wary oyster
#

that was me if it was chat gpt it would probs do that all in one line

#

anyways what do i do to get it to scale or at least fake it to look like its scaling not from the corner

#

do i translate simultaneously

blazing ocean
wary oyster
#

that was literally me

#

does the above look like chat gpt

blazing ocean
#

yes

wary oyster
#

random multi line comment with code that wasnt working

blazing ocean
#

yeah I believe you that you wrote that :p

wary oyster
#

i just decided to use a for loop even though its probably not the proper way to do it cuz i just want it to work

#

and im not super fluent in java or the spigot api

wary oyster
blazing ocean
#

because it did not write the first of those comments

wary oyster
#

it didnt write any of them 🥺

tall gyro
nova notch
#

chatgpt definitely wrote that

#

blockDisplay.remove(); // Remove the display entity

#

Do you just like useless comments or was it ai

tawny remnant
#

What would be the optimal way of identifying a PlayerHead? Im creating a custom "ore" sort of, and right now im identifying it with PersistentDataContainer key.

wary oyster
#

it confirms to myself what i expect to happen

nova notch
wary oyster
deft geode
#

Is there a place that lists all new things added to spigot per release?

remote swallow
#

the release post

granite owl
#

im pretty new to concurrency, is this thread safe/should i change it? ```java
public class AtomicObject <T1>
{
private long tID = 0;
private T1 obj = null;

public AtomicObject(T1 obj)
{
    synchronized(this.obj)
    {
        this.obj = obj;
    }
}

public synchronized boolean lock()
{
    if (this.tID == 0)
    {
        this.tID = Thread.currentThread().threadId();
        return true;
    }

    return false;
}

public synchronized boolean release()
{
    if (this.tID == Thread.currentThread().threadId())
    {
        this.tID = 0;
        return true;
    }

    return false;
}

public synchronized T1 get()
{
    if (this.tID == Thread.currentThread().threadId())
    {
        return this.obj;
    }
    
    return null;
}

public synchronized void set(T1 obj)
{
    if (this.tID == Thread.currentThread().threadId())
    {
        this.obj = obj;
    }
}

}

dry hazel
#

umm what is this for

granite owl
#

to prevent race conditions between the server thread and a dispatcher

echo basalt
#

mfw AtomicReference

granite owl
lilac dagger
#

i don't think this is thread safe

#

get and set can access the data independently (synchronized won't catch it)

#

you need a reetrantlock to check instead of a thread id

#

but an atomic reference is the best option based on what you have above

pure dagger
#
block.applyBoneMeal(BlockFace.UP)

why does it return false if the bonemeal was applied succesfully and my plant has grown

lilac dagger
#

Does it say what the return is for?

sweet pike
#

does anyone have any tips on how to constantly hide/show a player without removing their entry in the Tablist?

i am sending an entity destroy packet to all viewing players, but i am struggling on finding a way to spawn them back in

sullen wharf
#

Why doesnt right-clicking armor pieces trigger ArmorEquipEvent🤔

#

Right-click swap*

river oracle
sullen wharf
#

wut

remote swallow
#

spigot has no armor equip event

river oracle
#

Spigot has no such event

sullen wharf
#

bruh wut

#

I though this was from Bukkit, I'm dumb

#

my bad

#

Thanks anyways ❤️

thorn crypt
#

Hi, I have a problem. I try to get a player's server using Bungee Messages, but it doesn't seem to work and I don't know why. Here is my code :

@Override
    public void onEnable() {

        getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
        getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
}

@Override
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {
        if (!channel.equals("BungeeCord")) {
            return;
        }
        
        ByteArrayDataInput in = ByteStreams.newDataInput(message);
        String subchannel = in.readUTF();
        Bukkit.getLogger().info("Received message from BungeeCord subchannel: " + subchannel);
        if (subchannel.equals("GetPlayerServer")) {
            String userName = in.readUTF();
            String serverName = in.readUTF();
            Bukkit.getLogger().info("Player " + userName + " is connected to " + serverName);
        }
    }

public void checkPlayerConnected(Player sender, String targetPlayerName) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("GetPlayerServer"); // Channel
        out.writeUTF(targetPlayerName); // Name of the target

        sender.sendPluginMessage(this, "BungeeCord", out.toByteArray());

    }
mellow edge
#

what exactly doesn't work?

thorn crypt
#

"Bukkit.getLogger().info("Player " + userName + " is connected to " + serverName);"

mellow edge
#

does the first log work as intended or what?

thorn crypt
#

Yes it does, I do get "Message rom BungeeCord subchannel: PlayerList" but from another channel because I have another plugin using "PlayerList"

mellow edge
#

interesting, the code seems correct tho

thorn crypt
#

yeah :'(

#

idk what's wrong :/

mellow edge
#

yeah, this is following the packet format

#

maybe you are having your bungeecord setup wrong or idk...

thorn crypt
mellow edge
#

is your targetPlayerName correct?

thorn crypt
mellow edge
#

well ok assuming you specify it via command or hardcoded...

thorn crypt
mellow edge
#

try and see and also you need to have a player online to get his data

thorn crypt
#

give me a sec to show you

mellow edge
#

ok

thorn crypt
#

I get nothing back in my console

#

Okay, it's completly my bad I think.. :')
I'm sorry

mellow edge
#

is it working?

thorn crypt
#

I'm using Velocity, seems like they kept almost every bungee messages the same, EXCEPT GetPlayerServer

#

they changed GetPlayerServer into GetServer

mellow edge
#

ohhhh

#

yeah

thorn crypt
mellow edge
#

I was in a similar situation once lol

thorn crypt
#

Yeah ahah, it's my bad, sorry for the time I took you ^^

mellow edge
#

no problem

thorn crypt
#

Wishing you a good evening/day :)

mellow edge
#

same

thorn crypt
#

thank you :D

dire trail
#

why cant I set world spawn

coral sparrow
#

Hi i need help how do i make when player jumps twice in air they get elytra for flying and when they land elytra disappears.

mellow edge
dire trail
#

I do /setworldspawn and it doesnt work

#

when people join they are where they last were

mellow edge
#

How is this related to spigot lol?

worthy yarrow
#

Pretty sure that spawn location is only used for respawning and first time joins

dire trail
#

thats my server soft ware

mellow edge
#

Also you must set this position to an air block

dire trail
#

huh how to make it respawn EVERY TIME

worthy yarrow
#

Just use essentials + ess spawn

mellow edge
dire trail
#

whast that

mellow edge
#

Use a pre-made plugin or even a datapack for that.

worthy yarrow
#

There are also plenty of essx alternatives

dire trail
#

but I hate essentials

mellow edge
#

Lol

#

Use an alternative

worthy yarrow
#

Did I not just say?

dire trail
#

im trying with multiverse but it doesnt work

mellow edge
#

Go to #help-server and also some plugins aren't compatible together

young knoll
#

World spawn should be used for every respawn and first join

#

Players joining again will be at their last location

worthy yarrow
#

I said that too

#

I told them to try sunlight

eternal oxide
#

they have muiltiverse so just mvm set spawn world

worthy yarrow
#

🤷 they said it didn't work

#

I'm not a multidimensional engineer man D:

dire trail
#

I give up

spare crypt
#

You're trying to set a spawn point that the player always goes to every time they join the server? And every time they respawn?

mortal vortex
spare crypt
#

Are you up for a little programming? This would be a pretty simple thing to handle programmatically, but I'm not sure if plugins exist that will take care of it

mortal vortex
dire trail
#

but I dont know java

mortal vortex
dire trail
#

support

mortal vortex
#

Then use #help-server. This channel is for help with developing plugins.

worthy yarrow
spare crypt
#

yeah, lol. But I don't know that anything else quite has the functionality for it

eager fiber
#

Hey I have a weird bug.
I am overriding /help, but I am receiving no args (empty array) in the executor, unless I write it explicitly as /myplugin:help
When I try to run /minecraft:help, it shows the usual unknown command message
It is running the same executor without the full namespaced command, but the only difference is that args is empty

I am registering commands as so:

Objects.requireNonNull(plugin.getCommand(commandName)).setExecutor(new HelpCommand());

It is defined in the plugin.yml as below:

commands:
  help:
    description: Tells the admins the user needs help
    usage: /help [message]
worldly ice
#

or it might include myplugin:help in the args, dont remember

blazing ocean
#

iirc overriding bukkit commands has always been pretty jank

worldly ice
#

yeah just sounds like jank with overriding commands to me

eager fiber
#

is there any way to fix it?

#

it's hard to search on the internet because it's about "help"

blazing ocean
#

You could try removing the bukkit help command from the command map

#

and then add yours back in

worldly ice
#

i was gonna say that, but i thought only plugin commands were stored in the command map

#

unless im thinking of something else

blazing ocean
#

hmm potentially

remote swallow
#

remove a players permission to /bukkit:help, give permission to use urs

eager fiber
#

unregistering minecraft:help didn't work
(unless i did it wrong?)

plugin.getServer().getCommandMap().getCommand("minecraft:help").unregister(plugin.getServer().getCommandMap());
worldly ice
#

yeah you can't do that

#

vanilla commands don't exist on the command map

#

what epic said would probably be easiest

eager fiber
#

bukkit makes me so mad

slender elbow
#

so true

lone cipher
#

im making a paper plugin and i made this recipe but when i put all of the stuff in the crafting table it only shows a normal book not the one i made. does anyone know what i did wrong?

   {
       ItemStack book = new ItemStack(Material.BOOK);
       ItemStack amethyst = new ItemStack(Material.AMETHYST_SHARD);
       ItemStack totem = new ItemStack(Material.TOTEM_OF_UNDYING);
       ItemStack gold = new ItemStack(Material.GOLD_BLOCK);
       ItemStack diamond = new ItemStack(Material.DIAMOND);

       ItemStack questBook = new ItemStack(Material.BOOK);
       ItemMeta questBookMeta = questBook.getItemMeta();
       questBookMeta.displayName
               (Component
               .text("QUEST LICENSE")
               .color(TextColor.color(75,0,130))
               .decoration(TextDecoration.BOLD, true)
               );
       questBookMeta.getPersistentDataContainer().set(Keys.QUEST_BOOK, PersistentDataType.BOOLEAN, true);
       questBookMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
       questBookMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 1, true);


       ShapedRecipe bookRecipe = new ShapedRecipe(new NamespacedKey(main.getInstance(), "QuestBookRecipe"), questBook);
       bookRecipe.shape
               (
               "AGA",
               "DBD",
               "ATA"
               );
       bookRecipe.setIngredient('B', book);
       bookRecipe.setIngredient('A', amethyst);
       bookRecipe.setIngredient('T', totem);
       bookRecipe.setIngredient('G', gold);
       bookRecipe.setIngredient('D', diamond);
       Bukkit.addRecipe(bookRecipe);
   }```
violet blade
#

most likely because you are not applying the itemmeta to the itemstack but if you are making plugins for paper, ask on paper...

worldly ice
magic beacon
#

Yo we are trying to import a plugin into our server, but we are running into a problem and its not working alot to explain, can someone help over vc? via screenshare

drowsy helm
magic beacon
#

Ok basically we are trying to import a custom plugin and idk what is happening so cant explain much but its not fully uploading

#

like it shows in plugin folder

#

but doesnt work when trying to execute it in game

drowsy helm
#

what does it say in console

worthy yarrow
#

Any console errors?

magic beacon
#

no

#

Not that i see

worthy yarrow
#

Can you do /pl? Does it come up as green

#

Or does it come up at all...?

drowsy helm
#

it will at minimum give you a config error if its not valid and is a jar

worthy yarrow
#

^

#

ctrl + f on the console page and search for the plugin name or some sort of relevant reference to the plugin

magic beacon
worthy yarrow
#

What plugin is it?

drowsy helm
#

?paste

undone axleBOT
drowsy helm
#

can you put your console log in this

kind hatch
#

What type of file are you uploading?
Where are you uploading it to? (Remote Sever? Panel?)
What directory is it being uploaded to?

magic beacon
#

nvm son1c figured it out thank you though

wary oyster
#

I just thought of the best name for my parkour pathfinding alg i just conceptualized and am writing out rn

Walk in the parkour pathfinding

wary oyster
# wary oyster I just thought of the best name for my parkour pathfinding alg i just conceptual...
#

@lilac dagger this is what i thought of

kind condor
#

how to make player say something with json?

#

looks like player.chat only allows plain string

nova notch
#

deserialize it?

kind condor
#

deserialize?

pliant apex
#

how do i make a anticw 😭

rough ibex
#

CW?

pliant apex
#

makes it to where you can automatically crystal pvp

rough ibex
#

what

#

link me to something

#

what even is crystal pvp

kind condor
#

I want to make player say {"translate": "block.minecraft.air"}

pliant apex
#

like this, this is a cheat for crystal pvp

rough ibex
#

check how fast they place crystals

#

check for whatever it does that's not normal

grand flint
#

wowi really

#

some can place it reallt fast though

rough ibex
#

just write really fast code /s

pliant apex
rough ibex
#

then the check should work well

pliant apex
#

but i need something like a plugin that would check how fast they are crysstalling

#

like i said it is very obvious because you will crystal at obvlivion

rough ibex
#

okay

#

it is expected that you can write it yourself

pliant apex
#

is there a channel for finding plugins?

rough ibex
#

but I doubt anyone has a specific AC check for this

pliant apex
#

or do i have to look through spigot?

rough ibex
#

look through the resources page

#

yes

pliant apex
#

Ok

wary oyster
#
package dev.mcneds.parkour.util;

import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Location;
import org.bukkit.World;

import java.util.ArrayList;

public class ChunkAnalyzer {

    public static ArrayList<Location> highestBlockPositions (Chunk chunk){

        ArrayList<Location> chunkMesh = new ArrayList<>();
        ChunkSnapshot chunkSnapshot = chunk.getChunkSnapshot(true, true, false);
        World world = chunk.getWorld();
        int chunkX = chunk.getX();
        int chunkZ = chunk.getZ();

        for (int x = 0; x < 16; x++) {
            for (int z = 0; z < 16; z++) {
                int y = chunkSnapshot.getHighestBlockYAt(x, z);
                chunkMesh.add(new Location(world, (chunkX * 16) + x, y, (chunkZ * 16) + z)); // actually convert from chunk coords to world coords you bozo
            }
        }
        return chunkMesh;
    }

    public static Location highestInChunk (ArrayList<Location> chunkMesh){


        Location maxLocation = chunkMesh.getFirst();
        for (int i = 0; i < 256; i++) {
            if (chunkMesh.get(i).getBlockY() > maxLocation.getBlockY()){
                maxLocation = chunkMesh.get(i);
            }

        }
        return maxLocation;
    }


}

is there a better way to find the highest block in a chunk

#

(faster)

buoyant viper
#

?stash

undone axleBOT
kind condor
eternal oxide
#

not with json but you can use components

thorn crypt
#

Hey, I use a claim plugin (Factions by MassiveCraft) and I'm having a problem.

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void onBlockBreak(BlockBreakEvent event) {
        Player player = event.getPlayer();
        player.sendMessage("§cYou broke a block.");
    }

The problem is that if a player try to break a block in a claim where he can't place, the break block Event is cancelled, and my code wont run even tho it has HIGHEST priority and ignoreCancelled

eternal oxide
#

Components support Translatable objects

spiral light
wary oyster
thorn crypt
buoyant viper
kind condor
wary oyster
thorn crypt
spiral light
thorn crypt
grand flint
spiral light
#

Bukkit.getPluginManager.register...

thorn crypt
#

because the code run if it's not in a claimed area etc

#

(same for the other events in the class)

spiral light
#

did you try to remove the priority and ignoreCancelled ?

thorn crypt
#

yes

#

I first tried just @EventHandler, then added priority and ignoreCancelled

#

nothing works

spiral light
#

but it works when the area is not claimed ?

thorn crypt
#

yes

#

seems like Factions is too high :')

spiral light
#

sounds like you did not update the plugin jar

thorn crypt
grand flint
thorn crypt
# spiral light sounds like you did not update the plugin jar
@EventHandler(priority = EventPriority.HIGHEST)
    public void onBlockBreakFaction(BlockBreakEvent event) {
        Player player = event.getPlayer();
        player.sendMessage("§cYou broke a block. (New Message)");
    }

this is in a non-claimed area, and still doesn't work in a claimed area
now i'll try with the ignorecancelled and update you

shadow night
#

Iirc highest priority means it will be called last

spiral light
shadow night
grand flint
spiral light
spiral light
grand flint
#

Well I tried both, same error

#

I just build the jar with maven no?

thorn crypt
spiral light
grand flint
#

Shade gave error

#

One minute

thorn crypt
fading drift
#

anyone familiar with setting up intellij modules for spigot plugins

eternal oxide
grand flint
spiral light
#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
__**Admin:**__

selfrole Add or remove a selfrole from yourself.

__**Cleanup:**__

cleanup Base command for deleting messages.

__**Core:**__

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

__**Downloader:**__

findcog Find which cog a command comes from.

__**Mod:**__

names Show previous usernames, global display names, and server...
userinfo Show information about a member.

__**ModLog:**__

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

__**Permissions:**__

permissions Command permission management tools.

spiral light
#

thats not what i wanted

#

?paste

undone axleBOT
spiral light
#

can you provide the pom ?

spiral light
#

hmm i dont know... pom seems correct and your code too

grand flint
#

Yeah lol

buoyant viper
#

wait

#

?jd-s sec

undone axleBOT
buoyant viper
#

ok yeah its that

#

its like priority over the final say of the event rather than call order priority

shadow night
#

Yes

buoyant viper
#

?stash i wanna see what this undocumented method is

undone axleBOT
shadow night
#

what

buoyant viper
#

ah its the integer value of the priority

buoyant viper
#

couldve totally used .ordinal but i see why they wouldnt