#help-development

1 messages Β· Page 779 of 1

wet breach
#

aren't you past the basics of this now ?

grand flint
#

excatly

river oracle
#

@eternal night hey bby <3

grand flint
#

stranger danger

eternal night
#

Holla miles party

grand flint
#

telling me to use a memory leaker pfft

eternal night
#

See I knew Y2K

#

so I trust him

river oracle
#

yeah lynx knows my IRL name

tall dragon
#

@echo basalt werent u the guy with a pretty nice questing system

echo basalt
#

uhh

#

maybe

#

maybe not

tall dragon
#

could i uhh take a look for educational purposes of course hehe

wet breach
#

I don't remember illusion having a good quest system or making one lol πŸ€”

echo basalt
#

fuck you it is decent

tall dragon
#

i remember seeing some screenshots

#

not sure

wet breach
#

lol

echo basalt
#

This is the idea

#

or well

#

if you want it to create in code you do it like this

#

I also have a parser

tall dragon
#

im mainly interested in how you handle the objectives

echo basalt
#

read this

#

and this is the uh

#

walk blocks objective

#

in minestom

#

I can't bother opening the spigot project

#

code is the sae

grand flint
#

promise

echo basalt
#

getProgress is our stuff

tall dragon
echo basalt
#

we use it on menus n such

chrome beacon
grand flint
#

what are the cases that it could leak

chrome beacon
#

if we knew it would be fixed

grand flint
#

oh lmao

tall dragon
#

when theres a hole in the bottom

grand flint
#

but like how often is it

tall dragon
#

very leaky

chrome beacon
grand flint
#

so would i be better of learning gradle

#

or

#

using the mc plugin

glacial coral
#

I can't seem to get the item that the killer holds under PlayerDeathEvent. It just prints out an empty string. Anyone knows why that might be? I tried getting the inventory of the killer and then getting the mainhand item and then getting the itemmeta so I could get the item displayname itself:

Player killer = e.getEntity().getKiller();

PlayerInventory killerInventory = killer.getInventory();
ItemStack item = killerInventory.getItemInMainHand();
ItemMeta meta = item.getItemMeta();

plugin.getLogger().info(meta.getDisplayName()); //this becomes empty output
chrome beacon
#

Gradle is pain

wet breach
#

it should be noted that Olivio has a lot of ram at hand too πŸ˜‰

#

jk, have no idea how much ram they have or use lol

echo basalt
#

yo frosty

grand flint
#

so what does the mc plugin even do, doesnt it just setup the files for u?

echo basalt
#

I managed to get a few messages pinned

wet breach
#

nice

grand flint
#

how can it be a memory leak is what im tryna nuderstand lol

echo basalt
#

are you proud of me Pepeshy

remote swallow
chrome beacon
remote swallow
#

my life is a lie

storm crystal
#

I got one problem, after like 2 messages of showing cooldown it pretty much doesnt work anymore, can 2 runnables not run at the same time?

river oracle
wet breach
echo basalt
#

yeah

tall dragon
#

not that you trust me

echo basalt
#

I also managed to schedule a meeting with a chick from some gaming company at the tech conference

#

it's some esports media org

grand flint
tall dragon
#

hahaha

echo basalt
#

they got media passes :)

wet breach
echo basalt
#

they said something about a collab, can't wait to break it to them that I make minecraft ploogin

wet breach
echo basalt
#

It'll probably be fine I can just give them my youtuber contacts

storm crystal
#

nvm I merged them into one scheduler and works now, no spam and shows a number

#

but can 2 schedulers work at the same time?

remote swallow
wet breach
#

yes

storm crystal
#

and what happens if I try to invoke scheduler thats in the middle of run?

remote swallow
#

using a scheduler for cooldowns isnt the best

echo basalt
#

instant pain

young knoll
remote swallow
#

made an instant instance of instance

storm crystal
#

so what do I use for cooldowns then

#

😭

remote swallow
storm crystal
#

so I did all of this just to trash it now

#

okay

remote swallow
#

the life of a developer

chrome beacon
#

^ one of the reasons I've never properly published a plugin

river oracle
#

^

wet breach
#

Lol

#

at least you are only trashing like a method or two

young knoll
#

My main reason is making the resource page

wet breach
#

wait till you realize you need to delete half the plugin

#

because the way you went about it was flawed or dumb

young knoll
#

I just cba to make it look decent, but I refuse to publish a plugin with a shitty page

chrome beacon
#

I always start a project stay focused for a week then move on

#

When I come back it's a mess so I start over

#

repeat

river oracle
remote swallow
#

y2k

storm crystal
#

why is runnable not good for cooldowns

wet breach
#

or if you have a plugin like one I have, you have to basically recreate almost everything in it XD

river oracle
#

I've had to trash my multiblock structure system a few times already

remote swallow
river oracle
remote swallow
#

hows ur gen plugin coming along

river oracle
#

pain I hate multiblock structures

storm crystal
remote swallow
#

that was for y2k

storm crystal
#

still dk

young knoll
#

Tf is a gen plugin

remote swallow
#

but the server doesnt always run at 20tp so the runnable doesnt run for a tick

storm crystal
#

does #3 need dependency?

remote swallow
#

no

river oracle
# young knoll Tf is a gen plugin

it generates resources over time like pretty common with skyblock sept literally ever generator plugin ticks all of their generators instead of doing everything lazily

young knoll
#

Define lazily

remote swallow
#

me doing anything

river oracle
#

much likes signs cough merge my PR md5

chrome beacon
#

Do signs tick??

river oracle
gleaming yarrow
#

what classes should i check out to understand how to achieve this

chrome beacon
#

πŸ’€ but why

remote swallow
#

y2k i will turn you into an inventory in a minute

river oracle
#

mojang doesn't know how to code ig

young knoll
#

How does one interact with a generator

#

Don’t they normally just spit items on the floor

river oracle
#

its an Inventory GUI usually

wet breach
remote swallow
chrome beacon
#

Wouldn't that just be handled by block updates

river oracle
river oracle
#

it was just a dumb oversite I assume

wet breach
wet breach
#

but they do because mojang

cold pawn
#

Anyone know how I can make a respawn packet using protocolLib (1.20.2)? or atleast what I need to set?

remote swallow
river oracle
#

you don't need protocol lib to respawn a player

#

speaking of Player.spigot().respawn() that should be merged in CB

chrome beacon
#

CraftItemStack too

river oracle
# wet breach why?

people never know it exists because who tf looks at the Spigot interface docs

wet breach
#

I do o.O

chrome beacon
#

spigot javadocs show that method

#

?

wet breach
#

^

river oracle
#

A more realistic question is why its in spigot vs cb maybe that method is that old

cold pawn
river oracle
#

ahhh

chrome beacon
#

You can always capture a respawn packet and take a look

wet breach
cold pawn
wet breach
cold pawn
cold pawn
#

Especially when modifying info like their skin

chrome beacon
#

Did you send that packet to the other players too

#

or only to the one you modified

cold pawn
#

Only the one I modified

chrome beacon
#

Try sending it to the other players too

cold pawn
#

alright

gleaming yarrow
#

ok lol for some reason opening craftitemstack makes intellij freeze

#

ok what the actual fuck could possibly be causing this its so unfathomably random

dry hazel
#

happens when it tries to decompile a shit class, i.e. Material

gleaming yarrow
#

real

#

yeah got it on the third try

wet breach
quaint mantle
#

if I have a bunch of custom items and I dont want each one to "identify itself" how would i go on about that

#

so for example on a right click event I dont want each custom item to filter the event

