#help-development

1 messages Ā· Page 685 of 1

rough drift
#

If you don't use NMS it will automatically work with higher versions

#

For lower versions just use like spigot 1.17 and it will support anything above 1.17

echo basalt
#

yeah but

#

but

#

How can I avoid a block being scheduled for removal twice

#

Maybe I could store a hash of all the top positions due for removal

#

Something like a Map<RelativePosition, Byte> ticksLeft

rough drift
#

I mean

#

Set

#

and just check if it's already in the set

simple girder
rough drift
#

and if it is just ignore

simple girder
rough drift
#

if the min is 1.17 develop on 1.17

#

if the min is 1.8 pray to god that you change your mind

simple girder
#

And is there a standart for this? Which version do you think a plugin I release should support as a minimum?

tender shard
#

someone join #bot-commands pls

smoky anchor
rough drift
#

Though for the time being I am just sticking with 1.17.1

lost matrix
#

Minecraft trivia when?

simple girder
vivid skiff
#

How can i get a Pair with a enumitemslot in it and check the the itemslot for after modifing the itemstack in the pair? Using protocollib packetlistener

simple girder
grim hound
#

Does anyone know how I could fix this issue? I understand that both of the files are compiled on different java versions, but at the same time I don't want to change my project java version from 8

chrome beacon
#

You need to set api-version to 1.13 in the plugin.yml

simple girder
#

Oh, okey. I changed the spigot version.

chrome beacon
#

spigot version should be the lowest you want to support

grim hound
tender shard
#

does matter, paper api is compiled for java 17

#

spigot-api is compiled for java 8

grim hound
#

happens the same with minecraft packets

#

for 1.17+

tender shard
#

that's because NMS is obviously compiled for java 17 too

grim hound
#

yeah I know

tender shard
#

use jdk 17+

grim hound
#

can you read?

tender shard
#

I can, you cannot read

#

I never told you to change the project java version

#

only to use another JDK to compile

#

JDK 17 is able to use source/target of 8 just fine

grim hound
#

damn you got me there

tender shard
#

are you using IJ and maven? If so just do File -> project settings -> SDK -> 17

and in pom you can leave target/source at 8

#

then it should work fine

#

if you also use the maven-shade-plugin, that must be updated to at least version 3.5.0

grim hound
#

nope, I'm using the IntelliJ artifact compiler

tender shard
#

I am not sure if that even supports using different source/target and JDK

grim hound
#

maven is too slow

cinder abyss
#

Hello, I want to add a custom blocks using Spigot when the type of the oak slab is double and waterlogged. How can I make this in my resource pack ?

tender shard
#

probably that's not possible, I'd just use maven instead

#

(gradle btw also cannot do that as paper-userdev requires toolchains in gradle)

#

so I guess your only option to compile for java 8 while still accessing java 17 classes is to use maven

#

which you would normally do anyway because otherwise how'd you use mojang maps

tender shard
#

obfuscated mappings can't be properly used, not only because the names are nonsense, but e.g. because method names and their return types are clashing, e.g. if you extend entity classes

#

you'll get a message about "return type of x() clashes with EntityInsentient x()"

grim hound
#

and don't really use the raw mojang api that is not packet-related

tender shard
#

it'll be a() in 1.20.1 and c() in 1.19.4 and e() in 1.19.3 e.g.

grim hound
grim hound
#
    public static Method getMethodByReturnType(Class<?> instance, Class<?> returnType, Class<?>... parameterTypes) {
        for (Method method : instance.getMethods()) {
            if (method.getReturnType() == returnType && AlixUtils.equalsArrayCheck(parameterTypes, method.getParameterTypes()))
                return method;
        }
        throw new ExceptionInInitializerError(new NoSuchMethodException("No valid method returning: " + returnType + " in " + instance));
    }
#

like this

tender shard
#

how does one even create a .jar in IJ without maven or gradle

#

i dont see any "build artifacts" anywhere

kindred sentinel
#

Attributes for entities can only be given using NMS?

grim hound
#

magic

tender shard
#

yeah well

grim hound
tender shard
#

create what first

grim hound
#

the artifacts

#

you click the "+"

#

"JAR" > "From modules with dependecies"

tender shard
#

ah ok. yeah it seems like IJ doesn't support specifying -target or -source for artifact configs

#

maybe you can manually append it to the build config, idk

grim hound
#

yeah I didn't really find any info on that

#

well, I guess I don

#

't really need paper that much

tender shard
#

as said, maven is the easiest option

onyx fjord
#

maven has more boilerplate

grim hound
#

it builds too slow for me, maybe one day I'll find the ideal solution to this problem

onyx fjord
#

you can also enable additional caching

#

for config

tender shard
#

gradle doesn't support using a different source and target setting than the actual JDK being used when using toolchains

grim hound
#

also that /\

tender shard
#

this still doesn't create any .jar for me at all

onyx fjord
#

gradle spigot project is like 40 lines

#

or 30

#

in the build script

tender shard
lilac dagger
#

and then select the target classes

#

if you're generating jars the way i used to

tender shard
#

Run -> Edit COnfigurations -> add -source 8 -target 8 as options, but keep SDK at 17

grim hound
tender shard
#

btw maven is not slower than IJ unless you run "clean" all the time

onyx fjord
#

slow?

tender shard
grim hound
#

hmm I very much am doing something wrong here

#

cuz I still get the same error

#

of this

tender shard
#

project structure must be like this

#

language level 8, sdk 17

#

if that doesn't work, just use maven. this would have fixed the issue already half an hour ago šŸ˜„

#

Alternatively if you dont use paperweight but only the normal api jar gradle should also allow using different source and target levels than the JDK (just dont use toolchains, they force using the -release flag on javac)

kindred sentinel
#

Is there a way to find out the amount of armor a player has?

grim hound
tender shard
#

Np

grim hound
#
double armor = p.getAttribute(Attribute.GENERIC_ARMOR).getValue();
#

at least according to the spigot forum, no idea if this is influenced by armor

kindred sentinel
#

nope

tender shard
#

pretty sure that this only returns the "base" armor an entity has

kindred sentinel
#

OMG

#

It's working

cobalt thorn
#

