#help-development

1 messages · Page 1898 of 1

patent horizon
#

i just want to grab the class what does the type correlate to

low temple
#

I think it allows you to determine the type at runtime without needing it to be defined in the called class

quaint mantle
#

ohhh

ivory sleet
#

Wally explain

low temple
#

Like the type doesnt need to be defined by the class for it to be able to be used

quaint mantle
#

ok

ivory sleet
#

Because thing is, when you create these type templates you cannot know about which type is passed

low temple
ivory sleet
#

Only the very minimum

quaint mantle
#

WOW I LEARNED SOMETHING NEW

patent horizon
#

in redlib, to load/save a config, you need to pass a class for the target like so: config.target(targetclass).saveDefaults().load();. i want to make a method so that i don't have to go through the steps of running that method and one other every time i wanna grab data from a config, so i just wanna pass a class and a file path

ivory sleet
#

file path?

patent horizon
#

in case i explained it bad, the target/targetclass thing does smth similar to the config interface you showed me conclure im pretty sure

ivory sleet
#

yeah

low temple
#

and you want "targetclass" to be the class correct?

ivory sleet
#

You should teach yourself generics

#

like the bare basics

patent horizon
#

i probably should

ivory sleet
#

Generics is eventually just object orientation at type level

#

and with a lot of inference

patent horizon
#

i've found that recently, my 3 years of primitive code is holding me back

ivory sleet
#

Which makes it hard to get a deeper understanding of

quaint mantle
#

bc I wanted to get a better understanding of nms

#

wasnt that hard

ivory sleet
#

I mean like fully understand everything of it, including stuff like reified types, type inference contracts etc

quaint mantle
#

I ment like

ivory sleet
#

and generic inheritance

quaint mantle
#

the VERY basics

ivory sleet
#

(=

patent horizon
#

is there a video that explains it in a human way?

quaint mantle
#

no

#

there is only computer way

young knoll
#

I felt like I understood them

quaint mantle
#

lol

ivory sleet
#

What’s "human way" for you ?

quaint mantle
patent horizon
#

i dont think anyone really learns anything from the oracle docs without reading it over 7 times

quaint mantle
#

WOAH

young knoll
#

Then conclure brought out some made up words smh

quaint mantle
#

DO NOT READ THOSE

ivory sleet
#

lol

quaint mantle
#

learn from a video lol

low temple
#

the dude I linked explains everything in a great way

patent horizon
#

my dad tried shoving java down my throat back when i was like 10 through the oracle docs

ivory sleet
#

Yeah Wally, right now you just wanna get the gist of it, so that video is probably gonna suit you more or less

patent horizon
#

very sad moment in my life

young knoll
#

Use that one site that offers plugin development courses

#

Kek

ivory sleet
#

Lol

young knoll
#

What do javadocs taste like

muted quiver
#

Is morphia still used for Mongo or is it a no?

patent horizon
#

whys the man in the video doing Integer instead of primitive int

quaint mantle
#

because you have to extend a class

low temple
#

Cause you cant use primitives as types

quaint mantle
#

int is not a class

low temple
#

the input MUST extend Object

quaint mantle
#

integer is

low temple
#

aka it MUST be a class

quaint mantle
ivory sleet
#

I mean primitives got their classes

low temple
#

String is an example of a class, int/double/long/char are all primitives

#

Integer/Double/Long/Char are the classes for those primitives

paper viper
#

(aka wrappers)

ivory sleet
#

char.class or Char.TYPE exists

low temple
#

wrapper classes*

young knoll
#

int.class

quaint mantle
#

yes :)

paper viper
#

Lol

#

Integer.TYPE

quaint mantle
paper viper
#

better

#

Lol

young knoll
#

Wdym no

#

It exists

paper viper
#

yeah

quaint mantle
#

it exists but NO

#

lol

paper viper
#

I mean i prefer Integer.TYPE

#

lol

young knoll
#

Y E S

ivory sleet
#

Integer%TYPE just points to int.class, no?

paper viper
#

its the same thing but Integer.TYPE is fancier

quaint mantle
#

exactly

ivory sleet
#

🌞

quaint mantle
#

makes you look cooler

paper viper
#

i mean

#

if emily says to use it

quaint mantle
#

XD

paper viper
#

so

#

im gonna use it

#

lol

patent horizon
#

so my first question, in the video, the dude accesses the following code by doing Integer whatever = new IntegerPrinter(23). how does java know he's talking about the public IntegerPrinter(Integer whatever) method when he's just called the class?

young knoll
#

That’s a constructor

paper viper
#

Integer whatever = new IntegerPrinter(23)

#

wait what

ivory sleet
#

Wait watt

#

Yeah

paper viper
#

hold up

young knoll
#

Wait

#

What

paper viper
#

you cant extend Integer

quaint mantle
#

excuse me?

paper viper
#

right

#

XD

young knoll
#

Not with that attitude!

paper viper
#

its final right

patent horizon
#

wait no sorry

#

im just asking from memory

#

this is what he did

paper viper
#

yeah that makes more sense

#

Lol

young knoll
#

Yeah that’s a constructor

ivory sleet
#

It becomes new IntegerPrinter(Integer.valueOf(23))

#

Which matches the constructor

low temple
#

watch the video longer, he explains it

quaint mantle
#

it takes a int

young knoll
#

Woo autoboxing

#

That’s the word right

low temple
#

I think hes giving an example of the incorrect way to do generics then giving you an example of how to do it right

quaint mantle
#

what is that?

paper viper
#

why do you ever need to do Integer.valueOf tho

#

LMAO

patent horizon
#

yeah but say i made 2 almost identical methods that took in integers. if i made a new instance of the class and just passed 23 into the class constructor, how would java know which method to pick from?

ivory sleet
#

Idk

quaint mantle
#

exactly

low temple
ivory sleet
#

Probably never pulse

low temple
young knoll
ivory sleet
#

Their signature will have to be slightly different

young knoll
#

Wait what happens if you have 2 identical methods one taking int and one taking integer

patent horizon
#

oh so the method that's the same as the class name is it's constructor?

quaint mantle
#

polymorphism?

#

I think that is the word

ivory sleet
#

Const(int) vs Const(Integer) (given both exists)
if you do new Const(1) Const(int) is used
if you do new Const(Integer.valueOf(1)) Const(Integer) is used

paper viper
#
int num = 5;

System.out.println(num + "") enjoyers 
VS
System.out.println(String.valueOf(num)) enjoyers
patent horizon
young knoll
#

Ah okay so it would use the corresponding overload

#

Fair enough

patent horizon
paper viper
#

what

#

you cant do that

ivory sleet
paper viper
#

its a primitive

quaint mantle
#

exactly

low temple
#

Interger.valueOf(num).toString();

paper viper
#

unless you make it Integer