dry hazel
echo basalt
#

you can make a listener for every possible item type and call a custom event

#

that's pre-filtered

quaint mantle
#

illusion do u rem what I had before?

#

it was the interface with empty default method bodies

echo basalt
#

you've been bothering me with this for ages

quaint mantle
#

bro

#

im just using it for an example

echo basalt
#

just make a bunch of custom item events

quaint mantle
#

maybe ill just use the bukkit event api

storm crystal
#

is the code any okay? minus the bukkit runnable ill try to change it for something different

chrome beacon
#

That will break as soon as there's more than one player

storm crystal
#

why

chrome beacon
#

or are you registering a listener per player

storm crystal
#

you can do that?

chrome beacon
#

Yes but don't

storm crystal
#

so what do I do

chrome beacon
#

As it is right now the cooldown is global

#

Every player shares cooldown

storm crystal
#

can I just edit config for playerstats and add this cooldown here

chrome beacon
#

That would be a bad idea

storm crystal
#

well then im out of ideas

#

xd

chrome beacon
#

well you probably know what I will say

storm crystal
#

but learn what exactly

chrome beacon
#

You need to know the fundamentals

#

?learnjava!

undone axleBOT
chrome beacon
remote swallow
#

what the

#

since when was java a tld

worldly ingot
#

I mean Java's a country if I'm not mistaken

chrome beacon
#

Looks like it was registered/managed by oracle

remote swallow
worldly ingot
#

Just doing some onboarding. I probably won't start actually making anything until next week or so

remote swallow
#

smh

#

can you sneak some spigot easter eggs in

ivory sleet
#

schnitzel :,)

eternal night
#

add death run thanks

remote swallow
#

yes yes death run much player fun yes

echo basalt
worldly ingot
#

I dunno where it is, I just remember it existing Β―_(ツ)_/Β―

storm crystal
echo basalt
#

There are lots of ppl here

#

that have different opinions

remote swallow
#

its fine to learn java with plugins but you need to atleast know the basics before making plugins imo

echo basalt
#

The idea is to master the basics so you actually understand what people are talking about when they help you

remote swallow
storm crystal
#

and like, someone here also said that fundamentals are subjective

echo basalt
#

well

storm crystal
#

so more or less id practically never get fundamentals by everyone's definition of them

echo basalt
#

let's just say

#

everyone wants to help

#

But not everyone is qualified to help type deal

#

Just listen to what the "regulars" say and you'll be fine

#

and don't take everything literally

#

Sometimes people just BS their answers

inner mulch
#

what exactly are you looking for?

storm crystal
#

so if I want to make player specific listeners can I somehow loop for them?

inner mulch
#

im sorry but im not advanced enough, but maybe i can find a different solution, what exactly are you looking for ?

storm crystal
remote swallow
storm crystal
#

how about HashMap of UUIDs and cooldown values?

remote swallow
#

look at the cooldown manager tutorial i sent it shows how to have per player cooldowns

remote swallow
inner mulch
storm crystal
#

not really

inner mulch
#

with System.currentTimeMillis, you are getting a long representing this particular timestamp

storm crystal
#

HashMap is like dictionary?

inner mulch
#

?

chrome beacon
#

Yes

storm crystal
#

or like kind of PDC where you have "something" = value(can be int, string etc.)

inner mulch
#

yes every key has a value in a hashmap

storm crystal
#

so with time elapseed

#

I dont even have to use Runnable

inner mulch
#

yeah you dont need runnables for cooldowns

storm crystal
#

😭

#

ffs

chrome beacon
#

Here we go again πŸ™‚

storm crystal
#

I spent like 2 hours figuring out how they work

inner mulch
#

they are still useful tho

chrome beacon
#

Time for another rewrite

storm crystal
#

what are Runnables useful at?

chrome beacon
#

Running things in the future

inner mulch
#

or sending a message like join our discord every few minutes

storm crystal
#

can I make my plugin run my own commands?

inner mulch
#

yes

storm crystal
#

thats useful

inner mulch
#

you can create commands

#

or run them

wet breach
remote swallow
#

Bukkit.dispatchCommand

wet breach
#

dispatchCommand is fun to mess with sometimes

chrome beacon
remote swallow
#

well yeah

inner mulch
#

why tho?

#

why avoid?

remote swallow
#

ideally you shouldnt ever need to run the command like that

storm crystal
# inner mulch what exactly are you looking for?

honestly its kind of frustrating to hear "learn fundamentals" and assuming that I didnt even read anything, but I did entire w3schools course and so far utilized maybe like 70% of what I learnt there

#

like bro I am not going to recognize shit at the speed of light 😭

inner mulch
wet breach
#

well, the best way to understand the fundamentals is to use them in something so you have an understanding

#

there is going to be plenty of things though that can't always be explained in a very basic way, like for example keywords

chrome beacon
#

If you just read you'll forget it fast

#

Make sure to do the exercises

wet breach
#

there is going to be plenty of keywords that you won't know when you should or shouldn't use them because there really isn't an easy way to explain them except what they do

#

for example, the difference between private, protected and public

#

it can tell you what those do, but not when you should or shouldn't use them

#

and there is even more keywords then those, just those are the most common you will deal with πŸ™‚

chrome beacon
#

transient

orchid gazelle
#

I never used protected lmao

wet breach
#

lmao

river oracle
#

