#help-archived

1 messages · Page 120 of 1

sturdy oar
#

I want to learn so badly how to use graphics library for C99

frigid ember
#

i learned basic asm math functions lol

gleaming helm
#

ASM can be really hard to learn lol

stone rampart
#

Any that isn't a full blown computer

gleaming helm
#

No you didn't

#

I can guarantee you didn't

stone rampart
#

Use matlab lol

#

Arrays start at 1 etc.

keen compass
#

if I recall, now a days anything that requires ASM, it is generated by software instead of done by hand

sturdy oar
#

@gleaming helm Do you have experience with JNI and C ?

keen compass
#

since it can be so tedious and error prone depending on how large your ASM is

frigid ember
#

wjy kevin

#

masm i did

gleaming helm
#

I don't really have a need for JNI so no

frigid ember
#

i dont use assembly

#

why use it

#

use cpp

stone rampart
#

I write in binary lol

gleaming helm
#

@keen compass I still do some ASM by hand

sturdy oar
#

I find it pretty cool to be able to call C\C++ methods from Java environment though

frigid ember
#

ok

#

use c#

sturdy oar
#

no

#

go away

frigid ember
#

c # gang where u at

keen compass
#

@gleaming helm all I can say is kudo's to you for being able to lol, not everyone can XD

gleaming helm
#

lol

frigid ember
#

@gleaming helm zoomer lol

gleaming helm
#

thanks?

stone rampart
#

No language is truly better than the other change my mind

frigid ember
#

@naive goblet c# gang

sturdy oar
#

shut up microsoft java

frigid ember
#

stfu

#

better than java

gleaming helm
#

@stone rampart writes assembled machine code everybody

stone rampart
#

And if you think your language is best because you mastered it, you're wrong

frigid ember
#

l

gleaming helm
#

Give him a hand

naive goblet
#

kotlin before c# probs 🙂

frigid ember
#

lmao

keen compass
#

@stone rampart depends on what you are using the language for or what problem you are trying to solve

frigid ember
#

ffs

#

noo coonclur

#

u let us down man

sturdy oar
#

Kotlin is my second favorite language

stone rampart
#

Comparing like java and c# though

#

Is stupid

naive goblet
#

Ah sorry://

frigid ember
#

kotlin aint bad but ehh

#

Comparing like java and c# though
@stone rampart dum as

stone rampart
#

Because realisticly, they both do the same things in the same way

frigid ember
#

lol

#

oh

#

i misread

naive goblet
#

Also fendi why you hate streams api in java

keen compass
#

I mean, unless you have Java OS, Java isn't going to be better then say C or C++ if you are making drivers XD

frigid ember
#

i thougt you said compiling in java or c# is sumb

#

lOolll

gleaming helm
#

Streams do a memory copy for every chaining

#

AKA

frigid ember
#

kevin u zmer

#

use cpp

sturdy oar
#

please stop

#

and be serious

frigid ember
#

use c or cpp

gleaming helm
#

Don't use a stream to iterate over every block in a minecraft world
COUGH
FUCKING
MOJANG

stone rampart
#

Retrooper your language is not best because you learnt it. Shut it.

keen compass
#

lol

sturdy oar
#

Kevin_ you heavily optimize mojang's shiet with GraalVM

frigid ember
#

?

sturdy oar
#

you should try it

naive goblet
#

Kevin I like the idea thanks indeed for sharing such smart methods

frigid ember
#

Retrooper your language is not best because you learnt it. Shut it.
@stone rampart i didnt learn c tho lol

gleaming helm
#

That's not optimization, that's introducing instability and a complete hack

frigid ember
#

Kevin I like the idea thanks indeed for sharing such smart methods
@naive goblet its basics bruh

stone rampart
#

Lol just shut up

gleaming helm
#

Switch to a fork that's dedicated to fixing that type of stuff

frigid ember
#

lol

sturdy oar
#

I don't think it's unstable

frigid ember
#

dont use streams simple story

naive goblet
#

@naive goblet its basics bruh
@frigid ember **sarcasm

keen compass
#

it is stable until it is not 😉

sturdy oar
#

i've run a 1.15.2 server on it for several months and didn't have a single issue

frigid ember
#

ok

stone rampart
#

The whole c/cpp best language thing with no justification nor use cases is annoying af

gleaming helm
#

It's pretty unstable if you're running multiple instances of the JVM and if even one of them breaks some things can potentially be damaged

frigid ember
#

i like making cheats in cpp

gleaming helm
#

I'm running a cluster of servers with the goal of it being to appear as a single server

#

That's why it's important to me

frigid ember
#

my main use of it

gleaming helm
#

Like super high stability

keen compass
#

Ah sharding

stone rampart
#

Yeah bro I mod cheat engine to use it on roblox too

gleaming helm
#

Exactly

sturdy oar
#

oh wait I want to ask a question that no one answered me on Paper discord

stone rampart
#

/s

keen compass
#

I am working on that as well

stone rampart
#

Omg a real question in this channel?

sturdy oar
#

Asking to experienced developers here: Have you ever used or had any experience with Java's C.O.R.B.A modules? And what are your thoughts on them (yes I know that they've lately been removed since JSP 320 of Java 11) but I still think they are an amazing tool and am curious.
I haven't found much info about them online , so I'm trying to make an idea of their actual use case

gleaming helm
#

@sturdy oar Probably because deprecated and then removed completely

keen compass
#

Having not found much info should give you a clue as to why they are being removed 😛

gleaming helm
#

In all modern versions of java

sturdy oar
#

Well they have info but I think they've been deprecated since java 8

#

and completely removed on 11

gleaming helm
#

java 👏 8 👏 is👏 not👏 lts

frigid ember
#

In all modern versions of java
java 8 is good prove me wrong

sturdy oar
#

please stop

gleaming helm
#

java👏 8👏 gets👏 no👏 updates

frigid ember
#

?

sturdy oar
#

we went through this discussion 20000 times here

frigid ember
#

im not allowed to chat or what

#

bruh

sturdy oar
#

you're asking questions that have already been aswered

stone rampart
#

Just stfu

undone narwhal
#

OMG NO

#

Please

stone rampart
#

Or justify

undone narwhal
#

Don't

frigid ember
#

?

sturdy oar
#

java 7 EE is clearly better

#

reeee

frigid ember
#

ree

#

lez go

gleaming helm
#

Can somebody please mute this kid

stone rampart
#

Me and the boys use java 2

gleaming helm
#

I actually learned on a java 2 book lol

sturdy oar
#

real big servers use only Scala and java enterprise

wraith apex
#

kotlin is best

gleaming helm
#

@sturdy oar false

sturdy oar
#

i know it's a meme

gleaming helm
#

LOL

frigid ember
#

real men use trinary

sturdy oar
#

the whole enterprise thing

gleaming helm
#

It's not idiotic

#

It's...

frigid ember
#

hah

gleaming helm
#

It's solving "corporate problems"

#

That aren't actually problems

frigid ember
#

who here is a real boomer

gleaming helm
#

Oh and all the

#

"Enterprise version" stuff

frigid ember
#

he such a boome

gleaming helm
#

The reason they do that is because

stone rampart
#

Retrooper close thine mouth.

gleaming helm
#

