#help-development

1 messages · Page 1088 of 1

river oracle
#

Look at HTTPClient

sterile breach
#

thanks

river oracle
#

If it's json endpoints usually I just make gson do the heavy lifting

echo basalt
#

we tried this. eyeLocation and location have no difference when calculating direction

drowsy helm
#

Wuat are you trying to do?

echo basalt
#

head vs body rotation is also not a thing

#

eyeLocation is literally location + height

drowsy helm
#

wrapper has been deprecated for a while

wooden zodiac
#

1.8

river oracle
#

Kekw

wooden zodiac
#

there is no instant health so i did HEAL

river oracle
#

9 years old that's why

wooden zodiac
#

maybe it should work as instant health because health boost and regen exists

slate siren
#

Guys, I need some help, now I'm trying to code with Kotlin, I'll take a head and enter /addhead (name) to make the head disappear with that name into the json.

#

But there is a problem

#

I bought the head from a site called minecraft-heads and got the head that way with the command block.

#

Can't register this correctly

#

How can i do

dapper flower
#

where can i get the list of type of the block entity

lost matrix
slate siren
lost matrix
grim ice
#

how do you get the block that a dispenser is pointing at?

#

(not ray casting, I want the immediate block)

#

like, the one right in front of it

tardy delta
#

getRelative maybe?

grim ice
#

nvm

#

Directional

eternal oxide
#

Block next to is Dispenser#getRelative(Dispenser#getFacing())

tardy delta
#

starting looking for it too lol

grim ice
#

there's no Dispenser#getRelative though

#

since it's a block state

tardy delta
#

get a block

grim ice
#

yes

tardy delta
#

dispenser.getBlock()

#

from BlockInventoryHolder

brittle geyser
#

when i trying to use net.minecraft.network.chat.Component it says that no def found

#

nms version 1_20_R3, how to fix it?

chrome beacon
#

During compile or runtime

brittle geyser
#

runtime

pliant topaz
#

Is there a good way of placing blocks async without using FAWE? (there are reasons I cannot use it as I'm not the lead on the project and it should not use more than paper itself as a lib)

chrome beacon
#

?nms

chrome beacon
#

^^

brittle geyser
#

no i dont forget

chrome beacon
#

Show your pom

#

?paste

undone axleBOT
brittle geyser
#

gradle*

chrome beacon
#

Show your build file then

#

Don't send text as image

#

?paste

undone axleBOT
brittle geyser
#

Ok

pliant topaz
upper hazel
#

Who know what the event need for detect item move usage number buttons in keypad

earnest girder
#
File f = new File("plugins/Wicklow2/players/" + player.getUniqueId() + ".yml");

This is in my onPlayerJoin handler. Why is the file not getting created?

brittle geyser
river oracle
#

you aren't make sure the remap task is actually running

brittle geyser
#

yes

#

class is not founding in runtime

#

broooooo

river oracle
#

you're jar isn't remapping

brittle geyser
#

spigot doesnt have component class

river oracle
#

make sure the remap task is actually running

brittle geyser
#

already remapping

river oracle
#

your jar isn't remapping

#

make sure the task is running

brittle geyser
#

i am not stupid and remapping jar

river oracle
#

you are not remapping the jar

brittle geyser
#

why not

river oracle
#

make sure the task is running

#

because Component should remap to IChatBaseComponent

#

but it isn't at compile time

dense falcon
#
public class onJoinLobby implements Listener {

    private final Main NeoWorldPlugin;

    public onJoinLobby(Main main) {
        NeoWorldPlugin = main;
    }

    private static void sendTitle(Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut) {
        IChatBaseComponent chatTitle = ChatSerializer.a("{\"text\": \"" + title + "\"}");
        IChatBaseComponent chatSubtitle = ChatSerializer.a("{\"text\": \"" + subtitle + "\"}");

        PacketPlayOutTitle titlePacket = new PacketPlayOutTitle(EnumTitleAction.TITLE, chatTitle);
        PacketPlayOutTitle subtitlePacket = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, chatSubtitle);
        PacketPlayOutTitle length = new PacketPlayOutTitle(fadeIn, stay, fadeOut);

        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(subtitlePacket);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(length);
    }

    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        List<String> serverName = Arrays.asList(Bukkit.getServerName().split("-"));
        System.out.println(serverName);
        if (serverName.get(0).equalsIgnoreCase("lobby")) {
            Inventory inv = player.getInventory();
            inv.clear();

            player.setHealth(20);
            player.setFoodLevel(20);
            player.setGameMode(GameMode.ADVENTURE);
            player.teleport(new Location(player.getWorld(), 0.431f, 103, 0.622f, 0.5f, 2.1f));
            sendTitle(player, "&4 Test", "", 1,2,1);
        }
    }
}
``` Why I don't see my title 😦 ? (1.8)
river oracle
#

which means its likely the task isn't running

brittle geyser
river oracle
earnest girder
#
File f = new File("plugins/Wicklow2/players/" + player.getUniqueId() + ".yml");

This is in my onPlayerJoin handler. Why is the file not getting created?

river oracle
earnest girder
#

how do you create it?

river oracle
#

also hard coding that is dumb

earnest girder
#

this always worked for me before

river oracle
#
File f = new File(plugin.getDataFolder(), "players/%s.yml".formatted(player.getUniqueId());

Server owners can change the location of the plugins folder

#

this is the only safe way to direct youreself to that file

river oracle
river oracle
#

please consider learning more java or using google for super simple things like that

brittle geyser
#
> Task :1_20_R3:remap
Successfully obfuscate jar (1_20_R3, MOJANG_TO_SPIGOT)
earnest girder
#

I dont understand why it worked before and isnt working now

#

I never did anything else to create the file, new File() just did it automatically if it didnt exist

chrome beacon
#

new File doesn't actually write to disk

earnest girder
#

hmm, whenever new players joined it would create a file for them on my old server with the same code

ivory sleet
#

pretty sure somewhere ur code would run f.createNewFile()

#

if that were the case ^

earnest girder
#

I never used that method

#

I still have the old code

chrome beacon
#

some part of the code calls it

#

might be indirectly

earnest girder
#

cfg.save(f)?

chrome beacon
#

yes

burnt heron
#

Everything is very close to a solution...There is one more problem left to solve: I log on to the server, it says in the console that I am logged in, but in minecraft it connects me to the server and does not let me through to the server, I am kicked with the inscription "Disconnect"

chrome beacon
#

That would do it

ivory sleet
#

@earnest girder anyway fyi, File itself is pretty much just an object that contains the path to a file (whether that file actually exists or not on disk is another question, finding out about that is usually done by using some method() on the file object)

brittle geyser
#

how to combine projects and remap each project?

#

when i remapping one project its work but in all in one project remap is not appear

#

When i implementation my two projects (one of these has remapped) into one, remap dissappear

misty ingot
#

hey im trying to change the sound that the ender dragon makes
so like instead of its original roar it will make a diff sound
any ideas how i could go about doing this?

blazing ocean
#

Use a resource pack

brittle geyser
#

guys help with remapping pls

#

i have multiple projects, and result jar dont have mapping, but separately it has remap

#

what should i do?

chrome beacon
#

shade

#

then remap

brittle geyser
#

what is shade

river oracle
#

he means shadow

river oracle
#

if you have different versions remapping after shadowing will cause issues

brittle geyser
#

i have multiple project, separately it has remap, but when combining into 1 jar there is no remap

#

why?

river oracle
brittle geyser
#

fat?

river oracle
#

gimme your gradle configs

brittle geyser
river oracle
#

why does discord say that is a download

brittle geyser
#

idk

river oracle
#

weird

#

probably because of the .

river oracle
brittle geyser
#

build

chrome beacon
brittle geyser
#

currently i have two projects, one of them use nms

echo basalt
#

currently I have 8 projects, one of them uses minecraft

river oracle
# brittle geyser

alright in your nms configuration
build.get().dependsOn(remap) remove this line
Then in your bigger one tasks.jar {enabled = false}
shadowJar should then handle everything theoretically given your other modules are shaded properly

brittle geyser
#

not works

jolly solstice
#

Do you mean a Collection? Like Map or List?

brittle geyser
#

yes

river oracle
hazy parrot
#

Yes

jolly solstice
hazy parrot
#

As u should be sorting in actual query

#

Yes, it's a database operation

#

Not service layer logic

jolly solstice
#

Why would extra functionality be inappropiate?

#

Also the ORDER BY keyword is in the SQL reference

#

Which means every database that is SQL based, should have it implemented

brittle geyser
sterile sapphire
#

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event){
        event.setJoinMessage("Welcome To The Server");
        System.out.println("A player Has Joined The Server");
    }

    @EventHandler
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        
    // Queues You For 1v1s
        
        if (command.getName().equalsIgnoreCase("Queue")) {
            if (sender instanceof Player) {
                Player p = (Player) sender;
                p.sendMessage(ChatColor.GREEN + "You Are Now Queued For 1v1");
            }
        }
        
        return true;
    
    }
}```
#

