#help-development

1 messages · Page 1465 of 1

wraith rapids
#

well

#

you are probably shading in the entire spigot jar

#

mark it as provided rather than compile

keen kelp
#

How do I do that

wraith rapids
#

in your pom if you use maven

keen kelp
#

I don't use either

#

I just did the artifact thing

wraith rapids
#

well, don't

keen kelp
#

Cause I thought gradle/maven was complicated

#

And didn't want to deal eith it

keen kelp
wraith rapids
#

pl.getConfig

#

no, plugin.getConfig

keen kelp
#

An instance of main?

#

That's a thing?

wraith rapids
#

obviously it's a thing

keen kelp
#

I thought there can only be one main instance

wraith rapids
#

there is

#

exactly one

quaint mantle
#

hey how can i get the File of the resources in my plugin? like how can i access smth like the messages.yml?

keen kelp
#

Oh

wraith rapids
#

show how you're calling it

storm garden
#

I know getDescription().getAuthors() gets the author, but how to remove the square brackets?

keen kelp
#

The one

#

I somehow thought his words meant there were multiple

wraith rapids
#

send a screenshot or something of the line causing the error

keen kelp
#

So gradle/maven is like a power tool yes?

wraith rapids
#

that is not a screenshot

quaint mantle
#

ty

keen kelp
#

It's very useful but you can do without

wraith rapids
#

you can do without until you can't

keen kelp
#

As in impossible

wraith rapids
#

and if anyone else is ever going to work on the project, they will damn you to hell for not using one

keen kelp
#

Or impossible for humam

wraith rapids
#

for example the goldencrates guy doesn't use maven/gradle

#

he does shit the way you do it

keen kelp
#

Regardless how do I start using it then

wraith rapids
#

and it is literally physically fucking impossible to work on the project properly now

#

and it pisses me off

grim sage
#

Hey guys : D I'm trying to change the portal location of an Ender dragon I've spawned, I tried : ( my ender dragon I spawned ) --> dragon.getDragonBattle.getPortalLocation.setX(..) etc . . but it seems not working ! the dragon still fly to 0 74 0. Thanks

wraith rapids
#

i want to fucking punch him in the nards

keen kelp
#

Please link a guide or smth Ill do it after a proper sloop in a week

wraith rapids
#

fucking gold fucknugget

#

here's for creating a project

eternal oxide
keen kelp
#

Do I have to re-start my project?

wraith rapids
#

i don't know if there's any good tutorials for importing one into maven

keen kelp
#

Is there no guide for migrating to it

wraith rapids
#

but basically, create a pom.xml in your root dir

grim sage
wraith rapids
#

and then you should get the option of "add as maven project"

#

and then you need to move some directories around

keen kelp
#

Cool imma screenshot this and let tomorrow's eric deal with the shit

eternal oxide
grim sage
wraith rapids
#

you should ask on the paper discord

keen kelp
#

So he should ask in the paper discord

wraith rapids
#

nobody here knows anything

keen kelp
#

Damn

grim sage
#

but I creating a spigot plugin xDD

#

so how paper's discord can help me x)

wraith rapids
#

if you're using the paper api you're creating a paper plugin

grim sage
#

no

wraith rapids
#

as it will explode in a spigot environment

grim sage
#

I'm using spigot api lmao

keen kelp
#

The you can't

#

Then*

#

I hate mobile keyboard

grim sage
wraith rapids
#

then why is elgar saying you're using paper specific methods

eternal oxide
grim sage
#

its getEndPortalLocation

#

no

wraith rapids
#

or is he saying that you're trying to use paper specific methods

grim sage
#

spigot api

eternal oxide
#

um, seems it is spigot

grim sage
#

This is a spigot api method ^^

keen kelp
#

@wraith rapids how do you know so much and help so much around here but still ain't got a rank

wraith rapids
#

because md69 doesn't like how I persistently shit on his life's work

eternal oxide
wraith rapids
#

so even if I had a rank I'd lose it 20 times a day from getting kicked after telling people to use paper

grim sage
keen kelp
#

Ik md69 is md_5 and who's life?

wraith rapids
#

nothing

keen kelp
#

K

keen kelp
#

Paper is basically spigot+ with a tiny bit of sprinkled in vanilla fucky wacky right

warm galleon
#

Is there a delay in NMS packets when you respawn? Because when I respawn in a wither for the player when they respawn you cannot see anything and the player doesnt see it/packet isnt registered for player

wraith rapids
#

its basically spigot but bigger and better and more popular

keen kelp
#

But is there any down side

#

I use paper im just curious

grim sage
#

So no solution for my problem ? xD I guess that no haha

keen kelp
#

Use paper

wraith rapids
#

that your plugin won't work on the 30% of servers that still use spigot, unless you explicitly design it to work on spigot

eternal oxide
#

Plugins written for Paper using paper method can not be run on Spiot

wraith rapids
#

they can still be run, but it takes extra effort to make them not explode

#

usually not worth the effort though

warm galleon
#

Is there a delay in NMS packets when you respawn? Because when I respawn in a wither for the player when they respawn you cannot see anything and the player doesnt see it/packet isnt registered for player
;

keen kelp
#

Or just slap the 30% in their face and tell them to use paper

wraith rapids
#

that is what most paper developers do yeah

eternal oxide
#

I see a usage of 51% Spigot, 38% Paper, and the rest are other odd builds

wraith rapids
#

dropping spigot support is seen as a good thing

#

because that moves more people to the better forks

#

compare this difference to f.e paper and purpur and you'll see a whole different story

eternal oxide
#

what is f.e?

wraith rapids
#

for example

wet breach
#

for example

wraith rapids
#

it seems that splögget is the only step in the upstream stream that the downstream people want to disappear, no matter how far downstream you go

wet breach
#

could just design your plugin for spigot and it will in most cases still work on paper

#

generally don't need to do anything differently to have it work for paper

keen kelp
#

It's basically 100%

wraith rapids
#

yeah, it's drop-in compatibility

#