Hi question probably not that common but im making a plugin where you can get livestream from twitch and dispalyed in to maps the only issues ffmpeg can use rtmp that on twitch and most provider is closed by stream key, there’s an alternative to this and get live stream via rtmp without keys? (I want to use rtmp because it is the simplest to implement or another way to implement is by making the streamer add is key but that can be a security concern for streamers)

grim hound
kindred sentinel
#

Yeah

grim hound
#

yoo

#

dassick

tender shard
#

does it also work for specific armor attributes?

kindred sentinel
#

but just with getValue

#

it's working

grim hound
kindred sentinel
atomic flax
#

Hello, i'm trying to build my plugin trough a GitHub Workflow with Maven but he show me that error (10 times)

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project etercube: Compilation failure: Compilation failure: 
Error:  /home/runner/work/EterAuth/EterAuth/src/fr/arcade/eterauth/bungee/DataBase.java:[4,23] cannot find symbol
Error:    symbol:   class BungeeCord
Error:    location: package net.md_5.bungee```

Do you have any idea what the problem is?
tender shard
rough drift
tender shard
atomic flax
#

I think my friend messed up the dev :p

unreal pine
#

?ima

tender shard
#

there is no class called BungeeCord in that package

#

only class there is "Util"

atomic flax
#

yeah, he told me that he build his plugins with spigot and bungeecord.jar from jenkins šŸ’€

tender shard
#

well you gotta add the same dependencies to maven that your friend is using locally

atomic flax
#

exactly

tender shard
#

but having both spigot and bungee in one .jar? what's the purpose

#

also spigot especially doesnt have a class called bungeecord

#

is he importing the bungeecord server .jar as dependency? o0

#

what does he use the BungeeCord class for?

atomic flax
atomic flax
tender shard
#

you'll probably need bungeecord-bootstrap as dependency

#

or bungeecord-proxy

atomic flax
#

I'm going to ask him to remake the plugin.

Anyway, thanks for your advice, have a nice day :)

chrome beacon
#

?

#

The Bungeecord proxy module is maintained and is a core part of Bungeecord?

atomic flax
tender shard
#

that means you gotta build it yourself and mvn install it

atomic flax
#

yep

#

i know

#

I misspelled my message actually, sorry

tender shard
#

why can I not rename folders in winscp in the directory tree 🄲

grim hound
#

hmmm

#

Is there a reliable way to detect that a player killed another player?

#

cuz like

#

Player#getKiller could be from way before

#

and getting the last damage cause also doesn't help as someone could've like pushed them off a cliff

#

the death message would still contain those players' names as one was the cause of death for the other

#

oh, wait, is the Player#getKiller set to null if the player dies without receiving any hits?

lost matrix
grim hound
#

ahh I see

#

thnx

worldly ingot
#

Basically if it's in the kill message, it'll return the player lol

rich inlet
#

Hello. I want to launch the player from his location to another exact location (so that he always will land there when launched).

I haven't found anything in that direction which works. I want the player to always launch in a nice arch no matter what the destination location is.

I tried subtracting the two location vectors, but then the player will get a velocity in a direct path to the destination location and the launch force doesn't fit.

Does someone know a way to achieve this?

echo basalt
#

There was a combat tracker within nms

#

I wonder if it's possible to access its data in bukkit

worldly ingot
#

We have a lot of that stuff being exposed with the damage causes

#

Just a PR in limbo atm

echo basalt
#

Yeah but I'd like to access the entire combat entry history

#

I know a minigame server that had a pvp game with full combat history when you died

worldly ingot
#

Well... yeah... they can track that themselves

echo basalt
#

Nah it was hyperspecific

worldly ingot
#

Right... they can track that themselves

#

wat

echo basalt
#

ehh

#

p sure they just accessed the nms tracker

worldly ingot
#

I sincerely doubt that

#

You just don't have to. You can accomplish the same thing with just a handful of lines of code and a damage event listener

kindred sentinel
#

How to get the amount of armor an item adds?

echo basalt
#

uhh

#

You don't

#

But if you really care

#
LEATHER_HELMET: 1
LEATHER_CHESTPLATE: 3
LEATHER_LEGGINGS: 2
LEATHER_BOOTS: 1
CHAINMAIL_HELMET: 1
CHAINMAIL_CHESTPLATE: 5
CHAINMAIL_LEGGINGS: 4
CHAINMAIL_BOOTS: 1
IRON_HELMET: 2
IRON_CHESTPLATE: 6
IRON_LEGGINGS: 5
IRON_BOOTS: 2
GOLDEN_HELMET: 2
GOLDEN_CHESTPLATE: 5
GOLDEN_LEGGINGS: 3
GOLDEN_BOOTS: 1
DIAMOND_HELMET: 3
DIAMOND_CHESTPLATE: 8
DIAMOND_LEGGINGS: 6
DIAMOND_BOOTS: 3
TURTLE_HELMET: 2
native ruin
#

doesn't armor have an armor value?

echo basalt
#

Missing netherrite but idc

lost matrix
#

Do attributes not contain the default modifiers on items?

echo basalt
#

They might

#

In this case I did this for a customer that wanted to tweak armor

#

Which is why I have a config for this

lost matrix
onyx fjord
#

renaming is just moving as a different name

shadow night
#

makes sense

shell matrix
#

So I updated to the 1.20 NMS today after some difficulties and I'm seeing that here has changed a lot of Stuff. It now wants DataValue instead of DataItem as it was in the 1.19.2. Is there now a other, better way to do that (I want to change the entity temporarily to something else) or should I try to port it to DataValue?
https://paste.md-5.net/jemutotixu.cs

grim hound
#

Yeah no I just checked, it doesn't work

#

the Player#getKiller I mean

#

it's null whenever the death reason is different from physical kill (like throwing someone off a cliff)

subtle folio
#

this is intentionally as the killer was (example) fall damage

grim hound
kindred sentinel
#

Is there a way to find out the amount of a player's armor without considering attributes like only from armor besides checking every armor item?

subtle folio
grim hound
#

so there isn't a built-in method?

subtle folio
#

you just need to be careful to stop storing the last person to hit them after death though

#

no

kindred sentinel
#

I figured out how to make it easier

undone axleBOT
quaint mantle
#

Would it be possible to teleport a player into a dif server without making them do the loading world screen?

subtle folio
#

if server i don’t think so due to the nature of proxies

quaint mantle
#

Server ex hub -> mini game

quaint mantle
subtle folio
hasty prawn
#

Check what addBalance is returning

quaint mantle
#

Does that return true or false

subtle folio
#

Haha i didn’t make it! i’ve just used it before, serves only as a reference šŸ˜‚

quaint mantle
#

Looks cool tho

echo basalt
#

And how hard the author goes out of their way to not make a data class

subtle folio
#

though I think it was coded in net beans, looks like tabs > spaces

quaint mantle
#

Let’s keep in mind

#

It’s last commit was 4 years ago

#

Maybe they was just learning how to code

echo basalt
#

let's keep in mind that zombie_striker has had a premium plugin for sale for years and was an active member in the bukkit forums

quaint mantle
#

Never mind!!

subtle folio
#

love the main class name

#

ā€œMainā€

quaint mantle
#

MagicPacketHolder

subtle folio
#

7smile7 getting mad

echo basalt
#

ahh the public variables

lost matrix
echo basalt
#

I think it's a she but yeah

#

static hashmap

#

crunchy

timid hedge
echo basalt
#

who the fuck uses 8 character tabs

#

or 16 char

lost matrix
#

This is a troll i think

echo basalt
#

it's zombie_striker, previous author of QualityArmory(Vehicles)

opal juniper
#

thi

#

lollll

echo basalt
#

old community member

#

I wouldn't say it's a troll

#

But this has crackhead energy

#

I can imagine a drunk zombie_striker downing 5 red bulls after a night at the bar and writing a plugin in an hour

subtle folio
#

hack level

quartz elbow
#

Good morning, I created a login system, and I would like to know if it is possible to disable the world cache, since it is a temporary world. I looked in the documentation and couldn't find it. For example, useful position, hunger

echo basalt
#

Uhh

#

Great question

#

You can delete the player's file

#

No clue if World#setAutoSave influences player data or not

#

But iirc player data is separate

#

interesting

subtle folio
#

// spigot

echo basalt
#

can't wait for the day that entity movement bugs are fixed

#

Had to actually put effort in a commission today because apparently primed tnt can phase through blocks

subtle folio
#

that’s a minecraft feature !!

quaint mantle
#

Fr

echo basalt
worldly ingot
#

Preferably into Spigot though. Those seem like things Spigot should adjust, not CraftBukkit

echo basalt
#

I don't think I'm ever signing that CLA

worldly ingot
#

I guess your alternative is to complain eternally, so that's a valid option as well

echo basalt
#

my alternative is to charge more and impl a shitty fix

near crypt
#

how can i spawn a blockdisplay which is white concrete?

worldly ingot
#

It could be a much cleaner fix if it were in the server directly šŸ‘€

echo basalt
#

ehh

hasty prawn
#

We'll complain until you fix it then Choco

echo basalt
#

I have a history of "quick" and dirty fixes

echo basalt
#

Like that one time I had over 600 lines of nms to make entities collide with client-sided blocks

worldly ingot
#

By spawning the entity

#

Like you would any other

echo basalt
#

because mixins aren't a thing

#

and idk asm

chrome beacon
#

Time to learn ASM

echo basalt
#

I've also used unsafe to inject my own command map because spigot doesn't fire events if I call dispatchCommand directly

#

Namedly ServerCommandEvent or whatever it was

#

I was talking with someone here about doing a PR for that

near crypt
worldly ingot
#

Or just spawn() so you can get the instance type, but yes

echo basalt
#

yOu can cast the result

worldly ingot
#

Yeah but why cast when you can get a generic type? :)

echo basalt
#

Ideally EntityType would be a weird class with generics for this one method

worldly ingot
#

It will be soon

echo basalt
#

time to break compatibility I see

#

Unless..

worldly ingot
#

Compat-safe

echo basalt
#

EntityTypes

#

hm

slender elbow
#

Commodore is getting a big update :^)

near crypt
echo basalt
#

I wonder how many lines of code luckperms is running on

worldly ingot
#

Or you can use the consumer

quartz elbow
worldly ingot
#
world.spawn(BlockDisplay.class, location, entity -> {
    entity.setBlock(Material.WHITE_CONCRETE.createBlockData());
});```
#