it rly doesnt like CommandSender public boolean onCommand(CommandSender sender, Command command, String label, String[] args)

hazy parrot
#

That is not how commands work in spigot...

sterile sapphire
jolly solstice
#

So you should end up having a CommandExecutor for every command in your project

wicked sinew
#

EntitiesUnloadEvent, e.getEntities() seems to be empty every time,

#
@EventHandler
  public void onEntitiesUnload(EntitiesUnloadEvent e) {
    Bukkit.broadcastMessage("Plain Entities: " + e.getEntities().size());
amber stump
#

What event do I use if I want to check if the player picked up xp?

quaint mantle
amber stump
quaint mantle
#

Oh nvmd yeah your right

wicked sinew
#

I use Paper yet use this discord cause 🤷‍♂️ lmao

wicked sinew
slender elbow
#

i mean there's the exp change event but that'll fire for more things with next to no context

amber stump
#

Increasing the received experience

slate siren
#

Guys, I need some help I will send a code

halcyon hemlock
#

what do y'all think

#

made it myself in rust

#

the ecs

#

(on another thread)

blazing ocean
#

rookie numbers

blazing ocean
slate siren
#

https://pastes.dev/d6uFZqX29o

heads:
    test1:
      ==: org.bukkit.inventory.ItemStack
      type: SKULL_ITEM
      damage: 3
      meta:
        ==: ItemMeta
        meta-type: SKULL
        display-name: Enderchest

I get the head from the Minecraft-heads website and access it through the command blog. When I take it and type /addhead test1, it saves the config like this.

However, the one below does not add the internal, and when I say /gethead test it gives the alex head. I manually typed internal into config and reloaded it, and again I said /gethead test1 and I got the head successfully.
I want it to save the internal as well when using the /addhead command, but I couldn't do this.

internal: H4sIAAAAAAAAAE2PzU6DQBzE/5qYIPExvJKwsEB76MFYa5d0QVo+yt74WEJhF5sWGuhz+YDizePMb2aSUQFUeDm0gxBfl+/qJLgCj6SE1xKbqEILrFkmxho2qlLLsbXQCiszSuRgJ8OOCupcOvNLf+LXZ1B6PvbDhV9VAHhQ4CnOxMDhh0+uzo61Xh5dUUzEnnV40IVPmrNDunjK34lN5My3b/ZuWv7LWn2WWCI13Zp1wZDLWN+Ze8G3e1TI6JY2G8nkRrCwGKmkJlvXLQ29Jm3o6CeR6YXp6K9blEpXeGFkpJIi2nxgNnsspBa9B3/8Pm+0fkJ075OOpEPLKlit5gfwC2I59wQcAQAA

lost matrix
slate siren
lost matrix
#

1.8 support was dropped years ago

#

Its soon a decade old

worthy yarrow
#

?1.8

undone axleBOT
slate siren
lost matrix
#

Yeah thats how i picture the average 1.8 playerbase

worthy yarrow
#

Do you mean current 1.8 playerbase or like back when it was still acceptable

slate siren
#

The previous plugin was also recording without any problems, it was also 1.8.

lost matrix
#

Current

worthy yarrow
#

Ah yeas

#

Youngsters

worthy yarrow
slate siren
#

Mmm

worthy yarrow
#

1.8 is just old man

slate siren
#

So how do we define the head?

worthy yarrow
#

Lotta exploits fixed since then

#

Idk I don’t use 1.8 api

slate siren
#

I know it is old version

quaint mantle
blazing ocean
#

Just update

#

Just don't use 1.8

#

Ever.

slate siren
#

Nope, I need to use 1.8

#

I try to solve it somehow🙄

blazing ocean
#

No you don't.

quaint mantle
#

Like no one gonna help with ancient spigot

slate siren
#

My server will be installed on 1.8.9

blazing ocean
#

Then glhf with that

#

You just won't receive support here

#

Since nobody uses it

slate siren
#

Because it's a pvp server, and the best version for pvp

blazing ocean
#

slate siren
#

But still 1.8

jolly solstice
#

Still being used

quaint mantle
#

Who's destroys the mouse first, wins

blazing ocean
#

If you wish to use a 10 year old version, you need to know what you are doing.

#

And don't even dare to bring up hypixel rn

worthy yarrow
#

^

#

You can’t just start 10 years later lol

slate siren
#

I think it's a rule, it's a game, it's great in the beginning so it's still preferable for 1.8 pvp

jolly solstice
blazing ocean
#

And they have a team of like 50 devs I think

#

and they all know what tf they are doing

#

And they aren't even using spigot

worthy yarrow
#

They don’t understand what it means to maintain ancient technology

slate siren
worthy yarrow
#

The fucking hoops you gotta jump thru like pre 1.13

#

It’s bad

blazing ocean
#

No components 🤢

worthy yarrow
#

I meannnn

#

Spigot still ain’t helping us there

blazing ocean
#

real

#

just use paper bro runs

#

Bro switched to turkish

worthy yarrow
#

Nah I just shade all of adventure in my plugins lol

slate siren
#

🤷.

worthy yarrow
#

Adventure has the bukkit extension anyway so

blazing ocean
#

yeah

slate siren
#

e I feel like an old turtle while playing the new versions. 😂

blazing ocean
#

💀

#

Literally just a skill issue

worthy yarrow
#

That makes no sense

#

New means new

#

And in this case VERY IMPROVED

slate siren
#

I think the old version is great for pvp

lost matrix
#

Idk how ppl program and dont just change what they dont like

worthy yarrow
#

Truth

slate siren
#

Of course, the current versions are better.

#

But for pvp the old version is always better

worthy yarrow
slate siren
#

Nope

worthy yarrow
#

It’s really not that bad

slate siren
#

1.8.9 <3 me

worthy yarrow
#

Your loss man gl

slate siren
#

Tastes and colors are indisputable

blazing ocean
#

Get well soon

slate siren
near mason
#

how can i get the position of a particle after respawning it?

lost matrix
#

A particle doesnt exist on the server. You simply send a packet to the client and tell it where a particle spawns

near mason
#

what about computing its positon based on speed, ticks passed etc?

lost matrix
#

Depends on the particle. Most particles have random movement patterns. It all depends how each client interprets the particle.
Some particles can have momentum and a direction.

near mason
#

ok thank you

lost matrix
pliant topaz
#

When creating BlockData from a material and using World#setBlockData does it also get updated correctly to the material etc? (might seem like a dumb question but i never really worked with blockdata so yea)

lost matrix
#

Yes, setBlockData will update the blocks Material

pliant topaz
#

oke, ty :)

