#help-development

1 messages · Page 430 of 1

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

amber vale
#

Okay I'll just figure it out on my own you fucking cunts

icy beacon
#

?????

#

sorry that we can't read minds yet

smoky oak
#

can you send particle packets async

rotund ravine
icy beacon
#

seeing as Bukkit API can do it, packets also can i reckon

young knoll
#

You should be able to send any packet async

#

Since netty is async

wet breach
#

there is a block break event

#

you can modify the drops to be nothing from there

rotund ravine
#

He then said it didn’t work

#

Without showing what he did

wet breach
#

o.O

rotund ravine
#

Then got mad when i asked for code with the macro

wet breach
#

well, I was scrolled up so I didn't bother reading the millions of messages since then lmao

#

but yeah would need to see code to see what they did wrong

rotund ravine
#

Well then he’ll curse you out for not spoonfeeding him

tardy delta
#

is the Enum#values impl gone?

rotund ravine
#

Hm?

#

On what

tardy delta
#

java.lang.Enum.values() method does not longer seem to exist

eternal night
tardy delta
#

ah compiler adds it

rotund ravine
#

O guess

eternal night
#

wtf would that even do on the abstract class Enum KEKW

sacred wyvern
#

Is there a way to block Villagers with jobs from opening the trade window when you right click? I'm tracking the event and cancelling it but it still opens the trade window when you right click them.

tardy delta
#

iirc Enum had a field of type E[] but its gone now

sacred wyvern
#

PlayerInteractAtEntityEvent

young knoll
#

Try just the PlayerInteractEntityEvent

sacred wyvern
#
    @EventHandler
    public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
        
        for(String characterId : ConfigService.getConfig().getConfigurationSection("server.characters").getKeys(false)) {
            String uid = ConfigService.getConfig().getString("server.characters." + characterId + ".uid");
            if (uid.equals(event.getRightClicked().getUniqueId().toString())) {
                setFace(event.getPlayer(), (Villager) event.getRightClicked());
                event.setCancelled(true);
                LOG(LogType.Info, event.getPlayer().getName() + " right clicked " + event.getRightClicked().getCustomName());
                String id = CharacterService.getIdByUid(event.getRightClicked().getUniqueId().toString());
                SessionService.addSession(id, event.getPlayer());
                break;
            }
        }

    }
#

ick that's long sorry

sacred wyvern
tender shard
#

no

young knoll
#

No it isn't

#

note the "at"

sacred wyvern
#

Ah k

#

sorry and thank you

tender shard
#

the "at" event is only called for some entities where the client sends the exact position where the player clicked the entity

tardy delta
#

when will it develop feelings

tardy delta
#

ah kinda sucks but Enum#values returns a clone every time

hazy parrot
#

clone of what

tender shard
#

of the array

#

that holds all the values

quiet ice
tardy delta
#

ye

#

ah i thought you could redefine a static method but no

copper hemlock
#

How can I copy worlds?

onyx fjord
#

can u somehow change skull texture without reflection?

remote swallow
#

item or block

onyx fjord
#

item

remote swallow
#

what version

remote swallow
#

i just got beat

onyx fjord
#

yeah PlayerProfile is what iwas looking for

#

pretty new huh?

young knoll
#

1.18

ocean hollow
#

I'm sorry, but how can I create a dictionary to use multiple elements?

tender shard
#

it's been more than a year

pseudo hazel
#

wdym multiple elements?

tardy delta
#

i also forgot enums cannot extend a class 💀

tender shard
#

enums already extend Enum

tardy delta
#

dammit java

ocean hollow
pseudo hazel
#

I mean jave has some of the best enums out of any language imo

#

in most its just glorified constants

tardy delta
#

rust enums are the best

pseudo hazel
#

make a new class for that kinda of data

tender shard
#

but enums can implement interfaces, ofc

tender shard
tardy delta
#

id rather not make 1000 classes

tender shard
#

oh you wanna have a Map that stores Player, a boolean, and an inventory per location

#

create a data class