Argument order of that method might be wrong. I always forget location & class

near crypt
#

setblock isnt working...

slender elbow
#

entity.setBlock?

chrome beacon
near crypt
worldly ingot
#

I mean you can call it blockDisplay if you want lol. I just figured entity was shorter

echo basalt
#

easy goal

worldly ingot
#

To be fair it's also abstracted to shit so it can support other platforms

echo basalt
#

I'm at 8k right now and all I do is load like 3 values from a database on player join

slender elbow
#

implementing it on a platform is an easy task tho, platform hooks are minimal

echo basalt
#

I'll probably reach 12k when I'm done with this command system

worldly ingot
worldly ingot
#

I don't know what that error is telling you

#

I can't guess

near crypt
onyx fjord
near crypt
#

it just doesnt have this method

worldly ingot
#

Your IDE is broken or something

slender elbow
#

the better question is, does it actually compile. lol

worldly ingot
#

Right :P

near crypt
distant wave
#

does the eject function kicks all players riding on the player

strong parcel
#

Is it normal to only be able to reference a dependency's methods inside an event handler?

lost matrix
#

no

near crypt
# worldly ingot Right \:P

how can i do this with player.getWorld().spawnEntity(player.getLocation(), EntityType.BLOCK_DISPLAY); ?

chrome beacon
#

Invalidate cache and restart?

worldly ingot
#

spawnEntity() returns an Entity instance so just assign it to a variable and cast to BlockDisplay

#

BlockDisplay entity = (BlockDisplay) world.spawnEntity(location, EntityType.BLOCK_DISPLAY);

slender elbow
#

oh

chrome beacon
#

eh I wouldn't recommend that

slender elbow
#

you have the arguments swappefd

slender elbow
strong parcel
#

I am probably doing something wrong, but the only time I can use methods from the dependency I imported is when there's an annotation like @Override or @EventHandler

near crypt
lost matrix
worldly ingot
#

entity.setBlock()

#

Same as before

#

You should really take a moment to understand some of the basics of Java

near crypt
worldly ingot
#

Methods that return values, instance methods, etc.

#

These are things you need to seriously have a good grasp of

strong parcel
#

I thought all the code was supposed to go inside

glad prawn
#

"thought"

lost matrix
valid basin
#

Is it possible to make space gravity (actually lack of gravity) in latest spigot?