sand spire
#

Hey, I want to create multiple profiles so I need to save inventories to a database. Can I just store Inventory#getContents[] asString or should I encode it to base64?

I obviously want no item loss or dupes so I want save the inventory to the database async everytime it updates or every x ticks but at least every minute but rather sooner. But I'm not sure if it is bad for performance or anything else to spam database writes. My server won't have vanilla storage such as chests so I don't have to worry about those for dupes.

Any thoughts?

shadow night
#

From what I've seen, people usually go for base64

sand spire
halcyon hemlock
sand spire
#

xd

halcyon hemlock
#

Made it myself

#

You can query for any amount of components as you want

#

With mutable/immutable references

#

Totally async too

blazing ocean
#

It looks pretty cool

#

How much of the async is just Arc<Mutex> tho

halcyon hemlock
blazing ocean
#

damn

#

how

halcyon hemlock
#

I'm using RwLocks

blazing ocean
#

oh

#

Yeah that works too ig

halcyon hemlock
#

To allow multiple readers

#

Every component is rwlock'd

#

Checkout the repo if u want

blazing ocean
#

what's the repo

halcyon hemlock
#

I think

blazing ocean
#

Oh damn you have actual regions

halcyon hemlock
#

You talking about Mc regions?

blazing ocean
#

MC region files

#

yea

#

And not a diff format

halcyon hemlock
#

Oh, still working on the chunk stuff

#

It'll be saved in embedded db eventually, that's the plan

#

But you can join the server currently, just no chunks are shown

#

The packet system is also clean af

#

But it needs an update to the state system

torn shuttle
#

hey how can I check what class is stored if any in the Material enum? need to check for doors and trapdoors

#

and I'd rather not list them all individually

torn shuttle
#

meh chatgpt had a better idea, just checking if it ends with _door or _trapdoor

#

does the job fine

dry hazel
#

aren't there tags nowadays

torn shuttle
#

the reason I asked is because I'm sure there's a way to do it via api

ivory sleet
#

there should be one for trapdoors as well ^

echo basalt
blazing ocean
#

The 101231239123812th mc server in rust implementation™️

sleek island
#

hello i tried making a customentity but it does not spawn at all (1.20.1)

chrome beacon
#

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

sleek island
#

?paste

undone axleBOT
blazing ocean
#

You need to put it in the pastebin

sleek island
#

oh mb

blazing ocean
#

Are you extending NMS entities?

chrome beacon
#

Does look like it

#

also that code doesn't look entierly safe

sleek island
#

how to make it safer?

halcyon hemlock
#

Feather and valence

blazing ocean
#

Graphite

halcyon hemlock
#

Tf is that

#

Anyways add me as friend frfr

urban escarp
#
 BlockState state = Objects.requireNonNull(e.getClickedBlock()).getState();
        if (!(state instanceof Beacon)) return;
        int tier = ((Beacon) state).getTier();
        p.sendMessage("" + tier);
