#help-development

1 messages · Page 375 of 1

vocal cloud
#

Or at least that's what you do in maven

mortal hare
#

i've tried it, it just refuses to work

vocal cloud
#

In maven it's easy and a lot of projects recommend it for optional features

#

Sadly never done it in gradle

tender shard
#

Dude just threw an aci construction at me

#

You should consider to just use maven, there everything just works. Trying to get this to work in gradle will waste many hours of your time

green tapir
#

Material.TNT = e.getPlayer().getPlayerItem

subtle folio
#

You can get the material of the players held item

onyx fjord
#

Send entire code snippet

green tapir
#

thats basically all for now

subtle folio
#

Material mat= e.getPlayer().getInevntory().getItemInMainHand().getType();

green tapir
#

its a listener

onyx fjord
#

No that's not real code

green tapir
#

im udm

subtle folio
#

then check if material == Material.TNT

subtle folio
eternal oxide
#

.getType()

onyx fjord
#

I have my doubts it even exists

subtle folio
green tapir
#

ohh

subtle folio
#

my typo my bad

green tapir
#

what is = and == difference?

onyx fjord
#

...

eternal oxide
#

its basic java

onyx fjord
#

= sets something
== Compares values

eternal oxide
#

?basics

undone axleBOT
subtle folio
#

it's important to know the basics before trying to make a java plugin

zealous osprey
#

"==" is only realiable though for Enums and primitives, for anything else, like Strings use #equals

onyx fjord
#

Yeah it checks if it's the same exact thing right

zealous osprey
#

For primitives and for anything else it checks the address pointer, I think?

onyx fjord
#

Yeah I think so

subtle folio
#

smt like that

onyx fjord
#

Because it fucked up for me once

#

Learned the hard way

zealous osprey
onyx fjord
#

Equals is also null safe iirc

tender shard
#

No

#

you need sth to call equals(…) on

subtle folio
#

Object.RequireNotNull() is needed

zealous osprey
tender shard
#

Yes

mortal hare
#

ok can someone explain what happens if i use provided inside maven

#

how tf does the java knows

#

what .class file to use

#

if its not inside the jar file

#

when compiled

hazy parrot
#

Because that artifact/groupid is already provided at runtime

mortal hare
#

yea ik that, but how does the code run

hazy parrot
#

And with import, you declare what exact class will be used

mortal hare
#

when none of the libs are inside the jars classloader

halcyon hemlock
#

Hivgaugs

#

Hii guys

hazy parrot
#

Well, class is loaded somehow inside of runtime env

#

For example log4j in spigot, you can put provided in your plugin

#

Because spigot shades it

mortal hare
#

so if no classes are available inside runtime

#

you need to shade them

#

right

hazy parrot
#

Exactly

mortal hare
#

that's whati thought

tender shard
tender shard
tender shard
mortal hare
#

i fixed my issue

#

it turns out the real shadowJar task file outputs at *-all.jar

#

package

#

so it wasnt a real issue after all lol

#

now it lacks snakeyaml in bukkit implementation

#

while in core classes it includes it

tender shard
#

i thought you knew that lol

tender shard
#

remember that bukkit relocates snakeyaml

#

so you'd need a relocate thing in your shadow thing too

#

one line in maven but probably quite complicated in gradle lol

mortal hare
#

nah it easy on gradle

#
// Relocating a Package
shadowJar {
   relocate 'junit.framework', 'shadow.junit'
}

#

@tender shard it seems it doesnt relocate anymore

#

all those dependencies are loaded at runtime

#

or this might be only paper thing

quaint mantle
#

is it better to create multiple @EventHandlers for a event (i.e AsyncPlayerChatEvent) or just create one and run functions for better performance?

eternal oxide
#

depends what you are doing

tender shard
#

it usually does not matter at all "performance-wise"

#

unless you wanna register 500 listeners for PlayerMoveEvent

#

and in that case, your logic is flawed anyway

#

sooo don't worry

quaint mantle
#

thanks

quaint mantle
tender shard
#

whether you have 5 or 20 listeners, doesn't matter

quaint mantle
#

got it thanks

orchid gazelle
#

ok now this is very scuffed. I am using Player#sendBlockChanges with supressLightUpdates on true. It seems to ignore this flag completely when above about y=-33 which makes my sending extremely laggy. When settings the flag to false, it appears to ALWAYS lag
I can see some laggy shadows getting removed and added in the lag, too. Does not matter if its on superflat or normal

rapid aspen
tender shard
#

have you tried to debug it?

#

maybe opItemsDropCounter is not less than 3

#

maybe the player's name is not equal to GoldGamerPT

rapid aspen
#

it is

tender shard
#

add a System.out.println(...) everywhere, then see where it "stops working"

crimson terrace
#

add a few System.out statements to check out what could be wrong, its the best solution to most problems, or at least to diagnose the problems

tender shard
#

oh btw I don't see you doing any item drops at all

crimson terrace
#

world.dropItemNaturally() in line 47

tender shard
#

oh

#

havent seen that

#

mb

tender shard
#

btw you are usually not allowed to "extend" ItemStack

rapid aspen
#

i made another plugin and it works

quaint mantle
tender shard
#

no

#

it's not

quaint mantle
#

I remember looking into it once

#

Oh

#

Not in the past either?

tender shard
#

not that I recall, I also extended it years ago

quaint mantle
#

100% sure I saw that once somewhere

#

Suppose I'm just having the mandela effect then

tender shard
#

a better idea would be to make your custom item stack class not extend itemstack directly, but just be some wrapper that has a "getItemStack()" method or similar

tender shard
#

in 1.13 and 1.19, ItemStack definitely is not final

quaint mantle
orchid gazelle
quaint mantle
#

Ahhh

#

right

#

@tender shard the NMS version of itemstack is final

tender shard
#

ah that might be it

#

the bukkit one definitely isn't

#

what about CraftItemStack?

#

oh wait that doesnt exist

#

or does it

#

I am confused lmao

#

it's early (15 pm)

orchid gazelle
tender shard
#

my brain doesnt work yet

quaint mantle
#

CraftItemStack is also final

tender shard
#

ah ok

#

yeah then we probably were thinking of that

orchid gazelle
quasi flint
tender shard
#

my brain is too german to use english format

#

it's fucking 15 o clock