anyone got a better method name than this

    static <T extends RegistryKey> MutableRegistry<T> newMutable(Supplier<Map<String, T>> data) {

Method creates a mutable registry, but I really hate this method name for some reason

wet breach
#

I wouldn't call it Mutable that is for sure

river oracle
#

ahh fair

#

what do you think is a better name Cuz Registry and AbstractRegistry were already taken

wet breach
#

what kind of registry is this?

#

or is it like generic?

river oracle
#

just a template

orchid gazelle
#

I'd call it Gustavo

remote swallow
#

fring?

orchid gazelle
#

Or Caroline

river oracle
river oracle
#

Should I do like UpdatableRegistry

wet breach
#

read my mind

river oracle
#

I'm trying to make my new plugin completely data driven so I have quite a few registries

storm crystal
#

wait how is it not initialized if its already been initialized in constructor

remote swallow
#

that is outside the constructor

#

it will get init'd before the constructor runs

#

you got sent something for just that earlier

chrome beacon
#

We had an entire discussion about this just a few hours ago

#

???

storm crystal
chrome beacon
#

yes

storm crystal
#

okay I think I got it

#

so I basically made my main class only around setting up commandexecutors and registering events and parsing plugin instance further and each of my class grabs necessary instances of utility classes or plugin instance like that with initializing fields and then giving them values via constructor, is that a good way of making it?

wet breach
# storm crystal oh like that?

to clarify, if you look at DamageManager. The way you have declared it will make it not initialized just declared. If for some reason BoneAbility is not invoked, DamageManager will be left unitialized. Most times not an issue, but it could be say if another method below that BoneAbility method needs it but is say static. Now if something outside of the class access that static method, DamageManager would be unitialized. You can intialize stuff at the top where you declare and generally if you are able to initialize that early its best to do so. Its fine the way it is right now, just something to be aware about.

storm crystal
wet breach
#

A class being initialized isn't the same as a variable being intialized

#

two different things

storm crystal
#

declaring a class is basically writing it down while initializing is making an instance out of it?

#

or do I get that wrong

wet breach
#

also you can have 2 instances of a class but they both be different unless you have something in place to ensure only a single instance also known as singletons

#

anytime you do new DamageManager(plugin) you will get a new instance of the class

#

but now lets take your variable for example

storm crystal
wet breach
#

DamageManager damageManager = Rpg.DamageManager(Rpg) now if you had a method in your main class Rpg named DamageManger, and if it returned a DamageManger Instance. Instead of the variable creating an instance, we have now deferred to a method to create or return an instance instead.

storm crystal
#

yeah I dont get that

wet breach
#

at the same time if this was at the top of the class, the variable is also now intialized regardless if DamageManager method returns anything or not

#

well at minimum, it has to return a DamageManager object, but that doesn't necessarily mean the object isn't null

wet breach
# storm crystal yeah I dont get that

the reason I can use Rpg, is because all main classes of plugins are static, therefore you can directly call the main class. Anything that is static can be directly called. Your main class also extends JavaPlugin, so it makes a valid Plugin object due to inheritance. Hence I can just stuff that into the constructor

storm crystal
#

yeah I get that

#

I dont need instance of Rpg class

#

I can just get plugin from it

#

and pass it via constructor

wet breach
#

well it may be handy to intialize your plugin instance before the constructor

#

but, at least you are getting the hang of it regardless

storm crystal
#

like this?

wet breach
#

private Rpg plugin;

#

I typically keep a static method in my main class

#

so I can do something like this

#

private Rpg plugin = Rpg.getInstance()

#

then you don't need a plugin instance passed via constructor, handy when its not needed to do so

#

like true utility classes for example

ivory sleet
#

a singleton here is fine tho like frostalf is mentioning

storm crystal
#

but generally what im doing is not as bad?

wet breach
#

no, its correct

#

Just instead of using JavaPlugin however

#

which is the more generic version

#

you should use Rpg instead

#

use JavaPlugin if you are expecting an object from other plugins

wary remnant
#

What about JavaPlugin.getPlugin(Rpg.class)?

wet breach
#

That makes no sense to do even though it would work, you would use such a method like that when you want to fetch a Plugin instance of another plugin

#

not your own lol

ivory sleet
#

Altho it goes through the classloader and some other stuff

#

U also have getProvidingPlugin

#

Which is really nice for libraries

#

As frosty said, prob doesnt make much sense if u need to call the getPlugin one tho lol

wary remnant
#

I think making intelligent use of dependency injection and structural decisions will allow me to avoid using a singleton altogether

storm crystal
#

is it an okay way to make use of utility classes that dont need plugin instance and those that need plugin instance to work?

ivory sleet
wary remnant
#

They are not

ivory sleet
#

Which is a wrong assumption in the first place

#

Singletons have their place just like any other design pattern

storm crystal
#

I think I should dip to sleep, almost 2 am and I have uni from 10 am to 9 pm

ivory sleet
#

Yeah go to sleep

wary remnant
#

Yes, but one should not throw a singleton at every problem that would allow having one just because it is "easier"

wet breach
#

So because you wouldn't have a constructor to intialize, it makes sense you need a different way to fetch a plugin instance

ivory sleet
wet breach
#

which is what I was essentially inferring to

storm crystal
wet breach
#

well, that is just an exception to the rule because main classes of plugins are singletons and static

#

but yeah

storm crystal
#

so to turn it into a static class I'd have to make private constructor and static methods?

wet breach
ivory sleet
#

little late tho but ye

wet breach
#

ah Conclube to the rescue

storm crystal
#

so I just make methods static and how do I initialize such class in another one?

ivory sleet
#

You manage just fine frosty ;)

wet breach
#

you wouldn't intialize the class, you would reference the methods instead

wary remnant
wet breach
#

you can import static methods

#

like you do with classes

storm crystal
storm crystal
wary remnant
#

And by the way, there is the PersistentDataHolder interface which defines the getPersistentDataContainer() method, just in case you didn't know

wet breach
#

yeah once you import a static method, you should just be able to use it in the class like you do everything else πŸ™‚

#

also note it isn't necessary to import a static method either, as just like you are doing or showing

#

you can just reference it directly, but it does make it easier code wise if you import it though

storm crystal
#

I just found the fact that defining Namespaced key etc. is just very redundant

#

since im working a lot on PDCs

#

so I wanted to make utility class for that

#

so that I could just return value very fast

#

so I guess tommorow ill tidy up my plugin more with static methods now that I know how they work

wary remnant
#

I was referring to your LivingEntity parameter type. You could widen the scope of your function to accept every kind of thing that has a PersistentDataContainer

wet breach
#

this is an example of a utility class

wary remnant
#

Adding a private constructor and marking the class as final is a good convention on top of that

wet breach
#

point is, all those methods don't rely on each other, and don't rely on anything else and are self contained

#

therefore, they are static and can be used anywhere without issues

storm crystal
#

so I could make damage formula method static without a problem?

#

and use it in several parts of code like abilities or simple damage by player

#

and same for FileManager that reads stuff from configs?

wet breach
#

sure, but do be careful though with statics. Anything static will never go away and is always loaded

#

so its something to not over use πŸ˜‰

#

if your damage formula is always going to be used regardless it may be worth making it static as it would improve stuff

storm crystal
#

yeah as you said

#

good for pure utility

#

thats the kind of help I appreciate and am happy to hear

#

altho I get that not everyone has time or simply wants to explain

wary remnant
#

Yes, but try to make sure to not reinvent the wheel and think about making stuff static twice, not everything should be a utility class.
You should stick to the native configuration stuff as long as it fits your needs rather than shoving everything in a "manager"

storm crystal
#

but still that'd be better than just slapping with "you lack fundamentals, go back"

wet breach
#

well I think learning about static is something you should learn early on as I consider it something as part of the basics

storm crystal
#

I needed FileManager cuz I use several configs

wet breach
#

many people don't learn statics properly and either over use it, or shy away from it because they don't know how to use them properly

#

so its better you learn about them early as well as how to use them or rather know what the rules are when a static could be used

river oracle
wet breach
#

if an object is never going to go away, IE like your main class, it is acceptable for said object to be static, exception being if you want many objects then you don't want it static

#

classes, variables, and methods can all be static and are independent of each other

#

enums are by default static classes just fyi

#

they can not be anything else

storm crystal
#

Are stuff like enums or lambda important for plugin making

wet breach
#

sure I will show you another handy thing

river oracle
ivory sleet
#

its good to know, but its not like there dont exist other solutions

wet breach
#

a permissions enum that lets you define * perms for your plugin πŸ™‚

#

also lets you define dynamic perms too

#

IE perms you can't know about ahead of time XD

storm crystal
#

Do you recommend anything else to take a look at

#

In terms of basics

wet breach
#

there is always something to look at πŸ˜›

storm crystal
#

I feel like even tho I went through a course my knowledge is practically a swiss cheese

grand flint
#

Bukkit.broadcastMessage(Color.WHITE + player.getName() + Color.GRAY + " >> " + Color.WHITE + message);

#

Why does the color come up like this?

storm crystal
#

Shouldnt it be ChatColor?

grand flint
#

ye thx

wet breach
#

when you use the wrong color imports XD

grand flint
#

do i need to

#

ChatColor.RESET

#

after each color

storm crystal
#

No

grand flint
#

ok hot thx

storm crystal
#

ChatColor.GRAY + "this is gray" + ChatColor.RED + " this one is red"

grand flint
#

wait whats dark gray

storm crystal
#

Dark_gray

gleaming yarrow
#

still no idea how to do this without wasting way too many hours on it so if anyone can guide me through it dm me

grand flint
#

ohh

#

it wouldnt show up

storm crystal
#

Same for dark green dark red etc.

grand flint
#

in Color when i did that lol thx

