#help-development

1 messages · Page 2199 of 1

river oracle
#

If you can't find a result on that your Googleing wrong be more vague and general and apply the general idea more specifically

quaint mantle
#

im not too sure what exactly i should be googling, whats the exact terms used yk

river oracle
#

How to use variable in another class

#

Java

quaint mantle
#

java.lang.NullPointerException: Cannot invoke "thunderlearn.thunderlearn.databasesql.mySQL.disconnect()" because "this.SQL" is null

#

wtf

#

when i make calls to the database and create new entrys, its all fine but i get this as soon as i start my plugin

river oracle
#

Likely calling a constructor incorrectly

#

Bro with the amount of simple preventable errors you are having I can't reccomend enough doing something simple without a db

#

Narrow it down to just a pure Java project if possible

#

The best way to learn is a project but imo your in way to deep for your own good

arctic moth
#

how would i stop particles from spawnParticle flying everywhere

#

ik i have to turn down the speed

#

but how

#

theres no speed parameter

#

in any of the functions

quaint mantle
#

yeah sure im in over my head here but i cant physically sit down and learn a language by forcing myself, unless i have a reason to do it, i cant lol

#

and it was a simple fix

#

thankfully

arctic moth
#

oh its just extra

#

they couldnt lable it as speed?

river oracle
quaint mantle
#

im past the east stuff i wanted to do, there isnt anything left thats simple but something i want to do tbh

dreamy arrow
#

java -jar BuildTools.jar lastest --compile craftbukkit
Is this a valid param for buildtools

shadow gazelle
dreamy arrow
#

well i did how else do u think i got the command. they told me to add --compile craftbukkit but where in command idk

shadow gazelle
#

I mean, where else would you put it?

dreamy arrow
#
*You can find CraftBukkit (to but not including version 1.14) and Spigot in the same directory you ran the the BuildTools.jar in (craftbukkit-1.14.jar and spigot-1.14.jar). You can find Spigot-API in \Spigot\Spigot-API\target\ (spigot-api-1.14-R0.1-SNAPSHOT.jar). To compile CraftBukkit for 1.14 and beyond, you must add the --compile craftbukkit argument to the command.```
#

that's wat it says

#

will it work if i put --compile craftbukkit in the end of the whole param

shadow gazelle
#

Yes...

#

You should learn how running a jar from a command line works

dreamy arrow
#

:v i only used that thing only when building buildtools hehe. maybe i will learn it later

quartz epoch
#

imagine compiling craftbukkit

humble tulip
#

tfw u write a whole class to get it working then to realize its inefficient af so u gotta rewrite it

winged anvil
#

nevermind

#

apparently Bukkit#craftItem was setting the array to null

#

but since java is always pass by value that shouldnt have effect the itemstacks in my array right?

summer scroll
#

How can I create a system that hides players' nametag but only visually to certain players? I want to hide the nametag If the player e.g: behind a block, sneaking, etc.

frail sluice
#

how do I make my custom recipe unlock when a player obtains an item, (iron ingot in this case)?
this is how I register my recipe: ```java
Bukkit.getServer().addRecipe(new ShapedRecipe(key, result)
.shape(
"I I",
"IWI",
" R ")
.setIngredient('I', Material.IRON_INGOT)
.setIngredient('W', Material.WATER_BUCKET)
.setIngredient('R', Material.REDSTONE)
);

frail sluice
#

I don't see anything mentioning recipe book

winged anvil
#

oh shi my bad

frail sluice
#

I did find Player#unlockRecipe(NamespacedKey key), and it does unlock it, (I checked with the /recipe command), but it doesn't show up in the recipe book

quaint mantle
#

how do i make this buildtools.jar (1.19) be a server jar

frail sluice
#

run it? the guide explains how to use it very well

quaint mantle
#

erm

#

i tried

#

nvm

humble tulip
#

is there way to see when something was removed and something else added?

#

in javadocs

#

like changes per version

ornate patio
#

is it possible to "exclude" a certain event from firing? I'm trying to make it so that when a horse is spawned in, the plugin will save it to an array.

@EventHandler
public void onHorseSpawn(EntitySpawnEvent event) {
    if (event.isCancelled()) {
        return;
    }

    if (event.getEntityType() == EntityType.HORSE) {
        Horse horse = (Horse) event.getEntity();
        
        Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> {
            if (horse.isValid()) {
                superiorHorses.add(new SuperiorHorse(horse));
            }
        }, 1);
    }
}

(new SuperiorHorse(horse) kills the old horse and spawns in a new one)
How problem I'm having is that this turns into an infinite loop- superiorHorses.add(new SuperiorHorse(horse)); kills the old horse and spawns in a new one, which fires the event again and again

humble tulip
#

oh lol

#

just add the horse to a set

#

if its in the set, dont spawn another one

#

or even better

#

since everything is on one thread, have a boolean variable in the class

#

called spawning

#

set it to true before u spawn the new superiorhorse and set it false afterwards

#

if entityspawnevent is called when u spawn the horse, check if the boolean is true, if it is, you know you're spawning a custom horse so u can ignore

ornate patio
#

ahh smart

#

lemme try that

humble tulip
#

or u ca just check if ur set contains the event being spawned

#

if it does, cancel

ornate patio
#
@EventHandler
public void onHorseSpawn(EntitySpawnEvent event) {
    if (event.isCancelled()) {
        return;
    }

    if (event.getEntityType() == EntityType.HORSE) {
        Horse horse = (Horse) event.getEntity();
        if (getCachedHorse(horse) != null) {
            return;
        }

        Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> {
            if (horse.isValid()) {
                superiorHorses.add(new SuperiorHorse(horse));
            }
        }, 1);
    }
}
humble tulip
#

why u doing it one tick later?

ornate patio
#

getCachedHorse(horse) just returns the SuperiorHorse thats already in the cache

ornate patio
# humble tulip why u doing it one tick later?

SuperiorHorse is a wrapper for a custom horse using NMS. I need the original horse to actually spawn in first so that I can copy the color, style, custom stats, etc. from the original horse to the new NMS hose

ornate patio
#

1.18.1

humble tulip
#

wait ur unable to get it when the horse is spawned?

ornate patio
#

get what

humble tulip
#

the color style whatever

#

in the event

ornate patio
#

well i am

#

but I'm not able to get the coordinates

#

to teleport the new horse to

humble tulip
#

event.getLocation??

ornate patio
#

oh well yeah that would work

#

but it'll kinda make my code very unclean

#

I've already completely isolated SuperiorHorse so that it only needs a single entity to construct

humble tulip
#
@EventHandler(ignoreCancelled = true)
    private void onHorseSpawn(CreatureSpawnEvent event) {
        if (!(event.getEntity() instanceof Horse) || isSpawningCustomHorse)
            return;

        Horse horse = ((Horse) event.getEntity());
        Location spawnLoc = event.getLocation();
        isSpawningCustomHorse = true;
        //spawn hose
        isSpawningCustomHorse = false;
    }
