#help-development

1 messages ยท Page 1666 of 1

chrome beacon
#

I'd assume so? I have no idea

jade perch
#

I don't see how System.exit is slow for you

narrow furnace
#

yea

#

exactly how slow is slow

#

like how long does it take

gaunt saffron
#

it tells me to chnage language level? what does that even mean

jade perch
#

if your goal is to stop the world from saving

#

there is a way to do that

#

instead of doing it this degenerate way

narrow furnace
#

^ without destroying your server

gaunt saffron
#

no

#

my goal is stop the server asap

jade perch
#

then System.exit

#

it's not complicated

gaunt saffron
#

it's slow

narrow furnace
#

what does that mean

gaunt saffron
#

it saves some crap for like 2s

gaunt saffron
paper viper
#

I mean, if you really wanna get faster than that you could use JNI

#

lol

gaunt saffron
#

JNI?

jade perch
#

Disable the saving and call System.exit ๐Ÿ’ฏ

paper viper
#

Java Native Interface

gaunt saffron
#

ProcessHandle.current().destroyForcibly();
this does not wanna work...

paper viper
#

allows you to run C/C++ code so you can mess with internals

#

and fuck a ton of shit up

#

including shut the server down quick

#

cause its a direct call

gaunt saffron
#

well, i was thinking todo api call and remove the server

#

but that's too hard to scale... im not that good

jade perch
#

idk i'm sure your vps has an api to let you hard reset the server in some way

quaint mantle
gaunt saffron
quaint mantle
gaunt saffron
vast sapphire
#

how would I create a new file for each player with a kill counter?

gaunt saffron
narrow furnace
#

what just a bunch of files that only have 1 number in them

vivid lily
narrow furnace
#

surely just have one file

vast sapphire
vivid lily
#

No, multiple files would ๐Ÿ˜†

narrow furnace
#

uh wouldnt multiple files lag it more

paper viper
#

multiple files = more IO access needed

dusk flicker
#

or just use a DB

jade perch
vast sapphire
#

maybe, I was looking at how minecraft worlds save every uuid to a seperate file with data

dusk flicker
#

they store a lot of data tho, not just 1 number

vast sapphire
#

I usually have 2700 people

gaunt saffron
dusk flicker
#

If you are gonna have that many people use a db

narrow furnace
#

2700 files

#

is a lot of files

vast sapphire
#

yeah

dusk flicker
#

110% use a database

vast sapphire
#

I don't have one

paper viper
vivid lily
#

Minecraft stores lots of data in one file. And do NOT create a file for each. Also try to configure a database for it if you plan to have that many players.

dusk flicker
#

dear lord are you running a server with 2700 players and not using a database you are screwing up

gaunt saffron
vast sapphire
#

I get 20 players

paper viper
#

F

jade perch
#

bruh

vast sapphire
#

bc that is my max plan

dusk flicker
#

still could be useful

jade perch
#

Why would you word it like that to us

vast sapphire
#

2700 unique joins will still create those files

paper viper
#

but the performance

jade perch
#

there is a difference between "I usually have 2700 people"

#

and 2700 unique joins

dusk flicker
#

very different

vast sapphire
#

maybe

paper viper
#

with 2700 you have to focus on optimizations more

dusk flicker
#

still a db would be useful

narrow furnace
#

what did you mean by usually?

alpine urchin
#

How to improve the performance of your plugin

jade perch
#

dbs are always useful anyway

vivid lily
# vast sapphire I get 20 players

I would still recommend a database for storing any data. I mean on the plus side if you use one file and it gets corrupted all that info gone. Or if you transfer the server the database still stores that info.

dusk flicker
#

DBs are very very good for what it can do

gaunt saffron
quaint mantle
#

lol

dusk flicker
#

Lmao

quaint mantle
#

legit just stops the program

#

its god

dusk flicker
#

threads are nice

quaint mantle
#

very!

#

now people dont have to bump so much

dusk flicker
#

Yea

vivid lily
gaunt saffron
#
                    Bukkit.getScheduler().runTaskLater(MyEvents.this.plugin, () -> {

                        ByteArrayDataOutput out = ByteStreams.newDataOutput();
                        out.writeUTF("Connect");
                        out.writeUTF("survival");

                        for (Player onlinePlayers : Bukkit.getOnlinePlayers()) {
                            player.sendPluginMessage( MyEvents.this.plugin, "BungeeCord", out.toByteArray());
                        }

will this kick everyone off the node?

dusk flicker
#

no that will send a plugin message

paper viper
#

what is out

#

and yea that too

gaunt saffron
#

for every player?

dusk flicker
#

that will connect everyone to survival

gaunt saffron
#

perfect

#

kick everyone, yeet the server = infinite scaling

tardy delta
#

is there no shorter way?

public static String millisToHumanReadable(long millis) {
        long days = TimeUnit.MILLISECONDS.toDays(millis);
        long hours = TimeUnit.MILLISECONDS.toHours(millis) % 24;
        long minutes = TimeUnit.MILLISECONDS.toMinutes(millis) % 60;
        long seconds = TimeUnit.MILLISECONDS.toSeconds(millis) % 60;
        String str = days > 0 ? days + " days " : "";
        if (hours > 0) str += hours + " hours ";
        if (minutes > 0) str += minutes + " minutes ";
        if (seconds > 0) str += seconds + " seconds ";
        return str;
    }
vast sapphire
paper viper
#

or whatever its called

lean gull
#

hi im back

narrow furnace
#

hi back im bing

vivid lily
lean gull
#

rimshot

#

anyways i got a new problem

tardy delta
#

lemme search

dusk flicker
#

?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.

eternal oxide
#

I should get ready on the ?learnjava ๐Ÿ™‚

tardy delta
earnest lark
#

Bukkit.getServer().getWorld("").dropItemNaturally(new item, e); how can i set the world to the players world beacuse p.getworld does not work and i cannot make it into a world string

narrow furnace
#

i know ๐Ÿ˜

dusk flicker
#

p.getWorld().dropItemNaturally(...)

vivid lily
#

?learndatabases

#

DAMNIT

lean gull
#

how do i do hoverable chat message? i looked on google and it says i need to use TextComponent but for some reason i can't import it, i also found something called "The Chat Component API" which says it uses bungeecord chat api

so my question is: how do i do a hoverable message, do i need to install bungeecord and chat component api if they're even a thing that is installable or they're apart of the spigot api

tardy delta
lean gull
#

well techincally it's 2 questions

dusk flicker
#

the chat api is apart of the spigot api

earnest lark
dusk flicker
#

You should be able to implement it

lean gull
#

got it, now how does one use it?

dusk flicker
lean gull
#

also imma unblock everyone and just kinda deal with their annoying ?learnjava

tardy delta
#

i made somehing like this ๐Ÿ˜ผ

public static TextComponent suggestCommandByClickableText(String message, String command) {
        TextComponent textComponent = new TextComponent(colorize(message));
        textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command));
        textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click to run command")));
        return textComponent;
    }