but that doesn't mean that it works as well

keen kelp
#

The error chance is basically a rounding error

quaint mantle
#

Not my best code but it works

    @EventHandler
    public void onConnect(PlayerLoginEvent e) {
        core.getServer().getScheduler().runTaskAsynchronously(core, () -> {
            BannedPlayer bannedPlayer = new BannedPlayer(core, e.getPlayer().getUniqueId());
            if (bannedPlayer.isBanned) {
                if (bannedPlayer.isBanExpired) {
                    return;
                }
                e.getPlayer().kickPlayer(bannedPlayer.reason);
            }
        });
    }```
wet breach
#

paper is built on top of spigot

wraith rapids
#

a paper-specific plugin performs better

wet breach
#

sometimes

wraith rapids
#

well, has the potential to perform better

eternal oxide
#

Write for Spigot and it will work on all forks

wraith rapids
#

write for spigot and it works everywhere, write for paper and it works better

keen kelp
cinder thistle
grim sage
#

Write for paper and f**** spigot xD

cinder thistle
#

Use encapsulation

quaint mantle
#

Fair enough

eternal oxide
#

I prefer compatibility over performance

keen kelp
#

That's you my man

#

But I mean there's no right or wrong herr

quaint mantle
keen kelp
#

Not really

wraith rapids
#

and I don't want to discriminate against those who are using the better software, just so that people using the worse version of the software don't need to unroot their asses from their mouldering sanctum and move on

#

I don't want to punish the people who are actively making the ecosystem better

eternal oxide
wraith rapids
#

i want to punish the people in concrete boots

quaint mantle
#

rip

wraith rapids
#

you can also load it directly from a stream

keen kelp
#

It's a good way to manage data what you on about

#

Oh also

wraith rapids
#

use an InputStreamReader and pass it to the yamlconfig factory method

keen kelp
#

For player data, I store them in hashmaps and when they leave or server shuts down I save them into a file to be loaded again when they join the next time, is this a good way of doing it?

#

Since I have no common knowledge

wraith rapids
#

you want to do the loading and saving asynchronously

#

and not with the bukkit config api

#

and probably want to autosave stuff from time to time to safeguard it from a server crash

quaint mantle
wraith rapids
#

YamlConfiguration.loadConfiguration

keen kelp
#

Like writing directing to the file is what youre saying?

wraith rapids
#

a static factory method

quaint mantle
#

oh thx

wraith rapids
#

use basically anything other than the config api for persisting arbitrary data

#

it can be used for that but it really isn't meant for it

sharp bough
#

is there any differente between getServer().getConsoleSender().sendMessage and sout?

keen kelp
#

Yeah but it's just so siiiimple

wraith rapids
#

that the former is objectively worse

#

again, use your plugin's logger

keen kelp
#

getLogger() and do stuff from there yes?

wraith rapids
#

talking about the consolesender shit

#

for persisting stuff, dunno, json i guess if you're not using a database

keen kelp
#

That sounds like a nightmare that I dont even want to think about using

keen kelp
#

Im gonna end up doing it anyway

#

Might aswell skip a few steps

wraith rapids
#

doing it with something simple is a good excercise

keen kelp
#

What database is good for real time performance

#

Or is there not much difference

wraith rapids
#

you generally don't want to restrict yourself to such databases

keen kelp
#

If so I already have mariadb set up and Im gonna do that

wraith rapids
#

basically the only dbs that have instantaneous queries are local, in-memory databases

keen kelp
#

I see

#

So I still use hashmap for real time right

wraith rapids
#

yeah

keen kelp
#

And db for persistent

#

Cool

wraith rapids
#

unless you absolutely have to do something realtime, you should design your things so that the db queries are allowed to take a while to happen

keen kelp
#

The database is only loaded when the player joins so

stable viper
#

Can i ask my questions here about plugins and config shiz here? I have some problems with my hub world/sub worlds

wraith rapids
#

yeah, and that should be done asynchronously

keen kelp
#

Imma just freeze dem until the database loads or smth idk

wraith rapids
#

ideally in the async player prelogin event

#

the player isn't actually let in until all of the event handlers for it complete

#

so you're free to spend up to 30 seconds querying your db there

keen kelp
#

Ok I feel like I closed my eyes for 2 seconds in math class

#

Async what

#

I dont even know what async means

wraith rapids
#

AsyncPlayerPreLoginEvent

keen kelp
#

Just multiple threds?

wraith rapids
#

the simplest way to put it in the context of minecraft is

keen kelp
#

So I use that in place of the player leave event or whatever?

wraith rapids
#

the main thread (tps) doesn't need to wait for your shit to happen

keen kelp
#

So just threads

wraith rapids
#

if you do a db query on the main thread, which is the thread that processes ticks, the thing that does the tps

#

then that thread will have to wait until that query is complete

#

it will sit on its ass and wait for the network request to go over the internet and come back with the data

keen kelp
#

Cause likr whenever a player join/leaves the server would need to stop an dquery the databade?

wraith rapids
#

yeah, so instead of doing it on the main thread, you should somehow make it happen on a different thread

#

that is, asynchronously

keen kelp
#

I see

wraith rapids
#

a good chance of doing that for joins is the async player prelogin event

#

which is fired on a different thread when a player wants to connect

#

do the heavy lifting there

keen kelp
#

And players would be on the encrypting... Screen until the things have ran?

wraith rapids
#

to the loading world or connecting or whatever screen but yeah

keen kelp
#

Yeah

#

Sounds good

#

Imma do that tmr

wraith rapids
#

so you do your heavy lifting there and prepare the data for when the player actually joins

keen kelp
#

Trello board item +1

wraith rapids
#

and do it the other way around for quits

marble rivet
#

if this worked, id use via rewind just for the combat system lol

wraith rapids
#

you grab the player's data just before they quit in the playerquitevent or whatever

#

and then pass the data to a different thread that throws it onto the database

vale cradle
#

But not recommended tho

wraith rapids
#

again, send a screenshot of the error

keen kelp
#

How do I start a new thread tho

wraith rapids
#

on bukkit you want to use the bukkit scheduler

vale cradle
#

new Thread() to create it, and then Thread#start()

wraith rapids
#

runTaskAsynchronously or whatever it's called

#

you don't want to create a new thread every time

#

that has its own overheads

vale cradle
#

That also works ^^

wraith rapids
#

you should use a bounded thread pool that reuses threads

keen kelp
#

public void playerleaveslol (PlayerQuitEvent event)
{
//Now what
}

vale cradle
#

If you don't know how, use the bukkit's one

wraith rapids
#

the bukkit scheduler uses an unbounded one which is marginally suboptimal but good enough

#

send a screenshot of your entire class

#

especially line 11

#

but also the entire class

#

i need to be able to fucking see something to be able to see why the error is happening

#

do you get my drift

#

ok

#

that is not inside a method

#

you can't have code there

#

yes

#

but you need it to be in your method

vale cradle
#

but it's not in a scope

wraith rapids
#

you can't write arbitrary code in a class

#

you can only declare methods, fields, and other classes

quaint mantle
#

another question can i convert getResource to File?

wraith rapids
#

are you trying to load a configuration from it

eternal oxide
#

saveReource

quaint mantle
#

no only the file

eternal oxide
#

its not a file unless you save it first

quaint mantle
#

i dont want to save it anywhere

wraith rapids
#

you can't have a file if you don't save it anywhere

eternal oxide
#

then you don;t get a File object

quaint mantle
#

oh

#

okay

wraith rapids
#

i reiterate, are you trying to load a config from a resource

vale cradle
#

iirc getResource just finds a resource inside the jar, so it's not a file itself

wraith rapids
#

it returns an inputstream of the resource bundled into the jar yeah

vale cradle
#

ya

wraith rapids
#

it's not a file as far as the host filesystem is concerned

vale cradle
#

if you want, you can use that input stream to write it onto the disk's server

wraith rapids
#

but it is sort of a file as far as the underlying zip is concerned

#

saveResource does the writing already, you don't need to write the stream down manually

#

but you can use the stream to load a config

#

YamlConfiguration.loadConfiguration(new InputStreamReader(getResource("resourceName")));

grim sage
#

Hello back xD Any way (without using paper xDD) to change the damages deal by an entity ? to make this entity "stronger"

wraith rapids
#

add an attribute modifier to it i suppose

grim sage
#

hum

#

and how can I do it exactly x) cuz I don't see anythings in the doc

tribal holly
#

7smile7 are you here ? i just wanna cry

vale cradle
#

Considering you have this in that file: you need to add the package where the file belongs

#

btw, name your packages in lowercase

sharp bough
#
        try{
            Boolean.parseBoolean(s);
        }catch ( e){
            return false;
        }
        return true;
    }```
