#help-development

1 messages Ā· Page 372 of 1

remote swallow
#

look at the imports

#

might be from paper

hazy warren
#

org.bukkit.event.player.PrePlayerDeathEvent

iron palm
#

what package should i relocate io.netty?

remote swallow
#

dont think we ever had that so it has to be a fork probably

hazy warren
#

Yeahhh

#

Rip

remote swallow
iron palm
#

oh right sorry i just didn't really worked with maven so far

#

relocated gotta test it now

#
                            <relocations>
                                <relocation>
                                    <pattern>io.netty</pattern>
                            <shadedPattern>me.gameisntover.iranmcreportsspigot.netty</shadedPattern>
                                </relocation>
                            </relocations>

this is what i wrote

#

yeah it was fixed

#

but im getting a new error

org.redisson.client.RedisConnectionException: Unable to connect to Redis server: 127.0.0.1/127.0.0.1:6379```
but i guess ik what is it from
#

i've created the client via the create method with no parameter can it be caused this error?

tardy delta
#

127.0.0.1/127.0.0.1 🫔

iron palm
vivid skiff
#

How can i get a player ip adress on login with bungeecord?

vale veldt
#

Is there any way to see how spigot handles the getDrops() method of the BlockBreakEvent?

hazy warren
#

Just inspect the class

vale veldt
#

sometimes getDrops() indicates that it is empty but actually drops items on the floor :l

hazy warren
#

You can check the decompiled source to see what it's doing

vale veldt
valid basin
#

Does anyone know why this doesn't work?
I'm trying to remove items from a players inventory with certain lore

        Inventory inventory = player.getInventory();
        ItemStack[] contents = inventory.getContents();

        for (ItemStack item : contents) {
            if (item != null) {
                ItemMeta meta = item.getItemMeta();
                if (meta != null && meta.hasLore()) {
                    List<String> lore = meta.getLore();
                    if (lore.contains(loreToRemove)) {
                        inventory.removeItem(item);
                    }
                }
            }
        }
    }```
hazy warren
#

The best way to find where the event is called is to get the spigot source and then grep for the event

#

Or you can try your luck with guessing random classes it could be located in and opening them up with intellij

hazy warren
#

download this

#

Then you can easily search for any instance of where that event fires

#

and see how it's determining block drops beforehand

eternal oxide
#

There is getDrops() in BlockDropItemEvent

orchid gazelle
#
              ClientboundLevelChunkPacketData packet = new ClientboundLevelChunkPacketData(levelChunk);
              
              System.out.println("Send Chunk at -1;-1");
              ((CraftPlayer)player).getHandle().connection.send(packet);
