#help-development

1 messages · Page 568 of 1

cunning roost
kind hatch
#

Wut?

cunning roost
#

the first step on that page, for maven is already set to auto download,

#

the plugin it's talking about I dont have installed, I think I can get ultimate for free since im a student

kind hatch
#

I'll be, didn't know that was a plugin.

kind hatch
sterile axle
#

Don't need the plugin then

kind hatch
#

Although, you shouldn't need the plugin.

sterile axle
#

But yes you can get ultimate for free if you have a .edu address

kind hatch
#

I thought indexing was just a general feature of the IDE.

#

Even in the community edition.

cunning roost
#

yeah i have an edu. ill make that account and give it a go

sterile axle
#

It is, the plugin must do something else. I think it said it uses JetBrain's CDN to speed up indexes or something

eager girder
#

^

#

Ill just repost since it's a while up

#

Why is my enchant not able to be applied?

override fun canEnchantItem(item: ItemStack): Boolean {
    return Tag.ITEMS_HOES.isTagged(item.type)
}
val book = ItemStack(Material.ENCHANTED_BOOK)
val meta: EnchantmentStorageMeta = book.itemMeta as EnchantmentStorageMeta
meta.addStoredEnchant(Replanting(key), 1, false)
book.itemMeta = meta
cunning roost
#

I tried the JDBC java straight from oracle and it never worked

kind hatch
#

You could first try invalidating caches.

#

File > Invalidate Caches...

eager girder
#
val f: Field = Enchantment::class.java.getDeclaredField("acceptingNew")
f.isAccessible = true
f.set(null, true)

for (enchant in enchants) {
    Enchantment.registerEnchantment(enchant)
    println("Registered enchantment " + enchant.getName());
}
kind hatch
#

You might get the option to reindex upon the reboot.

#

Aw shi

kind hatch
cunning roost
#

I have openJDK, I just meant I got the JDBC from oracle

#

not sure if this is relevant info but im using Windows

kind hatch
#

That shouldn't matter all that much.

cunning roost
#

Does java care too much if I work on Mac and windows, should I set up a git ignore or something?

kind hatch
#

It would probably be a good idea to ignore the os specific files. Other than that, it should function the same.

young knoll
#

Sure, anything is possible with enough brute force

river oracle
#

and anvil shit

#

or is that hard coded

young knoll
#

Yes

river oracle
#

hmmmm

young knoll
#

They still won’t work in enchantment previews tho

river oracle
#