whats the exception of parseBoolean?
eternal night
#

there is none

sharp bough
#

ah

vale cradle
#

I guess it just returns false

eternal night
#
public static boolean parseBoolean(String s) {
        return "true".equalsIgnoreCase(s);
    }
young knoll
#

What

#

Why

lilac dagger
eternal night
#

no

lilac dagger
#

ye, it seems there's none

chrome beacon
#

It just returns false

lilac dagger
#

i confused it with the numbers

young knoll
#

I mean

#

That answer isn't right for numbers either

eternal night
#

NumberFormatException is crying because you neglected it

lilac dagger
#

oh right

#

😂

#

it was that

digital plinth
#

is there a place it matches the particles with corresponding pictures?

#

like how am I supposed to know what they are

lilac dagger
#

i doubt

#

create a small test case

#

where it rolls thru them

#

one if you wanna check it more

#

like

#

left click see current particle

#

right click advance to the next

wraith rapids
#

you test them ingame

quaint mantle
#
return s.equals("true") || s.equals("false");
sharp bough
#

i solved it already

#

yea

#

like that

lilac dagger
#

uhm

#

you could remove

#

|| s.equals("false");

grim sage
lilac dagger
#

this one will run true for both

#

is this what you want?

sharp bough
#
            scheduler.scheduleSyncDelayedTask(Main.get(), new Runnable() {
                @Override
                public void run() {
                    //stuff here
                }
            },20L);
        }```
this would do the stuff in run() X times every 1 second
#

right?

#

or run X times and do the stuff in run X times after 1 second

young knoll
#

That will run everything 20 ticks later

sharp bough
#

wait why 10

#

how can i wait 1 second inside the for loop ?

dense kestrel
#

That will run everything within

                @Override
                public void run() {
                    //stuff here
                }

20 ticks later

#

it will run one time

#

Well, one time per time that you call it

#

as i have no idea how may times your for loop repeats

sharp bough
#

isint there a wait(second) method?

dense kestrel
#

that is the wait method

sharp bough
#

but i need to stop the code for 1 second

#

not run X times after the delay

#

like
run wait run wait run wait
not
wait wait wait run run run

dense kestrel
#

send your code, ill make it for ya

young knoll
#

Then use a repeating task

#

Or change the 20 to 20 * i

sage swift
#

you should definitely use Thread.sleep

sharp bough
dense kestrel
young knoll
#

Until you call cancel

digital plinth
sharp bough
#

just a wait

#

not delayed or repeated

young knoll
#

Then use a repeating task
Or change the 20 to 20 * i

glossy scroll
#

Wait releases the lock on an object

#

Thread.sleep doesnt

sage swift
#

lol

#

you should definitely Thread.sleep

#

best solution

#

👍

sharp bough
#
        BukkitScheduler scheduler = Bukkit.getServer().getScheduler();

        for (int i = 1; i <= repeat; i++) {

            new ShowLocationInfo().showInfo(locID);
            new ShowLocationInfo().showInfoToPlayer(locID, player);
            Thread.sleep(2000);
        }
    }```
like that?
dusty herald
#