patent horizon
#

no for methods

paper viper
#

Lol

patent horizon
#

that return

ivory sleet
#

Integer%toString

#

(=

young knoll
#

Are we using % now

#

What happened to #

ivory sleet
#

Hmm Idk what to use honestly

low temple
#

is used to signify the ending method in a thing right?

#

or is it just used for methods

ivory sleet
#

Like

is for javadocs

:: is for method references but doesn’t make a good job in differentiating static vs non static

#

% is sometimes used for static

#

So just went with that

fleet imp
#

I'm casting ItemMeta to SkullMeta and doing setOwningPlayer() and It's not setting the skull owner. Is there a different way to do it

patent horizon
#

im just gonna shutup an watch the video cus he just answered a question i asked ._.

paper viper
#

Some people use the following
String.valueOf (dot for static methods)
String#substring (# for non-static methods)

ivory sleet
#

Yea

low temple
#

would
object.someMethod().anotherMethod();
be
object.someMethod()#anotherMethod();
or
object#someMethod()#anotherMethod();

ivory sleet
low temple
#

got it

ivory sleet
#

but all three are different if you use pulse’s convention

ivory sleet
low temple
#

after setting the meta to skull meta

fleet imp
quaint mantle
#

can you show us the code?

#

nvm

fleet imp
#

ok well theres my issue

low temple
fleet imp
#

kk thx

quaint mantle
#

:)

ivory sleet
#

Unofficial

quaint mantle
#

oh

ivory sleet
#

I use method references because they are used in jeps sometimes

#

So more official than what pulse talked about

patent horizon
#

since primitive types dont work with generics

#

is there alternative objects for primitve types

ivory sleet
#

You’d use the boxed variants

patent horizon
#

like Boolean

quaint mantle
ivory sleet
#

Yes

quaint mantle
#

wow

low temple
quaint mantle
#

I haven't seen anyone like that

ivory sleet
#

Sadly I write Python and I enjoy it

young knoll
#

Banned

ivory sleet
#

🥲

low temple
#

non OOP languages 🤮

quaint mantle
ivory sleet
quaint mantle
#

yee

vocal cloud
#

?google the multitude of guides on this

undone axleBOT
young knoll
#

Look I still haven’t recovered from numpy

#

Like what the hell is array[;,0]

quaint mantle
ivory sleet
#

Lol

fleet imp
#

when I try to add a custom recipe, it doesnt appear in game

quaint mantle
#

oh your talking about...

#

nms

#

oh god

quaint mantle
#

opening...

#

intelliJ

low temple
#

did you try player.setCustomName(""); then player.setCustomNameVisible(true);?

fleet imp
#

lol thx

low temple
low temple
#

Ive never used that but I think that might be a way to do it

young knoll
#

It won’t work that way

#

Afaik

low temple
#

unfortunate

fleet imp
quaint mantle
fleet imp
#

like the recipe doesnt exist

low temple
fleet imp
quaint mantle
#
Bukkit.addRecipe();
low temple
#

it wont appear in the recipe list

fleet imp
#

oh... i did that

quaint mantle
#

bruh

low temple
#

thats all clientside

young knoll
#

Not true

quaint mantle
young knoll
#

Recipes are synced to the client

low temple
#

oh is it really? can u add it to the list with packets then?

fleet imp
#

how do i give a player a recipe

low temple
young knoll
#

Pretty sure it’ll already be in the list if you register it with Bukkit

quaint mantle
#

did you do something like this? ```java
ShapedRecipe sr = new ShapedRecipe(new NamespacedKey(this, "Gun"), is);
sr.shape(
"ADA",
"BEB",
"ADA");
sr.setIngredient('B', Material.BOW);
sr.setIngredient('D', Material.DIAMOND);
sr.setIngredient('E', Material.EMERALD);
sr.setIngredient('A', Material.ARROW);

    Bukkit.addRecipe(sr);```
young knoll
#

But not unlocked

quaint mantle
#

"is" is an itemstack

fleet imp
#

its a recipe to give players exra hearts

public class Main extends JavaPlugin {
    public static ItemStack heart;
    @Override
    public void onEnable() {
        
heart.getItemMeta().setDisplayName(ChatColor.RED+"Heart Fragment");
        Recipe r = new ShapedRecipe(new NamespacedKey(this, "heart_fragment"), heart).setIngredient('1', Material.OBSIDIAN).setIngredient('2',Material.NETHERITE_INGOT).setIngredient('3',Material.OBSIDIAN).setIngredient('4', Material.TOTEM_OF_UNDYING).setIngredient('5',Material.PLAYER_HEAD).setIngredient('6',Material.DIAMOND_BLOCK).setIngredient('7',Material.OBSIDIAN).setIngredient('8',Material.ENCHANTED_BOOK).setIngredient('9', Material.OBSIDIAN);
        r.getResult().setAmount(1);
        Bukkit.addRecipe(r);

    }
}
young knoll
#

Yeah that’s not how you recipe

fleet imp
#

oop

quaint mantle
#

yee

young knoll
#

You never defined a shape

fleet imp
#

... wat

quaint mantle
fleet imp
#

ohhhhhhhh

quaint mantle
#

eclipse theme on intellij I love it much <3

patent horizon
#

this right here explains my frustration with python:

fleet imp
#

lol sorry i had to

low temple
#

I do like how you can use commas for string separation in PyThon

quaint mantle
young knoll
#

If (!String)

#

Still cursed

ivory sleet
patent horizon
#

yeah logically it does, but in the sense of java behavior where the process of type conversion is very picky, it doesnt

#

python is too aloof i guess

#

i also dont like how it's indention sensitive

ivory sleet
#

That’s just a language semantic

quaint mantle
#

exactly

#

python is pretty pog when you get to know it :)

patent horizon
#

all fun and games until some shitty website shoves a zero-width character into a code snippet you copy pasted

ivory sleet
#

That could happen in java also

young knoll
#

Lol

low temple
#

hence why you dont just copy paste code

ivory sleet
#

^

quaint mantle
#

lol

low temple
#

unless its ur own obv

patent horizon
#

intelly jelly just needs a paste without formatting option like google docs

ivory sleet
#

Ye

paper viper
#

for spacing?

patent horizon
#

for ctrl v-ing code

paper viper
#

No like

patent horizon
#

for all characters

#

kinda like the .normalize() method

#

just scraps out any characters you wouldn't find on a keyboard

young knoll
#

Depends on what keyboard you have

low temple
#

thats kinda character-phobic man

quaint mantle
#

I must say...

low temple
#

zero-width character lives matter

patent horizon
young knoll
#

Poor non-English keyboards

patent horizon
#

i got a mac recently and the worst part about it is the fact that they replaced the ctrl key with a useless button that pops up the emoji keyboard

#

