#help-development

1 messages · Page 484 of 1

tender shard
#

"With DI you can't pass it" erm lemme show oyu an example:

new User(myPlugin);
eternal night
#

Your written explanation hurts my brain

tender shard
#

see, it works

sterile token
#

No Man I'm being serious trying to explain but the english is really bad. Inwill translate what i mean

tender shard
#

nice cooking skills. "Today we'll cook a tasty porkchop. All you need is 2 cubic meters of cactus"

pulsar flicker
#

I don't mean using the recipe system, but the interface.

wild nexus
#

Hello, someone know why i've got an error when i try to compare two chunks like that : if(e.getChunk().equals(cs.getLocation().getChunk())) { ?

worldly ingot
#

I believe what they're trying to say is that with a User it's a little awkward to sneak in an instance of your main class, which I kind of sympathize with. It's a strange instance to have to pass into the constructor of your User object because imo they're really not (or at least shouldn't be) tightly coupled

tender shard
worldly ingot
#

At least that's how I'm interpreting their messages lol

tender shard
#

yeah but if the alternative is a static getter, there's no difference

mortal hare
#

man i hate cmake sometimes

#

i left a comma

#

inside function arguments

#

and i wondered why it wouldnt work

mortal hare
#

and guess what cmake doesnt use comma syntax for args

#

so i wondered wtf is wrong

worldly ingot
tender shard
#

not just parts of it

mortal hare
#

smth is bad at WorldListener.java at line 16

wild nexus
pulsar flicker
#

Why do you need to access the main class in the first place?

tender shard
#

then you're causing chunks to get loaded in the ChunkLoadEvent

sterile token
#

It all starts with passing instances of your main class to different objects. In my case I use DI for this process. It is very like using it and its advantages.

But at least from my point of view it has flaws when working with objects which are not initialized. Like utility classes, model objects to store property with results (for example an entity User, Group, etc).

tribal quarry
tender shard
#

getChunk() loads the chunk

worldly ingot
#

If you have a utility class that requires an instance of something, then it can't be a utility class

tender shard
worldly ingot
#

(assuming it's an instance that isn't passed as a method parameter)

sterile token
#

Can you elaborate it More?

tender shard
#

a utility class shouldnt depend on anything

#

StringUtils, that's a utility class

sterile token
#

Arent static method utilities ? Or I'm confusing things

wild nexus
eager jacinth
#

Does anybody know if it is possible to make a value in LoadingCache (Guava) immutable? That is, when I get a value from the cache and edit it, it is updated in the cache. Maybe I should just use copy constructor/Cloneable or something else?

wild nexus
tender shard
#

stop loading chunks in your ChunkLoadEvent

worldly ingot
#

All utility methods are static, not all static methods are utilities

#

static just means a method has no state

#

A utility method that requires some instance of something that isn't directly passed to the constructor cannot be labeled a utility method

#

It should probably be an instance method and your current design is flawed

wild nexus
tender shard
pulsar flicker
#

I'm assuming you just wanna check if the location is inside a specific chunk

wild nexus
# tender shard wdym?

I want to check if the chunk who is loading is a certain chunk for start my mob spawning

wild nexus
tender shard
#

just mark the chunk with a PDC key

tender shard
#

the in chunkload event, check if the chunk has that pdc key

tribal quarry
#

And store X and Z values?

tribal quarry
sterile token
#

Oh right, going back to my question what would be this clasified as?

public class Example {

Static oolean hasProperty() {
MainClass plugin = ?
If (bla.something()) return plugin.getBla().getProperty();
return bla;
}

}

worldly ingot
#

Probably a method that should be in your main class

tender shard
#

yes

sterile token
#

But what if it's satic?

worldly ingot
#

If the entire body of that method relies on the existence of an instance of an object, it should be an instance method of that object

sterile token
#

Apply the same?

tender shard
tribal quarry
#

Why there's so many coding rules, holy crap, just write the code bro

worldly ingot
#

I just see no reason to make it static

tender shard
#

obviously it needs your main instance

#

it does not belong to be static

#

making this static would be "wrong" because it requires an instance

sterile token
#

I think I'm not really explaning what i mean

tender shard
#

you didn't really understand when to use static and when not to

worldly ingot
tender shard
#

that method should be in your main class, not-static, or in a PropertyManager or sth, that your main instance returns with getPropertyManager() or whatever

worldly ingot
#

People have failed to write good code to get to a point where others can learn from it

tribal quarry
sterile token
#

Hmn Let me find some Berger example

pulsar flicker
worldly ingot
#

I know, that's why concepts should be explained, not told lol

tender shard
#

// Plugin disable logic

wild nexus
pulsar flicker
#

That's not a quick solution tho, so why would someone want a real explanation?

hollow birch
#
        PacketContainer packet = manager.createPacket(PacketType.Play.Server.BLOCK_BREAK_ANIMATION);
        if (Utils.getPickaxeFromItemStack(player.getInventory().getItemInMainHand()) != null) {
            System.out.println("Pickaxe");
            Pickaxe pickaxe = Utils.getPickaxeFromItemStack(player.getInventory().getItemInMainHand());
            if (pickaxe.getPickaxeTier() >= ore.getPickaxeTierRequired()) {
                Long delay = (long) (pickaxe.getMiningSpeed() * ore.getHardness());
                for (int i = 0; i <= 9; i++) {
                    final int finalI = i;
                    new BukkitRunnable() {
                        @Override
                        public void run() {
                            packet.getBytes().write(0, (byte) finalI);
                        }
                    }.runTaskTimer(main, 0L, delay);
                }
            }
        }```
tender shard
hollow birch
#

this is my code for handling sending the animation to the player

hollow birch
#

its currently run in an on interact event

#

but no animation is being sent

tribal quarry
hollow birch
#

could that be due to this part here for (int i = 0; i <= 9; i++) { final int finalI = i;

#

i dont know if final can be used like that

#

since it can only be assigned onc

worldly ingot
hollow birch
#

it would always be 0?

tender shard
#

why are you using packets for block damage? o0

worldly ingot
#

Not entirely sure why someone would make a finalI variable, but no, it's created locally and assigned to i

tribal quarry
tender shard
#

the only issue there is using protocol lib

sterile token
#

Lets say you have a TeamColor enum, which you want be able to get the team name. And a display of the team, but that display must setted on a config file. Theere you a clarify example of what i mean and you need a config object from main class. How would that apply there?

hollow birch
#

ive never used packets before so

tender shard
tribal quarry
#

Just do Bukkit.getScheduler().runTaskTimer

#

And use lambda syntax

tender shard
hollow birch
#

because im changing vanilla mining speed

tender shard
#

and why don't you use the API for the block damage?

sterile token
hollow birch
#

this is the only way ive seen it done before

tender shard
#

somePlayer.sendBlockDamage(...)

tribal quarry
icy beacon
#

anyone knows off the top of their head how does the output of Bukkit.getBukkitVersion() look like? i mean the format of the string, how it looks

sterile token
grizzled oasis
tribal quarry
icy beacon
tender shard
#

1.19.4-R0.1-SNAPSHOT

sterile token
#

Wouldn't it be absurd to initialize a TeamColor class for each color?

sterile token
#

Just because you need a config reference

grizzled oasis
tender shard
tender shard
#

which classes is it unable to find?

fluid river
#

you can use static util class

grizzled oasis
tribal quarry
#

locX?

sterile token
tender shard
tender shard
grizzled oasis
orchid trout
#

i am the cafe cat

tender shard
tender shard
orchid trout
#

wtf

#

?learnjava

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

sterile token
orchid trout
#

we are one and the same

tender shard
sterile token
#

Right I'm Will type it and send it

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

fluid river
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

sterile token
#

I'm on cellphone that why it's really diffxoult

fluid river
#

just wait until you get to pc

#

lol

sterile token
#

I can't sleept without knowikf tonfix this

fluid river
#

stop

sterile token
fluid river
#

pls

grizzled oasis
sterile token
#

What ?

grizzled oasis
tender shard
tribal quarry
tender shard
#

idk it's very hard to talk to you as all you say is always "not working", "not possible", but never show any screenshot or actual error message @grizzled oasis

tribal quarry
#

Since x() is an obfuscated name for a function

hazy parrot
#

You are trying to call getMethod on something that isn't Class<T>, of course it wouldn't work

worldly ingot
hazy parrot
#

If I understood right

sterile token
#

He Is calling obfusxated code directly without remaps

worldly ingot
#

TeamColor(String displayName)

pulsar flicker
#

calling backwards is usually something to try and avoid

#

imo

tribal quarry
orchid trout
#

mona cat

tender shard
#

why the heck would anyone use reflection for NMS in the first place?

#

it changes names on every version

worldly ingot
#

In the days of yore, my friend

tribal quarry
#

Well that's why I asked that first of all

pulsar flicker
#

or have people finally stopped playing that version?

tribal quarry
sterile token
#

He Is coding in 1.8 to start, where remaps doesn't exists. So you have to calle.dirextly obfusxated method

tender shard
#

people stopped playing 1.8 a long time ago, there's only like 5% of servers left using that version

icy beacon
#

hypixel is quite significant i might mention

tribal quarry
pulsar flicker
#

they on 1.12 now?

tender shard
sterile token
#

I mean dont point the versión iif Is he using he has reason. We are free to help. If not it better to rest

tribal quarry
worldly ingot
#

Realizing only now that I have no idea why the Field instance is a field

tribal quarry
pulsar flicker
#

what kind of host is that? lol

worldly ingot
#

Probably tbh

#

We'd just need a more general server properties API because we really do not have one

icy beacon
#

also true

sterile token
#

I really get upset why people only point the versión if you code on 1.8, Is because people has reason. But if you wont help just rest Is better

tender shard
sterile token
grizzled oasis
tender shard
#

you literally even say "method x()"

#

it's called y() in the next verison

#

or a2()

tribal quarry
#

Try using remapped jar

tender shard
#

mojang maps exist so you can use the same code for all versions

tribal quarry
#

And modules

tender shard
#

instead you do the opposite and write a class that only works in one version and even needs reflection

grizzled oasis
sterile token
#

CraftServer specific if I'm not wrong. Some of them are not with public modifier. So you have no other way rather acess them vía reflection

tender shard
#

?nms

pulsar flicker
#

Are there remapped jars for < 1.16?

tender shard
#

?nms

tender shard
sterile token
#

Sadly not

tribal quarry
#

There is

pulsar flicker
#

good reason to ditch those old versions

tribal quarry
#

MCP ones

sterile token
#

So if you Will code on < 1.16, up better way Is protocol library. Instead of plain NMS working

tender shard
#

protocol lib is the worst pain ever

tribal quarry
#

Using NMS itself is way better than plib

tender shard
#

^

pulsar flicker
#

Just force players into newer versions of the game, or is there an actual reason to stay in previous versions?

tribal quarry
sterile token
#

I mean isn't More hard, you have to self reflect the craft server things, etc

tribal quarry
#

Till now💀

sterile token
tribal quarry
#

Just use Netty and NMS functions itself

sterile token
#

Nah spigot sucks, they dont even use protocol standar

#

Not even Protobuf

#

💀💀

tender shard
#

oh

#

wrong reply

sterile token
#

Standar**

#

Shity cellphone

quiet ice
#

Standard you mean

tender shard
#

protocol standar?

quiet ice
#

But even that makes little sense. You mean protocol API?

sterile token
#

Yes protocol has a standar which means that they must use Protobuf for better usage and.impl

quiet ice
#

Also, why would one want Protobuf in spigot?

#

Plus it's google so ew

tribal quarry
sterile token
tender shard
#

today, I dont understand a single word verano tries to say

tribal quarry
#

Buffers are such mess

quiet ice
sterile token
#

You have to self decode it, use shity var ints longs, etc. While with Protobuf you sor over the model.proto

tribal quarry
#

It's the way how Netty works

lost matrix
tender shard
quiet ice
#

Same with services

sterile token
#

Yes i mean that Geol, exactly that. Working with MC.protocol Is like repairing a 2023 car piece, just buy a new piece

tender shard
#

yeah with protobuf you just "sor over the model.proto"

#

erm whut

#

fr verano can you pls at least try to create proper sentences lol

quiet ice
#

You then have Stacktraces that are a bazillion lines long and it becomes difficult to figure out what exactly is missing
So no, Protobuf's *.proto files are NOT the way forward

tribal quarry
#

Honestly I didn't understood too

lost matrix
tribal quarry
#

^^

tender shard
#

well verano hasn't, he uses protocollib and so has to do getLongs(), setInt(...) etc lol

quiet ice
#

Even then, you rarely want to directly operate on the network (unless you use plugin messaging channels but there you are free to set your own encoding)

lost matrix
#

ProtocolLib also simply wraps the classes. They dont actually write bytes into the encoded packets.

sterile token
quiet ice
tender shard
#

fun fact @sterile token , even if mojang would use protobuf or whatever you suggest, you would never be able to use it because they definitely won't add it to 1.8 lol

sterile token
tender shard
lost matrix
quiet ice
#

Smh, just use UDP

quiet ice
#

Or use that Appletalk protocol

tender shard
tribal quarry
pulsar flicker
#

My real time game is running on API calls 🙃

sterile token
#

Oh right im really interested on the topic about data synchronization and protocols

lost matrix
tribal quarry
tender shard
#

yes and then even count that per type
new NMSPacket(100, "something", 50)
now in protocllib
getIntegers().get(0).set(100)
getStrings().get(0).set("something")
getIntegers().get(1).set(50)
lol for real who the fuck invented this "system"

#

protocollib is just a huge joke

sterile token
#

What would you recommend me for joining and startimg around the data synchronization and protocols área?

tribal quarry
#

They actually went back to monke

lost matrix
tender shard
#

i didnt understand the sentence at all

pulsar flicker
smoky anchor
#

\o Hello ppl
I have come here yet again to seek your guidance!
Is there any way to store data into PersistentDataStorage without namespace
So the key would not be namespace:key but only key ?

tender shard
#

why would you want to do that?

tribal quarry
sterile token
smoky anchor
tender shard
#

also vanilla is not a plugin

#

vanilla knows exactly which keys it uses. you, as a plugin dev, have no clue which other plugins an admin installs

#

and hence we have namespacedkeys

smoky anchor
lost matrix
pulsar flicker
#

I only use my own plugins, so i don't have that problem :)

tender shard
#

imagine another plugin also wants to use "key". now your data is gone, good bye

lost matrix
sterile token
smoky anchor
lost matrix
#

Cross application communication is usually done by a broker. Redis or RabbitMQ are two examples.
Providing data is often done with Rest or Apache Kafka.

lost matrix
sterile token
tender shard
#

why don't you just create a PDC type for the vector

smoky anchor
tender shard
#

just create a PersistentDataType<double[],Vector>

smoky anchor
tender shard
#

then you only need one key instead of 3

tender shard
#

?morepdc

undone axleBOT
quaint mantle
#

Hello there is someone who would have tips for an import that is not found when I have the api? vice-president

lost matrix
quaint mantle
#

no sorry

tender shard
#

are you using maven?

quaint mantle
#

I have all the api but it has an import that I don't want

remote swallow
#

so dont use it?

tender shard
#

"it has an import that I don't want" wdyn? o0

pulsar flicker
#

you can type out the package you want an object to be from before the type.

quaint mantle
#

or can i post a screenshot?

sterile token
remote swallow
undone axleBOT
pulsar flicker
#

It's hard to explain something well if you don't have a good understanding of it.

tender shard
undone axleBOT
#

Usage: !verify <forums username>

sterile token
#

Sorry mfalex, for pingimg cellphone app get bug and.doesnt allow uncheck the tagging thing

pulsar flicker
#

which is why new programmers have trouble asking questions

weak meteor
#

how can i get server tps?

quaint mantle
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

weak meteor
#

im in 1.19.2

quaint mantle
#

!verifiy Julien0001

sterile token
#

If I'm not wrong

tender shard
tender shard
pulsar flicker
#

getServer().getTPS() ?

sterile token
#

Or Server#getTPS

chrome beacon
#

Spigot doesn't have that method

#

It's Paper only

eternal oxide
#

not in Spigot

tender shard
pulsar flicker
#

oh

sterile token
#

Oh my bad

weak meteor
#

nah

#

ive tried with everything

sterile token
#

I thoguht it was on spigot too

pulsar flicker
#

You can get the time after a tick and see how much time passed

#

and do some maths

tribal quarry
sterile token
#

Isn't with MinecraftServer ?

tender shard
#

slughorn DorkHeart

tender shard
sterile token
#

You can use MinecraftServer#getTPS()

#

If I'm not wrong

remote swallow
#

that is fabric

quaint mantle
sterile token
#

Wait wait Let me check

#

I rmeeber it was a method for 8t

tribal quarry
sterile token
#

Exactly that

#

💪🏽💪🏽

tender shard
#

when I already sent the proper solution twice

sterile token
#

Okay?

#

I meant if you dont want me to help i dont do it

tender shard
#

yeah idk wouldnt it make sense to just check that whatever you suggest actually exists before just sending random non-existent methods lol

#

i mean you sent 3 different methods, none of those exist

pulsar flicker
#

:)

sterile token
#

No need to be rude, I'm.not a machine whixy doesn't make errors

tender shard
tender shard
tribal quarry
shadow night
quaint mantle
tender shard
quaint mantle
tender shard
#

yeah obviously that import doesn't exist. just remove it?

grizzled oasis
#
'x()' has private access in 'net.minecraft.server.v1_16_R1.EntityLiving'
((org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer) player).getHandle().x().getPlayerChunkMap().movePlayer(((org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer) player).getHandle());

someone knows why? by the IDE

tribal quarry
quaint mantle
#

and I have to be the what?

tender shard
remote swallow
#

its pre moj maps so who knows

grizzled oasis
tender shard
tribal quarry
quaint mantle
tender shard
quaint mantle
#

can you send me the link in private message please

tender shard
#

no

#

also what link are you talking about?

#

just remove the import

grizzled oasis
grizzled oasis
pulsar flicker
#

What are you trying to do?

tender shard
#

then why don't you just use spigot's teleport() method? o0

grizzled oasis
tribal quarry
#

so do entityplayer.getClass() or net.minecraft.....EntityPlayer.class

#

then

remote swallow
#

check screaming sandles to figure out what x is and to see what the correct way to get itis

grizzled oasis
tribal quarry
#

you need to get the private method, set it as accessible for the class that you are trying to call with, then call invoke()

tribal quarry
#

reflection is pain to understand

grizzled oasis
#

i imported various nms

tribal quarry
#

dude

#

you see that getMethod?

#

or just the getClass thing?

#

that's called java's reflection

remote swallow
#

or check screaming sandles and check if you can do it without reflection

tender shard
grizzled oasis
tender shard
#

that's in ServerPlayer / 1.16.1

remote swallow
#

its on EntityLiving

tender shard
#

but they had a lower case x()

grizzled oasis
tender shard
#

lower case x() on LivingEntity is a void and it's "updateSwimAmount()" lol

remote swallow
tribal quarry
grizzled oasis
tribal quarry
#

its a complex class, used for tracking entities

tribal quarry
#

or

#

lemme check

#

for a sec

grizzled oasis
#

where?

remote swallow
tender shard
#
| Mojang                       | Obfuscated                              |
|------------------------------|-----------------------------------------|
| ChunkMap#move(ServerPlayer)  | PlayerChunkMap#movePlayer(EntityPlayer) |
| ServerPlayer#getLevel()      | EntityPlayer#getWorldServer()           |
| ServerLevel#getChunkSource() | WorldServer#getChunkProvider()          |
| ServerChunkCache#chunkMap    | ChunkProviderServer#playerChunkMap      |
#

these are the classes and methods names you need @grizzled oasis

#

Player -> get NMS player -> getLevel() -> getChunkSource() -> chunkMap -> move(...)

tribal quarry
#

chunkMap field is public

#

bro hell

tender shard
#

i wonder what hat method even does though

#

I mean it only takes a player but no destination?

tribal quarry
#

((CraftWorld) player.getWorld()).getHandle().getChunkSource().chunkMap.movePlayer

grizzled oasis
tender shard
tribal quarry
tender shard
#

it should either be getChunkProvider instead of getCHunkSource, or movePlayer should just be move

tribal quarry
#

((CraftWorld) player.getWorld()).getHandle().getChunkProvider().playerChunkMap.move

quaint mantle
#

Link for version ? please

pulsar flicker
#

just google jnbt

trim lake
#

Hi, I have maybe some stupid question. Why I should use Maven or gradle? Im not using any of these just play java and everything is fine I guess? Sorry for stupid question new here.

tender shard
#

imagine you put your project on github, now people have to manually add the spigot-api etc

#

if you use maven (or gradle), people just clone it from github and it's done

#

and it'll work with every IDE

pulsar flicker
tender shard
#

and it can automatically shade dependencies, relocate them, etc etc

remote swallow
#

it also minimizes the effort other people need to put in for it to work

#

they can clone and go, maven/gradle handles getting the deps

#

if its an ide build system they need to go download all the jars then add it to the project

tender shard
quaint mantle
tender shard
#

or in north korea

quaint mantle
#

no UK

tribal quarry
#

or iran?

tender shard
#

then it's the first result

#

on google

trim lake
#

Hmm thats sound like reason. Im using just plain java now because working on some private plugins for my server so its fine. Is better to start with maven or gradle? I know is mostly personal but I dont know any of these, so what is better for baginer?

quaint mantle
#

Morlok8k/JNBT: JNBT: The Java NBT Library

somber night
pulsar flicker
#

imo, not using maven is more comfortable for private projects

eternal oxide
#

I thought so too, for a while

tender shard
#

i would never NOT use maven again

eternal oxide
#

Now I'd always use maven

trim lake
tender shard
#

np

eternal oxide
#

once you realise all your dependencies get downloaded to your local repository you'll not worry about maven

trim lake
pulsar flicker
eternal oxide
#

build once and forever you will be offline

tender shard
pulsar flicker
#

everyone is allowed to have their own opinions :)

ocean hollow
#

please help, how to fix this

#

I need to set armor_stand y like player y

#

standloc.setY(player.getLocation().getY()) - doesn`t work

tender shard
#

whats the issue

tribal quarry
#

that location object is just a cloned object of stand's position

tender shard
#

in the video sent, it seems to work perfectly

#

I don't understand the issue lol

icy beacon
#

maybe you're looking for getEyeLocation for Player

#

afaik that's a thing?

tawny remnant
icy beacon
#

?arrowcode

undone axleBOT
tender shard
#

because you call explode(a)

tawny remnant
#

i call that many times in that code which explode are you talking about

icy beacon
#

add debugs to each and see

pulsar flicker
#

you are checking for entities on the y axis of the block you are looking at

tribal quarry
analog valley
#

no shit alex. he is asking why the raytracing is triggered when facing down

pulsar flicker
#

so 0.4y is gonna be the block

#

not the block above

#

so there are no entities

#

so you call explode

analog valley
#

what ?

tender shard
#

and if they look down, it's obviously not null

#

I wonder why would anyone expect the raytrace result to NOT be not-null when looking at the ground

rotund ravine
#

Cause of my filter duh

icy beacon
tawny remnant
#

even when im flying it explodes

#

how is the raytracing triggered

tender shard
#

yeah well you yourself that you call explode() all the time

tawny remnant
#

how

#

am i a block

tender shard
#

i really don't get the question

#

you call explode() if rayTrace == null and if it's not null

lost matrix
tender shard
#

then you wonder why it keeps exploding

orchid trout
pulsar flicker
#

The RayTraceResult is not null, so it explodes.

tawny remnant
#

how is the raytrace triggered when there are not blocks around me

lost matrix
tawny remnant
tender shard
#

aqua = explode if raytrace is null
red = explode if raytrace is not null

tender shard
#

btw what's the for loop for? you loop over a list, then add the elements to the same list, then you catch the ConcurrentModificationException that will arise from this, only to ignore it again then?

ocean hollow
tribal quarry
tawny remnant
#

thank you

tribal quarry
#

try player.getEyeLocation()

tawny remnant
#

and i am not calling explode when raytracing is or isnt null

#

when it is null it checks for the entities around

#

and then explode

tender shard
#

there will always be entities around

#

the armor stand that you just spawned will be there

pulsar flicker
#

Is the raytraceresult ever null tho?

tawny remnant
#

yes

ocean hollow
tribal quarry
small timber
#

how can I detect it a player did a water mlg? there is no event for it

tender shard
#

what is a water mlg?

icy beacon
#

you could track player's y-velocity per tick, if it's 0 but was negative before, then the player has landed, and if the player is standing in water, then they either fell in water or did the water bucket thing

#

if you want to be precise then track BlockPlaceEvent and see if it's water, then combine it with the velo check

small timber
tender shard
#

oh I see

#

but why is it called mlg lol

tribal quarry
#

cause its not that easy to do

tender shard
#

yeah anyway, just listen to PlayerBUcketEmptyEvent, check if the placed block is Y below player's Y and if the X and Z coords are the same as the player's, or close, and if the player has a negative Y velocity

tender shard
orchid trout
#

is it okay to do this? java public void addAttacker(User user) { if (allAttackers.contains(user) || this == user) return; allAttackers.add(user); }

#

the this == user part

tender shard
#

sure

#

i'd do the == check before contains() though

tribal quarry
tender shard
#

since it's much faster and avoids having to look through the list everytime

orchid trout
#

other people will trigger it more than the user

tribal quarry
#

MLG is short for Major League Gaming and in Minecraft it refers to a set of survival tactics that can be used while playing the game in survival mode. There are multiple MLG tactics that can be used to prevent the player from the impact of a fall while playing the game in survival mode.
^^what google says^^

tender shard
orchid trout
#

ok

pulsar flicker
#

isn't that a company?

#

like MLB

remote swallow
#

nbl is thing

brave sparrow
#

MLG is a thing yeah

remote swallow
#

oh

tender shard
#

why on earth do so many people, including the weird "mc-dev" ij plugin, disable the dependency reduced pom

#

that's just stupid

remote swallow
#

we dont need it

tender shard
#

it can't hurt to have it though

#

it only has advantages

remote swallow
#

"im new to plugin dev, wtf is tthis file? should i delete it do i need to change it 1111111111111"

tender shard
#

I never understood those people lol

#

also people who always wanna remove the test directory

tribal quarry
tender shard
#

yeah but why not just ignore it lol

#

it's part of the default maven layout

tribal quarry
tender shard
#

gradle probably too

tribal quarry
#

cause i have adhd tho

#

i want things clean 🔥

tender shard
#

I'd be more upset if it was gone and then think "wtf this project is messed up"

quiet ice
#

I mean deleting the test dir is straightforward

#

Just delete it lul

tender shard
#

ofc it is but it hurts to see it being gone

quiet ice
#

Maven does not regenerates it afaik

tender shard
#

nope

#

it doesnt

#

i guess exception makes more sense since it's never supposed to happen

#

ok IllegalStateException it is

#

your code doesnt match the exception

#

there is nothing in line 69

tawny remnant
#

click it again my bad sorry

tender shard
#

This usually happens when your vectors length is 0 or sth. Im only on the phone rn so cant properly look at the code

tardy delta
#

hmm modifying generated code is fun

#

when you come to the conclusion that it dissappears when you rebuild the project

tawny remnant
#

what is generated code

tender shard
#

this for example

#

is auto-generated code

wise mesa
#

so I'm trying out ACF for the first time

#

and I'm really confused on how function parameters work

#

if the first parameter is commandsender or player is that always the player who ran the command

eternal oxide
#

could be console

wise mesa
#

sure

#

but it'll always be the commandsender?

eternal oxide
#

yes

wise mesa
#

and then all following parameters are arguments?

#

always?

eternal oxide
#

unless some plugin effs with you

#

but none currently do

wise mesa
#

what happens if I use player as the first parameter and then someone tries to use the command from the console

#

will they get an error saying that only players can use it?

tender shard
wise mesa
#

i can?

eternal oxide
#

if you are talking about ACF, can;t tell you

tender shard
#
@Default
public void doSth(Player player) // This is a player-only command. player arg is the sender

@Default
public void doSth(CommandSender sender) // Works for console too
wise mesa
#

oh that's awesome

#

thank you

tender shard
#

it also shows "This can only be ran by players" automatically

#

it can even use localized messages etc, or even per player locales

wise mesa
#

and then call the bottom one

wise mesa
#

thank you so much

tender shard
#

you use CommandSender if you wanna allow both players and console

wise mesa
#

right i was just talking about the example you sent above

#

or you were just trying to show both options

tender shard
#

you can also use two separate methods, as above, if you want it to do different things based on whether it's a player or not that ran this

wise mesa
#

i understand

wise mesa
#

that's so cool

#

okay thank you so much

tender shard
#

yeah and that's just the beginning. ACF is indeed amazing :3

#

I've been using it for years now and never looked back lol

ocean hollow
#

There is some easy way to do this: is the player looking at the mob?

#
        List<Entity> nearbyE = plugin.player.getNearbyEntities(plugin.range,
                plugin.range, plugin.range);
        ArrayList<LivingEntity> livingE = new ArrayList<LivingEntity>();

        for (Entity e : nearbyE) {
            if (e instanceof LivingEntity) {
                livingE.add((LivingEntity) e);
            }
        }

        plugin.target = null;
        BlockIterator bItr = new BlockIterator(plugin.player, plugin.range);
        Block block;
        Location loc;
        int bx, by, bz;
        double ex, ey, ez;
        // loop through player's line of sight
        while (bItr.hasNext()) {
                block = bItr.next();
                bx = block.getX();
                by = block.getY();
                bz = block.getZ();
                        // check for entities near this block in the line of sight
                        for (LivingEntity e : livingE) {
                                loc = e.getLocation();
                                ex = loc.getX();
                                ey = loc.getY();
                                ez = loc.getZ();
                                if ((bx-.75 <= ex && ex <= bx+1.75) && (bz-.75 <= ez && ez <= bz+1.75) && (by-1 <= ey && ey <= by+2.5)) {
                                        // entity is close enough, set target and stop
                                        plugin.target = e;
                                        break;
                                }
                        }
                }

            }``` found this but it works weird
eternal oxide
#

just raytrace

tender shard
#

why not just raytrace

#

yeah

ocean hollow
#

and how to use it on an entity?

tender shard
#
    public static boolean isPlayerLookingAtMob(Player player, Entity entity, double maxDistance, double raySize) {
        RayTraceResult result = player.getWorld().rayTraceEntities(player.getEyeLocation(), player.getEyeLocation().getDirection(), maxDistance, raySize, e -> e.equals(entity));
        return result != null;
    }
#

haven't tried but should work

rare rover
#

I need some command api inspiration

#

Anyone got some I could look at?

tender shard
#

you want to write your own command API?

#

ACF can do basically anything, so I'd take a look at that

rare rover
#

Ye

#

Oki, I'm just having a hard time looking for the look

#

Like annotation based probably

ocean hollow
tender shard
ocean hollow
#

is the player looking at the entity, if so, you will recognize it.

tender shard
#
    public static Entity getEntityPlayerIsLookingAt(Player player, double maxDistance, double raySize) {
        RayTraceResult result = player.getWorld().rayTraceEntities(player.getEyeLocation(), player.getEyeLocation().getDirection(), maxDistance, raySize, e -> !e.equals(player));
        return result == null ? null : result.getHitEntity();
    }

this gets the entity a player is looking at. If you want to filter it more (e.g. only specific entities), change the Predicate<Entity> part (the lambda in the raytraceEntities)

#

error and class don't match up

#

there's an NPE in line 63 but your line 63 is empty

#

compile it again, restart server, then again send code and the new error msg

stiff vine
#

Do you know if Multiverse interfere with code for tp or something like that. cuz i try to create a plugin for play with friend i have 3 world : 1 hub and 2 arena. and when i try to tp to arena there is a erreur like : can’t tp in the world / world does not exist.

eternal oxide
#

KoTHPlugin.java:63

#

exactly

#

your error does not match your code

#

you have either given us old code or an old error

#

we can't help if your error does not match your code

rotund ravine
#

Show us the code that made the errror

#

Not a different code

#

Show us KothPlugin.java

#

@scenic sand

#

Show me your config.yml

#

@scenic sand

eternal oxide
#

you are registering me not koth

#

line 63

rotund ravine
#

Sorry i meant plugin.yml*

eternal oxide
#

Objects.requireNonNull(getCommand("me")).setExecutor(new KothCommand());

rotund ravine
#

Yes

#

Ellar was correct

#

In your setupCommands you are trying to register “me” and not “kott”

#

The requireNonNull is redundant

#

Yes

misty ingot
#
    public void setItem() {
        ItemStack suggestionItem = new ItemStack(Material.valueOf(plugin.getConfig().getString("suggestion-item")));
        ItemMeta suggestionMeta = suggestionItem.getItemMeta();
        // setting status by color
        setShowStatus();
        // setup suggestion item
        setItemName(suggestionItem);
        setItemLore(suggestionItem);

        // --- item data
        suggestionMeta.getPersistentDataContainer().set(suggestionItemKey, PersistentDataType.STRING, String.valueOf(this.suggestionID));
        suggestionItem.setItemMeta(suggestionMeta);
        this.item = suggestionItem;
        plugin.getLogger().info("Created suggestion item for suggestion #" + this.suggestionID);
        plugin.getLogger().info("Item name: " + this.item.getItemMeta().getDisplayName());
    }
    public void setItemName(ItemStack item) {
        OfflinePlayer ownerUser = Bukkit.getOfflinePlayer(UUID.fromString(this.owner));
        ItemMeta itemMeta = item.getItemMeta();
        itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("suggestion-item-name")
                .replace("{sender}", ownerUser.getName())
                .replace("{id}", String.valueOf(this.suggestionID))
                .replace("{status}", this.showStatus)
        ));
        item.setItemMeta(itemMeta);
    }

when I grab this.item and put it in a menu, its a plain item with no display name or lore

rotund ravine
#

Don’t get the meta before running your set methods @misty ingot

#

This is unrelated to those two files.

remote swallow
misty ingot
#

im going to just get meta before setting the PDC instead

#

i didnt know that was a thing

rotund ravine
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

misty ingot
#

ok it works now

remote swallow
#

why are you deleteing your messages

rotund ravine
#

You’re doing a poor job at it. Write it in one message.

Situation: What are doing?
Expectation: What was expected?
Issue: What actually happened?

Debug before asking for help @scenic sand

remote swallow
#

dont do that it, its pointless

#

(refering to deleting messages)

quartz gull
#

jeez

rotund ravine
misty ingot
#

@remote swallow i also added a system so admins can just straight up ban certain people from making suggestions (with reasons, time <optional> and unbans ofc)

#

you should do that

#

just because

remote swallow
#

i should

#

MORE REASONS TO PUT OFF DISCORD

#

LETS GO

misty ingot
#

AYYY

#

PROCRASTINATING BUDDIESSS

remote swallow
#

i blame autism

tender shard
#

Youre just lazy

#

As everyone

misty ingot
#

croc and balls moment

remote swallow
misty ingot
#

all I need to make now is the system to view suggestions, their info, settings, actually use settings, do comments, votes, etc

remote swallow
#

and lazy

#

gitgud?

misty ingot
#

ima do it after a brief hypixel skyblock session

#

it wont take long

#

i just need to grind dungeons first

remote swallow
#

simply get good

#

im only 32 hours deep into this

misty ingot
#

lol you are the one who needs to get gud then

#

i started like 3 hours ago

remote swallow
misty ingot
#

another couple of hours and this is done

remote swallow
#

i dont write quickly

misty ingot
remote swallow
#

wakatime

misty ingot
remote swallow
#

i can type normally speedy

#

coding drops it

remote swallow
misty ingot
#

accuracy?

remote swallow
#

give me 2 min

#

im slow

#

smh

#

most of the fuckups are the spacebar not working

#

this is better

misty ingot
#

well i have 120 with consistent 100% (on my good keyboard, not the laptop one)

#

there isnt a big difference

remote swallow
#

i can write quick enough to respond to people

#

my spelling dies sometimes

#

from how i type i think i dont rpess my space bar enough

misty ingot
#

holon actually i havent tried on my laptop in a while

remote swallow
#

then press it too early and fuck upo

misty ingot
#

ima do a couple runs

remote swallow
#

i cannot type on laptops

misty ingot
#

i have a non-butterfly keyboard on the lappy

remote swallow
#

im too used to mechanical keyboard

misty ingot
#

I also love my mechanical keyboard but sometimes you gotta use the lappy

remote swallow
#

also i dont have the space for my hands

#

like i need the drop from my fingers and the keyboard height

#

like if their the same level my speed is gone

misty ingot
#

how many fingers do you use

remote swallow
#

all but my pinkies

rotund ravine
#

2 or 3 depending on the tightness

remote swallow
#

and sometimes my ring finger

misty ingot
#

not as fast on the lappy ig

#

i use 3 all the time every time

remote swallow
misty ingot
remote swallow
#

my left pinky is for shit + control

#

thumbs handle space bar

#

right pinky for entry and right shift

#

ring finger for backspace

#

rest do the typing

misty ingot
#

left thumb is space bar, both indexes cover the entire keyboard and left pinky is for shift and control

remote swallow
#

i also use my palm for controlls

remote swallow
#

it gets a bit easier

misty ingot
#

eh

remote swallow
#

i used to just use index fingers

#

bc i still looked down but was quick

#

then slowly i would remember where keys were

misty ingot
#

using 3 out of 5 fingers is pretty good for now

#

I never look down

#

ever

#

i have muscle memory of the position of every single key (except numpad cuz who even uses that)

remote swallow
#

yeah

#

numbers fuck my speed

#

puncuation fucks my speed

#

apostrophes are fine

#

sometimes

misty ingot
#

im good with numbers too as long as its from the top row and not the numpad

remote swallow
#

i cant do numbers on either

misty ingot
#

i went from <70 WPM and trash accuracy to 120+ with 100% in 2 years cuz i type so. fucking. much.

remote swallow
#

i dont have a numpad so cant do that either

misty ingot
#

you play skyblock?

#

hypixel skyblock

pseudo hazel
#

make a claim plugin

misty ingot
#

you can make a simple administration plugin

#

add administration / utility commands for admins

#

make it easier for them to manage players

remote swallow
misty ingot
#

average normal person ^

#

no

pseudo hazel
#

there are only about 10000 admin plugins so yeah

misty ingot
#

ban / unban / history / info / etc

misty ingot
#

want a maths challenge?

#

make a cosmetics plugin with multiple styles of moving particle cosmetics all on your own (for the math part)

remote swallow
#

98^3 + 853 - 12

misty ingot
#

*according to maths

#

may or may not be wrong

pseudo hazel
#

john maths

remote swallow
#

it means 98x98x98 + 853 - 12

pseudo hazel
#

I mean I have yet to actually use them since for the plugin I am working with rn I already had made my own Item thingy

remote swallow
#

the question

#

^3 means squared, so the number timesed by itself 3 times

pseudo hazel
#

anyways, if you want to make a plugin to learn stuff, make some minigame thing

misty ingot
#

i think he meant my message @remote swallow

remote swallow
#

oh

pseudo hazel
#

copy some popular game or movie and make it into minecraft

remote swallow
#

oh morice do ur builds have component suport

pseudo hazel
#

or whatever

misty ingot
remote swallow
#

smh

#

use nms

pseudo hazel
#

why

remote swallow
#

fun

#

i have the remapped code

pseudo hazel
#

it doesnt sound fun

remote swallow
#

for lore atleast

#

lmao

#

you have to directly modify nbt for components

misty ingot
#

I am actually thinking of a custom armor / enchants / tools plugin as my first paid plugin

misty ingot
#

i have a base idea planned out

remote swallow
#

nms is fine with remapped if you can find stuff

#

nbt is fucking painful

#

builders to what

#

ah

quaint mantle
#

Hi , sorry how to fix the trouble ? because my health is not changes !

#

with no errors

#

Hello so basically I have special cases for smithing where there is no recipe registered to the game due to the fact i need the recipe to only only compare model id and item material so i use event.setResult but the issue is it does set the result but i can't grab it from the result box for some reason

tender shard
#

did you even register that listener called "plugin"?

quaint mantle
tender shard
tribal quarry
trim lake
#

Just starting using Maven and I have some warning here. Previously I was using java 17SE. If I change 1.8 java setting in maven to 1.17 I'm getting error.

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!-- The Java version used to compile the plugin. I suggest to use 1.8 because many servers are still using Java 8. -->
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>```
tribal quarry
#