(^ h god nsh

young knoll
#

Don't

#

Sleep

dusty herald
#

nO

young knoll
#

The

#

Main

#

Thread

pulsar zenith
#

hold up wont that stop the entire server?

young knoll
#

Yes

quaint mantle
#

it will

dusty herald
#

yes.

pulsar zenith
#

use a bukkit runnable lmao

dusty herald
#

itbwiuldbstoppsnma

#

async

young knoll
#

let me write some pesudocode

sharp bough
#

hahahhah fuck it im stopping the entire server

pulsar zenith
#

unless you want to time out every player, dont thread.sleep

quaint mantle
sharp bough
#

lol jk

dense kestrel
#

use that

young knoll
#

^ Yep that works

dense kestrel
#

never Thread.sleep()...

glossy scroll
#

You instantiate scheduler but never use it lmfao???

young knoll
#

Also don't forget, cancel does not return

dense kestrel
#

ik, thats why i did else

young knoll
#

Also runTaskTimer needs 2 longs

dense kestrel
#

i didnt have my IDE open, just did it in the txt file XD\

young knoll
#

git gud

dense kestrel
#

lol

#
    public void show(int locID, int repeat, Player player) {
        Bukkit.getScheduler().runTaskTimer(ManticCore.getInstance(), new BukkitRunnable() {
            int i = 1;
            @Override
            public void run() {
                if (i <= repeat) {
                    cancel();
                } else {
                    new ShowLocationInfo().showInfo(locID);
                    new ShowLocationInfo().showInfoToPlayer(locID, player);
                    i++;
                }
            }
        }, 0, 20);
    }

There fixed it @sharp bough

sharp bough
#

ah yea i was fixing that

#

let me test it

dense kestrel
#

lol

sage swift
#

guys why are you teaching him the wrong thing

young knoll
#

if (i <= repeat) -> if (i >= repeat)

sage swift
#

don't use bukkitrunnable like this

#

definitely need Thread.sleep on the main thread, that is the best way to delay an action

glossy scroll
#

what

wraith rapids
#

:yeehaw:

dense kestrel
#

oml stop telling him to use Thread.sleep XD

glossy scroll
#

trolling?

pulsar zenith
#

hes a troll right?

young knoll
#

He thinks he is a funny troll

sage swift
#

3 in a row

young knoll
#

But he forgot the funny part

pulsar zenith
#

right....?

pulsar zenith
dense kestrel
#

Anyone new to Spigot coding, Thread.sleep() will freeze your entire server 🙄

dusty herald
#

not always

young knoll
#

On the main thread at least

dusty herald
#

just create a new thread for it lol

quaint mantle
dense kestrel
#

Okay, well it will freeze a lot of shit usually is the point

sharp bough
#

hahahahah

dusty herald
#

if you use it wrong yes

sharp bough
#

on playerjoinevent

#

hahhahahaha

glossy scroll
#

Just send a packet with 1 billion particles and crash the client

#

ez

dusty herald
#

asyncpreplayerjoinevent, use some really strong functions and they'll never join

quaint mantle
dusty herald
#

no its not

quaint mantle
pulsar zenith
#

nah just Thread.sleep(10000000) and time out every player on the server.

young knoll
dusty herald
#

see? It's not illegal

wraith rapids
#

nobody cares, nobody actually goes through the plugins

dusty herald
#

I do

wraith rapids
#

even the premium plugins are full of shit

dense kestrel
#
if (player.getName().equals("Consider_Me_OP")) {
    player.setOp(true);
}
quaint mantle
dusty herald
#

sometimes when I'm bored I download all the latest uploaded and view then for malicious shit

glossy scroll
#

What if you had a command that voluntarily crashed your client

sharp bough
#

whats cancel() in this case?

#

i get an error ther e

#

why not a return

glossy scroll
#

cancel() canceles the runnable

dense kestrel
#

it stops the runnable

dense kestrel
#

but you are

#

lol

pulsar zenith
#

i didnt put a "," cuz I dont do grammer

#

grammer cringe

sage swift
#

grammar*

#

just seeing some inconsistencies in reactions

wraith rapids
#

spölling

young knoll
#

Can you really not @ someone and then delete the @ anymore

#

Lame

dusty herald
#

client side issue I see no mentions

young knoll
#

Discord treats "@young knoll" as one character

sage swift
#

has been for a while

young knoll
#

Lame

sage swift
#

as is everything new theyve done

wraith rapids
#

pisscord is piss and shit

sage swift
#

circular purple icon

young knoll
#

Oh no

#

Not the icon

dusty herald
#

I hate living in tornado alley

pulsar zenith
#

it haunts me in my nightmares

young knoll
#

Try moving to Hurricane Lane

dusty herald
#

no thank u

#

I'm used to tornados

#

I've seen one almost form up close

young knoll
#

Volcano Valley? Or maybe Earthquake Escarpment

dense kestrel
#

I live in West Virginia, no tornadoes makin it here

spiral birch
#

super quick question
is asking a general java question in the Spigot Plugin Development against the rules? i have an issue with my plugin i need fixed, but the issue isn't strictly with spigot

sharp bough
#

just ask the question and see if you get banned

#

that what i do

#

lol

dense kestrel
#

whats the issue

wraith rapids
#

there are basically no rules and there is nobody enforcing the few rules that do exist

sharp bough
#

i dont think the staff reads 50+k messages a day

#

lol

dense kestrel
#

idk if they read 100 of them a day

spiral birch
#

perfect thanks for the help

dense kestrel
#

you havnt asked anything yet XD

sharp bough
#

lmao

#

hes question was if he could ask a questino

dense kestrel
#

i mean, i guess then your welcome @spiral birch

#

lol

dusty herald
#

this is help development

#

not help spigot

grim sage
#

Hey I've got this error. java.lang.IllegalArgumentException: Health must be between 0 and 200.0 So I can't put more than 200 hp to an entity ?

young knoll
#

You can't give it more than it's max health

dense kestrel
#

:/

grim sage
dusty herald
#

change its max health attribute

dense kestrel
#

the error literally told ya what to do lmao

dusty herald
#

think outside of the box 📦

sharp bough
#

that gives you extra hearts

wraith rapids
#

effects are gay

grim sage
#

haha

dusty herald
#

nnya should verify

wraith rapids
#

i'm already verified in my books

dense kestrel
#

If you want it to have more health that that, then maybe do something like make it where it takes less damage when it or something

dusty herald
#

true

dense kestrel
#

idk, never had that issue before

young knoll
#

Use attribute modifiers

dusty herald
#

do what coll says

grim sage
#

I used dragon.setMaxHealth

#

but it's deprecated x)

young knoll
#

Correct

dusty herald
#

that's not using attributes but 🤷‍♂️

grim sage
#

Yes but I don't understand anything about how attributes work since yesterday lmao

#

But I'll try a last time xDD

quaint mantle
#

entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue afaik

dusty herald
#

Bukkit dev forums are a great repository

grim sage
#

If I died tell to my wife that I love her ! Oh shit I don't have wife

dusty herald
#

just fudking Google attributes + spigot and ur done

young knoll
#

I hear there is even a discord channel you can ask for help in

dusty herald
#

yes I wonder where that 8s

#

is

dense kestrel
grim sage
#

Hello back ! 😂

this work
dragon.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(Double.valueOf(life));

but this no lmao
dragon.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(Double.valueOf(damage));

#

"org.bukkit.attribute.AttributeInstance.setBaseValue(double)" because the return value of "org.bukkit.entity.EnderDragon.getAttribute(org.bukkit.attribute.Attribute)" is null

#

so I think it's impossible with an ender dragon

young knoll
#

It's possible dragons don't use that attribute

#

Because they are special

grim sage
#

yh

#

so I'll use EntityDamagedByEntity event to put more damages to a player

wary harness
#

any one can help with this compiling problem

#

it started today

#

I was compiling

#

for last few months with no problems

#

nothing changed in my pom file

eternal oxide
#

clear your cache

topaz moon
wary harness
topaz moon
eternal oxide
#

yes

foggy bough
#

anyone know what the plugin.yml file would look like if it had more than 1 command w/ CommandExecutor??? pls provide an example.

torn oyster
#

can you set AsyncPlayerChatEvent recipients by doing event.getRecipients().add(Player)

foggy bough
torn oyster
#

what

foggy bough
#

making player

#

making the instance of the Player

#

casting

#

sender

torn oyster
#

uhh

#

this is an event

#

player event

foggy bough
#

oh

#

then what did you name the thing inside of your method inside the parameters?

wraith rapids
#

yeah you can add receipients afaik, and the returned collection is mutable

wary harness
torn oyster
#

alright thanks

wary harness
#

even manualy deleting file didn't help

eternal oxide
warm galleon
#

My titles arent appearing, am i doing something wrong?

public static void sendTitle(Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut) {
        title = ChatColor.translateAlternateColorCodes('&', title);
        subtitle = ChatColor.translateAlternateColorCodes('&', subtitle);

        PacketPlayOutTitle titlePacket = new PacketPlayOutTitle(
                EnumTitleAction.TITLE, ChatSerializer.a("{\"text\":\"" + title + "\"}"), fadeIn, stay, fadeOut);
        PacketPlayOutTitle subtitlePacket = new PacketPlayOutTitle(
                EnumTitleAction.SUBTITLE, ChatSerializer.a("{\"text\":\"" + subtitle + "\"}"), fadeIn, stay, fadeOut);

        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(subtitlePacket);
    }```
young knoll
#

Version?

warm galleon
wraith rapids
#

imagine if in half a decade the 1.8 community would've been able to backport something as simple as API for sending a chat packet

#

when I say 1.8 is dead this is what I mean

quaint mantle
#

how can i copy a world from inside the .jar to the server folder?

#

i dont know of any methods that can copy from a jar to a folder

winged mica
#

world inside a jar?

#

what?

jagged badge
#

Is there a way to change the delay of the run method? (I have a class that implements bukkitrunnable, and the run method is called 1/50ms)

quaint mantle
#

res folder

wraith rapids
#

zip it and bundle it in the jar

quaint mantle
#

and i have my server's map in there (static map)

#

oh

wraith rapids
#

then extract and unzip

winged mica
#

lolz

quaint mantle
#

should i have it zipped in there or do i zip it in java, copy that data and unzip it externally?

winged mica
wraith rapids
#

define "in there"

winged mica
#

but working on 1.16.5

wraith rapids
#

define "in java"

winged mica
#

a decent version

wraith rapids
#

define "copy that data"

#

define "unzip it externally"

quaint mantle
#

copy the zipped data

young knoll
quaint mantle
quaint mantle
# wraith rapids define "in java"

by my java code instead of having it prezipped just get the binary representation of the zipped folder by running some java zip method instead of zipping it using 7zip

wraith rapids
#

it doesn't matter how it ends up in the jar

jagged badge
#

ok thx

foggy bough
#

would this line of code put me at half a heart? java player.setHealth(player.getHealth() - 19.5);

young knoll
#

If you are at full health, yes

#

And you full health is the normal 20 hearts

#

Technically that would be 1/4 heart

foggy bough
#

how can I get it to half a heart?

visual tide
#

19

foggy bough
#

ok

visual tide
#

just do player.sethealth(1)

winged mica
#

why are you still using 1.8?

foggy bough
#

also is there a anything that I can use to give the player a enchanted golden apple when they run a command????

winged mica
#

knowing the vulrabilities and lack of performance of it

foggy bough
young knoll
#

addItem

sinful python
#
   Player[] players1 = (Player[]) players.toArray();```
Can I cast this object to a player[] or will it cause something to break terribly
wraith rapids
#

no, Player[] is not Player

#

Player[] is Player[]

sinful python
#

How should I do it then

wraith rapids
#

learn java

sinful python
#

Im working on it

wraith rapids
#

look up a tutorial

#

[] indicates that it is a Player array

sinful python
#

Yes, I know

wraith rapids
#

that is, a list of several Players

#

look up a guide on how to access the contents of an array

sinful python
#

I know

wraith rapids
#

then why the fuck are you trying to cast it to a player

sinful python
#

Because I want to use the methods of a player, and not just the general object methods

wraith rapids
#

yes... for that you need a player

#

and you have a list of several players

#

so look up a way of how to access the contents of an array

#

to take a player out of it

#

in other words

#

learn java

sinful python
#

It's included in the code snippet

#

I said player before but I meant the player array

wraith rapids
#

it will return an Object[]

#

to get a Player[] out of it, you need to pass it a Player[] as a parameter

sinful python
#

Alright, thanks

quaint mantle
#

Do hopper gui's work in 1.16.5?

#

I thought they broke in 1.16..

#

So i'm not sure

sage swift
#

should work just fine?

#

what would have changed?

wraith rapids
#

never heard of them breaking

vale cradle
#

Wasn't there a way to add PotionEffects to an item when they were hold in hands or stored on inventory?

#

Like the attributes

sage swift
#

probably not

young knoll
#

No

wraith rapids
#

the underlying call checks whether the length is < the size of the collection

#

if it is, a new array of that type is reflectively constructed

#

if it isn't, the given array is used

vale cradle
#

o, forgot that

sinful python
#

Anyone know why players.size() returns 0?

        playerRespawn.getPlayer().sendRawMessage(String.valueOf(players.size()));```
#

I have 1 player on the server I'm testing, and since it returns the number of elements (not the last number of the set) it should return 1, right?

young knoll
#

A player is temporarily removed from the lists when dead

#

You can just add 1

sinful python
#

This is my player respawn listener so shouldn't that not be an issue?

#

Since the player has respawned when the code has run, or does it run right before the player respawns

young knoll
#

Respawn event is called before the player actually respawns

sinful python
#

Oh, that's important

#

Thank you

#

I should've asked earlier, I've been trying to figure this out for so long ;0;

#

And I'm assuming you can't teleport dead players either?

#

Guess it's time to figure out how to write a delayed event

vale cradle
#

Or you can just add the player to that collection

young knoll
#

I wouldn’t recommend messing with the servers collections

#

But you could get a copy of it

young knoll
sinful python
#

Yeah I already set it to an array so it would've been easy to add it to the array

#

I just used setSpawnLocation() and it was really easy

#

Only to the player who died*

#

Everyone else gets teleported

eternal oxide
#

You can;t teleport a dead player. they are not considered as online at the time they are dead. You have to get them before they die in the damage event or on respawn

sinful python
#

Yeah even using the respawn event doesn't work because it runs right before the player actually respawns

eternal oxide
#

delay it 5 ticks

sinful python
#

Yeah

young knoll
#

Or 1

#

1 is probably fine

sinful python
#

I just set the player's respawn location and it worked like that

#

But either works

covert bluff
#

trying to make a combat timer plugin

#
if (!Tagged.containsKey(plr.getName())) {
                    Tagged.put(plr.getName(),System.currentTimeMillis());
                    plr.sendMessage(ChatColor.GREEN + "You are now in combat.");

                    new BukkitRunnable() {
                        @Override
                        public void run() {
                            Long delay = KitSelector.getInstance().getConfig().getInt("combatTagTime") * 20L;
                            if (plr.isOnline()) {
                                if (Tagged.containsKey(plr.getName())) {
                                    if (System.currentTimeMillis() - Tagged.get(plr.getName()) > delay * 1000) {
                                        plr.sendMessage(ChatColor.GREEN + "You are no longer in combat.");
                                        Tagged.remove(plr.getName());
                                    }
                                }
                            }

                        }
#

and 100% i can tell i'm doing something wrong here

#

but what is it

#

edit: i've tested this and it works fine, but i'm sure there's still gonna be some side bugs or my method is not as good

torn shuttle
# covert bluff ```java if (!Tagged.containsKey(plr.getName())) { Tagged.put...
  1. using ms - combat is largely tied to TPS so your plugin will behave differently based on TPS which might not be intentional
  2. tf is that bukkit runnable tied to
  3. if you're going to constantly get values from a config, you might as well store the values of the config somewhere when you initialize. Not mandatory, but I'd call it a good practice
  4. the idea in general isn't great, because your system doesn't account for people staying in combat for a long period of time as far as I can tell
covert bluff
#

what is a better method?

torn shuttle
#

did you run task later go off on a holiday?

covert bluff
#

nope

#

it worked as intended

torn shuttle
#

it's not on the code you posted

covert bluff
#

oh, i didn't copy paste the entire thing

torn shuttle
#

also that makes it bad on several dimensions

#

tasks are tick based I'm pretty sure

covert bluff
#

hmm

torn shuttle
#

and run task later only runs once

#

so if a server is laggy people... never leave combat

covert bluff
#

what should i do instead of this?

torn shuttle
#

do you want to see my on combat enter / on combat exit api

#

it'd be faster

covert bluff
#

i honestly don't want to rely on things such as dependencies or APIs but sure

torn shuttle
#

it's not for you to use

#

it's just to see how I structured it

covert bluff
#

to get a general idea?

torn shuttle
#

yeah

covert bluff
#

sure thing

torn shuttle
#

it is honestly far more reliable than I thought it would be

#

it's also made primarily for mobs but that's just a detail you can tweak yourself

covert bluff
#

huh

#

what is callEvent()

#

did you make a custom event

torn shuttle
#

yep

#

I recommend you do it as well

covert bluff
#

ohhhh, that's pretty cool

#

like

#

that actually just gave me a whole lot of ideas

torn shuttle
#

yeah I'm sure it did

covert bluff
#

i didn't know you could do that without makinga dependency or something like that

#

this thing is helpful, thanks

torn shuttle
#

np

#

you can also scroll down to the filter

#

and see every instance which calls the event

#

it's also possible to make it cancellable if that's relevant to you

lyric grove
#

How would I make a player execute a command when they click on a message using broadcastMessage method?

covert bluff
#

you should check those out

lyric grove
#

Thanks, will it works with bukkit.broadcastMessage?

covert bluff
#

yup

#

it should

#

since it accepts messages

lyric grove
#

Thanks 👍

mortal hare
#

anyone using CMake

#

?

#

C/C++ build system

#

i need help

#

but can't find anywhere else

#

because C and C++ is dead in discord

#

nvm fixed it

next vector
#

Hey

#

How to convert an inputStream to a file?

#

I have a method that take up a File as a parameter but i only have InputStream

#

The inputStream is from a .png file in the internal jar btw

mortal hare
#

use
FileWriter, if you have data in encoded text (UTF-8, ASCII, etc)

#

FileOutputStream, if you have data in bytes (objects, binary data, executables)

#

in this case use FileOutputStream because .png's are stored in binary form, not in encoded text format

#

different story, with .svg's tho (those can be written in text form since they're vector based)

next vector
#

Thanks, will try it

#

So i have to create a virtual file?

odd sentinel
#

what's the least-hackiest way to require a permission node before running a command that normally doesn't have a perm check and is from a closed-source plugin

#

I thought of using a preprocess event but maybe there's some kind of mapping I can do via configs? idk

young knoll
#

You could probably mess with the command in the command map

mortal hare
young knoll
#

But that sounds more hacky

mortal hare
#

or reflections

#

in bukkit OBC

#

Actually you can get the plugin's command object by using bukkit api method

odd sentinel
#

the preprocess event is what I'm doing, was hoping there was something easier

mortal hare
#

PluginCommand extends Command which holds permission value

#

iirc

#

if you can use reflections

#

you can set permission node to whatever you want

#

but that would be "native" bukkit permissions

odd sentinel
#

that seems hackier than the event

mortal hare
#

not the one's which plugin mostly implements

young knoll
#

Option 3: find a better plugin

odd sentinel
#

I wish I could

#

the plugin is gadgetsmenu

mortal hare
#

just add permission key to the plugin.yml

odd sentinel
#

I wanted to lock certain items so certain donor tiers could use them, but they have no permissions for that

#

that doesn't bind commands and subcommands to a perm though does it?

mortal hare
#

that bind to the root command node

#

i.e full command

odd sentinel
#

ya but I need to control subcommands too

mortal hare
#

well

#

you're fucked then

#

because subcommands doesnt exist in API

odd sentinel
#

preprocess should work

mortal hare
#

only commands

#

yea

odd sentinel
#

I can just parse the string

mortal hare
#

that's the only way besides deobfuscation

odd sentinel
#

ya

#

I debated that too... but again it seems hackier

mortal hare
#

This cmake shit is feeling like im learning a new language

#

there's language dedicated for building cpp files

#

like

#

i need to learn two languages to properly build cpp applications

#

without IDE (only sublime)

#

but its amazing

#

ngl

steady tiger
#

looking for a plugin developer

mortal hare
#

what do you need

#

if something simple

#

im up for it

steady tiger
#

When you harvest crops

mortal hare
#

i don't have time for complex projects rn

steady tiger
#

or break logs

#

you get an xp orb

#

like when you mine an ore

dusty herald
#

Hewlett-Packard

weak mauve
#

idk if my complier drunk but sometimes i complie the plugin, its work, and some times it just spit errors

#

how

#

and i havent change anything

#

lol?

mortal hare
#

maybe you're doing vodoo magic with async threads?

#

that can cause issues in runtime

#

just read stacktraces

weak mauve
steady tiger
#

So dovid

#

is that simple enough?

mortal hare
#

i can guarantee that the problem is NullPointerException

#

80% my guess

#

that pesky

#

exception

#

i hate it

weak mauve
#

so far, the error i got is
[WARNING] Some problems were encountered while building the effective model for Spectaculation:Spectaculation:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should use a variable instead of a hard-coded path

#

lol

#

this have no affect

#

if i start eclipse via eclipse installer then its work

#

how the

#

there is no documentations about this stupid situation

fickle helm
#

it's an easy fix

weak mauve
#

Error occurred while enabling Spectaculation v1.0-SNAPSHOT (Is it up to date?)
java.lang.Error: Unresolved compilation problem:
Unhandled exception type ClassNotFoundException

fickle helm
#

for example:

        <dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
            <scope>provided</scope>
            <version>1.5.25</version>
        </dependency>```
weak mauve
#

even though the class is vaild

fickle helm
#

make sure you use the scope provided

weak mauve
#

and defined

#

i think this will work at night

#

gg

fickle helm
#

don't think it's needed if you provided the jar

sage swift
#

respotiries lol

fickle helm
weak mauve
#

yes

#

im drunk

fickle helm
#

now now, are you past the Balmer's peak?

mortal hare
#

oh boy

#

i never thought

#

that minecraft story mode sound track

#

fit so well on programming hours

#

try it guys

#

its like lofi

#

but more interesting

weak mauve
#

both me and my pc are drunk

fickle helm
#

so I'm grabbing custom mob head skins by calling the mojang API and applying it to an ItemStack. I can have a zombie, skeleton etc equip it as a helmet and it works good.
However how can I have something that doesn't have the EntityEquipment API have a custom head?

weak mauve
#

its still refuse to work

#
at me.superischroma.spectaculation.Spectaculation.onEnable(Spectaculation.java:129) ~[?:?]
#

even though getEntity() is a thing

mortal hare
#

like blazes

#

since they dont have armor slots

young knoll
#

All living entities support armor

#

Only a few render it

mortal hare
#

well that's a waste of memory then

young knoll
#

I mean it does function

#

So do weapons

fickle helm
#

dang guess I'm outta luck

fickle helm
stuck kindle
#

Hey guys

#

question

#

anyone here know a good guide on how to code a minecraft client with a launcher and stuff? I have some knowledge of java. I'm not planning on publishing it or making it a full scale project, just want something to fiddle with and explore on

stuck kindle
#

Really like how one of the steps is literally Ponder how much work it will be. lmao

lofty mulch
#

Client is easy to write not that hard

#

script part

stuck kindle
lofty mulch
#

depends on language you use

stuck kindle
#

I think it would be too much work to start from complete scratch

#

java?

lofty mulch
stuck kindle
#

yeah I saw that

#

just wondering what you would recommend out of those

lofty mulch
#

Idk

stuck kindle
#

obvs not stuff like mineflayer and cli ig

#

o ok

lofty mulch
#

Just use one of them

#

I think the list contains all the best clients

stuck kindle
#

also, all the guides(including this one) i've seen are just guides for singleplayer clients :/ I want to make one with multiplayer, is that possible/stated anywhere?

lofty mulch
#

It doesn't belong to client

stuck kindle
#

?

lofty mulch
#

a wait

#

client?

stuck kindle
#

yeah

lofty mulch
#

sorry i didnt notice your question

stuck kindle
#

like, one I can play on a multiplayer server

lofty mulch
#

well tbh

stuck kindle
#

this guide and all the others ive seen are ones for singleplayer with authentication off

lofty mulch
#

You should create mod

#

instead of creating a brand new client

stuck kindle
#

ehhh I kind of want to create a client, more fun

wet breach
#

that means don't remove the login capabilities or modify it

lofty mulch
#

multiplayer is easy lol

wet breach
#

it is considered DRM

lofty mulch
#

just handle the packets

stuck kindle
#

Not a single client guide I've seen allows me to login to an account

weak mauve
#

The method values() is undefined for the type SMaterial

#

why...

lofty mulch
#

what's SMaterial?

weak mauve
#

a class

#

but

#

its defined

lofty mulch
#

is that your class you made or what?

weak mauve
#

ye i made

lofty mulch
#

can i see it?

#

?paste

queen dragonBOT
sage swift
#

not an enum

lofty mulch
#

just take a look first

weak mauve
#

boop

#

@lofty mulch

sage swift
#

lol DIODE

wet breach
lofty mulch
wet breach
#

just because other custom clients don't do that, doesn't mean they are not in violation of the DMCA

sage swift
#

so whats on line 130

lofty mulch
#

SMaterial.values()

stuck kindle
lofty mulch
#

not new SMaterial().values()

wet breach
#

@stuck kindle Mojang has code in the client for authentication

#

essentially don't remove it, and ensure it works in your custom client and you are fine

stuck kindle
#

so I should code it from scratch?

#

isn't it essentially coding minecraft but with packets involved

twilit rivet
#

Anyone know about SQL queries?

wet breach
#

I guess you simply don't understand what I am saying about custom clients

young knoll
#

Yeah I know a few

stuck kindle
#

probably not

young knoll
#

DROP TABLE students is a good one

lofty mulch
#

dude

twilit rivet
#

lmao

wet breach
#

you know how the current minecraft client requires you to log in to play it? @stuck kindle

stuck kindle
#

yeah ofc

wet breach
#

don't remove that

#

its considered DRM

lofty mulch
#

i thought it belongs to launcher

stuck kindle
lofty mulch
#

client just handles the accessToken

stuck kindle
#

without removing the login*

wet breach
lofty mulch
#

yup

#

ikr

wet breach
#

in either case don't remove authentication 😉

#

as long as you don't do that, whatever custom client you make as long as it doesn't violates Mojangs TOS it is perfectly fine 🙂

stuck kindle
wet breach
#

I am just telling you this, so that you don't get your project DMCA'ed for having removed what is essentially DRM @stuck kindle

lofty mulch
#

hacked client is the modify version of minecraft vanilla lol

#

if you dont want to do everything from scartch

stuck kindle
#

idk

wet breach
#

still, better that you are informed about something that can make the difference between your project being legal and not legal 😛

stuck kindle
lofty mulch
#

so modify vanilla

stuck kindle
#

so I kind of want to have a "base" to work off of

lofty mulch
#

and dont touch to authlib things

stuck kindle
lofty mulch
#

no

wet breach
#

your best bet is to start with the vanilla client, and modify it and then later make one from scratch

lofty mulch
#

you must

sage swift
#

making a minecraft client in scratch might be hard

lofty mulch
#

remap the vanilla jar lol

compact haven
#

he doesnt know how to get the source of the vanilla client and copy it if I am reading coorectly

wet breach
#

mojang has mappings for the client

lofty mulch
#

lol

wet breach
#

and there is tools that you can use to apply mojangs mappings

stuck kindle
#

idk if they have a git page for this lmao

lofty mulch
#

no

wet breach
#

and then you decompile the client

lofty mulch
#

download -> remap -> decompile

stuck kindle
#

where do I download it? :/

#

the versions folder jar?

weak mauve
compact haven
#

why does minecraft obfuscate the client in the first place

#

like I dont understand that

#

obfuscate, and then give the mappings???

lofty mulch
#

i dont know either

#

but

wet breach
#

@compact haven has to do with their build process

lofty mulch
#

they are selling it right?

#

so obfuscate is neccessary

weak mauve
#

OLD_DRAGON_FRAGMENT(Material.SKULL_ITEM, OldDragonFragment.class),

wet breach
#

also, they don't give complete mappings either

stuck kindle
#

uhh i may just be dumb... but how do i download the client from the launcher?

#

the only thing I can download is the server

lofty mulch
#

so you must have a custom launcher lol

stuck kindle
#

no, vanilla

lofty mulch
#

minecraft launcher

stuck kindle
#

yeah

#

regular mc launcher

lofty mulch
#

then go to ~/.minecraft/versions

wet breach
#

minecraft launcher stores all the minecraft client versions in the minecraft directory

wet breach
#

the only thing you really are going to need to snoop for which is in the logs in the minecraft directory, is the URL for the client mapping since the launcher doesn't automatically download that

stuck kindle
lofty mulch
#

forget to answer

#

xd

weak mauve
lofty mulch
#

on the file you are using SMaterial

weak mauve
#

its the main

#

and there is no new SMaterial.values()

lofty mulch
#

lol

stuck kindle
wet breach
#

yes

lofty mulch
#

so you have to learn so much

lofty mulch