like they couldnt find a better place to put that

low temple
#

i hate mac keyboards

patent horizon
#

yeh

low temple
#

dont they replace the ctrl key with some tic-tac-toe looking bs

patent horizon
#

they call themselves a company for lifestyle-fitting devices and then go and screw over anybody whose used a keyboard before

low temple
#

code?

young knoll
#

Well then the command only has 1 arg

#

Or 0

low temple
#

args start at 0

young knoll
#

Arrays start at 0

patent horizon
low temple
#

so if i had a command like
"/command arg1 arg2"

#

arg1 would be args[0]

#

args.length would return 1 if the only arg is join

#

args.length has to equal 2 if you want another arg after join

young knoll
#

Yeah you probably want >= 1

low temple
young knoll
#

Since with that elseif it’s impossible for args[1] to exist

worldly ingot
#

It's not a terribly complicated API tbh. Just consists of 3 static methods. wordWrap() will wrap a string according to the specified width, and the paginate() methods will just give you a subsection of the string formatted more nicely that you can iterate over and send to the player

unreal quartz
worldly ingot
#

I should have @kind hatch on that one tbh

#

Habit to turn it off

patent horizon
#

is this correct?

young knoll
#

The British keyboard is weird

young knoll
#

They get an extra key

unreal quartz
#

What key

patent horizon
#

bo'l'o'wah'uh

unreal quartz
#

These? ' "

low temple
#

its meant to replace letters they dont pronounce

young knoll
#

Next to left shift

unreal quartz
#

The vertical bar

hasty prawn
worldly ingot
#

Yeah, that key is on the right for us ;p

#

Either above or to the left of enter

young knoll
#

But yeah they move stuff around and have an entire extra key

unreal quartz
#

Apple in their mighty wisdom thought a section symbol (§) was more important than a backtick and replaced it with that

young knoll
#

Which means if I switch my keyboard layout to British

#

I just can’t type | or \

unreal quartz
young knoll
#

Rip ~ and `

hasty prawn
#

Ah yes and the good ol plus or minus sign

low temple
#

isnt that the color code symbol for yml files?

hasty prawn
#

Very useful...

unreal quartz
#

Tilde and backtick are next to shift

young knoll
#

Yeah it’s the character minecraft uses for colors

#

Well, for legacy stuff anyway

fleet imp
#

my recipe still doesnt work

unreal quartz
#

The difference being that the shift and caps lock are symbols not written out

patent horizon
#

oh they just reloacted the ~

paper viper
#

Yeah

patent horizon
#

ah

young knoll
#

Wtf

#

Why think you are better than an international standard

#

Dangit Timothy cook

unreal quartz
#

Fortunately I'm used to switching between Apple's British layout and the actual British layout since the keybinds in macOS tend to be completely different anyway

young knoll
#

Oh no a British!

#

Run away

unreal quartz
#

You'll never take my tea away from me

#

(Even though I hate it)

young knoll
#

I only know one British person that likes tea

#

Wack

quaint mantle
#

tea is nice ngl lol

unreal quartz
#

Overrated

young knoll
#

I had just plain tea when I was there

#

Tasted like hot water that once saw a tea leaf pass by

quaint mantle
#

How can I load the plugins folder / great it without creating a config.yml rn I’m just using / wanted a data.yml

young knoll
#

Plugin#getDataFolder

quaint mantle
#

That creates it too?

young knoll
#

File#mkDirs

quaint mantle
#

K ty

young knoll
#

mkDirs is so weird

#

It’s much differently named compared to most methods

quaint mantle
#

Lol

fleet imp
#

@quaint mantle It's me again. My recipe matches your layout exactly but wont work

dry pike
#

Im working on a new project and have decided to take a look at design patterns to attempt to create code using best practices. Anyway I am creating a custom plant system that will require many PlantObjects to be tracked and continuously updated or tick()ed. Could anyone point me in the right direction for a pattern to help handle this. I started to use a PlantManager approach and loop through a list of plants and tick() each one of them but just thought I would take a look at a few other approaches. Any help is appretciated.

ivory sleet
#

I mean

#

The choice of design patterns very much depends on what exactly you’re trying to do

#

But for the ticking part, observer is probably what you want

#

And also facade for the api to interact with the observer system

#

Obv might wanna stick to static factory just to decouple instantiation and creation

#

But take a look at the behavioral ones

fleet imp
young knoll
#

The heck are all these patterns

#

What’s next, the toaster pattern

ivory sleet
#

Lol

ancient plank
#

🥔

dry pike
ivory sleet
#

Yeah, like it’s quite hard to tell you but generally

#

For implementations we talk about behavioral ones

#

For api designs and layering etc we use the structural ones

patent horizon
#
    public Class<?> getData(Class<?> target, String path) {
        ConfigManager config = ConfigManager.create(Main.get(), path + ".yml");
        config.target(target).saveDefaults().load();
        return target;
    }```
ivory sleet
#

That does not take a type

young knoll
#

PlayerData.class

patent horizon
#

ohh

ivory sleet
#

<T> T getData(Class<T> target,String path);

open current
#

When using the say command in console, the prefix is [Server]. Can I change this to something different?

quaint mantle
#