#

a scheduler makes that look very messy

#

cancel the event and spawn ur horse in the //

ornate patio
#

whats the difference between CreatureSpawnEvent and EntitySpawnEvent

humble tulip
#

an item is an entity

#

but not a livingentity

#

so item is entityspawnevent only

#

horse is creaturespawnevent and entityspawnevent

ornate patio
#

oh ok

humble tulip
#

it'll be better to listen to creaturespawn but tbh there's virtually no real difference

ornate patio
#

i guess its slightly more efficient

ornate patio
#

but theres some weird thing going on, i dont know if it will cause issues

ornate patio
#

when i spawn in a horse using a spawn egg, its color and style randomizes after like a millisecond after spawning in

#

like I can see it flash to a different type of horse

humble tulip
#

did that happen before?

ornate patio
#

no

#

althought i think its fine, i tried reloading the plugin and none of the horses changed

#

and they are all in the cache correctly

humble tulip
#

what are u making btw

#

very horse specific

quaint mantle
#

horse social stratification

ornate patio
#

well

#

its like

humble tulip
#

👁️ 👁️

ornate patio
#

RPG-style horses you could say

#

each horse has a stats like hunger, friendliness, trust, etc

#

and you do certain actions to them to bring stats up and down

humble tulip
#

nice

quaint mantle
#

interesting

ornate patio
#

and they affect how you interact with them

torn shuttle
#

wait, what's this about native support for bedrock to java clients now?

#

I hadn't heard about it

torn shuttle
#

it was on my launcher as news just now

humble tulip
#

where'd you see that?

torn shuttle
#

try launching mc

humble tulip
#

oh wow

humble tulip
#

the scheduled task runs after the event but before the next tick

ornate patio
#

ooh really

#

thanks

ornate patio
#

its just that the error was so hard to read i guess because i was being spammed with an exponentially growing amount of errors every second lmao

humble tulip
#

lmao

#

@ornate patio can u help me out with setting up nms

#

i messed it up somehow and now idk how to get it working again

#

should i just try to rerunbuildtools?

ornate patio
humble tulip
#

rebuilding with bt first

humble tulip
#

getting this error with BT

ornate patio
#

uhh

#

honestly i have no idea

#

i can send you my pom.xml if you'd like

#

or wait here

#

i actually found the link

eternal mountain
#

I have a small question, why is it that we need to implement the Listener interface when working with events? As far as I can see, the Listener interface is just empty right?

ivory sleet
#

Yes

#

It is what’s called a marker interface

eternal mountain
#

Ah, I will take a look into that, I'm still relatively new to Java, I am coming from C / C++.

ivory sleet
#

Ah I see, although Cpp has interfaces or well virtual functions

next fossil
#

I keep getting this error: incompatible types: net.md_5.bungee.api.chat.TranslatableComponent cannot be converted to net.minecraft.network.chat.Component

#

Apparently TranslatableComponents don't work anymore?

#

Need help

ivory sleet
#

Anyway the point of it is to mark that any class that implements it will most likely just have a bunch of methods annotated with @EventHandler and that you can expect something like that, we have in the jdk Serializable and RandomAccess as marker interfaces if that maybe helps enhancing the concept a bit better

quaint mantle
#

https://paste.md-5.net/ehipagaguj.cs

java.lang.ClassCastException: class org.bukkit.inventory.ItemStack cannot be cast to class org.bukkit.inventory.RecipeChoice (org.bukkit.inventory.ItemStack and org.bukkit.inventory.RecipeChoice are in unnamed module of loader java.net.URLClassLoader @5fa7e7ff)

i honestlt have no idea how to fix this here

eternal mountain
ivory sleet
#

Ah, just C and not ObjC?

next fossil
#
entity.setCustomName(new TranslatableComponent("test"));```
Doesn't work, throw this error:

incompatible types: net.md_5.bungee.api.chat.TranslatableComponent cannot be converted to net.minecraft.network.chat.Component

ivory sleet
#

@next fossil check your imports

next fossil
#

I did its all correct

#

Its the new 1.19 Chat Component issue

#

1.18 and before works fine

ivory sleet
#

No like

#

The TranslatableComponent is of md chat api whilst the Component is Minecraft’s component

eternal mountain
ivory sleet
#

pretty sure either wanna use just the components from Minecraft or md5 chat, not both mixed up

eternal mountain
winged anvil
#

yo maybe i’m dumb asf but why is it say i have a map in class A and then class B and C both take in instances of class A through injection. then i use classes B and C to modify class A. how is it that i can use class A to modify in those classes if java is pass by value

harsh totem
#

Is there a way to add my custom crafting recipe to the knowledge book?

ivory sleet
quaint mantle
winged anvil
#

cause to me pass by value is literally that it’s just a value not like ok we have instance to class A now we can use that to modify class A data. Wouldn’t that be reference ?

ivory sleet
#

setIngredient('C', new ShapedRecipe.ExactChoice(itemStack)); @quaint mantle

eternal mountain
winged anvil
#

bruh

eternal mountain
#

You pass the reference by value

ivory sleet
#

Pass by value means something else Zlaio

#

A variable always passes the value of itself when passes through a function/constructor

ivory sleet
#

What version?

quaint mantle
#

1.18.2

quaint mantle
#

havent updated yet

ivory sleet
#

iirc KnowledgeBookMeta

quaint mantle
ivory sleet
#

There’s

#

What error are you getting btw? (The red text)

quaint mantle
#

red text?

#

i can send my full error

quaint mantle
ivory sleet
quaint mantle
#

oh

#

Cannot resolve symbol 'ExactChoice'

ivory sleet
#

Uh that’s odd

harsh totem
# ivory sleet yes

in knowledgeBookMeta.addRecipe(); what should the key be? I dont understand

ivory sleet
#

Thunderin where did you put it in your code?

quaint mantle
#

do you mean the class?

humble tulip
#

1.18.1

#

it's there

ivory sleet
quaint mantle
#

yes RecipeChoice does have it

humble tulip
#

it's not ShapedRecipe.ExactChoice

quaint mantle
#

but wouldnt that still give me the same error?

humble tulip
#

no

#

can u paste ur code?

quaint mantle
harsh totem
quaint mantle
#

NameSpaced key? just a guess

humble tulip
#

dont cast

ivory sleet
#

Etc

humble tulip
quaint mantle
#

yeah figured

humble tulip
#

I see you keep making the mistake of casting stuff

#

U gotta try to figure how to get a recipechoice

quaint mantle
#

casting is genuinely not a concept i understand

humble tulip
#

so u can do new RecipeChoice.ExactChoice(itemstack)

#

?polymorphism

#

ah

#

please actaully read this

#

actually start here

#

and click next

#

It wont take more than 5 mins to read

ivory sleet
#

I found this video mildly elaborative https://youtu.be/HpuH7n9VOYk

Learn about Upcasting and Downcasting in Java! Full tutorial with concrete examples.

In Java, upcasting and downcasting are used along with method overriding to do some really cool things. But what exactly is upcasting, what is downcasting, and how do you use them in your Java programs?
When can you upcast, and when can you downcast? What do yo...

▶ Play video
#

Which explains it rather good

humble tulip
#

is upcasting ever useful?

ivory sleet
#

Method overloading

quaint mantle
#

ill watch the vid first

ivory sleet
#

Awesome :3

hybrid spoke
humble tulip
#

actually i upcasted String[] to Object when i was trying to use reflection yday lol

quaint mantle
#

just for my sake, is Player player = (Player) sender; casting?

ivory sleet
#

Yep

quaint mantle
#

okay i think i understand casting a little better

harsh totem
#

im trying to do this public static ShapedRecipe Heart = new ShapedRecipe(new NamespacedKey(this, "Heart"),HeartEssence.heart);
and it says com.ytg667.main.Recipe.this' cannot be referenced from a static context
I tried everything and I couldn't get it to work

#

It says that I need to input the plugin where I put 'this' but it also says that I can't use in static context

#

idk what to do

#

how do I make the nameSpacedKey?

glass mauve
hybrid spoke
#

the namespacedkey is fine, you just cant instantiate ShapedRecipe in a static context since that will be loaded before CB even load

glass mauve
#

and this is a keyword in Java that references the current instance of the class.

earnest forum
#

u can only use that in a non static context

harsh totem
#

If it isnt static I cant use this function

        Heart.shape("NDN",
                "HTH",
                "EDE");
        Heart.setIngredient('N', Material.NETHERITE_BLOCK);
        Heart.setIngredient('T', Material.TOTEM_OF_UNDYING);
        Heart.setIngredient('D', Material.DIAMOND_BLOCK);
        Heart.setIngredient('H', Material.HEART_OF_THE_SEA);
        Heart.setIngredient('E', Material.EMERALD_BLOCK);
        Bukkit.getServer().addRecipe(Heart);
    }```