quasi flint
orchid gazelle
#

I kind of adjusted myself to that whenever writing with English people

tender shard
#

...

#

in 10 minutes

quasi flint
#

Yes

#

9 minutes now

quaint mantle
#

however

#

that 50 is now 51

quasi flint
#

Yes

quaint mantle
#

Anyways, let's not get off-topic

tender shard
quasi flint
#

Well now

#

Only 8

tender shard
#

yaaay

orchid gazelle
#

so cringe that I am always sick whenever holidays start

#

I had already planned to go out today ;-; Its a special event right here

quasi flint
#

Whats cringe Is, me getting sick Yesterday but having to write a class Test today 😂

orchid gazelle
#

better than at holidays

#

I would not care about writing a test later xD

quasi flint
#

No

#

I Had to write IT anyways

#

39°C fever, can't talk, can't breath right

#

But still having to take a damn geography test 😂

tender shard
#

39°C? snack some aspirin lol

#

and get well soon

quasi flint
quasi flint
orchid gazelle
quasi flint
#

Forgot headaches 😂

orchid gazelle
#

and dizyness

quasi flint
orchid gazelle
#

and the good old throat

tender shard
quasi flint
#

And whilst standing

orchid gazelle
quasi flint
#

Insert windows xp shutdown sound

tardy delta
#

uhh is this the wrong way to use an atomiclong? ```java
private final AtomicLong generatedYet = new AtomicLong(0);

@Override
public void generate(@NotNull GenerationUnit unit) {
    Point start = unit.absoluteStart();
    UnitModifier modifier = unit.modifier();

    Audiences.server().sendMessage(Component.text(
            "Generating chunk at %s %s (%s yet generated)"
                    .formatted(start.blockX(), start.blockZ(), generatedYet.getAndIncrement()
    ), TextColor.color(131, 201, 22)));

    for (int x = 0; x < Chunk.CHUNK_SIZE_X; x++) {
        for (int z = 0; z < Chunk.CHUNK_SIZE_Z; z++) {
          // generation
        }
    }
}```numbers dont seem very correct
#

that generate method is called by multiple threads

#

or maybe its just the sendmessage method that doesnt respect the order or smth

quasi flint
mortal hare
#

nice comments for paper devs 😄

orchid gazelle
#

but.. cmon... its holidays... why bully me???

#

I got a streak of being sick the last 3 holidays

quasi flint
#

Cmon I write class test this whole week

#

And next week

tardy delta
rough drift
#

is there an event for whenever a player's advancement progress changes?

quasi flint
#

Totally didn't happen to me twice 😂

orchid gazelle
#

yes, very nice

#

same

rough drift
#

and that's enough

quasi flint
#

My lungs are fucking dead

orchid gazelle
#

haven't eaten anything big for 2 days now lol

quasi flint
orchid gazelle
#

sounds accurate

quasi flint
#

Vomited at the other half

#

Cleaning that off the wall was

#

Not fun

ivory sleet
tardy delta
#

no, multiple threads just call that generate method

ivory sleet
#

So just a single instance then?

quasi flint
orchid gazelle
#

yeah good night

ivory sleet
quasi flint
rapid aspen
quasi flint
#

Most of the times when I wake up I don't know which day or time of day it is

tardy delta
#

ye just a single instance

orchid gazelle
tardy delta
#

dunno if getAndIncrement even assures its only updated by one thread at the time

ivory sleet
#

It increments atomically

tardy delta
#

its just not very good at counting then

ivory sleet
#

Idk, maybe generate isn’t called in a chronological manner?

#

Or like, yk sequential manner we

tardy delta
#

no clue, its just for debugging so shouldnt matter too much

ivory sleet
#

But ye, could be sendMessage also

#

@tardy delta actually

#

Maybe you want to incrementAndGet

tardy delta
#

still weird, im looking at the impl and it uses the forkjoin commonpool

ivory sleet
#

Ye

fallen patrol
#

I am currently trying to use AdvancementDisplayType. However when using it in the IDE it works perfectly fine. But the second I try to compile it using maven it tells me: cannot access org.bukkit.advancement.AdvancementDisplayType

#

Anyone happen to know why?

wet breach
tardy delta
#

imma just leave it like this then

wet breach
#

with forkjoincommonpool it doesn't necessarily create a thread for every subtask, and instead there is a deque where all the other worker threads are trying to steal work from busy threads

ivory sleet
wet breach
ivory sleet
#

Ye

smoky oak
# tardy delta

wheres the difference between @NonNull and Optional<T> in this case? For the return value

ivory sleet
#

Btw iirc fjp doesnt have a particular shared data structure where it puts the tasks, isn’t it just that every worker has its own queue of tasks, or am I getting ahead of myself now, haven’t touched that for quite a while so icl forgot implementation sorta

wet breach
rare rover
#

whats ChatColor.of() in 1.19?

#

no such thing

ivory sleet
wet breach
#

so it uses a normal queue just its an open ended queue that can be pulled from both ends

wet breach
tardy delta
ivory sleet
#

Yea, so then the workers have the deques where tasks are stored

smoky oak
wet breach
#

correct

smoky oak
#

you know me by now

wet breach
#

but there is no telling which thread gets your task and just because a particular thread is holding your task doesn't necessarily mean that thread will be the one to execute said task lol

ivory sleet
#

Optional lacks flexibility

smoky oak
ivory sleet
#

The annotation is just an annotation at the end of the day

smoky oak
#

afaik optional forces you to handle null returns so it doesnt throw an exception later

ivory sleet
#

Yes but it sucks

tardy delta
#

@NotNull does nothing, only generates warnings

#

rusts Option<T> is still the best

ivory sleet
#

Optional has no subtype that expresses absence and presence

wet breach
#

@notNull basically means you have ensured that the object or value is not null and that if it is null at this point something terrible happened and we should stop 🙂

smoky oak
#

i mean

#

optionals only purpose is to say 'this can be null. handle it'

ivory sleet
#

Like there’s no
NoneOptional extends Optional
SomeOptional extends Optional

tardy delta
#

why would it be needed?

wet breach
#

Optional doesn't necessarily mean it can be null, it means the object may not be provided or the value

#

which includes obviously nullness

ivory sleet
#

And for generics, Optional is clumsy due to restricting method overloading

