#help-development

1 messages ยท Page 2281 of 1

sterile token
#

Lmao you want to explode the server who uses the api

#

๐Ÿ˜‚

hybrid spoke
#

thats the only way fetching the blocks

sterile token
#

okay

noble lantern
#

you can loop millions of times a second in java lmao

hybrid spoke
#

what do you expect

kind hatch
#

How else are you supposed to get every block without iterating? Magic perhaps?

hybrid spoke
#

a magic method which just provides all blocks instantly

noble lantern
#

it just depends on what your doing

sterile token
#

can i send full code?

noble lantern
#

you can looop through probably 100 ChunkSnapshots in just a few seconds

hybrid spoke
#

?paste

undone axleBOT
noble lantern
#

if even that

sterile token
#

allr because i created a custom loc class

#

Because then i have shity issue with mongo codec

#

๐Ÿ˜ฌ

hybrid spoke
noble lantern
#

never mentioned getting ๐Ÿ˜‰

hybrid spoke
#

if you wanna operate on it async afterwards its better to

noble lantern
#

Gettings probably the most taxxing part

sterile token
#

also why using chuks async?

#

If i want the blocks from a specific region not a chunk!!

noble lantern
#

well get sync then operate async is current style because of bukkit limitations

hybrid spoke
#

thats awful

sterile token
#

is it paste don?

#

it doesnt load

hybrid spoke
#

works fine for me

sterile token
#

should my cuboid class implements Iterable for the blocks?

hybrid spoke
#

no

sterile token
#

Allr

noble lantern
#

in that case only option is to to super taxing loops

You need to setup a load balancing with multiple async tasks running in paralllel looping those blocks

sterile token
#

So up to know is going okay

noble lantern
#

i reccomend converting cuboid to your own style of ChunkSnapshot somehow

#

it would be weird

#

but would be fast

#

not an easy setup tho

#

theres aguide on it

#

smile knows a lot more about it than me too bad hes not here

hybrid spoke
#

its 2:30 am in germany

#

so no wonder

upper vale
#

partitioning the task across multiple ticks?

noble lantern
#

yes that

#

what demeng said

sterile token
#

Now yes

noble lantern
#

task chain might be useful to chain those partitioned tasks accross threads tho

sterile token
hybrid spoke
#

on what version are you

#

you could also just use a BoundingBox

sterile token
hybrid spoke
#

who tf uses 1.13

noble lantern
#

You should just store location referances and block types

#

getBlock is whats gonna be taxxing for this

sterile token
#

Allright

noble lantern
#

and getChunkAt

sterile token
#

Tht code was done by copilot

#

So i ill modify know to what you think and explain me

noble lantern
#

getChunkSnapshot is the best way to go for performance

Multiply the coordinates of chunk snapshot by 16 or bitflip by 4 to get real World Location

sterile token
#

what

#

I dont think that method exists on 1.13

#

๐Ÿ˜ฌ

hybrid spoke
#

chunksnapshot is a 1.8 thing

upper vale
#

why are you on 1.13 ๐Ÿ’€

noble lantern
# sterile token what

when you get a block in a chunk snapshot it returns the chunk location not real world

sterile token
noble lantern
#

eg chunk 2 x 2 at chunk location 3 x 3

hybrid spoke
#

what he means is, you should store the locations of your region, convert then to a chunksnapshot and ask that snapshot for these locations

noble lantern
#

you would (3 * 16) * 2

sterile token
#

Hmnnn okay

#

So all the class is wrong?

noble lantern
#

(chunkBlockLocation * 16) * chunkLocation

hybrid spoke
#

only thing is, you would have to update the chunksnapshot everytime you query

noble lantern
#

if hes not holding the query should be fine

#

seems like hes running it straight through

noble lantern
#

you cant run it async

#

if you use referances to blocks you can run it async

sterile token
#

So let try to do the faster way

noble lantern
#

and not to mention just using referances overall is gonna boost performance so much

#

first you should setup the referance system

You may not even need async with it depending on the size of Cuboids your looping through

#

good luck thought this is gonna be an all day thing to do haha

sterile token
#

But i dont udnerstand hat mean ref system

#

๐Ÿค”

noble lantern
#

IE

#

Dont store a Block directly

#

Store a Location and Material

sterile token
#

Im not storing anything, im just doing a getter

noble lantern
#

the getter is storing Blocks into a List

Doesnt matter how long theyre stored, its the getBlock thats taxxing

#

sec

#

im gonna try to make some type of psuedo code

sterile token
#

Yeah i know what you means Chunk#getBlocks() ill shut down tps down

upper vale
#

is there a reason you need the actual Block object of every single block in the region

noble lantern
#

you will never need every Block instance

sterile token
#

No i dont think

noble lantern
#

hence why referances are key

sterile token
#

So i would need a Map<Location, Material>

noble lantern
#
class MyBlockLoc {
    public int x;
    public int y:
    public int z;
}

HashMap<MyBlockLoc, Material> map = new ...; // you can reverse the key/value if you like

#

only reason i wouldnt use Location is of the overhead

#

plus

#

i think it calls get to the world on creation/get

hybrid spoke
#

why dont you just store the block references once

sterile token
#

God, burch told me that storing the block reference ill be overkiller

hybrid spoke
#

instead of unnecessarily holding new location instances over and over again

#

you could just store the block reference which never changes

noble lantern
#