lean gull
#

cause they might actually be helpful

earnest lark
#

how would i put a item into a players inventory in any avalible slot

dusk flicker
#

Inventory#addItem exists iirc

tardy delta
#

inv.setItem(inv.firstEmpty, item)

#

idk

earnest lark
#

kk

tardy delta
#

i should use additem

eternal oxide
#

and test the return

lean gull
#

it seems that i can't use BaseComponent, TranslatableComponent and as i said TextComponent too

#

do i need to extend or implment anything?

gaunt saffron
#

im so bad at this...

                else if ( number_of_players_left <= 1) {
                    System.out.println("game ended !");
                    Bukkit.broadcastMessage(ChatColor.RED + "" + ChatColor.BOLD + "" + "GAME ENDED - RETURNING TO BUNGEE");

                    Bukkit.getScheduler().runTaskLater(MyEvents.this.plugin, () -> {


                        for (Player onlinePlayers : Bukkit.getOnlinePlayers()) {
                            ByteArrayDataOutput out = ByteStreams.newDataOutput();
                            out.writeUTF("Connect");
                            out.writeUTF("survival");
                            player.sendPluginMessage( MyEvents.this.plugin, "BungeeCord", out.toByteArray());
                        }




//                        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "stop");
                    }, 100);

                    // YEET
                    Runtime.getRuntime().halt(0);
                }

            }

the server halts before everyone gets moved...

eternal oxide
gaunt saffron
#

it already is?

#

like 100 ticks

eternal oxide
#

you have to give it time to empty its buffer

paper viper
#

the Runtime.getRuntime

#

that one

eternal oxide
#

no you are schedulign the packets. You are not scheduling the shutdown

paper viper
#

Yea so you need to make the Runtime.getRuntime delay longer

gaunt saffron
#

huh?

paper viper
#

so it has time for the players to be sent

gaunt saffron
#

oh..

eternal oxide
#

You need to schedule it again. not in the same runnable

paper viper
#

^

earnest lark
#

p.getInventory().setItem(p.getInventory().firstEmpty(), ItemStack item); why does this not work

chrome beacon
#

"not work"

eternal oxide
dusk flicker
#

use #addItem

gaunt saffron
eternal oxide
#

and check the returned map is empty

earnest lark
chrome beacon
eternal oxide
#

so a schedule inside your schedule

earnest lark
chrome beacon
#

It needs to be an instance you can't put a class like that

gaunt saffron
#

oh..

#

okay lemme try

chrome beacon
earnest lark
#

ik

chrome beacon
#

So make it one

paper viper
#

also why are you scheduling the actual send players part

earnest lark
#

how would i make it a itemstack

paper viper
#

couldnt you just leave that to the main thread

narrow furnace
#

new ItemStack(Material)

paper viper
#

and schedule the Runtime part

cold field
#

Guys I was wondering. Does the server create a thread for every player connection or it has loop that iterate over a pool of connections?

earnest lark
#

ok i got it

eternal oxide
#

Yep, just do all the sending on teh main thread. only schedule the shutdown

#

as you are killing the server anyway, no need to worry about lag

gaunt saffron
# eternal oxide do exactly as you are doing, just wrap the stop inside another schedule
                else if ( number_of_players_left <= 1) {
                    System.out.println("game ended !");
                    Bukkit.broadcastMessage(ChatColor.RED + "" + ChatColor.BOLD + "" + "GAME ENDED - RETURNING TO BUNGEE");

                    Bukkit.getScheduler().runTaskLater(MyEvents.this.plugin, () -> {


                        for (Player onlinePlayers : Bukkit.getOnlinePlayers()) {
                            ByteArrayDataOutput out = ByteStreams.newDataOutput();
                            out.writeUTF("Connect");
                            out.writeUTF("survival");
                            player.sendPluginMessage( MyEvents.this.plugin, "BungeeCord", out.toByteArray());
                        }




                //     Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "stop");
                    }, 100);

                    Bukkit.getScheduler().runTaskLater(MyEvents.this.plugin, () -> {
                        // YEET
                        Runtime.getRuntime().halt(0);
                    }, 100);

                }

still same issue?

earnest lark
#

how would i setthe value for a p.getinventory.additem

#

?paste