really :(

#

that's mean

#

are enchantment previews hard coded

#

ig I could just look at nms

young knoll
#

They are sent to the client by numeric id

river oracle
#

ahhhh

young knoll
#

The client won’t know what the numeric id of your custom enchant corresponds to

river oracle
#

so client would have no fucking clue

young knoll
#

Mhm

#

Iirc it just shows no tooltip

#

Which is better than exploding

river oracle
#

is the Preview itself completely client side

young knoll
#

Yes

quaint mantle
#

What method is it for when the plugin first loads up

river oracle
#

oof

river oracle
eager girder
#

set result?

#

ye

#

k

river oracle
#

🥳

young knoll
#

I can finally help people through telepathy

eager girder
#

didn't see it down here 😅

river oracle
#

:P

young knoll
#

MD is all the way in Australia

#

I need more power for the telepathy to reach that far

river oracle
young knoll
#

Ah right

#

I’ll merge it in the morning

worldly ingot
#

PR-ception

river oracle
#

I 🍴 the 🍴 and now want the 🥔 to be merged into the 🍴of the 🍴

cunning roost
#

thanks for your help @kind hatch and @sterile axle I think ive figured it all out for now

#

and I think you helped too @river oracle 🙂

river oracle
#

Uh I did something ig?

cunning roost
#

what is the difference between a build and a "shaded" build?

#

is that a maven thing?

buoyant viper
#

need to steal for My gui

eager girder
#

Don't I need a copy of the first item?

#

If so how would I do that

#

nvm

buoyant viper
#

prety good

#

had sorta meant to do BT-GUI inside of BT but i think it just really wouldntve allowed what i wanted to do bc of things like the PortableGit n Maven downloads

#

or i would just need to try n take a slightly convoluted approach

buoyant viper
cunning roost
#

[05:32:17 INFO]: [slimeBob] Connected to Database

It's Alive!!!

#

@kind hatch @sterile axle

quaint mantle
#

its possible to playsound for 100 blocks ?

#

i mean i playsound and player can hear this sound 100 block around

sterile axle
#

not without some extra work

#

find a center point, then get all entities in a radius of 50 blocks in every direction, for each entity, play the sound

sullen marlin
#

Or just play it at the centre point really loud xD

#

Ymmv

eager girder
#

Why can I not cast potatos to ageable

noble lantern
#

are you casting it to the wrong ageable

#

theres 2, entity and blockdata

eager girder
#

blockdata

#

import org.bukkit.block.data.Ageable

noble lantern
#

code?

eager girder
#

println(event.block.type) = Potatoes

#

if ((Tag.CROPS.isTagged(event.block.type) && (event.block as Ageable).age == (event.block as Ageable).maximumAge)) {

#

Ill fix the double cast in a bit

#

just testing rn

noble lantern
#

block.getBlockData() not Block itself

eager girder
#

Ohh

#

alr

#

Worked

#

Thank you

#

Done with my first custom enchant!

sweet sonnet
#

🫡

eager girder
#

what does inventory.addItem return if a players inventory is full?

noble lantern
eager girder
#

alright

tranquil prairie
#

I keep getting java java.lang.NoSuchMethodError: 'com.sk89q.worldguard.bukkit.RegionContainer com.sk89q.worldguard.bukkit.WorldGuardPlugin.getRegionContainer()' with the code java @EventHandler public void onGamemodeSwitch(PlayerGameModeChangeEvent event) { RegionContainer wg = WorldGuardPlugin.inst().getRegionContainer();

noble lantern
#

make sure world guard is installed on the server & your plugin depends on it in plugin.yml

sweet sonnet
#

Whats a good version I should support from (e.g 1.13>)?

#

My plugin is just a basic tree chopping plugin

jagged monolith
#

It's really upto you. Depends how far back you want to support.

sweet sonnet
#

i dont really know

subtle folio
#

and 1.8.8

spring creek
#

Can you make a secret gate for people with a certain luckperms rank can get through and what plugin would it be?

sweet sonnet
#

This channel is for creating/developing plugins as stated in the description. Are you looking to make a plugin or obtain one?

#

and please elaborate on "secret gate"

spring creek
#

yeah

#

If you dont have the required luckperms rank you cant access that area/ building at my servers spawn

sweet sonnet
#

Are you looking to make a plugin or obtain one?

spring creek
#

obtane

sweet sonnet
#

just use worldguard

#

set a region only certain people can enter

spring creek
#

oh. ok thanks!

orchid trout
#

when i store itemstacks in arrrays, items' amounts just decrease randomly

quaint mantle
#

can i control furnace cook time ?

sweet sonnet
#

A quick google search doesnt hurt

pure socket
#

Excuse me
Can someone teach me how to convert the source code of Github into a .jar plug-in file?

sweet sonnet
#

build it

#

That repo uses maven

pure socket
#

I want to turn this into a plugin file but don't know how to use it

sweet sonnet
#

package it with maven

pure socket
#

emm Can you do it for me please?0.0

#

I don't know how to use edit yet

sweet sonnet
#

Do you use intelij?

pure socket
#

ok.

#

I only have visual studio code installed

pure socket
sweet sonnet
#

no

#

you need maven

pure socket
sweet sonnet
#

yes

pure socket
#

How to download?.

sweet sonnet
#

press the big blue download button

pure socket
#

apache-maven-3.9.2-bin

#

ok

#

How do I use it next?

sweet sonnet
#

Preferably add maven to PATH
Clone the repository
CD into it
Run mvn package

pure socket
#

CD myitems

quaint mantle
#

can i growth nether fungus without bone meal ?

pure socket
#

Well, I'm still not good at it

pure socket
sweet sonnet
quaint mantle
wet breach
#

plugins for the most part can pretty much do what they want

subtle folio
smoky anchor
subtle folio
#

you have to do stupid texture shit and reskin blocks

smoky anchor
#

I wonder in what way you mean that 'cause I am pretty sure I have accomplished mostly fully custom blocks.

smoky anchor
subtle folio
#

is there new api features? I don’t think you can apply texture ids to blocks thought that was only@items

wet breach
#

there is 2 ways to have custom blocks. There is the visual appearance of blocks and then there is the function of the block. You are free to change the function of any block

smoky anchor
#

nope, you can however use display entities for custom models

wet breach
#

the visual portion is mostly client sided

subtle folio
smoky anchor
#

some people do re-texture noteblocks since they have what, 800 states, also gives some performance over entity models.

shy rock
#

||``` private static double calculateZombieHealth(int zombieLevel, double startingZombieHealth) {
double baseZombieHealth = startingZombieHealth;
double ZombieHealthMultiplyer = zombieHealthMultiplier;
double zombieHealth = startingZombieHealth * Math.pow(zombieHealthMultiplier, zombieLevel - 1);
double maxHealth = 2048.0; // Maximum allowed health

    if (zombieHealth > maxHealth) {
        zombieHealth = maxHealth;
    }

    return zombieHealth;
}```||

Is there a way to caculate all health values at plugin start? instead of needing to caculate everytime a zombie spawns?

quiet ice
#

Which values can zombieLevel be?

shy rock
#

id set a limit from 1 to 99 but it can be changed

small current
#

hey guys, not related to spigot but does anyone know anything about world cloning with SWM ?

quiet ice
#

Then it may be kinda dangerous to cache but you could just store it in an array

wet breach
quiet ice
#

However if you support reloading configs you'd need to repopulate the arrays each time which may cause issues

wet breach
#

Well the array is to store it

#

but yes

quiet ice
#

And I don't think that Math#pow is that expensive to begin with

wet breach
#

it can be, but if its not super complex stuff then no

shy rock
#

Well I want to include every mob so

wet breach
#

you would need to be spawning something like thousands of zombies per second to have some kind of effect

shy rock
#

Should I just leave it be then?

wet breach
#

if it works and you are not having issues definitely

#

you should only invest in optimizing something like this only after you have done some profiling and research to determine this is something affecting your server in a negative way

#

however odds are, you will probably have other stuff that is before this piece of code comes up as a culprit

quaint mantle
#

how could I use NMS 1.19.4 to make my LivingEntity move to a specific Location?

wet breach
#

you would need to utilize the goals/AI portion of the entity for this

quaint mantle
chrome beacon
quaint mantle
#

how could I use the goals then?

chrome beacon
#

Take a look at how the existing goals work

#

Then make your own

wet breach
#

if documentation existed for NMS

#

there wouldn't be much of a reason for API's like bukkit or spigot

drowsy helm
wet breach
drowsy helm
#

cbf reading everything

#

need to put my 2 cents in >:)

wet breach
#

lol

quaint mantle
#

can i growth nether fungals without bonemeal ?

smoky anchor
#

in what way ?

sweet sonnet
wet breach
#

they must not read the chat

#

therefore pointless to respond to them if they are not going to participate in a conversation

robust zenith
smoky anchor
#

One of the thrown exceptions has the following message

special characters are not allowed

wet breach
#

on top of you are using sponge and paper

smoky anchor
#

Also paper

robust zenith
#

it seems i have to recreate the file with paper right?

#

Just i copy paste every class?

smoky anchor
#

no, it seems that you have special characters that are not allowed by yaml in the config file
and since you're using paper, you should probably ask on the paper discord

wet breach
#

I assume the special character it is complaining about is the section symbol that mc uses

robust zenith
#

Oh yeah there i put "&" for colorCodes

#

I think i have to create a string translator it takes "&" as a colorCode translator right?

wet breach
#

there is an api for that already

#

unless paper changed it

#

which again this isn't the paper discord

robust zenith
#

ahahahah

robust zenith
#

public static String translateString(String input) {
return ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(HubCore.getInstance().getConfig().getString(input)));

}

what about if i do something like that

tender shard
#

instead of Objects.requireNonNull I would rather print out a useful error message or use the default message from your included config

smoky anchor
#

I may not know yaml, but I think it is screaming at you for having the & in the config
So doing stuff with it in code would be pointless

robust zenith
#

i hope it's going to take the String from the config as input

#

Or now for the moment just trying running without special character XD XD XD XD

wet breach
#

I don't really care about paper api

#

so it isn't relevant

robust zenith
#

Nothing guys, i removed the '&' from the config, but it is still crushing

wet breach
#

& is not a special character

#

the section symbol from mc is

smoky anchor
#

§ ?

wet breach
#

yeah that

#

its called a section sign or symbol

robust zenith
#

Solved, there was a failure in the creating of the world nether

#

LOL

smoky anchor
sweet sonnet
#

Please fix this indentation 😭

smoky anchor
# smoky anchor

instance is null when you try to use it for the first time...

smoky anchor
robust zenith
smoky anchor
#

you think ?
This is like textbook example of NPE :D

robust zenith
#

NPE?

smoky anchor
#

Null Poiner Exception

robust zenith
#

uh.... right

tender shard
#

you call "instance.getConfig()" before you assign any value to "instance"

#

btw why are you waiting until onEnable to set the instance? why not do it directly?

public final class HubCore extends JavaPlugin {

    private static HubCore instance;

    {
        instance = this; // <- set the instance in the constructor / init block
    }

    @Override
    public void onEnable() {
        FileConfiguration config = instance.getConfig(); // also why are you using the instance field instead of "this" here? That's quite useless. Just do "getConfig()" directly

        // ...
    }
}
wet breach
#

but otherwise yeah you can do just as you described

cosmic spear
#

Hi guys why using Kyori adventure api i have errors on every method like this: java.lang.NoSuchMethodError: 'org.bukkit.inventory.Inventory org.bukkit.Bukkit.createInventory(org.bukkit.inventory.InventoryHolder, int, net.kyori.adventure.text.Component)'

#

I can't send Message, or Log in console

#

Same error

#

I'm trying to convert my Paper plugin to Spigot plugin to support both

remote swallow
wet breach
#

I see this is the time of year where we get an influx of people asking questions in the wrong discord

#

don't see how they fail to read this is spigot lol

sweet sonnet
quaint mantle
round finch
wet breach
#

why not, its static

#

statics don't need methods

round finch
#
private static HubCore instance;

    {
        instance = this; // <- set the instance in the constructor / init block
    }
#

this i mean

wet breach
#

they mean the body of the class

#

it doesn't have to go in the onEnable() method, it can be set outside of it

round finch
#

🤯

sweet sonnet
round finch
#

damm

wet breach
#

the only thing that is outside of the methods in a class is the class itself lol

quaint mantle
#

nvm

sweet sonnet
#

can you just read the docs please

quaint mantle
quaint mantle
#

is not possible nether fungal growth without bonemeal

#

i need do this spigotapi

sweet sonnet
# quaint mantle wdym 😄
  1. find out what you want to do
  2. think of how it might be done
  3. search for the appropriate event
  4. check methods
sweet sonnet
quaint mantle
#

if i understand or learn this

#

i will do others

sweet sonnet
#

do you have any java knowledge

quaint mantle
#

yes

#

but you don't answer correctly

shy rock
tender shard
quaint mantle
#

hi

#

do u rebember me ?

tender shard
quaint mantle
#

this day

shy rock
#
        Random random = new Random();
        int range = maxZombieLevel - minZombieLevel + 1;
        int zombieLevel;

            double scaledRange = Math.pow(range, zombieLevelProbabilityFactor);
            zombieLevel = minZombieLevel + (int) Math.pow(random.nextDouble() * scaledRange, 1.0 / zombieLevelProbabilityFactor);

        return zombieLevel;

    }```
Having big trouble with probabilities,  zombieLevelProbabilityFactor is set to 0.5, but doesn't really seem to work, while when set to 10.0, it does
forgot to mention, I want it to spawn lower numbers when zombieLevelProbabilityFactor is a low number, and the opposite when its a high number
flint coyote
quaint mantle
flint coyote
#

didn't read about your problem, lemme scroll a bit - also I just woke up, I'll try my best

flint coyote
#

Aight

quaint mantle
#

its possible to growth crimson fungus without bonemeal ? in normal minecraft

#

in my opinion

#

not

flint coyote
#

Oh it's not a development question? You mean if there's a way to make those small shrooms become a tree without bonemeal?

quaint mantle
#

in my opinion, not

#

so i need idea for do this

#

alright

#

i think something

remote swallow
#

id guess just modify the nbt data for the block, probably a growth stage or something

quaint mantle
#

am i need spawn structure ?

flint coyote
#

Oh so you want to solve it programmatically. Lemme check some docs

quaint mantle
#

i found this in stucturegrowevent: "treetype"

#

can i paste this structures with any method ?

noble lantern
#

yeah mushrooms are trees in the code

#

so use the spawnTree method in World

quaint mantle
#

O MG

#

YES

noble lantern
#

generateTree*

quaint mantle
#

-YER WSE S ER

#

YESSS

#

I FINDING THIS

#

IN 2 DAY

quaint mantle
#

not only trees

#

only for other structures ?

#

like desert pyramid

#

jung temple

noble lantern
#

for structures might be different but i assume a generateStructure might exist by now

eternal oxide
#

StructureManager

#

Bukkit#getStructureManager

flint coyote
remote swallow
#

generics are making me realise some really weird things with bukkit

tender shard
#

and then you bake() it

remote swallow
#

BlockBreakEvent according to the jds is called when a player breaks a block, it doesnt extend PlayerEvent, player death event even has Player in the name, but no where extends PlayerEvent

quaint mantle
#

or they are formed without damaging other blocks

flint coyote
flint coyote
tender shard
#

unfortunately he's always alseep until afternoon

flint coyote
tender shard
#

it was public at some point, but not anymore

#

the version on grindr is pretty outdated

noble lantern
grave kayak
#

what event should i use to see when a player has removed a specific potion from a brewing stand

tender shard
#

and INventoryDragEvent (nah that only works for placing things)

grave kayak
flint coyote
#

Too bad when an api like that goes from open source to private repo - I'm glad you were granted access and are happy about it!

tardy delta
#

doesnt look too bad

tender shard
#

might also listen to BlockBreakEvent in case the player just breaks the brewing stand

brazen violet
#

this should acctully work or?

Particle.DustOptions dustOptions = new Particle.DustOptions(Color.GRAY, 1.0f);
player.spawnParticle(Particle.REDSTONE, player.getLocation(), 50, dustOptions);

noble lantern
brazen violet
brazen violet
#

maybe its because 1.20.1

noble lantern
#

i would wanna die dealing with that in map form

remote swallow
#

oh its not actually hard

silent steeple
#

anyone know why i get this error

Caused by: java.lang.NoClassDefFoundError: me/filoghost/holographicdisplays/api/HolographicDisplaysAPI

my pom.xml:

<dependency>
<groupId>me.filoghost.holographicdisplays</groupId>
<artifactId>holographicdisplays-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>

<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.io/repository/maven-public/</url>
</repository>

remote swallow
remote swallow
tender shard
# remote swallow

is it intentional that you can only have one consumer per event class?

silent steeple
#

yeah i do

tender shard
#

kk

#

otherwise I would have suggested guava's multimap

noble lantern
#

List<Consumer>

remote swallow
#

is a multimap technically just a Map<K, List<V>>

tender shard
#

MultiMap is just an interface

#

ArrayListMultimap is indeed a Map<K,List<V>>

wet breach
tender shard
#

there's a ton of Multimaps in guava: ArrayListMultimap, ForwardingListMultimap, ForwardingMultimap, ForwardingSetMultimap, ForwardingSortedSetMultimap, HashMultimap, ImmutableListMultimap, ImmutableMultimap, ImmutableSetMultimap, LinkedHashMultimap, LinkedListMultimap, TreeMultimap

#

actually, it's a dozen

#

lol

shy rock
#
        Random random = new Random();
        int range = maxZombieLevel - minZombieLevel + 1;

        double probability = 1.0 - Math.pow(random.nextDouble(), zombieLevelProbabilityFactor);
        int zombieLevel = minZombieLevel + (int) (probability * range);

        return Math.min(maxZombieLevel, zombieLevel);
    }```