he has to call getBlock to get a Block though

#

thats the thing

hybrid spoke
#

he only needs to call it once

#

then he has everything he needs

noble lantern
#

and hes calling it thousands of times in a loop

#

(possible thousands)

#

maybe even millions

#

And not to mention

#

its all on main loop because you cant getBlock async

hybrid spoke
#

so just dont call it in a loop?

noble lantern
#

did you see his code?

#

kinda cant

eternal night
#

World#getBlock is pretty cheap btw

noble lantern
#

It is but added up over hundreds of thousands of times its horrid

eternal night
#

Well

hybrid spoke
#

not really

eternal night
#

Only thing is object allocation

#

That is it

hybrid spoke
#

but you dont even have to call it that many times

sterile token
#

So in end?

#

The better options is?

eternal night
#

I mean, tbh, shouldn't matter

upper vale
#

what are you actually doing with that method though

#

you mentioend that you didnt need the actual Block object so what is the end goal

hybrid spoke
#

in the end you have to loop anyways

eternal night
#

getBlock only creates a super simply wrapper around the region accessor and the location

#

The "expensive" part is reading it's block data or type or whatever really

sterile token
#

The problem is that i will use that api for mines managing

#

So it need to be efficient

upper vale
#

oh youre filling blocks?

sterile token
#

Yes i ill use it to fill blocks

upper vale
#

you dont need the block object to fill blocks though

#

nor the material

sterile token
#

Basically i ill manage mines regions over that cuboid

upper vale
#

take a look at this

sterile token
#

And i need to know the blocks because there will be some custom blocks that ill do something like crates or give things

noble lantern
#

it was that as well as getting Locations too (in unloaded chunks)

#

getBlock does this under the hood

sterile token
#

So in the end?

noble lantern
#

well now that we know what your doing

#

cause i didnt know you were doing mines

hybrid spoke
#

in the end unload the region, access the region file, edit it manually, save, load it back in, update

#

very efficient

noble lantern
#

ngl

#

not a bad idea

#

just hang the player somewhere else in like a arena lobby

sterile token
#

It will be public api

#

That why!

noble lantern
#

or players in the area

sterile token
#

In my case will be used for mines but other people will use it for ther things

buoyant viper
#

wat

noble lantern
#

That could be made into a api, anything can

noble lantern
#

i dont want it now

buoyant viper
#

i'm at work anyway smh

noble lantern
#

grubhub smh

buoyant viper
#

i work at a gas station

sterile token
#

I want to achive something like world edit api but more simplier

buoyant viper
noble lantern
#

what gas station ill order gas

noble lantern
#

or do what cipher said

#

if yo udo what cipher said

#

you gonna get all the girls

#

100%

buoyant viper
#

wawa

noble lantern
sterile token
#

What said god cipher

noble lantern
#

otherwise its trash

sterile token
hybrid spoke
noble lantern
#

its possible from what im seeing

#

i mean after all

#

if minecraft does it, its possible obv

#

so theres ways to serialize those files

buoyant viper
noble lantern
#

wait wha

#

OH

sterile token
noble lantern
#

i thought you were saying water uwuified

#

water -> wawa

#

so i was like ignoring wat was said xD

noble lantern
#

if your gonna do it right

#

you need to handle the chunk processing offshore

#

in a rest server

sterile token
#

offshole?

noble lantern
#

where users can post theyre region files with coordinets of block referances they want

sterile token
#

shity lang bbarrier

#

๐Ÿ˜ฎโ€๐Ÿ’จ

noble lantern
#

offshore = not on the main server

In a sense

#

this isnt easy

#

why do you think a million world edits dont exist lol

sterile token
#

oh ok

noble lantern
#

but a million essentialsx plugins exist

sterile token
noble lantern
#

why do yall sell nfts

sterile token
#

Its has many amazing harcoded things

buoyant viper
noble lantern
buoyant viper
#

I

noble lantern
#

?

#

why

#

shame

noble lantern
buoyant viper
#

ive been off work for like 2 weeks

noble lantern
#

Me: "essentials is shit"

Also me: Posts a script with my github token hard coded into it

buoyant viper
#

LOL

noble lantern
#

you missed that

#

was funny

buoyant viper
#

i had a repo with my minecraft login in it

noble lantern
#

i wonder if someone tried anything

buoyant viper
#

F

sterile token
eternal night
#

Oh I'd suggest doing it in gradle ye

sterile token
#

Also if i didnt told you, u will never realized it

eternal night
#

Your ci then just runs the copy tasks that depends on the shadow task

buoyant viper
#

lol

eternal night
#

A clever move

sterile token
#

Burch

noble lantern
sterile token
#

I was looking at fawe repo and is even more complex than world edit

noble lantern
#

yes

#

bc it uses paralellilismslms

#

however its spelled

#

paralellism

sterile token
#

๐Ÿคก my face ith 1 emoji

noble lantern
#

parelism?

upper vale
#

paralellilismslms

sterile token
#

the same happen to me when i want to write this parametized

#

is it right?

upper vale
#

fawe isnt actually async is it :thonk:

noble lantern
#

uhmm

#

it is

#

its weird

sterile token
#

I dont know but it doesnt crash erver like does world edit

#

๐Ÿ˜‚

river oracle
#

fawe's name is Fast Async World Edit

#

so no its not async

sterile token
#

What have to do the name?