``` Why can't I send the packet? It tells me to cast the Packet to Packet<?>
vale veldt
eternal oxide
#

those are only the default drops which could drop

vale veldt
#

Yes, but when you get the drops, sometimes the collection indicates that it is empty but drops items on the floor, this happens with the grass

eternal oxide
#

you can't rely on Block#getDrops()

vale veldt
#

I've seen on the spigot and bukkit forums people who have had problems with this, md5 said it could be a bug, but I don't know what it turned out to be

eternal oxide
#

if you want to see what is actually going to drop use getDrops() in the BlockDropItemEvent

vale veldt
#

this I guess md5 will know what is going on here, because this should not be like this

sterile token
eternal oxide
#

As I said you can not trust Block#getDrops() as even in a best case it's only going to tell you what could drop. That won;t include things like seeds.

vale veldt
hazy warren
#

Yep you've stumbled upon a physically impossible problem

eternal oxide
#

Yes there is BlockDropItemEvent#getDrops() tells you EXACTLY what is going to drop.

vale veldt
hazy warren
#

Why do you have to verify it in another event

eternal oxide
#

simple, move your logic to the actual event that gives you the correct data

#

what are you doing in teh Break event which changes depending on drops?

vale veldt
eternal oxide
#

you didn't answer

hazy warren
#

is elgar a saint

eternal oxide
#

What specifically are you doing in the Break event which changes depending on drops?

vale veldt
# eternal oxide what are you doing in teh Break event which changes depending on drops?

let's say my plugin handles the BlockBreakEvent to break blocks in a region, I have to verify that it is a region of my plugin, that it is not in other regions or claims of other plugins, give compatibility, then proceed to do logic like checking if with the tool that has broken the block has enchantments, and much more, pass all that to the other event I do not know if it is possible, I guess not to have to verify everything I said above, at least I do not know how I would do it if my plugin depends on BlockBreakEvent

eternal oxide
#

all you do is check if it's permitted to break

#

what it drops has no relevance there

polar atlas
#

when i reload my plugin sometimes (quite often tbh) it throws an error where it says java.lang.NoClassDefFoundError: kotlin/collections/CollectionsKt during plugin disable process and yes i shaded my jar. how can i fix this?

hazy warren
#

use java

polar atlas
#

😦

vale veldt
eternal oxide
#

all the break event should be handling is IF the block is allowed to be broken.

#

drops are nothing to do with that event (other than exp)

quiet ice
#

Henceforth no classes that were not already loaded can be loaded.

polar atlas
#

do i really need to migrate over to java just to prevent this?

hazy warren
#

Probably not

#

but you should

quiet ice
#

No. Not the proper solution.

vale veldt
quiet ice
#

To work around this you may want to use your own classloader or play the classloader yourself and load all the classes early

eternal oxide
#

decide if it can be broken in the break event

#

handle drops in drop item event

#

BlockDropItemEvent#getBlockState() gives you the original block which was broken

wary topaz
#

minehut be like:

#

ah shoot wrong channel

#

ah whatever

#

(I advertised free op but I made a plugin that instantly kicks em)

crimson relic
#

ok

vale veldt
eternal oxide
#

if the BlockDropItemEvent runs then the block was permitted to break. The two events are not related

#

If you prevent the break no drop event runs

#

if you allow the break a drop event runs

#

once in the drop event your code shoudl no longer care if it's allowed to be broken

winged wasp
#

Hey, does anyone know how to use RGB colors in the scoreboard?

wary topaz
#

You mean like hex?

#

or like colorful

winged wasp
#

hex

wary topaz
#

Hex is a basic java keypoint

#

I think you should know that.

smoky oak
wary topaz
vale veldt
smoky oak
#

a while

wary topaz
#

prob 1.8 lol

smoky oak
#

1.6

wary topaz
#

jesus

#

thats like -- 7 years ago?

smoky oak
#

longer

wary topaz
#

~7

smoky oak
#

1.8 is 7 years old

wary topaz
#

another 5 peeps

smoky oak
#

8 and a half years

smoky oak
crimson relic
smoky oak
#

ye but why

wary topaz
#

on a server

#

record

smoky oak
#

uh but if you kick immediately

wary topaz
#

it gliches

#

haha

vale veldt
#

BlockDropItemEvent is from 1.13 right?

eternal oxide
#

probably

smoky oak
#

ye

sterile token
#

?work-load

#

?work-distrubution

#

?work-distribution

smoky oak
#

?commands

sterile token
#

its down the bot

lost matrix
#

?workdistro

sterile token
#

thanks smile

smoky oak
#

why cant we just list the commands btw

sterile token
smoky oak
#

why

lost matrix
#

I think discord helper can list them

sterile token
#

Yes they removed it

icy beacon
#

wdym

#

?cc list

#

try in #bot-commands

#

it works there

#

?ecosia

undone axleBOT
icy beacon
#

?bing

undone axleBOT
icy beacon
#

I love it

lost matrix
#

Oh i found a usefull one

#

?basics

undone axleBOT
wary topaz
#

seems 50 players crashed the server

#

noice

halcyon hemlock
#

?google

undone axleBOT
halcyon hemlock
#

?letmegooglethatforyou

#

smh

#

add that

orchid gazelle
#

hello

#

is there anything to apply things to a LevelChunk-clone?

lost matrix
#

There is a ChunkSnapshot you can create from a Chunk. Can even be used async.

orchid gazelle
#

the thing is that I gotta send the Object LevelChunk

#

and a LevelChunk is created with a ServerLevel and a ChunkPos

steel swan
#

helllooooo anyone has a good tutorial/video on how to properly create a database? like to store classes or things like that and to get those values back even after u /reload ?

orchid gazelle
#

do you just want to store data or actually serialize objects?

hazy parrot
#

If you really want to learn it look into relational schemes and dB normalization

steel swan
#

so objects yas

hazy parrot
#

Then you probably don't want to use relation scheme, but document based one

steel swan
hazy parrot
#

Google about mongodb, I think there is also tutorial on spigotmc iirc

steel swan
#

thx !

ivory sleet
#

Abstract away common parts

#

Like create a method registerEvents(Listener… listeners)

#

And then pass your listeners to that instead, removes a bit of boilerplate

#

You can use some hacky stuff to do that

#

But its not recommended

lost matrix
#

Classpath scanning incomming

ivory sleet
#

Cause like, classes come and go (they are loaded dynamically and can be unloaded and loaded before and after server start and end)

orchid gazelle
#

smile, can I somehow clone a LevelChunk with a String and then get one back from it?

vocal cloud
lost matrix
#

In theory you could use a context & dependency injector like guice to do a lot of stuff with annotations.
But i despise this meta programming style like its used in SpringBoot etc

ivory sleet
#

You mean like storing them in an array and then loop over the array and register each element

orchid gazelle
#

.toString obviously just gives something like net.minecraft.world.level.chunk.Chunk@74835ccd

ivory sleet
#

Or sth else?

ivory sleet
echo basalt
#

I never understood why people like the @Inject annotation

#

unless you're a google dev you can never understand what it does internally

ivory sleet
#

Its supposed to help with long constructors, like mapping dependencies

eternal oxide
#

a clean event register```java
private List<Listener> events = new ArrayList<>();