@fleet imp this is everything I have in my onEnable() and it works fine for me... if it doesn't work for you idk what I can do about that ```java
@Override
public void onEnable() {

    System.out.println("GUN PLUGIN IS ACTIVE... \n\n");

    for(int i = 0; i < 10; i++) {
        System.out.println("PLEASE READ THE PLUGIN PAGE BEFORE YOU PLAY THIS... THE ITEM IS ONLY OBTAINABLE BY CRAFTING!!! \n");
    }


    ItemStack is = new ItemStack(Material.GOLDEN_HOE);
    ItemMeta isMeta = is.getItemMeta();
    isMeta.setDisplayName(ChatColor.GOLD.toString() + ChatColor.BOLD + "Gun");
    isMeta.addEnchant(Enchantment.DURABILITY, 20, true);
    is.setItemMeta(isMeta);

    ShapedRecipe sr = new ShapedRecipe(new NamespacedKey(this, "Gun"), is);
    sr.shape(
            "ADA",
            "BEB",
            "ADA");
    sr.setIngredient('B', Material.BOW);
    sr.setIngredient('D', Material.DIAMOND);
    sr.setIngredient('E', Material.EMERALD);
    sr.setIngredient('A', Material.ARROW);

    Bukkit.addRecipe(sr);


}```
#

also @fleet imp have you tried making the item in the crafting table?

#

hold up

#

nvm

random epoch
#

Isn’t using system println not preferred over logger

fleet imp
#

no i think i see what i did

restive mango
#

[20:57:47 WARN]: Caused by: java.lang.NumberFormatException: For input string: "1642643863894"
[20:57:47 WARN]: at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)
[20:57:47 WARN]: at java.base/java.lang.Integer.parseInt(Integer.java:652)
[20:57:47 WARN]: at java.base/java.lang.Integer.valueOf(Integer.java:983)

#

Any idea why this is an error?

#

looks like an int to me

#

rofl

young knoll
#

Too big

restive mango
#

ah

#

go ddamn

young knoll
#

Use a long

restive mango
#

fuck

quaint mantle
#

i want to give an effect to a player while hes in x radius of a block. I have the code working and its on the player move event but what should i change it to since doing it on the playermoveevent is bad? should i make a while loop or smth

eternal night
#

most likely you'd schedule a task timer

quaint mantle
eternal night
#

that runs every x ticks

#

?scheduling

undone axleBOT
sterile token
#

?typing

forest edge
#

Does anyone know if it is possible to sort the player scoreboard (tablist) using packets? I would go with a teams approach, but I currently use teams for a clans plugin and would like to sort the board by rank/group instead of clan

ancient plank
young knoll
#

😳

ancient plank
#

don't be weird

young knoll
#

I’m more of a short actually

little elm
#

I might be misremembering here, but does Minecraft have a feature where you can draw a line from one point to another that is visible to the player?

#

I guess as a last resort, I can spawn particles going in a line

#

^ if I use this method, anyone have particle recommendations for this? LOL

young knoll
#

I think there might be something with the new debug stuff to do it

#

Not too sure, it would all be packet based at the least

quaint mantle
hexed hatch
quaint mantle
#

lets say i have a runnable that is set to run in like 4 hours. How can i make it so even if the server reboots etc it continues after the server starts back up / the timer resumes and doesnt just go away or restart

sterile token
#

If you will use it for players I dont recommend it

#

For player i will recommend using a Cooldown system + database

quaint mantle
sterile token
#

Cuz for doing that i think they are not used schedules. I think you use Timestamps

quaint mantle
sterile token
#

I wouldnt use runnables for that thing

#

The best way should be a timestamp

quaint mantle
#

Ah kk

#

How would I go about doing that

sterile token
#

I will link you to some information

quaint mantle
#

Kk

sterile token
#

Wait me i will translate it all

#

A timestamp is basically a number (a date) that is stored and used to perform actions. For example Litebans, when you get temporarily banned it creates a timestamp with the duration of your ban. And every time you go in he checks it.

quaint mantle
#

Ah Mk

dusk flicker
#

I generally just store the time when it should be undone as a long

dusk flicker
#

(aka in miliseconds)

#

as Java makes it easy with System.currentTimeMills or smth like that

quaint mantle
#

So should I just store the timestamp of when it should be removed in the data.yml with it and then check that where? In a runnable on startup every like 5 seconds or-

sterile token
#

I dont know how the people use it, but i use it in Mili-seconds and then for displaying it i have a Class for converting it to the format i want for example: seconds, hours, etc

quaint mantle
#

Kk ty

dusk flicker
#

Generally how I do it, is I store when it should expire, if they do a certain action like join etc I check if its past yet, if it is I remove whatever restrictions were placed on, I also have a update event running every 5 seconds so I just listen to that and do the same thing

young knoll
#

I think java has classes for formatting time

#

Not sure I’ve ever used them properly

quaint mantle
#

Kk ye so just make a runnable run every 5 seconds and check if the time has expired and if it has then run the function / remove it

dusk flicker
#

They might but I just wrote my own lol

quaint mantle
#

Easy enough ty

sterile token
dusk flicker
#

You dont prob need it every 5 seconds, but thats just what I do

#

Depends on the use tbh

quaint mantle
#

Ye Ik that I just sayin 5 as example

sterile token
#

For example when you set the location you set with it: the current milis + your expire time (millis). And then you check if the milis saved with your location its >= the current milis

#

That how i generally use it

quaint mantle
#

Ah what I was gonna do is set the expire time in millis so for example 12k then check every 5 seconds if the current millis is >= expiremillis

sterile token
#

I do a simple example

#
public class Timestamps {

    private Long start = System.currentTimeMillis();
    private Long end;

    public Timestamps(Long duration) { //Mili-seconds
        this.end = this.start + duration; 
    }

    public boolean hasExpired() {
        return System.currentTimeMillis() >= this.end;
    }

    public long getRemaining() {
        return this.end - System.currentTimeMillis();
    }
}```
#

There you have sir

vocal cloud
#

Could use a HashMap

quaint mantle
#

Ye kk that’s what I thought to do

#

Ty

quaint mantle
sterile token
#

I dont recommend using it

#

I recommend creating the timestamp when you set the location, and save it like:

location:
x: ""
y: ""
z: ""
time:

quaint mantle
#

Ye

sterile token
#

I dont recommend doing it on hashmap, cuz you will have to add it, then if server goes down. You should loop it, save the timestamps with each location. Its mess

#

Saving it directly to file its easy and more secure, cuz if server goes down its already saved

quaint mantle
#

Mhm

sterile token
#

But they are only recommendations

young knoll
#

Even better if you can make the saving async

sterile token
sterile token
young knoll
#

Sure if you need a callback if some kind

vocal cloud
#

Bukkit.getScheduler#runTaskAsynchronously#

sterile token
#

What do you use if you dont need a callback?

young knoll
#

A callback to inform you if the write fails though may be good

vocal cloud
#

Also if you're running a task say 5h later why are you writing to file so often?

#

Do a cycle write the next to a file.

sterile token
#

Can you explain why im getting the Remaning message sent 3 time like:

2 seconds left
2 seconds left
2 seconds left

1 second left
1 second left
1 second left

young knoll
#

I mean you don’t even print out in that code

young knoll
#

Where are you printing

#

Because the code you’ve shown us doesn’t send any messages, let alone 3 of them

sterile token
vocal cloud
#

Are you in a while loop?

sterile token
vocal cloud
#

Show code otherwise we're guessing here

sterile token
#

But i mean cuz if i create a debug like this:

public static void main() {
  Cooldown cooldown = new Cooldown("test", TimeUtil.format("1m"));
  if (cooldown.hasExpired()) {
    System.out.println(TImeUtil.parse("s", cooldown.getRemaining));   
  }
}
#

TimeUtil#parse(time char, milis) // Convert the long to the time char you want, if use seconds it will convert the long to seconds, and that with: hours, sseconds, etc

sterile token
vocal cloud
#

I mean that's an overly complicated solution to a very simple problem

sterile token
#

My cooldown class its really simplier

vocal cloud
#

They're storing it in a config file right?

sterile token
#

Im storing it on PlayerProfile (Java object) that its loaded all data from my MongoDB

rancid snow
vocal cloud
#

I imagine storing just a value for when the time is over is easier and requires less classes

sterile token
#

?

sterile token
#

LMAO

#

its only 1 class