ocean hollow
copper hemlock
#
``` This don't work on the latest versions?
tardy delta
#

Map<K, List<V>>

pseudo hazel
#

yeah you would create some data class for it

sacred wyvern
#

When you click on a villager with a job and it opens a trade window. The background behind the trade scene gets darker. Is there a way to activate/disable that alpha background for a custom interaction?

pseudo hazel
#

or you need to have a list of Objects

tender shard
pseudo hazel
#

just make it public xD

#

no need for getters lmao

rotund ravine
pseudo hazel
#

like what

tender shard
#

you can also use a Triplet<Player,Boolean,Inventory> from e.g. javatuples

#

but tuples suck, better make your own data class

tardy delta
#

at this point i just want to recreate this whole program

tardy delta
sacred wyvern
ocean hollow
#

ok guys thanks

pseudo hazel
tardy delta
#

guess what i just did

#

💀

#

good that comment was there

pseudo hazel
#

i wish we wouldve just had proper structs instead of records

compact haven
#

wat type of comment is that

ocean hollow
#

How to check inventory for empty slots?

if(inv.contains(new ItemStack(Material.AIR))){{}

????

icy beacon
#

lombok

compact haven
#

that’s kinda funny

icy beacon
tardy delta
#

javadoc

icy beacon
#

@Data

compact haven
#

no I know it’s a javadoc, it hs the two stars

pseudo hazel
#

I dont mean an annotation, I mean like an actual language feature like class and enum

tardy delta
#

a comment that humanity will extinct if i rearrange the constants order

compact haven
#

there we go

icy beacon
pseudo hazel
#

lol

tardy delta
#

why cant you override a static method lol

pseudo hazel
#

I dont even know what lombok is

#

because its static

icy beacon
tardy delta
#

id rather not copy an enum with 3000 constants or smth

#

looks like 3000

pseudo hazel
#

yikes

#

sounds like some devil's construct

tardy delta
#

wanted to make an enum parent class that provides an immutable alternative for Enum.values without having to copy that array everytime

ocean hollow
tardy delta
#

but java is like; you cannot let an enum extend smth 💀

pseudo hazel
#

just make an interface

tardy delta
#

need the constants

#

as a field

ocean hollow
#

thanks

pseudo hazel
#

then use composition

tender shard
#

-1

pseudo hazel
#

wait are enum instances/values static?

young knoll
#

yes

rotund ravine
#

They’re basically just static finals

young knoll
#

Enum constants are just fancy static final fields

tender shard
pseudo hazel
#

idfk

#

but yeah that does make sense now

tardy delta
#

oh man just by making it private

#

ugh cant make length static cuz an interface doesnt have its surrounding context

tender shard
#

how would that work as static o0

tardy delta
#

returning Enum.values().length but i cant have the constants cuz im in a interface

#

if that interface is implemented by an enum, does calling getClass().getEnumConstants() returns the constants of the child class?

tender shard
#

interfaces have nothing to do with getClass

#

getClass will return whatever that enum class it is

tardy delta
#

ye thats an isue too

#

uhh ye im fucked up

#

actually my idea is stupid, cant add static method to that enum through a parent class

icy beacon
#
toDrop = leftToDrop - amount;
leftToDrop -= amount;

this is identical to

toDrop = leftToDrop -= amount

right?

#

i've been working for 7 hours straight at this point

#

this is probably very obvious but i don't want to overthink

#

i just want to simplify

tardy delta
#

doesnt that assign leftToDrop to toDrop?

icy beacon
#

maybe idek

icy beacon
#

somehow i've never stumbled upon or used such expressions

#

or at least that's what i recall

tender shard
#

but toDrop will always be the same as leftToDrop

tardy delta
#

nice game that im forking lol

wraith tulip
#

anyone know how to fix 84 out of bounds for length 5

tender shard
#

do not call myArray[84] on an array that only has 5 elements

sacred wyvern
#

Is there a way to freeze a villager when it's walking and you setAware to false? If it's moving when you do that it gets inertia and slowly keeps moving in the same direction for a while.

#

Is there like a momentum property?

tender shard
#

do you mean velocity?

sacred wyvern
#

ya

#

I'm setting aware to false and making it look at me but then it just keeps walking

tender shard
#

villagers are more complicated than other mobs

tardy delta
#

why can an enum not just be a Iterable smh

tender shard
#

they have their weird memory system that does this or sth

lost matrix
tardy delta
#

just want to loop over it without having to clone those constants on every invocation

#

like Enum.values() returns a clone and id rather not clone 3000 constants

#

could always have a method that returns a shared copy but thats ugly

#

ill probably do that then

tender shard
# tardy delta like Enum.values() returns a clone and id rather not clone 3000 constants

then just cache the values in some class or sth?

public class EnumInfo<E extends Enum<E>> implements Iterable<E> {

    private final Class<E> enumClass;
    private final List<E> enumConstants;
    private final int size;

    public EnumInfo(Class<E> enumClass) {
        this.enumClass = enumClass;
        this.enumConstants = Collections.unmodifiableList(Arrays.asList(enumClass.getEnumConstants()));
        this.size = enumConstants.size();
    }

    public List<E> getEnumConstants() {
        return enumConstants;
    }

    public int size() {
        return size;
    }

    @Override
    public Iterator<E> iterator() {
        return enumConstants.iterator();
    }
    
    // Whatever else you need

}
#

and then make that Iterable

sacred wyvern
tardy delta
#

ye i had that but i wanted to make it possible for an enum to implement it

pseudo hazel
#

I mean at this point just make your own Enum class

tardy delta
#

then cry when you realize you gotta write public static final in front of every constant

modern vigil
#

How would I approach making a custom Inventory class?

#

Which class would I need to extend?

pseudo hazel
#

none really

modern vigil
#

Yes

pseudo hazel
#

just make a class that has an inventory

lost matrix
pseudo hazel
#

or just follow smile's tutorial

#

thats the most flexible way anyways

modern vigil
pseudo hazel
#

yes

#

exactly

#

because Bukkit cannot really create your custom inventory class if you had one

#

which is why you are restricted to the existing types/sizes

young knoll
#

I miss the old days when you could make janky 7 row inventories

pseudo hazel
#

lmao

#

I never knew about that haha

#

sounds like fun

modern vigil
#

but uhh

#

wait

#

how would you identify the 'owner' of the inventory?

pseudo hazel
#

what do you mean?

modern vigil
#

would you just add an uuid field to the InventoryHandler class?

#

let's say you have a menu

pseudo hazel
#

no you can compare InventoryHolders

modern vigil
#

i mean like

pseudo hazel
#

or like do you mean the player that opened it?

modern vigil
#

yes

#

or

#

like let's say you have a menu which has cosmetic items

pseudo hazel
#

well when you handle the open inventory event, the player will be given

modern vigil
#

and administrators can open other player's guis

pseudo hazel
#

sure

#

it would just be somewhat complicated

modern vigil
#

you'd need to store the uuid of the owner of those cosmetics

#

could you make a seperate IdentifyableInventoryHandler class?

#

or

#

something like that

pseudo hazel
#

yes if you had such an inventory I would not store the cosmetic data in the inventoryHandler as that does not make sense

#

you probably have some data construct you use to build the inventory when the player opens it

modern vigil
#

the thing i'm struggling with is to keep track of the owner of those cosmetics

#

like an admin opens the gui of e.g Player_1

tardy delta
#

man made his own arraydequeue 💀

pseudo hazel
#

well idk what the actual system is but it sounds like you want to save your player's cosmetics to permanent storage anyways

#

so then you store it alongside the player's uuid

lost matrix
pseudo hazel
#

yes and then make an InventoryHandler that can show a CosmeticsContainer when the player opens that inventory

alpine swan
#

are bungeecord events async?

lost matrix
alpine swan
sacred wyvern
alpine swan
tardy delta
#

isnt there an Event#isAsync?

#

yes

lost matrix
#

If they extend AsyncEvent then they are async

lost matrix
tardy delta
#

uhh i was just thinking

quaint mantle
#

pls you can make the plugin yourself (if you can) since I can't 😦 (1 16 5)

tender shard
#

?services

undone axleBOT
livid dove
#

Has anyone else had maven issues since the intelij plugin update on the 19th?

tender shard
#

which intellij plugin? wdym with "maven issues"?

tardy delta
#

hows that lazy? you give it a value immediatly?

tender shard
#

the minecraft dev plugin always causes problems, but I never had any problems related to maven

livid dove
tardy delta
#

im also wondering where my getter is now, i wrote @Getter but where is the getter lmao

livid dove
#

And my lbiraries are odd as heck

tender shard
tardy delta
#

oh other naming convention

#

can you modify the name of the getter?

tender shard
#

wait is that decompiled or actual source? because if it's decompiled, the annotation shouldnt be there, and if its actual source code, the getTransactions() method overrides the getter annotation

remote swallow
#

what other fancy stuff can lombok do

tardy delta
#

no cluehttps://www.baeldung.com/intro-to-project-lombok#lazygetter

tender shard
tardy delta
#

yes but how do i change the name

#

dont see any field in the annotation

tender shard
#

and you can change the capitalization

#

but that's it

tender shard
tardy delta
#

well instead of isInlineDescription i want it to be hasInlineDescription but the field is called inlineDescription

tender shard
#

if I was you, I'd just rename the private method to getTransactions0() or sth

tender shard
tardy delta
#

?conventions

tender shard
#

oh wait

#
 @Getter(fluent = true)
private boolean hasInlineDescription;
#

this would do

remote swallow
#

oh with lombok

#

if i add @Builder to a record

#

does it have to make a SomeThignClassXBuilder

tardy delta
#

dunno what version you have but i have no fluent

#

imma have to rename the field then

tender shard
remote swallow
tardy delta
#

no clue where id see the version on gradle

tender shard
tender shard
tardy delta
#

and me thinking annotations would be a good idea

tender shard
#

generated code:

remote swallow
#

is that recaf

tender shard
#

ignore the auto generated class in the first screenshot, that's bullshit and recaf only added it because it didnt know about the inner class

remote swallow
#

ah

tender shard
#

here's the proper decompiled file (empty record with two fields + builder annotation)

remote swallow
#

makes sense

#

is that recaf also

tardy delta
#

just realized you cannot add javadocs to methods that dont exist 💀

tender shard
#

if you e.g. annotate fields with NonNull (a lombok annotation), it looks like this

tender shard
remote swallow
#

im guessing the same

tender shard
#

nothing

remote swallow
#

are those just visual?

tardy delta
#

they only generate warnings

tender shard
#

yeah

remote swallow
#

huh

tardy delta
#

epics life has been a lie

remote swallow
#

im gonna start using lombok ones

tender shard
#

yeah I'll also switch to them

remote swallow
#

i wonder if theres a lombok thing to sysout fields

tender shard
#

wdym?

remote swallow
#

one sec

#
private static final int integer = 95635;

public static void runSomething(int toCompare) {
    @MAGIC integer;
    @MAGIC toCompare;
    if (toCompare > integer) runOtherMethod();
}
#

MAGIC being something lombok adds

tender shard
#

erm what's that supposed to do, I dont really get it lol

remote swallow
#

sys out

tardy delta
#

is there a shortcut for @Getter @Setter?

#

for a field

tender shard
#

Data

#

@Data

tardy delta
#

data doesnt work on fields

tender shard
#

it doesnt?

remote swallow
#

bc im bored

tardy delta
#

not applicable to fields

tender shard
#

oh well then use Getter Setter

tardy delta
#

this is starting to feel like cf

#

acf

tender shard
#

lombok is awesome for many things imho

hollow cliff
#

yo can someone help me make a plugin that would simply respond a message when typed in? i have no knowledge of java or plugins

bright jasper
#

idk why people hate lombok but i've stopped using it recently just because

#

i just either use kotlin or deal with having IDEA autogenerate getters

tender shard
#

?learnjava

undone axleBOT
tardy delta
#

this is starting to get messy, do people place them after the access specifier or smth?

#

any conventions?

tender shard
#

Before

#

Preferably above

#

You can also @Getter the whole class

#

Instead of every field

tardy delta
#

lemme guess, there will be one field that should not be exposed

remote swallow
#

also ouch

#

why are your annotations mid of the access modifiers

tender shard
remote swallow
#

how does lombok generate getters at compile time

#

thers nothing in the class for Getter

tender shard
#

I usually do it like this

#

or if you annotate the whole method, you can use Getter(AccessLevel = ...) exempt certain fields

tardy delta
remote swallow
#

is there no other way

tender shard
#

what's wrong with that?

remote swallow
#

effort

tardy delta
#

modify classfile

tender shard
remote swallow
#

thats a lot of words

tender shard
remote swallow
#

which is gradle

tender shard
#

javac

tardy delta
#

their code looks like it could use some lombok too

remote swallow
#

which field actually generates it

tender shard
#

wdym

remote swallow
#

method

#

which method actually generates it

tawny remnant
#

How do I cast a ray that checks for blocks in its way?

young knoll
#

There are several rayTrace methods

#

In World and Player

tardy delta
#

bruh how would i translate this to a getter and setter?
iconTable[u.iconId = lastCid++] = region;

#

isnt lastCid used as index

#

so iconTable[lastCid] = region;

#

idk when setIconId is called

tender shard
round finch
#

bruh 🤦‍♂️
i freaking forgot how to apply EnchantmentStorageMeta to a sword

tawny remnant
#

Can anyone help me with this function? Im trying to raycast in the player direction and check if there are blocks in the way. If not ill teleport the player to the final location. If there are blocks in the way send a message to the player.
https://paste.md-5.net/ezajuvimed.coffeescript

young knoll
#

Loop enchantments on the meta and add them to the sword

tender shard
#

not tested, but I guess this should do like vanilla would do it

    /**
     * Applies an enchanted book to an item. This will not apply incompatible enchantments (either because the target item type doesn't support it, or because it conflicts with an existing enchantment), unless {@param ignoreRestrictions} is set to true.
     * If the target item already has an enchantment of the same type, the higher level will be applied. If both levels are the same, the level will be increased by 1.
     *
     * @param book               Book to apply
     * @param target             Target item
     * @param ignoreRestrictions Whether to ignore restrictions
     */
    public static void applyBook(final EnchantmentStorageMeta book, final ItemStack target, final boolean ignoreRestrictions) {
        final Map<Enchantment, Integer> existingEnchantments = target.getEnchantments();
        final ItemMeta meta = Objects.requireNonNull(target.getItemMeta());
        
        newEnchantments:
        for (final Map.Entry<Enchantment, Integer> entry : book.getStoredEnchants().entrySet()) {
            Enchantment enchant = entry.getKey();
            int level = entry.getValue();
            if (!ignoreRestrictions) {
                if (!enchant.canEnchantItem(target)) {
                    continue;
                }
                
                existingEnchantments:
                for (Enchantment existingEnchant : existingEnchantments.keySet()) {
                    if (!enchant.conflictsWith(existingEnchant)) {
                        continue newEnchantments;
                    }
                }
            }
            final int existingLevel = existingEnchantments.getOrDefault(enchant, 0);
            if (existingLevel > level) {
                continue;
            }
            if (existingLevel == level) {
                level++;
            }
            meta.addEnchant(enchant, level, true);
        }
        target.setItemMeta(meta);
    }
ocean hollow
#

why it can be null?

tender shard
young knoll
#

location can probably be null at that location

#

o right locations weak reference world

ocean hollow
#

Is it complaining about this line, or because of an error in it, or inside?

quaint tapir
#

@brave sparrow Hello Mr Alex
I think you're probably the best person to ask this question as you worked on something like this in mineplex

Could you give me any directions on how the raid world for witherton was programmed
Like how do you create a new raidworld and how did you manage multiple raids happening at the same time
I want to be able to create a similar system which allows players to be teleported into a dungeon but I can't find any helpful videos online so I figured I'd ask for help
Any info would be greatly appreciated
Thanks Mr alex

tender shard
ocean hollow
#

yes

tender shard
#

then your inv is simply null

tardy delta
#

those two should be the same right?

tender shard
#

no

#

lastCid++ returns the current lastCid

#

++lastCid returns the current lastCid + 1

#

oh wait you do setIconId

#

yeah well then it should be the same I guess. no idea what your setIconId does

tardy delta
#

just a simple setter

rare rover
#

does anyone got a good hex code translator? I used to have a good one but lost it

#

ig i could make my own

tender shard
#

I just regex replace &#123456 with &x&1&2&3&4&5&6

tardy delta
tender shard
#

while lastCid is in the current class / instance

#

so no idea

tardy delta
#

well i made the iconId private instead of public at the bottom

#

and wrote a getter and setter

rare rover
#

what was replaced with .of()?

remote swallow
#

would anyone know how to go about using aspectJ to make the @Debug thing, i went and asked chatgpt but it just spat out incorrect stuff or not what i asked

tardy delta
#

Player#hidePlayer(Plugin, Player)

rare rover
tardy delta
#

wrong import

#

net.md5 you need

subtle kite
#

So like a mod can see a owner in /v , yes with permissions

rare rover
#

O

#

thanks

copper hemlock
#

How can I "spawn" a bed normally? I got a location and set it's block to a bed but it only sets the a half of the bed

tender shard
#

by passing the correct other player?

#

player1.hidePlayer(..., otherPlayer) will make player1 not see otherPlayer

rare rover
tardy delta
#

oh man

zealous osprey
tender shard
#

120 chars limit

tardy delta
#

idk

tender shard
#

or whatever is configured

zealous osprey
#

ik there's something similar in... Fortran? Cause screens used to stop there.

tender shard
#

yeah it's the "Visual guides" setting, 120 by default

subtle folio
#

is there anyway to view all your projects in the project sidebar, like in eclipse ?

tender shard
#

just open the IdeaProjects folder lol

remote swallow
#

theres a thing bottom right

#

it has a popup with all projects

tender shard
#

this also works

tender shard
remote swallow
#

one sec

young knoll
#

Huh

#

I actually didn't know inteliJ had that

remote swallow
#

move to intellij

tender shard
#

Oh you mean the „recent projects“

remote swallow
#

it has a sroll bar

tender shard
#

On mac Ij can open several projects in one window btw

#

On windows it cant

compact haven
#

no he means the bottom toolbar

#

yeah that’s throw if so

#

the new ui is so weird

#

looks cool but like wtf

#

hamburger menu for window toolbar

tardy delta
young knoll
#

File is

tardy delta
#

this looks more like c# than java

compact haven
#

what the fuck

#

have they ever heard of a constructor, or a builder pattern

#

or kotlin named parameter constructor W

tardy delta
#

thy also have a Fi class which is basically a File wrapper and does some nonsense with old api

#

not even a Path

livid dove
#

Im having a dumby java moment.

When making an instance of a plugin's api (e.g: The Coreprotect api) but i need it to be utilised in several classes, whats the general solution there?

compact haven
#

dependency injection

#

!di

#

fucking tags

haughty storm
#

How could I disable the collision between an entity and a player

livid dove
compact haven
#

yes

compact haven
#

also you don’t make an instance of the API

haughty storm
compact haven
#

Make sure you aren’t making an instance of the API please

#

odd, did u try google

tardy delta
#

does it make sense to wrap a bufferedreader around a buffered inputstream?

compact haven
#

however that javadoc concerns me, it says how players collide

haughty storm
tardy delta
compact haven
#

that’s definitely the worst case

subtle folio
tender shard
#

true

haughty storm
ancient basin
#

Hello, after a couple of months without coding any plugin, I want to create new things but I got a problem when I'm launching the server.
I got a start.bat with the following code:

@echo off
java -Xms1G -XX:+UseG1GC -jar spigot-1.19.jar nogui
pause

And when I'm launching the the server, I got this error:

Starting server
Unsupported Java detected (63.0). Only up to Java 18 is supported.

By the way, I got Java 19 as I can see when I'm using the command java --version:

java 19.0.2 2023-01-17
Java(TM) SE Runtime Environment (build 19.0.2+7-44)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing)

If someone got the solution, thanks in advance for your help!

sullen marlin
#

1.19 only supports up to Java 18

#

19 is bigger than 18 and therefore not supported

#

Just use java 17, this is the standard version now

ancient basin
#

up to don't means "higher or equal" ?

sullen marlin
#

It means lower or equal

ancient basin
#

Oh okay 🥲

#

My bad

#

It's working now, thanks 🙂

tardy delta
#

bruh why did this man create his own annotations

#

he probably has his own annotation processor too

#

ill be very happy if this thing actually runs

round finch
young knoll
#

Try in survival

round finch
#

same thing

young knoll
#

How are you setting the output

round finch
#

i set result

tardy delta
#

dammit

round finch
tardy delta
#

gradle is a joke to me

tender shard
round finch
#

and there is only the plugin i'm coding

tender shard
#

hm idk then

tardy delta
#

is it normal that when i delete the build folder in gradle, all code becomes an error?

#

and when building it goes away

round finch
#

i'm using PrepareAnvilEvent

#

no cancel

tender shard
copper scaffold
#

Can someone help me with configurations? trying to save/copy the config.yml from my plugin file/jar into plugin/<plugin-name> has someone a advice, tutorial or a example code?

tardy delta
#

also it cant seem to find my lombok getters

#

but nothing is in red ^^

remote swallow
copper scaffold
#

is that everything?

#

does that override the saved config after restarting the server

remote swallow
#

no

remote swallow
copper scaffold
#

okay thx and writing and reading in that file is that possible? i mean with code

remote swallow
#

getConfig() in ur main class or plugin.getConfig() if you have di

copper scaffold
#

okay thx

tender shard
#

don't forget to save the file after changing it

copper scaffold
#

is getConfig() FileConfiguration?

remote swallow
#

yes

copper scaffold
#

k thx

tender shard
#

it's even a YamlConfiguration

regal scaffold
#

Is there any way to have a config.yml file that's not editable

tender shard
#

what would the purpose of that be

regal scaffold
#

Like, that the user can't see

#

Disable the option to edit stuff

tender shard
#

just dont include a config?

#

o0

regal scaffold
#

Without having to copy everything into the plugin itself

#

Line by line

tender shard
#

don't call saveDefaultConfig()

rough drift
#

Is there a way that I can get a BlockState from a block or something to represent a snapshot of it?

regal scaffold
#

Can I still access it?

tender shard
#

then you can read the included config.yml but you don't have to save it

regal scaffold
#

Fantastic!

#

Thanks

tender shard
#

yes, getConfig() lodas the included config

rough drift
#

I am so dumb lmfao

tender shard
#

lol

round finch
#

i feel you ikevoodoo
it happens for me too

#

.

I were thinking maybe it is a client side issue idk
my problem

wary harness
#

is it possible to modify spigot logger format ?

#

I want to remove original timestamp

regal scaffold
#

Alex how can I access another yml file that's bundled in the plugin but never saved

remote swallow
#

JavaPlugin.getResource()

regal scaffold
#

Thanks

remote swallow
#

should give you an input stream, make that an input stream reader and you can YamlConfig.load() it

sterile token
#

Why when selecting a cuboid region between 2 blocks, the borders are not protected, its just protecting the blocks inside the 2 corners

quiet ice
next parcel
#

hey, im new to minecraft development in general so forgive me if this question's dumb.

i got intelij & im working on a server project along with other devs who have the server project in github, yada yada
it seems like the spigot dependency is missing for me which is making it hard for my highlighting & importing stuff but for others it works completely fine, is there a way i could fix this?

let me know if i can reword this better

regal scaffold
#
        InputStream guiFile = plugin.getResource("gui.yml");
        YamlConfiguration.loadConfiguration(new InputStreamReader(guiFile));
tender shard
#
    private YamlConfiguration getIncludedConfig(String filename) {
        try (InputStream stream = getResource(filename); InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) {
            return YamlConfiguration.loadConfiguration(reader);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }
regal scaffold
#

I assume this what you mean

#

Oh, more profesional ig

wary harness
#

works on paper but not in spigot

ancient basin
#

I want to create a random spawn using a random x and y. How to get the z coordinate of the ground to make the player not spawn on the air or inside a block ?

quiet ice
tender shard
#

returns a Block

#

or getHighestBLockYAt returns the Y coordinate

sterile token
tender shard
#

fuck mojang. why did they add suspicuous sand, but no brushes yet

remote swallow
#

brushes exist

#

in the datapack

tender shard
#

hm the wiki says upcoming in 1.20

remote swallow
#

all existed pre snapshot this week, so would be in datapack

young knoll
#

sus sand is also 1.20 preview

tender shard
#

besides breaking the block like normal

remote swallow
#

hold left or right click sus sand

young knoll
#

right click

remote swallow
#

i think its right click

tender shard
#

right click with brush doesnt do anything

remote swallow
#

hold it

tender shard
#

I did

remote swallow
#

one moment

young knoll
#

Should work

#

Do you have the datapack enabled

remote swallow
#

imma boot 1.19.4 iirc

#

iirc?

#

one min

#

brain smooth

tender shard
young knoll
#

Yeah that's probably why

remote swallow
#

theres why

tender shard
#

well bullshit then, why do they add things that only work if you install additional stuff lol

#

I mean, then the brush and the sus sand should go into the datapack as well

remote swallow
#

if you obtain it via bukkit its not int he game

sullen marlin
#

Sus sand is not a thing

#

Right

remote swallow
#

it is

young knoll
#

It is

tender shard
#

it is sus sand

round finch
young knoll
#

Also you aren't meant to be able to get those items without the datapack enabled

sullen marlin
#

Suspicious not Sus lol

remote swallow
#

same thing

young knoll
#

No one will use the fully name

remote swallow
#

coll go find that video

round finch
#

nah fam you're sus

#

too much Suspicious soup

lost matrix
#

"sussing out gravel"

#

mmmkay

steady sand
#

I dont get it how to develop

#

A plugin

#

🥲

lost matrix
#

Do you know Java?

steady sand
#

Yea

#

Actually

lost matrix
remote swallow
#

i just found something

remote swallow
#

vanilla mc, no mods /jfr is a command

steady sand
#

Ok thx

steady sand
#

Ill read it

lost matrix
sterile token
lost matrix
sterile token
lost matrix
#

Just create a BoundingBox using BoundingBox.of(blockA, blockB);
This creates a BB which includes both corners.

sterile token
lost matrix
#

Then copy the code of BB

sterile token
#

Yes i did that

#

But happen what i explain before

eternal oxide
#

or extend BB

sterile token
eternal oxide
#

ah

tender shard
#

ugh why is installing the datapack so fucking complicated wtf o0

remote swallow
#

bc its probably not the best for servers

#

even though client and server are identical

tender shard
#

also why did they still not finish the bundle? it's been like 4 versions now since they added it without actually adding it

young knoll
#

¯_(ツ)_/¯

small timber
remote swallow
#

?paste the error

undone axleBOT
small timber
#

it isnt an error

#

it's just returning null even though the file does exist

remote swallow
#

im guessng its file location being wrong, use new File(JavaPlugin.getDataFolder + File.seperator + "plots", file) instead

sterile token
remote swallow
#

its an example

small timber
#

so what can I sue

remote swallow
#

an instance of your plugin

remote swallow
#

it will, with an instance of your plugin

young knoll
#

Smh epic use # to denote instance methods

remote swallow
#

brain too smooth rn

sterile token
small timber
#

you can ask me

#

btw

sterile token
#

oh sorry

remote swallow
small timber
#

some, i'm still learning

sterile token
#

Right, i wont touch spigot api

#

Without knowing the lang itself, atleast the importants things, access modifiers, fields, methods, etc

small timber
#

i know that xd

#

i know those things

sterile token
#

oh ok

#

So what your issue?

small timber
#

when I run a command to delete a created plot, one of the methods is to delete the yaml file of the plot, but when I run the command, the file doesnt delete and it returns null

sterile token
#

okay

#

So are you tracking each player file somewhere?

small timber
#

each plot has its own file

sterile token
#

okay, why using yaml as storage? Its mostly designed for making configurations

small timber
#

i didnt want to use databases

#

too much work, i cba

sterile token
#

yes, but if you want to make good i iwould use a db

#

But meh its up to you

#

I would get the file object of the plot you want to delete, and then use File#delete()

small timber
#

well, that's exactly what im doing already xd

#
        File file = new File("plots/" + location.getWorld().getName() + "/" + location.getBlockX() + "," + location.getBlockZ() + ".yml");
#

what's wrong with this his line

#

the name of the files are the coords of the plot

#

-38,-24.yml as an example

tender shard
tender shard
#

use new File(parent, child)

young knoll
#

The file constructor handles slashes anyway

tender shard
#

or at least use File.separator()

small timber
#

i've never used a fire seperator, how does it work?

#

file*

#

sorry

hazy parrot
#

It's basically different char impl based on os

tender shard
#

instead of using / you do File.separator()

small timber
#

that isnt the problem though, I had it to log file name it's meant to delete and I think it's to do with the rounding of the coords?

#

something like that

#

the file format is fine,it's the coords trhemselves

young knoll
#

The file should be relative to your plugins data folder

#

What does java default to for the parent directory? Is it the same directory the jar is in

tender shard
#

the working dir

livid dove
#

Am i being a dumby?

tender shard
lost matrix
livid dove
lost matrix
tender shard
#

you probably shaded the API

lost matrix
#

^

tender shard
#

<scope>provided

lost matrix
#

That would be my first guess as well

tender shard
#

in pom.xml

livid dove
tender shard
#

are you using maven?

livid dove
#

yup

tender shard
#

set the scope of the lands dependency to provided

livid dove
#

OH M OTHER

tender shard
#
<dependency>
  <artifactId>Lands-Whatever</artifactId>
  ...
  <scope>provided</scope>
livid dove
#

Reason I question marked is because I didnt think would be it

#

earlier today

#

had issues with maven and whilst fucking around had removed the provided scope

#

forgot to add back in

tender shard
#

if you remove it, it defaults to compile

#

so your plugin used the included version of lands which of course never got initalized or whatever

livid dove
zealous osprey
# livid dove Am i being a dumby?

Idk what the subject is about or what's going on, but I would recommend putting your prefixes for things, like LandsUtilities into a getter or some variable, so you only have to change that one thing, if you lateron decide to change the prefix.

small timber
#

ok i found the problem

#

Math.floor(location.getBlockX())) + "," + (Math.floor(location.getBlockZ()))

tardy delta
#

i found my problem: using gradle, 500 lines build.gradle smh

small timber
#

instead of down

#

even though i'm using math.floor

small timber
#

why is this happening?

tardy delta
small timber
#

ceil rounds up

#

not down

#

i want it to rownd down

remote swallow
#

too much

small timber
#

but that will round 2.7 for example to 3

#

and i want it to drop it to 2

tender shard
#

that is the worst build.gradle I ever saw

remote swallow
#

oh alex if you want an example gradle multi module thing with nms look at epic spigot lib

#

jefflib hurts too much

tardy delta
#

dont blame me

#

i dont understand a shit of that magic

#

ill probably rewrite it

#

dude also using sun internal classes for annotation processing

tender shard
tardy delta
#

anways its time to sleep

tender shard
#

link?

#

I couldnt find it on google

remote swallow
#

i found it from just looking at projects

tender shard
#

hm it also has no spigot remapping

remote swallow
#

paper weight

tender shard
#

yeah

#

paper api

remote swallow
#

its the best we get

#

theres ways to set it up to use special soruce and hand remap stuff

tender shard
#

i just let maven do it for spigot

copper scaffold
#

is there a way to save a changed configuration with the code and if so how do i do that?

tender shard
#

saveConfig()

#

in JavaPlugin

copper scaffold
#

okay thx

tender shard
remote swallow
#

it does?

haughty storm
#
        ScoreboardManager manager = Bukkit.getScoreboardManager();
        assert manager != null;
        Scoreboard board = manager.getNewScoreboard();
        team = board.registerNewTeam(getPlayer().getName() + " -- " + UUID.randomUUID().toString());

        team.addEntry(getPlayer().getUniqueId().toString());
        team.setDisplayName("display name");
        team.setCanSeeFriendlyInvisibles(true);
        team.setAllowFriendlyFire(false);
        team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.ALWAYS);

I have this code to create a team. When I put another entity in that team, it can still collide and damage the player though. Could you tell me what I'm doing wrong?

tender shard
#

why don't you just shade it instead

remote swallow
#

PDT over DatType

#

im lazy

#

wait a minute

tender shard
remote swallow
#

its an inteface

tender shard
#

not that I#d care, just wanted to mention it lol

remote swallow
#

would it still work how i have it now, with PDT.whatever if i implement it in a class

tender shard
#

wdym?

remote swallow
#

if i implement DatType in PDT, making it a class i would still be able to do PDT.STRING or whatever i feel like at the time

#

gonna test that rq

tender shard
#
public class PDT implements DataType {
}

remote swallow
#

it does

#

im happy

#

i now dont violate a license

tender shard
#

gradle kills my cpu

remote swallow
#

ratio

tender shard
#

instead of having to copy/paste

remote swallow
#

oh also, i can build my spigot lib using paper weight without needing anything else done (buildtools etc etc) in like 4 min

remote swallow
quaint mantle
remote swallow
#

then i got lazy and just had the PDT interface and shaded more persistent data

tender shard
quaint mantle
tender shard
remote swallow
#

most builds i have github workflows do take like 5

#

my pc took like 12

#

its still quicker than running buildtools

young knoll
#

It depends on how many versions you depend on

#

Since userdev decompiles each one

remote swallow
#

adds like 2 min each version

tender shard
# quaint mantle

some dependency is fucked up.

run grep through your .m2 folder and see what it prints

grep -rnw ~/.m2 -e '\u0000'
young knoll
#

It caches them, but I think it's per project instead of systemwide

remote swallow
#

yeah

#

its saves it .gradle/caches/paperweight

tender shard
#

that explains why cloning a gradle repo always takes like half an hour

#

it's still not done, after 17 minutes now lmao

#

I could have ran buildtools for every version from 1.16.1 onwards during that time

remote swallow
#

could you?

#

wtf is that pc

tender shard
#

1.19.4 takes about 1 minute remapped

remote swallow
#

what the fuck

tender shard
#

m2 max

#

wait lemme check again

young knoll
#

Yeah it doesn't take me long to build

quaint mantle
young knoll
#

Only if it's cached tho

remote swallow
#

my last build with github workflows takes 6 minutes to build

young knoll
#

Idk how much buildtools caches

livid dove
#

So turns out even with the scope provided and proper im still geting my bug

quaint mantle
#

Does that mean that maven broke up all my dependencies?

tender shard
#

cached 30 seconds for 1.19.4 remapped

copper scaffold
#

how can i edit the config file in /plugin/<plugin-name>/?

remote swallow
#

i should 100% make a bat script to allows me to buildtools ver -flags

tender shard
grave plover
zealous osprey
#

How do you get this list again, including the prefix? Is there a function for it, or do I have to modify the Material#values array.

remote swallow
#

modify with YamlConfiguration#set("path", value)
then JavaPlugin#saveConfig()

tender shard
#

On Material

#

Or just getKey or getNamespacedKey

#

Sth like that

#

The translation key will be eg minecraft:block.dirt or sth

#

The normal key is just minecraft:dirt

sterile salmon
#

I'm trying to make fist contribution to the Spigot-Server, can anyone help with how I should comment my changes? Right now, I'm patching this

public void stopRiding() {
    this.removeVehicle();
}

to this

public boolean stopRiding() {
    return this.removeVehicle();
}
tender shard
#

what the heck is a fist contribution lol

#

fisting plugin when?

sterile salmon
#

first* XD sorry

tender shard
#

"you got fisted by mfnalex"

tender shard
#

I doubt that this would get merged though, it would break existing plugins

sterile salmon
#

whether or not it actually stopsRiding

#

Because you can cancel the unmount event

#

Which leads to a ton of unintended behavior

tender shard
#

ah okay. anyway, changing the return type will break compatibility for existing plugins because the method signature has changed, IIRC

#

not sure though

sterile salmon
#

Theoretically changing from void to boolean really shouldn't have any effect

#

Except for maybe some reflection stuff

#

It's also done in a few places in the Spigot/Craftbukkit patches already

tender shard
#
#

the return type of the invoked method is part of the byte code of that invocation, too. As developers writing code in the Java language, this might come at a suprise at first, as we tend to think of just a method’s names and its parameter types as the method signature. For instance, we may not declare two methods which only differ by their return type in the same Java class. But from the perspective of the Java runtime, the return type of a method is part of method signatures as well.

sterile salmon
#

So I'm not an expert on this at all, but this is an nms function and not an API function, so as long as the API's signature doesn't change wouldn't it be fine to change?

wet breach
tender shard
young knoll
#

Yes

wet breach
young knoll
#

WorldCreator to make a custom world

#

ChunkGenerator for custom world generation

#

WorldCreator can also load worlds

#

Or you can just load it with something like Multiverse

tender shard
#

building 10 spigot versions is literally 3 times faster than waiting until gradle setup paperweight for 6 spigot versions lol

remote swallow
#

how is it not done

#

my pc is shitter but can do it so quick

sterile salmon
tender shard
#

But building 10 versions from scratch took only 7 minutes

remote swallow
#

ig ur pc isnt optimized for gradle

tender shard
#

Lol no gradle cpu flag

tender shard
#

Or however its called

#

?contribute

tender shard
#

The last one should explain it

#

And the second i think

sterile salmon
#

Yeah, I get that, just worded it poorly
Specifcally, my guess would be

// Spigot start
public boolean stopRiding() { // PAIL void->boolean
    this.removeVehicle();
}
// Spigot end

is that right?

#

^I'm talking about where to put the start and end comments

tender shard
#

I guess. I only ever added stuff to craftbukkit, not nms directly

#

So i never needed those comments 😄

#

Looks good to me

sterile salmon
#

Well, I guess someone will tell me if I'm wrong ¯_(ツ)_/¯

tender shard
#

True lol

#

I always forget to run checkstyle

#

Enable the development profile, then see if throws errors

#

A tax plugin

remote swallow
#

make md and choco the tax men

worldly ingot
#

I don't know what stopRiding() is from so I can't really inform you how to comment your code @sterile salmon

tender shard
#

Players have to declare their ingame income or they get fined

pseudo hazel
#

minecraft has a lot of model types for being such a blocky game

sterile salmon
worldly ingot
#

Is this set for Spigot? Or CraftBukkit

sterile salmon
#

Spigot, I'm fixing an issue with EntityUnmountEvent, which isn't in CraftBukkit (I believe)

worldly ingot
#

It isn't, yeah. So comments would be better like this imo

// Spigot start - Change return type from void to boolean (must be done to overriding classes as well)
public boolean stopRiding() {
    return this.removeVehicle();
    // Spigot end
}
#

(though the last parenthesis can be ignored if that's not the case)

#

We use PAIL for access changes and renames

sterile salmon
#

Cool, in just a second can you check another function for me?

worldly ingot
#

Yepyep

remote swallow
#

🎵 chocos pr confirming service 🎵

sterile salmon
# worldly ingot Yepyep

Alright,
Original

    public void removeVehicle() {
        if (this.vehicle != null) {
            Entity entity = this.vehicle;

            this.vehicle = null;
            if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit
        }

    }

Modified

    public boolean removeVehicle() { // Spigot void->boolean
        if (this.vehicle != null) {
            Entity entity = this.vehicle;

            this.vehicle = null;
            // Spigot start
            if (!entity.removePassenger(this)) {
                this.vehicle = entity; // CraftBukkit
                return false;
            }
            return true;
        }
        return false;
        // Spigot end
    }
#

Also in Entity,java

worldly ingot
#

I'd adjust your end comments because we're not touching that closing bracket

    public boolean removeVehicle() { // Spigot void->boolean
        if (this.vehicle != null) {
            Entity entity = this.vehicle;

            this.vehicle = null;
            // Spigot start
            if (!entity.removePassenger(this)) {
                this.vehicle = entity; // CraftBukkit
                return false;
            }
            return true;
            // Spigot end
        }
        return false; // Spigot
    }```