if its idea then, try changing the jdk in project structure

trim lake
#

Eclips xD

tribal quarry
#

ok so

#

there might be an option for that

trim lake
#

Its just better use that old java?

tribal quarry
#

idk? do you need to use that old version?

#

like its dependens on your project?

trim lake
#

No I dont think so. But If I changed that number from 1.8 to 1.17 there is error during building .jar file so xD

tribal quarry
#

maybe try searching the error?

trim lake
#

I just already try google it but still cant get rid of warning. If I just leav as is it that works but that warning is annoying.

tribal quarry
quaint mantle
tribal quarry
#

use bukkit scheduler

#

you also need to pass in your plugin's instance

umbral torrent
#

How can i use autocraft(clicking recipe in craftbook) with custom items(with changed meta).
For example i have potion and i set it as ingredient with new RecipeChoice.ExactChoice(potion), but when i click recipe, only 'Material' items are placed

#

i think i can write custom ReceiptChoice, but maybe someone knows better solution?

vivid skiff
torn oyster
#

what would be the best approach to saving inventory layouts

somber night
#

im incredibly confused at how to add custom brewing recipes, i couldnt understand none of the information ive found online, if you could help me and explain how it works itd be much appreciated

lost matrix
vivid skiff
lost matrix
#

Then dont use obfuscated nms...