noble lantern
#

omg i should make that

#

wonder if spigot would take it down

hybrid spoke
#

make it a bedwars plugin

noble lantern
#

just make the worls shittiest performance world edit plugin

#

lmfao

sterile token
#

FakeBedwarsCore

#

FBC

noble lantern
#

registering that

sterile token
#

I wil lregister it

river oracle
#

code it like you started java yesterday

noble lantern
river oracle
#

how to move variable to other class

noble lantern
sterile token
#

So in fact there is no good api for managing regions and cuboid that they work okay, not being a resource fuck-er

river oracle
noble lantern
#

shit might as well add a "invalid plugin.yml" and not even let it load

noble lantern
hybrid spoke
sterile token
#

Allr can i get nmes burch?

noble lantern
#

first answer tells you what you need to know about em

sterile token
#

Also sorry for being assh-ole but i need a matcher for replacing variables based onvalues in mesages

noble lantern
#

Im gonna suggest regex and pretend i know how to use it

hybrid spoke
sterile token
#

Why mca files?

noble lantern
#

omg with source code

#

creams

sterile token
#

I dont understand

noble lantern
sterile token
#

Yes i know that

#

But what have to do?

hybrid spoke
#

fastest way possible

sterile token
#

Ohh ok

hybrid spoke
#

you wanted an efficient way

#

here it is

sterile token
#

You are wondering me to parse mojangs shits

#

๐Ÿค”๐Ÿ˜ณ

#

hahahaha

hybrid spoke
#

whatever you did before would probably be enough and this is overengineering af

#

but who cares

noble lantern
#

you have to get the chunks from your x y z cuboid

from those chunks get the region files

Send region files with x y z to a offsite server to handle the actual running of these requests

On offsite server read the file and do what is needed to get readable blocks from it

#

i only say offsite server since you wanted this as an API

#

and you could easily monetize off this too

#

but you dont need it

#

can just process this on your machine

sterile token
#

what means offsite?

noble lantern
#

not on your machine that is hosting the server

#

ie

#

external rest server

sterile token
#

Oh you mean code a backend which handle that conversions operations, ight?

upper vale
#

dont you have to restart the server for the block changes to apply if you directly edit mca

noble lantern
#

yee, only if you want tho but its not a bad idea since your wanting it as an API

noble lantern
#

might be able to inject

#

mixin

#

something

hybrid spoke
sterile token
#

๐Ÿ˜‚

noble lantern
#

well yeah your kinda doing that

#

just with chunks

#

theres a game

#

called second life that takes shit shit a step further

#

theyre chunks are seperate servers ๐Ÿ’€

wet breach
#

but really depends on what you are doing

sterile token
#

Read our ideafrost

noble lantern
#

my computer that off:

minecraft world: *nananananananananaa*
sterile token
#

We find a solution for easly loading structures and things

noble lantern
#

i dont think it directly messed with mca but directly interacts with MinecraftServer

#

buuut

#

still fast asf

hybrid spoke
#

yeah no thats just the NMS method

noble lantern
#

if you want a easy way verano you can do that thread

#

but if you wanna be innovative do what we were all talking about

#

bc a fully functionaing system doesnt exist doing it that way yet

Probably for good reasons, but everything exists for a reason, even you ๐Ÿ™‚

#

have a good day i need a beer

hybrid spoke
sterile token
#

Thanks burch

#

I need a wine

#

Its cold here

#

I love wine on winter

#

lmao why intellij gave new shits every day/month

noble lantern
sterile token
#

Allright

#

I ill pin that on my notes dm chat

upper vale
#

wait thats actually cool lol

sterile token
#

because where are trying to load structures directly using .mca format

#

Which is the most efficient way

noble lantern
#

this might not honestly be bad

#

bc of the async operations it provides

#

you may get similar performance using that class

hybrid spoke
#

i see, everyone instantly starred it

noble lantern
#

ofc editing mca is gonna be fastest, but that way its second best more than likely

#

yep kekw

#

looked at the code and instantly starred it

#

WAIT WHAT

#

EVEN HAS CUBOID METHODS

#

bruh

sterile token
#

Oh

noble lantern
#

in one class too lmfao

sterile token
#

Skid time lmao

#

๐Ÿคญ

noble lantern
#

only thing is verano

#

you should add methods

#

setCuboidAsync(int, int, MakeANewItemHandlerHere, false)

#

have the item handler take in multiple items with chances for each one

#

can PR it

#

cause for mines ur prolly gonna want that

#

not just one single block

sterile token
#

Yeah

#

I will set multiple blocks

valid folio
#

{"providers":
[
{"type":"bitmap","file":"custom/admin.png", "ascent":7,"height":7,"chars":["๊ˆ"]}

]

}

#

Whats wrong here?

late stone
#

how do I throw a potion with an effect

noble lantern
#

idk how the new font image stuff rly works

late stone
#

yo

noble lantern
#

all o ican do for you ignius is give you a video that does it, thats all i know

valid folio
#

Okey

noble lantern
late stone
#

oh

#

ok

#

does anyone know

#

wait i just realise

#

i should reqword that

noble lantern
valid folio
#

Thanks

late stone
#

how do i launch a projectile with a potion effect?

noble lantern
#

well typically

#

say you launch an arrow

late stone
#

yea

noble lantern
#