#

that actually works like 0 g

#

like exactly the same

#

i've tried combining levitation 255 and slow falling but that way player can still move forward or backward, just not up and down

#

And can't use elytra which is a major setback

echo basalt
#

write custom elytra physics

strong parcel
#

Or a variable

worldly ingot
#

PES_Think I'm confused how you think programs work

#

Something has to call it in order for it to run

valid basin
worldly ingot
#

You can ignore him. Stupid idea

echo basalt
#

:/

worldly ingot
#

"I want to visit Paris one day"
"lol just build your own airplane"

strong parcel
#

Maybe this is a part of Java I have never touched, but I have always put the code inside of the class brackets.

tall dragon
#

does any1 know what this component from intellij is called by chance?

distant wave
#

when adding a passanger to a player, do multiple passangers stack on each other?

valid basin
#

im sure he just tried to troll me anyway

worldly ingot
#
public class Foo {

    runSomeMethod();

}```
#

This is not valid

echo basalt
#

nah I've actually worked on custom elytra fizzics

#

it was crunchy

#

but worked fine

#

was just a scheduler

worldly ingot
#

No, you can only have one passenger on a player

strong parcel
worldly ingot
#

If you want multiple passengers you need to add a passenger to the passenger

valid basin
echo basalt
#

yep

worldly ingot
echo basalt
#

Was surprisingly smooth

jagged thicket
#

its been long

echo basalt
#

Just make sure to make a speed cap and write nice curves

worldly ingot
#

Is what a constructor?

valid basin
#

yeah but idk if that'd work with no gravity (using potion effect levitation 255 and slow falling)

worldly ingot
#

Because some entities have multiple passengers

echo basalt
#

setPassenger is 1.8 stuff

worldly ingot
#

e.g. boats

jagged thicket
#

that yellow thing we used to see on the main method

echo basalt
#

addPassenger was added in like 1.9 or something

#

or 1.10 or whatever

worldly ingot
#

Right, when boats were allowed two passengers

echo basalt
#

I wonder what 1.11 added

strong parcel
#

That probably explains my confusion. I have always put the EventHandlers inside the class that defines the methods used.

#

I was just trying to check that the import worked, and I guess I have never run into this issue before.

worldly ingot
#

Yeah, event handlers are going to be a strange concept if you're just starting to learn a programming language. Though at the end of the day all you have to understand is that something will eventually call your event handler method

#

It's just not your own code calling it. It's CraftBukkit

#

If the code you're writing is top-level, nothing can call it so it won't run - or in the case of most languages, it won't compile

echo basalt
#

pro tip: don't ask some of us for help if you're a beginner, we'll overengineer our solutions and confuse you with all kinds of patterns

#

pink name = avoid

#

:p

strong parcel
#

haha

echo basalt
#

unless it's 7smile

#

then run

strong parcel
#

Alright, thanks!

#

Yeah, I have had that experience with some of the pink name people. I send a code snippet and then they are too busy roasting the rest of my program to answer the question.

echo basalt
#

we're picky

rich inlet
#

is there someone good with vectors?

echo basalt
#

Vectors aren't hard

strong parcel
#

My calculus teacher just went over those today

#

I got you šŸ˜Ž

opal juniper
#

love vectors

glad prawn
#

hate math

strong parcel
#

Yeah, that's what they made the math package for šŸ˜›

distant wave
rich inlet
#

alright.

Vector launchVector = someLocation.getDirection().normalize().multiply(force);

if force is something like 1 to 10 (smaller values), the player gets launched in the right direction (direction of someLocation).
but if force is a high value like 100, somehow the direction isnt right anymore, it changes

#

@opal juniper @echo basalt @strong parcel

#

why is that?

echo basalt
#

Something tells me it has to do with floating point innacuracies being scaled up to a number so big they become apparent

#

Launching an entity with a vector as big as that will always cause problems

#

Sometimes due to chunk loading

#

server might teleport you back etc

#

And it never really looks nice

ripe moat
#

Hallo šŸ‘‹.

How do i create a folder (with boosted yaml library)? I can only find about files. Is that just with regular spigot/paper yaml?
I'm new to developing plugins. Don't blame if it's super obvious

hazy parrot
opal juniper
echo basalt
#

Well you're going from a big vector to a normalized vector

#

and back to a big vector

#

The innacuracies stack up

ripe moat
#

but thanks

chrome beacon
echo basalt
#

Also keep in mind that in the protocol, yaw and pitch are converted to bytes

#

and are done in increments

#

1.4Āŗ increments

#

It's weird

rich inlet
#

so is there an easy way to fix this?

#

eg using int instead of float?

opal juniper
#

i suppose, yeah

#

to @echo basalt that message is

#

i mean you can try and combine the calculations but idk if that will help much

rich inlet
#

using integers doesnt work either

opal juniper
#

well you are making the error worse

echo basalt
#

time to test a goofy ahh plugin I made in 5 minutes

#

I wonder if there's a mod that lets me hotswap game versions without actually having to re-open the launcher

river oracle
#

that would be scuff

onyx fjord
#

do conventions say to use small or big letters for explicit floats, doubles and longs

#

1d vs 1D

silent cove
#

sorry if im not in the right place, ill delete if needed

echo basalt
#

Got 2fa on?

silent cove
#

yeah i just did it today after i read that req

echo basalt
echo basalt
#

So just be patient

silent cove
#

alright

subtle folio
near crypt
#

how can I destroy a block?

smoky oak
#

depends what you mean by destroy
setting its material to air is usually enough

topaz cape
lilac dagger
topaz cape
lilac dagger
#

Then find the packet, i assume you need to use bytes to denote the packet

#

Most likely you have to use minecraft protocol to find the data you need

topaz cape
#

Thats the part which i cant

lilac dagger
#

I don't remember the site, protocol something

chrome beacon
#

wiki vg

remote swallow
lilac dagger
#

There you go

topaz cape
#

is it possible to use some lib to do it or is it jus not

chrome beacon
#

Protocolize

near crypt
#

how can I add a tag to an entity in spigot?

chrome beacon
#

What type of tag?

#

Your own custom nbt tag?

near crypt
#

/kill @e[tag=idk] so that i can use this command

chrome beacon
#

so a scoreboard tag

near crypt
#

oh is it called a scoreboard tag?

kindred sentinel
#

I want to make it so that every 5 seconds the player has 1 heart restored, but so that if he takes damage, the timer for 5 seconds is reset, is it possible?

kindred sentinel
#

player.addScoreboardTag("name")

kindred sentinel
#

and player.getScoreboardTags().contains("name")

kindred sentinel
subtle folio
#

you can set up a runnable system, giving each player their own time stamp and the runnable can do the math in order to see if the player needs a new heart given, and then in an entity damage event you can set the time needed for a new heart +5s

kindred sentinel
subtle folio
#

i don’t think it’s worth persisting 5 seconds..

kindred sentinel
#

yeah, but where could i store time stamp?

chrome beacon
#

pdc

subtle folio
#

you could ise a hashmap

#

pdc would be stupid for this

chrome beacon
#

Depends on if they want it to be persistent or not šŸ¤·ā€ā™‚ļø

subtle folio
#

highly doubt it, based on it only being 5 seconds

chrome beacon
#

Yeah I didn't read that part :/

kindred sentinel
subtle folio
#

Baeldung is a great resource for future reference ^^

kindred sentinel
#

is it something like an array/list?

kindred sentinel
subtle folio
#

it’s a similar idea, but instead you store miltiple key-values

#

where you key is the player’s uuid and the value is a long (unix time stamp)

kindred sentinel
#

oh

#

it's like objects in JS

subtle folio
#

Yeah, exactly

kindred sentinel
#

{UUID: Key}

subtle folio
#

but more like Player=Key

kindred sentinel
#

Yeah

subtle folio
#

yup

kindred sentinel
#

like json or js objects

subtle folio
#

exactly like json

smoky oak
#

I've noticed some attributes can be set directly using Player and some not.
Is there a difference between them I'm not aware of, or are they just 'exposed' since they're more commonly modified?

subtle folio
#

some attributes only go on items or armor and some onto players

smoky oak
#

im intending on modifying the attack speed attribute of the player to not accidentally leave 'residue' on items

smoky oak
#

so im trying to work out how to edit attributes properly rn

subtle folio
smoky oak
#

i didnt meant the display thing

subtle folio
#

right.. that resources goes over covers how to use them in general, you’ll need to@modify it to what you want

smoky oak
#

hm I'm staring down the numbers and it looks like they got floating point issues

#

is there an explanation on how that calculation works internally?

#

i want the final value of the attribute to temporarily become 1.6

pseudo hazel
#

i mean it pretty much is

smoky oak
#

can i just add a +/- number to the attribute

pseudo hazel
#

just round it down to a few decimals

smoky oak
#

oh thats my reference value

#

im assuming its supposed to be 1.6

pseudo hazel
#

well yes but floating precision error turns it into 1.5999999999

#

you don't compare floating values directly anyways

smoky oak
#

not the point
yes or no - can i just add a purely numeric modifier to attributes

pseudo hazel
#

oh idk anything about attributes lol

#

i was just talking about floats

smoky oak
#

well my plan was
double modifier = 1.6 - value

scenic onyx
#

Hi, I would like to create a plugin that when you receive an effect says which plugin gave you the effect. Because there is a plugin that gives me the effect of wikness and mpm I can figure out what it is.

#

Who can help me?

tender shard
smoky oak
#

hm actually this is concerning
this implies the modifier needs to be kept in memory and there's no easy way to reset it
do i need to cache the modifiers i apply?

scenic onyx
rare rover
#

how would i improve this?:

    public static String formatNumber(double num) {
        int index = 0;
        while (num >= 1000 && index < (FORMAT_THINGS.length - 1)) {
            num /= 1000;
            index++;
        }
        return String.format("%.2f", num) + FORMAT_THINGS[index];
    }``` was thinking of just doing a StringBuilder but that wont improve it by much