tardy delta
#

im still waiting for java enum Optional<T> { SOME(T t), NONE() }

ivory sleet
#

😌

smoky oak
#

that looks wrong somehow

tardy delta
#

but ye thats rust

ivory sleet
#

sealed Optional permits Some, None {}

tardy delta
#

rust is like rs if let Some(value) = some_optional { value.do_something(); }

smoky oak
#

reminds me of if (a instanceof b B)

ivory sleet
#

Moterious, but yea there’s benefits with optional also

smoky oak
#

like

ivory sleet
#

Like, it becomes a bit harder to miss accidental poor null pointer handling

smoky oak
#
if(a instanceof B b){}

cant be negated

quasi flint
#

IT can

ivory sleet
#

if (a !instanceof B b){} when uwu

quasi flint
#

Bang a !(expression)

smoky oak
#

i mean that you cant really remove the block

quasi flint
#

Around that

wet breach
#

but yeah the biggest use of @notNull is testing and if you are making an API and where ever that method is implemented you insured to the best of your ability that it can't be null because it will throw all kinds of errors if you use that annotation and that object or value is null. But the downside is if you use it somewhere where something could be null and it does end up being null, it kind of hides or makes it harder to tell what the actual real problem is or where the problem is at

tardy delta
#

what when a is a boolean

ivory sleet
#

Hush

quasi flint
tardy delta
#

!instanceof hmmm

smoky oak
#

boolean is 8 bits minimum

hazy parrot
#

is not

smoky oak
#

unless you store it as an array ie a char

tardy delta
#

😢

smoky oak
ivory sleet
#

Dont think that was to u x)

wet breach
hazy parrot
#

I'm replying to fourteenbrush xd

wet breach
#

but it depends at what area we are specifically talking about

tardy delta
#

os just allocates 8 bits?

#

im feeling that we had this conversation before

smoky oak
#

boolean, as boolean, is stored as the same bit 8 times

wet breach
#

Well since most everything is backed by an integer in Java, the least it can be memory wise is 8bits or 1 byte. But because this Memory is located inside the Java heap, java can make use of those other bits for other things.

tardy delta
#

there are no instructions for booleans afaik, so a boolean is handled as an int

smoky oak
#

bruh

#

A Boolean has 8 bytes of header, plus 1 byte of payload, for a total of 9 bytes of information. The JVM then rounds it up to the next multiple of 8. so the one instance of java.lang.Boolean takes up 16 bytes of memory.

tardy delta
#

lol

smoky oak
#

so address + byte for storage ig

ivory sleet
#

that’s java.lang.Boolean?

tardy delta
#

we re talking about a Boolean now

ivory sleet
#

Not to be confused with boolean (primitive)

smoky oak
#

arent they auto cast

wet breach
#

no

ivory sleet
#

You have autoboxing

#

But that’s during runtime mostly

#

Or well sometimes not

wet breach
#

and even so doesn't always happen

#

because you also have autounboxing

#

as well

ivory sleet
#

Yep

tardy delta
#

doesnt the jvm inline Boolean.valueOf by the respective Boolean.X?

ivory sleet
#

Inline like as in jit compilation? Or do u mean aot?

tardy delta
#

uh no clue lol

#

what even is aot

smoky oak
#

compiles beforehand

tardy delta
#

probably that

ivory sleet
#

Ahead of time

smoky oak
#

java bytecode doesnt actually get converted into machine code unless the jvm deems it important

tardy delta
#

uhu

wet breach
#

but the primitive boolean only takes up 1 bit in the JVM heap space or the memory the JVM requested from the OS. If the JVM had to request more memory from the OS for this primitive it would need minimum just 1byte or 8bits but it wouldn't use the other 7bits instead it would probably stuff some other things that would fit there since the entire memory is for the JVM anyhow and it can use it as it sees fit or as long as the OS is happy anyways

smoky oak
#

i dont think the jvm can address those other 7 bits

#

as said afaik the jvm just fills it up with the same bit

wet breach
#

it can because the entire memory glob is assigned to the JVM

#

so if the JVM requests 1GB of ram to be assigned to it, the JVM gets 1GB assigned to it. The JVM then uses its pointers it has use of to do whatever

rotund ravine
#

It depends on the jvm, but a boolean is usually a byte

wet breach
#

those pointers are not specifically allocated for any one thing

smoky oak
#

urgh dont come at me with this 'version dependent' nonsense

#

i had enough of that with SD 1.4 vs 2.1

smoky oak
#

why the fuck does using a 2d matrix make it necessary to use full precision

mortal hare
#

doesnt the primitive boolean take up one byte

rotund ravine
#

It does usually.

wet breach
tardy delta
#

primitive booleans in the heap 👀

#

arent those supposed to be in the stack?

wet breach
#

if anything, it will probably stuff other booleans in there if it can

#

since 1 boolean uses a bit, you could fit 8 booleans in a byte

smoky oak
#

well i know that integers should be in the heap

mortal hare
#

ik you can store up to 8 boolean values in one byte by using bit toggling

rotund ravine
#

It’s very much jvm dependent

smoky oak
#

isnt stack reserved for pointers

mortal hare
#

with bitwise operations you can store up to 8 boolean values inside one byte

#

but that would require more computational power

#

due to bitshifting operations

tardy delta
#

bitset my beloved

mortal hare
#

in this modern age, its not really worth it

smoky oak
wet breach
rotund ravine
smoky oak
#

its called herd mentality

mortal hare
#

i dont think that jvm reuse leftover bits from the primitive values

#

it would cost cpu power

wet breach
#

no it wouldn't

rotund ravine
mortal hare
#

address alignment padding exists

tardy delta
tardy delta
mortal hare
#

memory is cheaper than cpu

tardy delta
#

imagine wasting a cpu clockcycles

#

🥵

smoky oak
#

like

#

minecraft is predominantly single threaded

ivory sleet
#

Lol

tardy delta
#

🤓

ivory sleet
#

40 core cpu like lmao

tardy delta
mortal hare
#

have anyone used paperweight here before

ivory sleet
#

Yes

mortal hare
#

why my dev version of jar plugin is smaller in size

subtle folio
mortal hare
#

than normal one

smoky oak
#

have one on my desk

mortal hare
#

paperweight-userdev

subtle folio
mortal hare
#