undone axleBOT
paper viper
#

the one where you send the plugin message

#

its unnecessary

eternal oxide
gaunt saffron
#

i want like 100 ticks for people to realise game is over

eternal oxide
#

ok then two runnables, one inside the other is correct

gaunt saffron
#

so what's wrong?

eternal oxide
#

What doesn;t it do?

gaunt saffron
#

it stops the server, does not kick me

paper viper
#

Make the delay of the second one longer

gaunt saffron
#

okay i guess

paper viper
#

dont make them both 100

#

lol

gaunt saffron
#

why not?

paper viper
#

You realize that its being ran async

#

After the first schedualer is ran, it schedules for the next 100 ticks

earnest lark
#

how do i set the vaulue of a .additem

paper viper
#

then it continues on the main thread directly

#

finds the next one, schedules for the next 100 ticks

#

you end up with a 0 tick difference (or something very small)

eternal oxide
#

he's using runTaskLater so its sync

gaunt saffron
#

oh

#

i did 100 and 200 lemme try..

paper viper
#

i meant sync

gaunt saffron
#

i wish i could wait will it's done..

paper viper
#

but same idea applies

paper viper
eternal oxide
#

his second task will not be scheduled until the first task has run

quaint mantle
#

When I using /say test
Displaying: "[Server] test"

How can I change the [Server]?

paper viper
gaunt saffron
eternal oxide
#

Play with teh length of the second timing to see what works

#

100 for the first is fine

#

experiment and see what the minimum you need it

gaunt saffron
#

could you just help with waitng till it's done?

#

since that would save most time tbh

eternal oxide
#

There is no way to know when all teh packets have been sent

gaunt saffron
#

trying 100 and 200ticks now

eternal oxide
#

as player is using a queue backed channel

gaunt saffron
#

okay 100 and 200 works, problem is, i have no idea how it will handle 10-20? players

eternal oxide
#

good question

#

you will have to test and see.

tardy delta
#

is this possible?

DateFormat df = new SimpleDateFormat("dd hh mm ss");
earnest lark
#

how do i change the vaulue of a .additem

ivory sleet
#

elaborate

earnest lark
#

p.getinventory.additem(new ItemStack(item)).setvaulue(e);

#

would what i want it to be

#

but i cant do that

eternal oxide
#

you can;t chain that

earnest lark
#

yea

eternal oxide
#

add item returns a map of anything that didn;t fit

earnest lark
#

but i d0ont know how to get the slot it was put in

#

to set the vaulue

ivory sleet
#

well

eternal oxide
#

what value?

ivory sleet
#

why not modify the itemstack first

lean gull
#

here's my other problem btw, if anyone can help that would be great <3

eternal oxide
#

do you mean teh stack size?

ivory sleet
#

then add it

earnest lark
#

so i want to change the ammount of the item

earnest lark
eternal oxide
#

you specify it when you create it

ivory sleet
eternal oxide
#

new ItemStack(Material, amount)

lean gull
#

conclure you do realise i blocked you right

ivory sleet
#

makes ur issue all the more visible

#

Yes floofsy ik

lean gull
#

then why u answering

ivory sleet
#

Because why not

lean gull
#

(im unblocking everyone anyway)

paper viper
#

why would you block a Discord helper

grim ice
#

"In order to create an object (an instance of a class), we need a constructor method. "

#

What??

ivory sleet
#

Oo cool ๐Ÿ˜„

lean gull
earnest lark
minor garnet
#

why i getting this error

lean gull
#

im not homophobic but they used it as an offense

paper viper
#

Conclure did? Cause I doubt that

grim ice
eternal oxide
#

I spent 8 hours tutoring him, then told him to read the spigot wiki on custom configs until he understood it. He blocked me for that.

lean gull
#

no i find it that i don't like people who use gay as an offense and that i also don't like people who insult

ivory sleet
#

I think I wrote it by mistake cause my phone autocorrected to that

tardy delta
#

๐Ÿ˜‚

grim ice
#

who did that??

grim ice
#

im blocking him on spot

ivory sleet
#

Hope you can forgive me regardless ๐Ÿ™‚

quiet ice
#

People here are foolish

paper viper
#

i already blocked u 2Hex, sry

lean gull
grim ice
quiet ice
grim ice
lean gull
#

ok what's with people not understanding that if you block someone you can't see their messages

opal juniper
#

annoying

grim ice
#

o

#

fine

paper viper
#

I have 14 ppl in this discord blocked

grim ice
#

you can have this channel, I'll refrain from talking here :P

lean gull
opal juniper
#

i have no blocks

eternal oxide
#

2Hex is fine. Sometimes he's intelligent, sometimes he dumb, so its Not too bad ๐Ÿ™‚

grim ice
#

lul it fine

paper viper
lean gull
#

wdym

opal juniper
stone sinew
# lean gull wdym

You block everyone that says learn java when you post code thats as simple as adding {} to the correct spot.

eternal oxide
#

Everyone gave up helping you Buenny as you just block everyone the instant you don;t get what you want.

paper viper
#

Elgar do you remembered when I first joined

#

lol

ivory sleet
#

anyways floofsy what was the issue

eternal oxide
#

Yes

lean gull
#

dis thing

paper viper
#

And I was big noob

ivory sleet
#

cant use the options of the team

quartz pike
eternal oxide
#

Everyone is. You shoudl have seen me a couple of years ago when I came back to Java

minor garnet
tardy delta
#

actually i'm converting millis to a timestamp and im not sure what to use

eternal oxide
minor garnet
#

yes

grim ice
# lean gull got tired of people not understanding my slow methods of learning and telling me...