@Override
public void onEnable() {

    events.add(new RainbowGlow(this));
    events.add(new RecipeManager(this));
    // ...
    
    events.forEach(e -> pluginManager.registerEvents(e, this));
}```
ivory sleet
#

Since if you have a long ass constructor its gonna be a pain to maintain the order in which the dependencies are passed

quaint mantle
ivory sleet
#

Just do
registerEvents(Listener… listeners){
Arrays.stream(listeners).forEach(listener->{
this.getServer().getPluginManager().registerEvents(listener,this);
});
}

#

That way the vararg arr is rest assured to be gc’d

#

And you document your code by making the method explain to the reader what is going on

quaint mantle
#

Is Java's GC routine really dumb enough to leave a dead array reference if it's used/not used in a certain way?

ivory sleet
#

Na

#

But the gc is sometimes stupid

quaint mantle
#

Or does my method make GC slightly slower than others?

ivory sleet
#

No

#

Maybe if u’re running poopy system with serial gc

#

Tho i used a stream

#

Which is like goofy memory usage right there

quaint mantle
#

I seen that, which is why I was asking

ivory sleet
#

Well didnt know if that variable declaration was a scoped local variable or a field

quaint mantle
#

What's the benifiet of using .forEach(<lambda>) or Arrays.stream compared to java's built in for-each loop syntax?

orchid gazelle
#

how can I view the actual sourcecode of something like a ClientboundLevelChunkWithLightPacket? Not some description, I gotta know how it works to fork it

ivory sleet
#

There’s no benefit, but there’s less boilerplate, just readability

quaint mantle
#

Ah

desert loom
#

I think a simple foreach there is fine

ivory sleet
#

Yes

#

Its during server plugin bootstrap

#

So using little more memory there is no biggie

desert loom
#

Not talking about performance/memory, was just saying I think it's probably not needed

smoky oak
desert loom
#

isn't that more code compared to just a simple foreach?

orchid gazelle
ivory sleet
#

compared? You mean compact?

orchid gazelle
desert loom
#

no I mean compared to a foreach isn't it more code*

quaint mantle
desert loom
#

I'm all for readability but I don't think that improves it.

hazy parrot
#

Yeah I also like standard loop more then forEach

orchid gazelle
#

yep

#

where?

quaint mantle
# orchid gazelle yep

NMS is typically obfuscated, you'll need the deobfuscation maps and then you can just decompile the vanilla server and apply the deobfuscation

orchid gazelle
#

im using mojang mappings btw.

quaint mantle
#

The vanilla server is NMS (net.minecraft.server)

orchid gazelle
ivory sleet
#

Theone in this case it doesn’t matter but basically

Normal for each is faster as of now (Java told us streams might be comparable in the future)

For each gets clustered(nested) easier because you’re forced to write consequent code inside the scope of the for each

Stream allow you to do it in a monadic style, that is being able to compose it without the code becoming too nested, of course you can always extract more methods to avoid large functions since large functions almost always decreases readability and maintainability

The other advantage is parallel streams.

Then you have the fact that lambdas compile down to invokedynamic which is nice.

#

You also have method references, which is nice if you can take advantage of.

#

But both works, and it doesn’t matter in this case at all.

quaint mantle
desert loom
#

yeah true it does not matter

orchid gazelle
desert loom
#

I wasn't talking about whether it mattered but if it was even worth going for a stream

quaint mantle
desert loom
#

I guess it's just preference there?

ivory sleet
#

Mye, well I always think in streams so prob why I went for it

#

Ye

desert loom
#

I haven't really looked into streams but they do look cool

#

and can shorten code a bit which is always nice

ivory sleet
#

Very beautiful stuff but oh god java does use memory for it nonetheless

quaint mantle
wet breach
desert loom
#

you mean the foreach method?

#

but yeah I'd assume they are the same

ivory sleet
lost matrix
#

After learning about them i literally wrote everything i could with streams.
Mostly stuff i should not have used streams for...
Dropped them almost completely after some jmh benchmarking. They are
better in newer versions but im marked now

ivory sleet
#

🄲

desert loom
#

ā˜¹ļø

ivory sleet
#

Like mojang for instance

quaint mantle
#

Java is a strange beast

wet breach
ivory sleet
#

They have bombarded their code with streams unnecessarily

wet breach
#

not to be confused with your normal for loop btw which is different

#

and still handy for its own use

ivory sleet
#

Like you even have path finding and entity fetching being handled by streams

onyx fjord
#

Nothing will save mojangs code

ivory sleet
#

Truly

quaint mantle
#

That's the problem with long-standing projects (of really any language.)
It becomes increasingly harder to keep up with the times.

ivory sleet
#

Indeed

onyx fjord
#

Yandex still uses python 2

#

😐

wet breach
#

don't need mojang code if you just make your own implementation šŸ˜›

#

but everyone is also set on trying to make public plugins everywhere XD

ivory sleet
#

I mean its pretty nice just being able to use some api and stuff to get my little hub plugin up running

wet breach
#

indeed

orchid gazelle
#

hmmm thats weird

#

I wanna send a ClientboundLevelChunkWithLightPacket without having to modify a Chunk for it

wet breach
#

you should be able to send a chunk update packet instead

orchid gazelle
#

can you give me the name of it?

wet breach
#

should have update in its name

orchid gazelle
#

nothing with chunk and update

orchid gazelle
#

the chunk

wet breach
#

that is the one to update the light only

orchid gazelle
#

I gotta manipulate chunk data and send it

#

so not only light

wet breach
#

to cut down on the packet size you can exclude the block entities and light update and just send those later

#

if you want to make it more performant

orchid gazelle
#

uhm that seems like an extreme shit-load of work to wrap myself

#

all I wanna do is having a clone of a LevelChunk

#

to modify it and send it to the client

wet breach
#

well that is what chunk updates entail

orchid night
#

anyone on here able to help with a small issue?

#

Factions based

hazy parrot
#

?ask

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!

wet breach
#

asks if there is people to help

#

and ignores people chatting

orchid night
#

I was in another chat

frank pumice
#

I am trying to add a dependency for plguin factions and I can't, it can't find the dependency in maven, I tried to add it as an external dependency but it doesn't work either. Can you help me?

orchid night
#

I need help with protection and the end

wet breach
#

need to tell maven how to find the dependency

#

it isn't magic

orchid gazelle
#

with my own non-existant chunks

wet breach
#

the update is fake if you are sending those packets without the server being aware of it, but there is a lot of packets you are going to need to catch to prevent the client from seeing that it is fake

lost matrix
wet breach
#

which is basically all the update packets

frank pumice
orchid gazelle
#

all this just to see the suspection of it being 10x faster than rendering BlockChange-Packets

#

=(

wet breach
#

add the repository information where said dependency can be found

#

or install it into your local maven repo

lost matrix
# orchid gazelle oof

You can also try creating an instance of LevelChunk manually and see if you can edit/send it this way

orchid gazelle
#

I got an instance of it with ServerLevel and ChunkPos

#

but, when for example trying to use LevelChunk#setBlockState, its gonna access the real Chunk and change the block

frank pumice
wet breach
#

show your pom

#

and people might be able to help

frank pumice
#
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>LakeAddonFactions</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <id>local-repo</id>
            <url>file://${user.home}/Documents/dependencias</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.massivecraft</groupId>
            <artifactId>Factions</artifactId>
            <version>2.14.0</version>
        </dependency>
    </dependencies>
</project>```
remote swallow
#

that is not where your local repo is

#

or shouldnt be

frank pumice
#

The jar is exactly in the "dependencies" folder.

remote swallow
#

is it just the jar or is it in com.massivecraft.Factions.2.14.0

#

you should mvn install that

frank pumice
#

I am using mvn install:install-file -Dfile=Factions. jar -DgroupId=com. github. Factions -DartifactId=factions -Dversion=2.14.0 -Dpackaging=jar it and still this dependency does not work for nothing

remote swallow
#

remove the un-needed spaces

#

mvn install:install-file -Dfile=Factions.jar -DgroupId=com.github.Factions -DartifactId=factions -Dversion=2.14.0 -Dpackaging=jar

regal scaffold
#

So currently my plugins depends on vault. But i'm wondering how can I make vault be the last priority dependency and depend on other plugins first if they're available. Changing my code accordingly depending which one is available

For example:

Depend on vault or luckperms

If LP is available use LP directy, otherwise vault

remote swallow
#

soft depepnds

frank pumice
regal scaffold
#

Yeah but like code wise

#

How does that logic work

remote swallow
regal scaffold
#

Do I make a DependHandler abstract and make each handler extend that?

remote swallow
regal scaffold
#

But then somewhere I need to specify different functions depending on which handler is used

regal scaffold
remote swallow
#

yeah, that would work

regal scaffold
#

Is there a better way to do it?

remote swallow
#

not that i know of

regal scaffold
#

Ok cool,

wet breach
#

once you install it with the mvn install command, change your pom to remove the repository information

#

as it isn't valid and isn't necessary for local repo

frank pumice
#

The dependency has been added in pom.xml. But in the code below.

import com.massivecraft.factions.Factions;
import com.github.Factions;

public class AddonFactions {

    public void printFactionInfo() {
        Faction faction = Factions.getInstance().getFactionById("my-faction-id");
        System.out.println("Faction name: " + faction.getTag());
        System.out.println("Faction leader: " + faction.getLeader().getName());
        // etc.
    }```
It is not identifying the classes.
wet breach
#

did you successfully install it with mvn install?

frank pumice
wet breach
#

well to verify, navigate to local repo

#

to see where it is at

#

if everything is good, hit build on your maven project

#

it should cause it to update and see the dependency

#

of course after updating your pom to be correct

frank pumice
#

In maven it is correct, without any dependency problems. But when I do the import I run into this problem Cannot resolve symbol 'massivecraft'

wet breach
#

did you hit build for maven to pick up the dependency ?

#

this is assuming you installed it with the correct groupId and artifact name to match what you have in your dependency tag

frank pumice
#

Faction dependence

frank pumice
wet breach
#

if everything is correct then you should be able to use it

regal scaffold
#

Hey so I'm trying to sort tablist.

I understand tablist gets sorted by teams prefix a-z and such. How could I go for sorting this automatically based on a groups weight or a groups permission node signifying a weight. weight.<int>

wet breach
#

otherwise you have something wrong, maven looks in the local repo and maven central for dependencies

regal scaffold
#

Because I see people in old posts say the only way is creating teams and adding those with a hidden prefix.

#

But how can I create teams with specific names if I Don't know how many teams there will be

frank pumice
wet breach
#

did you hit build?

molten pebble
#

hi boys

#

how can I do to add a .yml inside a datafolder

#

Like

#

plugins/myPlugin/lang/en_EU.yml

sterile token
#

Im confused why would thorw an NPE?

#

If im already checking, if im creating the section if it doesnt exists

molten pebble
#

bro

#

you can do this

sterile token
golden turret
sterile token
golden turret
#

intellij dont has obligation to know what each code does

#

then you are creating it worng

sterile token
molten pebble
#
final ConfigurationSection yourSection = config.getConfigurationSection("Section");
if(yourSection == null) return;

for(String path : yourSection.getKeys(false)) {
  String al = yourSection.getString(path + ".aaa");

  // TODO
}
sterile token
#

I must create the section in case of being null

#

Yeah its the same logic*

#

Hmnn

#

I will prob wait until another answer because im really cofnused, doesnt make sense the exception

#

Because im creating the fucking config section, in case it doesnt exists, so there is no posbility of having the section null

molten pebble
#

but ur code is right

#

not?

sterile token
#

Yeah the code seems right

molten pebble
golden turret
#

data.set("Previews", new HashMap<>())

molten pebble
sterile token
golden turret
#

but why do you need to get the configuration section?

regal scaffold
#

Because I see people in old posts say the only way is creating teams and adding those with a hidden prefix.
But how can I create teams with specific names if I Don't know how many teams there will be

sterile token
golden turret
#

elaborate

molten pebble
sterile token
#

Im using this code for using ConfigurationSerializable ith custom model objects

golden turret
#

but

#

you dont need it

#

the ConfigurationSection

#

send me your config layout

molten pebble
#

Wizard u from brazil

sterile token
#

I cant sent it, because i cant even save the data

#

šŸ˜‚

#

The same issue tho

#

a fucking NPE saying that section is null when im fucking telling to create the fucking section in case of fucking beeing null

#

😔

#

Sorry man

#

I didnt want to rage but doesnt make sense the fkg issue

golden turret
sterile token
golden turret
#

will it be a list?

sterile token
#

Hmnn

golden turret
#

like

#

after you do what you want

sterile token
golden turret
#

will it be a List<YourObject>?

#

bro

#

you dont need it

#

just use a list

#

like this

sterile token
#

I cant

#

Im using a Map<String, Object> that how it must work

molten pebble
#

hm?

golden turret
#
Previews
  - ==: YourCustomObject
    some-data: value
  - ==: YourCustomObject
    some-data: another value
  - ==: YourCustomObject
    some-data: value 3```
#

and the code woul be

sterile token
#

i cant use list, was an specific request from my executive to treat it like a map

golden turret
#
List<YourCustomObject> list = (List<YourCustomObject>) data.getList("Previews", new ArrayList<>());```
#

much easier

sterile token
#

Hmn

#

But why throws NPE

#

You are not giving any explanation

golden turret
#

idk

sterile token
#

I must want an explanation

#

I dont want spoofed code, its easier yes, but i want to learn the why

golden turret
#

but i am providing to you a better code

regal scaffold
#

šŸ˜† this guy

sterile token
#

Im not with humo to support this jokes, im being seriuos

#

When coding, its coding them yes you can do jokes and what ever

regal scaffold
#

This is why half the dev discord has you blocked. You're not nice

sterile token
#

I just wondering to get an explanation of why owuld throw an NPE exception, when im telling to create the section in case of not existing

molten pebble
#

ta

golden turret
# sterile token
public void reload() {
  this.data = new FileHandler(plugin, "data/previews.yml", true);
  for (Preview preview : (List<Preview>) data.getList("Previews", new ArrayList<>())
    this.previews.put(preview.getKit().toLowerCase(), preview);
  plugin.getLogger().info("[PreviewManager] Sucessfully loaded " + previews.size() + " previews");
}```
golden turret
#

you didnt

sterile token
#

aint not way giving the same exception

molten pebble
#

its similar

sterile token
#

It must be something else wrong i will check the file creation, must be that

golden turret
#

it dont have anything to do with the file creation

sterile token
#

Lol

sterile token
#

Lmao than im the one who fucks

golden turret
regal scaffold
#

:/

sterile token
#

I know how section works

#

Either that or havent even read my code

golden turret
#

omg

#

verano

#

we are fucking blind

molten pebble
#

SMH

regal scaffold
#

;.

sterile token
golden turret
sterile token
#

Im really mad with this guy he alays disturbing instead

golden turret
#

you are using the section before it was created

sterile token
#

I was before using createSection() when was null

regal scaffold
#

xd

golden turret
#
if (section == null)
  section = data.createSection("Previews");
#

the .set method would work too

molten pebble
#

i cant believe

golden turret
#

but the section = should be a get

sterile token
#

oh i understand why

#

it doesnt get updated šŸ¤¦ā€ā™‚ļø

golden turret
#
if (section == null) {
  data.set("Previews", new HashMap<>());
  sections = data.getConfigurationSection("Previews");
}```
sterile token
#

That why i always prefer using custom libraries rather 3rd parties 😬

golden turret
#

the last 2 codes I sent will fix your problem

#

you forgot to update the variable

molten pebble
#

ChatGPT could solve ur problem

sterile token
#

And most of time code its wrong or broken

molten pebble
#

sure it's an ai

molten pebble
#

but ChatGPT helps a lot

regal scaffold
#

When people help you the correct thing to say is "thank you" btw

#

Maybe if you try that people will want to help you out more

sterile token
#

I always say thanks, but once i have the code working

#

šŸ¤¦ā€ā™‚ļø

golden turret
#

just reassign the variable

#

and you should be fine

molten pebble
#

you weird

sterile token
#

right thanks wizard

golden turret
#

but

#

you should use my code

sterile token
#

I would but it specific ruquest from my executive

molten pebble
golden turret
#

and uses the power of the ConfigurationSerializable

#

yea

molten pebble
#

fucking 20 dolars

golden turret
#

that is cheap

sterile token
molten pebble
#

brasil

#

brazil is not so cheap

sterile token
#

If you want good custom things == putting bunch of money

molten pebble
#

not expensive but not cheap

sterile token
#

I tell you as experience

#

For example i was paid around $100 just for adding 3 simple things and refactoring some things

#

From a src they already provided

molten pebble
#

u dumb

sterile token
#

I love how english people like to give far a way / for free their money to devs

#

haha its something i love from them

molten pebble
#

really dumb

#

but is your money

sterile token
#

That you consider something is +200 usd and they pay u without any questions

#

šŸ˜‚

#

That why i dont usually code for latin americans

#

Just for english people who really have the money

hybrid spoke
#

a software dev doesnt have a fixed price

molten pebble
sterile token
sterile token
#

I didnt know you code

#

Sorry

molten pebble
#

It's a joke

hybrid spoke
orchid gazelle
#

20$/hour is usually insanely low for a dev

#

Lol

green tapir
#

is there a method to get arrow land location?

sterile token
vocal cloud
#

Especially for a freelance dev

hybrid spoke
green tapir
#

oh ok thanks

orchid gazelle
#

Well but almost in all cases, 20 is low

sterile token
#

You cant compare plugins working with backend working

molten pebble
#

im so poor then

sterile token
#

backend get paid around +60% rather mc coders

hybrid spoke
molten pebble
#

Lmao

hybrid spoke
#

otherwise they will just look for someone cheaper

sterile token
#

Yeah

orchid gazelle
hybrid spoke
#

broken down its all code

orchid gazelle
#

Well plugin is not plugin

sterile token
vocal cloud
#

I charge the same for all my work. Work is work

hybrid spoke
#

^

hybrid spoke
#

your business logic is code

molten pebble
#

im going back

#

cya

sterile token
#

cya

orchid gazelle
#

Yo guys how do I modify a BlockState or LevelChunk without modifying anything in the real world?

sterile token
#

Packets if im not wrong, im not sure tho

orchid gazelle
#

Thats the issue

#

I gotta send the packet

#

But it requires a LevelChunk, and I wanna modify it without modifying the world permanently

sterile token
#

You have to get the CraftPlayer, then the handler, usafe sendPacket

orchid gazelle
#

I know how to send Packets

sterile token
#

oh right

#

My bad

orchid gazelle
#

No problem

orchid gazelle
#

Because this complex thing does a lot more than just setting a variable for a block

sterile token
#

Yeah

#

That why depending on 3rd parties libs its a mess

#

šŸ˜‚

orchid gazelle
#

Not doing that

sterile token
#

I know but i mean

#

For this type of issue i dont like using none custom framewoorks

orchid gazelle
#

Yeah

#

I hate using other libs anyways if I can create them by myself

sterile token
#

Agree

golden turret
#

ok

#

I want to know spring

#

so I can charge $1000/h

#

šŸ˜Ž

orchid gazelle
#

šŸ˜Ž

sterile token
#

Im currently working on custom plugin library for creating multi platform (Bungee and Spigot) plugins in the same way, without chaging the file loading, scheduling, commands, etc

orchid gazelle
#

Nice

#

Keep it up!

sterile token
#

Because i code lot of multi platform stuff

#

Specially with redis and mongo

#

And i wont want to be creating diff code for just file loding for example, which can be done by same way

orchid gazelle
#

Redis is cool

sterile token
#

yeah pretty cool

#

Specially when having to work with redis shards šŸ˜

#

but sometimes its really annoying

regal scaffold
#

Hey so I'm trying to sort tablist.

I understand tablist gets sorted by teams prefix a-z and such. How could I go for sorting this automatically based on a groups weight or a groups permission node signifying a weight. weight.<int>

Because I see people in old posts say the only way is creating teams and adding those with a hidden prefix.
But how can I create teams with specific names if I Don't know how many teams there will be

green tapir
#

how can i spawn an arrow that fires at the direction the player is looking at?

#

and how can i implement two events in 1 listener?

sterile token
golden turret
#

i never worked with it before so idk

green tapir
#

they don't let me register my other event as e2

worldly ingot
#

In one Listener, not in one handler

#
@EventHandler
public void first(SomeEvent event) {}

@EventHandler
public void second(SomeOtherEvent event) {}```
#

You can't do two events in one handler. There'd be no way for Bukkit to know how to call that

green tapir
#

then how exactly can I use both of the handlers in one listener?

#

how do i create a new body for them

regal scaffold
#

I guess I can make the teams for all groups with a permission node but then how do I assign the player to a scoreboard group that I did not keep track of

worldly ingot
fresh timber
#

is there a way to play a song from a cd disc or a jukebox thing to a player with a minecraft plugin?

smoky oak
#

playsound exists

#

the disk should be another sound

eternal ivy
#

How to block explosion of respawn anchor and bed?

green tapir
#

do listener then deny respawn anchor explosion and bed explosion?

#

idk man

eternal ivy
#

There are no respawn anchor and bed explosion

smoky oak
#

doesnt the explosion event have an explosioon source

#

cancel if bed

green tapir
#

u can cancel bed placement

#

i think

smoky oak
#

yea getblock should tell you the block thats triggering the explosion

worldly ingot
#

Check if the block is either a bed or a respawn anchor and cancel accordingly

smoky oak
#

thats what ive been saying without actually pointing out the exact solution lol

eternal ivy
#

yeah

#

it blocked

#

but

#

How to block damage of block explosion?

smoky oak
#

if you cancel the event it will not explode in the first place

green tapir
#

how can i do GetItemInPlayerHand = Material.TNT or something?

green tapir
eternal ivy
#

um

green tapir
#

after delay set back un-invulnerable

#

like 20 tick delay or sth

eternal ivy
#

Cannot get player in BlockExplodeEvent

eternal ivy
sterile token
eternal ivy
#

he told me that make player to invulnerable

sterile token
#

Also tnt and beds, dosnt trigger a EntityExplodeEvent ?

#

Someone confirm please

smoky oak
#

why the fuck does a cancelled event still go through in the first place

worldly ingot
#

It shouldn't

#

If that event is being cancelled correctly and it's still damaging players, then it's a bug

smoky oak
#

hm

#

you recon the interactevent with the bed in the nether triggers a block explosoin and a damage explosion

sterile token
smoky oak
#

yea so you have to cancel the interactevent

#

huh

sterile token
#

And then someone told me tha tbeds and tnt trigger the entity explode event

smoky oak
#

weird

#

ah or that

sterile token
#

idk the apis has some weird things

smoky oak
#

what about anchors

#

also entity?

sterile token
#

what are anchors?

smoky oak
#

respawn

#

the nether bed

sterile token
#

never heard about them

#

Maybe is something new

smoky oak
#

uh

#

the nether update isnt new

sterile token
#

Tell him to try using the EntityExplodeEvent

green tapir
#

public class GunFireListener implements Listener {
@EventHandler
public void PlayerInteractEvent(PlayerInteractEvent e){
if( Material.TNT = e.getPlayer().getItemInHand().getType();)
}

#

what's wrong with this?

sterile token
sterile token
#

And add a listener to EntityExplodeEvent and check if entity is instanceof Player, and then cancell it

green tapir
sterile token
#

oh right

#

Hmn confused now

#

maybe i reply wrong persona

#

oh yeah

#

My bad i just realize

sterile token
#

And check if that works, i think that its the same issue i used to have some time ago

sterile token
# green tapir ?

What are you doing? What your final goal? mainly context please

green tapir
#

to summon arrow when the tnt (gun) right clicked

#

and summon primed tnt at projectile land location

sterile token
#

oh math, im not good at it, sorry. You will have to mainly wait pantientlly until someelse answer

#

Please if you want to persist your message you would have to open a thread

green tapir
#

k

quaint mantle
#

Hi , why elese is wrong ?

sterile token
#

Atleast take a cap near the error

#

No whole screen

#

Not even with 200% of zoom can read tht

quaint mantle
eternal night
#

else not elese

sterile token
#

Also if you hover over that red lines, you can read the issue reason

green tapir
#

lol

sterile token
#

If its your first time coding plugins, dont even touch spigot without learning how to use Intellij / IDe you use for coding, neither learning Plain Java, and then yes start using apis or liibraries

quaint mantle
sterile token
#

Because moslty people here explain you things very technically so if you dont learn Java, a) you will have many issues while coding plugins, b) and also wont understand whtat others explain you