it doesnt have potion meta data so you cant apply it to it, do you would apply it rather on ArrowHitEntity event and if its the same arrow apply the effects for that arrow you have stored via config

valid folio
#

Ugh unicode thing doen't look working for now

noble lantern
#

as for potions idk how the potion api works but it should be relatively easy

valid folio
#

I need characters

#

My freand knows how to do it, but for my its 04:31

#

Working for my dreams 24/7 ๐Ÿ˜„

noble lantern
#

cast its ItemMeta to PotionMeta

#

make sure to instanceof check ItemMeta

#

if (item.getItemMeta() instanceof PotionMeta) { // do my stuff }

#

or you can just check ItemStack type

#

but intellij will warn doing it that way so just instanceof check

sterile token
#

GRANT PRIVILEGE * TO 'user'@'host';

#

is that okay?

#

Im installing mysql again without used it for more than 1y

noble lantern
#

i beileve

sterile token
#

Can you help me burch

#

I just installed mysql server

#

And then im stucked

noble lantern
#

its grant privileges on database.table to 'user'@'host' with grant option;

#

and afterwards

#

flush privileges;

sterile token
#

will grant priviliges to all tables?

noble lantern
#

database.*

#

or all databases just *

#

like you have it

#

but

#

generally i wouldnt do that

#

if that accounts compramised whol db goes

#

rather than just a single instance of the db

sterile token
#

Because we just installed mysql

#

And we want to create a root user

#

with all priliges

noble lantern
#

What for?

sterile token
#

And then another user only for specific dbs

noble lantern
#

Generally i wouldnt make a "root user" for mysql bc its generally not good practice for security

#

unless

#

the mariadb is not opened to outside connections

sterile token
#

its locally

#

๐Ÿ˜ก

noble lantern
#

so no one outside that machine can connect to 3306?

noble lantern
noble lantern
#

you need to make user then grant

sterile token
#

i will be used as localhost server

noble lantern
#

create user 'name'@'host' identified by 'password';

#

then you can run the grant command

sterile token
#

already created it

noble lantern
sterile token
#

CREATE USER 'xxx'@'host' IDENTIFIED WITH authentication_plugin BY 'xxx';

noble lantern
#

idk what by is

#

never used that

#

oh

#

wait weird syntax but okay its basically same thing

sterile token
#

i ru nthat cmd

#

and said status okay

#

but still and error when giving grants

#

@noble lantern really thanks man you are a nice person

#

Also sorry for pinging you all time

#

๐Ÿ‘

hybrid spoke
#

dont mind to ping @noble lantern

#

@noble lantern likes to get attention

ionic cipher
#

so i made a test plugin and when i try to load it, it crashes luck perms. do i need to register luck perms differently? here is yml ```main: com.skulls.skullsmain
name: Skulls
version: '1.0'
description: Runescape Style PVP Skulls
load: POSTWORLD
author: melon
website: spigotmc.org
depend:

  • WorldGuard
    commands:
    skulls:
    description: edits skull information
    aliases:
    • skulls
    • skull
      permission: skull.edit
      permission-message: You do not have permission!
      usage: /<command> [add|remove] [time]
      permissions:
      skull.edit:
      description: allows skull edit command
      default: op
      skull.:
      description: Wildcard permission
      default: op
      children:
      skull.
      : true```
karmic stirrup
#

How should I access this scheduler outside the method?

private BukkitTask bukkitTask;
public someMethod() {
bukkitTask.cancel();
}
Bukkit.getScheduler().runTaskTimer(plugin, task -> {
                bukkitTask = task;
                task.cancel();
                Bukkit.shutdown();
            }, 10 * 20L, 0L);
        }
#

That's what I have so far but I haven't tried it. I was just wondering if that's a good way to do it

ionic cipher
zenith gate
#

How can I increase sekelton's damage? like zombies and spiders? attribute damage, does nothing...

golden turret
#

is there a way to edit this?

#

the armor points

#

and it is possible to edit the armor resistance without enchanting it?

noble lantern
#

Its called toughness

#

Armor has two armor traits

#

toughness and then the armor bar amount

#

idk the forumula but it all calulates out somehow

golden turret
#

alright

noble lantern
#

i thing toughness is the actual % blocked out

#

cause its max value is 0-1 iirc, higher values get ignored

golden turret
#

what would be the name?

noble lantern
#

Im not sure

#

maybe this can help somehow

#

you might need NMS

#

cause its not a standard attribute iirc

zenith gate
noble lantern
#

no he means the name of the attribute

#

for armor toughness

zenith gate
#

here is an example of my attack speed

AttributeModifier attackSpeed = new AttributeModifier(UUID.randomUUID(), "GENERIC_ATTACK_SPEED", 0.5, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
        meta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, attackSpeed);
#

yeah its that.

#

GENERIC_ARMOR is for your armor bar

noble lantern
#

Yeah but toughness is something else

#

generic.armor.toughness

#

ahh

zenith gate
#

yeah

noble lantern
#

GENERIC_ARMOR_TOUGHNESS so its a standard modifier then

#

i know it used to not be in older versions

#

@golden turret

#

^

torn shuttle
#

you guys think mojang will walk the global bans back?

#

seemingly you can get a 7 day ban for typing Nigel in a sign which is a pretty good feature in my opinion

#

I hate Nigel, fuck that guy

golden turret
#

armorResistance is 1

#

so /4 is 0.25

noble lantern
#