this is my last message here,

  1. just give up, you will have to learn java either way, so better start now
  2. dont block someone that's helping you nicely, especially elgar hes one of the rare people that help without offending
  3. if youre seeking help and someone is toxic just ignore them or if it goes over limit ping a helper or tell them to stop
  4. don't blame / hate on everyone, you should already know if you're 13+ that life isn't completely fair and not all opinions should be said, if you need someone showing niceness is the least you can do
eternal oxide
minor garnet
#

what is JI

paper viper
#

JNI

#

One of the dll modules arent loaded or something

minor garnet
paper viper
#

so you cant use the method

lean gull
#
  1. telling people to give up isn't nice, get nice
  2. they weren't helping me very nicely, they knew i get offended when someone tells me to learn java and they did
  3. helpers are apart of the problem
  4. i do whatever i want aslong as it's along the rules
quartz pike
quiet ice
#

nor will it get nice

lean gull
#

yeah i know

#

but you can atleast try man

paper viper
ivory sleet
#

Guys this debate is as meaningless as the one I had to read yesterday

lean gull
paper viper
#

we need to eat food too

minor garnet
#

this code is in kotlin but he started the class using Bullet.init() library which i am using but how can i do it in java class

eternal oxide
#

com.badlogic.gdx.physics.bullet.collisionJNI.swig_module_init()

stone sinew
#

"get nice" WHAT THE FUCK! LMFAO

quiet ice
lean gull
ivory sleet
paper viper
#

and then System.loadLibrary

lean gull
#

imma stop now

paper viper
#

or wait nvm

minor garnet
#

ah nvm

ivory sleet
#

yeah floofsy good

lean gull
#

i'd like it if you call me buenny

stone sinew
lean gull
minor garnet
eternal oxide
lean gull
#

yo that's one cute bunny

minor garnet
#

yes but ?

eternal oxide
minor garnet
#

? ...

paper viper
#

can you show us the Bullet class

#

Cause this isnt related to your issue. It's something to do with the API you use

minor garnet
#

?paste

undone axleBOT
paper viper
#

and it uses JNI to use a method thats coded in a native language

#

which cannot be found

#

likely due to a binary not loaded or found

minor garnet
#

^ Bullet.class

paper viper
#

hmm lets see

#

can you show the class CollissionJNI

minor garnet
#

3k123 lines

#

you sure ?

paper viper
#

Oh wow uh

#

is there a static block in that class?

minor garnet
#

yes

paper viper
#

Show me that

minor garnet
#

wait nvm dont have

quartz pike
#

3k lines on one class?

paper viper
#

oh hmm

paper viper
#

its JNI

#

it includes all methods from a DLL, DYLIB, etc

#

or binary file whatever

quaint mantle
minor garnet
#

i think you mean this ?

quartz pike
#

ah okok

eternal oxide
#

are you sure you have the gdx-bullet lib?

minor garnet
paper viper
#

Can you check the resources folder of the specific apis and your plugin too?

#

Are there any native binary files

#

(after compiling)

#

The JNI methods have to be extracted from somewhere

minor garnet
#

well in the plugin's resources folder there is nothing

eternal oxide
#

inside the jar

#

is gdx-bullet shaded?

minor garnet
#

yes i'm here

eternal oxide
#

as a test, throw gdx-bullet in a folder called libs in yoru server root

#

create the folder if it doesn;t exist

eternal oxide
#

teh root of your test server

#

create a folder called libs

minor garnet
#

you mean where i start the .bat ?

eternal oxide
#

yes

minor garnet
eternal oxide
#

try both ๐Ÿ™‚

gaunt saffron
#

or i could just use /send all ? but no idea how...

paper viper
#

i dont think you can actually with CompletableFuture

minor garnet
#

i continues getting the error

eternal oxide
gaunt saffron
#

but thhen it's connect survival and not send all survival

eternal oxide
#

you are sending to survival, or wherever you are

gaunt saffron
#

                        for (Player onlinePlayers : Bukkit.getOnlinePlayers()) {
                            ByteArrayDataOutput out = ByteStreams.newDataOutput();
                            out.writeUTF("Connect");
                            out.writeUTF("survival");
                            player.sendPluginMessage( MyEvents.this.plugin, "BungeeCord", out.toByteArray());
                        }
eternal oxide
#

use onlinePlayers.sendPluginMessage not player

tardy delta
#

uhm my math goes brr but i just wanted to now if this is correct

long days = TimeUnit.MILLISECONDS.toDays(millis);
        long hours = TimeUnit.MILLISECONDS.toHours(millis) % 24;
        long minutes = TimeUnit.MILLISECONDS.toMinutes(millis) % 60;
        long seconds = TimeUnit.MILLISECONDS.toSeconds(millis) % 60;
gaunt saffron
gaunt saffron
#

yeah im pretty new to java ๐Ÿ˜‚

tardy delta
#

that returns a date i want a timestamp

tardy delta
#

ah i didnt make it myself ๐Ÿ˜‚

paper viper
#

or whatever

#

and it returns a String

#

it should?

#

iirc

#

Oh you need to pass in the date

#

but you can just do new Date(millis);

ivory sleet
paper viper
#

Use more final

#

daddy

eternal oxide
#

Is there a reason you didn;t use ConfigurationSerializable on the PlayerData?

tardy delta
ivory sleet
#

Uh no just that it might be nice in case of other storage implementation types like databases and such

ivory sleet
#

so clustered hehe

#

but ye

#

ima add that tru

paper viper
tardy delta
ivory sleet
minor garnet
#

so far I haven't solved my error

paper viper
#

i thought my IDE auto adds final

ivory sleet
#