``` any ideas why I don't get tier level? in older versions used to work
lost matrix
urban escarp
#

in PlayerInteractEvent trying to check if player hits a beacon if its beacon it should print out it's tier level

lost matrix
#

Alright, what is actually happening?

urban escarp
#

I want to know what's beacon tier by hitting it

#

interract event should do the thing

lost matrix
#

Alright, thats again what you expect to happen. Now explain what is actually happening right now?
Any errors in your console? Do you get any message? Do you get the wrong tier?

urban escarp
#

Yeah I get errors on int tier = ((Beacon) state).getTier(); line

#

But the thing is it used to work in older versions

#

1.13.2

pseudo hazel
#

what error

urban escarp
#

one sec

lost matrix
urban escarp
#

yes, but then restarted normaly to make sure

#

right now its restarted normaly

lost matrix
# urban escarp yes, but then restarted normaly to make sure

Alright, try this one:

Block block = event.getClickedBlock();
if(block == null) {
  return;
}
if(block.getState() instanceof Beacon beacon) {
  p.sendMessage("" + beacon.getTier());
}

If this still throws an exception, then there is a serious problem at order

urban escarp
#

It works, thank you 😅

sinful ridge
#

Can sm1 help

pseudo hazel
#

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

sinful ridge
#

Oh ok

brittle geyser
sinful ridge
#

Hello how do i edit the drop spread (if a person dies the loot spreads in all ways i want to make it that it drops below there feet)

pseudo hazel
#

probably the easiest is collect all drops in the event and then spawn them in yourself

sinful ridge
#

Its not like that

#

I have a elytra pvp and if people fight

#

The items spread all around

#

And my communtiy doesnt like either do i

sinful ridge
# brittle geyser what

Hello how do i edit the drop spread (if a person dies the loot spreads in all ways i want to make it that it drops below there feet)

pseudo hazel
#

well thats what I was trying to explain

#

liste for the player death event I think

#

then get all the drops

#

and spawn them in yourself

sinful ridge
#

I dont understand

barren cloud
#

So, when a player dies, the PlayerDeathEvent gets called, you understand?

sinful ridge
sinful ridge
barren cloud
sinful ridge
lost matrix
sinful ridge
pseudo hazel
#

are you a developer?

barren cloud
#

Bro, you are in the SpigotMC Discord, so I assume you know at least a bit about java plugin coding, if not, please first learn the basics for minecraft plugin development, then you can most likely solve the problem you have, yourself

sinful ridge
#

No im not

pseudo hazel
sinful ridge
#

Then im sorry

barren cloud
#

So are you developing a plugin?

#

Alright

sinful ridge
#

Okay thanks

lost matrix
sinful ridge
#

Im sorry i wasted time guys

barren cloud
#

np

pseudo hazel
#

its fine

halcyon hemlock
#

It's ok

#

I forgive you

barren cloud
#

To the other devs here, does anybody know a bit about texturepack vanilla shaders 1.20.1? I'm adding a custom texture for my hotbar, but the y positioning is sometimes 1 px off if i fullscreen or have a weird aspect ratio or have the GUI scale 1 or 2

halcyon hemlock
#

(what's going on)

barren cloud
#

So basically the problem is between pic 1 and pic 2. The Red and blue bars are custom unicode textures from the actionbar, since I can't use the vanilla hearts and hunger bars in my project. So the actionbar, the xp bar and the selected slot icon are all positioned by minecraft, but my custom hotbar is positioned by me via the position_tex.vsh core shader

chrome beacon
#

Try asking in the shaderLABS discord

barren cloud
#

thank you, I'll do that

lost matrix
barren cloud
#

Thanks!

chrome beacon
#

You want to be in the vanilla shaders channel and provide as much information as possible

barren cloud
fathom island
#

any news about the API for can_break and can_place ?

brittle geyser
#

How to decrease jar size?
I am using only one class from this library

implementation("it.unimi.dsi:dsiutils:$dsiutils")

Who knows how to get only necessary classes from libraries?

brittle geyser
brittle geyser
#

thanks

lost matrix
#

*Im assuming you are using the shadow plugin

fathom island
brittle geyser
toxic summit
#

Hi everyone, I am currently updating my plugin from 1.20 to 1.21 and I want to spawn an Armor Stand with a shield which has a banner on it. I use this code which worked in the previous version:

[...]

flagBanner = new ItemStack(Material.SHIELD);
BlockStateMeta flagBannerMeta = (BlockStateMeta) flagBanner.getItemMeta();    
BlockState state = flagBannerMeta.getBlockState();
Banner banner = (Banner) state;
banner.setBaseColor(DyeColor.RED);
flagBannerMeta.setBlockState(banner);
flagBanner.setItemMeta(flagBannerMeta);

[...]

ArmorStand flagStand = (ArmorStand) NMS.spawnNMSArmorStand(loc, true).getBukkitEntity();

[...]

flagStand.setItem(EquipmentSlot.HEAD, flagBanner);

In 1.21 the Armor Stand only has a shield on its head but the banner is missing. It also does not work when using banner.setType(Material.RED_BANNER);

quaint mantle
#

It’s a shame because downstream is not ready for production

fathom island
#

im really sad

#

I develop an item plugin, I have almost implemented the whole spigot API to create very personalized items and I need that to be perfect 😱

quaint mantle
#

Pull request to Spigot

#

If your draft is not “good enough”, they will let you know. Once you apply changes, if everything’s right it should be merged.

eternal night
#

the can_break and can_place api basically is terrible to implement in 1.20.5 and above

#

given that that component can do a lot more

fathom island
#

yeahh

young knoll
#

What can it do now

fathom island
#

okayy i have a "solution" for the can break

eternal night
#

so an API would have to expose that somehow

#

which sounds just horrible

#

and not doing that would be an insta data loss issue sooo, it's ass

fathom island
#

with the configuration of my plugin I define that my item has a default mining speed at 0.0 and I define the blocks I want to break with a speed greater than 0

tool-component:
  enable: true
  damage-per-block: 1
  default-mining-speed: 0.0
  rules:
    materials:
      - materials:
          - TINTED_GLASS
        speed: 8.0
        correct-for-drops: true
young knoll
#

So you can make items that can only break chests that contain a specific item

eternal night
#

Yea

#

Which, that is cool but yea. Terrible for the API

eternal night
brittle geyser
lost matrix
lost matrix
#

And if everything shades regardless, then there is some linking between those classes.

remote swallow
#

reload gradle

quaint mantle
#

Its in tasks for kotlin dsl

lost matrix
#

Yeah, i did an oopsie. Would be

tasks.shadowJar {
  minimize()
}

For kotlin dsl. Which is the same as your previous code.

brittle geyser
#

then, what i should do

#

if nothing happens

#

i dont think that all classes is depends which other

lost matrix
brittle geyser
lost matrix
#

I dont know what to do in that case. Pray to the gradle gods.
Make sure to run clean before compiling.

brittle geyser
#

How to correct minimize my libraries

quaint mantle
brittle geyser
#

what spigot`s library do?

#

to decrease plugin size

quaint mantle
eternal night
#

🙃🙃

young knoll
#

Are we sure that’s happening

river oracle
#

ye

slender elbow
#

99.999% +- floating point precision error

#

so it could be 100% :^)

lost matrix
#

Could be 100.0000003% as well

slender elbow
#

very much so

young knoll
#

What does the extra .00000003% result in

river oracle
young knoll
#

I see

river oracle
lost matrix
#

And he told me that you lie

rapid fulcrum
#

why was my message deleted?

river oracle
rapid fulcrum
#

Im hiring developers

river oracle
#

KEKw

#

?services

undone axleBOT
rapid fulcrum
#

ok

#

i cant post in any of the forums

river oracle
#

not post

rapid fulcrum
#

oh

#

thanks

wet breach
#

but probably better if they look to see who is offering services first lol

young knoll
#

They don’t meet the requirements

wraith delta
#

What is the equivalent to getSpawnedType() for trial spawners? In other words grab the mob type

young knoll
#

TrialSpawner#getNormalConfiguration#getSpawnedType

#

Or the same with getOnimousConfiguration

#

Keep in mind the type of mob it spawns changes often in vanilla

wraith delta
young knoll
#

What interface?

wraith delta
river oracle
#

well yeah

#

BaseSpawner probably shouldn't even exist, but they share some data ig

#

TrialSpawner and regular Spawner are so different them sharing much data at all would be more of a burden

wraith delta
river oracle
#

the methods aren't missing

#

they are just fit to the TrialSpawner data better

young knoll
#

They are in the configuration

#

Of which there are two

#

Normal and ominous

river oracle
#

you have to remember the API of one of those is probably over 10 years old at this point and the other one was added like last month

young knoll
#

It’s basically two entire sets of spawner data attached to one block

river oracle
#

things change

river oracle
#

I'm gald they got added

wraith delta
#

Fair, there are extensive attributes to trials. well, would you mind giving me a example of getting such string of the current mob type. im grabbing it on block mined

#

The GetSpawnedType for trials is under BaseSpawner interface, which doesnt match what you say about the configuration. the api is kind of going back and forth lol

river oracle
#

BaseSpawner is inherited by TrialSpawnerConfiguration not TrialSpawner

#

what Coll said holds

young knoll
#

You’d have to check the block data to see if it’s ominous or not