torn oyster
vivid skiff
lost matrix
#

?nms

lost matrix
#

Mojangs mappings a public and spigot uses them

rare rover
#

um what

remote swallow
#

reload maven or gradle

lost matrix
vivid skiff
torn oyster
#

uh

rare rover
#
@Override
    public <T, V extends Comparable<? super T>> TreeMap<T, V> sortValue(Map<T, V> map) {
        if (map == null)
            return null;

        Comparator<Map.Entry<Object, V>> valueComparator = Map.Entry.comparingByValue().reversed();
        TreeMap<T, V> sorted = map.entrySet().stream()
                .sorted(valueComparator)
                .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
                        (e1, e2) -> e1, TreeMap::new));
        return sorted;
    }```
torn oyster
#

players can save their own loadouts for themselves

#

is that still gonna work with that solution

rare rover
#

line 6

lost matrix
rare rover
#

sortKey is fine?

torn oyster
#

at the start of every game they are given the inventory and i want them to be able to customize the order of the items

lost matrix
rare rover
#

because it told me too

#

but

#

neither works

lost matrix
#

Copy the methods here pls

#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
rare rover
#

yeah

#
    @Override
    public <T, V extends Comparable<? super T>> TreeMap<T, V> sortValue(Map<T, V> map) {
        if (map == null)
            return null;

        Comparator<Map.Entry<T, V>> valueComparator = Map.Entry.comparingByValue().reversed();
        TreeMap<T, V> sorted = map.entrySet().stream()
                .sorted(valueComparator)
                .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
                        (e1, e2) -> e1, TreeMap::new));
        return sorted;
    }```