not a real paperweight lol 😄

ivory sleet
#

U’re using the test server thingy?

mortal hare
#

no

smoky oak
#

you do know that youre asking in a channel filled with people 95% can be sorted into god-complex, troll, or lurker, correct?

onyx fjord
#

how do u force ij to recheck for modules without restarting ide

mortal hare
#

i've not included it inside gradle project

#

im using it for mojang mappings

rotund ravine
#

@onyx fjord Gradle or maven?

mortal hare
#

i have two identical jar files

onyx fjord
#

i have mixed modules @rotund ravine

#

rn

mortal hare
#

but for some reason dev version is more optimised in terms of size 😄

rotund ravine
#

What’s the top one? @onyx fjord

ivory sleet
#

Isnt one reobfuscated

onyx fjord
#

gradle

ivory sleet
#

Where one isnt assuming u do use nms

rotund ravine
#

Open gradle window and look for the refresh button @onyx fjord

mortal hare
#

i dont use nms in either of one

#

rn

wet breach
onyx fjord
ivory sleet
#

Oh then that’s weird

onyx fjord
#

i tried

wet breach
#

also you can change the memory alignment of objects as well in the JVM but if you do it has to be a multiple of 2

onyx fjord
#

oh wait nvm i had to add it to project modules

spice shoal
#

guys what is the name of potion effect for haste?

wet breach
#

speed?

twin venture
#

hi , i want to create a better chance system for itemstacks ..
this is how i have it rn , and its not 100% accurate

ivory sleet
#

weighted random

onyx fjord
#

ctrl + space

wet breach
#

I told them what it is

spice shoal
wet breach
#

its called speed

tardy delta
mortal hare
twin venture
smoky oak
rotund ravine
wet breach
twin venture
#

this is how its stored :

mortal hare
#

so dev version of paperweight outputted jar reobfuscates or its reverse of that?

twin venture
#

each item have its own chance

wet breach
# mortal hare and people call me micro-optimising for using different type of hashmap

the other thing you should do, is reduce the amount of objects in a class too. While it may seem obvious that you should have less this isn't quite the case I am referring to, there is a pool for objects in classes that is a certain size and if you go over it, then instead of your objects for that class sitting in heap space it ends up in a different type of space that is slower and harder for the JVM to locate

#

also is true for the size of objects as well

#

the size of an object being too large can make this happen as well

#

something to think about later on 😉

tardy delta
mortal hare
#

streams make devs lazy

wet breach
#

thats lambda's for you

tardy delta
#

ok stuff doesnt even use reduce

#

whatever

rotund ravine
wet breach
#

not always but sometimes true

#

but it is ironic though that lambda is actually one of the few things that came into existence purely because of someone being lazy XD

#

nothing wrong with it, just ironic

glossy venture
tardy delta
#

yes

#

me abusing the noise library too

mortal hare
#

is it possible to set properties in gradle that are visibile within the whole project scope? im currently using gradle.properties, but i think that's an abuse

ivory sleet
#

Gradle props are nice

glossy venture
#

you can do

ext {

}
``` in your root build.gradle and reference the settings with `rootProject.property`
mortal hare
#

i've tried that but it seems to not work for some reason

#

its kinda weird

ivory sleet
#

You have to cast iirc

#

Assuming u use kotlin dsl

#

Which you should use

mortal hare
#

groovy

#

why should i use kotlin

ivory sleet
#

Better support

#

Like IntelliJ even says its gonna support it better

mortal hare
#

eh, i havent touched kotlin ever

ivory sleet
#

Did u touch groovy ever before gradle?

#

Prolly not

mortal hare
#

no, but it was simple enough to setup

#

basic things

ivory sleet
#

Well im just a strong proponent of the kotlin dsl

#

Kotlinscript isn’t harder by any means

wet breach
#

may not be harder, but it is different and people don't like learning many different things for just a very specific thing

ivory sleet
#

Mye i suppose

mortal hare
#

im storing these values in gradle.properties:

PROJECT_NAME=TestPlugin
MC_VERSION_MAJOR=1.19
MC_VERSION_MINOR=3
MC_VERSION_BUILD=R0.1-SNAPSHOT

but i think that's not where i should store them, since I use them to sync my gradle plugins with other parts of subprojects

#

extra properties is what i seek to use

ivory sleet
#

That’s fine tho

mortal hare
#

but last time i tried it didnt work

wet breach
#

global properties is acceptable if sub projects rely on it, I mean where else would you put them

mortal hare
#

cant you make extra properties global?

wet breach
#

probably, but not entirely sure what extra properties means

mortal hare
#
ext {}
#

block

#

but by using those i have another problem lmao

#

i want to make settings.gradle see those properties

#

to prevent duplicates

#

i think i'd just stick to gradle.properties

quaint mantle
#

How do I make unit tests for my plugin?

subtle folio
desert tinsel
#

Hey I'm using sqlite database with jdbc and I get an error no such column 'pvp' but in a database viewer, the column is in, and when I try to access the name of all columns with ResultSetMetaData I get the column named 'pvp', why?
This is my code:

String uuid = p.getUniqueId().toString();
        ResultSet rs = Database.onQuery("SELECT * FROM PLAYERDATA WHERE uuid = \"" + uuid + "\"");

        boolean is = false;
        if (rs != null){
            while(true) {
                try {
                    if (rs.next()){
                        is = true;
                        PlayerData playerData = new PlayerData(uuid, compressors(p), rs.getDouble("pvp"), is1(rs.getInt("pvp")), rs.getInt("kills"), rs.getInt("deaths"));
                        SennyMine.playerDataHashMap.put(p, playerData);
                        break;
                    }else{
                        break;
                    }
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }```
subtle folio
#

Unit tests are gonna be difficult with a java plug-in, but you can test logic that isn’t related to spigot

desert tinsel
#

yes

desert tinsel
quaint mantle
desert tinsel
#

it s still a little bit sus

rapid topaz
#

I am editing a custom music disc plugin, and I wanted to add something that multiplies my items. For example, if i type /musicdisc.d it duplicates what item i have in my hand.

rapid topaz
#

i cant figure out how to do it

#

oh damn i forgot to ask the question

subtle folio
#

give the player there current item in their main hand

rapid topaz
#

yeah

#

but

#

can i just add anotherfile in the jar file and be goodorwaht