cause if so fuck nigel

noble lantern
torn shuttle
#

it was on the minecraft subreddit, a user got banned from their own realms server for having the gall of typing Nigel on a sign

noble lantern
#

oh my god

#

what did they do to test the string lmfao

if str.startsWith("ni");

#

watch out night might get you banned

#

night*

torn shuttle
#

it's a good thing that minecraft is an english-only game

noble lantern
#

honestly i dont see why it wouldnt

#

yeah multi languages has to be a pain for that

#

idek why companies bother with censoring chat

#

if imma say fuck imma say it

#

same with any 9 year old whos been on the internet for 6 months

#

and then you cant talk about alcohol in game either

#

they act like they have no 21 and plus playerbase

torn shuttle
#

I have a suggestion, let's nuke the country of Niger so that way we don't have to take that into account for chat filters

noble lantern
#

wow discord let you send that message

#

suprising

torn shuttle
#

just erase it from the map

#

no more nigerian princes, they'll all be nigerian bunker survivors

sterile token
#

Does this annotation types exists on java?

AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER

noble lantern
#

lets pretend like it doesnt excist

#

so when someone says

"Im from niger"

Ill just say "tf did you call me?"

noble lantern
#

use lombok

#

@Getter @Setter

#

sec

#

ill get import

torn shuttle
#

we'll also have to nuke Nigeria I guess since they're two different countries

sterile token
#

They are kotlin types but i want to know if there is an equals on java

#

๐Ÿค”

noble lantern
#
    compileOnly 'org.projectlombok:lombok:1.18.24'
    annotationProcessor 'org.projectlombok:lombok:1.18.24'
#

nah

#

not in raw java

torn shuttle
#

I have to say it is a bit awkward to have two very similarly named countries adjacent to each other

noble lantern
#

but with this yes

noble lantern
#

and they lost a war

#

so they added ia to the end

#

idk

#

lmao

torn shuttle
#

it does feel a bit like someone is copying someone else's homework

golden turret
zenith gate
#
ItemStack book = new ItemStack(Material.ENCHANTED_BOOK);
                ItemMeta meta = book.getItemMeta();
                assert meta != null;
                meta.setDisplayName(ChatColor.GREEN + "Your Enchantments");
                meta.addEnchant(enchantment, integer, false);
                book.setItemMeta(meta);

How can I make this item be able to be in an anvil to be combined with another item?
ping upon answer please

sterile token
noble lantern
golden turret
#

Bukkit

sterile token
#

Oh ok its vanilla spigot api

noble lantern
#

thats spigot verano lmao

#

its in the api already

#

stupid discord send my message bruh

#

oh my goood

#

send my messages wow

#

fucking hell

golden turret
noble lantern
#

that event z_aCRYYY

zenith gate
#

So make another listener?

noble lantern
#

yeh

zenith gate
#

would there be an easier way of making an enchanted book?

noble lantern
#

not really

#

its a lot of work to setup

zenith gate
#

im trying to take off the enchants of an existing item, to then be reapplied to another.

noble lantern
#

well

#

then do this

#

cause you can just rename en EnchantmentBook

#

and it still holds vanilla functionality

#

One sec

#

need to find the class

#

?jds

#

?docs

#

?javadocs

#

fucks sakes

#

found it

#

When you have an ItemStack thats an ENCHANTMENT_BOOK, you can cast its ItemMeta to this

zenith gate
#

mhm sweet.. I'll try it out!

noble lantern
#

Im not sure if that class exists on 1.8ish versions; it might not sure

#

i know in around 1.12 the prepare anvil event doesnt exist

#

so i think around that version that class might not also exist

vast zenith
#

So I have a reload command, and I need to know how exactly to save config, cancel task get new config from config.yml then start the task again so it loads in the new config.yml save

zenith gate
sterile token
#

Burch do you have experience with paginated menus?

zenith gate
#

can someone make me some example code of the EnchantmentStorageMeta. ๐Ÿ™‚

noble lantern
#

You could be checking if ItemMeta instanceof EnchantmentStorageMeta

noble lantern
noble lantern
#

eg re-initialize it like you do in onEnable

#

in fact

zenith gate
noble lantern
#

your reload should basicaly just be onDisable and onEnable

zenith gate
#
@Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if(sender instanceof Player player){
            ItemStack mainHand = player.getInventory().getItemInMainHand();
            ItemStack book = new ItemStack(Material.ENCHANTED_BOOK);
            EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) book.getItemMeta();
            EnchantmentStorageMeta handMeta = (EnchantmentStorageMeta) mainHand.getItemMeta();
            assert handMeta != null;
            //get enchants and remove them
            Map<Enchantment, Integer> enchants = handMeta.getEnchants();
            for(Enchantment enchant : enchants.keySet()){
                assert bookMeta != null;
                bookMeta.addStoredEnchant(enchant, enchants.get(enchant), true);
                handMeta.removeEnchant(enchant);
                book.setItemMeta(bookMeta);

                player.getInventory().addItem(book);

            }

        }
noble lantern
zenith gate
#

instance of what? instanceof enchant?

noble lantern
#

sorry, EnchantmentStorageMeta

#

wait

#

wait

#

wait

#

ignore me im sorry

zenith gate
#

okay okay

noble lantern
#

can you

#

?paste

undone axleBOT
noble lantern
#

its hard to read

#