#

Im not being rude, just telling you the truth because many people make that issue

quaint mantle
quaint mantle
green tapir
#

how can I copy the args I got from a command and then paste it in a message?

#

like if player type /command args then the system would send the player "args command is sent"

#

public class TpaCommand implements CommandExecutor{
// /tpa playerName - tps to player
// args[0] - "playerName'
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player);
Player p = (Player) sender;
if (args.length == 0){
p.sendMessage(ChatColor.GOLD + "Sent " + ChatColor.RED + "TPA Request" + ChatColor.GOLD + "To " + args[0]);
}
return true;
}
}

#

will this work?

echo basalt
#

?tryandsee

undone axleBOT
echo basalt
#

also code blocks

green tapir
#

what if i want to make the args[0] and see if it is a player and if it is player then send a message to that player?

#

and import the args[0] into the /tpaccept and /tpadeny command?

frank kettle
#

Dude

#

Search online honestly

#

That's such basic questions that have so many threads and tutorials online easy to find.

#

Use discord if you can't find your answer elsewhere

#

Don't waste someone else's time

worldly ingot
#

Could've probably been said a little nicer, lol

#

but yeah, a lot of these questions are asked by most beginners so if you're familiar enough with how to write a decent Google query, you'll probably find your answer on the forums already

frank kettle
green tapir
#