hybrid spoke
#

oh wait a sec, i didnt looked right

harsh totem
#

its like a loop either way I cant do it

hybrid spoke
#

yeah you cant use this in a static context since there is no this

harsh totem
hybrid spoke
#

init methods exist

#

just make one

#

init there your recipes

harsh totem
#

what is init

hybrid spoke
#

and call it after you set your instance

earnest forum
#

initialize

#

just make a method called setupRecipes or something

harsh totem
#

so I have this public void SetRecipe(JavaPlugin plugin){ this.Heart = new ShapedRecipe(new NamespacedKey(plugin, "Heart"),HeartEssence.heart); }
And I cant use it in main if it isnt static but I cant make it static

humble tulip
#

Huh?

#

?paste

undone axleBOT
humble tulip
#

Paste ur class

#

You're abusing static to easily access stuff

earnest forum
#

if its a constant value i dont see why it cant be static

humble tulip
#

Yeah but in this case, static is being used for access throughout the project instead of it being used for a class having a single instance of something

harsh totem
humble tulip
#

Does it work?

harsh totem
#

The recipe works

#

but I don't have the knowledge

#

@humble tulip nvm

#

It didn't show up but it's there

humble tulip
#

Don't u have to add the item to the player inv

humble tulip
#

Well what does creating the itemstack do?

#

I'm not familiar with recipe book

harsh totem
humble tulip
#

I mean

#

In playerjoinevent u create a recipebook itemstack

#

And do nothing with it

#

Don't you have to give that to the player?

harsh totem
#

oh wait

#

you're right the recipe isn't given if the player doesn't have this item

#

what should I do?

humble tulip
#

Look att his

#

Think it's what ur looking for

harsh totem
#

I just put this in the event and nothing happened event.getPlayer().discoverRecipe(new NamespacedKey(plugin, "Heart"));

#

I put it in the end

humble tulip
#

U can reuse namespacedkeys

#

But it's whatever

humble tulip
harsh totem
#

You're right, thank you!

lament swallow
#

How would i get the server TPS?

iron glade
#

Has anyone else experienced problems with item meta hide attributes lately?

lament swallow
#

nope

iron glade
#

I'm crazy then

#

I can't get rid of it

rare flicker
#

theres an attribute to hide them

#

i'm not sure if you can completely get rid of them though

iron glade
#

We can

#

It works in every other plugin from me

#
    public ItemStack createGuiItem(int amount, Material mat, String displayName, String... lore) {

        ItemStack itemStack = new ItemStack(mat, amount);
        ItemMeta itemStackMeta = itemStack.getItemMeta();
        ArrayList<String> metaLore = new ArrayList<>();
        metaLore.add("");
        metaLore.addAll(Arrays.asList(lore));
        itemStackMeta.setLore(metaLore);
        itemStackMeta.getItemFlags().add(ItemFlag.HIDE_ATTRIBUTES);
        itemStackMeta.getItemFlags().add(ItemFlag.HIDE_POTION_EFFECTS);
        itemStackMeta.setDisplayName(displayName);
        itemStack.setItemMeta(itemStackMeta);

        return itemStack;
    }```
#

that's what I always used, it works in every single one of my plugins except this one

rare flicker
#

that's... peculiar to say the least

iron glade
#

The item is created and has the right material, display name and lore

#

just the attributes are still visible

#

I don't understand this :(

rare flicker
#

i'm sure i have at least ONE project laying around that has this

iron glade
#

that's so weird and really annoying

rare flicker
#

huh

#

are you on 1.19 or 18?

iron glade
#

1.18.2

#

1.19 out already?

rare flicker
#

because here i've used

#ItemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);

instead of 
#ItemMeta.getItemFlags().add(ItemFlag.HIDE_ATTRIBUTES);
rare flicker
rare flicker
#

buildtools doesnt yell at me so i would suppose so

#

if that fixes it, i suppose the reasonning is that getItemFlags gives you a copy of the attributes list rather than the original, so if you alter it it has no effect

iron glade
#

I love you man

#

This fixed it

rare flicker
#

np! x)

iron glade
#

But still weird, in older versions it worked the way I did it

rare flicker
#

i had this thing for a project where i was tired of UI items having data

rare flicker
iron glade
rare flicker
#

well on that note, back to updating every one of my plugins to 1.19 TwT

iron glade
#

There's a changelog somewhere?

rare flicker
#

probably in the post yeah

#

wait, per player world border??

iron glade
#

whhhat

rare flicker
#

i would suppose its only visual but still

#

i just hope that one day, a pathfinding api will be implemented, because NMS is a pain and not really meant to be used

iron glade
#

I'd love to make my custom entities look at you, but instead they just stand around

rare flicker
#

well mine does look at you, and move around to cure copper, do somethings on anvils, fight off mobs. But if you ever DARE reload the plugin or be on 1.18.2 instead of 1.18.1

breaks

#

but its a personal project so its fine

iron glade
#

Mine have no AI and only way to make them still look at you is by setting a pathfindinggoal or smth like that

#

through nms

#

And that's currently not worth the struggle for me

rare flicker
#

to make them just look at you i'm pretty sure you dont need NMS
i think teleporting them with a specific yaw and pitch on the location should do the trick

earnest forum
#

yeah

#

some maths

#

its a bit slow tho

#

depending on ping

iron glade
#

rly? But wouldn't I need to teleport them like very often

rare flicker
#

is that overkill? yes, absolutely

earnest forum
#

yeah it lags behind a little bit

rare flicker
#

i was like "why dont you just use packets and make a fake one" but i remembered that its basically the same thing

#

and it doesnt lag that much, as long as your ping is decent

#

used it to make a enderslenderman look at you from afar

#

works nicely but having about 50 around starts to get a bit heavy

earnest forum
#

mhm

iron glade
#

Do you think this is how they've done this?

rare flicker
#

given this is a fake player, no

#

but you honestly cant tell the difference

iron glade
#

hm

sand sphinx
#

Im new to Java

#

Why not working

  }
  @EventHandler
  public void onPlayerJoin(PlayerJoinEvent event){
      event.setJoinMessage("Just a test");

  }```
