#help-development

1 messages ยท Page 414 of 1

tender shard
#

but not "Listener called"

eternal night
#

well yes

#

its the job of the event executor to call the listener

#

its point is like, timings

tender shard
#

hm welp ok

#

I'll just do my stuff in the EventExecutor, it's only to test whether the getEffectiveMotd() method works, anyway

eternal night
#

but yea, concerning you don't need it, people do funny dynamic event listener registration

snow pond
#

how can i make a itemframe be on the ground

young knoll
#

I think it's setFacingDirection

snow pond
young knoll
#

Idk how rotation would work

#

What rotation is on the floor

tender shard
#

FLIPPED

#

or FLIPPED_UPSIDE_DOWN

tall dragon
#

isnt setrotation for the item within the itemframe?

tender shard
#

I guess

tall dragon
#

pretty sure thats not for the itemframe itself

tender shard
#

Idk

#

Then probably setFacing

tall dragon
#

with BlockFace.UP

young knoll
#

Try setting a painting to face up

#

What could go wrong

tawny remnant
#

is it possible to create a custom entity without NMS? I want to do it in Intellij only with SpigotAPI

#

If so, can someone send me a link?

haughty storm
#
public class Marionette extends Zombie {

    public Marionette(Location location) {
        super(EntityType.ZOMBIE, ((CraftWorld) location.getWorld()).getHandle());

        setPos(location.getX(), location.getY(), location.getZ());
        level.addFreshEntity(this);
    }
}

If I have smth like this, how would I be able to, instead of it being a Zombie, make it so I can pass an EntityType through the constructor and spawn that entitytype

fluid river
#

you can change it's damage or attributes

tawny remnant
fluid river
#

health and damage are from entity class

#

pathfinder is nms only

tawny remnant
#

just entity?

fluid river
#

or LivingEntity

#

and then just call the super constructor, and pass given entitytype

tender shard
haughty storm
fluid river
#

?jd-s

undone axleBOT
fluid river
#

think i need to go deeper

fluid river
#

then one of the superclasses has it too

haughty storm
#

I am not passing an EntityType to the Zombie class. Just a Level

fluid river
#

ez

#

thanks alex

haughty storm
quaint mantle
#

Could someone help me figure out why MongoDB logger is not taking effect?

#

The issue is that I am trying to disable Mongo's logger but for some reason it's not working

full holly
#

guys with which method Bukkit.getMinecraftVersion() got replaced?

tender shard
quaint mantle
#

I did. I got classcastexception

tender shard
full holly
tender shard
haughty storm
# tender shard it does

sorry again, but do you know how I would convert from org.bukkit.entity.EntityType to net.minecraft.world.entity.EntityType

tawny remnant
#

How can i do that Somthing happens on PlayerFishEvent only sometimes? Like a chance to do it or something?

tender shard
full holly
#

then I think I used paper

tender shard
quaint mantle
full holly
quaint mantle
#

It's causing error while enabling BlobLumber but code is borrowed from BlobLib

tender shard
tender shard
#

but how did it look?

tender shard
#

1.19.3? 1_19_2_R0.1-SNAPSHOT?

full holly
fluid river
#

w8 spigot doesn't have getMinecraftVersion()?

quaint mantle
#

((LoggerContext) LoggerFactory.getILoggerFactory()).getLogger("org.mongodb.driver").setLevel(Level.ERROR);

quaint mantle
young knoll
tender shard
fluid river
#

Can LoggerFactory be casted to LoggerContext then

#

maybe you need one more method or smth

tender shard
fluid river
quaint mantle
#

The one liner

quaint mantle
#

Not

tender shard
#

how can you cast it to LoggerContext without any imports?

quaint mantle
smoky oak
#

anyone know if i can do something to get rid of the 'Class is never used' thing for the class extending JavaPlugin?

quaint mantle
#

I did

#

I copied wrong imports

smoky oak
#

if i do @suppressWarnings("unused") it would suppress internal warnings too

fluid river
#

is that some intellij stuff

smoky oak
#

i only want to get rid of the warn for 'unused CLASS'

#

ah ye

fluid river
#

which i never encountered

smoky oak
#

intellij

fluid river
#

no clue

smoky oak
#

ah thanks

tender shard
#

alternatively you can add the main class as "entry point"

#

but that never properly works for me

smoky oak
#

are the settings per project or global btw?

haughty storm
# tender shard it does

Sorry to bother again, but do you k ow how I would convert from

org.bukkit.entity.EntityType
```to ```java
net.minecraft.world.entity.EntityType
smoky oak
#

getHandler()

#

or getHandlers()

#

one of these

tender shard
quaint mantle
#

I have to explain. I tried this code yesterday. I am no longer using it since it printed classcastexception.
I am 100% that I perfectly remember copying the right imports from stackoverflow and copying the oneliner and then getting the classcastexception.
Then I went back and found that it points to the oneliner and what I remember is that in IntelliJ everything seemed fine but at runetime it had that issue!

tender shard
#

usually it's only for the current project. if you wanna change it for all projects, go to settings from the "welcome screen" and change it there. It will only apply to new projects, though

quaint mantle
tender shard
#

I also never understand how to properly change settings for ALL, including old, projects

fluid river
#

oh you casting type

haughty storm
fluid river
#

then not possible ig

#

why do you even need this

smoky oak
#

pretty sure it is

#

wasnt there someone like 2 days ago with a pretty similar issue

haughty storm
fluid river
#

don't remember

#

not in dev maybe

smoky oak
#

ah found it

#

custom pathfinding but no casting reference

#

iirc the way to do it is just (NMSPath) entity

tender shard
haughty storm
#

thx, I'll try it

haughty storm
tender shard
#

I pull requested this and it got merged like a month ago, or two

#

so it's definitely available in 1.19.3