The reason is because they want to have their asses covered so they don't get sued for license infringement

frigid ember
#

i didn’t open it

gleaming helm
#

You can't use the standard version of java 11 commercially

frigid ember
#

ok i stop

gleaming helm
#

for example

frigid ember
#

why use them in the first place then

#

Lol

keen compass
#

Well technically java 8 is LTS and is supported till 2030 for corporate and 2022 if you pay for support. Otherwise Java 8 is EOL sometime towards the end of this year however. Java 11 is the next LTS and then its Java 16 after that.

gleaming helm
#

You have to either use the enterprise version from oracle or the openjdk version

stone rampart
#

On the topic of spigot, java 8 is pretty much the only way to go

gleaming helm
stone rampart
#

Barely any hosts have anything above java 8

sturdy oar
#

yo kevin

#

you gotta make an account

#

and send images lol

gleaming helm
#

lol

keen compass
#

Ah, ok

gleaming helm
#

I have one I just like

#

Didn't link it

keen compass
#

either way I recommend updating anyways

gleaming helm
#

Yeah please update to AT LEAST java 11

keen compass
#

Java 14 is great especially with the updates they have done with the GC

sturdy oar
#

I can't develop on j11 )=

#

no one would use my stuff

frigid ember
#

i use java 8

gleaming helm
#

I'm running java 11 for now but as soon as java 16 is released and stable I'm upgrading

frigid ember
#

i like jav 8

gleaming helm
#

Oh the joy of running 100% custom code

frigid ember
#

kevin why dont u update ur mc

keen compass
#

I am hoping in Java 16 native unix sockets are supported

sturdy oar
gleaming helm
#

@frigid ember Java 11 has the same feature set as Java 8 you know right?

frigid ember
#

ik

keen compass
#

currently native unix sockets are in the sandbox testing phase 😄

undone narwhal
#

LombokGang

gleaming helm
#

Wow did somebody find the other lombok annotations besides @Getter and @Setter

frigid ember
#

why shud i take 10 mins to install a new jdk with same features

sturdy oar
#

I kinda know them all

stone rampart
#

Security I think

sturdy oar
#

except i don't end using them that much

#

@With and @Builder are my favorites

frigid ember
#

what they do

sturdy oar
#

go read the doc.

gleaming helm
#

^

frigid ember
#

i dont really use lombok

keen compass
#

@frigid ember there is significant optimizations done to the JDK since java 8.

gleaming helm
#

You also don't really use docs

frigid ember
#

i do

stone rampart
#

Doubt

frigid ember
#

just i dont plan on using it

keen compass
#

Well JVM I should say

sturdy oar
#

😅 nice joke, really laughed

keen compass
#

but new things added to the JDK and some things removed/deprecated

frigid ember
#

just someone could quickly say what it does

#

i thought

stone rampart
#

Or

gleaming helm
#

It's newer

frigid ember
#

but ok

sturdy oar
#

@With was previously known as @Wither @frigid ember

gleaming helm
#

And java 8 is not supported

#

any longer

sturdy oar
#

DISCORD

gleaming helm
#

So you should upgrade

stone rampart
#

Lol

#

Backslashed the ping?

frigid ember
#

i don’t use lombok, some peoples projects i was invited to used lombok so i had to install it ig

undone narwhal
#

Yep ahah

keen compass
#

I highly recommend updating to Java 14 😉

stone rampart
#

Poor mate wither is gonna have to cop the mention

sturdy oar
#

FUCKACKASCK
ASCè

gleaming helm
#

I use it sparingly

#

As in

#

When it feels right

frigid ember
#

lombok?

#

like making a getter and settsr isnt too hard

sturdy oar
#

...

#

look at this

#

and you'lll get why

frigid ember
#

intellij lets u click a button generate -> getters and setters

#

most people use itnjust for that reason

stone rampart
#

Retrooper ngl I'm surprised you know what instances are

frigid ember
#

ik ofc not all just saying

gleaming helm
#

LOL

sturdy oar
#

lombok solves this

gleaming helm
#

oh that's nothing

frigid ember
#

stop flexin kev

stone rampart
#

400 lines?

frigid ember
#

we got the point u work with assembly and all sht

gleaming helm
#

I have a 700 line class

sturdy oar
#

each getter and setter is 3 lines

gleaming helm
#

80% getters

frigid ember
#

same

gleaming helm
#

And setters

frigid ember
#

dumb ass

#

lmao

#

jk

#

why?

stone rampart
#

Oh yeah true lol

sturdy oar
#

data classes

frigid ember
#

makes it sound bad, i doubt 80% is getter and setter

stone rampart
#

I bet that's fun to scroll through

gleaming helm
#

That's one of my 2 types of profiles

#

It's not

frigid ember
#

u barely do sht there

keen compass
#

I mean, still comes out to about the same @sturdy oar only difference is you are just having lombok put the bytecode in there for you as opposed to you doing it yourself 😛

gleaming helm
#

I also don't touch it often

#

Because it just works

wide nebula
#

i feel like kotlin > lombok though

frigid ember
#

it works mindset isnt the bwst

sturdy oar
#

yeah Kotlin is Java with better Lombok

#

smh

gleaming helm
#

It's like the core profile that handles punishments, donation history, etc.

frigid ember
#

we don’t do shit because it just wirks

gleaming helm
#

Join timestamps, IP history

#

2fa

#

Grants, ranks, perms, available kits

keen compass
#

Well, depending on how much software you work on, sometimes leaving things alone because they work is actually the best

frigid ember
#

i do a 100second for loop in start of my spigot plugin because it works boiz

keen compass
#

don't fix what isn't broken you know, otherwise you just might break it 😛

sturdy oar
#

let me guess

gleaming helm
#

Vanish state, flying state, walk/fly speed, staff chat status and settings, need I carry on?

frigid ember
#

ig the for loop isnt broken

sturdy oar
#

do you also make scheduled tasks with Thread.sleep() @frigid ember

frigid ember
#

so that mindset isn’t best too

stone rampart
#

lol

frigid ember
#

yea

sturdy oar
#

oh god

gleaming helm
#

LOL HE DOES

frigid ember
#

i do threadsleep

stone rampart
#

Use BukkitRunnable

undone narwhal
#

OMG

gleaming helm
#

USE TIMER

sturdy oar
#

ban this dude

#

from GitHub

stone rampart
#

You're genuinely a clown

frigid ember
#

no

stone rampart
#

Read the docs

frigid ember
#

ok

#

no

stone rampart
#

🤡

#

Yes

sturdy oar
#

actually what's the difference with wait() and Thread.sleep() tho

#

never got it

frigid ember
#

bruh

stone rampart
#

Blacklist his IP from the maven repo

frigid ember
#

you don’t get jokes

stone rampart
#

No but it's inline with what you've said

frigid ember
#

?

keen compass
#

wait expects to be interrupted where as sleep isn't expected to. Wait doesn't throw a security exception where as interrupting sleep can do so

frigid ember
#

i said “i do thread sleep”

gleaming helm
#

You saying you do that is perfectly in line with your code quality

stone rampart
#

Your attitude almost definitely comes from someone who uses thread sleep

#

And doesn't read docs

undone narwhal
#

ThreadSleep attitude