#

Rest LGTM

sterile salmon
#

Thanks!

worldly ingot
#

inb4 md_5 disagrees LUL

young knoll
#

the heck is pail

#

I thought it was called bukkit

remote swallow
#

water

#

a pail of water

tender shard
remote swallow
#

wat

#

oh

#

its probably setup to only gen full javadocs on publish

tender shard
#

and ofc all the modules have one separate .jar but that's not the idea is it?

#

yeah but where is the final jar that one would use?

#

the one that includes core AND the nms stuff?

remote swallow
#

on my repo

tender shard
#

but where does it get generated

#

when running gradlew build?

remote swallow
#

gradlew publish

#

i make github workflow do that htough

#

yeah, i dont have gradlew build setup

tender shard
#

even when I uncomment the repo and do gradlew publish, there is no .jar anywhere

#

I mean, it must create it SOMEWHERE?

remote swallow
#

yeah, it generates it and publishes it

tender shard
#

yeah but where does it save it before uploading?

remote swallow
#

no clue

tender shard
#

lmao gradle

remote swallow
#

my dog just let out a ripper

sterile salmon
#

@worldly ingot I actually have one more
Original

    @Override
    public void rideTick() {
        if (!this.level.isClientSide && this.wantsToStopRiding() && this.isPassenger() && this.stopRiding()) {
            this.setShiftKeyDown(false);
        } else {
            ... 
        }
    }