ok

halcyon hemlock
#

average js developer

quaint mantle
#

Anyone know how to optimize a PlayerMoveEvent listener even if its just a if statement its at the top of my timings

lost matrix
quaint mantle
#

it just checks if they move a full block

#

could just be because it gets triggered 20 times per sec per player

#

its not a lot its like 0.03

#

and my entire plugin takes like 0.06

lost matrix
#

ms? percent?

quaint mantle
#

im just tryna to figure out how to optimize it

#

percent per tick

lost matrix
#

Show some code then i can tell you if you can optimize it. Ive written this check a bunch of times
and optimized it.

quaint mantle
#
@EventHandler(priority = EventPriority.LOWEST) fun onPlayerMove(event: PlayerMoveEvent) { if (!FrozenHandler.isFrozen(event.player)) return if (event.from.x == event.to.x && event.from.z == event.to.z) return event.player.teleport(event.from) event.player.velocity = Vector(0,0,0) }
#

wtf

#

why did my chromebook format it like that

lost matrix
#

Why are you teleporting the player back and setting the velocity to 0?
This is the most expensive code in your move event.

quaint mantle
#

its for frozen

lost matrix
#

How does isFrozen check the players state

quaint mantle
#

to prevent u moving

lost matrix
quaint mantle
#

It just returns if a list contains a uuid