vivid skiff
# lost matrix Copy the methods here pls

How can i fix this error? Could not find artifact org.spigotmc:spigot:jar:remapped-mojang:1.17.1-R0.1-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)

lost matrix
lost matrix
rare rover
#

because i wanna sort by value in this method

rare rover
#

!paste

rare rover
#

?paste

undone axleBOT
rare rover
lost matrix
# rare rover
  public <T, V extends Comparable<V>> TreeMap<T, V> sortByValue(Map<T, V> map) {
    if (map == null) {
      return null;
    }
    
    Comparator<Map.Entry<T, V>> valueComparator = Map.Entry.<T, V>comparingByValue().reversed();
    TreeMap<T, V> sorted = map.entrySet().stream()
            .sorted(valueComparator)
            .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
                    (e1, e2) -> e1, TreeMap::new));
    return sorted;
  }

You need to explicitly define a type for comparingByValue()

somber night
#

lines 266 to 282 arent working as expected (giving every effect and adding duration each time the item is used) after i added lines 266, 269, 270 (the item is now unusable) why can that be? https://paste.md-5.net/mazimuyeyi.java

torn oyster
stiff knot
#

Hey what's the easiest way to change a player nametag to a string that I already have?

#

looking to do this basically

#

😭

#

I have protocollib added to my project but i don't know how to use it to change nametags :/