Modified

    @Override
    public void rideTick() {
        if (!this.level.isClientSide && this.wantsToStopRiding() && this.isPassenger() && this.stopRiding()) { // Spigot - moved stopRiding to condition so else statement is called when entity does not dismount
            this.setShiftKeyDown(false);
        } else {
            ...
        }
    }
#

I think I might need to keep the this.stopRiding() inside the if-statement but commented out

worldly ingot
#

I think you fucked up your original lol

#

Though the comment looks fine

sterile salmon
#

My bad XD

desert frigate
#

since this is deprecated what else should i use

skull.setDisplayName(player.getName());```
sterile salmon
#

The original is a bit important for context though

sterile salmon
remote swallow
#

if its ItemMeta

remote swallow
tender shard
desert frigate
desert frigate
tender shard
#

@remote swallow where are the ones for 1.19 etc?

#

you use the same package for all of those so shadow ofc can only include one

remote swallow
#

is my brain that dumb

young knoll
#

(Seriously what is PAIL google is not helping smh)

#

Kids and their acronyms

remote swallow
kind hatch
worldly ingot
#

Don’t think it has any meaning

remote swallow
#

so why is it used

worldly ingot
#

I always assumed it was Please Add In Later lol

young knoll
#

What does it mean in this context

sterile salmon
young knoll
#

No commit credit for you :p

remote swallow
livid dove
#

Can someone go sanity check getting the LandsAPI initiated as I stg I'm going utterly nuts

sullen marlin
#

the boolean is probably better, but as you saw it means a lot of override changes and also potential hidden breakages

#

generally if the signature of a method is changing you need to keep the old one as well, which I guess would have been an option here

#

but given its currently just one spot, the isPassenger check probably suffices

sterile salmon
#

The current behavior seems like it would mess up my specific use case (I'm making a slide mechanic by mounting the player on an invisible turtle)

#

Essentially, it would force unshift them as soon as they shift

sullen marlin
#

how so?

sterile salmon
#

Hold Shift->Tries to dismount but cancelled-> server-side isCrouching value set to false (in that code snippet) -> mismatch between isCrouching and whether the player is actually crouching

sullen marlin
#

setShiftKeyDown(false) is only called if they did dismount

#
+                this.setShiftKeyDown(false);
+                return;
+            }```
sterile salmon
#