your casting ItemStack to a typeof ItemMeta (The enchantment class)

zenith gate
#

yes

noble lantern
#

Are you using NMS?

#

Whats your imports and whatnots

zenith gate
#

No

noble lantern
#

thats a weird error ngl

zenith gate
#

ikr

#
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
``` all basic imports
noble lantern
#
  1. I wouldnt use assert use if and handle the null value it shouldnt be null (If it doesnt need to be handled you use a guard clause, eg return so the rest of the code wont fire)

  2. Always check if the meta is instance of the object you are trying to cast to

zenith gate
#
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) book.getItemMeta();
EnchantmentStorageMeta handMeta = (EnchantmentStorageMeta) mainHand.getItemMeta();

So remove these and make an instance?

#

do an instance if mainHand.getItemMeta EnchantmentStorageMeta

noble lantern
#

just with enchantmentstoragemeta this time

zenith gate
#

ah okay okay

noble lantern
#

Normally you always wanna check that when casting

#

as with this code, the item in a players hand may not have that type of meta

zenith gate
#

so something like this?

#

?paste

undone axleBOT
zenith gate
noble lantern
#

yes just know you capitablized your variables name for the if statement

#

E -> e

zenith gate
#

github copilot..

#

sometimes he sucks

noble lantern
#

ohhh

#

hahaha

#

wonder why he did that cause the string == an imported class

#

would think he would be smarter than that

zenith gate
#

honestly he sucks at java...

#

he is only good when im doing repetitive tasks

noble lantern
#

he does math for me

#

thats the main thing i use em for

#

or front end bloat for android

zenith gate
#

for me he just repeats my recipes, then I change stuff acordingly

cursive kite
#

If there a way to accomplish this, not sure how to explain it values.addAll(Server.getShownUsers().stream().toList().forEach(t -> t.getName()));

#

I am trying to add all my User objects names to a string list

noble lantern
#

yes but i dont know the exact syntax one moment

cursive kite
#

I've been trying to google it but not sure how to search it lol

noble lantern
#

s = user data object

#

s -> s.userName != null

#

you receive a uhhh

#

Predicate i beileve

#

sec

#

no

#

List/Collection

#

oh no

cursive kite
#

lol

noble lantern
#

sorry, it returns a stream after filter

#

i dont use these methods often haha

cursive kite
#

I thought this would be simpler than creating a bunch of for loops and manually adding each to the list

noble lantern
#

Basically you filter through users firt and you can use a method referance i nforeach

#

ew

#

?paste

undone axleBOT
noble lantern
#

oops

#

ignore > 0

#

should be != null

#

i would wrap it in a method

#

like so

#

there probably a way to one liner it

#

but it will be aids for user readability

cursive kite
#

Server.getShownUsers().stream().filter(t -> t.getName() != null).forEach(t -> {values.add(t.getName());});

#

This works lol

sterile token
noble lantern
#

Yep its same thing as i did, i just made it so you can get it in a method style format to re-usability in code

cursive kite
#

Thank you!

noble lantern
sterile token
noble lantern
#

cant do that

#

he needs to call a method

sterile token
#

ohh ok

noble lantern
#

otherwise would be perfect oneliner

sterile token
#

so he is adding and calling a method?

noble lantern
#

yes his forEach parameter isnt a string

sterile token
#

Server.getShownUsers().stream().filter(t -> t.getName() != null).forEach(values:::add).map(do an action here);

#

๐Ÿ˜‚

noble lantern
#

cant do that

#

its a syntax error

sterile token
#

Oh ok

#

Hmn

#

I have done perfect maps

noble lantern
#

read the filter

#

t != string

#

he needs t to convert to string via getter

#

method referances cant do that

sterile token
#

oh i didnt understand he was doing

noble lantern
#

yeah its a UserDataObject

#

and hes getting all UserNames

#

so his forEach paremeter is UserDataObject

sterile token
#

But i didnt something related convert all players name into a list of names

#

members.stream().map(Player::getPlayer).map(OfflinePlayer::getName).collect(Collectors.toList());

#

What a perfect one liner

noble lantern
#

sec

#

maybe

sterile token
#

Burch im having troubles setting up a filler to the menu

zenith gate
#

so @noble lantern that code would work?

#

cause im still a little fuzzy atm it does nothing atm

subtle folio
#

Is there a way to change the overhead name with scoreboard teams?

subtle folio
#

team.setDisplayName() doesnt work

sterile token
subtle folio
#

changing the color works

#

so its defo working

#

its just that the displayname isnt setting

worldly ingot
#

You have to set the team's prefix, not its display name

subtle folio
noble lantern
worldly ingot
#

Is that not your goal?

subtle folio
#

I want to change the actual name!

worldly ingot
#

Oh you want to change the whole name. No. That's not possible

#

You'd have to change the user's profile

#

Which has all sorts of fun side effects

subtle folio
#

Yeah,

#

one would expect

noble lantern
#

just ask the player very nicely to change his name

worldly ingot
subtle folio
#

It's for a hide command for my moderators ๐Ÿ˜ฆ

noble lantern
#

if your moderators wont change theyre name for you, are they reallly real moderators

#

jkjk

worldly ingot
#

"Hey if you wouldn't mind changing your name to 'TotallyNotSus' for this quick 15 minute game, ktnx"

sterile token
noble lantern
#

Verano

sterile token
#

What do oyu think :D

#

Im figuring how to only fills the borders

noble lantern
#

like 0 and 8?

#

if slot != 0 || 8 return

#

ez

#

if you wanna make a border

#

math nvm

#

lazy

#

need math for that but its simple

#

like a full box border

sterile token
#

Yeah

#

i ant to make a square ith boders

noble lantern
#

so you just need a method

#

actuall no no math

sterile token
#

yeah i want to make a border on every line something like this:

|------------------------|
|                        |
|                        |  
|                        |
|------------------------|
noble lantern
#

int startingSlowFirstRow = 0; // always 0
int startingSlotLastRow = (this.rows * 9) - 8; // (Maybe 9 im bad at math)

sterile token
#

using the for?

noble lantern
#

then for 8 iterations of both of those numbers put your item

#

use those for top and bottom row

#

for sides just check if slot == 0 or 8

#

unless your making a box smaller than that...

#

then god bless your soul

sterile token
#

I saw people only using a for filing borders

#

I want to achive that

noble lantern
#

thats what i do

#

what i do is i set all the items first

#

and then fill the inventory with those items if material == air

#

sec

#

i have example

sterile token
#

allr

#

really thanks

#

Man im stucked

#

Also with filling and paginated menus

#

The one that have pages depending how much items you have

noble lantern
#

i set the items for the slots that are allowed to have the paginted items i have, then use this method afterward to set my glass pane backgrounds

#

eg if i set slot 1 to a apple

#

and use this method, it will fill entire inventory with whatever, and leave the apple there in slot 1 (considering overwrite == false)

sterile token
#

allr

#

so mostly what i did?

#

๐Ÿค”

noble lantern
#

your method you showed will fill an entire inventory

sterile token
#

yeah i just realized that

#

Atm

noble lantern
#

you can just check if slot == air

#

and continue if not

sterile token
#

i dont want to fill all inventory only the borders

#

Not empty slots nothing

#

Only a square

noble lantern
#

so then do what i said earlier

sterile token
#

๐Ÿ˜‚

#

Okay... they are too much lines but if it works

noble lantern
#

Its rly not a lot of lines lol

#

its like 5-8ish

jagged quail
#

:thonk:

sterile token
#

my problem is that i only know the rows

#

๐Ÿ˜ฌ

jagged quail
#

Burchard helping verano code? ๐Ÿค”

sterile token
#

but he has inv size, I dont have it

#

๐Ÿ˜ 

jagged quail
#

:troll:

sterile token
#

i already getting size because of rows * 9

#

Im an idiot

#

forget it

noble lantern
#
int startingSlowFirstRow = 0; // always 0
int startingSlotLastRow = (this.rows * 9) - 8;
for (int i = 0; i <= this.rows *9; i++) {
    if (inv.getItem(i).getType() != AIR) continue;
    if (i == 0 || i == 8) {
         inv.setItem(i, item);
         continue;
    }

    if (i <= startingSlotFirstRow + 7) {
        inv.setItem(i, item);
        continue;
    }

    if (i <= startingSlotLastRow + 7) {
        inv.setItem(i, item);
       
    }
}
sterile token
#

what that bruhhh (the photo)

#

Looks that github codes

noble lantern
sterile token
#

Allr

#

I wil ltry that

#

thanks

noble lantern
#

you basically just need the math for getting the last rows first slot

jagged quail
jagged quail
#

Also you can make it coloured

noble lantern
noble lantern
#

its buggy

#

doesnt always work

sterile token
#

Agtree

noble lantern
#

wait

#

your on mobile

#

it doesnt work on mobile

jagged quail
#

On my phone doesn't show up ๐Ÿ’€

noble lantern
sterile token
#

buchard

#

and for pages?

#

Really sorry man for being annoying

noble lantern
#

for pages you need to keep track of the max amount of items allowed in your inventory

sterile token
#

๐Ÿ˜”

jagged quail
#

Yeah lol

noble lantern
#

if size >= stop loading current page and make a new one

#

its reccomended you have a highly abstracted inventory api for this

#

or its gonna be a pain

sterile token
#

Hmn its really diff every code from my own code

#

I have looked on many github examples

#

But no one fit my menu api

noble lantern
#

i was working on pagintation for my lib api

sterile token
#

Can i upload it to github and invite you to see it?

noble lantern
#

never finished it tho

#

i cant look through code rn sadly

sterile token
#

are u on cellphone?

#

oh okay

noble lantern
#

no but i will be soon

sterile token
#

I was wondering to finish this today

#

But meh i dont worry

noble lantern
#

pagintation for inventories is a lot of work to get it right

jagged quail
#

What time is it in your state rn

noble lantern
#

for dynamic inventories at least

#

10pm a;mpst

#

almost

jagged quail
#

O.o

#

5:44 am in the UK

#

Still 14th July there

#

15th here

sterile token
#

Here is 15th July, 1:47 AM

cursive kite
#

How can I recreate this?

#

This was the best I could get

#

With return Arrays.asList(args[1] + "min", args[1] + "hour", args[1] + "day");

visual tide
#

not 100% sure but you might have to take a deep dive into brigadier

quaint mantle
#

I disagree

#

Wait

#

Nvm

#

I agree

cursive kite
#

Aw

small current
#

Brigadier is a nightmare

sterile token
#

Is posible to merge 2 branchs into only 1 branch?

noble lantern
#

merge one into the other, then that into master

#

or main

sterile token
noble lantern
#

because github is sissies

sterile token
#

sisies?

#

dumb not understand

noble lantern
#

they changes master branch name to main

#

so now its main branch

sterile token
#

okay?

#

But there is a big problem

#

I want to merge diff project modules (1 module per branch) and then add the readme and parent pom to the main branch

#

๐Ÿค”

cursive kite
#

Can I see it?

noble lantern
#

sounds hard

sterile token
cursive kite
#

thx ๐Ÿ˜„

sterile token
#

Maybe burch told him if is okay my way or coude be a better one

noble lantern
#

my way would prolly be atrocious

sterile token
noble lantern
#

i would literally store each string provided as characters and provide index + 1 on tab complete

sterile token
#

There you have

sterile token
#

More than 2d shitting about regex to achive that

cursive kite
#

Wait what does this class do

#

Is this so I can type /tempmute username 4<press tab> then it will show s, d, m?

sterile token
#

The method format you can pass something like 1h and will conver it into ms

#

long duration = TimeUtil.convert("10s"); // 10.000 ms

noble lantern
#

Does anyone know how to reduce times on gradle's first compilation before the daemon is running?

The build time for this project while daemon is running is like 200ms so 45 seconds is quite long (On my pc my daemon doesnt take this long to start but this is in a docker container)

The second image is my installation script when the docker container starts.

Is there any options to run gradle without any project cachine, or better yet even without the daemon and just straight up compile?

#

sorry

sterile token
#

haha

noble lantern
#

didnt mean to spam entire channel thought those pics were smaller

sterile token
#

now i cannot steal your token

noble lantern
cursive kite
#

I think we might be misunderstanding each other lol unless I am wrong, I am just trying to auto complete a suffix

#

I just want to make these letters appear without overriding the value

noble lantern
#

ohh

#

Whats your tab completion code currently

#

can you show what you have rn

cursive kite
#
    public List<String> getCompletions(CommandSender sender, String input, String[] args) {
        if(args.length == 1)
            return null;
        if(args.length == 2)
            if(MathUtils.isInt(args[1]))
                return Arrays.asList(args[1] + "min", args[1] + "hour", args[1] + "day");
        return Arrays.asList();
    }```