#

10ms ain't bad but

lilac dagger
#

what about space waste?

rare rover
#

also have tried:

return String.format("%.2f%s", num, FORMAT_THINGS[index]);```
tender shard
# scenic onyx Can you tell me a code example?
    @EventHandler
    public void onPotion(EntityPotionEffectEvent event) {
        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
        for(StackTraceElement element : stack) {
            String clazzName = element.getClassName();
            try {
                Class<?> clazz = Class.forName(clazzName);
                try {
                    Plugin plugin = JavaPlugin.getProvidingPlugin(clazz);
                    System.out.println(plugin.getName() + " added a potion effect to an entity");
                } catch (IllegalArgumentException ignored) {
                    // Class does not belong to any JavaPlugin
                }
            } catch (ReflectiveOperationException ignored) {
                // General exception from Class.forName(...)
            }
        }
    }
#

idk if that works

scenic onyx
smoky oak
#

switching items doesnt by chance reset the generic attack speed modifiers does it?

rare rover
#

no

scenic onyx
#

return the name of the plugin

carmine mica
#

yeah, you'd have to filter out your plugin

#

cause the first stack trace element is going to be your plugin since its your listener

carmine mica
#

if plugin = my plugin, continue

scenic onyx
tender shard
carmine mica
#

could also just start not at the first stack trace element

tender shard
#

i thought you would at least TRY to understand the code I sent instead of blindly copy pasting it

valid burrow
#

is there a way to get all online servers in a bungeecord network

tender shard
#

ProxyServer#getServers()

scenic onyx
scenic onyx
tender shard
#

print out the whole stacktrace instead, then send it

valid burrow
#

anyone know a formular to calculate a players missing health? I suck at math but i dont get how this can possibly return 20
double missingHealth = p.getMaxHealth() - p.getHealth();

pseudo hazel
#

what does p.getHealth return

glad prawn
#

From 0 to getMaxHealth()

pseudo hazel
#

well yes in theory

#

im just asking what it returns in this case

valid burrow
#

ill try 1 sec

#

max health returns 20
health also returns 20
when im at full hp

glad prawn
#

yes

valid burrow
#

but it doesnt

#

it returns 20

glad prawn
#

Nah, show your full code

valid burrow
#

oh nvm i think i got it nvm

#

i used the method twice and the second one had a /2 at the end for some reason

#

i think because i wanted to round it or somethin? idk

#

i was to tired to think probally

glad prawn
#

Lol

river spear
#

Entity entity = player.getWorld().spawnEntity(location, EntityType.); How can I spawn a bamboo raft with this?

chrome beacon
# river spear ```Entity entity = player.getWorld().spawnEntity(location, EntityType.);``` How ...

When you want to spawn a custom entity, e.g. with a custom name or certain items equipped, you must use the method World#spawn(Location, Class, Consumer) unless you give a shit about compatibility with other plugins. I’ll explain why. The shitty way Usually, you can easily spawn entities like this: That is fine, as...

tender shard
#

mb

river spear
#

thanks

smoky oak
#

a or b?
A)

if(modifier != null) {
    modifier.remove();
    modifier = null;}
modifier = new Modifier();

B)

if(modifier != null) {
    modifier.remove();}
modifier = new Modifier();
#

at this point there should be no other references to it

slender elbow
#

there is no difference

#

also the closing brace right after the semicolon is cursed

smoky oak
#

you aint getting 'normal' out of me lol

#

if(modifier) modifier.remove() there ya go

#

wait that only works in lua

#

dammit

#

no

#

its throwing an error

kindred sentinel
#

is using runTaskTimer very bad for optimization?

tender shard
#

no

kindred sentinel
#

So is it about the same as a cyclic command block in terms of optimization?

smoky oak
#

I'm not understanding this...
player.sendMessage("Speed: "+player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).getValue());
I'm manipluating this attribute to be 1.6d, but why do axes still have their long recharge time? Do i need to bind it to the item?

lilac dagger
#

don't just use tick when you can use every 20 sec

lilac dagger
#

class is a keyword

orchid trout
#

oh i was just gonna say

#

didnt know that

lilac dagger
#

you can't have variables with keywords, at least in ides

tender shard
#

ofc something like "eventClass" would be an allowed name but it's quite common to always use clazz, e.g. eventClazz instead

lilac dagger
#

once mojang mappings had a method name called do

#

i had to reflect to get it

kindred sentinel
tender shard
#

since then I switched to $ + keyword naming

#

e.g. my methods are called $case()

lilac dagger
#

i see

sullen marlin
#

Not the intention of the rules anyway

tender shard
#

not a big deal

lilac dagger
#

to be honest it doesn't affect readability

tender shard
#

it was "if", not "do", my bad lol

#

i then messaged allatori and they now made the "aa, ab, ..." mode not use keywords anymore lol

kind hatch
#

Kinda surprised the obfuscator didn't already do that.

tender shard
#

well usually it's not a problem if a class is called "if"

lilac dagger
tender shard
#

yeah they even made a custom version for me once

#

i asked them to add an option to change to which class the string decryption method gets added since it just used a random class and sometimes, that used to be my WorldGuardHandler class that must ofc not be loaded if WorldGuard is not installed

lilac dagger
#

or if it was a nms class

#

this is so cool

tender shard
#

oh I see the custom version they made was for sth different

lilac dagger
#

with proguard you're kind of on your own

tender shard
#

yeah but proguard is free, isnt it?

lilac dagger
#

yeah

#

technically you can pay for more features

#

like string encryption

tender shard
#

i was spectical about allatori at first because their website looks like 1999 but the customer service is great and they added every single of my suggestions / fixed all my bug reports within 1-2 days

sullen marlin
#

Still looks more modern then zelix

tender shard
#

yes lol

lilac dagger
#

you can't really fault devs for making bad website pages

tender shard
#

yeah I also just bought themes for my websites

#

if I would have to make them myself they'd look like 1999 too

smoky oak
kindred sentinel
#

Is it possible to make an Overlay for a player like powdered snow or barrier

#

like if player in the snow biome he has overlay like from powdered snow

sullen marlin
#

I think freeze ticks?

#

Not sure if it's client side

#

But try setting that

kindred sentinel
#

Yeah

#

it's freeze ticks

echo basalt
#

p sure the player actually starts shivering n stuff

#

The nice way of doing this is to just send a packet

kindred sentinel
#

but what about barrier overlay?

echo basalt
#

yeah that's the warning distance of the world border

kind hatch
#

That's the world border overlay. For when you're too far away outside of the barrier.

echo basalt
#

the vignette intensity has to do with the distance you are compared to the warning distance

kind hatch
#

I think it's referred to as warning distance.

echo basalt
#

So if the warning distance is 5, and you're 2 blocks away, it's 60%

kindred sentinel
#

yeah but is it possible to display it artificially?

kind hatch
#

With packets, yes.

kindred sentinel
#

packets?

upbeat gale
#

Hey, im trying to build and im recieving these errors ```2023-08-22T21:38:34.221+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Error occurred during initialization of VM
2023-08-22T21:38:34.221+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not reserve enough space for 2097152KB object heap