rare flicker
#

||oh hell no||

#

you probably didnt register the class that has this code as a listener in your main class

harsh totem
#

In the main

sand sphinx
#

No :/

harsh totem
#

So do it

sand sphinx
#

Give you a example link?

rare flicker
harsh totem
#

Yes

rare flicker
#

replace BWListener by your class name

#

i is an instance of your plugin

#

you could replace it by the keyword "this"

sand sphinx
humble tulip
knotty meteor
#
    @EventHandler
    public void onBlockPhysicsEvent(BlockPhysicsEvent e){
        if(e.getBlock().getType().equals(Material.CROPS) && e.getChangedType().equals(Material.AIR)){
            e.setCancelled(true);
        }
    }```
Im trying to grow a wheat seed on top of another block, but it just breaks every time.. this was my code for trying to prevent it but it still breaks. I did a log in console for old and new block
And i saw that it also breaks because it does crops as old and crops as new 
But i cant cancel that because then it doesnt grow the seeds
So does someone know how i can fix this?
torn shuttle
#

has anyone else noticed an issue with spawning mobs on chunk load in 1.19

#

the ghost of an old bug seems to have returned

#

we had the same issue I think it was in either early 1.18 or early 1.17, I think it was 1.18

rare flicker
#

crop is trying to grow, so crop to crop, doesnt get cancelled, * gets updated and realises it should be here so simply breaks
and blockPhysicsEvent doesnt catch the break event for some reason

torn shuttle
knotty meteor
#

So how can i only prevent the breaking part? And that it still grows?

torn shuttle
#

same exact issue happened I am pretty sure it was in early 1.18 days, and was fixed

#

on spigot's end

rare flicker
#

not too sure on that one

knotty meteor
#

Hmm thanks, i will try that one!

rare flicker
#

hope it works!

knotty meteor
#

Me too!

humble tulip
rare flicker
#

what's the event for "natural" block breaking then? like explosions?

torn shuttle
#

@hybrid spoke guess I better hit jira up huh

knotty meteor
#

I guess thats the BlockPhysicsEvent but with all the things i try with that event it doesnt break but also doesnt grow the seeds

rare flicker
#

you're actually mistaken

#

its a simple blockevent

#

wait no

#

i am

#

and cannot read

knotty meteor
#

Oof haha

torn shuttle
#

yeah it's bugged

#

damn it I hate this bug

humble tulip
#

Lol

misty current
#

can you clear an NbtTagCompound?

hybrid spoke
rare flicker
# knotty meteor Oof haha

i have no idea, the api suggests it IS blockPhysics eventbut that linked event dont all trigger a new event

sand sphinx
#

What should I do register, can someone explain to me?

humble tulip
knotty meteor
#

Yes it gets called because i want to grow a seed on top of another block, and with blockphysicsevent it breaks
When i cancel the crop with that event then it doent break it but also doesnt grow it

rare flicker
#

oooooohhh

#

then just manually grow it

humble tulip
#

^^

knotty meteor
#

But how?

rare flicker
#

when it gets called

#

you cancell it

humble tulip
#

Oh wait

rare flicker
#

and update the satte

humble tulip
#

He won't know if it's being broken or being grown

knotty meteor
#

Exactly

humble tulip
#

Cuz if he did he wouldn't be in this position rn

rare flicker
#

right

#

thats a problem...

humble tulip
#

Seems like getChangedType returns the type of block that the source block is

#

That's so stupid lol

knotty meteor
#

Yes i saw that sourceblock and changedblock both returned crops lmao

sand sphinx
# rare flicker

I did this but not working 😦

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event){
        event.setJoinMessage("Just a test");
        getServer().getPluginManager().registerEvents(new tr(), this);

    }```
humble tulip
#

Why are you registering your listener in your listener

#

Think about it

sand sphinx
#

Because I have only one class

#

😄

rare flicker
#

o h

hybrid spoke
#

how would it register itself

humble tulip
#

How would your plugin register the listener on player join if the listener needs to be registered for onPlayerJoin to be called

#

Register your listener in your onEnable method

sand sphinx
rare flicker
#

yes

sand sphinx
#

Im trying now

#

Give me a minute please

#

Not working 😦

humble tulip
#

It should work

#

Do you see Plugin is enabled! In your console?

rare flicker
#

i think we should just straight out ask for the whole class

humble tulip
#

?paste all your code here pls

undone axleBOT
rare flicker
#

alright i've fallen in love with CafeBabe

humble tulip
#

Don't do new tr

#

Use this

#

Not even gonna try to explain why

sand sphinx
humble tulip
#

replace new tr() with "this" without the ""

rare flicker
#

shouldn't it work with a new instance though?...

sand sphinx
#

Oh okay

humble tulip
#

Nah

sand sphinx
#

Its working

#

Thank you

humble tulip
#

That's his main class

#

Can only have one plugin instance

rare flicker
#

we learn new things everyday i guess

#

OH, i have a question
convention wise, is it better to :

1 - Have a public static instance of you plugin class for every other class to access
2 - Pass the instance in constructors

humble tulip
#

Think it throws an exception of u got more than one so idk how he didn't see the console spam

#

Either is fine

humble tulip
#

2 is better

ivory sleet
#

Like you usually wanna avoid passing your plugin instance anyway

rare flicker
#

hmmmmm

ivory sleet
#

If possible, pass dependencies directly