can someone explain me why when zombieLevelProbabilityFactor = 10.0, numbers high, but when its = 1.0 numbers are random?
ivory sleet
#

It violates the fact consumers allow covariance and suppliers allow contravariance

#

Not the other way around

tender shard
cinder abyss
#

hello, how can I use nms in my spigot plugin (1.19.4, gradle)

tender shard
noble lantern
#

or at the least keep a referance to that random

#

that hurts to see r_baby_cry

ivory sleet
#

Random sucks

tender shard
ivory sleet
#

They can run BT and depend on the spigot artifact

tender shard
#

maven -> spigot's "specialsource" plugin
gradle -> paper's "paperweight userdev" thing

cinder abyss
ivory sleet
tender shard
# cinder abyss

as said, in gradle you wanna use paper's paperweight / userdev plugin

cinder abyss
#

so, I can't use nms in spigot ?

ivory sleet
#

And then in ur build.gradle(.kts) change spigot-api to spigot

#

You can

#

But its poor

remote swallow
#

you can its just obsfucated

cinder abyss
tender shard
#

you can, but you gotta remap it manually, or you use the obfuscated version (don't do that), or you gotta use maven

cinder abyss
#

I just want nms

#

not stability x)

tender shard
#

then just change "spigot-api" to "spigot" and deal with the obfuscated mappings