lost matrix
#

This can also be expensive with more players in the List. Use a HashSet instead.

lost matrix
remote swallow
#

also no early return stuff so smh

strong chasm
#

how to make a boss?

lost matrix
remote swallow
#

ah true ig

lost matrix
#

But yeah i wrote this guide after about a year of programming and still used
Eclipse back then... Just updated a few pics over the years.

vital sandal
#

how can i make spigot plugin multi version :l

remote swallow
#

nms?

vital sandal
#

it coded purely with spigot and no NMS

remote swallow
#

just depend on the lowest version you want to support and set the api version to the same

#

it will work on all higher versions

vital sandal
#

ohh i see

#

ty

regal scaffold
#

I have a map of String, int

How can I sort this by int going from highest to lowest

#

Specifically I need to sort a list of groupnames by weight

hazy parrot
#

You can use stream api, use its #sorted method

#

Iirc there is builtin comparator for sorting by value, I just can't remember it's name

low temple
#

oh its /tpa playername

#

yeah that should work. args[0] should return the playername

iron palm
# remote swallow your.package.netty

meh i couldn't fix this error yet

org.redisson.client.RedisConnectionException: Unable to connect to Redis server: 127.0.0.1/127.0.0.1:6379```
these are also my dependencies am i missing something?
lost matrix
strong chasm
#

any tuts on how to make a boss?

glossy venture
glossy venture
#

ah

#

you could maybe have it provided by putting it in the libraries block under plugin.yml

iron palm
#

oh

#

might be

#

what format libraries need for an object

#

since im receiving a warning while typing

      - netty```
tender shard
#

groupid:artifactid:version

tender shard
#

e.g.

libraries:
 - "io.netty:netty-all:4.1.89.Final"
iron palm
#

but server isn't downloading the libraries

#

idk why

#

server version is paper 1.8.9

lost matrix
#

XDD

#

?1.8

undone axleBOT
remote swallow
#

it got added in like 1.14 or 1.13 iirc

tender shard
tender shard
remote swallow
#

ah

tender shard
#

the libraries feature is 1.16.5+

iron palm
remote swallow
#

1.8 cannot buy booze

#

why can a 7 year old buy booze in germany

tender shard
remote swallow
#

wtf

remote swallow
tender shard
remote swallow
#

they are a child

tender shard
#

however, it's not allowed to sell it to <18 year olds

#

but they could legally buy it

iron palm
tender shard
#

have you seen the patch that deprecates 80% of spigot's api?

remote swallow
#

they did fuck up the api recently

lost matrix
#

Anyone got an idea how this is serialized in protocolLib (1.19.3)
Trying to send a meta data packet for a dropped item and dont feel like digging through nms for this

remote swallow
#

even more yesterday

tender shard
#

oh they fuck it up very often, e.g. the Advancement api

remote swallow
#

they introduced their own plugin.yml stuff

tender shard
#

huh?

#

wdym

remote swallow
#

one sec

iron palm
tender shard
iron palm
#

thats bad

tender shard
#

but as I already said, libraries is 1.16.5+

remote swallow
iron palm
#

my fault

tender shard
#

so you just gotta shade netty

#

if you need it

iron palm
#

yeah

#

i do

#

but i have some servers that are using +1.16

#

except the bedwars one (I seriously hate bedwars but im not the server owner so)

tender shard
#

change*

remote swallow
#

they made their own

#

paper-plugin.yml, it has bootstrap stuff too

tender shard
#

ahaha

iron palm
#

they're absolutely ruining up many spigot plugins for paper why are they doing this

remote swallow
#

its al on the 2nd link

tender shard
#

they really wanna stop having compatibility between spigot <> paper

#

how stupid

remote swallow
#

plugin.yml will still work

#

they just want to be quirky

tender shard
#

yeah...

#

I mean, deprecating all string methods already was a bad joke

#

but now this?

iron palm
#

I guess i gotta learn minestom šŸ’€

iron palm
#

if they do such a thing most of my plugins for the server that im working on would be fucked up how stupid is this idea of making spigot and incompatible only for making the plugin development process easier or whatever bullshit that they're planning to

#

tho

rough drift
#

the fuck?

remote swallow
#

i dont get it lol

rough drift
remote swallow
#

most likely will happen when hanger fully releases

rough drift
remote swallow
#

people have to make a plugin that goes on spigot for spigot, hanger for paper

tender shard
rough drift
#

mainly for spigot

#

90% of tutorials are for spigot anyways

remote swallow
#

even though literally everyone uses paper for servers, none of us care to support their features

iron palm
remote swallow
#

yeah

tender shard
rough drift
tender shard
rough drift
#

So either they keep that 50%

#

or lend it to spigot

iron palm
#

i've worked with the paper api and its dumb

rough drift
tender shard
remote swallow
#

i worked with it once

tender shard
#

it would be awesome if they didnt enforce components that much

remote swallow
#

i just use the string versions

rough drift
#