#

I tried just returning "s", "d", "m" but if you tab it deletes the number and makes it "s" instead of "439s"

noble lantern
#

yeah ngl im stumped

#

maybe you do need brigader

#

thats how i would do it

#

Wait

#

You said it only makes it s?

sterile token
#

@noble lantern did my time unit class help?

cursive kite
#

yeah

noble lantern
sterile token
#

I know lmao is what i sent him

noble lantern
#

No this is something else

noble lantern
#

i thought it was working here?

sterile token
#

The TimeUnit#convert("time+unit")
Example: TimeUnit#convert("10s")

The method returns you the ms depending on the unit, and them you just use that ms to set the timestamp

#

๐Ÿค”

noble lantern
#

what

#

timestamp???

#

huh?

#

this is tab completion

#

the number value is ireelvent

#

its strings

sterile token
#

I know but i already parse the tring bruh

#

Look the code crefully

#

I use regex to parse the diff time units "y", "M", "w", "h", "m"; "s"

noble lantern
#

they already have all this setup

#

this part is user user entry

#

not actually handling the time

#

They are trying to make TabCompletor auto add a time unit character at the end of a provided argument

#

in the array list

noble lantern
sterile token
#

I dont understand you tho i ill go to sleep

#

๐Ÿ˜ฌ