#

Hahaha

#

I dont understand you some time

vocal cloud
#

Yes? You don't even need said class if you store just a value

#

So 1 less class

sterile token
#

The problem is that i cannot work out the class

#

If not i will have a mess then for convertir all the things, etc

vocal cloud
#

I'm extremely confused to what exactly you're storing and why

sterile token
#

Omg

#

I will explain

#

I a have player profile (Cuz its networking) where its has many data, and there its has a Set<Cooldown>.

#

All works great, the only thing is that when displaying the cooldown#getRemaning() its shown 3 times. Not only 1 time

vocal cloud
#

Doesn't do that for me

#

I assume this is an issue with when you call it

sterile token
#

Allright

#

So the message are not sent 3 time?

#

I think its an inssue while debugging with Java#main() method

vocal cloud
#

I'm extremely confused. There is no way that it's called 3 times it's impossible

sterile token
#

Like instead of sending:

Left 3 seconds
Left 2 seconds
Left 1 second

It send:

Left 3 seconds
Left 3 seconds
Left 3 seconds
Left 2 seconds
Left 2 seconds
Left 2 seconds
Left 1 second
Left 1 second
Left 1 second

#

Idk what happening

tall nova
#

R u just running it once

sterile token
tall nova
#

The main file

#

How are you running it? Do you just click on run or is there something external calling the method

sterile token
#

I do like this

maiden thicket
#

seems pretty interesting ngl

sterile token
#

When you execute a command im checking your profile, inside your cooldown if you have a specific cooldown. If you have it i send you back the message with remaning

#

If you are not on cooldown you execute the command, and then add again the cooldown to your profile

vocal cloud
#

It depends how you're parsing it

#

To me it seems like that's where you're getting the issue.

iron tundra
#

Issue: I am trying to make this recipe only work IF the Diamond used in the recipe has the model data of 1 but I can't seem to find a way to do this. If you happen to know of a method that I might be missing to parse in this information or require it, I would greatly appreciate it!

    private ShapedRecipe getCrownRecipe() {
        ItemStack item0 = new ItemStack(Material.DIAMOND);//Diamond Item
        ItemMeta meta0 = item0.getItemMeta();
        assert meta0 != null;
        meta0.setCustomModelData(1);
        item0.setItemMeta(meta0);//setting Item's Model Data to 1
        ItemStack item = new ItemStack(Material.GOLDEN_HELMET);//Crown Item
        ItemMeta meta = item.getItemMeta();
        assert meta != null;
        meta.setCustomModelData(1);
        meta.setDisplayName(ChatColor.GOLD + "Golden Crown");
        meta.addEnchant(Enchantment.LUCK, 10, true);
        meta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 10, true);
        item.setItemMeta(meta);//Pushing all the infomarion and setting the Model Data to 1
        NamespacedKey key = new NamespacedKey(this, "Custom_Crown");
        ShapedRecipe recipe = new ShapedRecipe(key, item);
        recipe.shape("   ", " G ", "BBB");
        recipe.setIngredient( 'B', Material.GOLD_INGOT);
        recipe.setIngredient('G', Material.DIAMOND);//issue line
        return recipe;
    }
young knoll
#

RecipeChoice.ExactChoice

#

Do note that requires the items to match perfectly, except for stack size

iron tundra
#

Thank you so much

pine island
#

?paste

undone axleBOT
pine island
#
org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.lumina.luminassw.LuminasSw'