#

anyway, print out the results of this:

        EntityType.getKey(EntityType.ZOMBIE);
        org.bukkit.entity.EntityType.ZOMBIE.getKey();
#

maybe this would work:

return EntityType.byString(bukkitType.getKey().toString()).orElse(null);
tawny remnant
quaint mantle
#

No

tawny remnant
#

why

quaint mantle
#

It spawns the creature right where the fishing hook is, at the water

tawny remnant
#

yes thats the idea

quaint mantle
#

You need to pull it to the player (if this is what you are expecting)

tawny remnant
#

how would i do that

quaint mantle
#

In order to pull it, a good idea would be to use entity velocity with a vctor

#

I will share you a piece of code I have

tawny remnant
#

Thanks

quaint mantle
#
        Location playerLocation = player.getLocation();

        double gravity = -0.08;
        double distance = location.distance(playerLocation);
        double a = 1.0 + 0.07 * distance;
        double b = 1.0 + 0.03 * distance;
        double x = a * (location.getX() - playerLocation.getX()) / distance;
        double y = b * (location.getY() - playerLocation.getY()) /
                distance - 0.5 * gravity * distance;
        double z = a * (location.getZ() - playerLocation.getZ()) / distance;

        Vector vector = new Vector();
        vector.setX(x);
        vector.setY(y);
        vector.setZ(z);
        player.setVelocity(vector);
    }```
#

Refactor Player player with Entity entity

tawny remnant
#

do i put the Entity field as the "g" or the "mob"

quaint mantle
#

LivingEntity is enough

#

No need to cast to Guardian

#

LivingEntity already extends Nameable (for setCustomName) and it also extends Damageable (setCustomHealth)

#

Also, you should not set health through this!
use LivingEntity Attributable

#

Like, mob.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(50.0D);

grizzled oasis
#

Having an issues with this code:

                    Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
                        @Override
                        public void run() {
                            Breaker.getWorld().spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, Breaker.getLocation(), 1);
                        }
                    }, 0L, 20 * plugin.getConfig().getInt("Breaker." + itemsName + ".time"));

This code runs is under the code for drops, im having 2 problems mainly, 1. the particle runs at infinite time and 2. the particle spawn randomly

quaint mantle
#

If it doesn't update health, then use LivingEntity Damageable#setHealth(50.0D);

quaint mantle
grizzled oasis
quaint mantle
#

If it has a random direction it needs an extra argument, I will give you more info in a bit

quaint mantle
#
                        @Override
                        public void run() {
                            Breaker.getWorld().spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, Breaker.getLocation(), 1);
                        }
                    }, 0L, 20 * plugin.getConfig().getInt("Breaker." + itemsName + ".time"));```
remote swallow
#

run task timer runs until you explicitly cancel it or the server stops

quaint mantle
#

Now you have task, you can track it.
Once you want it to stop, you will do task.cancel();

#

If you need it to only run once, you should use runTaskLaterAsynchronously instead of runTaskTimerAsynchronously

tardy delta
#

use a lambda instead of a runnable, no reason to do it async too

grizzled oasis
young knoll
#

Gotta save those precious microseconds on the main thread

grizzled oasis
rose aspen
#

Hello friends, do you know any good "image map api"?

Currently i'm working on a coupon project, where players can interact with fancy looking Material.FILLED_MAP items.
I tried the built-in map api, but somehow after a server restart, the map gets empty and won't stack with the new "same maps".

tender shard
quaint mantle
#

Alex, I found this

tawny remnant
quaint mantle
#

How can I work around it? Mongo is using SLF4J because of HikariCP but not only that, HikariCP SLF4J dependency is omitted by another which I cannot find

tardy delta
#

oh man i had some good meme about logging frameworks but i seem to have lost it

quaint mantle
#

Could someone help me?

#

I am really lost with this one

sterile token
#

What could be the reason of the file not getting created with the content from its model class inside the jar resources

#

Because the exception is not getting thrown, so the InputStream is not being null

sterile token
#

๐Ÿ˜ฌ

warm mica
#

could be

#

mkdir only creates one folder at a time

#

and mkdirs also creates its subfolders

sterile token
#

right, maybe its that

#

But i dont think, because is something related to the content

#

The config.yml is getting created with no exception, but with no content

#