final class

paper viper
#

Oh

ivory sleet
paper viper
#

Yea intellij dum dum smh cant read code

#

cant understand code

#

smh

ivory sleet
#

lol

tardy delta
#

well it should say 5 minutes

paper viper
#

hmm thats weird

hushed marlin
#
        Projectile entity = event.getEntity();
        Arrow arrow = (Arrow)event.getEntity();
        arrow.remove();```

help - wait 5 second
#

in 5 seconds to delete the arrow

ivory sleet
#

?scheduling

undone axleBOT
ivory sleet
#

I would strongly suggest having a look at that

grim ice
#

You want an arrow to get removed from an entity after 5 seconds? If so us what conclure did

ivory sleet
#

it goes through how to schedule something after x amount of times

#

๐Ÿ˜„

grim ice
#

otherwise, explain more

summer scroll
hushed marlin
#

I just don't know it

#

I just sent a piece

grim ice
#

Bukkit.getScheduler().runTaskLater(plugin, () -> arrow.remove()), 100L);

hushed marlin
#

Generally it works but deletes immediately

grim ice
#

100 is in ticks

eternal oxide
#

You need to read what people are telling you Mervik

grim ice
#

1 server tick = 1/20 of a second

#

it's a 20:1 rate

#

plugin is your main class instance

#

the one in the middle is a lambda expression

#

?javadocs would've been easier than asking here

hushed marlin
#

I understand

#

I tried wait xD

grim ice
#

Cool, if you have any more questions I'll answer to the max of my knowledge

eternal oxide
#

Yeah, wait is unuseable (generally) with Spigot/Minecraft

hushed marlin
#

if you tell me where to put it Bukkit.getScheduler().runTaskLater(plugin, () -> arrow.remove()), 100L);

#

I pasted it but something is wrong

grim ice
#

show the error

hushed marlin
grim ice
#

I assume it's "plugin"

hushed marlin
#

I'm just starting out with java

grim ice
#

I see

#

what's the error?

hushed marlin
#

already showing

#

I can't send screen

#

we can go pv?

eternal oxide
#

?verify

#

?register

#

bah

#

I can never remember

grim ice
#

ill send it here for you.

hushed marlin
#

accept

grim ice
#

make an instance variable

#

of your main class

#

name it plugin

#

private final YourPluginMainClassHere plugin;

tardy delta
#

static

grim ice
#

then in your constructor add a param of ur main class

#

and set it to the field you created

#

and boom, you achieved Dependency injection

#

if you don't get the stuff I'm saying you may consider learning java

#

otherwise here's spoonfeed:

hushed marlin
#
    public void onArrowHit(ProjectileHitEvent event) {
        Projectile entity = event.getEntity();
        Arrow arrow = (Arrow)event.getEntity();
        Plugin plugin;
        Bukkit.getScheduler().runTaskLater(plugin, () ->  arrow.remove()), 100L);```
grim ice
#

||java private final urpluginclass plugin; public urclassnamehere(Main plugin){ this.plugin = plugin; }||

hushed marlin
#

ok

grim ice
#

it might be frustrating first, but sometimes you realize spigot is nothing but an addition to java

#

you're basically coding java

#

there is nothing called coding spigot

#

if you dont know java while youre coding java

#

it just won't make sense

#

don't use libraries and APIs while you're learning raw basic java

#

this is what I'm gonna do, learn java for some time then go back to spigot

#

until then I decided to not ask any questions here

unkempt peak
grim ice
#

trust me It took long LOL

unkempt peak
#

It's so annoying when people are like "oh ill learn Java by making plugins" then ask simple Java questions that should be easy to understand

grim ice
#

thats for all libraries i guess

#

even discord.js

unkempt peak
#

Yes. If you want to program something in a specific language learn the atleast the basics of that language before you start trying to make stuff with it.

ivory sleet
#

Yeah

grim ice
#

LMFAO I saw this picture when i searched go learn java spigot

#

i mean java was made 31 years ago

#

btw everyone here whos same as me trying to learn java

#

codecademy is 100% the best option

#

mooc thingy or whatever is also good ig, but codecademy is Very good

quiet ice
#

can only disagree

stone sinew
quiet ice
#

Stackoverflow is the best and only resource

grim ice
#

its development started 31 years ago

stone sinew
#

Its not

stone sinew
grim ice
#

Java was first released in 1995, and Java's ability to provide interactivity and multimedia showed that it was particularly well suited for the Web.

#

and its development started on 1991

quiet ice
#

Oak was first used in 1992

#

According to my java book that was written in 2005

grim ice
#

Java was started as a project called "Oak" by James Gosling in June 1991. Gosling's goals were to implement a virtual machine and a language that had a familiar C-like notation but with greater uniformity and simplicity than C/C++. The first public implementation was Java 1.0 in 1995.

ivory sleet
#

Yeah

grim ice
stone sinew
#

So 26 years ago

ivory sleet
#

the development progress was probably commenced before 1992 tho

grim ice
#

No, 31 years ago

#

its almost 2022

#

but i would say 30 to be precise

quiet ice
#

It has to be said that java now is a shell of its former self

grim ice
#

That doesn't change the fact

#

it's actual development

stone sinew
#

1995

grim ice
#

started on 1991

stone sinew
#

Development started yeah but released 1995

grim ice
#

Then maybe make 'simple google searches' before replying

quiet ice
#

And the JDK 1.0.2 was the first useable JDK according to my book, launched in 1996

grim ice
#

imagine using jdk 1 tho

#

lol

tardy delta
#

why are we talking about the jda

#

oh jdk

#

๐Ÿ˜ณ