#

See you people

noble lantern
noble lantern
sterile token
#

3am lmao

#

Cya

cursive kite
#

Yeah this is working

noble lantern
#

i would keep it like that ngl, i like it rather than the ladder option

If your wanting to remove user input from the tab completions, you will prolly need brigader i cant think of a way to do that with spigot

sterile token
#

Also sorry for asking but for spawning particles should be in async?

#

Becaue im planning to do something like traiels and things like that

#

Thanks

ivory sleet
#

The math can be async

#

But packets get synced anyway

#

So donโ€™t just send it async cause that ainโ€™t gonna help that much

torn oyster
#

is there a Spigot Forms API?

#

to check if people own a premium plugin or not

marble copper
#

Guys I wanna start coding plugins can someone help me with it

quaint mantle
lost matrix
quaint mantle
#

Whats a Java

jagged quail
lost matrix
quaint mantle
#

Oh cool

#

So is javascript better

#

alr so I have made a mob which is a zombie

lost matrix
#

Yes. You can do everything. Even do super fast super clean checks like 10 ========= 'x'

quaint mantle
#

how do I disguise it as a player?

marble copper
lost matrix
somber cliff
#

How to use duplication glitch in the server

#

How to enable duplication glitch in the server

quaint mantle
#

Oh My god

hybrid spoke
quaint mantle
somber cliff
#

Sorry I am new I didn't knew that we can't do that

quaint mantle
#

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

somber cliff
hybrid spoke
#

did it work?

somber cliff
#

Do we have to change any setting to do so?

somber cliff
hybrid spoke
#

then try again

lost matrix
noble lantern
#

but no

marble copper
#

Can someone tell me how to make a kit gui with command panels

quaint mantle
#

Ok where you wanna start

marble copper
#

Send me the config for it

quaint mantle
#

What

torn oyster
#

does anyone use jetbrains space