rare flicker
#

so i should pass one of the two fields i need instead ?

ivory sleet
#

probably wanna encapsulate it and make it a proper singleton

#

yes

humble tulip
#

Ye

ivory sleet
#

That’d be the best practice here, altho its fine to do it with the singleton or just passing the plugin instance

#

Since you won’t gain anything significant from passing dependencies directly unless the project is growing at a noticeable pace

rare flicker
#

the project?

ivory sleet
#

Yes your plugin

rare flicker
#

growing uncontrollably?

#

naaaaahhhh never

ivory sleet
#

Yeah that’s not much

rare flicker
#

its starting to be given my usual project scale

ivory sleet
#

Yea ye

rare flicker
#

first time working on an actual minigame from a to z

ivory sleet
#

Sounds exciting :3

rare flicker
#

so i went from like, 7 to 15 classes to this abomination

#

it is! ^^

ivory sleet
#

But when I meant growing noticeably I mean having 100k lines+ at least

rare flicker
#

okay i have a lot of leeway then

ivory sleet
#

Lmao yep

rare flicker
#

whole project must be smth like 5k lines at most

#

and that's with generous rounding up

ivory sleet
#

Yeah, well companies who are in the enterprise might have 1 million lines or more

rare flicker
#

i still have access to a company i did an insternhip in

#

or at least a version of it

ivory sleet
#

🥲

rare flicker
#

i can scroll through classes for a solid 3 minutes

#

and each has at least 1k lines

ivory sleet
#

:/

rare flicker
#

its in PHP tho so it tends to have more lines

ivory sleet
#

oh

#

God

#

Well php 8 isn’t that bad

rare flicker
#

yeah not that bad

#

still pretty bad tho xD

#

was enlightening tho

#

i now know how to organize a project with thousands of files

#

i just hope i'll never reach that scale for a personnal project

ivory sleet
#

Lol

#

Sounds like "I became the thing that I swore to destroy”

rare flicker
#

when i was young i wanted to optimise every bit of code i could see, then i got an internship

#

that was the end of that dream

#

alright, back to 1.19 updating everything

ivory sleet
#

ye

#

the new chat system is quite the mess

rare flicker
#

what did change for devs in the big lines?

#

i dont think i have any plugin that heavily relies on chat

ivory sleet
#

ah then you're good to go

#

well for one, the chat packet changed

rare flicker
#

oh, the encrypted one isnt a different packet?

ivory sleet
#

nope

#

and it is basically one packet containing 2 packets (chat preview being optional)

rare flicker
#

preview?

#

what would that be used for?

ivory sleet
#
CHAT PREVIEW
Servers can enable Chat Preview by setting previews-chat=true in server.properties
When enabled, a server-controlled preview appears above the chat edit box, showing how the message will look when sent
This can be used by servers to preview messages with styling applied, such as emojis or chat coloring
Chat Preview sends chat messages to the server as they are typed, even before they’re sent
The server then sends back the styled preview in real time
This allows servers to apply dynamic message stylings while still allowing chat to be securely signed
A warning screen is shown on the client when joining a server with Chat Preview, and it can be globally disabled in Chat Settings
Dynamic chat styling can also be controlled by the server, although this is only signed when Chat Preview is enabled
Clients can prefer to always show the original, signed message by enabling “Only Show Signed Chat” in Chat Settings
rare flicker
#

oh

granite owl
#

thats a thing?

rare flicker
#

does that mean chat coloring is a vanilla thing now? or is it just a neat feature for devs

granite owl
#

🤣

granite owl
humble tulip
granite owl
#

yea but by default u havent had access to it

rare flicker
#

i meant without plugins or anything

#

and without /tellraw ofc

#

like

&4 This message is in red!

granite owl
#

u use the paragraph character

rare flicker
#

!

#

§ <= this one?

granite owl
#

paragraph character + ascii char

#

is for chat formatting

granite owl
rare flicker
#

i never knew you could color stuff in chat without a plugin

granite owl
#

the chatcolor enum merely translates colors to this pattern

crude loom
#

Is there a way to get a list of all the hidden players from a specific player? or do I need to iterate through the online players list?

sand sphinx
#

package com.connorlinfoot.actionbarapi does not exist
What is this?
I have ActionBarAPI.jar in the libraries folder

granite owl
crude loom
#

Yes

ivory sleet
granite owl
#

either that ^

#

or iterate

crude loom
#

Oh I see, that's what I was looking for yes
Thanks !

humble tulip
#

Why is player.spigot a thing?

earnest forum
#

for text components

humble tulip
#

Why not just put it in player?

#

Ah

earnest forum
#

and other stuff

rare flicker
#

you cant edit Player directly i think

earnest forum
#

the only use i know is for sending text components

granite owl
#

getServer.spigot().respawn

#

muah

ivory sleet
#

it was mainly to explicate the additions that spigot had compared to craft bukkit, but now thats no longer relevant hence why Player.Spigot scarcely gets any new methods

granite owl
#

tho tbh the spigot reference doesnt have many members

rare flicker
ivory sleet
#

mye

crude loom
#

If I get an online player and put it in a 'Player' variable and they log out
Will it turn the variable to null or does it not work like that?

ivory sleet
#

nope

#

no variable turns null just like that

rare flicker
ivory sleet
#

however you will have a bad player object

granite owl
rare flicker
#

you would have 2 player instances of same name and uuid, but different nevertheless

ivory sleet
#

like certain things in the player object is gonna be null Shalev

crude loom
#

Oh if they relog I will also not be able to target them?

ivory sleet
#

target them?

rare flicker
ivory sleet
#

^

crude loom
#

Yeah I think this is the safer option, I wondered if I could use Player though

rare flicker
#

had to do this for a antispam plugin wsith a mute feature

#

and it could be bypassed by relogging

#

which was annoying

ivory sleet
#

you almost never want to use Player as the key type in a Map

#

or well in a Set etc

#

Player interface is at most an accurate context object of a player

#

nothing more

rare flicker
#

what about OfflinePlayer tho?

#

would that persist through relogs?

ivory sleet
#

sometimes

rare flicker
#

or be invalid as well, or is it just unrelated

#

||i'm having so much fun discussing here, why didnt i join sooner||

ivory sleet
#

so OfflinePlayers are weakly persistent

#

which means as long as any plugin holds on to them they will stay

rare flicker
#

and if not it gets destroyed and recreated when needed ?

ivory sleet
#

myeah

#

well the implementation is a weak hash map

#

(basically)

rare flicker
#

<= doesnt know the differences between a weak hashmap and a "normal" one

#

lemme google it rq

ivory sleet
#

yeah

granite owl
rare flicker
#

OOOOHHH

#

THAT'S SO USEFUL

ivory sleet
#

ye

granite owl
#

basically if u wanna perform anything that ACTUALLY requires the player to be online to work