#

how about

#

hex codes?

wet breach
#

need chat components to use hex if I recall

grand flint
#

can u explain a tiny more :))\

gleaming yarrow
storm crystal
wet breach
#

at the moment I can not explain more as I have to get ready for work lol

grand flint
#

what

#

i meant how do i use hex codes in the code

storm crystal
#

Oh

wet breach
#

but the easiest thing to use is MiniMessage for them chat components

storm crystal
#

Whoops

gleaming yarrow
#

check out ChatHexCode

#

or was it HexChatCode or whatever

#

this is how you do it via nbt in vanilla, it might help
{Count:1,id:"minecraft:trident",tag:{display:{Name:'{"italic":false,"extra":[{"text":""},{"color":"#974DFF","text":"Hex Name"}],"text":""}'}}}

grand flint
#

okk thank u

#

one more thing

#

does broadcastmessage not support utf8

#

this

#

" Β» "

#

turns into this

gleaming yarrow
#

is it formatted

grand flint
#

wdym

gleaming yarrow
#

is there a section symbol before it

#

or sth like that

grand flint
#

wdym D:

gleaming yarrow
#

Β§this thing

wet breach
grand flint
#

Bukkit.broadcastMessage(ChatColor.WHITE + player.getName() + ChatColor.DARK_GRAY + " Β» " + ChatColor.GRAY + message);

gleaming yarrow
#

weird

#

shouldn't be doing that

wet breach
#

also, java by default is utf8 as well, unless you set it otherwise specifically

grand flint
#

ye i assumed so

#

then where on earth is the A coming from

wet breach
gleaming yarrow
#

Yeah ig

grand flint
#

i use the same thing in another plugin

#

no A there

gleaming yarrow
#

its as if its saving it as text somewhere then fucking it up and loading it again

wet breach
#

thats the escape code for that character, guarantees it to show up properly

gleaming yarrow
#

but yeah try escaping it

grand flint
#

wdym ecapin it

gleaming yarrow
wet breach
#

thats the UTF-8 code for that character

grand flint
#

what color

#

the gray?

wet breach
#

java knows what UTF-8 characters are, hence can use them directly, and also known as escape code since you have to prepend with a backslash

gleaming yarrow
#

You want Dark gray right

grand flint
#

\U+00BB this is dark gray?

gleaming yarrow
#

thats just the symbol

wet breach
#

thats the double arrow character

gleaming yarrow
#

you need to add an 8 after that

grand flint
#

oh ye i assumed so

gleaming yarrow
#

Ah wait

grand flint
#

what

gleaming yarrow
#

mb

grand flint
#

what are u guys on about πŸ”œ

#

Bukkit.broadcastMessage(ChatColor.WHITE + player.getName() + ChatColor.DARK_GRAY + " \\U+00BB " + ChatColor.GRAY + message); no?

gleaming yarrow
#

Yea yea

#

mb

wet breach
#

I am not on about anything, just telling you what the utf8 code is for that character

#

which guarantees it to show up properly everywhere

grand flint
#

okk

#

is that how other plugins do it

#

they use the utf code for it

wet breach
#

when there is issues like you are having, yes

grand flint
#

no i mean like

#

in config files

#

it translates the symbol to its utf8 code right?

#

in the code

wet breach
#

depends how you its read from the file and is done a slightly differently from config files

grand flint
#

ahh ye i get it

#

so i wouldnt need to code a system like that for config files

#

it should most likely work if im just reading from there

wet breach
#

most times yes

#

unless someone changed the encoding of the file πŸ˜›

#

I think snakeyaml enforces utf-8 though if I am not mistaken

grand flint
#

is it a single slash

wet breach
#

should be single slash

gleaming yarrow
#

try without the plus

#

and lowercase the u

wet breach
#

also doesn't need quotes either

grand flint
#

but that errors

#

oh

#

whast

gleaming yarrow
#

and yeah no quotes cause otherwise itll treat it as literal text

wet breach
#

it should be a single slash, don't remember needing two

gleaming yarrow
#

one slash

grand flint
wet breach
#

hmmm

grand flint
#

i never

#

seen that before

#

r u guys fr

gleaming yarrow
#

can we get the entire line of code

eternal oxide
#

show the whole line

grand flint
#

Bukkit.broadcastMessage(ChatColor.GRAY + player.getName() + ChatColor.DARK_GRAY + \U+00BB + ChatColor.GRAY + message);

eternal oxide
#

"" + ChatColor.GRAY +

#

can;t start a String with an Enum

wet breach
#

welp have to travel to work

#

be back in like an hour or so

gleaming yarrow
#

gl

remote swallow
#

if you use the bungee chatcolor its not an enum

grand flint
#

ye

remote swallow
#

but wrap the unicode in a string

grand flint
#

ye i thought so πŸ€”

#

now it errors again

gleaming yarrow
#

try it with no +

#

ig

eternal oxide
#

now you double escape as it's Java

grand flint
#

omg

#

all of u

#

are saying different things

eternal oxide
#

yep

grand flint
#

this

#

prints

eternal oxide
#

Its hard to advise when you only show snippets. Best to give it all at the start

grand flint
#

but i gave the entire broadcast message

#

what else could u possibly need for that πŸ€”

gleaming yarrow
#

dunno what to tell you blud

eternal oxide
#

sec let me open my ide. Check how to use unicode

grand flint
#
@EventHandler
    public void onPlayerChat(AsyncPlayerChatEvent e){
        String message = e.getMessage();
        Player player = e.getPlayer();

        message = message.replaceAll("\\s+", " ");

        e.setCancelled(true);

        Bukkit.broadcastMessage(ChatColor.GRAY + player.getName() + ChatColor.DARK_GRAY + " \\U+00BB " + ChatColor.GRAY + message);
    }
gleaming yarrow
#

would you

#

try it wihtout the +

#

and lowercase the u

#

thats how ive mostly done it whenever it needed to be done elsewhere

#

never needed to do it in intellij though it was mostly for stuff like server motds

glad prawn
#

πŸ€”

eternal oxide
#

"\u2B1B"

#

thats the correct way

grand flint
#

thx

wet breach
grand flint
#

same as javascript

#

shouldve just tried that D:

eternal oxide
#

You too slow and my IDE takes forever to open too

wet breach
#

Lmao

#

I was busy getting to my car and starting it

young knoll
#

I was busy googling it

midnight solar
#