And the code works perfect on Spigot (using Plugin#getResource() and Plugin#saveResource())

#

Same issue

#

๐Ÿ˜ก

zealous osprey
#

Try: Files.copy(stream, file.toPath(), REPLACE_EXISTING) ?

sterile token
warm mica
#

You should also try to close your streams

#

It might not be as bad with your case, but it can lead to problems

zealous osprey
#

oh yeah, there is no try-catch that'll do that

sterile token
#

right

#

I forget that tho

#

no

#

Same fkg issue, its still empty

#

๐Ÿ˜ก ๐Ÿ˜ก

tawny remnant
sterile token
#

And my resource file is not even empty

#

Doesnt make sense, because the stream is not null too, so it must be copying the content

warm mica
quaint mantle
warm mica
# sterile token Yes

Is there actually content in the file? You could verify that by opening the jar as a zip

sterile token
#

I already seem that

#

I mean i wont be asking for help without first looking the common issues

#

๐Ÿค”

#

shity bungeecord, why didnt they add the fkg getResource() and saveResource()

warm mica
#

you are checking whether it is null twice

tawny remnant
sterile token
#

no?

warm mica
#

and I guess that it is actually null and you don't notice

sterile token
#

yes i know, but why the issue?

#

it must throw the illegal argument exception

warm mica
#

invalid name, I would say

#

No, because of your first if-statement

#

it never reaches that point

#

get rid of it and try again

sterile token
#

okay

#

makes sense

#

okay you where right

#

But now i have to find the why the stream is not opened

warm mica
#

๐Ÿ˜„ It's funny how nobody noticed that

warm mica
#

you should use Plugin#getResourceStream()

sterile token
#

hmn i cant tho

#

its not bungee tho

#

its even worst

#

shity velocity ๐Ÿ’€

warm mica
#

Then start it with a tailing slash /

sterile token
#

I dont like their shity api

warm mica
#

/my/cool/config.yml

sterile token
#

ohh ok

#

like that?

warm mica
#

ya that should work

sterile token
#

Also really thanks man, if where another will told me to ask shity paper support

#

They comm is so shity lmao

tender shard
#

or maybe the other way around

warm mica
#

please put yourself into our position

#

imagine if you would receive that message

#

would you understand what the context is with a single random line of a stack trace and a single random line out of a larger problem?

hearty totem
#

Anyone here with some cool plugin idea's?

atomic moon
#

it depends if you want something original i guess!

tender shard
#

and it was not in the random line of code you sent

tender shard
hearty totem
warm mica
atomic moon
#

xD

tender shard
#

wdym with "write text with java on a website"?

atomic moon
#

like a http request?

sterile token
#

Yes you can use an http api

#

Like OkioHttp, its pretty good http driver

sterile token
#

You can even use venilla Java http client, if you are on java 9 and up

#

oh nice

atomic moon
#

i often use URLConnection directly :P

sterile token
atomic moon
#

the http client sounds good, i should learn it!

#

often i'm using java 8 for compatibility though

sterile token
atomic moon
#

cough

#

URLConnection is fairly intuitive though

sterile token
#

But i code 1.8.8 plugins so i cant complain

atomic moon
#

it's just some things which require writing a lot of code

#

you can use java 17?

sterile token
#

I never understand the versioning tho

echo basalt
#

it likes to trip around java 11

#

unless you disable rcon

sterile token
#

he?

#

what are you meaning ilussion?

#

rcon is not related to java version ยฟ?

echo basalt
#

<1.13 likes to throw errors if you run any minimally recent version of java

#

rcon drivers do some funky stuff with java internals iirc

sterile token
#

But who uses rcon?

#

๐Ÿ’€

atomic moon
#

rcon?

echo basalt
#

idfk

atomic moon
#

you just need to disable native-transport don't you?

echo basalt
#

yea

#

that

sterile token
atomic moon
#

rcon shouldn't use java internals

#

does it still exist? xD

#

i remember using it before

sterile token
#

who tagged? i seen the ghost pong

atomic moon
#

hmm

sterile token
#

So, who uses rcon? ๐Ÿ’€

buoyant viper
#

people use rcon?

sterile token
tender shard
#

I never saw anyone use it

#

Only on source games

sterile token
#

what means source games?

#

its a new cnept for me

tender shard
#

Source engine

#

Half life (2), counter strike source, cs:go, tf2, โ€ฆ

sterile token
#

Idk what means, but WebSocket >>>

#

Full duplex technology, bi-directional, good error handling, what more we can expect about it

terse ore
#

@fluid river

#

one question

#

so I made my own biomeprovider and chunkgenerator

fluid river
#

cool

terse ore
#

but there's an issue

#

multiverse doesn't detect it as a world

fluid river
#

idk how multiverse works

#

rly

young knoll
#

You have to like

terse ore
#

I should code my own command to teleport to my world?

young knoll
#

Specifically register it with multiverse

young knoll
#

Or you can use vanilla commands

fluid river
#

try

terse ore
#

hmm

fluid river
#

/mv import worldName NORMAL

terse ore
#

for some reason it isn't generating world :c

#

and only 1 bedrock (i think ik the fix for this)

young knoll
#

you made your own chunk generator

#

So you need to provide the terrain

fluid river
#

ig that's bedrock in the middle of the chunk

young knoll
#

Every method listed above as well as getBaseHeight(WorldInfo, Random, int, int, HeightMap) must be completely thread safe and able to handle multiple concurrent callers. Some aspects of world generation can be delegated to the Vanilla generator. The following methods can be overridden to enable this:

shouldGenerateNoise() or shouldGenerateNoise(WorldInfo, Random, int, int)
shouldGenerateSurface() or shouldGenerateSurface(WorldInfo, Random, int, int)
shouldGenerateCaves() or shouldGenerateCaves(WorldInfo, Random, int, int)
shouldGenerateDecorations() or shouldGenerateDecorations(WorldInfo, Random, int, int)
shouldGenerateMobs() or shouldGenerateMobs(WorldInfo, Random, int, int)
shouldGenerateStructures() or shouldGenerateStructures(WorldInfo, Random, int, int)
fluid river
#

or at it's 0/0

warm mica
#

Do accounts get auto disabled?

#

I can't log in anymore to jira

fluid river
#

shouldGenerateX to false on everything except Surface

terse ore
#

okok some advancements

fluid river
#

hmm

terse ore
#

so now

#

how could I make so if y is lower than 51

#

it generates as normal?

terse ore
young knoll
#

What do you mean?

terse ore
#

so rn I removed the ChunkGenerator

#

and it is generating a single biome

terse ore
# terse ore

when I add the chunkgenerator it results in this

sullen marlin
terse ore
#
public class DeepDarkChunkGenerator extends ChunkGenerator {
    public void generateSurface(WorldInfo info, Random random, int x, int z, ChunkData data) {
        for (int y = 51; y < data.getMaxHeight(); y++) {
            if (y == 51) data.setBlock(x, y, z, Material.BEDROCK);
            else data.setBlock(x, y, z, Material.AIR);
        }
    }
}```
young knoll
#

What is the goal?

#

All deep dark underground?

terse ore
#

make deep dark

#

in a nether-alike way

young knoll
#

You'll need to generate your own noise for that

terse ore
#

so you have a roof

warm mica
terse ore
#

is it possible to modify the already existing one?

young knoll
#

It's all NMS

#

So have fun

terse ore
#

fuck

young knoll
tawny remnant
tender shard
#

what's the issue with that code

warm mica
warm mica
#

the velocity is so small that you don't even notice a change

smoky oak
#

does Enchantment not have a getFromString or getByName method?

#

nevemind it has

tawny remnant
sterile token
#

Why, doesnt disable the shity mongo logger? ๐Ÿ˜ก

Logger.getLogger("com.mongodb").setLevel(Level.OFF);
terse ore
#

in chunkgenerator, is there a way to modify just x blocks not all?

smoky oak
#

let me rephrase. how do i generate the namespacedkey for Enchantment.getbykey? do i use the deprecated method and do getByKey(new NamespacedKey("Minecraft",enchantment) ?

sterile token
hasty prawn
sterile token
#

Any answer are appreciated

hasty prawn
#

Yeah that one PogU

smoky oak
#

anyone know if it nulls or excepts if the key is wrong?

quaint mantle
#

Mongo is trash

smoky oak
#

null

quaint mantle
#

I hate it

terse ore
#

How could I make so setting the ChunkGenerator of a world to modify the existing chunkgenerator and not override it completely?

smoky oak
terse ore
#

idk

#

let me read the docs

#

brb

#

what does populates mean?

young knoll
#

I mean you can

#

But you should only use that for decration

terse ore
#

too many new words

young knoll
#

First the base terrain is generated

#

Population adds all the fancy decor

#

Trees, Structures, etc

terse ore
#

let me explain what I need it for

#

rn I have a generator that generates an only deep dark biome world

#

but I would like so it has a roof (like the nether one, bedrock and above of that bedrock air)

#

but when I try to set ChunkGenerator for a custom one it (obviously) overrides the original one

young knoll
#

Yeah you'll want your own noise system

terse ore
#

would be any way to modify the default one?

smoky oak
#

i did some nonsense with that

#

lmc if i can find it

tawny remnant
quaint mantle
tawny remnant
#

for me

sterile token
#

๐Ÿค”

tall dragon
#

editing it dont work

young knoll
#

Subtracting the two vectors should work

#

You may need to play with he multiplier to get it how you want

tawny remnant
#

it doesnt do a thing rn

#

should i put 10k ther

#

e

#

or more

fluid river
#

no

#

what is happening

#

when your event triggers

sterile token
sterile token
young knoll
#

Does it move at all with just 1

fluid river
tawny remnant
sterile token
fluid river
#

but doesn't move it at all

#

?

sterile token
#

if we dont know what doesnt work, its imposible to help

terse ore
tawny remnant
sterile token
quaint mantle
#

Could you please make a clip?

smoky oak
fluid river
#

is your player above the spawned guardian

tawny remnant
smoky oak
#

and then chang or dont change it respectively

young knoll
#

It doesn't pull it to the player

#

But

#

Does it move at all

tawny remnant
fluid river
#

maybe there's wall between player and guardian or smth

tawny remnant
fluid river
#

been givin fava lessons

#

to one guy

#

no worries morice

quaint mantle
#

You need to spawn the entity

fluid river
#

yeah ig

smoky oak
# terse ore did it work right?

it did, i shelved it cuz i didnt understand perlin noise. Ceiling generated fine. It was in the nether, so i just copied the ceiling to higher up. I'd recommend you just clone and mirror the bedrock layer

sterile token
#

Where im really interested in

tawny remnant
quaint mantle
#

Like

#

Call it to the world

fluid river
#

like cast magic

young knoll
#

It is in the world

fluid river
#

summon

quaint mantle
#

Before pulling it to the player

young knoll
#

You might have to delay the velocity by a tick

terse ore
#

I mean, I did it on ChunklPopulateEvent and it worked

fluid river
terse ore
#

but laggy af

tawny remnant
sterile token
#

Wait im wondering to ask if you worked with Mongo?

quaint mantle
#

No

sterile token
quaint mantle
#

Nevermind

#

You are not using consumer

fluid river
#

sql OP

quaint mantle
#

This is only needed for consumer

sterile token
tawny remnant
#

so what do i do

fluid river
quaint mantle
#

Before applying velocity

fluid river
#

delay for 1 tick

quaint mantle
#

Try setting "0,0,0" velocity of vector

#

Then wait a tick and try again

fluid river
#

cover your setVelocity with

#

Bukkit.getScheduler().runTask()

#

so it will be delayed for 1 tick

quaint mantle
#

It's not required

#

It can be runTaskAsynchronously

#

Velocity can be applied asynchronously

#

It will be called to another thread

young knoll
#

I mean

#

It doesn't really matter

fluid river
#

that's just the shortest version lol

#

just to test

quaint mantle
#

runTask runs in main thread

fluid river
#

ok and

quaint mantle
#

๐Ÿคท๐Ÿป

fluid river
#

that's literally just a test solution

#

with smallest amount of characters possible

young knoll
#

I mean you are sending a single packet

quaint mantle
#

We don't know if that guy expecting their server to be a fishing gamemode

young knoll
#

You aren't going to nuke the server

terse ore
#

@young knoll getting back to your suggestion

#

could I make a noise generator that is identical to the deep dark generation and just modify it as I want?

young knoll
#

Sure

#

You just need to figure out all the values Mojang uses

tardy delta
#

reverse engineered vanilla generators huh

terse ore
#

I am not that advanced ;-;

#

any help on how to do it?

fluid river
#

well then just go to random YT guide on minecraft noise gen

visual laurel
#

Heya, i have a plugin that counts how many deaths you have and when you reach a certain amount of deaths it kicks you constantly until you get revived, it works until you get revived then gets stuck and doesnt go down after the first death, can someone help

fluid river
#

or to any noise generator

tardy delta
#

reverse engineered vanilla world generator go brr

terse ore
fluid river
#

sources magic ig

smoky oak
tardy delta
#

its minestom anyways so i wonder if you could use it anyways

terse ore
#

f4?

fluid river
#

in intellij

tardy delta
#

thats too much anyways in a sentence

smoky oak
sterile token
terse ore
#

^^

smoky oak
terse ore
#

is it spigot api?

smoky oak
#

i always do --generate-docs --generate-source

visual laurel
# fluid river ??

so when you die it adds a number to an int value in the config file, once you reach 7 deaths it kicks you and doesnt let you join again, there is a revive gui that shows banned players, but once you get revived the deaths stop counting and the config doesnt update for that player

smoky oak
young knoll
#

yes

visual laurel
#

I want it to be easily editable but I guess i can use that

smoky oak
#

im no wizard but im fairly sure i am following that constraint??????
Caused by: java.lang.IllegalArgumentException: Invalid key. Must be [a-z0-9/._-]: FROST_WALKER

young knoll
#

No

#

a-z is not the same as A-Z

#

Keys must be all lower case

smoky oak
#

um

#

arent enums

#

yknow

#

CAPS

young knoll
#

Yes?

hybrid spoke
#

.toLowerCase them

young knoll
#

^

smoky oak
#

so why cant i get a enum with CAPS

young knoll
#

You can with valueOf

smoky oak
#
        Player player = (Player) commandSender;
        String number = strings.length == 2 ? strings[1] : "1";

        if(strings.length == 1 && number.matches("[0-9]+") ){
            int eNumber = Integer.parseInt(number);
            Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(strings[0]));
            if(enchantment == null){
                player.sendMessage("Please define a EXISTING enchantment.");
                return true;}
young knoll
#

But this is different

smoky oak
#

i cant

#

it takes a namespacedkey for some reason

young knoll
#

Oh wait duh

#

Enchantment isn't an enum

#

(Anymore)

hybrid spoke
young knoll
#

getByName is deprecated

#

But yes you can use that

smoky oak
#

keys are weird man

young knoll
#

Not really

#

They are generally just the english name

#

IE minecraft:frost_walker

tender shard
#

why is the string parameter in Enchantment#getByName nullable lol

smoky oak
#

cuz it returns null if you enter null

sleek pond
#

To get a null enchantment

tender shard
#

why would anybody think "oh, yeah, let's see what the Enchantment is whose name is "null"

smoky oak
#

failsafe most likely

tender shard
#

idk almost all other methods have NotNull parameters and throw IllegalArgumentException or similar when the input is null

terse ore
#

one question guys, when I use the method ChunkGenerator#generateSurface the ChunkData parameter, returns the chunk that was originally created or is it a blank one?

smoky oak
#

shouldnt it return a chunk thats not connected with the world yet?

terse ore
#

idk that's why I am asking

#

if I don't do nothing with the ChunkData

#

should it just generate the normal world?

#

or I am getting confused

young knoll
#

No

#

you need to set shouldGenerateSurface to true

#

public boolean shouldGenerateSurface()
Gets if the server should generate Vanilla surface.

The Vanilla surface is generated before generateSurface(WorldInfo, Random, int, int, ChunkData) is called.

This is method is not called (and has therefore no effect), if shouldGenerateSurface(WorldInfo, Random, int, int) is overridden.

Returns:
true if the server should generate Vanilla surface

#

So if you set that to true then you will have a ChunkData with the vanilla surface in generateSurface

terse ore
#

hmm, so ChunkData is only available before the chunk gets created?

young knoll
#

yes

terse ore
#

hmm

#

do you mind explaining me how could I make the same noise generation as vanilla one?

smoky oak
#

cant u clone the vanilla chunk generator

young knoll
#

Some aspects of world generation can be delegated to the Vanilla generator. The following methods can be overridden to enable this:

shouldGenerateNoise() or shouldGenerateNoise(WorldInfo, Random, int, int)
shouldGenerateSurface() or shouldGenerateSurface(WorldInfo, Random, int, int)
shouldGenerateCaves() or shouldGenerateCaves(WorldInfo, Random, int, int)
shouldGenerateDecorations() or shouldGenerateDecorations(WorldInfo, Random, int, int)
shouldGenerateMobs() or shouldGenerateMobs(WorldInfo, Random, int, int)
shouldGenerateStructures() or shouldGenerateStructures(WorldInfo, Random, int, int)
#

Set all those to return true

eternal oxide
#

I've nto looked but surely you can call super

terse ore
young knoll
#

Yes

terse ore
#

hmm

young knoll
#

But only with the biomes in your biome provider

echo basalt
#

oo

#

that's funky

terse ore
#

I wish there was a way to get the vanilla ChunkData

echo basalt
#

I remember 4 years ago trying to modify the default worldgen to exclude oceans

terse ore
#

and then modify it as I want

echo basalt
#

and it was not fun

#

but I was also like 13 at the time and knew about 3 things about spigot

terse ore
#

lol

young knoll
#

Worldgen is half black magic to me still

terse ore
#

so @young knoll one last question before I try to make my own generator

#

is there a way to "intercept" the vanillla ChunkData and modify it as I want?

young knoll
#

Yes

young knoll
terse ore
#

contains the vanilla chunkdata?

young knoll
#

It should if shouldGenerateSurface returns true

#

Granted the surface is for stuff like placing grass and dirt

#

For the actual shape of terrain you want the noise methods

quaint mantle
#

Are there any good resources to provide to users for how YAML works and why things need indentation? I'm trying to help a user of my plugin and I don't think they understand why indentation is important.

young knoll
#

shouldGenerateNoise , generateNoise

terse ore
#

nono

#

I just want to add a nether-alike roof

young knoll
#

Well the nether roof is not flat

#

It's noise based

terse ore
#

just a single layer of bedrock

young knoll
#

You can still do that with the noise method

terse ore
#

is it difficult to do?

young knoll
#

Should just be some loops

terse ore
#

yeah

#

ill run for first time the code

#

wish me luck

#

yay everything is void ๐Ÿ˜ญ

orchid gazelle
#

hello. Is there any way to quickly serialize itemstacks?

young knoll
#

They are config serializable

orchid gazelle
#

means?

young knoll
#

Means you can serialize them to yaml already

orchid gazelle
#

I'd like to serialize them to a json file

young knoll
#

Ah

tardy delta
#

write your own serializer

orchid gazelle
#

I am able to use gson, but sadly I do not know how to serialize itemstacks

young knoll
#

Well you should be able to use similar code to what spigot uses for YAML

tardy delta
#

not too much work with gson

terse ore
#

I am very confused @young knoll

orchid gazelle
#

like there are sooo many options needing to get checked and serialized

young knoll
#

That is how spigot serializes them for yml

#

Which should be a good start

eternal oxide
#

ItemStacks are ItemStacks and Gson is Gson

orchid gazelle
#

I'd also be fine with just writing some base64

#

I do not care about readability, I just want it to be able to save and read

young knoll
#

Well

#

You could use BukkitObjectOutputStrem to convert it to bytes

#

Then base64 that

tardy delta
smoky oak
#

i mean

#

you can just take the outputstream and turn it into a byte[] array

eternal oxide
#

Just create a TypeAdapter and register it

smoky oak
#

and store that somewhere

eternal oxide
#

that thread covers it

orchid gazelle
#

counting in all the different options an ItemStack can have

terse ore
#

Why does this only generate void?

public class DeepDarkChunkGenerator extends ChunkGenerator {
    public void generateSurface(WorldInfo info, Random random, int chunkX, int chunkZ, ChunkData data) {
        for (int y = 51; y < 320; y++) {
            for (int x = 0; x < 16; x++) {
                for (int z = 0; z < 16; z++) {
                    data.setBlock(x, y, z, Material.AIR);
                }
            }
        }
    }

    public boolean shouldGenerateSurface(WorldInfo info, Random random, int chunkX, int chunkZ) {
        return true;
    }
}
``` @young knoll
eternal oxide
#

The TypeToken handles all teh meta deserialization

#

you don;t have to do it manually

young knoll
terse ore
#

both of them?

#

let me try

analog thicket
#

Is it possible to get nearby packet armorstands?

fluid river
#

is that my code

#

akex

terse ore
young knoll
#

Packet armor stands only exist on the client

fluid river
#

it was bad tho

terse ore
#

I modified it

fluid river
#

also you are spawning air only

#

ofc it's void

terse ore
#

some advancements

terse ore
#

and more

desert musk
#

Does anyone have written tutorial suggestions for making plugins?

fluid river
#

yes

young knoll
terse ore
#

are this

shouldGenerateSurface() or shouldGenerateSurface(WorldInfo, Random, int, int)
shouldGenerateCaves() or shouldGenerateCaves(WorldInfo, Random, int, int)
shouldGenerateDecorations() or shouldGenerateDecorations(WorldInfo, Random, int, int)
shouldGenerateMobs() or shouldGenerateMobs(WorldInfo, Random, int, int)
shouldGenerateStructures() or shouldGenerateStructures(WorldInfo, Random, int, int)```
#

true by default?

indigo frost
#

hi i need some help

fluid river
#

iirc no

#

if you just do

terse ore
#

should I use @Override for all of them?

fluid river
#

WorldCreator#generator(new ChunkGenerator() {}) you would have void

young knoll
terse ore
#

what does it change tho? Because with generateNoise didn't used @Overide but still worked

young knoll
#

It's for the compiler

#

It's not strictly needed but it's good practice

fluid river
#

actually doesn't change anything in algorithm

#

just makes compiling easier

indigo frost
#

im making a plugin and one of the features is when a tripwire hook is placed, it triggers an event that finds the placed block and removes it so that it acts like a key. I've tested the plugin and there are no issues. The issue im having is when the server has the customNPC's mod, none of the events register. Does anyone know the fix to this?

terse ore
#

WAIT

#

I THINK I GOT IT

tawny remnant
fluid river
#

does it even move

#

is it in water

terse ore
#

YOOO @young knoll

fluid river
#

show

terse ore
fluid river
#

cool

#

now your code xD

terse ore
terse ore
#

lol

fluid river
#

?

terse ore
#

this is the only code remaining from yours

fluid river
#

hehe

terse ore
#

ty man

fluid river
#

you had to figure out generator yourself tho

#

rate the post tho โค๏ธ

terse ore
#

can you send it again

#

I will

young knoll
#

I've done fishing mobs before

#

Let me find what I did

desert frigate
#

is it possible to get a list of blocks from BoundingBox?

terse ore
tawny remnant
#

then it starts moving as normal

remote swallow
#

is there a way to send a message to a player without it appearing in their log console or whatever its called

young knoll
#

What I did was set the mob's velocity to the velocity of the caught item 1 tick later

storm stump
#

Why is my use of PacketPlayOutRelEntityMove jerky?

young knoll
#

And then remove the caught item

storm stump
#

The entity still jolts

#
            return new PacketPlayOutEntity.PacketPlayOutRelEntityMove(entity.getId(), (long)(4096*(x-oldX)), (long)(4096*(y-oldY)),  (long)(4096*(z-oldZ)), onGround);
#

oldX is entity.lastX

#

x is entity.locX

#

Sending on every tick

fluid river
#

try spawning mob in the air and check if it's pulled towards the player

terse ore
#

can you set max building y?

desert frigate
young knoll
#

Loop through the xyz from getMin to getMax

terse ore
#

yeah that

terse ore
young knoll
#

You can with a datapack

tawny remnant
young knoll
#

Idk if you can with the api

wild cedar
#

By any chance does anyone know changes that are made to location.subtract()/add ?

#

They seem to act differently in 1.19.4

#

a bit higher than usual

young knoll
#

I doubt anything changed

fluid river
#

they are still same

wild cedar
#

Then I guess the armorstand nametag place has been changed

fluid river
#

you probably forgot to clone

wild cedar
#

it used to be down, but it's up now

young knoll
#

What do you need it for

wild cedar
#

armorstand nametag for holograms

young knoll
#

Use TextDisplay for holograms

wild cedar
#

I'm just trying to see if something is changed in location or armorstand

#

Since I didn't change any values, but the text seem to be a bit higher

#

which I feel it's from add/subtract methods of location

weak meteor
#

How to make a close-proof inv?

#

I refer to when the user closes the inv, give back his items

fluid river
#

?

young knoll
#

When it's closed, loop over all the slots you want and grab the item in them, then give them to the player

fluid river
#

player can place items in this inv?

weak meteor
#

yep

fluid river
#

does your inv has custom holder?

weak meteor
#

what is a custom holder?

fluid river
#

InventoryHolder

#

of your inv

#

null or player himself or <T extends InventoryHolder>

weak meteor
#

ye the problem is there bro

#

i just dont understand this inventoryholder stuff

#

and i need the plugin like for the friday

fluid river
#

show your inventory creation code

young knoll
#

You shouldn't use holders to identify your inventory

fluid river
#

it's literally like 2 mins of coding

fluid river
#

i only do that using holders

#

all the time

young knoll
#

Because that isn't what they are designed for

fluid river
#

it's like super useful

young knoll
#

You should use the inventory instance itself, or the view returned from openInventory

fluid river
#

๐Ÿคฎ

weak meteor
#

?paste

undone axleBOT
fluid river
#

i use holders so i don't track instances

weak meteor
fluid river
#

well if you are not using custom holder you need to create a list of itemstacks

#

attached to a player

#

so you would need a hashmap

young knoll
#

What

fluid river
#

<Player, List<ItemStack>>

weak meteor
fluid river
#

and just add itemstacks to this list when player drags items into your inventory

weak meteor
#

Its just 2 items

young knoll
weak meteor
#

and well, the player

fluid river
#

and when player closes the inv remove his entry for the map and give items from the list

weak meteor
#

ok

young knoll
#

Tis a good resource

weak meteor
fluid river
#

so guy just used an inventory handler

#

and a hashmap

#

and i suggest just using a holder

young knoll
#

I mean you can use a holder

#

Nothing is going to stop you

#

But MD will smack you :p

weak meteor
#

Okay so maybe i just use a map but how tf i can get the items out of the if statement?

#

nvm

#

just thought a little bit

fluid river
#

you just add items to the list as player drops them at the inv

#

and when player closes it, just loop through list and give items back to the player

#

and remove map entry

desert frigate
weak meteor
#

sorry for the bad question but i've never managed maps, how i add elements?

#

<Key, Value>, right?

young knoll
#

Map#put(key, value)

weak meteor
#

Thanks.

indigo frost
#

hey i need some help. For some reason the customNPC's mod is causing the events in my plugin to just not do anything at all and I have no idea why

#

how can i fix this aside from removing the mod

young knoll
#

Mod?

#

Spigot doesn't run mods

indigo frost
#

well its archlight

#

mix of spigot and forge

young knoll
#

Go ask archlight about it then

#

We don't provide support for forks here

weak meteor
# young knoll Map#put(key, value)

@EventHandler
public void OnEnchanterMenuClose(InventoryCloseEvent e){
for (Player player : items.keySet()) {
List<ItemStack> itemsList = items.get(player);
for (ItemStack item : itemsList) {
if (player.getInventory().firstEmpty() != -1) {
player.getInventory().addItem(item);
} else {
player.getWorld().dropItem(player.getLocation(), item);
}
}
}
}

#

This should do?

fluid river
#

ye but

#

why not just

#

items.get(player)

#

without loop

weak meteor
#

oh

#

thats true

#

its only 1 thing

fluid river
#

only one player is closing the inventory

weak meteor
# fluid river only one player is closing the inventory

List<ItemStack>itemStack = items.get((Player) e.getPlayer());
Player p = (Player) e.getPlayer();
for (int i = 0; i < itemStack.size(); i++){
ItemStack item = itemStack.get(i);
p.getWorld().dropItem(p.getLocation(), item);
}

#

look

analog thicket
#

Is it possible to get nearby packet armorstands?

young knoll
#

Not unless you keep track of them somewhere

analog thicket
#

Well, i do have them on a list.. problem is in making an animation that should spin a random about. Then remove every single armor stand but the top one.

#

If that makes sense.

echo basalt
#

I'm thinking on integrating my scripting system with my menu engine and being able to make scripts in-game hmm

#

how awful would it be

young knoll
#

Loop through the list and check the distance

analog thicket
#

Distance is same all over :/

young knoll
#

What

analog thicket
#

Ill send a vid of the animation.

#

This is with a fixed value btw.

echo basalt
#

Not sure how you're doing animations

#

at work we use a timeline system

young knoll
#

Why do you need to get nearby ones if you already have a list of them all

echo basalt
#

With a timeline system, we'd probably make a Set<UUID> usedEntityIds that would keep track of all the entities that need to be removed when the timeline is done

analog thicket
#

Thats the only way i could think of getting it if i don't know which one is at the top.

young knoll
#

Check the location of each?

analog thicket
analog thicket
echo basalt
#

ordered list, maybe?

analog thicket
#

or that would be 0-7 but

#

yeah

echo basalt
#

nvm the amount is random hm

#

How are you doing such a random selection?

analog thicket
#

Haven't really found out yet, but im thinking rotating it by intervals of 45. Because thats how many degrees that between each.

echo basalt
#

what if you do like

#

get a random index in the list

#

and rotate by 45 * index

analog thicket
#

Uuh i could do that yeah

echo basalt
#

that way, you have the element that's on "top"

#

as it's the element at the index

analog thicket
#

Thats a great idea! imma try that.

#

Thanks

sterile token
#

Please!!! I need some simple help, its struggling me

#

Because its throwing the params lenght exception, when the param is only 1

#

๐Ÿค”

echo basalt
#

ehh annotations

#

I'd probably just make a subscription system

#

no need to overcomplicate things

sterile token
#

please i know what you think about it, but i need to fix this ๐Ÿ˜ฌ

echo basalt
#

I think about a different system :)

sterile token
#

Right thats the code

echo basalt
#

Won't fix yours because I'd never do it that way and don't know how I'd use it

sterile token
#

Thats line is exception is being throw but if you see on the cap about the listener just isten 1 packt

echo basalt
#

hm

#

debug?

#

just add a couple souts

young knoll
#

Don't methods have like, an implicit first param

sterile token
#

hmn

#

I will check that

#

thanks tho

echo basalt
#

isn't there like a getMethodsAnnotatedBy

#

?

sterile token
#

java 1.8, so prob not

#

But the thing is that, why fails on that listener? ๐Ÿค”

echo basalt
#

no clue, print out the params

#

that's how you debug things

#

instead of crying you figure out why it's failing that check

sterile token
#

๐Ÿซก

#

Agree with you, you are right man

echo basalt
#

I'm still thinking how I'll make the menus for the scripting system hmm

#

maybe on a particular day where I'm mentally instable and feel like linking 15 menus together

young knoll
#

When in doubt, sysout

#

You could also use a proper debugger, but that's no fun

echo basalt
#

proper debuggers are for memo leaks

sterile token
#

also proper debugs are for stable proejcts, not just for temporary projects

echo basalt
#

oo I upped my daily avg from 2 hours to 3 hours today

young knoll
#

What is that?

echo basalt
#

wakatime

#

it tracks how much time I spend coding

young knoll
#

I see

echo basalt
#

and puts it in a fancy dashboard

young knoll
#

Why is gradle a language

remote swallow
#

build.gradle

analog thicket
young knoll
#

Yeah but that is groovy

remote swallow
#

joshi told you about that days ago

remote swallow
echo basalt
#

not really

young knoll
analog thicket
echo basalt
#

the only part I don't like is the funky visualizers

young knoll
#

Oh heck yeah

sterile token
young knoll
#

Psychedelic word cloud

echo basalt
sterile token
echo basalt
#

I must've been mentally unstable on aug

sterile token
#

Thats are all the listener, and all listen to a single packet

#

๐Ÿ˜ก

echo basalt
#

param name, class type

sterile token
#

yes i did that before

#

And they are all okay

echo basalt
#

odd

#

rework your checks idfk

sterile token
#

yes

#

I will do that tho

analog thicket
echo basalt
#

nah

#

I actually didn't have any errors yesterday

#

today was funky

smoky oak
echo basalt
#

but yesterday I wrote this entire scripting system and it worked first try

#

and it made me extra happy

analog thicket
smoky oak
remote swallow
#

illusion

echo basalt
#

yea

remote swallow
#

how many hours do you have on ur wakatime

echo basalt
#

today I was adding new functions and forgot to increment my shit

echo basalt
remote swallow
#

since you joined

echo basalt
smoky oak
#

fucks wakatime

echo basalt
#

time tracker

remote swallow
#

1.2k hours

#

thats a few hours

echo basalt
#

you can graph my seasonal depression based on my commit activity alone

remote swallow
#

im only at 145 since jan 2nd

analog thicket
# echo basalt

This is pure coding time right? it doesn't count testing and stuff

echo basalt
#

I was feeling extra sad around sept - dec, and mid-jan to march

echo basalt
smoky oak
#

i have a github but im too lazy to connect it to my shit

echo basalt
#

this is jan 2nd, but 2 years ago

young knoll
#

We love depression killing motivation

smoky oak
#

so occasionally stuff breaks and i do it all over again lol

remote swallow
echo basalt
#

lemme see

remote swallow
#

you can see where i went on holiday

smoky oak
#

u almost made amogus

hazy parrot
#

basically same ๐Ÿ˜›

young knoll
#

Mine is so dead

echo basalt
remote swallow
#

get fucked

echo basalt
#

yes I have the monthly subscription

remote swallow
#

imagine having money

echo basalt
#

I get paid about 20-25$ / hour there

#

so this year I made at least 2 grand

remote swallow
#

whats the blue project

echo basalt
#

it's my main project atm

remote swallow
#

what does it do

echo basalt
#

and the green project is my main project, but on my school laptop

echo basalt
remote swallow
#

core features

echo basalt
#

pick one

smoky oak
echo basalt
#

Portugal

smoky oak
#

we havent seen hide or hair of school laptops here

echo basalt
#

my "school laptop" more like the 1k$ LG Gram that I bought to work in class

smoky oak
#

ah

echo basalt
#

the EU gave shitty lenovo laptops to everyone

#

like last year

smoky oak
#

you meant 'laptop USED for shool'

echo basalt
#

laptop I bought to use in class instead of actually doing shit

smoky oak
#

i did the same damn thing

#

brought my own and a lan cabble

#

whatever computers they have has no redeeming qualities

young knoll
#

Oh it's an IDE plugin

smoky oak
#

at least the 2015 variants were encased in 1 inch of solid plastic and pretty much indestructible