ivory sleet
#

User friendliness yeet

tender shard
#

be sure to run buildtools for 1.19.4 beforehand

eternal oxide
#

?nms

tender shard
#

(that is for maven)

cinder abyss
#

okay thanks

eternal oxide
#

pretty sure he was told long ago Spigot is maven based

tender shard
#

yeah probably lol

ivory sleet
#

Gradle > Maven (:

#

Noway it got added

#

Lmao

eternal oxide
#

Wash your mouth out with soap!

ivory sleet
#

🥺 sowwy

tender shard
eternal oxide
#

yum fish

tender shard
#

Schnitzel Wiener Art > Wiener Schnitzel

remote swallow
tender shard
#

wow, so useful

flint coyote
#

lmao

ivory sleet
#

Given type A and type B where A <= B meaning a is A subtype of B (like a subset, not to be mixed up with a proper subset) then covariance means a type constructor S<T> will imply the following relation that (A <= B) -> S<A> <= S<B>. Contravariance means A <= B -> S<A> >= S<B>.

#

That’s the theory part

#

Now let’s look at the application part

#

If we have a function addCallback(Consumer<Animal>)

#

What should happen if we pass a Consumer<Dog> respectively a Consumer<Object> ?

#

Given that Object >= Animal >= Dog

noble lantern
young knoll
#

Lol, where is that

ivory sleet
#

Well in this case, only a term of the type Consumer<Object> can be passed safely to the function. A Consumer<Dog> could lead to a class cast exception (in Java). Since a Consumer<Dog> may end up invoking methods that only Dog has.

#

Now ofc of we would be doing something like consumer.accept(new Dog()) in the function addCallback it would be fine. But what about Consumer<Bird> and Consumer<Whale>?

tender shard
ivory sleet
#

Thus we say Consumer is covariant @remote swallow

#

However the opposite would be the case for Supplier if u compare it like what I did with Consumer

#

Then if something is both a Consumer and Supplier we call it bivariant on I<T>

#

since A <= B or A >= B both implies I<A> is equivalent to I<B>

ivory sleet
#

And ofc sometimes in Java you have to use covariance and contravariance for the wrong stuff to make java not complain etc

#

But generally speaking this is the theory behind how and why

pseudo hazel
#

the only thing I got from taht explanation is that you want to use concrete types in your consumer?

ivory sleet
#

Na

#

What I mean is that if you have a Consumer<? super Animal>

#

an instance if Consumer<Dog> wouldn’t work

#

Because Consumers generally have a covariant relationship

#

the ? super X means that you just allow covariance (and above I explained why this is the correct one for Consumer)

#

the ? extends X means that you just allow contravariance

#

just X would technically be bivariant and just ? is novariant

wet breach
#

I just keep things simple

pseudo hazel
#

yeah I agree

#

I just pass the same type of object as my consumer consumes

wet breach
#

I find that the more complex a system is, the less optimal it becomes

pseudo hazel
#

yes

#

I dont think you can argue against that

young knoll
#

Yeah idk how to better set up a system for events other than that map

#

I’m open to suggestions tho :p

ivory sleet
#

Avoid generics

#

You don’t need it for every subtype system you’re going to write

pseudo hazel
#

lmao I think I just found a memory leak in my plugin xD

#

I have this MenuEventListener where I add inventories to it

#

but I never remove them

ivory sleet
#

think its fine?

pseudo hazel
#

but in some cases I keep making new ones for updating display purposes

eternal oxide
#

You're sacked

ivory sleet
#

bukkit deregisters listeners automatically

#

oh

#

maybe then ye

pseudo hazel
#

yes, but not while the plugin is running

#

like the issue is I should really be deregistering them as I close the menus

ivory sleet
#

well u only want to register listeners in onEnable in principle

pseudo hazel
#

since thats how I make them

#

yes

#

but thats not practical imo

ivory sleet
#

it is

pseudo hazel
#

well

eternal oxide
#

you shoudl have ONE listener and pass each event to your menu class

ivory sleet
#

if u wanna extend on that with dynamic registering, you'd create ur own listener event system

pseudo hazel
#

idk how I can update a menu and still have it be different for every player for example

ivory sleet
#

because its costly to register and deregister

#

(bukkit listeners)

pseudo hazel
#

well I have 1 listener

#

but in the listener I have a list of inventories

eternal oxide
#

then you shoudl not be registering/deregistering anything

#

just a map

pseudo hazel
#

okay well I mean adding and removing from teh map

eternal oxide
#

or a Set even

pseudo hazel
#

right now I am never removing stuff from the map

#

list*

eternal oxide
#

yeah thats not good

#

especially with a List as it can have duplicates

pseudo hazel
#

yes

#

however I am not 100% how a set works in that regard

#

I mean I suppose it hashes teh class or whatever

#

but that also depends on the type of Set i am using

#

like at what point does an instance of a class become a copy of another

#

if I change some property of the instance is it no a duplicate anymore and does it get added by the set

young knoll
#

.hashcode must be the same and then .equals must be true

pseudo hazel
#

and liek is it recursive? because I am storing the actual Inventory in such a menu class as well

#

is that like terrible practise or what

eternal oxide
#

if I were you I'd use a Map(Inventory, Consumer<Event>)

pseudo hazel
#

I dont quite understand

#

right now i have a menuInventory which has an Inventory variable

#

and those menuinventory objects are being kept by the listener

#

if I turn that list of menu inventories into a set

#

does it see a menu with different inventory contents as a duplicate or not?

eternal oxide
#

I'd do a dumb Listener which has event listeners and your Map

pseudo hazel
#

idk how to structure Consumer<Event> into a class

eternal oxide
#

if you create a menu inventory you add it as a key in yoru map and a consumer class to handle the events for ity

#

it doesn;t have to be an actual Consumer

#

an event handling class of your own design

#

its just somewhere to put the logic of handlign clicks/drags/close etc

pseudo hazel
#

this is how I do the drag for example ```java
@EventHandler
public void onInventoryDrag(final InventoryDragEvent event)
{
if (!menuPrecondition.apply(event.getView()))
{
return;
}

    for (MenuInventory inventory : inventories)
    {
        if (inventory.internalInventory().equals(event.getInventory()))
        {
            inventory.handleDrag(event);
            break;
        }
    }
}```
#

is taht similar to what you mean?

#

also ignore the precondition thing

eternal oxide
#
@EventHandler
public void onInventoryDrag(final InventoryDragEvent event) {
    YourEventClass handler = yourMap.get(event.getInventory());
    if (handler != null) handler.process(event);```
pseudo hazel
#

how do you call openInventory

#

from like a command? openInventory(player, someMenuObject)?

remote swallow
#

yeah

pseudo hazel
remote swallow
#

you have 1 instance of the manager class and use it accordingly

pseudo hazel
#

well yes I do that right now

#

omg

eternal oxide
#

you don;t need the internal inventory in your handler class, it's already in the event

pseudo hazel
#

this code is too old lmao, I need to make it not static, maybe that will help with my clusterfuck of a manager class

#

but I need to add items to the inventory

#

how do I add items to the inventory if I dont have access to it from the MenuInventory class?

eternal oxide
#

you have access toit everywhere

#

in your handler its in the passed event, in your listener it's a key in the map

pseudo hazel
#

I guess i can just add the items in the inventoryOpen event then

#

is that what you mean

#

right now I am adding items before the inv is opened

#

but i guess it doesnt really matter

#

so the only thing I really need to change is to somehow pass the menu manager into everywhere where I create a menu basically

#

in order to still open the inventories

pseudo hazel
#

right now I just call parent.open when I close my inventory in the MenuInventory

#

but my question is can I open a menu from the MenuInventory class

#

if I dont have the inventory stored in it

eternal oxide
#

if it were me I'd reuse one inventory

pseudo hazel
#

well I would love to do that

#

but idk about any side effects

#

like what about an inventory that changes contents like a paginated menu

#

I dont want the page to change for everyone who has that menu opened

eternal oxide
#

In general I do an inventory per player not one universal inventory

pseudo hazel
#

hmm

#

do you maybe have an example?

#

you mean one inventory per player per custom inventory type?

#

or like what do you mean by that

eternal oxide
#

a player is only going ot have one open at a time

pseudo hazel
#

yes

#

so you mean only one CustomInventory can exist for each player?

eternal oxide
#

think of the inventory as nothing more than a screen to view whatever you want to put in it

#

rather than each custom inventory being it's own instance

pseudo hazel
#

yes I am having a hard time pulling the visual menu apart from what I want the menu to ultimately do

#

maybe I just need to structure the logic differently

#

like do you have a lot of logic in the customInventory?

#

when handling events or whatever

eternal oxide
#

all the logic should be in the handler

pseudo hazel
#

how do I make a parent menu remember what page it was on when I open and close another menu "on top" of it?

#

in reality I would wipe out the parent wouldnt I

#

this page number being a very trivial example of data I want to retain basically until the menu is closed properly, (not by another menu opening overtop of it)

eternal oxide
#

Theres many differeent approaches

#

have you looked at teh GUI resource by (I think) 7smile7

pseudo hazel
#

yes

eternal oxide
#

it was either him or alex

pseudo hazel
#

thats where I based mine off of loosely

#

to get it started

#

that is where I had teh central listener idea from

#

but then I didnt quite know how to expand that in the right way I needed so I just fucked around until it worked

eternal oxide
#

if you are doing paginated by player you could do private Map<UUID, List<Inventory>> inventories = new HashMap<>();

pseudo hazel
#

the pagination is just one example but basically yeah

eternal oxide
#

except I'd probably do a wrapper on the inventories of a handler class

pseudo hazel
#

that is how I add items and stuff to my inventory now

#

I am wrapping an Inventory object I create in the constructor of the menu

eternal oxide
#

then your dumb listener class just gets teh Map entry for the relevant player and passes the event to the stored handler class

#

your handler class holds all inventories for that player

pseudo hazel
#

hmm

#

I will need to rethink a lot of what I ahve right now probably , I also need to not be static first off all xD

#

like rn I have this java public MenuInventory(int size, String title, MenuInventory parent) { this.parent = parent; this.inventory = Bukkit.createInventory(null, size, Message.PREFIX_STRING_SHORT + " " + ChatColor.DARK_RED + title); MenuEventListener.addInventory(this); }

#

which is kinda bad

eternal oxide
#

yeash get rid of static, not needed

pseudo hazel
#

but I need to redesign and define what I actually want my menus to do

eternal oxide
#

yep

pseudo hazel
#

because not only do I want to keep the state for each player, but in some cases I want the inventory to update for other players if I change something

#

like lets say I have a menu full of game settings

#

ideally 2 people could change the settings for the same game

#

but then the inventories need to reflect each change to each other

#

but like

#

thats like exponentially more complex lmao

#

I guess its time to use my brain for once

eternal oxide
#

if you have an instance like that then you have to use the same menu instance, or a complex sync system

pure socket
pseudo hazel
#

yeah definitely the same instance haha

#

anyways thanks for your suggestions

desert tinsel
#

is there any way to reset a world like after a bedwars game, all world's modification are reseted?

ivory sleet
#

technically deleting the world files and let chunks regenerate

pseudo hazel
#

or replacing the world

#

i guess

#

I have seen some implementations where they would just store all blocks that people created

#

and then remove those when restarting

#

but that will really depend on if players can break other blocks that are part of the map

desert tinsel
#

yes, players can break blocks that are part of the map

#

and I would not like regenerating the world

eternal oxide
#

is the world a limited area?

#

nah, just backup the world before and replace it when finished

desert tinsel
eternal oxide
#

file copy or chunk snapshots

high pewter
#

I've asked this here a couple times before, so sorry for asking again, but I'm about to resort to hard-coding the mappings which will be tedious, sub-optimal and prevent my plugin from working across versions (I originally wrote it as a datapack and I started re-writing it as a plugin with the intent of it working across versions, so this would be particularly sad) so just want to ask one last time in the hope someone has an idea.

Given an ItemStack where ItemStack.getItemMeta() instanceof SpawnEggMeta, how can I get the EntityType which the spawn egg would summon when used? There used to be a few methods for this, but they all seem to be deprecated in favor of each spawn egg type being a unique material, but making use of this would mean hard-coding all the mappings.

eternal oxide
smoky anchor
#

Hi hello ppl!
What would be the best way to hide NBT data of an item from clients ?
Best would be if I were able to specify which tags would be hidden.
(Talking about PDC)
I assume ProtocolLib would be a way, but I think I would have to handle a lot of cases of manipulating the item (moving between slots, updating durability, renaming...)

wet breach
high pewter
smoky anchor
wet breach
#

if you don't want the client to know about it, you simply don't have it

#

and I highly doubt you know hypixels backend intimately

noble lantern
#

how come this just happens to me all the time anymore even when running as admin?

wet breach
#

so how do you know they manage to do something that isn't possible?

noble lantern
#

like....

#

have to completely reopen intellij every 15 mins because of this annoying...

smoky anchor
#

And why do you think it isn't possible
Have you tried it yourself ?

smoky anchor
#

where specifically

echo basalt
#

Same principle behind client-sided lore

wet breach
echo basalt
#

Not rly

#

You just... Strip it out of all the item packets

wet breach
#

Yes, basically just removing the nbt data as I said

#

otherwise the client knows about it

smoky anchor
#

Ok so it seems that ProtocolLib is the only way to go then

echo basalt
#

yup

#

there are 2 packets

#

containing all the inventory data

#

one of them is window items

#

which contains:

  • a list of items (array maybe)
  • an item for the cursor
#

and there's also set item

wet breach
echo basalt
#

which is just a position and an itemstack

smoky anchor
#

oh I kinda expected much more packets

#

oh well ty for confirming my suspicion then

echo basalt
#

also there's a weird thing where if you're on creative

#

it like

#

duplicates the thing

#

so you gotta check for that

#

or well

#

if you're on creative and you try to copy the item

#

it copies it client-side

#

I had lore duplication with client-sided lore and the trick was to remove it server-side

#

was some weird goofy ahh stuff

smoky anchor
#

I think I'll let creative ppl see the NBT
So no worry on that part, just gotta update all items when player switches gamemodes.
but ty

echo basalt
#

not my proudest code but it does the client-sided lore

smoky anchor
#

oh tyvm for some example :D

echo basalt
#

It's really stupid but you gotta remove all the client-sided stuff on the item

#

and then re-add it once

high pewter
#

Hm ok now that I've got spawn eggs working, I did some testing and found that Camels exist in the 1.19.3 API even though they don't exist in that version of the game so I get an error if I try to spawn it. I'm already using EntityType.isSpawnable so I suppose isSpawnable doesn't take into account if the entity is actually available in the version being used. Is there another method I'm supposed to use?

inner ruin
#

Hey I’m trying to make a link detector, which checks if a link is present in a message. If a link is detected in a message, it nightlights it with Color coding and creates a clickable URL.
The thing is this works with messages that just contains links or text before the link. However, if the link is followed by text, it apparently doesn’t work. Is this even possible? I tried a lot

echo basalt
#

Regex

high pewter
echo basalt
#

You need to do your checks both with
/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/
and
/^[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/

#

praise whoever made them

cobalt thorn
high pewter
#

I don't want my plugin to assume 1.20 is enabled on the server, so I just want to exclude any entities exclusive to 1.20 (or, any version other than the one the server is running)

inner ruin
# high pewter Could you show your code? I'd imagine you'd need to use a regex, and define what...
public class ClickableLinks {

    private static final String LINK_REGEX = "\\b(https?://[^\\s/]+\\.[^\\s/]+)\\b";
    private static final Pattern pattern = Pattern.compile(LINK_REGEX);

    public static BaseComponent[] convertLinksToClickable(String message) {
        ComponentBuilder builder = new ComponentBuilder("");
        Matcher matcher = pattern.matcher(message);

        int lastEnd = 0;

        while (matcher.find()) {
            String textBeforeLink = message.substring(lastEnd, matcher.start());
            String link = matcher.group();

            builder.append(textBeforeLink);

            BaseComponent linkComponent = new TextComponent(link);
            linkComponent.setColor(ChatColor.AQUA);
            linkComponent.setUnderlined(true);
            linkComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link));

            builder.append(linkComponent);

            lastEnd = matcher.end();
        }

        if (lastEnd < message.length()) {
            String textAfterLink = message.substring(lastEnd);
            builder.append(textAfterLink);
        }

        return builder.create();
    }
}```
echo basalt
#

pre-compile your pattern!!

cobalt thorn
inner ruin
#

Wydm?👀

echo basalt
#

compiling your pattern in every single methodo call is... a little performance killer

high pewter
cobalt thorn
high pewter
#

Why does Spigot define classes for entities which only even exist if you install a datapack...

cobalt thorn
inner ruin
high pewter
#

But in that same game code, there will also be code which disabled them by default, meaning there must be code I can use to identify entity types which have been disabled, without having to check for the presense of a datapack which enables them

high pewter
cobalt thorn
high pewter
high pewter
echo basalt
#

trycatch it

cobalt thorn
high pewter
#

As I say, I don't want to force 1.20 onto every 1.19 server which installs my plugin

worldly ingot
#

1.19.4 has datapack API

cobalt thorn
inner ruin
#

Oh alright thanks 👍 but for my actual issue, any ideas why it doesn’t work? I assume my regex is correct, but I might be wrong?

cobalt thorn
# worldly ingot No, 1.19.4

no he wants to enable the camels without enabling the datapack for 1_20 Update, i thought you meant how to enable the datapack

high pewter
#

No, I don't want to enable camels

cobalt thorn
worldly ingot
#

They want to check if an entity is enabled so they can do things with it

high pewter
#

I want to identify which entities can be spawned on the server

worldly ingot
#

You can do that with the commit I linked in 1.19.4. EntityType.CAMEL.isEnabledByFeature(world)

#

That's the better way to do it, but you can also just check if 1.20 is enabled via the DatapackManager

high pewter
#

I'm writing a random events plugin, and one of those events is spawning a random entity, but I don't want to randomly select an entity which can't even be summoned, so I need to filter the EntityType by isSpawnable and something else (it appears isEnabledByFeature, I'll have a look!)

worldly ingot
#

Just be aware that these methods don't exist in 1.19.3 despite camels being added in that version

#

Not that anyone should be running .3 anyways

high pewter
#

That's a bit strange, but my plugin is made for 1.19.4 so that's fine!

worldly ingot
#

We just didn't have API around the time is all. Nobody had contributed it

high pewter
#

Honestly I didn't even realise camels were added in 1.19 at all, I thought they were only in snapshot versions and 1.20, it's just strange to me that an entity was added which couldn't even be spawned by default

worldly ingot
#

Yeah, experimental datapacks were introduced in 1.19.3 or .2 or something

high pewter
#

Oh I've only just realised why this isn't just done by isSpawnable, I forgot datapacks were world-specific

worldly ingot
#

Mhmm

shy rock
#
            int zombieLevel = getRandomNumber(minZombieLevel, maxZombieLevel);
            double zombieHealth = calculateZombieHealth(zombieLevel, startingZombieHealth, zombieHealthAddPerLevel);

            zombie.setMaxHealth(zombieHealth);
            zombie.setHealth(zombieHealth);
            zombie.setCustomName(ChatColor.GRAY + "Zombie (Level " + zombieLevel + ")");
            zombie.setCustomNameVisible(true);

        }```
is there a way to include damage multiplyers in there? or just setDamage in any way?
#

Every time the mob is diferent

#

There can be an infinite amount of zombie varieties I can't make that

#

Ill do thanks

worldly ingot
#

You could pass that method into it ;p

#

world.spawn(Zombie.class, location, YourClass::spawnZombieLVL)

shy rock
#

hm

worldly ingot
#

Or whatever the param order is

#

Yeah that

shy rock
#

Alright

echo basalt
#

I'd probably make a data class containing zombie attributes

#

and have an apply(Zombie) method

shy rock
#

Wouldn't that be alot if done for each mob

echo basalt
#

no I mean a template

#

not a data class per zombie

narrow flare
#

Hi, is there a lib to serialise an inventory and save it as data[] or String[] so that I can save it in my database (it's for a backpack plugin)? i use spigot 1.19.4

wooden drift
#

hi, i wanted to make a few plugins for 1.20.1 but i get "org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.2" with an empty project

last sleet
#

Is there a way I can place a locked repeater in a given Location in my world?

last sleet
narrow flare
#

?

wooden drift
#

thank you

narrow flare
#

i want in my sql database sorry

sullen garden
#

Hello

young knoll
#

You can use a BukkitObjectOutputStream to turn an ItemStack into a byte[]

sullen garden
#

Can i ask a question

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

sullen garden
#

I cant dupe tnt on my server

narrow flare
sullen garden
#

Sorry

young knoll
echo basalt
#

pretty sure you can shove the entire array

sullen garden
#

Thanks

echo basalt
#

like I do here

#

it's a try-with-resources

#

Basically it automatically closes the variables you initialize

#

avoids memory leaks pretty much

young knoll
#

Ah cool

#

Yeah just shove the entire array in

echo basalt
#

I should probably try-with-resources on the deserialize method

shy rock
inner ruin
zenith gate
#

?pdc

zenith gate
#

For me^

echo basalt
#

I'd still use a wrapper

#

here

echo basalt
narrow flare
echo basalt
#

yes

narrow flare
echo basalt
#

correct

#

No one else talking atm

narrow flare
#

^^'
the problem is that I'd like to save all my inventory in a single byte[].

echo basalt
#

you can just pass the entire array

narrow flare
# echo basalt you can just pass the entire array

like this ?

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        BukkitObjectOutputStream objectOutputStream = new BukkitObjectOutputStream(outputStream);
        objectOutputStream.writeObject(Arrays.stream(items).filter(Objects::nonNull).toList());
        objectOutputStream.flush();
        byte[] serializedData = outputStream.toByteArray();
        objectOutputStream.close();
        outputStream.close();```