quiet ice
#

don't worry, I sometimes have the same moments

grim ice
tardy delta
#

ofcourse

ivory sleet
#

btw iirc haskell was founded before oak

#

so ye idk why I said that but its cool

quiet ice
#

You sure love haskell, don't you?

ivory sleet
#

I love lisp also

prisma needle
#

Hey guys! I was wondering if it is possible to mute messages for only certain advancements with spigot

ivory sleet
#

messages as in chat?

prisma needle
#

yeah as in "Player has completed the challenge [challenge]"

quiet ice
#

it certainly is possible with nms and/or a packet library, not sure if it is otherwise doable

grim ice
#

couldnt you turn on the achievements when someone gets one

#

then turn it back on

quiet ice
#

I mean, yes, you could. Should you?

#

It's likely as bad as setting op on and off - won't do damage in the short term, but might lead to strange situtations

grim ice
#

you're compaing

#

comparing

#

the permission to do everything on the server

#

with a simple cosmetic chat message

tardy delta
#

uh what do i get if i do milliseconds / 1000 ?

#

my maths go brr

grim ice
#

There is even another way to do it

#

i think, idk tho

#

Infact

#

use my solution

#

easiest and simplest one

sharp bough
#

anyone needs help with any kind of proyect?

#

im bored af

ivory sleet
#

yeah code my commission for me

sharp bough
#

do i get a cut?

ivory sleet
#

uh

#

its only $10

sharp bough
#

whats the plugin

ivory sleet
#

playerattributes

#

well I dont need help probably but yea

sharp bough
#

hm no i dont wanna start an entire new proyect i just wanna join one and help xd

#

im bored but im also tired lol

ivory sleet
#

yeah I get you

lost matrix
sharp bough
lost matrix
#

You have 1000ms
Multiply it by 1000
You get 1_000_000us
or divide it by 1000
You get 1.0s

grim ice
#

player attributes are 100% gonna be water for you lol

grim ice
#

no

#

its 1 ms

#

wait

#

nvm i think im wrong lmfao

#

why is he asking that here tho

tardy delta
grim ice
#

u can use google for that

grim ice
sharp bough
#

but 1000 ms is 1 second
1000 / 1000 is 1 ms, 0.001 second

tardy delta
#

we learn maths in school but we'll never use it in daily life smh

sharp bough
#

you cant divide a number and make it bigger

grim ice
#

1 millisecond / 1000 = 1 microsecond

ivory sleet
#

us ๐Ÿ˜„

ivory sleet
grim ice
#

wtf

#

ok here u go

sharp bough
grim ice
tardy delta
#

hmm my cooldown sucks
it says wait one second then i try again and it says 7 seconds

#

it has to be 5 minutes smh

tardy delta
#
command class
if (!isConsole) { // no cooldown for console
            long timeLeft = System.currentTimeMillis() - CooldownManager.getCooldown(p.getUniqueId());
            if (TimeUnit.MILLISECONDS.toMinutes(timeLeft) < 5) {
                Utils.message(p, "&cPlease wait " +
                        Utils.millisToHumanReadable(
                                System.currentTimeMillis() -
                                        CooldownManager.getCooldown(p.getUniqueId()))
                        + " before reusing this command!" + (System.currentTimeMillis() - 5));
                return true;
            }
        }

after executing command

CooldownManager.setCooldown(p.getUniqueId(), System.currentTimeMillis());
public class CooldownManager {

    private final static Map<UUID, Long> cooldowns = new HashMap<>();

    public static void setCooldown(UUID uuid, long time) {
        if (time < 1) {
            cooldowns.remove(uuid);
            return;
        }
        cooldowns.put(uuid, time);
    }

    public static long getCooldown(UUID uuid) {
        return cooldowns.getOrDefault(uuid, 0L);
    }
}
#

smh ?paste was better

grim ice
#

millisToHumanReadable LMFAO

tardy delta
#

IDK

#

maybe that method

tall dragon
#

whats not working @tardy delta

tardy delta
#

the cooldown time does not makes sense

tall dragon
#

?paste

undone axleBOT
tardy delta
#

wait ill show the method that calculates the cooldown

tall dragon
#

well thats just the method thats formatting it right?

tardy delta
#

yea

#

i think the calculations are correct

sharp bough
grim ice
sharp bough
#

hwo

grim ice
sharp bough
#

this dont work

sharp bough
grim ice
#

get gud

tall dragon
#

i use this to format time maybe this helps @tardy delta

private static String TIME_FORMAT = "%s Hrs, %s Mins, %s Secs"

public static String formatTime(long seconds) {
        int day = (int) TimeUnit.SECONDS.toDays(seconds);
        long hours = TimeUnit.SECONDS.toHours(seconds) - (day * 24);
        long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
        long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);

        return String.format(TIME_FORMAT, hours, minute, second);
    }
tardy delta
#

lemme see

hasty prawn
sharp bough
#

i made it

tardy delta
#

yea i had that too

#

lets try again

#

i think i fixed it

#

lmao now is the cooldown 18000 days for 5 minutes

sharp bough
#

XD

tall dragon
#

woops

#

wrong reply

tardy delta
#

rrrrr

Utils.message(p, "&cPlease wait " + Utils.millisToHumanReadable(
                                System.currentTimeMillis() - 5) + " before reusing this command!");
#

5 has to be minutes

#

ow wait

tall dragon
#

take a look at this

#

this is what i use for cooldowns

sharp bough
#

with a hashmap<UUID, TimeLeft>

tardy delta
#

im doing

#

oh i have map uuid long

sharp bough
#

show code

#

!paste

#

with that