gleaming helm
#

He definitely does both

naive goblet
#

Why are you god damn rude to retrooper like wtf

sturdy oar
#

He sleeps the thread inside a runnable 🤣🤣🤣

gleaming helm
#

You should try having him DM you all his questions

frigid ember
#

i thread sleep inside my async call

sturdy oar
#

he never asked me anything luckily

frigid ember
#

it gives best fps

naive goblet
#

Block him then just not a big deal

gleaming helm
#

I did

frigid ember
#

i blockdd u tho

#

lol

undone narwhal
#

Retrooper stop wasting your time and go learn some maths

gleaming helm
#

he only knows skid

sturdy oar
#

You see there are 2 different kind of questions, the one I and others make , who are genuinely intersted in learning, and @frigid ember 's questions

tiny dagger
#

this became wayy to toxic lol

strange grove
#

hey does anyone know how to do a packet listener?

sturdy oar
#

yes

#

use ProtocolLib

strange grove
#

or can someone point me somwhere where i can get information

frigid ember
#

or watch the source codes video

#

i can send u in dm

keen compass
#

@strange grove will have to either use protocollib or use reflection

strange grove
#

well

gleaming helm
#

I'd use protocollib

strange grove
#

ok

sturdy oar
#

I'd go with a library

strange grove
#

well how do i use it

sturdy oar
#

well glhf

keen compass
#

it has a wiki page

#

go read it

sturdy oar
#

takes a long time to understand

strange grove
#

ok

sturdy oar
#

but it's worth it

frigid ember
#

lmao

strange grove
#

sighs in headcrab

sturdy oar
#

is this an half-life reference

strange grove
#

yes

keen compass
#

Yep

strange grove
#

see my name?

sturdy oar
#

luckily i never got to play it

#

only GMOD

strange grove
#

it's also a reference to spongebob

frigid ember
#

some good devs are douches like allegedly the dev who made the minecraft development plugin for intellij

sturdy oar
#

dude

#

remove that

keen compass
#

Lol

strange grove
#

but a much darker version of Mr.Krabs

frigid ember
#

allegedly

#

i said

#

i didnt say i claim it ffs

#

people call him toxic idk why

#

he seems alr

keen compass
#

because people annoy him with pointless questions XD

#

and ping him sometimes for no reason

frigid ember
#

ok

gleaming helm
#

You'd call me toxic but there are plenty of people that can ask question without being entitled who wouldn't say I'm toxic

sturdy oar
#

I wouldn't call Kevin_ toxic, he helps me because i actually make proper questions

gleaming helm
#

🖐️

sturdy oar
#

kinda

frigid ember
#

i actually had respect when u stll helped me

#

i expected to be ignored

keen compass
#

Kevin just likes like to bash on my methods but isn't the first to do so 😛

strange grove
#

kevins cofindence takes a blow

frigid ember
#

then u just idk what happened

gleaming helm
#

Well I mean

#

I disagree with a lot of ways you do things

frigid ember
#

i was surprised u helped

gleaming helm
#

😛

keen compass
#

Sure

strange grove
#

and there goes his self esteem

keen compass
#

but I don't take it as a toxic thing though

frigid ember
#

well

strange grove
#

and his ego

gleaming helm
#

I really am not taking any of this personally

frigid ember
#

what do i do rn that u disagree

strange grove
#

obliterated

keen compass
#

at the very least I understand the methods you throw out there as well 😉

gleaming helm
#

Because nobody here knows me IRL

sturdy oar
#

can I get to meet someone here who uses IdeaVIM on IntelliJ

gleaming helm
#

@strange grove

strange grove
#

i know

#

i'm just kidding

#

sry

gleaming helm
#

lol

strange grove
#

@gleaming helm

#

I may have went too far

#

but yea

gleaming helm
#

@sturdy oar I use vim a lot but not with IJ

frigid ember
#

kevin what do i do that you disagree with, as you said a lot of things.

undone narwhal
#

Guys, move to #general. I'm sure many devs need help but are afraid of seeing their question lost

gleaming helm
#

Yeah I agree let's move

keen compass
#

@frigid ember generally not wise to ask such questions unless you are prepared for the potential answers

strange grove
#

says in CS:GO voice Go Go Go

#

!

#

363

#

lol

#

dang num lock

gleaming helm
#

We're moving channels

strange grove
#

sneaky beaky like says in irish voice

sturdy oar
#

omg i've seen someone use a label in java

#

for the first time of my life

strange grove
#

who?

sturdy oar
#

a tutorial

strange grove
#

oh nvm

#

🙂

sturdy oar
#

he needed to break nested for

strange grove
#

nods in confusion

#

not understanding a thing of what

#

@sturdy oar said

sturdy oar
#

label are kinda like C's goto

#

actually not but i like to say so

strange grove
#

@strange grove nods with an even bigger confused look on his face

#

wondering how he got here

frigid ember
#

So guys, I have a problem with a crafting plugin I'm working on. So I spawn a fake player and open a workbench for it, and I open a chest inventory for the player typing the command, so when items are put into a 3x3 grid in the chest gui, I set the items to the workbench that is being set to the fake player. Then I get the result and set it to a certain slot in the chest inventory. However, I've come across a problem. When I click the item in the result slot, how do I get the item in the workbench to get clicked as well or remove the items used in the craft from the chest inventory?

strange grove
#

and why he is shuffling around chat

frigid ember
#
        PacketPlayOutSetSlot slot = new PacketPlayOutSetSlot(-2, 2,
            CraftItemStack.asNMSCopy(new ItemStack(Material.DIRT)));
        ((CraftPlayer) p).getHandle().playerConnection.sendPacket(slot);

I've tried packet play out slot to make the player click the resulting slot, but that isn't working

#

And I've tried this