#

Based on that you can get the correct configuration and then getSpawnedType

wraith delta
#

its not ominous

young knoll
#

Well then just use getNormalConfiguration

river oracle
young knoll
#

Though getting the spawned type isn’t super useful as all naturally generated trial spawners have multiple possible spawns

wet breach
wraith delta
#

and then gives you a gift

wet breach
#

weird

river oracle
#

All mobs spawned by the trial spawner must be defeated before the trial spawner can drop loot. A mob is considered defeated when is either killed or transformed into another entity (excepting the transformation of creepers into charged creepers; the charged creeper must be defeated before completion of the trial spawner).

young knoll
#

Pretty easy addition

river oracle
#

peperun running to steal Coll's PR

young knoll
#

I mean, go ahead if you want

river oracle
#

nah I'm good I got to finish a commission by saturday 😭

young knoll
#

Don’t you usually make epic do them

#

Kek

river oracle
wraith delta
river oracle
#

are you on 1.21

#

is java version set to java 21?

wraith delta
#

Yes

#

Oh wait it needs to be java 21 on the jre too, facepalm!

river oracle
#

JDK

#

not the JRE

wet breach
wraith delta
young knoll
eternal oxide
undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

eternal oxide
#

not using maven?

wraith delta
young knoll
#

Also makes it 100% less portable

wet breach
#

only reason I would like to be able to enable or disable features is so that the server isn't literally doing all kinds of stuff to the point where only a single player realistically can play

young knoll
#

What other features are you concerned about

wet breach
#

not sure, but the more stuff added the more processing it requires or resources

#

can't infinitely keep adding and expect no negative impacts lol

sleek island
#

who knows the equivalent of new PathfinderGoalNearestAttackableTarget<EntityHuman> in 1.20

#

i cannot find the import

blazing robin
#

Hey guys is there any way to change inventory title?

I tried this :

   InventoryView inventoryView = player.getOpenInventory();
        AsyncExecutors.run(() -> inventoryView.setTitle("Hello there"));

but the error said :

java.lang.IllegalArgumentException: Only creatable inventories can have their title changed

how can I changed normal chest inventory title?

wraith delta
# eternal oxide ?bootstrap

The jar maven generated works, even without maven. But its not shaded like such post describes, the shaded. Thank you to both of you, it returns the entity type with getnormalconfiguration

river oracle
sleek island
#

this.targetSelector.addGoal(1, new NearestAttackableTargetGoal(EntityType.PLAYER, this, false));
this errors what can i do

#

?paste

undone axleBOT
blazing robin
river oracle
sleek island
river oracle
#

Also don't run it asyncrhonously

blazing robin
#

open new inventory every single second?

sleek island
#

no

#

like make a new inventory

#

then check for certain items

#

then change that item

#

if u wanna animate glass, lets say

#

just check for glass

river oracle
#

They probably wanna do texture pack fuckery

sleek island
#

tah

river oracle
#

Just use items with different model data

sleek island
#

like wynn

#

^

river oracle
#

Switch the model data every second

blazing robin
#

hmm but I created unicode gif (title change) 'cause I thought it would worked for the lower version but in 1.20.+ seems it changed 😭

sleek island
river oracle
#

I generally shy away from entities

#

so no

#

I mostly do inventory related things

sleek island
#

ah ty though

young knoll
#

Pathfinders should be added in the registerPathfinderGoals method

#

Or whatever it’s called

sleek island
#

sorry to ask but does anyone have the syntax for the

#

NearestAttackableTargetGoa

#

idk if this will work this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<Player>(this, Player.class, false));

young knoll
#

?tas

undone axleBOT
sleek island
#

ty bill wurtz

wraith delta
#

Is there another way to use code to set a single line comment in the order it is placed in code? i know there is setComment() but that requires going based off of the config keys. id like to make several lines of comments

#
config.set()
config.comment
config.comment
```This sort of way
young knoll
#

No

#

Not with the spigot config api anyway

mortal vortex
#

Is there a way to get the "pretty" name of a Material? the name method only returns the direct String like "OAK_PLANKS", is there a function to get "Oak Planks" from it? or do I need to use Regex?

wraith delta
# mortal vortex Is there a way to get the "pretty" name of a Material? the name method only retu...
    public static String capitalizeWord(String str) {
        String words[] = str.split("\\s");
        String capitalizedWord = "";
        for(String w : words) {
            String first = w.substring(0,1);
            String afterFirst = w.substring(1);
            capitalizedWord += first.toUpperCase() + afterFirst + " ";
        }
        return capitalizedWord.trim();
    }
```wrap it in this, and add `.replace("_", " ");` if you want those underscores gone. Full use capitalizeWord(type.toString().replace("_", " ").toLowerCase())
sleek island
#

ServerPlayer moves head, but does not move body.

public static void absMoveTo(double d0, double d1, double d2, float f, float f1, ServerPlayer npc) {
        ClientboundMoveEntityPacket packet = new ClientboundMoveEntityPacket.PosRot(
                npc.getBukkitEntity().getEntityId(),
                (short) (d0 - npc.xo),
                (short) (d1 - npc.yo),
                (short) (d2 - npc.zo),
                (byte) ((int) (f * 256F / 360.0F)),
                (byte) ((int) (f1 * 256F / 360.0F)), true);
         // Send to all players who are allowed to see the NPC
        Bukkit.getOnlinePlayers().forEach(pp -> ((CraftPlayer) pp).getHandle().connection.send(packet));
    }```
#

not in terms of rotation, he does not get translated

#

does anyone know a fix?

blazing robin
#

hey guys I'm trying to set a anvil's maximum repair cost
so I tried this :

((AnvilView) event.getView()).setMaximumRepairCost(maxCost);

but the compile error said :

'org.bukkit.inventory.view.AnvilView' is declared in unstable package 'org.bukkit.inventory.view' marked with @ApiStatus.Experimental 

'setMaximumRepairCost(int)' is declared in unstable package 'org.bukkit.inventory.view' marked with @ApiStatus.Experimental 

how can I change anvil data?

sterile breach
lethal coral
#

what can cause this artifacting on the right side (the lines) and cause it not to fully draw?

#

and also I seem to see slight lines where the item frames meet

rough ibex
#

might be lighting

#

how are you generating the map

sullen marlin
#

yeah the shades of gray look different

lethal coral
#

the lighting is baked into this world, but I don't think that would impact the artifacting on the right side

blazing robin
sullen marlin
blazing robin
thorny salmon
#

hi guys how can i get structure recognition when i move to it? i mean when i enter stronghold it will send message that i am in a stronghold?

worthy yarrow
thorny salmon
worthy yarrow
#

I've never used it before, but I can gpt it kek

#

Location param would probably be player location, structureType is any type of structure you'd like to search for, int is a search radius, true or false whether or not to locate (previously) discovered structures

#

Uh I'd avoid doing this onPlayerMoveEvent, perhaps a task every 10-15 seconds or something? I'd also probably do something that will prevent message spamming if the player was already in the structure as well

sterile breach
#

I am making a replay system. I made an architectruy:

/record player
first we should get the envrionnement (all blocks in a 25 bloc radius) and all entities. Then we wait our player packets and load it as a list and all packets which concerns what surrounds the player. to replay it we just reproducte "inverted" packets.my system is good?

It should be possible with a packet lib like packets events but in certain camera plugin they also use nms? Is there something I forgot to think about?

brittle geyser
#

how to correctly use minimize() shadowJar method?

#

not works

thorny salmon
# worthy yarrow Location param would probably be player location, structureType is any type of s...

i tried in the player move event but it doesn't work, it returns "No" even though i'm in or some distance away from that structure

    @EventHandler
    public void onPlayerMove(PlayerMoveEvent e) {
        Player player = e.getPlayer();
        UUID playerId = player.getUniqueId();
        String playerIdString = playerId.toString();

        if(!databaseManager.getVerify(playerIdString))
        {

        }
        else if (databaseManager.isPlayerSitting(playerIdString)) {
                e.setCancelled(true);
        }
        Location location = player.getLocation();
        StructureType structureType = StructureType.STRONGHOLD;
        StructureSearchResult result = location.getWorld().locateNearestStructure(location,structureType,35, false);
        if(result != null)
        {
            player.sendMessage("no");
        }
        else {
            player.sendMessage("yes");
        }
    }```