at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:66) ~[spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at java.lang.Thread.run(Thread.java:823) [?:1.8.0_272]

Caused by: java.lang.ClassNotFoundException: me.lumina.luminassw.LuminasSw

at java.lang.Class.forNameImpl(Native Method) ~[?:1.8.0_272]

at java.lang.Class.forName(Class.java:408) ~[?:1.8.0_272]

at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

... 7 more```
sullen marlin
#

The named class is not in your plugin

pine island
#

hmm

#

do i just refactor it?

muted quiver
#

check your plugin.yml

#

and make sure the main class is correc.t

pine island
#

this is my main class

muted quiver
#

are you sure it is in that package?

pine island
#

i am

muted quiver
#

make sure maven is properly exporting the plugin.yml file.

pine island
#

how do i do that now

#
name: LuminasSw
version: '${project.version}'
main: me.lumina.luminassw.LuminasSw
api-version: 1.17
commands:
  buy:
    description: Gives kit with the argument of type
    usage: /<command> <kit type>
    aliases: [k]
#

nvm its 1.17 when it should be 1.8

muted quiver
#

send ur pom.xml

#

ah lol

pine island
#

was that the problem

muted quiver
#

idk

pine island
#

dint work

hardy swan
pine island
#

?paste

undone axleBOT
pine island
#

here is this

#

its the pom.xml

hardy swan
#

Show main class

pine island
#

1 sec

#
package me.lumina.luminassw;



import me.lumina.luminassw.comands.buy;
import org.bukkit.command.CommandExecutor;
import org.bukkit.event.Listener;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

final class luminassw extends JavaPlugin implements Listener {




    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Lumina's Easy SW was initialised successfully.... ");
        getServer().getPluginManager().registerEvents(this, this);
        getCommand("Cobble").setExecutor((CommandExecutor) new buy());



        }

    }



hardy swan
#

There

#

your class should be public, or at least having the same name as your file

pine island
#
package me.lumina.luminassw;



import me.lumina.luminassw.comands.buy;
import org.bukkit.command.CommandExecutor;
import org.bukkit.event.Listener;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

public class LuminasSw extends JavaPlugin implements Listener {




    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Lumina's Easy SW was initialised successfully.... ");
        getServer().getPluginManager().registerEvents(this, this);
        getCommand("Cobble").setExecutor((CommandExecutor) new buy());



        }

    }



hardy swan
#

You say that your main class is me.lumina.luminassw.LuminasSw but there isnt even such a class

#

Thats why it complained

pine island
#

is it good now?

hardy swan
#

Yes try again

pine island
#

alr ty

hardy swan
#

I have had read a user guide that says its main class is Main.java

pine island
#

i know

#

i forgot and now im too lazy

quaint mantle
#

Main.jora

pine island
#
[ERROR] Error occurred while enabling LuminasSw v1.0-SNAPSHOT (Is it up to date?)

java.lang.NullPointerException: null

at me.lumina.luminassw.LuminasSw.onEnable(LuminasSw.java:21) ~[?:?]

at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]

at java.lang.Thread.run(Thread.java:823) [?:1.8.0_272]

[INFO] Server permissions file permissions.yml is empty, i```
hardy swan
#

Ok great, a different message now, sign of progress

pine island
#

[ERROR] Error occurred while enabling LuminasSw v1.0-SNAPSHOT (Is it up to date?)

quaint mantle
#

wait

#

sus

#

ancient debris is still young compared to 1.8

pine island
#

wait what

#

is it trying to load ancient debries?!?

quaint mantle
#

no

#

im trying to say that 1.8 is just too outdated lol

hardy swan
#

That may lead you to the source of exception

pine island
#

what line u just replied to the whole thing

hardy swan
#

It is for you to find out

#

Where did the exception come from?

pine island
#

wym

hardy swan
#

Do you know what is a NullPointerException?

pine island
#

uh no

#

im really bad at debugging

hardy swan
#

It is a crucial part of software development

#

You may want to search up of java exceptions

lavish hemlock
#

Yeah I think it would help if you knew exceptions

#

They're a big part of Java's error-handling and the language itself

hardy swan
#

I think i can guess that you didnt have a command called Cobble

lavish hemlock
#

(Also understanding how to read stacktraces)

chrome beacon
#

I'm glad I already know Java

hardy swan
#

Oh what lol

lavish hemlock
#

Well a stacktrace is just a trace of all the methods that were called up until the exception, essentially.

hardy swan
#

My module asked for the categories of exceptions

#

At least

lavish hemlock
#

The top is the topmost method called, meaning the latest.

hardy swan
#

The direct "callsite"

lavish hemlock
#

Yeah

#

Fun fact: In Java 9+, stacktraces can be used to get the "caller method" efficiently

#

(e.g. what method called the method you're in right now)

#

It's not terribly important of a feature unless you're really strict about safety.

pine island
#

yoo its fixed i changed some small things

gentle oriole
#

is there anything that could help me find out if a player breaks their fall damage by water bucket mlging?

#

maybe falling velocity

#

getFallDistance() seem interesting?

#

but very informative...

frigid rock
#

guys i made a plugin that randomtps

#

this plugin gets a region and then if a player gets to that region, he randomtps

#

i made a structure, for that

#

a player needs to jump of a "big hole"

#

and then it tps him

#

but when it randomtps he dies from fall damage

#

idk if i explained it right

#

how can i disable that?

gentle oriole
#

tps is ticks per second?

#

not to be confused with teleports

#

ay no

frigid rock
#

teleports*

gentle oriole
#

setFallDistance

frigid rock
#

not tps

gentle oriole
#

setFallDistance(0)

frigid rock
#

playerteleportevent

#

?

gentle oriole
#

yeahh

frigid rock
#

okk

#

lemme try

gentle oriole
#

put that before it teleports the player

frigid rock
#

thanks, it works

modern vigil
frigid rock
#

yeah tried that but the setfalldistance its easier

#

thanks anyway

spare prism
#

Why is it deprecated to use the BaseComponent in the HoverEvent constructor? What should I use instead?

pine island
#
package me.lumina.luminassw.comands;





import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.Objects;



public class buy implements CommandExecutor {




    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {



        if (args.length == 0) {

            Player player = (Player)sender;
            if (player.isOp() == true){

                if (cmd.getName().equalsIgnoreCase("Kit")) {

                    if (args[0].equalsIgnoreCase("Insane")) {

                        player.getInventory().addItem(new ItemStack(Material.ENDER_PEARL, 64));

                    }

                }

            }
            else{
                player.sendMessage("Sorry but your not OP!");
            }

        }
        return true;
    }
}``` i made a command the command should work it dosnt throw a  error but dosnt give me 64 ender pearls when i run it
young knoll
#

You check it args are empty

#

And then try and get the first arg

pine island
young knoll
#

args.length == 0

pine island
#

dude args start with 0 not 1 lmfao

#

they are a array

gentle oriole
#

if args.length != 1

lavish hemlock
young knoll
#

args.length == 0 will only match if the args are empty

#

And then you check args[0] which won’t exist

pine island
#

hmm

#

i only need 1 arg

lavish hemlock
#

you need to do args.length == 1

#

which checks that there's 1 element in the array

gentle oriole
young knoll
#

Also player.isOp() == true hurts my brain

pine island
#

yeah

#

too lazy hahah

lavish hemlock
#

...for what? removing the == true?

#

it's a boolean, it doesn't need to be compared

pine island
#

yep

#

i know

lavish hemlock
#

I feel like removing is easier than adding though

gentle oriole
#
ItemStack[] empty = new ItemStack[]{new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR)};
                if (Arrays.equals(player.getInventory().getArmorContents(), empty)) {
``` Is there a better way to find out if player doesn't wear armor?
pine island
#

nope i dont think so

lavish hemlock
#

well

#

you could turn that empty array into a constant

#

e.g. private static final ItemStack[] EMPTY

#

so you don't have to recreate it over and over

young knoll
#

I feel like a loop is less code

#

Idk whether you’d consider it better

pine island
#

wait now im confused, the 1st item in the array is still 0 ?

young knoll
#

Yes

gentle oriole
#

loop is unnecessary for this i think

young knoll
#

I mean

#

It’s less code, idk if it’s faster

lavish hemlock
#

Actually Arrays.equals probably loops anyway

pine island
#

and making my if statement to 1 is just check that my array list hast atleast 1 item right?

young knoll
#

Yes

gentle oriole
#

now I need to think of a reason why the player should die if it equips armor... any suggestions?

lavish hemlock
#

one sec

private static final ItemStack EMPTY = new ItemStack(Material.AIR);

private boolean isArmorEmpty(Player player) {
    for (ItemStack stack : player.getInventory().getArmorContents()) {
        if (stack != EMPTY) return false;
    }
    return true;
}

// then you just use 'isArmorEmpty' in your if statement
#

This would be cleaner ^

#

Probably faster too since it can short-circuit.

#

(short-circuiting is when a condition ends as soon as it's proven to be false, e.g. if one piece of armor isn't empty, then we know the armor isn't empty, which reduces how many times we must loop)

gentle oriole
#

oh gosh, were now going into efficiency instead of simplicity

#

ok ill add it i guess

lavish hemlock
#

This is simpler.

#

At least, in my opinion.

#

It's easier to understand since you're using a method which details exactly what it does via the name.

pine island
#

efficiency is my nemesis

gentle oriole
#

yeah thats what I thought

lavish hemlock
#

It's nice if the code is both efficient and simple.

#

AKA the exact opposite of an enterprise codebase.

#

Actually wait I don't know if you'd even need to create that EMPTY itemstack...

#

you could probably just do stack.getType() != Material.AIR

gentle oriole
#

isnt getType a method and thus decreasing efficiency?

lavish hemlock
#

I mean they should be equal

pine island
lavish hemlock
#

It's a difference between an invokevirtual and getfield instruction

#

afaik they don't have much overhead compared to each other

#

so you should probably just go for the simpler option

#

here's a tip: don't care about micro-optimizations when you're working on Spigot plugins

#

micro-optimizations are only important within embedded systems and other memory/performance tight applications

gentle oriole
#

thats too much for my brain to handle. thanks anyways

young knoll
#

Spigot is very performance tight

#

One microsecond too long and the user will hunt you down

lavish hemlock
#

oh no

gentle oriole
#

hello!! block.getBreakSpeed(player); doesn't return 0.0 when player stopped breaking the blockkkk.....

quasi flint
#

Well because it is the modifier how fast he can break blocks

#

Like a higher value the faster he breaks the block

gentle oriole
#

it returns 1.0 when he finished breaking the block

quasi flint
#

And when he does nothing?

gentle oriole
#

something like 0.05 when just clicked the dirt

#

I have a delay of 70 ticks after the event fired

quasi flint
#

Why tho

gentle oriole
#
        if (enabledModules.get("PLAYER_BREAK_TOO_SLOW")) {
            Block block = e.getClickedBlock();
            if (block != null && block.getType() != Material.AIR) {
                scheduler.scheduleSyncDelayedTask(plugin, () -> {
                    float progress = block.getBreakSpeed(player);
                    System.out.println(progress);
                    if (progress != 0.0 && progress != Double.POSITIVE_INFINITY) {
                        Utils.kill(player, "PLAYER_BREAK_TOO_SLOW");
                    }
                }, 70L);

            }
        }
quasi flint
#

Antichrist purpose?

#

Anticheat

gentle oriole
#

no, its to kill the player if he didnt break the block in 3.5 seconds

#

and if the player didnt cancel it

quasi flint
#

Prob just check if it's higher then 0.05

gentle oriole
#

did check but it depends on the block

#

on obby its like 0.000002

quasi flint
#

Well then it's the modifer

#

How fast the player can break it

gentle oriole
#

its the progresss

quasi flint
#

That wouldn't make sense tho 😂

gentle oriole
#

the problem is it doesnt reset when player cancelled it

quasi flint
#

Why would the value be lower

gentle oriole
#

because it takes longer to take to 1.0

#

it saves the highest value even though the player already stopped breaking it

quasi flint
#

@ivory sleet pong

spare prism
#

Is there a way to check if a minecraft book's page is filled and next page needed?

pine island
#

my command isnt working i have implemented in plugin.yml and registered it in the main class all i get is the command dosnt exsisit but it used to?

vocal cloud
#

Your plugin loaded correctly?

pine island
#

yep

vocal cloud
#

Show on enable registration

pine island
#

1 sec!

vocal cloud
#

Why are you casting it to CommandExec does it not implement it?

pine island
#

it gave me a error doing this fixed it

vocal cloud
#

Show your buy class

#

buy should be capitalized btw

pine island
#

yeah

#

it isnt really buy lol its sw kit selector which can be used by op, anyways

package me.lumina.luminassw.comands;





import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.Objects;



public class buy implements CommandExecutor {




    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {



        if (args.length == 1) {

            Player player = (Player)sender;
            if (player.isOp() == true){

                if (cmd.getName().equalsIgnoreCase("Kit")) {

                    if (args[0].equalsIgnoreCase("amp")) {

                        player.getInventory().addItem(new ItemStack(Material.ENDER_PEARL, 64));

                    }

                }

            }
            else{
                player.sendMessage("Sorry but your not OP!");
            }

        }
        return true;
    }
}```
vocal cloud
#

What exactly is the error you get if you remove the cast?

pine island
#

1 sec!

#

now i dont weird:

gentle oriole
vocal cloud
pine island
#

nope

gentle oriole
#

mabe because K is capitalized in Kit... just maybe...

pine island
pine island
gentle oriole
#

change (args.length == 1) to (args.length != 1) and put else {player.sendMessage(commandUsage)}

vocal cloud
# pine island nope

Wait. Try Bukkit.getServer.getPluginCommand("command") instead and register it through that

#

It's 3am I'm super slow lul

pine island
#

hmm

gentle oriole
#

args[0] is amp right?

#

so if args is null or more than 1[0], it will send the usage

pine island
#
Bukkit.getServer.getPluginCommand("buy")
``` like this
gentle oriole
#

does .length start with 0 or 1?

pine island
#

is a array so starts with 0

#

i did 0 but that wont load

vocal cloud
#

Well getServer needs the ()

grizzled pollen
#
package me.lumina.luminassw.comands;

import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.Objects;

public class buy implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (args.length == 1) {
            Player player = (Player) sender;
            if (player.isOp()) {
                if (args[0].equalsIgnoreCase("amp")) {
                    player.getInventory().addItem(new ItemStack(Material.ENDER_PEARL, 64));
                }
            } else {
                player.sendMessage("Sorry but your not OP!");
            }
        }
        return true;
    }
}
#

This is what your class should look like at best

pine island
#

so do i remove @override?

vocal cloud
#

No it stays

#

I'm confused as to the issue here. Is the game telling you unknown command or are you just not getting output

pine island
#

Bukkit.getServer().getPluginCommand("buy"); somth like this for my cmd executor?

grizzled pollen
#

getCommand("buy").setExecutor(new buy()); in onEnable()

#

show your plugin.yml

#

where you registered your buy command

pine island
#
name: LuminasSw
version: '${project.version}'
main: me.lumina.luminassw.LuminasSw
api-version: 1.8
commands:
  buy:
    description: Gives kit with the argument of type
    usage: /<command> <kit type>
    aliases: [k]
grizzled pollen
#

btw the api-version is not needed if your plugin is below version 1.13

pine island
#

oh?

grizzled pollen
#

(I think so, I don't remember. check)

#

and is your plugin enabled?

pine island
#

it is!

grizzled pollen
#

show your onEnable()

pine island
grizzled pollen
#

and also learn java convention please🤩

#

you are should use getLogger().info("text here") instdead of sout

pine island
#

why is that better?

grizzled pollen
#

Sometimes it can cause problems and errors

pine island
#

like?

vocal cloud
#

Put it under all the code too so that it actually runs everything else first so you know if it was enabled or not. I mean it'll crash but still

young knoll
#

I mean spigot already has enabled messages

grizzled pollen
#

why are you on 1.8? This is an old version, why stay on the old versions when there are new and much better!!!

pine island
#

skywars

vocal cloud
#

Something something 1.8 PvP

#

I wonder if it's permissions related

#

are you OP?

grizzled pollen
vocal cloud
grizzled pollen
#

Doesn't it tells to 1.8? I don't know, I haven't used old versions for a long time. I am always on the latest stable version

vocal cloud
#

It's 3am I'm tired lol I just tested it just gives the good old don't have perms

pine island
#

oops i was gone, im back now

vocal cloud
#

Build a fresh version of your plugin make sure the message in console sends after the command registers and make sure it prints it out to the console. Run command as a server operator

#

show output

grizzled pollen
pine island
grizzled pollen
#

buy class

#

command executor class

vocal cloud
#

The biggest problem here is that at least in the latest version if it's in the yml it should at least return as if the executor returns false

pine island
#

oh no, naming..

vocal cloud
#

I mean if you want me to be a real stickler you should include a Command at the end of the name BuyCommand

grizzled pollen
#

yes!

vocal cloud
#

Da

pine island
#

alright i finished building

#

it*

vocal cloud
#

Now shove it on the server and show the console output so we can at least know it's loaded properly on the server

pine island
#

yep im restarting

vocal cloud
#

Alright now try it

pine island
#

and then just the /help message

vocal cloud
#

Aren't we testing /buy

#

Not /kit

pine island
#

oop

vocal cloud
#

Don't tell me that was the issue this whole time

pine island
#

it was supposed to be kit i forgot to rename class

#

and the executor

#

🤦

vocal cloud
pine island
#

lets test that make sure it works

vocal cloud
#

Don't forget the yml as well

pine island
#

ofc!

#

alright done and building

vocal cloud
#

It's going to work

pine island
#

wait will /reload do the same thing as restarting the server?

grizzled pollen
#

Never use the /reload command under any circumstance as it is always unsafe and error-prone. It causes significant instabilities within the server and plugins. Reloading the server will create issues, especially if you've replaced any jar files. For more information: https://madelinemiller.dev/blog/problem-with-reload/

FULLY RESTART YOUR SERVER

timid vale
pine island
#

it works!!!

#

god damn naming ruined it

#

thanks mike and sal!!

#

its just a process of adding items!

grizzled pollen
#

sal4i will be better :p

#

np

vocal cloud
#

Ah now to go to bed. My life is complete

pine island
#

3hrs lmao

wary harness
#

Why I can't remove passangers from list

#

p.removePassenger(pas);
p.getPassengers().remove(pas);
pas.remove();

#

they are removed from player visually

#

but if you do Player.getPassengers() size is still same

#

if was 5 before removing

#

it stays 5

chrome beacon
#

Show entire code

wary harness
#

for (Entity pas : p.getPassengers()) {

        pas.setInvulnerable(false);
        p.removePassenger(pas);
        p.getPassengers().remove(pas);
        pas.remove();
    }
#

that is command

#

to remove them

#

I got armorstand on top of my head

worn tundra
#

Why are you doing it twice

wary harness
#

and rotates passenger direction

#

to be same as players

worn tundra
pine island
#

wait is there a event for ender pearl throw?

wary harness
#

problem is if I am removing passenger in some cases

#

and adding new ones

#

old ones are still on getPassenger list

#

so for loop need to go thru more and more of them

chrome beacon
young knoll
#

Depends on how the remove methods works

chrome beacon
#

True

wary harness
#

I try to use only one method

#

of those 3 and

#

not even one works

#

I even looked in NMS

#

found list in CraftEntity class

#

you can't clear list

#

there is some exception saying action not allowed

#

or something

chrome beacon
#

I would just make a copy of the getPassengers and loop that. Then use removePassenger

wary harness
#

but what do I get with that

#

if I make a copy

#

still I will not remove passenger of player

#

or let me try

wary harness
#

and nothing

#

bananas

spiral light
young knoll
#

Yep

#

ProjectileLaunchEvent specifically

pine island
#

is there something like destroyBlocks()?

ivory sleet
#

We got Block::setType

young knoll
#

There’s also Player#breakBlock

wary harness
#

xd

#

I was canceling EntityDismountEvent

#

because when players were entering water Passenger will dismount

young knoll
#

Lul

wary harness
#

is there a way to check

#

reason of dismounting

#

I will only need to cancel it when player goes under water

pine island
#

how do i show players scoreboard?

#

title*

young knoll
#

Player#sendTitle?

#

Oh wait 1.8

#

Lol good luck

pine island
#

..

young knoll
#

NMS or find an API for it

#

I don’t believe it ever made it into the 1.8 spigot API

grizzled pollen
#

?google How to send title to a player *Spigot *1.8

undone axleBOT
grizzled pollen
pine island
#

haha

grizzled pollen
#

I'm sure there are plenty of good SkyWars plugins for the latest versions.

spiral light
#

Would be an idea to have this feature

grizzled pollen
#

Move on to the latest versions!🤩

late sonnet
#

Cafe need many features xd

young knoll
#

I’ll program them for cookies

#

Actually, I wonder what lang cafe uses

late sonnet
#

Python

young knoll
#

Oof

ivory sleet
#

Yeah lol

#

Altho it uses numpy iirc so hopefully not terrible when calculating

young knoll
#

Is cafebabe the public one or the custom one

#

I never remember

ivory sleet
#

Public iirc

#

Red

young knoll
#

Ah

#

I’ve never tried a bot with python

#

Making one with node was fun though

late sonnet
#

With the archived lib in python

late sonnet
#

Node? For this then java dogJAM

young knoll
#

I’m sure I could handle a java bot

#

I will admit though, node is easy

late sonnet
gentle oriole
#

it says progress in docs

young knoll
#

No apparently it’s progress

#

Terrible naming

late sonnet
#

Yeah...

young knoll
#

“The returned value is the amount of progress made in breaking the block. When the total breaking progress reaches 1.0f, the block is broken.”

gentle oriole
young knoll
#

I mean

#

You can work with that

late sonnet
#

Hmm if "never" return 0 then you can make a report in jira for check

young knoll
#

The docs should specify it returns infinity if the block is broken though

gentle oriole
#

smh it returns Infinity instead of 1.0f when broken

#
        if (enabledModules.get("PLAYER_BREAK_TOO_SLOW")) {
            Block block = e.getClickedBlock();
            if (block != null && block.getType() != Material.AIR) {
                scheduler.scheduleSyncDelayedTask(plugin, () -> {
                    float progress = block.getBreakSpeed(player);
                    System.out.println(progress);
                    if (progress != 0.0 && progress != Double.POSITIVE_INFINITY) {
                        Utils.kill(player, "PLAYER_BREAK_TOO_SLOW");
                    }
                }, 70L);

            }
        }
young knoll
#

Nice

late sonnet
#

Maybe can check the method and try a PR

young knoll
#

Wonder if MD would accept a deprecate and rename

#

Probably not :p

late sonnet
#

Maybe for 1.19 (?

gentle oriole
#

it can only handle so much

late sonnet
#

Maybe Later i can check

wary harness
#

any one know how would I telport Player with Passenger

#

PlayerTeleportEvent is not called

#

so I can't dismount passanger

late sonnet
#

But if you can make a jira ticket for all this things

young knoll
#

?jira ^

undone axleBOT
young knoll
#

Actually it’ll probably auto dismount so you can skip that part

wary harness
#

it wont even fire PlayerTeleportEvent

#

if you got passenger

#

on you