You're right, I was looking at the commit diff and missed the minus sign

#

Thanks again for the fix

sullen marlin
#

no problem

sick edge
#

Is there any way to get the players of a scoreboard team or should I keep track of them on my own?

jagged monolith
sick edge
jagged monolith
#

It gets all Entries on the team

sick edge
#

Ok and how can I cast it to a player?

jagged monolith
#

There is no dedicated getPlayers because teams can have more than just players as entries

#
if (team.getEntries().contains(<player name>)) {
  Player player = Bukkit.getPlayer(<player name>)
}

That's one way, if you know the players name.

sick edge
#

ah ok it contains the name thx for the info

wary harness
#

can soem one help with this

jagged monolith
# sick edge ah ok it contains the name thx for the info

If you want to cast all players in the team, you could do something like

List<Player> players = new ArrayList<>();

for (String name : team.getEntries()) {
  if (Bukkit.getOnlinePlayers().contains(name) {
    players.add(Bukkit.getPlayer(name))
  }
}

Then just call players whenever you need to get a player from the team.

#

Probs not the most efficient way, but it would work

jagged monolith
wary harness
#

malformed

#

?

jagged monolith
#

Meaning broken, syntax error

sick edge
wary harness
#

some tutorial

jagged monolith
undone axleBOT
quaint mantle
#

Is there a way of checking if a Material is crafted by wood like is there a method to get the recipe then see if it contains wood