#

            if (cic.getRecipe() instanceof ShapelessRecipe) {
                ShapelessRecipe recipe = (ShapelessRecipe) cic.getRecipe();
                for (ItemStack stack : recipe.getIngredientList()) {
                if (stack == null || stack.getType() == Material.AIR)
                    continue;
                inv.removeItem(stack);
                }
strange grove
#

and then he suddenly realizes he's gtg so Mr.Krabs leaves the chat.

#

Discord Server: @strange grove has left the chat

frigid ember
uneven dove
#

How long does it take to review a premium resource? It's been 2 days.

sturdy oar
#

Ohoh

#

Took 14 for me

#

And I even gave opensource

uneven dove
#

14 days ?!

sturdy oar
#

Yep

#

Can take even 1 month

frigid ember
#

takes a week mostly

languid pewter
#

someone know how I can fix this: No suitable driver found for jdbc:sqlite:sample.db I'm using minimize jar because I need the file to be less than 5MB, also I'm using this setting in maven-shade-plugin

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/services/java.sql.Driver</resource>
                                </transformer>```
errant python
#

Will you post your full maven pom.xml?

#

@languid pewter

#

Also did you run the maven install?

languid pewter
#

That's pom.xml

#

Also did you run the maven install?
@errant python I didn't think about that 😄 I'll try it

errant python
#

XD all good 🙂

languid pewter
#

Still same

errant python
#

Can you post the full stack trace?

languid pewter
errant python
#

Ok, hold on let me test a few things 🙂

languid pewter
#

Sure

errant python
#

Ok after testing you maven, it checks out.
However, I remember someone asking me about this awhile back.
Try adding Class.forName("org.sqlite.JDBC"); before you attempt to initiate a connection.

languid pewter
#

It's already on it

errant python
#

Don't forget to also surround it with try{}catch(classnotfoundexcetption e){}

languid pewter
#

I use Exception usually

#

It uses less code than adding a lot of catch to a try{}catch with a lot of exceptions 😄

errant python
#

Specifying the exception has a greater chance of actually catching the correct exception, its some weird JVM thing.

languid pewter
#

Oh, I didn't knew that, I'll change that, but still not working

Ok after testing you maven, it checks out.
However, I remember someone asking me about this awhile back.
Try adding Class.forName("org.sqlite.JDBC"); before you attempt to initiate a connection.
because this ^ is already on the code

#

the only way to fix this is set minimizeJar to false, but that will make the file size be like 8MB

errant python
#

Why are you trying to minimize it?

#

As is why do you need it to be 2 MB smaller.

languid pewter
#

to upload the api to spigot

#

the file size limit is 5mb

errant python
#

Try using something along the lines of:

            <configuration>
                <minimizeJar>true</minimizeJar>    
                <filters> 
                    <filter>
                       <artifact>sqlite:sqlite</artifact>
                       <includes>
                           <include>**</include>
                       </includes>
                    </filter> 
                    <filter>
                       <artifact>Something-else:Something-else</artifact>
                       <includes>
                           <include>**</include>
                       </includes>
                    </filter>                      
                </filters>
            </configuration>
languid pewter
#

I'll try it

errant python
#

In this case you need to change it up a bit. But the code concept works.

languid pewter
#

ok

errant python
frigid ember
errant python
#

@frigid ember Talk me through your problem.

frigid ember
#

I'm trying to make hypixels crafting, so I spawn a fake player but open a workbench for it, so that I can get the crafted result. But I don't know how to subtract the items I use from the inventory the real player has open. Is there any way that I can force a craft to happen or make the player click on an inventory they dont have open? @errant python if that makes any sense

errant python
#

Try explaining it another way please.

#

@frigid ember

frigid ember
#

Well I have what looks like this, except for when I click in the slot 24, I want the items in the 3x3 grid to dissapear as if the item is actually being crafted. I currently have it so that whenever items are added to the 3x3 gird, they are added to a workbench as well, so the result in slot 24 is the same as slot 0 of the workbench, but when I click on slot 23 I'm stuck on the part where I can get the items used in the recipe to be removed but leave the items not used

#

@errant python

languid pewter
#

maybe this.inventory.setItem(SLOT, null)?

#

I don't remember what is the exact method

frigid ember
#

I think that would just set the result to air, but I'm trying to remove only the items in the 3x3 grid of the chest gui and workbench gui

errant python
#

this.inventory.setItem(SLOT, null) :: If this wroks just loop through those slots.

frigid ember
#

I don't want to remove items not used in the recipe though

languid pewter
#

then remove the specific amount

errant python
#

12, 31

frigid ember
#

How would I get the specific amount?

languid pewter
#

this.inv.getItem(slot).setAmount(amount);

frigid ember
#

Yeah but how would I get the amount from the recipe?

errant python
#

Or remove the itemstacks

#

It you have 12 blocks and an item-stack of 6 it'll take 6 blocks

frigid ember
#

Well I mean if I have a recipe like this
I want to keep the extra wood in the inventory

languid pewter
#

yeah, like this:
@frigid ember

ItemStack item = this.inventory.getItem(slot);
item.setAmount(item.getAmount()-1);
this.inventory.setItem(slot, item)
#

do that with a loop through the slots of the crafting table

frigid ember
#

No, that wouldn't work as intended

errant python
#

How so?

#

@frigid ember

dusty topaz
#

would set to 0 for instance

errant python
#

eclipse is booting up

dusty topaz
#

not remove

frigid ember
#

Some recipes require more than 1 item in the slot

errant python
#
player.getInventory().contains(Material.ENDER_PEARL
consumeItem(player, 1, Material.ENDER_PEARL
timid wagon
#

Maybe I can get answered now, this is about my 3rd time asking this. Where is the logic for Water pushing minecarts?

errant python
#
public boolean consumeItem(Player player, int count, Material mat) {
        Map<Integer, ? extends ItemStack> ammo = player.getInventory().all(mat);
        int found = 0;
        for (ItemStack stack : ammo.values())
            found += stack.getAmount();
        if (count > found)
            return false;
        for (Integer index : ammo.keySet()) {
            ItemStack stack = ammo.get(index);
            int removed = Math.min(count, stack.getAmount());
            count -= removed;
            if (stack.getAmount() == removed)
                player.getInventory().setItem(index, null);
            else
                stack.setAmount(stack.getAmount() - removed);
            if (count <= 0)
                break;
        }
        player.updateInventory();
        return true;
    }
#

Here is some of the code from my plugins @frigid ember, you should be able to repurpose it.

frigid ember
#

How would I determine how many of each block the recipe requires in each slot?

#

Thats the part Im having trouble on

languid pewter
#

if(){}?

#

if(material == Material.STONE){ /*Do some code stuff */ }

errant python
#

@frigid ember Saved templates that it attempts to match?

frigid ember
#

Yeah I understand if statements, I don't know how to get the amount required in a recipe

#

@errant python wdym saved templates?

languid pewter
#

in config.yml

errant python
#

@languid pewter Yes or saved arrays.

languid pewter
#

create a path like:

Crafts:
  MyCraft:
    - 'MATERIAL:AMOUNT;MATERIAL:AMOUNT;MATERIAL:AMOUNT'
    - 'MATERIAL:AMOUNT;MATERIAL:AMOUNT;MATERIAL:AMOUNT'
    - 'MATERIAL:AMOUNT;MATERIAL:AMOUNT;MATERIAL:AMOUNT'
errant python
#

@frigid ember You could have a bunch of valued arrays that it runs against. Ones that match materials and amounts get run.

languid pewter
#

@errant python about my issue with sqlite, im still having troubles:

frigid ember
#

I was trying to avoid that, I did that in the older version but I want it so that if a custom recipe from another plugin registers you won't have to add it to the config in this plugin

errant python
#

@languid pewter Its your maven filtering.

#

@frigid ember What format do other plugins use?

languid pewter
#

@errant python I'm using this filter:

<filter>
  <artifact>org.slf4j:sqlite-jdbc</artifact>
  <includes>
    <include>**</include>
  </includes>
</filter>
errant python
#

SCREAMS XD

#

Yes but no

languid pewter
#

I tried with: org.sqlite:sqlite

#

org.sqlite:sqlite-jdbc

#

org.xerial:sqlite

errant python
#

Try just sqlite.

languid pewter
#

org.xerial:sqlite-jdbc

#

I'll try it

frigid ember
#

@errant python they register the recipes through bukkit

languid pewter
timid wagon
#

Does anybody know where the water logic for pushing minecarts is located?

errant python
#

@timid wagon To do what?

timid wagon
#

Well I'm trying to fix a plugin that makes minecarts link together and the way it works is that it converts all minecarts to their own minecart, and there is a bug with the converted minecart not being pushed by water.

balmy sorrel
#

Hi, I hope you can help me, I am making a plugin (my first plugin) and something has happened, the commands I have made do not work, before they did and now they do not, esot tells me when I enter Eclipse, I am Spanish and I speak Spanish If you do not understand something, I will explain without problem what it means

errant python
#

@languid pewter
Another example:

<filters>
  <filter>
    <artifact>junit:junit</artifact>
    <includes>
      <include>org/junit/**</include>
    </includes>
    <excludes>
      <exclude>org/junit/experimental/**</exclude>
    </excludes>
  </filter>
</filters>
#

Hope thats more consise.

languid pewter
#

ok, thanks

errant python
#

@timid wagon Ok, just a moment.

#

@balmy sorrel Your making a plugin in node?

timid wagon
#

Alr, just ping me

balmy sorrel
#

What does that mean? Sorry, I'm new :( @errant python

errant python
timid wagon
#

Alright will do, I'll let you know how it goes.

errant python
#

Cross-reference this code: if(entity.getLocation().getBlock().getType().equals(Material.WATER) || entity.getLocation().subtract(0,1,0).getBlock().getType().equals(Material.WATER)){

#

@timid wagon

#

@balmy sorrel What are you coding your plugin in? (And don't worry about it 🙂

timid wagon
#

Where'd you find that

errant python
#

Mine carts are entities.

#

@timid wagon Lmk if that helps you 🙂

#

@balmy sorrel My dude! Whatcha coding you plugin in?

timid wagon
#

Not really helping me :/

errant python
#

Or at least how are incorperationg node.js into your plugin?

balmy sorrel
#

@errant python Sorry, I don't know :(

errant python
#

Could you drop you code in DM's?

frigid ember
#

I'm not sure if minecarts are pushed in water like other entities however

languid pewter
#

@errant python do you know what can I exclude from sqlite?

#

because including all just put me at the start

errant python
#

...

#

@languid pewter I do not. Maybe exclude some of the imports your not using??

languid pewter
#

I have minimizeJar enabled, all that size come from sqlite

errant python
#

@languid pewter I do not. Maybe exclude some of the imports your not using??
@errant python

languid pewter
#

without sqlite I have 800KB

errant python
#

You'll need to exclude the aspects of SQLITE your not using.

languid pewter
#

But I'll see what I can do

#

Ok

errant python
#

Ok man, maybe try <artifactId>sqlite-jdbc:sqlite-jdbc</artifactId>

#

@languid pewter

languid pewter
#

for the filter?

errant python
#

Yeah

languid pewter
#

I found it, its org.xerial:sqlite-jdbc

errant python
#

Idk if thatll work but its worth a shot

languid pewter
#

do you know if bungee have implemented sqlite inside the jar?

errant python
#

I do not.

languid pewter
#

because I was seeing that spigot is

#

ok

errant python
#

Sorry :/

languid pewter
#

NP

strange grove
#

does anyone know how to access something in another public void class?

#

it would rly help!

frigid ember
#

depends what you are trying to access

#

but if its something like a local variable, make it into a field

primal nymph
#

does anybody know the best way to hide your numeric server ip(not the domain one) from the public....???

strange grove
#

@frigid ember how so?

frigid ember
#

well i can't really determine unless i have an example of your code

strange grove
#

well

frigid ember
#

also @frigid ember use Bukkit.dispatchCommand()

strange grove
#

it's not exactly mine

#

i'm piggy backing off itr

#

so

frigid ember
#

can't really help if i don't have an example

strange grove
#

well

#

im trying to get

#

name

#

and i'm trying to put it into a hash map

#

and when it goes into this hash map

#

it will dispense the name of the img somewhere else

#

`public void ImgCommand(final CommandSender sender) {
if (sender instanceof Player) {
Player player = (Player) sender;
World world = Bukkit.getServer().getWorld("world");
Location l = player.getLocation();
Collection<Entity> nearbyEntities = l.getWorld().getNearbyEntities(l, 8, 8, 8);

    }
}`
iron trellis
#

hello

strange grove
#

public void ImgCommand(final CommandSender sender) {
if (sender instanceof Player) {
Player player = (Player) sender;
World world = Bukkit.getServer().getWorld("world");
Location l = player.getLocation();
Collection<Entity> nearbyEntities = l.getWorld().getNearbyEntities(l, 8, 8, 8);

    }
}```java
iron trellis
#

minigameslib isnt working

strange grove
#

dang it

frigid ember
#

@frigid ember something like Bukkit.dispatchCommand(getServer().getConsoleSender(), "say hi");

#

@strange grove what's the code for the method you are trying to get the name from

strange grove
#

well it is very long!!!!

#

are you sure you want it?

iron trellis
#

i need help

frigid ember
#

send it in pastebin then

#

or something

strange grove
#

`if (plugin.frameManager.doesFrameExist(name)) {
sender.sendMessage(MESSAGE_LOADER.getMessage("create.error.exists", "create.error.exists"));
return;
}``

#

nvm

#

I think i found irt

#

i pressed ctrl

#

and pressed my mouse on name

#

it took me to the top of the method

#

so yeah

#

and this is what I get it

frigid ember
#

so what exactly are you trying to access

strange grove
#

the name of the img

#

and when i get that name

#

im going tell the player if it is near

#

because it would identify it and tell me where it is what it is

#

and It comes from item frames

#

so I want to do

frigid ember
#

ok but where is it in the code

strange grove
#

the name of the img

#

it's right up there ^

frigid ember
#

yes

strange grove
#

I held ctrl

#

and that was the source of it

#

this is not exactly my code as I stated earlier

#

I want to edit for personal use on my server

#

and i'm tweaking it

frigid ember
#

so basically you want the name in plugin.frameManager.doesFrameExist(name)

strange grove
#

yeah

#

I wnat the name of the img

#

coming from the itemframes

frigid ember
#

you'll have to find where the name is declared

strange grove
#

and the ability to detect that specific image

#

and i'm using a

#

hash map to store this

#

and give it to the other public void

#

I can show you that cod e too if you like

frigid ember
#

@frigid ember the string is supposed to be a command

strange grove
#

``HashMap<String, String> imgname = new HashMap<String, String>();`

frigid ember
#

i used "say hi" as an example since it runs /say hi

strange grove
#

just a sec

#

gtg eat

#

brb

#

plz stay in the chat

#

🙂

frigid ember
#

if you're running it in the join event you can just get the player from the event

#

yes

coarse shore
#

.getName()

buoyant path
#

Does anyone mind helping me with creating a pathfinding goal and using it for certain players? I also need help using the EntityMetadata packet, im not using ProtocolLib because I need it to be standalone for better editing

frigid ember
#

it would be event.getPlayer().getName() but yes

minor spruce
#

not a spigot question, but how do i use java 14? i installed it but when i use java -version it still says im using java 8

frigid ember
#

code?

#

event.getName grabs the event's String field "name"

#

show us more code.

#

You forgot 1 implementation.

#

I'm not gonna spoon feed you it.

#

You forget to implement 1 thing.

#

What could it possibly be?

#

🤔

#

also remember to space out the command

#

What are you trying to replicate exactly?

#

and or accomplish; restricting players from joining the server?

#

If you wish to restrict players from connecting there's a special Event for just that, ever hear of anything that starts with Async?

#

and ends in Event

#

Kicking a player on join still allows them to join for a split tick; than kicks them a tick after join.

#

It is poop.

#

Skript is frowned upon by majority.

#

Learn Java, I was in your shoes a few years ago I know how it feels.

#

But spoon feeding isn't the way.

#

really the only good thing it is for is prototyping what you can do in java

strange grove
#

k im back!

#

@frigid ember

frigid ember
#

ok

strange grove
#

so I want to have tha hash map get the name what do I do ?

frigid ember
#

where is the name declared

strange grove
#

it is declared in a class called commands

#

and it is also declared

#

in the command

#

almost on the very top

#

in the afcreate command

#

taking the args

#

and giving it to name

#

well the first args

#

or the 0th

#

in computer programming

#

rihgt?

frigid ember
#

why cant you just put it in the hashmap directly

strange grove
#

how so?

#

elaborate plz

frigid ember
#

such as map.put(name, otherobject);

strange grove
#

what would the other object be?

#

cause i know what name would be?

frigid ember
#

whatever you are trying to store in the hashmap

strange grove
#

then it would be a string correct?

#

because i want to get the name

frigid ember
#

yes

strange grove
#

ok

#

lemme try this

frigid ember
#

hashmap is 2 values, it would be String and something else

#

so you can store the name and some other object

strange grove
#

so something like this? imgname.put(name,String);

#

the only problem is it's underling the string in red

frigid ember
#

what 2 objects are you storing in the hashmap

strange grove
#

and i'm not sure if I did it right or just plain stupud

#

well

#

a String

#

and another String

#

HashMap<String, String> imgname = new HashMap<String, String>();

#

see?

frigid ember
#

so it would be map.put(name, "anotherstring");

#

something like that

strange grove
#

is that the way you would go about it?

#

wait then what would the other string be?

#

cause i already put name

#

and

frigid ember
#

i honestly don't know what you are trying to accomplish so i cant say what way i would do it

strange grove
#

I see what you're saying

frigid ember
#

and you tell me, you chose a hashmap so you must have 2 strings to store

strange grove
#

well

#

i was stupid

#

didn't realize that

frigid ember
#

if you only need the name i would go with an arraylist

strange grove
#

how do I do that

#

instead of string ArrayList?

#

just put it there?

#

that's it?

frigid ember
#

well instead of declaring a hashmap and doing map.put

strange grove
#

that's it

#

so

frigid ember
#

you would make a string arraylist and do list.add

strange grove
#

imgname.put

#

that;'s it?

#

can you give und example

frigid ember
strange grove
#

so something like this ?

#

ArrayList<String> imgname = new ArrayList<String>();

#

ArrayList<String> imgname = new ArrayList<String>();

frigid ember
#

yes

strange grove
#

ok

frigid ember
#

and then you add the name to it

strange grove
#

imgname.get(name); ?

#

imgname.add(name);

#

like this?

frigid ember
#

yes

strange grove
#

it asked for a string

#

so this ones the right one correct?

frigid ember
#

the string is the name

#

yes

strange grove
#

good

#

many thx skeagle

frigid ember
#

np

strange grove
#

I know this is hassle for people like

#

u

#

the smart guys

#

🙂

#

tryign to answer everyones questions

#

gl

#

thx man

#

again many thx

#

I will pester you again if I have problems

#

🙂

frigid ember
#

glad i was able to help, gl on your project 🙂

strange grove
#

well it will

#

work

#

hopefully

#

🙂

errant python
#

@frigid ember Did someone help you?

#

Just making sure 🙂

#

I saw your question:

Sooo...
How do I execute a console command, if a player joins the server (I can't find any tutorials x_x)?
@frigid ember

#

Wait... What XD

#

Alright glad to hear it 🙂

pastel igloo
#

is there a gamerule to autosmelt?

errant python
#

@pastel igloo No...

pastel igloo
#

oh

#

ty

errant python
#

Np!!

strange grove
#

@frigid ember

#

I need help!'

#

and i'm in need of your services!

#

actually that's the same thing but whatever

#

anyway here's my problem

#

I think it does not know what i'm talking about

#

I can show you the code

#
@Command(name = "ImgName",
            aliases = {
                    "In",
                    "ImageName",
                    "ImageNameDetector"
            },
            usage = "/ImgName",
            fallbackPrefix = "animatedframes")
    public void ImgCommand(final CommandSender sender) {
        if (sender instanceof Player) {
            World world = Bukkit.getServer().getWorld("world");
            for(Player player : Bukkit.getServer().getOnlinePlayers()) {
                Location l = player.getLocation();
                for(Entity entity : player.getNearbyEntities(5, 5, 5)) {
                    if(entity instanceof ItemFrame) {
                        ItemFrame itemFrame = (ItemFrame) entity;
                        if (entity == imgname){
                            player.sendMessage(ChatColor.BLUE + "This is " + imgname + ".");
                        }

                    }
                }
            }

        }
    }
#

@anyone?

heady geode
#

So people, any chance someone knows a txt file or a source that can help me transtale the fields of the nms packet classes for 1.8.8 and 1.7.10 mc server

#

Like
PacketPlayInFlyingPacket field a

PacketPlayInFlyingPacket field onGround

#

Like if maybe there exists a changelog file containing that info

#

I know there exists mapping for that for 1.15.2 but there were changes to packets since these versions and I cant really afford to do mistakes with what Im making

dusty topaz
#

You can find the official mojang mappings for latest publicly

#

not sure if they exist for 1.7.10 though

errant python
#

I need help!'
@strange grove

#

You need to be more specific and concise.

#

@heady geode You may be able to look at older version's of Geyser.

heady geode
#

Geyser? 🤔

errant python
#

Its for translating bedrock packets to java packets for cross platform play.

#

It may go back to 1.7

#

Its been around for awhile so, id take a look at that.

heady geode
#

Oh I see, it may like have the packet classes translated to their original names and not obfuscated ones?

errant python
#

Yes.

heady geode
#

Well tnx I'll take a look

errant python
#

Hope its helps!

heady geode
#

Seems like I cant find packet classes in the geyser repo

frigid ember
#

?

errant python
#

@heady geode Im sorry to hear that :/

heady geode
#

Hmm, maybe mcp contains obfuscation mappings for the server

#

Not only for the client

frigid ember
#

import spigot nms 1.15

#

then type

#

net.minecraft.server.v_1_15_R1.PacketPlayInUseEntity for example

frigid ember
#
Caused by: java.util.ConcurrentModificationException
    at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1561)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at net.frozenorb.bridge.Bukkit.Profiles.Profile.getActiveGrants(Profile.java:59)
    at net.frozenorb.bridge.Bukkit.Profiles.Profile.refreshCurrentGrant(Profile.java:145)
    at net.frozenorb.bridge.Bukkit.Profiles.Profile.importSettings(Profile.java:55)
    at net.frozenorb.bridge.Bukkit.Profiles.Profile.lambda$new$0(Profile.java:46)
    at net.frozenorb.bridge.Bukkit.MongoManager$6.run(MongoManager.java:233)
``` ?
chrome lark
#

net.frozenorb.bridge.Bukkit.Profiles.Profile.getActiveGrants(Profile.java:59)
Whatever that is did a dumb by tryna access something that was being modified

frigid ember
#

how could i stop it then if its being accessed?

#

because it be doing the dumb alot

chrome lark
#

We'd need to see code

#

But, quite simply, don't modify something that you're iterating

frigid ember
#
        return grants.stream().filter(Grant::isStillActive).sorted(Comparator.comparingInt(o -> o.getRank().getPriority())).collect(Collectors.toList());
#

is line 59

chrome lark
#

So, something modified the contents of grants, probably; need to ensure that that can't happen

gleaming helm
#

Frozen orb skid?

frigid ember
#

The owner askedd idk lol

gleaming helm
#

Tell me I’m not the only one who’s noticing a clear IP rights violation

#

Funny thing is

#

That's not even a real FO plugin

#

That's a shitty remake made by a dude named C0an

frigid ember
#

what is this?

gleaming helm
#

😐 I think you know exactly what it is

frigid ember
#

Not really just know the link says "skid bin" lol...

gleaming helm
#

I don't help people who illegally attempt to profit off of other people's work

frigid ember
#

yea he just asked me to get it to work i didnt ask anything...

gleaming helm
#

Got that link from a friend after sending your laughable request for help

frigid ember
#

but exactly is the link meant for?

gleaming helm
#

It's a link to an explaination and a zip download of the rest of the remade FO plugins

#

Which includes the original to the one you're skidding

#

Which, as explained above, isn't even a real FO plugin

#

It's a shitty remake

frigid ember
#

The links on it doesnt even work lol...

#

whats the point in sending him that if it doesnt even work

gleaming helm
#

Look my point is that you shouldn't be copying other people's work without credit

#

That's actually against the law in most places, and it's almost certainly against any kind of licensing agreements.

frigid ember
#

i was never told who it was by i was just told to fix something for him and thats it lol..

#

but what he really wants is just the original plugins

gleaming helm
#

The plugins you're copying aren't the originals

#

They're remakes

#

😐

frigid ember
#

yea, i figured that out after you told me, but he just wants something like originals or originals

pure pasture
#

Hey guys is there a way to set the ID of a Task?

bronze marten
#

with bukkit api no

pure pasture
#

Cause' I have the problem that I send an Actionbar every few ticks(Custom Health) and I have to cancel the Task that sends it to send it aigain so it's refreshed

fleet crane
#

?xy

worldly heathBOT
bronze marten
#

you can just store the id of the task

#

you dont need to set the id for the task

pure pasture
#

I tried that

bronze marten
#

wdym you tried

pure pasture
#

Doesn't work

bronze marten
#

eh

pure pasture
#

I already tried getting the ID but it doesn't cancel it for some odd reasom

fleet crane
#

Chances are that's an issue with your code

#

Don't know why setting the id would somehow help you cancel the task regardless

bronze marten
#

^ xd

pure pasture
#

Idk

#

Just wanted to try it out

fleet crane
#

You may also want to look at BukkitRunnable that makes cancelling easier by storing the id for you

pure pasture
#
public static void cancel() {
                Bukkit.getScheduler().cancelTask(taskToCancel);
            }
bronze marten
#

why is it static?

#

seems like youre using an instance variable, not really nice to do that statically

pure pasture
#

It's static so that I can call it from other classes

bronze marten
#

why not keep a reference to that class where you instantiate the task?

pure pasture
#

?

hollow thorn
#

how do i get if a mob is hostile

torn robin
#

get its target probably

#

dont use static for that reason Trixone

pure pasture
#

But how can I call it from other classes if don't use static?

torn robin
#

store a reference to the class' instance in the main class probably

pure pasture
#

The Id#

#

or what?

torn robin
#

or the id sure

#

OOP

#

google

#

private class Class {}

public onEnable(){
timer = new Class();
}

public Class getClass(){
return timer;
}

#

so you'd get the class using the plugin's instance

#

instead of just having it be static

#

that way you can have multiple Timer classes if you want going at once

bronze marten
#
public class MyClass() {
    private int taskToCancel;
    ...
    public MyClass() {
        taskToCancel = //Your task id here etc
    }
    ...
    public void cancel() {
        Bukkit.getScheduler().cancelTask(taskToCancel);
    }
}
public class MyOtherClass() {
    public void method() {
        MyClass m = new MyClass();
        m.cancel();
    }
}
torn robin
#

and each would handle their own timer individually

#

^

pure pasture
#

Thanks I will try it

hollow thorn
#

get its target probably
@torn robin i mean any mob that can be catagorised as a hostile

torn robin
#

Monster extends LivingEntity i believe

#

si

#

Blaze, CaveSpider, Creeper, Drowned, ElderGuardian, Enderman, Endermite, Evoker, Giant, Guardian, Husk, Illager, Illusioner, PigZombie, Pillager, Raider, Ravager, Silverfish, Skeleton, Spellcaster, Spider, Stray, Vex, Vindicator, Witch, Wither, WitherSkeleton, Zombie, ZombieVillager

#

slime isn't part of it because slimes are stupid

pure pasture
#

But how do I now start my task again?

#

It's fine I figured it out

#

Doesn't work

#

For some odd reason it doesn't cancel the task

undone narwhal
#

You've to write a new BukkitScheduler#runTask...

pure pasture
#

?

#
public void SendActionBar(Player p) {
        actionbar = this;
            taskToCancel = Bukkit.getScheduler().scheduleAsyncRepeatingTask(Main.getMain(), new Runnable() {
                int hp = Main.yamlConfiguarationhealth.getInt(p.getUniqueId().toString());
                int def = Main.yamlConfiguarationdefence.getInt(p.getUniqueId().toString());
                int currenthp = Main.yamlConfiguarationcurrenthp.getInt(p.getUniqueId().toString());
                @Override
                public void run() {
                    Main.sendHealth(p,"        §c"+ currenthp + "§f/§c" + hp + "❤                    "  + "    §a   "+ def + "✸          ");
                }
            }, 0, 20L);
        }
undone narwhal
#

If you want to restart it, then just call your SendActionBar method again

#

it will restart it and update the task id

pure pasture
#

Yeah that's not the problem

#

It doesn't cancel it for some reason

undone narwhal
#

Ohwww

#

Do you start more than one task?

pure pasture
#

Yes

undone narwhal
#

Cause if you start two task, one will lost it's id because your taskToCancel is updated when you launch a new one

pure pasture
#

ohhhh shiiiii

#

What could I do about that?

#

You know before I just used to cancel every single Task that is running in the plugin

#

And then restart every single one of them

#

But that's probably not the best thing you could do for Server Performance xD

undone narwhal
#

You should save a taskId for each player

#

You have to choices: - use a map with key UUID and value TaskID

  • create a player object which takes in parameter taskId (you can then implement a start method which check if there is no running task, if there is one it can stop it before launching a new one)
pure pasture
#

What Map a Hasmap?

#

I mean I guess

#

xD

undone narwhal
#

HashMap, ConcurrentHashMap

#

Choose the best one for your case

pure pasture
#

But how do I get a new TaskID for every single Task without overwriting the others?

undone narwhal
#

int taskID = Bukkit.getScheduler().scheduleAsyncRepeatingTask()...
yourCoolPlayerMap.put(player.getUniqueID(), taskID)

#

Then to get it: yourCoolPlayerMap.get(uuid goes here)

#

HashMap<UUID, Integer>

pure pasture
#

Yeah but the TaskID but be the same for every player

undone narwhal
#

What do you mean?

pure pasture
#

Am I stoopid?

undone narwhal
#

No, you're just confused

pure pasture
#

Yeah probably xD

undone narwhal
#

Each time you call sendActionBar, it creates a new task for that player right?

#

Then each time you call this method it will creates a new taskID

#

And if you cant to stop it for a specific player, just stop the corresponding taskID

#

Cos each player will have one task

ashen stirrup
#

If you want to cancel the task within the method, use a BukkitRunnable so you can use this.cancel

pure pasture
#

I'm too stoopid to use my HashMap

#

I can't access it in the same class

#

I don't get why xD

#

I mean what the f

#
     public HashMap<UUID, Integer> taskToCancel = new HashMap<>();
#

That should be right?

undone narwhal
#

Right

#

now edit you sendActionBar method

tranquil aurora
#

how do I do like every 30mins it sends a message?

sturdy oar
pure pasture
#

Noice no I can't run my sendscoreboard method anymore what the hell

undone narwhal
#

Show it

pure pasture
#
public static SendActionBar actionbar;
    public SendActionBar() {
        actionbar = this;
        for(Player p : Bukkit.getOnlinePlayers()) {
            taskID = Bukkit.getScheduler().scheduleAsyncRepeatingTask(Main.getMain(), new Runnable() {
                int hp = Main.yamlConfiguarationhealth.getInt(p.getUniqueId().toString());
                int def = Main.yamlConfiguarationdefence.getInt(p.getUniqueId().toString());
                int currenthp = Main.yamlConfiguarationcurrenthp.getInt(p.getUniqueId().toString());
                @Override
                public void run() {
                    Main.sendHealth(p,"        §c"+ currenthp + "§f/§c" + hp + "❤                    "  + "    §a   "+ def + "✸          ");
                    taskToCancel.put(p.getUniqueId(), taskID);
                }
            }, 0, 20L);
        }
    }
sturdy oar
#

why is it Async

#

are you sure it can be done concurrently

pure pasture
#

Yeah

#

Why not

undone narwhal
#

omg ^^

#

Put your taskToCancel.put(p.getUniqueId(), taskID); in front of the task

#

not inside

#

What's your Main.sendHealth method?

sturdy oar
#

also writing asynchronously into an hashmap

#

doesn't seem a good idea

pure pasture
#

I can't put it in Front

undone narwhal
#

So after

#

But not inside

pure pasture
#

Yeah I did it now but the real problem is that I can't call the method anymore outside of this class

undone narwhal
#

Do you know what"static", "public / private", "instance" mean?

sturdy oar
torn robin
#

isn't there an ActionBar class that the spigot API provides

pure pasture
#

In what version

undone narwhal
#

Yes there is

#

New versions

torn robin
#

"new"

pure pasture
#

I'm in 1.9

sturdy oar
#

🤦

undone narwhal
#

Here we go again and again omg

#

What's your Main#sendHealth ?

pure pasture
#

To my defence I used to be in 1.8

sturdy oar
#

wow upgrading from 2014 code to 2015 code

pure pasture
#
 public static void sendHealth(Player p, String text) {
         ActionBarAPI.sendActionBar(p, text);
     }
#

And yes I tried doing it without an Api

undone narwhal
#

And what's ActionBarAPI#sendActionBar ?

torn robin
#

i assume a third party plugin

pure pasture
#

Yes

undone narwhal
#

Okay

#

Then I'm sorry but can't help

pure pasture
#

K I think the saving of the TaskID didn't work

#
public void cancel() {
            
                for(Player all : Bukkit.getOnlinePlayers()) {
                    int task = taskToCancel.get(all.getUniqueId());
                    Bukkit.getScheduler().cancelTask(task);
                }
                
            }
#

That should be right for cancelling it shouldn't it

#

?

undone narwhal
#

Should be right

pure pasture
#

In the Console it says that int task = taskToCancel.get(all.getUniqueId());
is a null pointer exception

#

And to save it that should be right:

public void SendActionBar() {
        actionbar = this;
        for(Player p : Bukkit.getOnlinePlayers()) {
            
            taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getMain(), new Runnable() {
                int hp = Main.yamlConfiguarationhealth.getInt(p.getUniqueId().toString());
                int def = Main.yamlConfiguarationdefence.getInt(p.getUniqueId().toString());
                int currenthp = Main.yamlConfiguarationcurrenthp.getInt(p.getUniqueId().toString());
                @Override
                public void run() {
                    Main.sendHealth(p,"        §c"+ currenthp + "§f/§c" + hp + "❤                    "  + "    §a   "+ def + "✸          ");
                    
                }
                
            }, 0, 20L);
            taskToCancel.put(p.getUniqueId(), taskID);
        }
    }
undone narwhal
#

Write some debug somewhere

#

To see if each of your parts is correctly reached

pure pasture
#

K I see the problem but I don't really know what it is

open girder
#

Anyone know how to loop through all classes in a package and register them as listeners?

        this.getServer().getPluginManager().registerEvents(new Telekinesis(), this);
        this.getServer().getPluginManager().registerEvents(new Marksman(), this);
        this.getServer().getPluginManager().registerEvents(new InfernalTouch(), this);
        this.getServer().getPluginManager().registerEvents(new Spring(), this);
        this.getServer().getPluginManager().registerEvents(new StrayAspect(), this);
        this.getServer().getPluginManager().registerEvents(new IllusionAspect(), this);
        this.getServer().getPluginManager().registerEvents(new Slicing(), this);
        this.getServer().getPluginManager().registerEvents(new Dexterous(), this);
        this.getServer().getPluginManager().registerEvents(new Beheading(), this);
        this.getServer().getPluginManager().registerEvents(new Necrotic(), this);
        this.getServer().getPluginManager().registerEvents(new MagmaWalker(), this);
        this.getServer().getPluginManager().registerEvents(new Tectonic(), this);
        this.getServer().getPluginManager().registerEvents(new Evasion(), this);
        this.getServer().getPluginManager().registerEvents(new Succession(), this);
        this.getServer().getPluginManager().registerEvents(new Farmhand(), this);
        this.getServer().getPluginManager().registerEvents(new FragilityCurse(), this);
        this.getServer().getPluginManager().registerEvents(new Wisdom(), this);
        this.getServer().getPluginManager().registerEvents(new VampireAspect(), this);
        this.getServer().getPluginManager().registerEvents(new Leeching(), this);
        this.getServer().getPluginManager().registerEvents(new Instability(), this);

doesn't seem like good practice

torn robin
#

I personally register events per class

#

looks those are enchantments

#
public abstract class Enchantment implements Listener {
    public Enchantment(JavaPlugin plugin) {
        Bukkit.getPluginManager().registerEvents(this, plugin);
    }
}
#

and then you can make each enchantment extends Enchantment

#
public class Wisdom extends Enchantment {
    public Wisdown(JavaPlugin plugin){
        super(plugin);    
    }
}