tardy delta
#

but i found it i guess

sharp bough
#

!code

#

!p

#

!bot

#

!help

#

!?

tardy delta
#

i was converting System.currentmillis - 5 to days minutes etc

sharp bough
#

!md

tardy delta
#

?paste

undone axleBOT
sharp bough
#

XD

tardy delta
#

smh

#

if this doesnt work i eat my sock

sharp bough
#

can i have 1

tardy delta
#

no

sharp bough
#

y no

grim ice
sharp bough
#

then we share

#

like brothers

grim ice
#

wtf

#

owo

sharp bough
#

xD

#

:uwu:

grim ice
#

we can share my dick tho UwU

sharp bough
#

how tf u gonna lick ur own dick

grim ice
grim ice
sharp bough
#

like i cant suck my own dick

#

my back hurts

#

XD

grim ice
#

becuz yours is so small

tall dragon
#

i think were going a bit off toxic here ey

ivory sleet
#

bruh what am I reading

tall dragon
#

lmfao

grim ice
#

lMFAO

sharp bough
#

HAAHAHA

#

shit got weird real quick

tardy delta
tardy delta
opal juniper
grim ice
#

@tardy delta ok i have an idea of how to do it

tardy delta
#

cooldown is working but the message says stupid things

grim ice
#

o

#

then fix it

#

smh

opal juniper
#

show code?

tardy delta
#

uh wait

#

just under it

#

and the thing that says the message is the md5 paste thing

grim ice
#

owo

tardy delta
#

uwu

grim ice
#

tbh

#

i dont find discord helpers active

#

except conclure

#

whos active all time lol

ivory sleet
tardy delta
#

i need cuddles

lean gull
#

i need nothing

#

nvm there is something i need

lean gull
#

oh god

sharp bough
#

bro why does it look like that when i open it

lean gull
#

bruh conclure just left the thread he was helping me in

grim ice
#

i discovered this before sussy baka

sharp bough
#

scary af

ivory sleet
#

I joined

#

just left all other ones

grim ice
#

@lean gull

#

what plugin r u making rn

lean gull
#

multiple

grim ice
#

the teams one

#

what is it aabout

lean gull
#

oh then im making a rank plugin

#

create ranks, edit ranks, delete ranks

grim ice
#

o

lean gull
#

...delete people... jk jk

grim ice
#

LMFAO

#

ok

tardy delta
#

hey does someone knows what yellow is in char color?

lean gull
#

&e

#

&6 is gold if u feelin fancy

#

:p

sharp bough
#

bruh

grim ice
#

very nice resolution my guy

sharp bough
grim ice
#

that will make it worse

tardy delta
#

aha yes

#

thanks

sharp bough
#

xd

lean gull
#

yo i just thought of a pog game

#

yo upgrade people and edit people

sharp bough
lean gull
#

no

#

like you have npcs that do stuff like miners, crafters, smeleters, weapon bois

#

you can edit their proffesion, you can upgrade their speed and whatever

sharp bough
#

like minions?

lean gull
#

and c u s t o m i z a t i o n

#

sure, like minions

#

minions that move and actually do stuff instead of having an animation of mining on loop

#

maybe even make them talk with eachother to make it seem realistic

opal juniper
#

doesnโ€™t seem like a game xD

lean gull
#

why not

opal juniper
#

but cool idea nonetheless

lean gull
#

they mine, smelt the ores they got, then make them into weapons and sell them

sharp bough
lean gull
#

it's an upgrading game

#

you upgrade the npcs with the money u get from them

sharp bough
#

like an idle game?

lean gull
#

also they get revenue

#

yes, like an idle game

#

idk im just making it up as i go along explaining

sharp bough
#

make it bigger and call them slaves

#

and you can send your slaves to mine

lean gull
#

and no revenue

sharp bough
#

or fight other player's slaves

#

xd

#

so the games is like factions

#

but you have your own army

#

and you have to manage your army

lean gull
#

kinda reminds me of the clay army mod or whatever it's called

grim ice
#

yeah but thats just skyblock minions

#

aka slaves

lean gull
#

i don't play skyblock but don't minions just mine stuff or farm stuff instead of what i said which they move, talk with eachother and stuff like that

sharp bough
#

in hypixel

#

minions are in 1 place

#

and they do stuff arround them

#

but they dont move

#

they "talk"

lean gull
tardy delta
#

GOD WHYYYY

lean gull
#

i'm guessing that's your own plugin?

tardy delta
#

ofc

lean gull
#

lawl

tardy delta
#

rawr

lean gull
#

sounds like a you problem jk jk

tardy delta
#

i think its - 5000 instead of 5

#

๐Ÿฅบ

lean gull
#

wait is it going up

tardy delta
#

someway

quaint mantle
tardy delta
#

it doesnt makes sense

eternal oxide
#

you are increasing the timer when you use the command no matter if its still on cooldown

#

did each of those messages come after you tried to reuse the command?

tardy delta
#

yea

#

lemme retry

eternal oxide
#

then yes, you are increasing teh cooldown

ivory sleet
#

:9

eternal oxide
#

if a cooldown exists you should do nothing other than notify the player

tardy delta
#

i have this

long timeLeft = System.currentTimeMillis() - CooldownManager.getCooldown(p.getUniqueId());
            if (TimeUnit.MILLISECONDS.toMinutes(timeLeft) < 5) {
                Utils.message(p, "&cPlease wait&e " + Utils.millisToHumanReadable(
                                timeLeft - 5000) + " &cbefore reusing this command!");
                return true;
            }
lean gull
#

hi, i need help - im unable to use any of the TextComponent stuff in my IDE (IntelliJ), if you can help pls join thread ok thx