crude loom
#

huh, and will I be able to get information about them? like their hidden players?

rare flicker
#

that would fix a ram leak i had on an old project of mine

ivory sleet
#

no guarantee shelev

granite owl
#

if theyre offline? do if(player.isOnline()) check for hidden players;

#

else remove from list

humble tulip
#

I honestly do not understand weak references

ivory sleet
#

I can try to explain

#

you know how the garbage collector works?

humble tulip
#

Sorta

#

No reference to object it's safe for the gc to clean up

granite owl
humble tulip
#

That's really as much is i know

ivory sleet
#

sort of

humble tulip
ivory sleet
#

anyway in java

var x = blah;
#

x is a strong reference by definition

misty current
#

can you get the cause of an EntityCombustEvent

humble tulip
#

?jd

ivory sleet
#

it means as long as x is pointing to blah, blah cannot by definition be garbage collected

humble tulip
#

Ok that i do know

ivory sleet
#

however let's say I do this:

x = 1
#

now blah can be enqueued for garbage collection

humble tulip
#

Yep

misty current
ivory sleet
#

and then some arbitrary time in the future, blah will be garbage collected and cleared from on heap memory

#

if I were to do:

WeakReference<?> ref = new WeakReference<>(blah);
#

here, any time blah can still be enqueued for garbage collection

#

only way to hinder it from being enqueued is if

var y = blah

is present somewhere else at the time

humble tulip
#

I'm guessing weakreference has special treatment from the jvm because how else would it store a reference and still be allowed to be garbage collected

ivory sleet
#

Yes

#

like Thread, and some other classes, this one is treated with special care

humble tulip
#

Then is it possible to get an object that has not yet been gced back from heap memory with no references to it

ivory sleet
#

yes

humble tulip
#

Wtf

ivory sleet
#

you can register the weak reference to a reference queue

#

altho PhantomReference might be more suitable here

humble tulip
#

Imagine being smart enf to use this in your projects😂

ivory sleet
#

lol ye

#

well you should avoid this type of pattern

#

since we have try with resources

#

a much better way of dealing with resources

humble tulip
#

Oh that's another thing

#

Why do statements need to be closed

#

If we no longer reference them

rare flicker
#

ram usage?

golden kelp
#

do plugins made on paper work in spigot servers?

humble tulip
#

Yes but shouldn't it be gced

humble tulip
golden kelp
#

yea that i know

rare flicker
humble tulip
#

Paper has stuff that spigot doesn't

#

If u want it to work on both, use spigot

rare flicker
#

otherwise the server will be like, oh you need something from paper? what's paper? and just error

golden kelp
#

xd

ivory sleet
humble tulip
#

Similar to closing a stream?

ivory sleet
#

myeah

#

altho you dont need to close all streams

humble tulip
#

Ah ok

ivory sleet
#

only io streams must be closed

humble tulip
#

I close all cuz idk which

ivory sleet
#

like a normal Stream from Stream::of or Collection::stream doesnt need to be closed

humble tulip
#

Yk there are streams that accept streams in the constructor?

ivory sleet
#

ugh wym?

humble tulip
#

One sec

ivory sleet
#

like Stream::flatMap?

humble tulip
#

Nah

#

Ugh I'll go turn on pc

ivory sleet
#

sure :3

iron glade
#

Is there an event called even later than the PlayerQuitEvent when a player leaves?

ivory sleet
#

nope

iron glade
#

alright then I have to run a task

ivory sleet
#

x)

rare flicker
#

ahhh, the infamous
. runTaskLater(plugin, 1)
because for some reason it needs a tick to process and work

humble tulip
#
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream);

            dataOutput.writeInt(obj.length);

            for (int i = 0; i < obj.length; i++) {
                dataOutput.writeObject(obj[i]);
            }

            dataOutput.close();
            outputStream.close();
humble tulip
#

do i need to close both and do i even need to close them at all?

rare flicker
ivory sleet
#

yes

rare flicker
#

huh

humble tulip
#

I thought runTask delays by 0 ticks

#

i was looking at craftschduler class

rare flicker
#

i guess i can remove smth like 10 characters from a few plugins then

ivory sleet
#

no minion

#

you only need to close dataOutput in principle

#

since dataOutput will close outputStream when close() is invoked

humble tulip
#

oh it will

#

ok

ivory sleet
#

well it makes no sense to schedule something after 0 ticks

humble tulip
#

it does, in a sense

rare flicker
#

unless you are on an asynchronous thread

#

like chat

#

wait

humble tulip
earnest forum
#

just use runTask ten

rare flicker
#

what does runTaskLater(plugin, 0) do then?

humble tulip
ivory sleet
#

anyway

    public BukkitTask runTaskTimer(Plugin plugin, Object runnable, long delay, long period) {
        CraftScheduler.validate(plugin, runnable);
        if (delay < 0L) {
            delay = 0;
        }
        if (period == CraftTask.ERROR) {
            period = 1L;
        } else if (period < CraftTask.NO_REPEATING) {
            period = CraftTask.NO_REPEATING;
        }
        return this.handle(new CraftTask(plugin, runnable, this.nextId(), period), delay);
    }