#

good or what

subtle folio
#

you should probably recompile it..

wet breach
#

you probably could just use a single class and maybe like 10 or so lines

rapid topaz
#

yeah i have the folder with everything

#

i have the folder

glossy venture
#

just a for loop

rapid topaz
#

where should i add the class or whatever

minor garnet
#

yes but how?

glossy venture
#

or use an AABB

minor garnet
#

aabb is a colliding box why i need use this?

glossy venture
#

no its a bounding box

wet breach
#

basically you want the border

rough drift
#

oh nooo

minor garnet
minor garnet
glossy venture
#
Location loc = player.getLocation();
for (int x = loc.getBlockX() - radius; x < loc.getBlockX() + radius; x++) {
  for (int z = loc.getBlockZ() - radius; z < loc.getBlockZ() + radius; z++) { 
    Location newLoc = new Location(loc.getWorld(), x, loc.getBlockY() - 1, z);

    // do something with the newLoc
  }
}
glossy venture
minor garnet
#

in this case I would need to get only the edges so I can do a logic, in this case I would need to get the last block of height y

#

wait

wet breach
#

if you know the size of the box in 2d, then you have the border

#

you also need to only know half the size as well

rough drift
#

a quarter if it's a perfect square

subtle folio
#

an eighth it it’s a perfect trapezoid

minor garnet
#

but this ill return air

wet breach
#

all you need is the corners and some math

minor garnet
wet breach
#

if you know Pythagoras's theorem you know the lengths of all 4 sides if you just have 2

#

😉

minor garnet
#

i mean

echo basalt
#

this is 8th grade math

minor garnet
#

example this

echo basalt
#

too advanced for our developer monkey brains

wet breach
#

you also know that one side of the square is equal to half the distance of the length

minor garnet
wet breach
#

so even if you just had the opposing corners you could still determine the width and length with just that

minor garnet
#

i need just get the hight block at of that corners locations

wet breach
#

oh well you said nothing about 3d

echo basalt
#

through each block

rough drift
echo basalt
#

I'd make an example if I didn't have to catch a train in an hour

echo basalt
rough drift
minor garnet
wet breach
echo basalt
#

not really

#

if you have a block in the s ky it'll trip

wet breach
#

I mean it still does, just needs to be applied differently

minor garnet
wet breach
#

so, to get the border blocks to include height, you need to use 2 triangles. 1 for the size of the box, and the second from the height to the bottom and from that you know the exact dimensions and can get all of the blocks just only on the border only 🙂

#

actually might be able to use 1 triangle if you know how to combine it

#

but probably easier if you just use 2

rapid topaz
#

how do i give myself the item imholding

#

like for example if i hold a stack of cooked meat, it doubles

wet breach
rapid topaz
wet breach
#

something to this effect

#

there is other ways

rapid topaz
#

so i should be able to put this in a command

wet breach
#

Well your command works however you specify

#

if you want the register a command that is named duplicate

#

you could just have that command run that code and it duplicate items

rapid topaz
#

and how do i make it so you need a specific permission to execute the command

wet breach
#

you would check for said permission

#

if they don't have it don't run it

#

if player.hasPermission("Permmisssion here")

rapid topaz
#

can i sepcify so that only my username works?

wet breach
#

sure

rapid topaz
#

so if name = epib, run

#

orsomething

wet breach
#

it would be better to check against UUID

#

but sure

eternal oxide
#

add the permission to the command in plugin.yml and you need no checks

rapid topaz
#

what is uuid

wet breach
#

seems like you have a lot of learning to do

rapid topaz
rapid topaz
wet breach
#

it depends on the plugin 🙂

rapid topaz
#

yeah i think i understand

eternal oxide
#

unless it's specifically excluded, yes

rapid topaz
#

because if i say that in theplugin only my username can run it. Then the operator cant run it because their name issomethingelse

minor garnet
#

not to mention that I would need to pick it up by the center

wet breach
#

how is the size determined?

#

or have you not got that far yet? lol

minor garnet
#

.

wet breach
#

basically what I am asking is. Do you know the size of the box ahead of time, is this user provided or is this some dynamic thing based on a arbitrary value

minor garnet
#

im not using box

#

what so complex lol

wet breach
#

even if the box has nothing and is only imaginary, you still must know the size because it has a purpose

minor garnet
#

i just need a loop provide me all those red carpets location

rapid topaz
#

where is the main file of the plugin located

wet breach
#

ok, but you already know the box size correct?

hazy parrot
#

Main class?

minor garnet
rapid topaz
# hazy parrot Wdym

yeah when i edit it, oredit someone elses, i need to find where like to main fileis

eternal oxide
#

modify that method to only select ones with red carpet

minor garnet
#

in this case (2 + 1) = 3 * 2 = 6

wet breach
minor garnet
#

i need get only the ''borders'' location

rapid topaz
wet breach
#

they want to get all the locations along the border including the height

#

the easiest way I can tell you to do it without making it too complex for you to understand

#

all you have to do is traverse in 2 directions in regards to your radius

#

so one direction is on the 2d plane, and you will go out in a direction however far, and then up or down to get a corner. The second direction, is going to go up in the amount of the radius, and then go in the opposite direction you went for the 2d plane

#

this gives you the opposing corners

#

now you can just use 3 for loops to iterate just on the x, z axis only and inverse at the same time, and then move your y afterwards one at a time. This will give you all the locations around the border

#

so the first loop, is the y, the second and third is x or z which ever you want

minor garnet
wet breach
#

Well yes because these are xyz coords

subtle folio
wet breach
#

the method I am explaining you is the easiest to do, not the most performant but still accomplishes what you are wanting while at the same time of you capable of understanding it

#

maybe I am just not explaining good enough which I wouldn't be surprised and I imagine imllusion has something to add