worthy yarrow
#

Yes that is correct

#

Check your conditional

thorny salmon
worthy yarrow
#

if(result != null) {
sendMessage("no)

#

else{ gets printed

#

wait

#

I'm cooked

#

It just wont print

thorny salmon
#

i stand away from the structure but it still returns "No". Instead of standing inside the structure. That's what i meant @@

worthy yarrow
#

Buddy

#

!= null

#

Does

#

not

#

equal

#

null

#

Literally swap your print statements

limpid furnace
#

Hello, I need help compiling my plugin. As it supports 1.18-1.21, I'd like to compile it using Java 17. However, I also use NMS (paperweight plugin) and the 1.21 module is build using Java 21.
v1_21_R1 build.gradle.kts:

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

dependencies {
    // NMS and other dependencies
}

plugin build.gradle.kts:

plugins {
    id("com.github.johnrengelman.shadow") version("8.1.1")
}

dependencies {
    implementation(project(":nms:v1_21_R1"))
    // More NMS versions and other dependencies...
}

tasks {
    shadowJar {
        minimize()
        // Shade adventure to support Spigot
        relocate("net.kyori", "net.kyori")
        archiveFileName.set("${project.parent?.name}-${project.version}.jar")
    }
}

I am migrating from maven to Gradle, and the maven toolchain plugin worked. How can I compile the v1_21_R1 module with Java 21 and the plugin module with Java 17?

I tried adding this in the root build.gradle.kts

// Tried "subprojects" too
allprojects {
    apply(plugin = "java")

    java {
        disableAutoTargetJvm()
        toolchain {
            languageVersion.set(JavaLanguageVersion.of(17))
        }
    }
}

I tried setting that java block in the plugin build.gradle.kts block too, I've tried all combinations of setting disableAutoTargetJvm() in only specific modules or everywhere and I keep getting the Unsupported class file major version 65 error no matter what I do

blazing ocean
limpid furnace
#

I use Spigot's API but shade adventure API

#

And paper, spigot, whatever, the issue is the same

brittle geyser
#

i am using nms 1.20.4 version and compiling with java 8, idk why you have troubles with java

limpid furnace
chrome beacon
#

You can then tell it to target an older Java version with the release or target/source settings

brittle geyser
#

how to correctly use minimize() shadowJar method?

#

Or can i optimize plugin using libraries?

    implementation("org.bstats:bstats-bukkit:$bstats")
    implementation("com.zaxxer:HikariCP:$hikaricp")
    implementation("org.jooq:jooq:$jooq")
    implementation("org.apache.commons:commons-math3:$apachemath3")
    implementation("it.unimi.dsi:dsiutils:$dsiutils")
remote swallow
#

basically all of that is on maven central so if your 1.17+ you can use the libraries feature

chrome beacon
#

^^

fluid birch
#

Why am I getting this error? This code worked in 1.20

remote swallow
#

if its an air ingredient dont add it, also whats the point of matchMaterial if you dont use the output

fluid birch
#

Thanks btw, the error went away :)

karmic falcon
#

hi, im adding custom commands with aliases, let us say my custom command is /hi, the aliases are appearing like /hi:alias not /hi alias

rough hinge
#

can I use getContents() (use the method to read) on async context? private List<ItemStack> contents;

#

async context

eternal night
#

depends on the impl of Backpack?

slender elbow
#

honestly

#

if you have to ask

#

then the answer is no

#

lynx

rough hinge
slender elbow
#

ggwp

eternal night
#

ggwp emily

eternal night
#

the impl

#

but yea, emily is probably right

rough hinge
#

why do you want

eternal night
#

What is "Backpack"

rough hinge
#

why you need this info

#

to awsner

eternal night
#

things are generally not safe to call from different threads

#

so unless the Backpack implementation has logic to make it safe

#

it won't be

rough hinge
rough hinge
eternal night
#

Well, that would generally be safe

#

unless you also have a thread that writes to the contents list

#

so getContents().add or something

eternal night
#

if you stick to setContents for mutation, you'd be fine because you'd be setting it to a new list

rough hinge
#

i uypdate contents on inventoryclose (sync context)

#

and playerjoin

eternal night
#

via just backpack.setContents(Arrays.asList(something.getContents())) ?

#

or something along those lines

rough hinge
#

List<ItemStack> contents = new ArrayList<>();

        for (int i = 0; i < backpack.getSpace(); i++) {
            contents.add(inventory.getItem(i));
        }

        backpack.setContents(contents);
#

and setcontents(null)

eternal night
#

Yea

#

then you should generally be fine

rough hinge
#

So can I use backpack#getcontents asynchronously?

eternal night
#

the issue happens with you read and write the same list instance on multiple threads

#

Yea if you adhere to the above restriction ^

#

now, you may still have the problem that the list obviously changed

rough hinge
#

I don't understand why my server is crashing then

eternal night
#

post the stacktrace 😅

rough hinge
#

latest.log?

eternal night
#

?paste

undone axleBOT
eternal night
#

yea

rough hinge
eternal night
#

PandaSpigot omegaroll

rough hinge
rough hinge
blazing ocean
#

it's the gongas guy

#

that kid who got banned on 3 accounts

#

making another fourth one ain't smart buddy

rough hinge
#

what

#

look at the date on my account

#

what are you talking about wtf

blazing ocean
#

twinsmc
pandaspigot
1.8
mhm what a coincidence that three accounts came here with these exact same things

eternal night
#

your issue isn't the insetOrUpdate method

rough hinge
eternal night
#

you literally posted a screenshot of your server hanging on BackpackService#get

#

but w/e, I cannot be bothered to read 1.8 stacktraces omegaroll

dapper flower
#

How do i check what my plugin is doing most of the time? Like if ik that method X is ran a lot i try to optimize it

blazing ocean
#

spark

rough hinge
eternal night
blazing ocean
rough hinge
dapper flower
eternal night
rough hinge
#

I'm not even going to waste my time answering you. I created an account in 1999 and went back to the future!

eternal night
#

no I am just saying, the screenshot you posted literally showed your issue is something else

#

aight reeeachyz_

rough hinge
eternal night
#

you are doing IO on inventory close event

#

which hangs the server

blazing ocean
#

@ivory sleet hey buddy

rough hinge
#

what is IO?

dapper flower
#

Input Output of files generally

pseudo hazel
#

writing to files and stuff

eternal night
#

or in this case, network

rough hinge
eternal night
#

you are doing a database request on the servers main thread

pseudo hazel
#

in any case writing to places that dont instantly give feedback

rough hinge
eternal night
#

what

rough hinge
#

my api takes care of the threads, it's not me

eternal night
#

I don't think you understand how that works

blazing ocean
#

well it doesn't look like it kek

eternal night
#

show the code of BackpackListener#onInventoryClose

rough hinge
#

ok

eternal night
#

plugin.getBackpackService().get(player.getName());

#

how is that get implemented

#

and respectively, how is BackpackRepository#findOne implemented

rough hinge
slender elbow
#

i mean it shows you are calling CompletableFuture#join on the main thread which is very monkaW

eternal night
#

Yea so, the backpack isn't in the cache

#

it then does a blocking database request

#

and dies

#

there ya go

dapper flower
#

Why not just cache it lmao

blazing ocean
#

imagine

rough hinge
eternal night
#

Well idk how slow your db is

dapper flower
#

Load the data from db to cache and when the server turns off the plugin save the data

eternal night
#

but that is what your server is dying on

rough hinge
eternal night
#

but also you store the backpack under the backpacks name and lookup based on the players name?

#

"the api is supposed to be in another thread"

#

what

#

yea Database#execute does its work in a separate thread

#

findOne then joins the CF

#

which means you'll hang the thread you call that on until the one that does the IO is finished

rough hinge
#

oh completable future ok

#

yes, I understand, but it shouldn't crash the server because it's not the server thread~

eternal night
#

i s2g

slender elbow
#

you are blocking on that request, waiting for it to finish on the main thread

#

and it's taking way too long to complete

#

therefore, the watchdog trips

ancient plank
#

SilvervaleThinkings ~

rough hinge
#

but why is the request on the main thread? That's what I don't understand

eternal night
#

it isn't

#

the request happens on a separate thread

#

but you make the main thread wait on that thread to finish the reuqest via CompletableFuture#join

rough hinge
#

and how do I solve this? decrease t imed out?

young knoll
#

Don’t join the completable future

#

Use the chaining methods like thenAccept

rough hinge
#

And can you tell me a good timed out value? I think it's currently 30 seconds, but I think it's too high because it's on the same server

young knoll
#

But you should cache the backpack data

slender elbow
#

i love decompiled code

rough hinge
#

I must then keep all created backpacks in cache and only update the database when there is an updated item in the cache

young knoll
#

You assume it's decompiled

#

Thats how I name my variables

rough hinge
#

bro, this is the api

slender elbow
#

?

#

it literally says it's decompiled lol

rough hinge
rough hinge
hazy parrot
#

What

rough hinge
#

@Override
public Backpack findOne(String name) {
return database
.execute("SELECT * FROM backpack WHERE name = ?")
.readOneWithAdapter(statement -> statement.set(1, name), adapter)
.join();
}

If there is nothing in the db, will the join stop the thread for the seconds configured in the mysql config? or does it simply return empty and will return null?

brittle geyser
#

i have this nms method, and it works 50/50. I mean in some coordinates its just not showing blocks (blocks are filled totally)

public void setBlockInNativeChunk(World world, int x, int y, int z, int blockId, boolean applyPhysics) {
        if (nmsWorld == null || this.world != world) {
            this.world = world;
            this.nmsWorld = ((CraftWorld) world).getHandle();
        }
        int chunkX = x >> 4;
        int chunkZ = z >> 4;
        if (this.x != chunkX || this.z != chunkZ) {
            this.x = chunkX;
            this.z = chunkZ;
            this.nmsChunk = nmsWorld.getChunk(chunkX, chunkZ);
        }
        LevelChunkSection[] sections = nmsChunk.getSections();
        int y4 = y >> 4;
        LevelChunkSection section = sections[y4];
        BlockState existing;
        if (section == null) {
            existing = Blocks.AIR.defaultBlockState();
        } else {
            existing = section.getBlockState(x & 15, y & 15, z & 15);
        }
        BlockPos blockPos = new BlockPos(x, y, z);
        nmsChunk.removeBlockEntity(blockPos);
        if (section == null) {
            sections[y4] = sections[y4 << 4];
        }
        nmsChunk.setBlockState(blockPos, Blocks.STONE.defaultBlockState(), false);
        this.nmsWorld.getMinecraftWorld().notifyAndUpdatePhysics(blockPos,nmsChunk, existing, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), chunkX, chunkZ);
    }
#

every 2 chunks blocks are shown and 2 chunks not shown (but blocks exist)

rough hinge
#

If it returns empty, it doesn't crash....

#

It's not join's fault, it's something else's fault

#

It's bukkit's fault

eternal night
#

Facts

blazing ocean
#

smh bukkit

rough hinge
blazing ocean
#

no

brittle geyser
#

How to do everything in my plugin async?

blazing ocean
#

step 1: remove spigot from your dependencies

#

step 2: make a fabric mod

sinful ridge
#

command /offhand:
trigger:
if player's tool is not air:
set {_item} to player's tool
set player's offhand to {_item}
send " " to player
else:
send " " to player
Guys it doesnt work can someone help

brittle geyser
#

what is it man

sinful ridge
#

Its an offhand command

#

I tried it

brittle geyser
#

i see it, but it is code in yml file?

sinful ridge
#

But i think i did smth wrong

#

What

blazing ocean
#

this looks like skript

brittle geyser
#

yes

sinful ridge
#

It is

blazing ocean
#

we do not support skript here

#

go to their discord or something

sinful ridge
#

How?

#

I did it my seld

#

Self

blazing ocean
#

wha

sinful ridge
#

It says help-development

#

Isnt that a development

brittle geyser
#

this chat for developers

#

spigot programming chat

pseudo hazel
#

its not really development

sinful ridge
#

Ok

pseudo hazel
#

its a glorified scripting language even worse than kotlin

#

most people in here know about java development for plugins

sinful ridge
#

Jo

pseudo hazel
#

if you want support on skript syntax or bugs you would have to ask in a server that supports it

brittle geyser
#

why bukkit methods slower than nms?

pseudo hazel
#

well, shockingly, bukkit has to call the nms so it has extra overhead probably

brittle geyser
#

bukkit methods sucks

slender elbow
#

true

blazing ocean
#

just switch to fabric at that point

blazing ocean
pseudo hazel
#

yeah

#

did I say it was bad?

#

you just heard what you wanted to hear

inner mulch
#

is there a distinction made from pressing buttons for the hotbar and scrolling through it?

pseudo hazel
#

not that I know

brittle geyser
blazing ocean
pseudo hazel
#

well yeah that was the point of the joke I guess

blazing ocean
pseudo hazel
#

but its still a valid opinion

brittle geyser
#

used kotlin 10 minute

#

kotlin "null safety" is @Nonnull (Lombok) in java

blazing ocean
#

...that's the point

pseudo hazel
#

sorry but 10 minutes aint enough to do anything

blazing ocean
#

even if you read through the docs for 10 minutes you'll know it has more features than java lol

brittle geyser
#

java has all the kotlin features

pseudo hazel
#

yeah it should have more features compared to java because its built on java

blazing ocean
#

..no?

blazing ocean
brittle geyser
#

use lombok builders

pseudo hazel
#

wtf is lombok

blazing ocean
#

compiler fuckery

pseudo hazel
#

the fact that lombok isnt in the standard language feature set says enough

#

if it was really that good it would be in standard java

brittle geyser
#

lombok is java library

pseudo hazel
#

right

blazing ocean
pseudo hazel
#

you kinda proved kotlin is better by saying you need a library to get java closer to kotlin

blazing ocean
#

?

#

that's the languages website

eternal oxide
#

"better"

brittle geyser
#

What's stopping you from using java libraries?

blazing ocean
#

the fact that I don't need them :p

brittle geyser
#

because you use kotlin ☠️

tardy delta
#

Yes

blazing ocean
tardy delta
#

How dare you summon me

blazing ocean
#

hi 14b

tardy delta
#

Hi

foggy cave
#

Hey, can someone here recommend a command framework for 1.21

blazing ocean
#

1.22

brittle geyser
blazing ocean
#

acf or cloud

blazing ocean
#

commandapi is good too

brittle geyser
foggy cave
#

I think what he means is that this kotlin code:


class Foo {
    var name: String? = null
}

Will produce:

private String name;
public final String getName() { ... }
public final void setName(String name) { ... }

In Java

blazing ocean
#

forgot the class definition there buty ea

foggy cave
#

Oh yea

foggy cave
blazing ocean
#

ACF

foggy cave
#

ACF looks nice thank u very much

#

Exactly what I was looking for

brittle geyser
#
@Getter
@Setter
private String name
blazing ocean
#

also @ivory sleet have you banned the gongas kid again? :D

foggy cave
blazing ocean
#

interfaces, inventoryframework

foggy cave
#

Like simple ones, not heavily bloated ones

#

Thanks

eternal oxide
#

?gui

ivory sleet
paper falcon
#

Is it weird I'm that org.bukkit.ChatColor isn't importing at all?

blazing ocean
#

update intellij and use java 21

paper falcon
blazing ocean
#

What IJ version are you on?

#

You just won't be able to use 95% of bukkit classes

#

So update to a 2024 one

paper falcon
paper falcon
#

thanks

torn shuttle
#

god I love early day classes

blazing ocean
#

what

turbid flame
#

Is there any event called before player change worlds so i can cancel it if needed? PortalEvent is not suitable

blazing ocean
#

PlayerChangedWorldEvent

eternal oxide
#

why is it not suitable?

blazing ocean
turbid flame
turbid flame
#

PlayerTeleportEvent??

royal heath
#

Why are you trying to cancel change world?

#

Just asking because there could probably be a different approach

slender elbow
#

Because i am teleporting player to worlds that are not accessed via portal

#

teleport event would work

royal heath
#

I'm not sure what he meant by that. I'm confused how you would cancel changing worlds without cancelling the teleport. You could just use teleport event and check the destination world

earnest girder
#

I am making a system where players process an ingredient into a product, and takes 10 seconds per item they process. I want them to start the process with a GUI button or whatever, and then they can sit and wait while it slowly processes their entire stack of items one at a time. I tried doing this with multithreading and it created some really weird lag and bugs.

Here is the code I used:

@EventHandler
    public static void lab(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked();

        int amount = Math.min(LabManager.getIngredientAmount(player, Material.KELP), 64);

        for(int i = 1; i <= amount; i++) {
       System.out.println(player.getLocation().distance(LabManager.getLocation())); //NEVER CHANGES, EVEN WHEN MOVING???

            if(player.getLocation().distance(LabManager.getLocation()) > 6) {
                player.sendMessage("You moved too far away");
                break;
            }

            ItemStack ingredient = findIngredient(player, Material.KELP);

            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            ingredient.setAmount(ingredient.getAmount() - 1);
            addItemAndDropExcess(player, ItemManager.getKelpProduct());

            player.sendMessage("Processed 1 Kelp (" + i + "/" + amount + ")");
        }

        player.sendMessage("Done Processing");

The distance from the player to the lab never updates, even when I move further away. It gets stuck at the player's position when the loop starts. If the player moves far away, the loop continues, but then they get teleported back after it completes. ALSO, the item stack of ingredients stays full and everything gets removed at the end, rather than one at a time as the loop goes.

What am I doing wrong??

chrome beacon
#

💀

#

You're telling to server to freeze for 10 seconds

earnest girder
#

the whole server?

chrome beacon
#

yes

sullen canyon
#

why do people hate lombok

earnest girder
#

oh wait

#

I forgot I removed the Bukkit runnable

#

no theres multithreading in there

chrome beacon
#

Don't use thread sleep

#

You have no reason to do so

#

Just schedule your task in 10 seconds

royal heath
#

No, you need to make a new thread if you're sleeping else it will sleep the main server thread, regardless just use runlater

earnest girder
#

the whole for loop was inclosed in this:

new BukkitRunnable() {
            @Override
            public void run() {

}.run();
chrome beacon
#

That will run it next tick

royal heath
#

Bukkit.getScheduler().runTaskLater()

ivory sleet
earnest girder
#

it was there in the actual code

royal heath
#

Right, still use runLater

earnest girder
#

so if theres a whole stack of items and one should be processed every 10 seconds until it is done, how do I schedule each one?

ivory sleet
chrome beacon
#

for i loop

royal heath
#

You could use recursion until a condition is met and keep running the runnable, but there could be better ways

earnest girder
chrome beacon
#

yes

earnest girder
#

got it thanks

#

one problem with this is that i cant break out of the loop to cancel processing halfway through when something happens like the player leaves the area

#

how do I cancel the current and all future tasks if I need to?

royal heath
#

You could use a hashmap / list of players that are currently processing, then if they move in the move event break out of the loop

earnest girder
#

but if they start processing again and there are still scheduled tasks from their previous interaction, it will continue

royal heath
#

then in the loop check if its still in the processing list, or create a new object that has isProcessing and set it to true or false, and query on that in the loop