#

how do i put people in thread

eternal oxide
#

does getCooldown return a future time for teh cooldown to expire?

lean gull
#

hi elgar

eternal oxide
#

hi

eternal oxide
#

does getCooldown return a future time for teh cooldown to expire?

tardy delta
#

returns the last time its used

#

in millis

#

after epoch i guess

sharp bough
tardy delta
#

still the same problem

#

it counts up lol

sharp bough
#

i would play that

#

if its made properly

tall dragon
grim ice
#

just use a cooldown library if there are any

#

until u learn hhow to make ur own

tardy delta
#

idk

grim ice
#

or ask for help like normal poeple

grim ice
#

dont bother, i tried it and it's fucked up

tardy delta
#

i was looking for something with timestamps

sharp bough
#

let me find it

grim ice
eternal oxide
#

?bt

undone axleBOT
grim ice
#

pogchamop

#

i almost learnt nothing

#

except a few concepts lmfAO

sharp bough
grim ice
#

yes

#

its indeed useful though

sharp bough
#

imagine having the patience

#

lol

grim ice
#

it was not much

#

i thought the course will at least take a day

#

took me like 4 hours

#

to 5

tardy delta
#

i dont understand why it isnt working

grim ice
#

show your code dude

#

the actual relevant one that you find issues in

sharp bough
#

it saves the timestam of when it was used

#

and then checks

tardy delta
#

crying

sharp bough
#

send the code

#

i cant help u if i dont see what u did

tardy delta
#
long timeLeft = System.currentTimeMillis() - CooldownManager.getCooldown(p.getUniqueId());
            if (TimeUnit.MILLISECONDS.toMinutes(timeLeft) < 5) {
                Utils.message(p, "&cPlease wait&e " + (TimeUnit.MILLISECONDS.toMinutes(timeLeft) - 5) + " &cbefore reusing this command!");
                return true;
            }
#

so it seems to be 0

grim ice
#

check otu dis

#

also whatever weird shit ur using just replace it with this:

#

make hashmap(uuid, integer)

#

onprecommandprocess

sharp bough
grim ice
#

check if command is ur command

#

Yes and it should

#

you can't make that persistent, except with pdc or configs

#

use configs and youre done for

sharp bough
#

yes thats what im trying to tell him, use timestamps and config files

grim ice
#

fuck you

#

don't

#

why use configs for cooldown

#

thats extremely dumb

sharp bough
grim ice
#

making them un persistent is good

sharp bough
#

all good ๐Ÿ‘

quaint mantle
#

why doesn't it work?

int exp = p.getTotalExperience();
List<String> lore = config.getStringList("messages.lore");
if (lore.contains("%exp%") && p != null) {
lore = lore.replaceAll((str) -> str.replace("%exp%", "" + exp));

sharp bough
#

something?

quaint mantle
#

Type mismatch: cannot convert from void to List<String>

#

1.12.2

#

I already sent you a website telling you how to use streams

#

read. it.

#

this works:
lore.replaceAll ((str) - > str. replace ( " & " , "\u00a7"));

#

but why doesn't i %exp% work?

#

๐Ÿงฑ
๐Ÿงฑ

tardy delta
#

wut why not just lore.replaceAll("&", "\u00a7")

sharp bough
#

XD

quaint mantle
#

I need to make a placeholder %exp%

#

So make it

#

it works!

#

lore.replaceAll((str) -> str.replace("%exp%", "" + exp));

#

XD

quaint mantle
#

ChatColor.translatewhateveriforgor

golden turret
#

.replace('&', 'ยง') >>>>>>>>>>>>>

quaint mantle
golden turret
#

compile to utf-8?????????????????

#

always used and never broke

#

only broke when i didnt compiled to utf-8

quaint mantle
#

@waxen plinth.

#

Help.

#

Now.

grim ice
#

amogus??

waxen plinth
quaint mantle
#

how tf do i evaluate this

waxen plinth
#

Evaluate what?

quaint mantle
#

The list

#

i have a list of tokens

waxen plinth
#

Oh

grim ice
#

when a spigot plugin with 2k+ downloads has way worse java than you: man

waxen plinth
#

You have a linked list right?

quaint mantle
#

@grim ice

quaint mantle
#

what do i do

waxen plinth
#

What do you mean kinda

quaint mantle
#

tell me what to do

waxen plinth
#

Do you have a linked list or not

quaint mantle
#

Yes

waxen plinth
#

Okay

#

And the tokens are in that list

quaint mantle
#

yes

waxen plinth
#

Is each operator assigned a priority?

quaint mantle
#

yes

waxen plinth
#

Great

#

Now the easy way

#

Create a map

quaint mantle
#

gimme the quickest way

waxen plinth
#

Quickest as in runtime complexity?

quaint mantle
#

yes

grim ice
#

what yall doin

waxen plinth
#

A map

#

Is this kotlin or python?

quaint mantle
#

py

waxen plinth
#

I think you should stick with kotlin

#

Damn

#

Alright, well make a map

quaint mantle
#

ill move to kotlin once i figure it tf out

waxen plinth
#

ops = {} or something

lean gull
waxen plinth
#

Do you want to move somewhere we won't be interrupting people asking for plugin help?

quaint mantle
#

heres fine

waxen plinth
#

Okay

grim ice
#

why would anyone use maps instead of hashmaps if what theyre adding is @NotNull

waxen plinth
#

Well, you create a map and iterate over all of the operators

lean gull
#

love it when helpers encourge to missuse channels

grim ice
#

im just wondering btw

grim ice
#

yeah but like

quaint mantle