echo basalt
#
public List<Location> getLocationsAroundPlayer(Player player, int diameter) {
  Location location = player.getLocation();
  int radius = diameter >> 1; // this is the same as dividing by two, but more cryptic

  List<Location> corners = new HashSet<>();
  corners.add(location.clone().add(radius, 0, radius));
  corners.add(location.clone().add(-radius, 0, radius));  
  corners.add(location.clone().add(-radius, 0, -radius)); // the order of these matters, otherwise edges might cross diagonally
  corners.add(location.clone().add(radius, 0, -radius));

  corners = addBorders(corners);

  for(Location borderLocation : corners) {
    int highestY = location.getWorld().getHighestYAt(bornerLocation);

    if(highestY <= borderLocation.getY()) { // use heightmaps to our advantage
      borderLocation.setY(higestY);
      continue;
    }

    while(borderLocation.getY() <= location.getY() + radius && !borderLocation.getBlock().getType().isAir()) {
      borderLocation.add(0, 1, 0);
    }
  }

  return corners;
}

public List<Location> addBorders(List<Location> corners) {
    List<Location> locations = new ArrayList<>(); // 0->1, 1->2, 2->3, 3->0

    for(int index = 0; index < corners.size(); index++) {
      Location start = corners.get(index);
      Location finish = corners.get((index + 1) & corners.size()); // this is the same as a %, but more cryptic

      Vector difference = finish.toVector().subtract(start.toVector()).normalize();
      double distance = start.distance(finish);

      Location current = start.clone();

      for(double irrelevant = 0; irrelevant <= distance; irrelevant++) { 
        locations.add(current);
        current.add(difference);
      }
    }

    return locations;
}
#

something like this

rapid topaz
#

`@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {

        Player player = (Player) sender;
        String uuid = player.getUniqueId().toString();
        if (uuid == "bce295f0-0575-4c83-ac7a-8b6f285881a5") {
            ItemStack item = new ItemStack(itemFromMainHand);
            PlayerInventory inventory = player.getInventory();
            inventory.addItem(item);
        }else{
            // I dont know what to put here
        }
       
    }
}`
#

i tried codingsomething

echo basalt
rapid topaz
#

will this give myself the item im currently holding?

#

and will it check if the uuid is correctbefore executing thecommand?

wet breach
#

look at that

#

ImIllusion is in a good mood to give away code

rapid topaz
#

but is it correct

echo basalt
#

I'm going out in 10 minutes

#

and can't bother watching 2 people argue over trivially simple code

wet breach
#

most likely correct or very close to it

rapid topaz
wet breach
echo basalt
#

sure

wet breach
#

so it looks cryptic

#

and people are scared of it

rapid topaz
#

what can i put after the else

echo basalt
#

imma replace the % with a &

#

so people are afraid

rapid topaz
#

or how could i like not execute the command

echo basalt
#

there

#

cryptic

rapid topaz
#

can i just delete the ele

#

else

echo basalt
#

yea

rapid topaz
#

oh

#

ok

#

but will thiswork

#

on a server

echo basalt
#

@wet breach added comments for clarity

spare prism
#

Hey. Is there a way to register a custom flag using WG API, which value is not a boolean? I need a list of values to be stored there

wet breach
#

lol

#

nice

echo basalt
#

anyways imma go out now

#

cya losers

rapid topaz
#

where is most likely the OnEnable function

wet breach
#

otherwise its in the JavaPlugin class

marsh brook
#

Hi everyone

rustic hedge
#

Can someone please help me with how to enable the scripting engine with spigot I’ve looked for hours at this point and can’t find a direct modern answer for newer Minecraft versions. I know spigot has its own loader and stuff and that’s why it doesn’t work but is there any way I can enable it or something

river oracle
#

Skript has their own discord

cunning canopy
#

does EntityDeath event get triggered when players break armorstands?

lost matrix
#

I dont think he is speaking about skript...

lost matrix
cunning canopy
#

thanks

#

Also

#

WHen doing rayTrace entities

#

is there anyway to get the hitVector

lost matrix
#

Yes

cunning canopy
#

like the onPlayerInteractAtEntity event

#

cause then you can do event.getClicked position

lost matrix
cunning canopy
#

I know you can get the actual location hit

cunning canopy
#

Because the getClickedPosition is kinda relative if you get what I mean

#

for example if you click the top of an armor stand

#

you get something like 1.9 for the y

#

and not the actual location in the world

lost matrix
#

Well then just calculate the relative vector.

Vector fromPlayerHeadToHitPosVect = rayVec.subtract(playerEyeLoc.toVector());
cunning canopy
#

so can I then compare the difference between the location of the hit armor stand and the hit location?

lost matrix
#

Wait so its a vector within the BoundingBox of the clicked Entity?

cunning canopy
#

I think so, but I am not completely sure

#

All I know is that on the PlayerInteractAtEntity event the top of the armor stand is represented as 1.975 y

lost matrix
#

So its probably relative to the AS's location.
Find that out and then calculate the vect:
AB = B - A
Vector from A->B is B minus A

cunning canopy
#

Thank you

cunning canopy
#

is a the armor stands actual location

#

and b the raytrace hit loaction?

orchid gazelle
#

Hello^^ Now this is very scuffed. I am using Player#sendBlockChanges with supressLightUpdates on true. It seems to ignore this flag completely when above about y=-33 which makes my sending extremely laggy. When settings the flag to false, it appears to ALWAYS lag
I can see some laggy shadows getting removed and added in the lag, too. Tested it both on superflat, normal and paper, spigot

rotund ravine
#

Fun times

small hawk
#

Hey guys, how can i obtain single line of lore?
I am using player.getInventory().getItemInMainHand().getItemMeta().lore().get(3) for now, and it returns whole Componen thing, I just want to have one word as a String, any solutions ?

tardy delta
#

is there a list of translateble components somewhere?

#

like the commands.gamemode.success.self stuff

small hawk
#

if i am looking at the right thing, then no

cunning canopy
#

java has mem leaks?

tall dragon
#

if you mess up badly enough

pseudo hazel
#

yes

tall dragon
#

it can have yes

cunning canopy
#

so for example infinite recursion?

pseudo hazel
#

i am trying to debug one rn actually xD

#

well infinite recursion will stall your server

#

so no

#

more like making stuff without resetting other stuff

#

or whatever

cunning canopy
#

well I am getting a stack overflow error

#

that explains the recursion

pseudo hazel
#

yes

cunning canopy
#

is there a limit to how manny recursive calls you can have?

pseudo hazel
#

yes

#

ofc

#

but thats probably not your issue

#

stack overflow is 9/10 times a programming error on the devs part

lost matrix
#

Dont check custom items by comparing their name.
Add a PDC tag to the ItemStack. Then it will stay your
custom item no matter what name or enchantment it
might get.
@small hawk i think it was