Hey, so currently I'm making a custom PathfinderGoal. Basically I'm trying to detect if there is a block in the path of the entity and if so make it jump over the block. Currently it does work/jump over the block but only when the block is set inside the mob (i'm using a giant). I can't seem to come up with an efficient way to get a block in front of the mob without it being inside it's body for this to work. Any help would be appreciated, ill show the two methods i went about it so far below. Also to note im using 1.8.8

Method 1:

Location entityLocation = entity.getBukkitEntity().getLocation();
        World world = entityLocation.getWorld();
        Vector entityDirection = entityLocation.getDirection();

        BlockIterator blockIterator = new BlockIterator(world, entityLocation.toVector(), entityDirection,0.0, 2);

        while (blockIterator.hasNext()) {
            org.bukkit.block.Block block = blockIterator.next();
            System.out.println(block);
            if (block.getType() != Material.AIR) {
                System.out.println("Block detected");
                return true;
            } else
               // System.out.println("Air detected");
            return false; ```


Method 2:

Location entityLocation = entity.getBukkitEntity().getLocation();
World world = entityLocation.getWorld();
org.bukkit.block.Block currentBlock = world.getBlockAt(entityLocation);
BlockFace entityFacing = getEntityFacing(entityLocation.getDirection());
org.bukkit.block.Block blockInFront = currentBlock.getRelative(entityFacing);

    if (blockInFront.getType() != Material.AIR) {
        System.out.println("block detected");
        return true;
    } ```
wet breach
#

Probably because the giants hitbox is inside the giant

midnight solar
#

Hm that is true, anyway to so called 'avoid' the hitbox to actually make it work lol

wet breach
#

Might have to do some hacky thing and make it levitate at the right time to make it appear right lol. Wont be easy and will have to play around with it

eternal oxide
#

you are only checking 1 block in front of the location

midnight solar
#

Even with it set to 20 it still only 'jumps' over the block when the block is inside the body

eternal oxide
#

you don;t use the hitbox at all

wet breach
eternal oxide
#

yeah, they stopped using giants for a reason πŸ˜‰

wet breach
#

Lol

wet breach
#

It may or may not still look right but that is about the best you can do for this

midnight solar
#

Yeah it makes sense now that you mentioned the hitbox lol, thanks

quaint mantle
#

how do i make a org.bukkit.Color become a org.bukkit.ChatColor

clever crescent
#

currently learning how to make a plugin so sorry if this is a basic asf question, but is this how i would format a command that i want to be /verify [PlayerName] [TwitchName] and for all intents and purposes i would just want it to store both TwitchName and PlayerName as a string of some form to a file or something (if thats possible, would also greatly appreciate if someone could point me in the right direction ^-^)

commands:
  verify:
    description: gets and stores twitch username with player name.
    usage: /verify [PlayerName | TwitchName]
    aliases: [Verify, verify]
    permission: verify
    permission-message: you do not have permission to verify?...
kind hatch
# clever crescent currently learning how to make a plugin so sorry if this is a basic asf question...

Some things you should probably fix with this alone are

  • Removing the redundant alias that is the same as the command.
  • Making a better permission node. (Usually plugins follow the <pluginName>.<permission> format. Ex: essentials.ban or minecraft.command.ban)

As for how you might want to approach a system like this, you'll want to create a command and use the command arguments to compare what the player entered.
You shouldn't save any data to the config file as that would just be bad practice. However, you can save your information to a file using FileConfiguration.

File file = new File("datafile.yml");
FileConfiguration data = YamlConfiguration.loadConfiguration(file);

data.getString("path.to.your.value");

data.setString("path.you.want.to.edit", "value");

data.save(file);

@clever crescent

river oracle
#

God I'm in data structures but I haven't gotten to this yet. I essentially have a node which knows about 6 nodes. I need to navigate through every node within the system. I'm not sure about a great way to do this though.

#
public record StructureNode(@Nullable StructureNode north, @Nullable StructureNode south, @Nullable StructureNode east,
                            @Nullable StructureNode west, @Nullable StructureNode up, @Nullable StructureNode down, @NotNull BlockData data) {
#

each structure node knows about every node around it basically and the data it contains

#

I wouldn't really want to use recursion here as that would probably kill the call stack

#

maybe there is a better way to go about this too? idk I'm just trying to find a nice way to build and store structures within memory

#

I could just run through each direction and add to a call stack, but I feel like that overhead would get insane.

#

MultiBlock structures are a real pain

clever crescent
clever crescent
# kind hatch Some things you should probably fix with this alone are - Removing the redundant...

when you're saying "path.to.your.value" and "path.you.want.to.edit" does this mean that im pulling the value im inputting into the command? and is path that i want to edit in reference to location in the file or like whether im appending to the file?
currently how im formatiing it


{PlayerName} {TwitchName}
{PlayerName} {TwitchName}
{PlayerName} {TwitchName}
{PlayerName} {TwitchName}
{PlayerName} {TwitchName}
{PlayerName} {TwitchName}

quaint mantle
#

@river oracle

#

Maybe treat the nodes using a vector as direction

#

Also idk how u won't use recursion for something like that

#

You could maybe make a queue and while loop ig

kind hatch
# clever crescent when you're saying "path.to.your.value" and "path.you.want.to.edit" does this me...

YAML files work using sections and subsections. In order to access a subsection using the Spigot API, you use the . to specify that you have a subsection.

section:
  subsection: test
  subsection2: 15.9
    sub-subsection: 8

If you wanted to get the value of subsection2, you'd use FileConfiguration#getDouble("section.subsection2").
If you wanted to set the value of sub-subsection, you'd use FileConfiguration#set("section.subsection2.sub-subsection", 9)

clever crescent
#

oh wooooow thats beautiful

#

that makes alot more sesne

kind hatch
#

Oop, made a mistake. You can't actually have a value on the direct parent of a subsection.

#

subsection2 is formatted incorrectly, but the principle is the same

#
section:
  subsection: test
  subsection2:
    sub-subsection: 8
#

It would have to look like that

river oracle
kind hatch
clever crescent
#

so instead i would do?

but does this imply that im not able to append a new section to the YML file?

like would i be better off storing 2 raw strings in a TXT or like a different file type?

player1:
  PlayerName: ingameusername
  TwitchName: twitchusername
#

cause the end goal is to make players when they join do /verify [minecraftname] [twitchname]

#

and then store that and compare later

kind hatch
#

You can append however many sections you want to a yml file. #set() should automatically create the section if it doesn't exist.

#

If it doesn't for whatever reason, you can use FileConfiguration#createSection("section.path")

#

Also, something you may want to consider is using the player's UUID instead of their name. Since player names can be changed at any time, your data may become outdated and behave in a way that you don't want. It would also cut down on the number of lines you need to write to disk.

03687ca0-30cf-4c3c-8c1d-3b2dd75c3ff0: "MyTwitchName"
#

That's my UUID btw

clever crescent
#

oooo i like that idea

so instead of creating a section that is the players name with twitch name as the value, i just pull their player ID and set that inplace of username instead.

i think where im getting lost is how i translate the data i input into the command into a string that i pass to the file

kind hatch
#

FileConfiguration#set() is a flexible method. It has tons of overloaded methods so you can pass in whatever data type you need.
If you wanted to store data like the example above, you'd just call it like this,

datafile.set(player.getUniqueId().toString(), "TheirTwitchName");

#

If you wanted to put all that data into a subsection, you could format your file like this.

data:
  03687ca0-30cf-4c3c-8c1d-3b2dd75c3ff0: "MyTwitchName"

Then you just need to prepend the section name to the set method. datafile.set("data." + player.getUniqueId().toString(), "TheirTwitchName");

#

How you store your data is up to you, but since these files are easily editable, I like to keep them as easy to understand for the end user as possible while keeping it concise.

wet breach
#

Went searching in the api in relation to what you were stating and inadvertently found a new prompt lmao

clever crescent
#

i still have to figure out how to pass the data the player gives the command but that should theoretically be a google search away

wet breach
#

In case you are curious

#

Think this might be useful when i update server tutorial

kind hatch
#

I still need to learn how to use those. lol

wet breach
#

My plugin uses the conversation api

#

I dont so anything too fancy with it. But what is nice about it is you can use it to kind of simulate chat

#

In case you want to get fancy with entities and channels

#

I make use of the channel bit so that normal chat doesnt interfere and when they are done they still retain normal chat history

#

Maybe this weekend i will update it

#

Going to implement display entities into it

#

Which also means new api as well uwu

kind hatch
#

Ohh, I think I see how that works now. Just a bit of chaining.

wet breach
#

You can chain them but dont have to. And you can loop back around too

#

Just have to call the relevant prompt

#

Which i do implement in a couple of places where they dont give a correct response

#

Or if the response given doesnt parse properly

kind hatch
#

Ahh yep. I see that too.

wet breach
#

Also i specify a keyword as well so they can exit out as well

kind hatch
#

That propagates all the way down right? So it's only defined once?

wet breach
#

Yep

kind hatch
#

Nice

wet breach
#

And the context can hold arbitrary amounts of data too

#

Kind of like a cache for the duration of the conversation

#

You set your own key and data and it also has some predefined keys if i remember right. Been a while since i messed with it lol

#

Its sad though its one of the most under used api as well given how old it is

#

Existed since 1.6-1.7

kind hatch
#

I thought the Conversation API was added in 1.12 or 1.14 lol. (Yet another reason for me to complain about not having @since tags) reeeeeeeeeeeeeeeeee

wet breach
#

Lmao

#

Just have to remember is all

#

I think this might be overwhelming the new person

kind hatch
#

Maybe. I kinda dropped a lot of info. Could have gone further into technical details though. >:)

#

I work with config files far too often.

wet breach
#

Ironically that is what i use the conversation api for

clever crescent
#

im definitely having some form of fundamental misunderstanding lol nothing ends up in the .yml file after I type the command, dispite me passing the args into the value at data.set("data." + player.getUniqueId().toString(), TwitchName); and i have a red underline on .save in data.save(file);

public class Verify implements CommandExecutor 
{
    String TwitchName;
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String [] args) 
    {
        TwitchName = args[0];
        Bukkit.getLogger().info(TwitchName);
        if(!(sender instanceof Player)) 
        {
            sender.sendMessage("Only players can send this command");
            return true;
        }



        Player player = (Player) sender;

        File file = new File("PlayerStreamData.yml");
        FileConfiguration data = YamlConfiguration.loadConfiguration(file);
        data.set("data." + player.getUniqueId().toString(), TwitchName);
        data.save(file);

        return true;
    }
}

//this is how i initialize the file on server startup in the "main" class

        try {
            File PlayerStreamlist = new File("PlayerStreamData.yml");
            if(PlayerStreamlist.createNewFile()) {
                Bukkit.getLogger().info("Player Whitelist File Created:" + PlayerStreamlist.getName());
            } else {
                Bukkit.getLogger().info("file " + PlayerStreamlist.getName() + " already exists");
            }
        } catch (IOException e) {
            Bukkit.getLogger().info("an error has ocurred while creating or checking for player stream list file");
            e.printStackTrace();
        }
wet breach
#

To make it easier for a server admin or mod to edit the tutorial stuff

kind hatch
wet breach
#

Make sure to implement a nice error message too

#

Its good practice to just not only catch the exception but actually do something lol

#

Or you can just mystify your users or yourself with some stack traces like most do

kind hatch
wet breach
#

Maybe should have pinged them? Lol

kind hatch
#

tf

#

I clicked their post as the reply. lmao

#

I got the discord bug

#

After all this time

wet breach
#

Ah

clever crescent
wet breach
#

Anytime you mess with io it needs to be surrounded with try catch unless your lazy and state your method throws io

#

But you will still at some point at least catch it one time

kind hatch
wet breach
#

Saving data still throws io exception

#

Because even though file exists there can be issues with writing

#

Cause of perms, no more room etc

kind hatch
#

true true

clever crescent
#
        try {
            data.save(file);
        } catch(IOException e) {
            Bukkit.getLogger().info("oops no save hehe c:");
            e.printStackTrace();
        }
#

that would do the trick i assume?

kind hatch
#

Yep

wet breach
#

Yeah that works

#

At least with the nice message makes it easy where this error comes from lol

quaint mantle
#

How do i start making plugins

wet breach
#

And with that, back to doing my tire related duties. Gotta figure out what is to be done with my door since someone broke it

kind hatch
#

Duct tape is a great temporary solution. Used it to fix my bumper that someone ran into. They ended up breaking the plastic clips that hold it in place.

clever crescent
#

success! tysm :D

kind hatch
wet breach
#

Doubt duct tape will fix this lol

#

Either someone on the previous shift did this and said nothing or someone ran into it again

kind hatch
#

Hmmm

wet breach
#

Not really a big deal if someone broke it, but people are dumb in speaking up lol

kind hatch
#

Gonna break out the torch and mallet? bang it back into roughly the original shape?

#

Or just get enough for the clearance. lol

wet breach
#

Probably wont use the torch and most likely will be our building maintenance guy in the morning. Its what they did last time when someone hit it with a box truck

#

One day i will get a new door

wet breach
#

As long as it can open and close and lock that is all they care about

kind hatch
#

Yea, that's typically what happens. At least what I'm used to seeing.

wet breach
#

My floor basically turned to powder in one spot

#

It was filled in with fiber glass lol

#

Not that a fork lift needs to drive in there or anything XD

#

I use a squeeze lift and it has to go inside of there. Fortunately that fiber glass has held up thus far

#

Hole was like offset from the center to the left so i drive over that spot a lot

#

Floor is like 3/4 wood except at the very ends its metal

kind hatch
#

Ah, that makes sense now. I was assuming the floor was concrete and they were patching it with fiberglass.

wet breach
#

Lol. Its a connex box

shadow zinc
#

What would you consider to be an A+ in MSPT?

#

its for a plugin im making

zenith gate
#

Soo why would EntitySpawnEvent be casted when an entity dies? I don't have any events for deaths currently, but everytime I kill one of them a random monster spawns ( my custom ones ). I'm so confused.

echo basalt
#

mob cap?

zenith gate
#

shouldnt be hitting it

rotund ravine
#

Mc wants there to be x monsters

#

And mobs

#

When one dies

#

One needs to be replaced

#

πŸ’ͺ🏻

#

Simplified

wet breach
#

Cut off the head of one and two more takes it place

zenith gate
#

really thats what it is?

#

but why? im replacing a mob that has spawned it should've taken its place. therefor wouldnt it spawn somewhere else instead right on where it died?

#

cause it would really fuck with someone if a boss death summons another boss. people would be pissed.

#

cause like well they arent easy lmao

sullen marlin
#

If it's th same mob spawning then you have some plugin messing stuff up

#

Print exactly the events, maybe with an exception to get a stack trace

zenith gate
#

wym print exactly the events?

chrome beacon
#

spawn and death ig

sullen marlin
#

Print the entity involved in both

zenith gate
#
[02:29:46 INFO]: CraftExperienceOrb
[02:29:46 INFO]: CraftVex
[02:29:46 INFO]: CraftExperienceOrb
[02:29:46 INFO]: CraftExperienceOrb
[02:29:46 INFO]: Named entity EntityEnderman[' Slack'/258, uuid='d727dca0-24d8-42de-811e-f9d5b584ab03', l='ServerLevel[world]', x=-61.45, y=63.00, z=370.82, cpos=[-4, 23], tl=12, v=true] died:  Slack was slain by ToastARG using [The Furnace]
[02:29:48 INFO]: CraftZombie
[02:29:48 INFO]: CraftEnderman
[02:29:48 INFO]: CraftEnderman
[02:29:48 INFO]: CraftVex
[02:29:48 INFO]: CraftEnderman
[02:29:48 INFO]: Named entity EntityEnderman[' Slack'/269, uuid='5620a417-4a61-45bd-bfb4-5416fee0853c', l='ServerLevel[world]', x=-61.03, y=63.00, z=369.43, cpos=[-4, 23], tl=11, v=true] died:  Slack was slain by ToastARG using [The Furnace]
[02:29:49 INFO]: CraftSkeleton
[02:29:49 INFO]: CraftCreeper
[02:29:49 INFO]: CraftEnderman
[02:29:49 INFO]: CraftItem

this was all during the spawn of the enderman, and the death. i killed him and another spawned. i killed a zombie a slack spawned, once i killed that slack again, another spawned, then it stopped.

wet breach
#

Do you have some kind of task for spawning?

zenith gate
#

All I am doing is checking for every spawn event and there's a chance for each one of my monsters to take that place. highest chance is 11% rn lowest is 4%.

wet breach
#

Alright. How often does it check and did you consider if certain limits are hit?

hushed spindle
#

is there any method to check if the player is standing on ground or not, since isOnGround() is deprecated

wet breach
#

I will give an example

hushed spindle
#

nothing

zenith gate
hushed spindle
#

it just says it can be spoofed by the client and so is inaccurate

wet breach
#

If the limit is 89% full. That means your 11% guarantees a spawn and the minimum still yields 93% odds

hushed spindle
#

getting the player location and checking the block under it also isnt always accurate because it doesnt account for the player sneaking off the edge of a block so i was thinking using the players bounding box and checking the 4 bottom corners of it and seeing if theres a block under that

#

but i reckon that'll fail for blocks that arent complete like fences

zenith gate
#
private static void summonMonster(EntitySpawnEvent event, Monster monster, Double spawnChance, Integer radius){
        Random random = new Random();

        if (!(random.nextDouble() <= spawnChance)) return;

        event.setCancelled(true);

        Location spawnLocation = event.getLocation();
        Player nearestPlayer = Players.findNearestPlayer(spawnLocation, radius);

        if (nearestPlayer != null) {
            MonsterType monsterType = CalculateAttribute.DetermineType(LevelManager.getLevel(nearestPlayer));
            Monster.SummonMonster(monster, spawnLocation, monsterType, nearestPlayer);
        }
    }

this is how im doing it, idk if i took yours another way but it didnt sound like what i was doing.

wet breach
#

So here is another example

zenith gate
#

Yeah but it's being replaced no? im cancelling the orignal and using my own.

#

it should just stay the same.

wet breach
#

Depends how many times its called i guess lol

hybrid spoke
#

could it be that you recall the event with your summon

zenith gate
#

its only when it spawns tho. death shouldnt trigger it.

zenith gate
wet breach
#

The spawn rate for trying to spawn a mob must be fast enough that it appears mob spawn is guaranteed. You should add a delay to counter this. But probably should print a debug message for every spawn along with time

zenith gate
#

how would i delay it?

wet breach
#

You would just create a delayed task or better yet just create a que management system to handle your custom spawns and be independent of spawning all together and dont have to worry how many you cancel except continue intercepting the command ones

#

Should solve your issue and basically give you all the control you want

zenith gate
#

I wouldn't even know how to create the que system, and I just still don't understand why it doesn't work properly. any other time if done something like this i didnt have this issue. But I changed how I create, and manage them, I didn't really change how they were spawned.

#

all i did was make some things easier down the road

wet breach
#

Well as i said it could be the spawn rate. If the mob limit is high and amount of mobs total low and there is plenty of areas to spawn the server can easily spawn 20 mobs every few ticks until about half or so full towards the limit

zenith gate
#

could i check if i've reached the mob limit, and remove something else instead to make room?

wet breach
#

Lets say 20 mobs try to spawn each tick for 20 ticks. How often will 11% be hit? Lol

wet breach
#

These limits are in spigot.yml

zenith gate
#

if i increased those would that fix it? cause that also seems like a good option.

wet breach
#

You would want to decrease

zenith gate
#

i thought we had to make room for it to spawn? if i lowered it woouldnt that make it worse?

wet breach
#

There is spawn rates, overall server entity limits and per chunk limits

zenith gate
#

ohhh

wet breach
#

Make a copy of spigot.yml so you have defaults handy. Messing with these can take time lol

zenith gate
#

yeah and damn i've actually never opened this file before. there's actually a lot of shit in here.

wet breach
#

Yeah

zenith gate
#
entity-activation-range:
      animals: 32
      monsters: 32
      raiders: 48
      misc: 16
      water: 16
      villagers: 32
      flying-monsters: 32

What are these?

wet breach
#

How far you can be for those types of entities to move or do things

#

Those are in blocks

zenith gate
#

ahhh okay, so if i were to have custom follow ranges, this would be necessary.

wet breach
#

So animals will move around if your 32 blocks or closer but once farther they stop

#

Or freeze to be more accurate

wet breach
zenith gate
#

true..

wet breach
#

If you use goals most likely. But if you handle the movement manually most likely not

zenith gate
#

I'm not seeing what i need to change for those rate limit things.

wet breach
#

Check bukkit.yml then

zenith gate
#

yep spawn-limits is here

#
spawn-limits:
  monsters: 70
  animals: 10
  water-animals: 5
  water-ambient: 20
  water-underground-creature: 5
  axolotls: 5
  ambient: 15
chunk-gc:
  period-in-ticks: 600
ticks-per:
  animal-spawns: 400
  monster-spawns: 1
  water-spawns: 1
  water-ambient-spawns: 1
  water-underground-creature-spawns: 1
  axolotl-spawns: 1
  ambient-spawns: 1
  autosave: 6000

Which of these do i modify?

#

just the spawn limits or also the ticks-per?

wet breach
#

Ticks per is how many globally will try to spawn

#

While 400 may seem high for animals have to remember not all spawns will succeed

zenith gate
#

do we know aprox how many fail?

wet breach
#

Spawn limits, is how many globally and i think the chunks one resides in spigot.yml

wet breach
zenith gate
#

that makes sense

wet breach
#

So for example spiders. A spider will try to spawn if the light level is low enough and there is at least a 1 block space for it. If it comes from a spawner the limit is 16 blocks all around the spawner

zenith gate
#

Okay, so how would i adjust these to fix my problem? We'd want it lower?

wet breach
#

Well this is where you get to have fun lol

zenith gate
#

fuck with it till it works lmao

#

that'll be tommorows task then. its 3;30am here. At least i know what the problem is now.

#

I appreciate the help!

wet breach
#

Got to love percentages and odds and if you go through them fast enough lol

wet breach
upper hazel
#

hey how i can find for read craftBukkit code

#

craftSpigot too

#

tried to find it but couldn't find it

hazy parrot
#

?stash

undone axleBOT
upper hazel
#

thf

shadow night
#

what is CraftSpigot

storm crystal
#

Is it okay if I have static methods and event listeners that are registered in a class?

chrome beacon
#

What do the static methods do

storm crystal
#

Generally or in my particular case?

chrome beacon
#

Your use case

rotund ravine
#

Olivo is a newbie, please explain it to him

shadow night
storm crystal
#

I doubt that every class that'd use any of those would need to have separate instance

#

But im curious if I can mix it like that

#

Static methods and event listeners in one class

wet breach
#

For the nms stuff and then the cb and spigot is in their respective directories

#

Can import them into your ide if you want

#

Stash only gives you the api and git patches

wet breach
#

Singleton is one thing, but static it typically shouldnt. Reason being if for some reason you need to clear it out to refresh you wont be able to

#

If its static

storm crystal
#

So I keep it as is?

wet breach
#

Yep wont hurt anything. Also later down the road you might want to do some abstraction with it or something else. If it's static this makes it harder to do and you end up changing it back anyways

storm crystal
#

Is it any not super okay if I make instances of class with listeners despite not using them in those instances?

upper hazel
rotund ravine
glacial coral
#

Would there be an easy way to find an items display name (when it's not set) other than getting its type and then putting it to lower case, and capitalizing each letter at start of a new word? So NETHERITE_SWORD becomes Netherite Sword?

#

Or is it just something you have to sit and create a translation for each item?

#

I found out that if you do meta.getDisplayName() from an ItemMeta, you won't get any unless the item has been set a name by an anvil or the .setDisplayName function

rotund ravine
#

What version are you using

#

@glacial coral

glacial coral
#

1.20

rotund ravine
#

Let me check

#

?jd-s

undone axleBOT
glacial coral
#

Well that sucks. I guess I could cheese it by setting a displayName when it's being crafted?

#

It's just weird that it doesnt register the display name automatically since there clearly is one there ... 😦

#

Nevermind, it's way cleaner to just remove underscores, lowercase and uppercase each new word and I guess that's just how Mojang made it as well

fluid river
#

free Microsoft Java lessons

rotund ravine
#

A danish user will see β€œSten” for Stone etc egΓΈtc

#

Etc*

fluid river
#

tho you probably can find a library which has a method for returning item base name for each locale like LanguageUtils

rotund ravine
#

It does

storm crystal
rotund ravine
#

Your sentence

storm crystal
fluid river
#

wdym instantiate a listener class and don't use it

#

you mean like not register it?

#

well, i already mentioned it, but it's too old for him ig

#

it returns a pair en_us ig

#

in lowercase

#

wiki states it's in lower

#

the locale key at least

#

the display might be like en_US

fluid river
#

maybe you can do smth else

#

I mean for cases like displaying your current held item to chat you can use ChatComponents and Locale settings

glacial coral
#

Nah ill just remove underscore etc etc.

#

Its way easier. All I'm doing is making a death message hehe

#

Just wanted to include the weapon name if any item was used

#

Next step is to learn how to link the item in the chat so it looks even cooler

fluid river
#

well, only display the item name if it has one

#

otherwise just say "Player died from some shit"

glacial coral
#

Yea ik

fluid river
#

"&aPlayer was killed by &csus"

glacial coral
#

Sir thats illegal

storm crystal
#

Or should I split them

rotund ravine
#

What

#

Don’t do that

#

Move those methods somewhere else

fluid river
#

2 instances of something is kinda cringe in general(except stuff which is mass-produced(like all zombies in the world) or has a hard but big limit(all server players))

storm crystal
#

So if I want to use those methods I make one instance in main class and pass it to other classes?

#

Wouldnt it be easier to just make it static?

fluid river
#

depends

#

can you paste your current code

storm crystal
#

Im at uni so later

#

πŸ˜”

native bramble
#

i need to unfroze biomebase registry to create custom biomes, how can i get registry?

#

here is my code now:

RegistryMaterials<BiomeBase> materials = ((RegistryMaterials<BiomeBase>) dedicatedServer.aU());```
#

i cant understand what i need to write after aU()

#

like which method

#

in 1.19.2 it was java dedicatedServer.aX().b(IRegistry.aR)

rotund ravine
#

?nmsmapping

#

?nms

eternal oxide
#

?mappings

undone axleBOT
native bramble
#

ty

wet breach
#

That gets the language that is set

#

By the client depending which locale it is otherwise if its the wrong one it gets the locale of the server instead lol

spare hazel
#
@EventHandler
    public void onBlockDropItem(BlockDropItemEvent e){
        if(e.getBlock().getType() != Material.LIGHT_BLUE_WOOL) return;

        e.setCancelled(true);
        e.getItems().remove(0);
        if(e.getPlayer().getInventory().getItemInMainHand().getType() == Material.SHEARS) return;

        HypixelPlayer playerAccount = HypixelSkillCore.getInstance().getPlayer(e.getPlayer().getUniqueId());

        playerAccount.setMithrilPower(playerAccount.getMithrilPower() + playerAccount.getMithrilFortune());
        if(playerAccount.getMithrilPower() > playerAccount.getMaxMithrilPower()){
            playerAccount.setMithrilPower(playerAccount.getMaxMithrilPower());
        }

    }```
why is this still dropping the light blue wool
tender shard
#

@spare hazel did you set api-version to at least 1.13 in plugin.yml?

spare hazel
#

lemme check

#

yeah its 1.17

tender shard
#

then add some debug statements

#

to see where it returns

spare hazel
#

okay

tender shard
#

my guess is the getBLock() is already set to air

rotund ravine
#

It is

#

?jd-s

undone axleBOT
tender shard
#

use getBlockState()

#

that gets you the block before it was broken

tender shard
spare hazel
tender shard
spare hazel
#

oh nvm

tender shard
#

1.17 has it too

#

call it on the event, not on the block

#

if(event.getBlockState().getType() == Material.LIGHT_BLUE_WOOL) or sth like that

upper hazel
#

why do some plugins have a folder with a bunch of modules?

tender shard
#

because they use NMS

upper hazel
#

what his mean

tender shard
#

NMS is version specific code

#

it uses minecraft internals

#

not just spigot api

#

and those change each version

wet breach
tender shard
#

https://blog.jeff-media.com/maven-multi-module-setup-for-supporting-different-nms-versions/ here's a guide on how to do that. but you should avoid using NMS unless it's absolutely necessary

Hi there! Today I’m going to explain how to setup a multi-module project using maven to support different NMS versions. Important notes about this tutorial: Every step will have detailled screenshots using IntelliJ. I explicitly chose not to include everything as copy/pastable source code, but normal screenshots (you can click on them to show th...

upper hazel
#

support for different versions?

tender shard
#

NMS is not needed in 99% of cases on modern spigot versions

#

it used to be required a lot in old versions, e.g. to send action bar messages in 1.8

#

but in 1.20 there is very little reason to use it

#

using NMS means your plugin will most likely break on major updates

gleaming yarrow
#

well yeah for simple stuff it aint needed esp if you dont mind using protocol lib

spare hazel
#

DUDE WHY LEAVE ME ALONE

#

@tender shard nothing changed

tender shard
#

before every return, print out why it returns

spare hazel
#

oh i know why

tender shard
#

why?

rotund ravine
#

Did u register it

upper hazel
spare hazel
#
@EventHandler
    public void onBlockDropItem(BlockDropItemEvent e){
        if(e.getBlock().getType() != Material.LIGHT_BLUE_WOOL && e.getBlockState().getBlock().getType() != Material.LIGHT_BLUE_WOOL) return;

        e.setCancelled(true);
        e.getItems().clear();
        e.getBlock().getDrops().clear();
        e.getBlockState().getBlock().getDrops().clear();
        e.getPlayer().sendMessage(e.getBlock().getType().toString());
        e.getPlayer().sendMessage(e.getBlockState().getType().toString());
        if(e.getPlayer().getInventory().getItemInMainHand().getType() == Material.SHEARS) return;

        HypixelPlayer playerAccount = HypixelSkillCore.getInstance().getPlayer(e.getPlayer().getUniqueId());

        playerAccount.setMithrilPower(playerAccount.getMithrilPower() + playerAccount.getMithrilFortune());
        if(playerAccount.getMithrilPower() > playerAccount.getMaxMithrilPower()){
            playerAccount.setMithrilPower(playerAccount.getMaxMithrilPower());
        }

    }```
still no result
storm crystal
#

Whats nms command

tender shard
rotund ravine
#

@spare hazel smh

#

Use || if u want to keep the starting thing

tender shard
#

getBlock().getType() will almost always be AIR

rotund ravine
tender shard
storm crystal
tender shard
#

?nms