Has anyone got any clue how to fix this, I have over 5gb ram available right now so im a little confused
grim hound
kindred sentinel
#

hm

#

it's too difficult for me i think

smoky oak
#
player.getInventory().getItemInMainHand().getItemMeta().addAttributeModifier(
    Attribute.GENERIC_ATTACK_SPEED,
    new AttributeModifier("GGP",1.6 - player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).getValue(), AttributeModifier.Operation.ADD_NUMBER));

This is slightly modified code, but it should still work? Why is the modifier not getting applied?

#

I'm running the code while holding said wooden axe

sullen marlin
#

GetItemMeta returns a copy that needs to be .setItemMeta

lilac dagger
#

^

smoky oak
#

hm

#

and about the other issue?

remote swallow
#

im only seeing 1 issue

lilac dagger
#

keep in mind that setting an attribute wipes away existing ones

smoky oak
#

where it says my attack speed is 1.6 but its in actuality closer to 0.7?

#

well im doing this nonsense cuz setting player Generic_attack_speed doesnt do squat

smoky oak
#

it prints out my speed is 1.6

#

but when i actually attack it recharges with normal = slow speed

sullen marlin
#

Not sure if that method takes into account items

smoky oak
#

it does

#

it registers 'weapons' and 'tools' if you print out the components for the player attribute

#

depending on whats in your hand

#

it just doesnt accept any input

#

or well, ignores it

ornate mantle
#

i hate nms

tender shard
#

same, but with mojang maps it's halfway usable

ornate mantle
#

not anymore

valid burrow
#

is there a way to get bungeecord servers status without using bungeecord

ornate mantle
#

the connection variable in 1.20 is now private

tender shard
ornate mantle
#

in the serverplayer class

ornate mantle
#

i tried the reflection method

tender shard
#

then you have to getDeclaredFields(), loop over that until you find one of type ServerGamePacketListenerimpl