cunning canopy
#

yes its on me

pseudo hazel
#

like you arent breaking out

cunning canopy
#

ofc its on me

#

because I am exceeding the limit

pseudo hazel
#

well you are exceeding the limit not because you need more , but probably because you made another mistake

cunning canopy
#

I have recursion using events hehe. Is there any way I can pass a value to my event that tracks the calls so I dont overstep?

pseudo hazel
#

what kind of events

lost matrix
#

Use a field for that

small hawk
cunning canopy
#

oh

#

like just a private int of the class?

pseudo hazel
#

yeah if thats sufficient

#

but like anything, it depends on your usecase

cunning canopy
#

oh welp

#

I think my vector is negated

lost matrix
cunning canopy
#

that explains why my if statement is always true

rocky tree
#

Anyone know how I can check if an item has a specific name?
Ex. I have a book (Material.BOOK), how I can check if the name of it is equal to "Hi"?

pseudo hazel
#

get the item meta and getDisplayName()

cunning canopy
#

I swear using player#sendMessage is the best debugger

pseudo hazel
#

unless you actually get memory leaks xD

cunning canopy
#

yes

#

cause

#

hehe

#

now my tps is like 5

pseudo hazel
#

omg

#

what are you even doing lmao

small hawk
tardy delta
#

mojang translations go brr

rocky tree
tardy delta
#

wait lol

pseudo hazel
bleak comet
#

hi everyone, i have a error on this : itemMeta.getPersistentDataContainer().set(new NamespacedKey(this, "creatureType"), PersistentDataType.STRING, creatureType.name());
its said : Multiple markers at this line
- The method getPersistentDataContainer() is undefined for the type
ItemMeta

pseudo hazel
pseudo hazel
rocky tree
bleak comet
#

spigot 1.16.3

pseudo hazel
#

did you set the item meta on the item again after you changed the name?

rocky tree
pseudo hazel
#

hmm

pseudo hazel
rocky tree
pseudo hazel
pseudo hazel
#

?paste

undone axleBOT
bleak comet
pseudo hazel
#

and the exact error?

bleak comet
# pseudo hazel and the exact error?

Multiple markers at this line
- The method getPersistentDataContainer() is undefined for the type
ItemMeta
- Line breakpoint:Main [line: 70] - onBlockBreak(BlockBreakEvent)

mortal hare
#

is trie tree data structure good for searching autocomplete words?

pseudo hazel
#

is what structure?

mortal hare
#

Trie

#

literally named Trie

pseudo hazel
#

yes

#

thats good

#

sounds like the right solution

rocky tree
pseudo hazel
#

idk

#

very weird

rocky tree
tall dragon
#

without the name

#

of course its false

pseudo hazel
#

oh lmao

#

how did I not notice 🥲

bleak comet
pseudo hazel
#

idk

#

check if your version of ItemMeta implements PersistentDataHolde

#

the only thing i can think of is that your source is outdated

bleak comet
#

ok thx

rocky tree
#

I check if the itemMeta (DisplayName) in the hand of player is equal to the displayName of book

tall dragon
#

exactly what i am saying. in that code snippet ur creating a new ItemStack upon which you do the check

#

u dont use the item in the players hand

crimson relic
#

^

rocky tree
#

Ahh, ok. Thanks

bleak comet
eternal oxide
#

read the error it tells you

#

literally in English

bleak comet
#

yes but i don't know what i have to do

eternal oxide
#

it tells you in the error

crimson relic
mortal pollen
#

I need help to change plugin from 1.16.5 to 1.17.1

bleak comet
eternal oxide
#

you read the part about plugin.yml?

bleak comet
#

yes

#

it said : Did you forget to define a modern (1.13+) api-version in your plugin.yml?

eternal oxide
#

and an api version?

#

if you google "spigot plugin.yml api-version"

river oracle
#

?services

undone axleBOT
mortal pollen
river oracle
#

No I'm at school

#

Do it yourself or commission

#

Plus there's no need to do any upgrading unless youre dealing with nms

mortal pollen
#

but I dont know what is NMS

eternal night
#

the forums post had an update example

crimson relic
mortal pollen
#

can I send to you the plugin and you will help me to do it

#

?

#

or join the voice

crimson relic
#

No

eternal night
#

just read the update post ?

mortal pollen
#

my plugin is multi character

eternal night
#

multi character ? cat_what

mortal pollen
#

I bought the plugin

#

but I HAVE SERVER FOR 1.17.1

eternal night
#

why would you buy a plugin that does not offer support for your version

mortal pollen
#

because I tought that I can change the plugin version but I didnt understand

crimson relic
#

It very clearly says what it supports

eternal night
#

Well, ehm, updating a whole plugin to 1.17 that uses NMS is work

#

work that I guess is now on you

mortal pollen
#

I need spigot buildtool?

eternal night
#

the post I linked has instructions on how do setup nms for 1.17

#

yes

mortal pollen
#

plugin for minecraft roleplay server

#

Can you help me in a voice?

wet breach
#

unless you really are lol

mortal pollen
#

plese

#

please

eternal night
#

LMAO

eternal night
wet breach
#

well, random doesn't necessarily mean to include the large or popular plugins

#

just random unheard of maybe mostly useless ones 😄

eternal night
#

buying a plugin that does not support your server version is genius tho

#

especially if it is open source

wet breach
#

Well I can't say it is smart, but I can see the point if you still wanted to support the dev

#

even if its not an item that currently works for you lol

eternal night
#

It seems that was not their main objective 🙃

#

OH GOD

#

they are on paper

wet breach
#

ah so they are in the wrong place then

eternal night
#

no place is the right place for this

#

this is more of a service request

wet breach
#

to you

#

it seems

mortal pollen
#

SO HELP ME I NEED YOUR HELP

crimson relic
#

NO AND USING CAPS DOESNT HELP

eternal night
#

I linked the article that explains how to setup NMS for 1.17 already 😭

#

?nms

eternal night
#

there is also this blog if you wanna read something else

#

I don't know what else I can do

wet breach
#

we all know what else you can do

#

its just that you are not going to do it

eternal night
wet breach
#

and I wouldn't blame you either lol

#

I would do the same

mortal pollen
#