``` here
#

CraftTask.ERROR = 0

#

oh wait

#

ugh

#

yes

#

no?

rare flicker
#

hmm

ivory sleet
#

wait let me see if I can find it

humble tulip
#

sets next run to current tick + 0

#

which is current tick

ivory sleet
#

oh yeah thats the thing

#

it will still be consumed the next tick

humble tulip
#

time to test

humble tulip
ivory sleet
#

no but it used to be the way

#

idk why it would change

light bloom
#

i found that spigot-1.19 will play 2 times of the warden summoning animation.

#

can fix?

ivory sleet
#

yeah make an issue

#
        Bukkit.getScheduler().runTask(plugin,() -> {
            System.out.println(Bukkit.getCurrentTick());
        });
        Bukkit.getScheduler().runTaskLater(plugin,() -> {
            System.out.println(Bukkit.getCurrentTick());
        },1);
        Bukkit.getScheduler().runTask(plugin,() -> {
            System.out.println(Bukkit.getCurrentTick());
        });

@humble tulip

#
[11:49:07 INFO]: 105
[11:49:07 INFO]: 105
[11:49:07 INFO]: 105

output ^

humble tulip
#

ah ok

#

so it does run one tick later

ivory sleet
#

ye

humble tulip
#

is there an order to how a tick functions?

ivory sleet
#

tick functions?

#

I believe runTask always runs before runTaskLater etc tho

humble tulip
#

like first mc world does it stuff and all events, then player packets processed and those events then scheduler?

#

like that

ivory sleet
#

oh

humble tulip
#

idk how to explain it

ivory sleet
#

well

packet interception -> queued to server thread -> world handles it -> delegates to blocks, entities etc

#

basically

humble tulip
#

when does the scheduler run sync tasks then?

ivory sleet
#

the scheduler runs before the world tick and anything iirc

#

let me check

humble tulip
#

how do u check these things so quickly lol

ivory sleet
#
    public void tickChildren(BooleanSupplier shouldKeepTicking) {
        MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper
        this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
#

yep

ivory sleet
#

and I use ctrl + left click to navigate (through classes and functions)

earnest forum
#

pressing double shift while hovering the class?

ivory sleet
#

oh no, just double shift, it will bring up a search window

earnest forum
#

ah

#

i right click

#

go to> declaration

ivory sleet
#

oh

#

I just ctrl left click the class, method, variable or whatever needs to be navigated

earnest forum
#

yea im probably gonna use that now

ivory sleet
iron glade
#

Can I simply combine those 2 maven shade plugins? Cause it's causing me some trouble when building

ivory sleet
#

Sure I don’t see the incompatibility here

fair steeple
#

you should move the relocations from the bottom one to the configuration of the first one

iron glade
#

that's what I just thought

#

thanks for confirming

fair steeple
#

no problem

iron glade
#

Is there a reason this is like this?

#

when putting it through jd-gui

tall dragon
#

does it have an inner class?

iron glade
#

no

#

Also, is this something I should / can take care of?

fair steeple
#

Shouldn't be an issue in most cases

ivory sleet
#

Yeah ignore it

#

Spigot doesn’t go/incorporate too well with the module system

iron glade
#

Alright, thanks. I'm still kinda new to maven

#

The pom kind of overwhelmed me at first

quaint mantle
#

the gravity storm part

torn shuttle
#

well, the visual effects are falling blocks but that's the only other thing

quaint mantle
#

can we go dms?

torn shuttle
#

no

quaint mantle
#

can we not go to dms?

quaint mantle
tepid thicket
#

Anyone knows why TextComponents now are prefixed with a <> in 1.19 chat?

#

It only applies to component messages. Not normal chat messages.

torn shuttle
eternal night
#

are you up to date on spigot ?

#

a lot of stuff is changing around chat

tepid thicket
#

Thats from worldedit. But also applies to other plugins.

#

Yes. I just builded the server jar.

glass mauve
glass mauve
#

prob use setVelocity

glass mauve
torn shuttle
#

stop trying to drag people into dms

quaint mantle
#

bro

#

I need help

glass mauve
#

I can help you here

torn shuttle
#

then get help like a normal person

glass mauve
#

^

quaint mantle
#

ok ig

glass mauve
#

I just told you how to do it, what is your current problem

quaint mantle
#

nothing nbm

hybrid spoke
#

since thats what he wants

glass mauve
#

he wants to push them all to a location, so I would prob. try it with setVelocity(Vector)

earnest forum
#

what vector though

glass mauve
#

but idk how to create that animation

hybrid spoke
#

spawning falling blocks in a circle

#

push them up by 0.2

#

and gone

eternal oxide
frail sluice
#

I am trying to add a recipe to the recipe book when the player obtains an iron ingot. this is how I register the recipe: java Bukkit.getServer().addRecipe(new ShapedRecipe(key, result) .shape( "I I", "IWI", " R ") .setIngredient('I', Material.IRON_INGOT) .setIngredient('W', Material.WATER_BUCKET) .setIngredient('R', Material.REDSTONE) ); and this event is also registered: ```java
@EventHandler
public void onEntityPickupItem(EntityPickupItemEvent event) {
if (event.getEntity() instanceof Player player && event.getItem().getItemStack().getType() == Material.IRON_INGOT) {
player.discoverRecipe(key);
}
}

the event does get called, and the player gets the recipe (I checked using the `/recipe` command) but the player doesn't get a notification and it doesn't appear in the recipe book.
minor otter
#

Is it possible to add a block to a block tag like minecraft:logs so leaves dont dissappear around it

tender shard
minor otter
tender shard
#

also the tags are "per material" and not "per block" so yeah tags don'T help

minor otter
#

I was gonna add mushroom block to it

tender shard
#

oh ok. you could probably add a tag with some very nasty reflection

minor otter
#

Id rather override the event but thanks for help

tender shard
#

oki

tepid thicket
#