smoky oak
#

wait

sullen marlin
#

There's a public method

smoky oak
#

can creative mode mess with attributes?
thats ALSO not it, im losing my mind

tender shard
#

which class exactly do you need? the Connection or the ServerGamePacketListenerImpl?

ornate mantle
#

connection isnt

#

which is what i need

tender shard
#

well then do

Class<ServerGamePacketListenerImpl> clazz = ServerGamePacketListenerImpl.class;
Connection connection = null;
for(Field field : clazz.getDeclaredFields()) {
  if(field.getType.getClass() == Connection.class) {
    connection = field.get(myServerGamePacketListenerImpl);
ornate mantle
#

reflection is so unreliable man

tender shard
#

oh dont forget to set it accessible

#

but yeah if you get the field through its type, you don't have to worry about the obfuscated name

ornate mantle
#
public Connection getConnection(){
        Field field = ((CraftPlayer) player).getHandle().connection.getClass().getDeclaredField("f"); // connection
        field.setAccessible(true);
        return (Connection) field.get(((CraftPlayer) player).getHandle().connection);
}```
#

this is what i did

tender shard
#

yeah but that's bound to that specific mapping

#

better use the field's type

sullen marlin
#

Which part of there's a public method was unclear

tender shard
#

there is none for Connection?

ornate mantle
#

^

tender shard
#

there is a field to get the ServerGamePacketListenerImpl on ServerPlayer (called connection, it's public))

#

but Connection is another class (extending the SImpleChannelInboundHandler) and there is no method to get that

#

the only way to get the "Connection" object is to get it from the private field "connection" in ServerGamePacketListenerImpl

ornate mantle
#

why'd they change it tho

tender shard
#

because mojang doesnt care whether you need it 🄲

ornate mantle
#

does mojang make nms?

#

lol

tender shard
ornate mantle
#

i barely know anything about this

tender shard
#

NMS is the original minecraft code

smoky oak
#

and remapped is the slightly more stable version created by spigot

ornate mantle
#

why is the obfuscated mapping called spigot and the good one mojang?

smoky oak
#

i dont think it is?

ornate mantle
#

oh i cant read english

#

its the mojang mappings remapped

#

its called remapped-mojang

carmine mica
#

there is obfuscated, spigot mappings (not good), and mojang mappings (good)

#

spigot only changes the names of classes now, and not new ones

smoky oak
#

wait theres three?

tender shard
carmine mica
#

there's way more than 3, other projects use others

smoky oak
#

which one of the remapped ones does --remapped spit out then?

ornate mantle
#

the good one everyone likes

carmine mica
#

but its own class names.
but not for new classes, new classes use mojang's mappings

tender shard
#

see here:

  1. MOjang mapped name: what mojang uses in their own code
  2. Obfuscated name "aig" - that's what the vanilla server calls it
  3. Spigot - that's how spigot called this class
#

if you use mojang maps in your plugin, then first the class name gets translated from mojang > obfuscated and then from obfuscated to spigot mappings, IIRC

#

although the only difference between spigot and obfuscated nowadays is class names

#

before 1.17, spigot also renamed methods and fields (sometimes), since 1.17 it does not do that anymore (in favor of mojang maps)

ornate mantle
#

i feel like you're chatgpt the way you bring up massive amounts of information in seconds

tender shard
#

🄲

smoky oak
#

he writes a blog

#

hes used to this

#

also on the earlier topic...
i really dont want to have to mess with item metadata if i dont have to. I just cant figure out why the final value of the attribute is ignored and replaced with a different one somehow? 1.6 -> 0.7

naive loom
#

Do clients have client side interpolation with items? (e.g. if I set the location of a stone block item entity will it smoothly transition to the set location or does it just teleport)

smoky oak
#

i think stuff just teleports

tender shard
#

e.g. Spigot: EntityZombie, Mojang: Zombie
but for Camel (1.20), it's both Camel

kind hatch
tender shard
#

my beloved display entities ā¤ļø

#

best addition in the history of additions, maybe ever

naive loom
#

How would I make it so it smoothly transitions to another location?

#

Like how if you throw a water in a flowing water stream it just flows down.

#

Trying to create a sort of "conveyor belt".

onyx fjord
#

we all wanted it

#

and mojang delivered

#

and number 2 are armorstands

sullen marlin
tender shard
#

install mediawiki 🄲

#

the spigot wiki is pain because of bbcode - and people flood the discussions with their own personal problems instead of simply discussing the article

kind hatch
remote swallow
tender shard
#

it is wikipedia

remote swallow
#

oh its trash then

#

just the docs better

tender shard
#

mediawiki is not trash

#

well but probably overkill for most things

green plaza
#

When i want to sell plugin on spigotmc can i make obf with my own obfuscator?

tender shard
#

the list of obfuscators allowed are listed in the rules on the website. other obfuscators require approval

onyx fjord
#

especially for programming related stuff

tender shard
#

No other obfuscator, whether public or private may be used on resources uploaded to this site. To inquire about adding an obfuscator to the above list, please contact staff and provide a sample plugin.

green plaza
onyx fjord
#

yours will also get cracked

tender shard
sullen marlin
tender shard
#

point 4.1.6

smoky oak
#

so is nms

green plaza
#

I didn't code project for a month so a day after release it will be available at black spigot for free

carmine mica
#

Obfuscation isn’t the thing preventing that…

onyx fjord
#

bad news, obfuscation wont make your plugin uncrackable

#

and DRM isnt allowed

#

so have fun

green plaza
onyx fjord
tender shard
naive loom
# kind hatch I'm not too sure about that. I think that's done with velocity, but it might be ...
public class ItemInterpolationTask extends BukkitRunnable {
    private final Item item;
    private final Location targetLocation;
    private final int steps;
    private int step = 0;

    public ItemInterpolationTask(Item item, Location targetLocation, int steps) {
        this.item = item;
        this.targetLocation = targetLocation;
        this.steps = steps;
    }

    @Override
    public void run() {
        step++;

        double progress = (double) step / steps;
        double x = item.getLocation().getX() + (targetLocation.getX() - item.getLocation().getX()) * progress;
        double y = item.getLocation().getY() + (targetLocation.getY() - item.getLocation().getY()) * progress;
        double z = item.getLocation().getZ() + (targetLocation.getZ() - item.getLocation().getZ()) * progress;

        item.teleport(new Location(item.getWorld(), x, y, z));

        if (step >= steps) {
            cancel();
        }
    }
}
```You think this would handle interpolation of the item smoothly? With steps being the "smoothness" of movement.
onyx fjord
#

you dont need the full deobufscated code to remove a part of DRM

#

also @green plaza im assuming you will use obfuscation + some form of drm

green plaza
onyx fjord
#

is that correct

#

???

green plaza
#

u cant even decompile this shit

tender shard
#

obfuscation is pretty pointless - and I say that as someone who paid for obfuscators twice

onyx fjord
#

send me the jar

tender shard
remote swallow
carmine mica
#

Open source + premium support is the better model

remote swallow
#

staff need to be able to read it

green plaza
green plaza
tender shard
#

you know, premium plugins require approval

remote swallow
#

check for malware, check for drm, etc

carmine mica
#

Pay for compiled jar on spigot, open source, only offer support on discord or whatever to those who pay

ornate mantle
#

if theyre not gonna fix my bugs then whats the point

tender shard
onyx fjord
#

obfuscation is good at hiding bad code

#

lets be honest most premium plugins have shit code

green plaza
#

So it should work like that that staff compile your project from src and post it and verify from src.

onyx fjord
#

because why care if noone sees it

tender shard
#

idk they must have at least a minimum standard of code quality to get approved in the first place

onyx fjord
#

i do that

green plaza
#

Posting on spigotmc premium projects is basicly allowing someone to crack it and post it 2 days later on black spigot

onyx fjord
#

then dont publish anything

#

keep it to yourself

#

if you are scared of publishing something

carmine mica
#

(This is why you do paid support, can’t ā€œstealā€ that)

tender shard
green plaza
#

OKay great

#

Perfect

#

I didn't know its available option

onyx fjord
#

you cant stop it, your plugin will get cracked sooner or later

tender shard
#

I have sent you both articles that both mention this and also included a quote where it's mentioned

onyx fjord
#

@green plaza but why obfuscate when someone can just repost the obfuscated jar?

#

makes no sense

tender shard
green plaza
onyx fjord
#

whats stopping that person

onyx fjord
tender shard
# green plaza He can not

why not? you do realize that DRM is only partly allowed right? your .jar must work straight "as is" after downloading it, without any additional setup or internet connection - which is btw, also mentioned in the rules

green plaza
# onyx fjord you will be suprised

No one is secured but using more complicated and advanced techniques to secure the code drasticly decrease amount of ppl that can crack it

kind hatch
#

I'd bet Optic or Frost could do it in less than an hour.

tender shard
#

i bet even I could do it

green plaza
kind hatch
onyx fjord
#

your plugin has to work offline you know that?

tender shard
green plaza
green plaza
onyx fjord
#

yeah then your attempts of making it uncrackable are pointless

#

anyone can just firewall any drm you got

#

or straight up remove it

green plaza
#

U seem like u pro

#

So great

tender shard
onyx fjord
#

make that a competition

#

lets see who does it first

#

but deposit money to staff so we know you dont scam us

green plaza
tender shard
#

yeah you can open a thread in spigot forums and send your .jar there, then ask people to crack whatever there is to get cracked

green plaza
#

No XD

#

Why would i help ppl to crack it

onyx fjord
green plaza
#

I don't rly give a fuck what u know or u don't

tender shard
#

a minute ago you wanted to offer them thousands of dollars and now you don't want to distribute a .jar? then how would someone crack it if you don't send the .jar? is your method of preventing cracks that you simply not upload anything? because if so, then yeah, that'll work

onyx fjord
#

there are many reasons not to trust you

#

first is you trying to hide your code

#

thats shady

tender shard
#

brb smoking

green plaza
onyx fjord
#

no

kind hatch
onyx fjord
#

i dont really buy proprietary software

#

nor i use it

kind hatch
onyx fjord
#

some games are an exception

green plaza
#

There are bilions ppl here except u

onyx fjord
#

cool i dont care

river oracle
#

Proprietary software has its place, granted I don't think its great in all scenarios

onyx fjord
#

the rest of the world doesnt matter to me besides my family and friends

tender shard
green plaza
onyx fjord
#

@green plaza do you know whats the license of bukkit api / spigot api

green plaza
#

Idk never thought of this

onyx fjord
#

LOL

#

look into it

kind hatch
#

Well uhh, you're not going to like it then. lol

onyx fjord
#

spoiler: its not on your side

river oracle
#

just turn a blind eye and pretend you didn't see it :P

onyx fjord
green plaza
#

GNU GENERAL PUBLIC LICENSE

onyx fjord
#

and just not pay them

green plaza
#

Is that it?

river oracle
#

GPLv3

onyx fjord
tender shard
green plaza
#

So i don't think it apply for this license

onyx fjord
#

it doesnt matter

#

you use it in your plugin

tender shard
onyx fjord
#

so it applies

#

ogh its not a plugin

#

then what is it

tender shard
#

You can only sell plugins on spigot

green plaza
onyx fjord
#

šŸ’€

green plaza
#

Oh weired

onyx fjord
#

mf is trying to sell mojangs code

tender shard
onyx fjord
#

@green plaza is the fork for version 1.8

tender shard
green plaza
onyx fjord
#

let me go ahead and notify mojang about that

#

you know that its illegal to resell their code right

green plaza
#

XDDD

quaint mantle
#

Good evening, I'm using CombatLogX and I can't add the menu command. Can you help me?
Picture here #verified

onyx fjord
#

you can be sued for that

remote swallow
#

ud have to use bbb to sell server jars probably

green plaza
#

U stupid asf

onyx fjord
#

theres a reason theres no public access to compiled spigot jars

onyx fjord
tender shard
onyx fjord
#

based on your knowledge

green plaza
#

Great i have not a single code from mojang

green plaza
onyx fjord
green plaza
#

What it is

onyx fjord
#

you built minecraft server from scratch?

tender shard
green plaza
onyx fjord
#

then does it have their code or not

green plaza
#

Nope

#

It does not

onyx fjord
#

can you prove it?

tender shard
#

Not the other way around

onyx fjord
#

if its a fork theres a ton of code

green plaza
#

It only handle necesery things like ArmorStand, Players, Worlds, Blocks, locations, Items, Commands, Inventories

tender shard