I need to change only the numbers from 1.16.5 to 1.17.1 and to install buildtool 1.17.1 snapshot on my computer?

cunning canopy
#

is there a raytrace that gets more multiple entities

eternal night
#

presumably not as NMS changed between 1.16 and 1.17

#

you can try it tho

#

you also have to follow the more complex setup linked in both posts to get NMS

wet breach
#

I am sure if it was just as easy as just changing the numbers around, many plugins wouldn't have such a problem in updating

#

if only they were geniuses too

eternal night
#

yeaaa

mortal pollen
#

ok thank you

hushed spindle
#

probably a stupid question but what does the "target" folder do in intellij projects

eternal night
#

target is a folder used by maven to compile your project in

mortal hare
#

is there any way to reset backup codes for spigotmc

#

i have verifed my account on discord

#

and i cant access my spigotmc account due to how i changed my phone

eternal night
#

if you fucked up your 2fa probably mail to support

hushed spindle
#

would it be safe to remove some stuff from there because i've noticed it still contains some older files i dont keep in src any more

eternal night
#

2FA resets are a rather long thing to go through

#

you can remove the entire target folder yea

#

next build, maven just re-creates everything it needs in there

hushed spindle
#

i assume maven will just regenerate it right

#

yea

#

cool cool tnx

mortal hare
#

i think i'd rather create a new account with my proper username instead

#

its my old username

eternal night
#

if you don't have anything valuable linked probably easier/faster

mortal hare
#

eh

#

:/

eternal night
#

or not KillMeLmao

#

probably send a mail

#

and then next time make sure to have backup codes 5Head

mortal hare
#

i had it on my phone

#

i've bought a new one

#

because first one got dead

eternal night
#

yea that is why you don't keep your backup codes on the same device as your normal 2FA

mortal hare
#

i think i should buy usb cryptographic key instead

#

way easier to manage

#

and allows for complete safety

delicate sluice
#

Where can I recruit a developer?

eternal night
#

?services

undone axleBOT
delicate sluice
#

I have insufficient permissions to post there because of one small mistake 💀

#

I guess I'll have to create a new account then

eternal night
hazy parrot
eternal night
#

LMAO

hazy parrot
#

Lol

delicate sluice
#

Well i emailed them and explained to them I made a mistake but got no reply

mortal hare
#

😂

wet breach
mortal hare
#

eh i dont really care about that account

#

i would rather create new one, but i cant

wet breach
#

second, the odds of getting help in resetting 2FA is like 0

delicate sluice
#

Where can I learn spigot plugin development?

mortal hare
#

this nickname is so old

#

it dates back to 2013

#

i have used Dovias since 2016

wet breach
#

ok its not 0 in getting help, its 0 in for someone to reset the 2FA for you so you can get back into the account

mortal hare
#

but im verified in discord

#

why wouldnt they reset it

wet breach
#

third, just make another account, since you can't prove the account is yours it also works in reverse 🙂

winged knot
#

Hello! How can I disable player collision?

wet breach
#

without the 2FA there is no verifying who you are

mortal hare
#

i have 2FA on discord 😄

eternal night
#

I mean usually you can 2FA reset

mortal hare
#

thank god i had a session on a pc

delicate sluice
eternal night
#

with like, a month long period of contacting the old person

#

on emails

#

etc

wet breach
eternal night
#

Well you need like in person authentication

wet breach
#

yeah I doubt Md is going to do that lmao

eternal night
#

yeaaa

#

¯_(ツ)_/¯

#

issue is like, who guarantees that even if you have access to the old discord, you aren't just a hacker that has the discord etc

wet breach
#

but in order for in person to work they would have to have someway to still verify that person belongs to that account

#

which is pretty much the whole purpose of 2FA

eternal night
#

see that is why my backup codes are duplicated in 4 different locations 5Head

wet breach
#

Well 2FA isn't super secure anyways

#

But yeah best to store backup codes in more then one place 🙂

eternal oxide
#

2fa is just another vector for attack. just a password is safest

eternal night
#

waiting for that /s

wet breach
#

the assumption many have about 2FA is the delivery method is assumed safe

winged knot
#

Can someone tell me how to disable player collision, I couldn't find any information

eternal oxide
#

teams

winged knot
#

I tried it but it didnt work

#

Maybe I have done it wrong, I will try again later

#

But arent there any other ways?

cunning canopy
#

What roes raytraceresult.getHitEntity return if there were multiple?

mortal hare
#

does any of you use fastutil?

#

seems like a neat library

rapid topaz
#

How do i recompile Jar file? I would like to turn it from .src to .Jar

mortal hare
#

there's no .src extensions in java

#

there are .java and .class extensions only

opal juniper
mortal hare
#

in general

rapid topaz
river oracle
#

Hacks

quaint mantle
#

The matrix rows come back as 3 and this.rows comes back as 4

cunning canopy
#

can I raytrace more then one entity?

quaint mantle
#

These are my kernels that are used to do the image ```java
private NamedMatrix[] kernels = {
new NamedMatrix("identity", new double[][]{
{0, 0, 0},
{0, 1, 0},
{0, 0, 0}
}),

        new NamedMatrix("ridge", new double[][]{
                {-1, -1, -1},
                {-1, 8, -1},
                {-1, -1, -1}
        }),

        new NamedMatrix("sharpen", new double[][]{
                {0, -1, 0},
                {-1, 5, -1},
                {0, -1, 0}
        }),

        new NamedMatrix("unsharpen masking 5x5", new double[][]{
                {-1.0 / 256, -1.0 / 64, -3.0 / 128, -1.0 / 64, -1.0 / 256},
                {-1.0 / 64, -16.0 / 256, -3.0 / 64, -16.0 / 256, -1.0 / 64},
                {-3.0 / 128, -3.0 / 64, 119.0 / 64, -3.0 / 64, -6.0 / 256},
                {-1.0 / 64, -16.0 / 256, -3.0 / 64, -16.0 / 256, -1.0 / 64},
                {-1.0 / 256, -1.0 / 64, -3.0 / 128, -1.0 / 64, -1.0 / 256}
        }),

        new NamedMatrix("laplace", new double[][]{ // ridge + identity
                {-1, -1, -1},
                {-1, 9, -1},
                {-1, -1, -1}
        })
};```
tardy delta
#

linux kernel