crude cobalt
#

Hello there, somebody know what's my mistake? I created a file for an abstract command and then created a command, but when I check, it says that the command is null, what should I do?
AbstractCommand.java:

public AbstractCommand(String command){
        System.out.println(command);
        PluginCommand myCommand = Meditation.getInstance().getCommand(command);
        if (myCommand != null) {
            myCommand.setExecutor(this);
            System.out.println("won");
        }
        System.out.println(myCommand);
    }
    public abstract void execute(CommandSender sender, String label, String[] args);
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        execute(sender, label, args);
        return true;
    }"

ReloadCommand.java:

public ReloadCommand() {
        super("reload");
    }


    @Override
    public void execute(CommandSender sender, String label, String[] args) {
    }
hazy parrot
#

Is it added inside of your plugin.yml?

crude cobalt
#

Yeah

#

And that's what MainJavaClass looks like

private static Meditation instance;
    @Override
    public void onEnable() {
        instance = this;
        new ReloadCommand();
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }

    public static Meditation getInstance(){
        return instance;
    }
tender shard
#

if getCommand returns null, it's definitely not in your plugin.yml

stiff knot
#

Would it be easier to use an API like NameTagEdit to change player name tags?

#

It feels like I have tried everything and I haven't found a way to get it working

earnest wasp
remote swallow
#

why

#

the codes fine

tender shard
#
public void ONENABLE()
hazy parrot
#

Public static final void ONENABLE

earnest wasp
#
public void onEnable() {
remote swallow
#

thats exactly what they have

tender shard
#

well the original code had the formatting right

hazy parrot
remote swallow
earnest wasp
#

yes true

crude cobalt
tender shard
#

and what's the advantage of removing the annotation?

remote swallow
earnest wasp
remote swallow
#

no

#

dont do that

hazy parrot
#

???

remote swallow
#

you have no idea what your talking about, dont give support if you have 0 idea what your talking about

tender shard
earnest wasp
hazy parrot
#

Tbh I don't find it funny

tender shard
#

Yk whats funny

quiet ice
#

My segue to the sponsor segment!

stiff knot
#

Trying to use NameTagEdit API but I'm getting this error, any ideas?

hazy parrot
stiff knot
#

yeah i do

hazy parrot
#

Have you added it as depends in plugin yml

stiff knot
#

ah no, how do i do that?

hazy parrot
#

It may be that nametag loads after your plugin