LegacyTextSerializer.ampersand().deserialize(getConfig().getString("message")); (Didnt' have a string to put in šŸ’€ )

quiet ice
#

Many spigot plugins fail to load under paper now

rough drift
#

and if you use LegacyTextSerializer.char('&') it doesn't recognize it as an ampersand lmao

remote swallow
remote swallow
quiet ice
remote swallow
#

so they have fully gone and hard forked

quiet ice
remote swallow
#

LegacyComponentSerializer.builder().character('&').hexCharacter('#').hexColors().useUnusualXRepeatedCharacterHexFormat().build()

rough drift
#

the fuck

#

Watch them remove reflection into nms lmao

remote swallow
#

it works

#

so i just use it

rough drift
#

?

remote swallow
#

thats what i use for minimessage legacy stuff

rough drift
#

damn

#

makes me feel sad

remote swallow
#

hurts but works

timid jetty
#

Does player.swingOffHand() just call the animation or would it also hit something i.e. a sword hitting?

timid jetty
iron palm
#

the only thing that made me interested in paper api was that they were trying to complete the bukkit api to enforce that ppl wont use nms.
the idea was cool but they made it with a horrible way by adding components and deprecating strings.

remote swallow
#

people might have used paperapi before components

#

now barely anyone wants to

#

and with plugin.yml stuff more people dont wanna use it

quiet ice
#

meh I still do and I don't see all the fuzz

rough drift
iron palm
rough drift
quiet ice
#

And the plugin.yml thing is minor - it will mostly affect server owners

timid jetty
#

Never worked with raycasting any resources you can share on that?

rough drift
timid jetty
#

Ah okay it's just a function

#

Ty got it

rough drift
#

@timid jetty

#

The function returns a RayTraceResult

#

in your case you need getHitEntity() and getHitPosition() (to calculate rotation if you need it)

timid jetty
#

Thanks yeah i found the documentation should be fine :)

rough drift
#

Also, taken from the mc source, maximum client hit distance is 4.5 in survival and 5 in creative, iirc the server allows up to 5.5-6

torn shuttle
#

my brain's been infected with c#, is there no way for me to create an async task that retuns a value which I can use once it's been obtained similar to the await c# keyword?

rough drift
iron palm
#

oh? can it be why that redis wasnt connecting?

hazy parrot
rough drift
#
var future = new CompletableFuture<MyThing>();

CompletableFuture.runAsync(() -> { // Use any async task, I just used runAsync for simplicity
  var result = ...;
  future.complete(result);
});

try {
  var result = future.get();
} catch(Exception e) {
  // error
}
lost matrix
torn shuttle
#

I wasn't sure if completable future would work here

torn shuttle
#

hmm

#

alright I'll try it, thanks

rough drift
rough drift
hazy parrot
#

Your code blocks main thread, the one from 7smile7 doesn't

lost matrix
#
    CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> someExpensiveAction());
    
    // You can also pass the future somewhere and wait for the result:
    String result = future.join();
rough drift
#

that's the point?

#

He wanted to use await

#

thus

hazy parrot
#

Await is not blocking thread, but suspending

rough drift
iron palm
#

the redis error has no clue to see whats wrong

#

and im having no idea how can i fix that

rough drift
iron palm
#

sure

hazy parrot
#

Looks like you haven't relocated netty

iron palm
#
    init {
        instance = this
        channel = BungeeCordChannel()
        client = Redisson.create()
        topic = client.getTopic("BungeeCord")
        topic.addListener(String.Companion::class.java) { channel, msg ->
            if (!channel.equals(this.channel)) return@addListener
            var response = msg.toString()
            if (response.startsWith("resp")) {
                response = response.substring("resp".length - 1)
                val args = response.split(":", limit = 1)
                val i = args[0].toInt()
                println("${args[0]} ||||||  ${args[1]}")
                conMap[i]!!.accept(args[1])
                conMap.remove(i)
            }
        }
    }
iron palm
#

lemme

rough drift
iron palm
hazy parrot
rough drift
quaint mantle
rough drift
#

is there a setProperties for GameProfile

quaint mantle
#

no

rough drift
#

alright, that could've been on eissue lmao

hazy parrot
quaint mantle
#

ooh nvm i found the issue

#

thanks anyways

torn shuttle
#

uh oh

#

I think I fucked up

#

ok this needs a rewrite

timid jetty
#

So I'm using getItemMeta().getAttributeModifiers(Attribute.Generic_Attack_Damage) and it's returning null

#

Anyone know ankther way to get the damage of an item or do I need to write my own utility for it?

#

Nvm found an alternative

iron palm
thick oracle
#

Is there a resource on using configs thread safe?

lost matrix
#

What does "configs" specifically refer to?

thick oracle
#

YamlConfigurations

lost matrix
#

Those are not thread safe. Basically just a HashMap<> underneath.
And you should also never have to use them on multiple threads.

timid jetty
lost matrix
timid jetty
#

Nvm i lied it's working

torn shuttle
#

man this code is a pain

#

all of this because I didn't want to write two nearly identical methods

timid jetty
#

Okay nvm it works sometimes very gimmicky

torn shuttle
#

turns out completable futures' #thenAccept() method is async?

#

which is weird, I don't think that's right

tardy delta
#

isnt it sync on the thread it gets executed on

#

common pool

torn shuttle
#

I mean there's a method specifically for async

#

thenAcceptAsync

#

ok so it's sync with only the thread it's on? that sucks

tardy delta
#

i believe so, i always misused it lol

torn shuttle
#

well how the hell am I going to dump this back to the main thread

tardy delta
#

scheduler::runTask :(

torn shuttle
#

yeah I think retuning a boolean for this method is a dead meme

#

screw it

lost matrix
#

Are you trying to do something on a different thread using CF and using the result on the main thread?

torn shuttle
#

yeah

lost matrix
#

thenAccept(result -> Bukkit.getScheduler().runTask(() -> { use result here }));

iron palm
#

should i add mongodb to the dependencies if i want to use redis ?

tardy delta
#

or join it if thats what you want (probably not)

iron palm
#

or atleast install mongodb

lost matrix
#

Also no