echo basalt
#

you can just pass the entire array

#

even null values

#

also try with resources

#

I literally send an image of what I did

#

but sure here it is again

#

I should probably just call writeByteArray

narrow flare
narrow flare
echo basalt
#

yeah

narrow flare
#

nice

echo basalt
#

here it is with raw bytes

narrow flare
echo basalt
#

strings are more appropriate for uhh

#

writing to a file

#

it's just encoding honestly

#

strings also have padding and unicode stuff so they use more bytes

#

byte[] is simpler but only meant for internal use

wide coyote
#

yeah use the encoded string if you want to store the data anywhere

rotund ravine
#
    public static byte[] serializeItemStack(ItemStack itemStack) {
        try {
            ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
            GZIPOutputStream gzipStream = new GZIPOutputStream(byteStream);
            ObjectOutputStream objectStream = new ObjectOutputStream(gzipStream);
            objectStream.writeObject(itemStack);
            objectStream.close();
            return byteStream.toByteArray();
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }

    public static ItemStack deserializeItemStack(byte[] data) {
        try {
            ByteArrayInputStream byteStream = new ByteArrayInputStream(data);
            GZIPInputStream gzipStream = new GZIPInputStream(byteStream);
            ObjectInputStream objectStream = new ObjectInputStream(gzipStream);
            return (ItemStack) objectStream.readObject();
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
            return null;
        }
    }
#

jk

rotund ravine
#

Well you can store bytes too.

echo basalt
#

yeah you can store bytes

#

otherwise my cosmos plugin wouldn't be a thing (it stores schematics in multiple databases)

rotund ravine
#

It's useful for some databases and for text-based storage which is mostly used by this communities newbies.

#

Strings

echo basalt
#

yeah

#

just make a custom file extension clown_2

rotund ravine
#

No need to there is already .dat

#

thoughhh you probably aren't following any nbt schemes

narrow flare
silent steeple
#

this is my pom.xml

<dependency>
<groupId>com.gmail.filoghost.holographicdisplays</groupId>
<artifactId>HolographicDisplays</artifactId>
<version>2.1.0</version>
<scope>system</scope>
<systemPath>${basedir}/libs/HolographicDisplays.jar</systemPath>
</dependency>

Caused by: java.lang.NoClassDefFoundError: me/filoghost/holographicdisplays/api/HolographicDisplaysAPI

and this is the error i get

#

huh?

chrome beacon
silent steeple
#

yes

young knoll
#

Are you depending/softdepending on it in plugin.yml

silent steeple
#

oh

#

no i mean like the groupId

#

in the pom

#

is com.gmail

#

im just using the wrong imports

#

my bad

chrome beacon
#

system path dependencies are deprecated btw

#

You should avoid them

echo basalt
#

I like em

#

even then just like

#

install stuff to mavenlocal I guess

#

I made a batch script for that

#

if you're on windows and can't bother

#
@echo off
cls

set /p file="File name: "
set /p group="Group: "
set /p artifact="Artifact: "
set /p version="Version: "

call mvn install:install-file -Dfile=%file% -DgroupId=%group% -DartifactId=%artifact% -Dversion=%version% -Dpackaging=jar
pause

Here it is if anyone cares

#

I could probably make something stupid to scan files

#

but this works

hollow beacon
#

yo I need some help, we're using an old plugin in our server (1.12.2). There is an error going on and I want to decompile the source to fix it. Unfortunately there is an issue with the bytecode causing the decompiler to output not even remotely close code. So what I tried is replacing the class with a little fix included, unfortunately that fix did not work as intended either. So I'm wondering if there is another decompiler that can help with this

#

The plugin author is 'Twyzl' so if someone knows his discord, i'd be glad if you linked me to him

orchid trout
#

i have an itemstack[], that gets deserialized from mongo every time the server starts. the first image is from a server that has just been started and the second image is from a server that has been online for like an hour

#

i notice the values going down untill evetually it reaches 0

#

it only happens to the arrows

smoky anchor
hollow beacon
#

jd-gui, fernflower, and luyten

#

all producing the same gibberish

#

actually not fernflower, my bad

#

i had the wrong java version

smoky anchor
#

try IntelliJs decompiler
Just put all the classes into some directory and browse with IntelliJ

hollow beacon
#

that's pretty smart actually

hollow beacon
#

someone might just be taking the items

orchid trout
#

noone is taking the items and ofc its correct in the database

#

it resets on restart

hollow beacon
#

send your code snippet

#

maybe github

hollow beacon
#

maybe you need to clone the itemstack upon dropping

#

not too sure though

shy rock
#

Is it possible to make an enchantment a double? And in incrase its level by 0.1 ?

orchid trout
#

yeah i did that just now actually

#

i just didnt push changes cause im not sure if itll work

hollow beacon
smoky anchor
#

just decompile it manually then :D

hollow beacon
#

xD

#

I kinda was hoping someone would know the dev

smoky anchor
#

out of curiosity, what is the error ?

hollow beacon
#

it's with PrisonMines

#

it uses the ConfigurationSerializable from bukkit, though one class fails to load correctly

#

it works fine, but I need that class now

#

if I use it however it works fine too, it just removed the complete configuration file and causes it to break

#

this is the error

#

the weird thing is, it just works

#

it just removed the config and causes everything to break

desert tinsel
#

is there any problem if in plugin.yml I use yml api-version: 1.8 and in pom.xml I use this dependency: xml <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot-api</artifactId> <version>1.13.2-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency>

hollow beacon
#

unless there are api changes, not really

chrome beacon
#

That setting didn't exist in earlier versions

hollow beacon
#

valid point

desert tinsel
#

uh, ok, so can I use this on a 1.8 server?

#

or should I remove api-version

hollow beacon
#

i think < 1.13 just ignores it

chrome beacon
#

You can set api version to 1.13

#

Yeah older versions will just ignore it

desert tinsel
#

ok, tysm

ashen bolt
#

probably a stupid question but: when working on a menu should I instantiate a new invenotry every time a player opens a GUI or can I instantiate one and store it in a variable?

hollow beacon
#

there is nothing wrong with that right??! :p

#

i was joking

trim creek
#

GadgetsMenu moment

hollow beacon
#

several dupe glitches can occur

trim creek
hollow beacon
#

isn't it

trim creek
#

Then what are we supposed to use?

hollow beacon
#

InventoryHolder way is actually the most decent one though

trim creek
#

'k this is stuff I still gotta learn

#

I eventually will

hollow beacon
#

you can serve everyone a different GUI without much of a hassle

shy rock
#

Anyone knows how to make mobs drop more exp?

hollow beacon
subtle folio
#

heehee

#

i implement listener all the time ! Troll

#

haha i

zenith gate
#

Would learning NMS be useful? I hear it could be dangerous to use, as in server crashes, and corrupt player data. Would it be of use to learn NMS despite the bad ?

eternal oxide
#

Don't touch nms unless you need to do something which is impossible with just the API

zenith gate
#

So pretty much don’t worry abt it until I need it?

vital sandal
#

:l anyway to write out data like the console.log() function

#

in javascript

worldly ingot
#

Either via your plugin's logger (preferred), or System.out.println() will work

vital sandal
#

here is what I do if I use fs

worldly ingot
#

Oh, sorry, IN JavaScript

#

Not like In JavaScript

vital sandal
worldly ingot
#

What kind of data are you trying to write that console.log() can't do?

hollow beacon
#

console.log(JSON.stringify(myObject, null, 4));

#

for example

vital sandal
#

if I use log it show pretty detail

worldly ingot
#

Yeah, JSON#stringify() if you want the object

#

The null and 4 are optional there. Unsure what those do

hollow beacon
#

4 is the indentation

worldly ingot
#

Ah I suppose it's not prettified otherwise

hollow beacon
#

null is the replacer not sure what that does

worldly ingot
#

Probably maps values if necessary

#

e.g. true -> "Enabled"

vital sandal
#

:l hmm

#

not every things is json

#

I hate working with packetdata ;-;
I used to know how but after years I have no clue ;-;

#

I'm trying to modify packet that playerreceive and send :l

hollow beacon
#
import * as util from 'util' // has no default export
import { inspect } from 'util' // or directly
// or 
var util = require('util')
#

and then:

console.log(util.inspect(myObject))
#

google is very powerful too 😛

vital sandal
#

to be percise I'm faking player current location to hide that

#

:l any better suggestion?

hollow beacon
#

location as in coordinates?

vital sandal
#

yeh

hollow beacon
#

/gamerule reducedDebugInfo true

vital sandal
#

:l

#

that just hide from vanila

#

not from modded minecraft

#

with pvpclient or hackclient pp still abled to access those

hollow beacon
#

oh

#

that sets the gamerule

#

my bad

#

i mean to be honest

#

any mod will bypass that

#

even when spoofing a location

#

a mod can simply just get the seed by some tree patterns and nearby bedrock and figure out the pos

vital sandal
#

:l?

#

how?

#

tree patterns?

hollow beacon
#

bedrock patterns are always the same iirc

#

have you ever watched this video

sterile token
#

Hi I have a big problem that is making my head shake too much. I don't know how to think of a logic to get the instance of the main class. Because as far as I know, entities (User, Bank, etc) should not be initialized by passing them a reference from the main class through the constructor. Because then when you create an instance of the entity you have to pass the instance too. What can I do in this case?

edgy peak
#

Are scoreboards supported by 1.20? as my scoreboard doesnt show now that i changed to 1.20

edgy peak
#

did they change in any way?

hollow beacon
#

or save an instance of the entity and do stuff in some kind of handler

vital sandal
hollow beacon
#

remember it's only one image

sterile token
hollow beacon
hollow beacon
vital sandal
#

well

#

that is lots of work

#

I can just replace it with stone clientside

sterile token
#

Do i explain or i translate to english from my native lang, maybe thats the problem that i dont explain well in English

hollow beacon
vital sandal
#

like

#

they receive nothing about that

#

the data is removed not hiden

sterile token
#

The problem is that I don't know what is the best design pattern to pass instances to objects, which depend on an instance to work. But at the same time it should not be passed through the constructor (as DI does), since it is a chaos and a bad design when initializing the object (to give you a use case)

Is it more clear @hollow beacon, i have re written the daught ?

hollow beacon
#

what should the entity do

#

and why would you need an instance of the main class?

sterile token
echo basalt
#

I'd say it's not the responsibility of the user to actually do IO

sterile token
echo basalt
#

Do it on your user manager

hollow beacon
#

^

sterile token
#

right im doing a manager too

hollow beacon
#

why are the methods there

echo basalt
#
public class UserManager {

  private final Map<UUID, User> userMap = new ConcurrentHashMap<>();

  public CompletableFuture<User> loadUser(UUID userId) {
    ...
  }

  public CompletableFuture<User> saveUser(UUID userId) {
    ...
  }

  public User getCachedUser(UUID userId) {
    return userMap.get(userId);
  }
}