Well, could also be a chat plugin making the issues with the <> prefix. (if it's only me who has them in 1.19)

#

Anyway, thanks for the help.

subtle folio
#

hi alex :3

tender shard
#

henlooo

subtle folio
#

what’s your timezone

tender shard
#

CEST

subtle folio
#

you sen to be on when i’m on

tender shard
#

it's 1pm here

subtle folio
#

wait nvm i read that as est

tender shard
#

central european summer time 😛

subtle folio
#

easter standard time 🙄

#

eastern

tender shard
#

it's funny how it's called "eastern" time although it's on the west side of the world lol

karmic mural
#

I'm trying to get info of the item a player is holding, but it spits out "org.bukkit.entity.Player.getItemInUse()" is null

There is a fair bit of conflicting info that I've found from searching this stuff up. From what I read on the spigot api docs this should be working but clearly I am doing something wrong

tender shard
#

it's nullable

#

that means it returns null when the humanentity doesn't have any item in use

#

they could simply be using their bare hands

subtle folio
#

like fists

karmic mural
#

That is the issue, there is an item in use which is what is confusing me

tender shard
#

and what item is that?

karmic mural
#

A diamond pickaxe

earnest forum
#

what about get item in main hand

eternal oxide
#

Are you doing this in an Interact event? You have two hands

karmic mural
earnest forum
#

is 1.19 for minecraft actually out yet

#

or is it just snapshots

subtle folio
#

it’s out

minor otter
#

its out

earnest forum
#

i never knew lmao

subtle folio
#

and spigot is updated

karmic mural
#

I must be out of date, I can't use getItemInMainHand apparently. Is it new?

earnest forum
#

get the player's inventory

#

and then use that method on it

karmic mural
earnest forum
#

wait what mnecraft version are you on

#

this is 1.9+

karmic mural
#

1.18.2, I was just not thinking the right way. It's been a while since I worked on this plugin

#

and java in general tbh

subtle folio
karmic mural
#

I should probably have realized I'd need to get the player inventory first. Thank you for your help. Code is working perfectly now.

light bloom
karmic mural
tender shard
subtle folio
#

ah yes

#

“properly”

karmic mural
#

Looks more like a massive pain ngl

tender shard
#

yeah it was a joke, i'm bored

karmic mural
#

It seems there is no issue when having no item in hand so I'll leave it as is

light bloom
#

will now spigot will handle 2times about some BlockInteractEvent

karmic mural
#

I was just checking if they had Silk Touch enchant java boolean usingSilktouch = e.getPlayer().getInventory().getItemInMainHand().containsEnchantment(Enchantment.SILK_TOUCH);

tender shard
karmic mural
#

If it's null then it'll be false anyways so it's fine for my specific usecase

tender shard
#

but IIRC it's annotated as NotNull

#

it would return an empty itemstack of Material.AIR instead of being null

karmic mural
light bloom
#

and warden summoning animate will be played 2 times in spigot

karmic mural
#

Yes, my mistake. Result is the same but I should've been more clear about cause

light bloom
#

when will this bug fix?

tender shard
#

if you find a bug, report it to jira

#

?jira

undone axleBOT
tender shard
#

or fix it yourself

subtle folio
#

is spigot open source ?

#

or closed open source

tender shard
#

it's all on stash

#

?stash

undone axleBOT
subtle folio
#

their own github?

#

but stash

tender shard
#

a similar thing lol

#

yes

subtle folio
#

um

#

hm

#

rad

tender shard
#

you have to sign some agreement to get access though

subtle folio
#

i see

#

that’s prob why it’s there and not on github then

eternal oxide
#

you can access anon on stash. You can;t view PR's is all

tender shard
#

oh ok

torn shuttle
#

are wolves persistent by default?

polar pagoda
#

I believe so

kindred valley
#

?paste

undone axleBOT
eternal oxide
#

tamed/named are for sure

torn shuttle
#

god this issue is annoying me

polar pagoda
#

Minecraft's forums should say

torn shuttle
#

ok yeah so

#

something busted my spawning entities on chunk load but only for... wolves and (some) villagers

#

100% of the wolves, but an inconsistent % of villagers

#

ok so my issue now makes... less sense

karmic mural
#

I've a config for my plugin that requires a quite strict way of writing. Is there an optimal way of making sure the plugin doesn't crash when there's an error, outside of using a try catch statement?

torn shuttle
#

I was spawning stuff 1 tick after the chunk load and when removing that wolves now spawn correctly

#

yeah so now everything spawns correctly

#

so my 1.18 fix now breaks 1.19

#

uh

tender shard
#

I always just print a huge warning to both console and chat when the config is broken and load the default config instead

tardy delta
#

ah i let the plugin crash

vocal pine
#

again with my probably very basic questions - can someone show me how i'm supposed to setup my pom.xml to undo mojang mappings on compile? it did not work from the two tutorials i found so i tried working it out and turns out i just made it worse, lol

tender shard
#

I always just show this msg

vocal pine
#

yeahh thats the one i tried

tender shard
#

it's definitely working 100% fine

#

if not you did something wrong 😛

vocal pine
#

but it kept giving me malformed pom errors

tender shard
#

?paste your pom.xml

undone axleBOT
vocal pine
#

thats my current one

#

(homemade badly from trying to make that tutorial work)

#

thiink the issue when i tried that one as-is, executions tag wouldnt work and gave malformed

tender shard
#

okay so what the heck is this?

torn shuttle
#

oh that's hilarious, now I have a different bug

#

great

tender shard
vocal pine
#

ah ye its even more messed up cus i tried to follow an alternative way

#

that included splitting it into profiles

#

then i just kept moving tags as errors happened

#

so its way more messed up now lol

tender shard
#

pls check out my blog post again. you should have a <build> inside <project>, and that should contain <plugins>. and inside there you need to add the maven-specialsauce plugin or whats it called with all the remapping configuration

vocal pine
#

👍

tender shard
#

you can actually remove your complete <profiles> section

quaint mantle
#

Sorry for late reply but how would one go about doing this and so it only replaces air blocks?

#

I've tried to do it and it only places 1 block not a sphere

tender shard
#

show your code ps

tall dragon
#

@tender shard

quaint mantle
#

Updated code

        final Set<Location> blocks = new HashSet<>();
        final World world = location.getWorld();
        final int X = location.getBlockX();
        final int Y = location.getBlockY();
        final int Z = location.getBlockZ();
        final int radiusSquared = radius * radius;

        if (hollow) {
            for (int x = X - radius; x <= X + radius; x++)
                for (int y = Y - radius; y <= Y + radius; y++)
                    for (int z = Z - radius; z <= Z + radius; z++)
                        if ((X - x) * (X - x) + (Y - y) * (Y - y) + (Z - z) * (Z - z) <= radiusSquared)
                            blocks.add(new Location(world, x, y, z));
            location.getBlock().setType(material);

            return makeHollow(blocks, true);
        }

        for (int x = X - radius; x <= X + radius; x++)
            for (int y = Y - radius; y <= Y + radius; y++)
                for (int z = Z - radius; z <= Z + radius; z++)
                    if ((X - x) * (X - x) + (Y - y) * (Y - y) + (Z - z) * (Z - z) <= radiusSquared)
                        blocks.add(new Location(world, x, y, z));

        return blocks;
    }```
tender shard
tall dragon
#

he is

#

once

tender shard
#

oh yeah

#

there

tall dragon
#

outside the for loops

quaint mantle
#

I get wrong locations probably

tender shard
#

hard to spot without formatting lol

#

the only block you ever place is at "location" which is the original argument

#

instead of doing it in this weird way, you should remove the setType in that completely and then loop over the RESULT of this method to set the type

vocal pine
#

that worked perfectly thanks, really have no idea what i did wrong before then lol

harsh totem
#

I have this function that gives items:

        if (amount > 0){
            is = is.clone();
            is.setAmount(amount);
            World world = p.getWorld();
            p.getInventory().addItem(is).values().stream()
                    .filter(item -> !item.getType().isAir())
                    .forEach(item -> world.dropItemNaturally(p.getLocation(), item));
        }
    }```
and when I use it the dropped items are invisible for some reason. any ideas?
tender shard
harsh totem
tender shard
#

I don't know. I am doing similar stuff and it's working fine for me

karmic mural
# tender shard use a config format that isn't as strict as yaml

I should probably have been more specific. When the plugin pulls from the config it requires things like materials to be properly typed "deepslate_diamond_ore" can't have a spelling error for example. If it does the plugin crashes. I've gotten around this by just typing properly but if I want it to be more user friendly it obviously has to let them know in a friendly way.

So that's why I ask if there's a better way than just try catch, in terms of running the code and spitting out an error if there's an issue.

harsh totem
#

it's a function that I created 2 weeks ago and it did work fine

tender shard
#

?paste

undone axleBOT
tender shard
harsh totem
#

@tender shard well I reloaded the plugin and now it's not invisible. idk what that was but thanks anyways

tender shard
harsh totem
#

minecraft counts 4215 dropped items as 2 ;-; wtf

#

it's not my plugin's problem

eternal oxide
#

pretty sure it is

#

unless you are modded or messing with stack sizes

harsh totem
#

I jumped into that dropped items and my entire inventory was filled.
I killed every item entity after that and I got in chat "killed 2 entities"

#

there was actually a lot of items

tardy delta
#

isnt that because dropped items merge?

harsh totem
#

merge to 2?