#help-development

1 messages ยท Page 1724 of 1

acoustic pendant
#

The action bar is the thing that is above the life right?

civic apex
#

i think so

acoustic pendant
#

for example, where the life and mana in hypixel skyblock is

tender shard
#

yes

#

or are you talking about the "Grass Block" thing?

#

because that's something different

acoustic pendant
#

no

#

look

#

this thing

tender shard
#

That's the action bar

acoustic pendant
tender shard
#

actiooooonbaaar

#

but you're not going to use NMS to access it, I hope?

acoustic pendant
tender shard
#

kk

civic apex
#

finally i finished the crafting thing

#

should work identically to a ctable

#

after 7 nested for loops

mortal hare
#

get topinventoryview slots

#

and check if the clicked slot is higher or equal of top lowest inventory view slot

#

at least that's how i did this

#

that way the GUI inventory is cancelled while players inventory isnt

#

but it requires more work than that

rigid hazel
#

Code:

            List<String> lorePieces = Arrays.asList(lore.split(" "));
            List<String> lines = new ArrayList<>();
            String currentLine = "";
            int resultLength = 0;
            for(String lorePiece : lorePieces)
            {
                resultLength += lorePiece.length()+1;
                currentLine += lorePiece + " ";
                if(resultLength >= 20)
                {
                    lines.add(currentLine);
                    resultLength = 0;
                    currentLine = "";
                }
            }```
#

How it looks like.

#

But in the next line, there should stay ,der .

#

[Werde, zu, einem, starken, Krieger,, der]

#

Because of that list. Why does it not work?

#

Please ping if anyone has an answer

#

Yeah.

eternal oxide
#

compare slot to rawSlot. If they are different it tells you which inventory was clicked

acoustic pendant
#

How can i do to spawn a entity with delay?

I have this:
Bukkit.getScheduler().runTaskLater(Holograms.getInstance(), player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND, ));

But in the last , it says randomizeData instead of "Delay"

eternal oxide
#

it requires a Task, not a line of code

acoustic pendant
#

oh?

eternal oxide
#

?scheduling

undone axleBOT
acoustic pendant
#

ok thank you

rigid hazel
#

@eternal oxide Can you help me pleeeeeeeeeeeeeeeeeease? ๐Ÿฅบ

eternal oxide
#

No it will always be a dual inventory. The Player inventory is always show.

eternal oxide
#

You are trying to split text on a line length of 20?

rigid hazel
golden turret
#

any help please

eternal oxide
#

You are going too fast

#

its skipping positions because you are simply trying to make it go too fast and it never gets to render evenly

torn shuttle
#

I am regretting this discord to trello bridge project

eternal oxide
#

its like trying to make it fly in a circle but due to the speed you are trying to make it move you only have 3 points on the circle for it to move to.

#

with animations you are limited by bandwidth and the division of 20 ticks per second

stone sinew
eternal oxide
#

if you try to make it move two positions in a single tick it will skip the middle one.

#

He's using tick timing

#

as such he is limited to 20 ticks

#

Simply put (using ticks), the faster you try to go the lower the resolution of the circle. Less points and less positions to move to.

young knoll
#

Arenโ€™t you limited by ticks even with packets

#

Or are you then limited by FPS

eternal oxide
#

You are still limited by ticks as each packet is processed as its received, but updates are done per tick.

#

you can send more packets using async but its not going to be smoother

mortal hare
#

no

#

sending packets via async

#

will make the packets wait in a queue

eternal oxide
#

More likely you are going to back up the queue and be restricted by bandwidth

stone sinew
eternal oxide
#

I stand corrected then

mortal hare
#

try making bigger gaps between keyframes of your animations

stone sinew
#

Could go faster but breaking 100k blocks every 1ms probs not a good idea lol

mortal hare
#

its probably due to the way your server cant keep up with all of your packet data

#

if you're sending many of them

#

it can cause issues

young knoll
eternal oxide
#

He's doing his calculations by ticks which is why his resolution is dropping.

mortal hare
#

its not as if server is constant 20 tps

eternal oxide
#

it is when he's calculating the next position based upon a speed variable which calculates the next position by multiplying ticks

#

he is literally reducing a circles resolution

stone sinew
eternal oxide
#

yeah, you don;t get it. It has nothing to do with FPS

#

oh separate convo?

mortal hare
#

so he's getting the tps of the server and multiplying the same value repeatedly

#

i don't understand since i havent seen the code

eternal oxide
#

no he's not using teh TPS at all

#

he's increasing the rad per sec which is basically skipping positions on the circle

#

if he wants more granular movement he needs to increase the speed of his loop

mortal hare
#

wouldnt this be fixed if it was running on a seperate thread pool?

eternal oxide
#

yes

#

and run faster

#

to maintain resolution as his movement speed increases he needs to increase the speed of the loop.

wintry cloud
#

Hey there,
i want to create an economy-system working with vault in my own plugin. I tried to register it into vault like in the documentation but other plugins like Towny or Shopchest are saying "Could not find any Vault economy dependency".

Someone here with a good Tutorial / example repository how to create an own economy plugin working with vault and other plugins?

mortal hare
#

ah yeah good old trigonometry here

#

good that im having course on trigonometry this year

stone sinew
#

Idk what was actually being talked about. I was just letting it be known armor stand movement was not limited by tick rate.

eternal oxide
#

which is good to know ๐Ÿ™‚

#

You are only limited by bandwidth

stone sinew
#

The more points of a circle the armor stand has to move to in a circle the smoother the animation. (If I understood your last message correctly)

eternal oxide
acoustic pendant
#

How can i add properties to an entitie and spawn it later

eternal oxide
#

nice

#

an Entity either exists or it doesn;t

torn shuttle
eternal oxide
#

unless you fake it using NMS/packets

eternal night
#

lies and deception

eternal oxide
eternal night
#

tho you won't be able to create such a virtual entity, afaik spigot introduced the structure API and is now exposing entities that are not spawned in a world

eternal oxide
#

a Class to store all your information and that can be used to spawn the Entity later

stone sinew
torn shuttle
#

to go along with your animation

stone sinew
#

Ah

torn shuttle
#

man I have no clue of what I am doing with these get and post requests

#

and with nodejs in general

acoustic pendant
#

You would need to write a wrapper for your entity
@eternal oxide so if i add delay to the spawn of an entitie it will have the properties?

torn shuttle
#

we must go deeper

eternal oxide
acoustic pendant
#

Yes

#

Because if not

torn shuttle
#

how are you rotating them btw

stone sinew
eternal oxide
#

if so use the World#spawn method that takes a Consumer

acoustic pendant
#

When it spawns it's not invisible

torn shuttle
stone sinew
#

For loop with the division of 360 and pi

eternal oxide
#

yes as I just said, use the world spawn method

acoustic pendant
#

Eh?

stone sinew
torn shuttle
#

if you're going to have it run forever you might as well precache it for good

acoustic pendant
#

The player.getWorld ?

torn shuttle
#

will let you go up to 500+ entities without hitting your tps

acoustic pendant
#

Oh i see

#

Ty!

stone sinew
torn shuttle
#

I mean youcan it's just not a good idea

#

I can go steal candy from a baby but that doesn't mean that I should do it

stone sinew
#

Having that many entities in 1 area doing anything in the first place is a bad idea xD

torn shuttle
#

eh

#

depends on what you're trying to do with the server

stone sinew
torn shuttle
#

then add one more armor stand per second

crude charm
stone sinew
ivory sleet
#

Probably baby armor stand

crude charm
ivory sleet
#

Possibly packets?

crude charm
stone sinew
#

Wither.setAdult(false)

golden turret
crude charm
stone sinew
#

If it's in skyblock it's more than likely a texture.

eternal night
#

You can also just fake a withers particles/boss bar can't you

ivory sleet
#

^

torn shuttle
mortal hare
#

are the mini wither even used in the game

crude charm
#

I dont have a pack on that would make it like that

mortal hare
#

what's the purpose of baby withers lol

crude charm
mortal hare
#

no im talking about vanilla

stone sinew
stone sinew
crude charm
golden turret
#

yes?

crude charm
#

not built in

torn shuttle
#

maybe!

crude charm
#

no

#

it doesn't

#

I've been playing it since day 1, there is no texture pack

stone sinew
crude charm
mortal hare
#

i would rather compile the location calculations into some kind of AnimationController class and play them, rather than using trigonometry functions every tick which are expensive to do sometimes

golden turret
#

dovidas

mortal hare
golden turret
#

you seem to know armor stamds animation

crude charm
#

yes, there are mod or packs for it but this is vanilla, I'm not using any of those pack mods

mortal hare
#

that's just my idea in my head

stone sinew
mortal hare
#

oh

golden turret
#

could you help me with this?

eternal oxide
golden turret
#

ye

#

did not read

mortal hare
#

i'm sorry i really can't, Coll knows about it much better than me

eternal oxide
#

are you now using packets to animate yoru stands?

golden turret
#

yes

eternal oxide
#

then you need to stop using ticks to calculate your stand locationsd

golden turret
#

๐Ÿ˜”

eternal oxide
#

move off the scheduler and instead run a Thread which can run faster

golden turret
#

i think it is based in the radPerSec

#

so if i change it

#

it would be a new location

eternal oxide
#

you can't obtain the speed you want using a resolution of ticks

golden turret
#

actually it is not about speed

eternal oxide
#

teh faster you go the more jumpy your animations will be.

#

its all about speed

golden turret
#

it is about the armor stands teleporting after i change the speed

eternal oxide
#

Yes, thats exactly what I'm telling you

#

As you increase the movement speed the resolution of your calculations decrease

golden turret
#

ok

eternal oxide
#

you need to run your loop faster to be able to increase the accuracy

#

which means moving off the scheduler and onto Threads

#

you need to be able to run faster than 1 tick loops

golden turret
eternal oxide
#

yes you move away from ticks

golden turret
#

what i do with that?

eternal oxide
#

you will be running a Thread on milliseconds

golden turret
#

yes

eternal oxide
#

so you can control the granularity of your movements teh same way, but you use the ms instead of ticks

eternal night
#

@crude charm btw the wither size is relative to the invulnerable ticks left

#

afaik around 1k is the smalltest possible ?

#

or 900

#

tho those are barely visible withers

#

that size might be closer to 750 ticks left

#

somewhere around 1k it should switch, rendering the wither upside down btw

golden turret
#

lol

#

my code is killing the server

#

ok

#

but i want to change it while the animation is happening

stone sinew
golden turret
#

send it

#

i will send mine

eternal oxide
#

you can change speed all you want, but your loop has to run fast enough to maintain teh fastest speed

golden turret
#

?paste

undone axleBOT
golden turret
#

:C

stone sinew
golden turret
stone sinew
#

Gotta do the math based on your circle speed

golden turret
#

how could i do this

stone sinew
# golden turret how could i do this

So lets say you do 10 positions in that circle for a speed of 2 ticks or what ever. You need to add more positions to smooth it out at higher speeds so like 15 per 1 tick or such.

#

otherwise its snaps to a position thats far and doesn't look as smooth as at lower speeds.

golden turret
#

i did not understand

eternal oxide
#

imagine a circle with 12 points around it. Locations your stands can move to at speed 1.
If you double the movement speed of a stand to 2 it skips every other position. It now only has 6 positions it can move to.
Increase to speed 3 and you now only have 3 locations around the circle this stand can be in.

golden turret
#

wait a minute

#

i almost did it

ancient plank
#

large brain

golden turret
trail flume
#

Is there a way to detect when a player comes into another player's render distance?

stone sinew
golden turret
#

no

#

but i think i can change itby decreasing the speed

trail flume
#

Surely that's just when a player joins?

mortal hare
#

there's only server side render distance

#

wait a bit

trail flume
#

ok

mortal hare
#
This packet is sent by the server when a player comes into visible range, not when a player joins.```
#

catch this packet and you're good to go

trail flume
#

Thanks

#

What's the packet name/class in code?

torn shuttle
#

if I accidentally close git bash again instead of closing the screen I'm going to bed

ancient plank
#

:(

mortal hare
trail flume
#

NMS

torn shuttle
#

holy shit boys

#

my code, it works

#

it actually works

mortal hare
#

use auto complete you should find it, idk

trail flume
#

I don't want my plugin to have many dependencies

torn shuttle
#

pop the champagne

mortal hare
#

PacketPlayOutSpawnPlayer maybe

#

or PacketPlayOutPlayerSpawn

trail flume
#

Ty

mortal hare
#

its a server packet, the server sends it not the client

trail flume
#

yeah

mortal hare
#

but if server sends it i think there's a better way to do this

trail flume
#

Seems like only PacketPlayOutEntitySpawn

mortal hare
#

EntitySpawn is different packet

trail flume
#

ik

#

I'm just saying there isnt a player spawn one that I can find

mortal hare
#

what version of your protocol are you using

trail flume
#

you're not gonna like me when I tell you

#

1.8.8

mortal hare
#

well idk then

ancient plank
#

time to get googlin

mortal hare
#

im looking at 1.17's protocol info

trail flume
#

ok

ancient plank
golden turret
#

bro could you give me your code? im spending a lot of time on this

acoustic pendant
#

@eternal oxideHey, you told me before about "spawn" could you help me with it?

amber vale
#
        at net.minecraft.server.v1_12_R1.Chunk.a(Chunk.java:833) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.World.getEntities(World.java:2439) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.World.getEntities(World.java:2426) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.World.getCubes(World.java:1241) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.Entity.move(Entity.java:658) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.EntityLiving.a(EntityLiving.java:1813) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.EntityHuman.a(EntityHuman.java:1416) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.EntityLiving.n(EntityLiving.java:2124) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.EntityHuman.n(EntityHuman.java:348) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.EntityLiving.B_(EntityLiving.java:1946) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.EntityHuman.B_(EntityHuman.java:145) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.EntityPlayer.playerTick(EntityPlayer.java:313) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
#

o,o

chrome beacon
#

entity1 is null

#

?paste next time..

undone axleBOT
eternal oxide
amber vale
#

Yes, but this seems to be happening at completely the mercy of god.

amber vale
#

I get that for what ever reason it cant find entity1

acoustic pendant
chrome beacon
acoustic pendant
#

i have something like that

amber vale
#

But that has nothing to do with my code it is in minecrafts code

#

hmm

#

wait

eternal oxide
acoustic pendant
#

it has spawnEntity but i can see the armor stand for some miliseconds

acoustic pendant
#

ArmorStand hologram = (ArmorStand) loc.getWorld().spawn(loc, ArmorStand.class, (ArmorStand) -> {
ArmorStand.setSource(player);
ArmorStand.setVelocity(new Vector());
});

#

like that?

eternal oxide
#

except ArmorStand not TnTPrimed

amber vale
#

I got no clue

chrome beacon
acoustic pendant
amber vale
#

I am using Java 8?

#

Oh wait

#

wait

#

I know what this is

#

The server has java 16

#

fuck me... ._.

eternal oxide
acoustic pendant
#

ok

#

so where is velocity and that things

#

i put the properties?

#

write*

mortal hare
#

iterating players is thread safe right? since its unmodifiable list

#

the only thing i need to look after is reference change of list

#

?

#

right?

chrome beacon
#

lowerCamelCase variable names

mortal hare
#

ArmorStand is a type

#

hologram is a variable name

acoustic pendant
eternal oxide
#

You shoudl not be using setSource nor setVelocity

acoustic pendant
#

but still

eternal oxide
#

you replace those with your setInvisible

acoustic pendant
#

getting errors with "loc"

mortal hare
#

Elgar

eternal oxide
#

thats teh location you are spawning the stand at

mortal hare
#

is getting online players and iterating

#

thread safe

eternal oxide
#

not really

mortal hare
#

but its an unmodifiable list

eternal oxide
#

yes

chrome beacon
mortal hare
#

i can get the reference of the list

#

in main thread

#

pass it to another one

chrome beacon
#

Which is what I was refering to

mortal hare
#

and iterate it

eternal oxide
#

but the data backing could be stale

mortal hare
#

so what i could do then ๐Ÿ˜„

#

i need non stale data

eternal oxide
#

what are you trying to do?

acoustic pendant
mortal hare
#

send packet to all of the players

eternal oxide
#

then yes do it but catch any exception

acoustic pendant
#

what?

eternal oxide
#

post yoru code not a screenshot so I can edit

acoustic pendant
#

ok

#

i have some comments there

mortal hare
#

i would still get stale data

#

but it should be more recent right?

#

technically

#

inside the async task

#

ik you wouldnt loop iterate the list without creating the list reference since the reference could change and you would get messy data

vestal turtle
#

Hello, can someone help figuring out an algorythm to find a random spot on an angled line?

eternal oxide
vestal turtle
acoustic pendant
#

the rest do

eternal oxide
#

setInvisible

acoustic pendant
#

nope

eternal oxide
#

yep

acoustic pendant
eternal oxide
#

why are you still using ArmorStand?

#

I corrected all that

acoustic pendant
#

oh sorry

acoustic pendant
unreal quartz
eternal oxide
torn shuttle
#

has anyone here done discord bot work before

#

I have it all down I just don't get how to reference inline replies

acoustic pendant
west wolf
#

Hi, i am gonna develop a plugin that makes you being able to connect your boat to another boat with a lead. Anyone got any idea on how i should do this?

torn shuttle
#

I thought it was msg#reference but it seems to say it's null

vestal turtle
torn shuttle
#

oh wait I'm just dumb

#

nvm

eternal oxide
#
ArmorStand hologram = (ArmorStand) player.getWorld().spawn(player.getLocation(), ArmorStand.class, (armorStand) -> {
    armorStand.setInvisible(true);
    armorStand.setCustomNameVisible(true);
    armorStand.setCustomName(ChatColor.RED + "Hologram");
    armorStand.setGravity(false);
    armorStand.setInvulnerable(true);
});``` Works perfectly
acoustic pendant
#

so i don't understand why is sending an error

eternal oxide
#

show your imports

acoustic pendant
#

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;

eternal oxide
#

imports are fine

acoustic pendant
#

yees

#

the error sais

#

"Cannot resolve method 'setInvisible' in 'T'

west wolf
#

Hi again, so i was thinking about attaching a boat to an invisible animal. So you can use leads on it. How would i do that?

eternal oxide
#

No idea, shitty IDE

#

Works perfectly here

acoustic pendant
#

hmm

#

can u paste all the complete code you have?

acoustic pendant
#

the IDE is intelijj

ancient plank
#

aint it setVisible

#

not setInvisible

acoustic pendant
#

nope

#

the same error

ancient plank
#

unlucky

acoustic pendant
#

yes, but it sends the same error

eternal oxide
#

try ArmorStand hologram = (ArmorStand) player.getWorld().spawn(player.getLocation(), ArmorStand.class, (ArmorStand armorStand) -> {

acoustic pendant
#

ArmorStand armorStand?

quaint mantle
#

L, Works perfectly

vestal turtle
tender shard
acoustic pendant
#

let me see

unreal quartz
quaint mantle
acoustic pendant
eternal oxide
#

setVisible and setInvisible both compile for me.

unreal quartz
quaint mantle
#

api version

eternal oxide
acoustic pendant
#

java version maybe?

quaint mantle
#

API

tender shard
#

in your dependency section

unreal quartz
#

i had never seen it before but maube i'm just blind but cool

quaint mantle
#
    <dependencies>
        <dependency>
            <groupId>some.group.id</groupId>
            <artifactId>artifact-id</artifactId>
            <version>VERSION</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
tender shard
vestal turtle
unreal quartz
#

i don't know what jumpandrun is you definitely need 2 axis for this

vestal turtle
acoustic pendant
#

this?

vestal turtle
#

And i wanna get a point, a block of the angled line

unreal quartz
#

if it was a straight line then you only need 1 axis, but the x and z co-ordinates vary when you move along the line

tender shard
acoustic pendant
tender shard
#

try to use it anyway and let it compile

eternal oxide
#

it does for everyone else

unreal quartz
acoustic pendant
eternal oxide
#

invalidate your caches and restart

acoustic pendant
#

no

#

i can't compile

eternal oxide
#

File menu

tender shard
#

what's the error?

eternal oxide
#

invalidate cache and restart

acoustic pendant
acoustic pendant
tender shard
acoustic pendant
#

eeeh

#

yes

#

๐Ÿ˜„

acoustic pendant
tender shard
#

but you must know that

acoustic pendant
vestal turtle
# unreal quartz no..? explain

Yes, because i dont wanna go up on the y-axis. Or did you mean that i need a x and a z axis for the point? I use 2D dimensions not 3D

tender shard
#

what are you clicking to compile @acoustic pendant ?

acoustic pendant
unreal quartz
tender shard
# acoustic pendant

go to the right of intelliJ, click Maven, then Lifecycle, then double click package

vestal turtle
#

But the same question, how do i implement it?

vestal turtle
acoustic pendant
#

@tender sharddo i send you the whole code maybe?

unreal quartz
unreal quartz
#

those functions accept an angle as radians

mortal hare
#

well no

#

not true

#

but practical use case for trigonometric functions are rads

vestal turtle
#

Well could someone do an example because i dont really understand it rn

unreal quartz
#

?

unreal quartz
#

it quite clearly asks for it in radians..

unreal quartz
tender shard
#

uuugh people using math again

mortal hare
#

is the conversion to radians

torn shuttle
#

I didn't let my dreams be memes, I just finished making this

unreal quartz
torn shuttle
#

bow down to the greatness of my discord->trello bridge

tender shard
torn shuttle
#

tbh you were right, there's hardly anything to it

#

I spent 4 hours trying to figure out the best way to do post requests with nodejs and 10 minutes writing the code

onyx shale
#

yikes

#

just use axios or similar

mortal hare
#

yay

#

my dynamic command allocation works!

#

finally

onyx shale
#

yikes...

mortal hare
#

what

onyx shale
#

not a fan of injecting things into the command map directly

mortal hare
#

its deeper than that trust me ๐Ÿ˜„

#

you need to create unregister method for specific command object too

#

since bukkit doesnt have it

#

also you need to sync brigadier manually

#

its not disabling the command

#

its removing it completely

#

you can for example remove specific commands that you dont need from the server which you cannot unless you edit the jar

#

its removing the command from command map and brigadier command dispatcher

#

technically yes

#

unless the plugin doesnt have the reference to the plugincommand object its gone

#

neither nms neither spigot doesnt know about the command

#

after that

#

except if you have a reference to that and reregister it

#

if you dont have the reference, the garbage collection will delete the instance completely from memory

#

i created this to wonder if I can remove some internal bukkit and spigot commands which i don't need

#

but i decided to implement this to my command node system too

#

for example lets say you have an Essentials plugin installed and you somewhat useless command /jail (useless for me, idk), and here's the options for me to do that:

โ€ข Use commands.yml file. but the thing is it doesn't disable the command completely, it only deletes the command label value from command map, thus you need to add all the aliases of the command too to that list.
โ€ข Use command disabler. Usually these command disablers only hide commands, not deregister them, thus it still exists in the server and administrators can access it and that's not what i need.
โ€ข Decompile the plugin. What if plugin is obfuscated? This is not suited for everyone, also you can get your plugin access voided, because some plugins have anti piracy boobytraps Not gonna even talk about the hussle to fix all the decompilation errors.

All of these methods have cons so i've tried to think how to get away past those.

paper viper
subtle folio
#

Im trying to make players not get exp whenever they hit without a sword in their hand,

if(((Player) event.getDamager()).getInventory().getItemInHand() != null){
                ((Player) event.getDamager()).giveExp(1);
            }```
 this is my current code
its not working atm
acoustic pendant
#

Hello, i have this problem could anyone help me?

mortal hare
#

?

acoustic pendant
#

i can see the armorstand for a few miliseconds

#

and the when i hit where the armorstand is

mortal hare
#

do you use entities?

#

or packets

acoustic pendant
#

it souns

acoustic pendant
#

what is better?

mortal hare
#

its because its serverside entity

#

you need to send packets

acoustic pendant
#

how can i do that?

mortal hare
#

seek google for protocollib

#

or if you're primitive ooga booga who likes NMS

#

use netty channel injection

acoustic pendant
#

i don't know any of both things

#

xD

mortal hare
#

protocollib is easier

#

its a plugin for spigot

#

which you drop

#

and include as library inside your plugin

#

and you can send packets easily

#

there's plenty of tutorials online how to use protocollib

#

even on youtube

acoustic pendant
#

see

mortal hare
#

there's couple thing which cant be fixed even with packets

tender shard
#

IntelliJ will also mark the line in yellow to tell you this @subtle folio

mortal hare
#

for example you cannot hit anyone via hologram (detection is done clientside and sent to the server)

tender shard
mortal hare
#

you can fix this but it would require you to do ray tracing of normal player's range value

#

and seeing if it hits something

#

if it does simulate player damage with its current tool

#

but it requires more classes than its worth it to do

tender shard
mortal hare
#

i've got so many sleep problems because of it

tender shard
#

let me know when you found out how lol

mortal hare
#

i managed to restore my back to its place naturally somehow

#

buy an office chair

#

it would help alot

#

gaming chair are trashiest thing i've got

#

at least it was free

#

that fucking chair scratched my floor

tender shard
#

I have an office chair, but

#

this is me

young knoll
#

Shrimp

tender shard
#

I am Shrimp

#

yes

mortal hare
#

my back was so bad at that time that i was sleepin while in pain

#

and i couldnt lift something heavy off the floor

#

thank god its over now

quaint mantle
#

i ate so much shrimp i became allergic

tender shard
#

that was their revenge

quaint mantle
#

Anyone know of a good anti-cheat that works with CMI?
Can be premium, i dont mind

chrome beacon
mortal hare
#

Verus is a great packet level anticheat but its 200$ and only sold for networks

#

NCP forks are great too

#

it could kill killauras like flies

chrome beacon
#

NCP updated with a good config is perfect

#

Anyway as for the CMI part uh they like to do a lot of bad things

mental chasm
#

Why on earth is spigot registering events annotated with @Subscribe?

ivory sleet
#

@EventHandler ?

mental chasm
#

No Subscribe from guava

#

@ Subscribe

ivory sleet
#

Itโ€™s really not using Guavaa event bus framework

mental chasm
#

I'm saying it does register methods annotated with @ Subscribe

#

I'm asking why

ivory sleet
#

Idk hard to believe why it would

#

Unless youโ€™re on some fork that is

paper viper
chrome beacon
#

There is

paper viper
#

Yeah

#

I don't think you need packets, you can just use that method

tender shard
subtle folio
#

but checking if its air doesnt work either

#

ยฏ_(ใƒ„)_/ยฏ

tender shard
#

then add some debug statements and see what exactly is happening

tender shard
#

you are never cancelling getting XP

#

all you do is giving the damager one additional XP when they have an item in their hand

subtle folio
#

ive come up with a fixed

#
if(((Player) event.getDamager()).getInventory().getItemInHand().getType().equals(Material.WOOD_SWORD) ||
                    ((Player) event.getDamager()).getInventory().getItemInHand().getType().equals(Material.STONE_SWORD) ||
                    ((Player) event.getDamager()).getInventory().getItemInHand().getType().equals(Material.IRON_SWORD) ||
                    ((Player) event.getDamager()).getInventory().getItemInHand().getType().equals(Material.GOLD_SWORD) ||
                    ((Player) event.getDamager()).getInventory().getItemInHand().getType().equals(Material.DIAMOND_SWORD)){
                ((Player) event.getDamager()).giveExp(1);```
tender shard
#

uuugh damn that's an ugly piece of code

subtle folio
#

all i wanted was swords

#

it should work spagethi or not

main dew
#

how get playername with UUID offline mode without use offline player?

subtle folio
#

yeh but like

#

public static kinda eh

gaunt saffron
#

[15:36:57 ERROR]: Could not load 'plugins/BuildBattleControl.jar' in folder 'plugins': uses the space-character (0x20) in its name

um? what? please help what is this even lol

tender shard
crude sleet
#

Hey guys, i need some help with my Packets.
I want if a player click on any Recipe in my Custom Furnace Inventory, that the Recipe cant be used.
I dont know why but if i try it with fakeblock clicks etc. it works but on this recipe packet, it dont work.
https://hastebin.com/ejipitosac.php

gaunt saffron
tender shard
tender shard
gaunt saffron
#

can't find plugin.yml
found xml tho
and fixed it to
<name>TCW-BuildBattleControl</name>

also reloaded maven

and same error?

#

nvm

#

found the yaml

#

thanks fgor help

mortal hare
#

packets should be preffered because its mostly static

main dew
#

I use this method to get UUID from String

UUID.nameUUIDFromBytes((String).getBytes(Charsets.UTF_8))```Is there an reverse option? (to get a String from UUID)
unreal quartz
#

.toString?

#

and UUID has a parseString (or similar) method

main dew
unreal quartz
#

yes

ancient plank
#

this man gets uuid from string by using bytes instead of using #parseString()

#

you see something new every day

main dew
#

how I use this method java System.out.println(UUID.nameUUIDFromBytes(("OfflinePlayer:" + "Raymano").getBytes(Charsets.UTF_8)));I got the result 5d336a96-7a2a-315d-a543-bb6a5aa9b4e7 (my UUID in offline mode)

unreal quartz
#

you can't reverse that

#

it's a hashing function

main dew
#

there is no way?

unreal quartz
#

nope

#

well, they could be

#

but by design they are not reversible

#

have you... tried it?

main dew
unreal quartz
#

well it wont be in dark red, it will be in bold, and that is incorrect use of translateAlternateColorCodes

main dew
unreal quartz
unreal quartz
#

if its a one-off thing then you could just write a python script or something to request each username from mojang/namemc/whatever and store a uuid-name map there

main dew
#

and I can't use getOfflinePlayer java OfflinePlayer#getNamereturn null

main dew
#

what kind of script are you talking about?

unreal quartz
#

well, you're kinda fucked

main dew
#

๐Ÿ˜…

#

and I have over 10,000 users to read ๐Ÿ˜…

lavish hemlock
mortal hare
#

what is the problem exactly

main dew
mortal hare
#

raymano what's the problem

#

if i understand correctly you have lots of offline UUID's which need to be converted to names right?

lavish hemlock
#

iirc converting offline UUIDs to names is a bit difficult

mortal hare
#

If so, there's an usercache.json file inside server files, which stores json structure of uuids mapped to usernames, it is specifically designed for offline players to make plugins compatible both with offline players and online players, otherwise plugin would need to implement different storing techniques for player data

#

read the structure from the file and use a for loop to check if key UUID is a match if so, map the player name to your needs

#

my usercache.json:
[{"name":"Dovias","uuid":"bf35cc01-5df1-355c-aaa6-44ed8a1bbbd7","expiresOn":"2021-11-09 17:20:37 +0200"},{"name":"Doviasas","uuid":"4560dddf-cdbf-3989-83a9-a610749ac9ba","expiresOn":"2021-11-01 19:10:31 +0200"}]

quaint mantle
#

what is this

#

1 = $5
10 = $5 * 10

#

its literally simple math

#

????????

#

price * 10

#

its that simple

ancient plank
#

bUt sIr!

hasty prawn
#

Upgrade 10 should just be 5.49M * 10

#

So 54.9M, and then 549M for 100

mortal hare
#

i think your string formatting method is broken

main dew
#

and that's literally 1000

golden turret
tender shard
#

yo everyone

#

how awesome are YAML anchors

#

I only about them since a few weeks

#

why did noone tell me about them earlier

#

๐Ÿ˜ 

mortal hare
#

holy shit

#

thank you

#

!!!

tender shard
#

it's so awesome!

ancient plank
#

a hwat

tender shard
#
  autoinvsorting-disabled:
    displayname: 
    base64: *base64-disabled
    lore:
      - *lore-disabled
      - *autoinvsorting-lore-1
      - *autoinvsorting-lore-2
  autoinvsorting-nopermission:
    <<: *nopermission
    display-name: *autoinvsorting-name
mortal hare
#

built in variables

#

inside yaml format

tender shard
#

let's you easily reuse existing yaml sections, even overriding only certain things

#
  autoinvsorting-enabled:
    display-name: &autoinvsorting-name "<#2e86c1>&lAutomatic Inventory Sorting<#/85c1e9>"
    material: PLAYER_HEAD
    base64: *base64-enabled

You can also inline the definition of anchors like display-name above

#

glad I could show something new ๐Ÿ˜„

mortal hare
#

does snakeyaml support this?

tender shard
#

sure

ivory sleet
#

Believe even snake yaml supports it

#

Ye

mortal hare
#

nice!

tender shard
#

I discovered it by accident a month ago or sth

mortal hare
#

finally i can reuse some lines in locale config files

#

without copy pasting

tender shard
#

however you cannot concat strings

mortal hare
#

still that's awesome

tender shard
vivid cave
#

Hey guys i need to know:
I did check the protocol wiki but sth is still not clear:
Are SetSlot packets ONLY for player inventory?
Or can I send SetSlot packets on stuff like chest inventory, furnace, anvils, ench table inventories etc? (my goal is to show the player a fake item if it has a certain tag ofc)

mortal hare
#

I've been tinkering with packet level inventories before and i can guarantee that setslot works with all of container slots

#

it uses inventoryview slots

vivid cave
#

perfect!

#

thank you dovidas

mortal hare
#

wait

vivid cave
#

yes

mortal hare
#

if you want to set lots of items instantly there's packet for that too

vivid cave
#

ik

#

its window blabla

mortal hare
#

SetSlot is used for manual dragging, while another one is used to resync the client and server and to open containers

vivid cave
#

but its at most one or two items usually, and i treat them independently

mortal hare
#

then use setslot

vivid cave
#

ok perfect, so if someone opens a container, and i start sending a sendslot packet to a specific slot which ain't necessarily related to what he has/had in hand, it will fakely update right?

mortal hare
#

yes

vivid cave
#

ok that's what i want perfect

mortal hare
#

i mean

#

if you have it in your hand

#

the item will change in your fist

#

but it will just override everything that slot has

vivid cave
#

but what if the item is not in hand at all

mortal hare
#

but if you click it, the server will resync and it will be gone

#

then it would just override previous item

#

or add one

vivid cave
mortal hare
#

in the slot as someone put something in the chest while you have chest opened

#

packet level GUI's are great

#

i've got Proof Of Concept

#

with inventory click protection etc

#

but i never finished it sadly due to the way it requires lots of work to mimic the vanilla behaviour

#

since server doesnt know about the inventory nothing at all

#

and you need to implement your own mini server on top to handle the GUI packets

vivid cave
#

yeah i know the madness i once tried to do sth similar too, i discontinued the project

mortal hare
#

i will revisit that soon probs

#

because if its done correctly it would make your GUI's undupable even if the bug existed in the plugin's code

vivid cave
#

i actually came with a much easier solution:
on inventory click, let process the event = wait one tick (because we know that in one tick all the click actions will have triggered, views&inventories&slots updated), and at this point grab the inv and operate on it

#

it sounds really dumb

#

but it works so good

#

basically, in onInventoryClick event listener, create a BukkitTask that will run in ONE tick, not more not less, and inside that task it will grab the inventory again, and operate on it

mortal hare
#

that works if the container itself is synced but items aren't (packet level items)

#

i've made fully packet level GUI

#

with containers too

#

but inventory container synced one is much easier to do

#

since inventory container provides events what the slot is clicked if its registered

#

i think that's what i'm gonna do for now in the future

vivid cave
#

good luck with that!

mortal hare
#

maybe in the future i'll make fully packet level one

vivid cave
#

also i gotta ask, do you watch snooker or sth?

mortal hare
#

no

vivid cave
#

ah okay, i was just wondering about ur "147"

mortal hare
#

that's a different story

#

i've played snooker in 2008

#

via some client

#

on windows xp

vivid cave
#

ahhhh

mortal hare
#

and that's where my name was born ๐Ÿ˜„

vivid cave
#

makes sense xd

mortal hare
#

i don't remember how to play it anymore, i was kid back then

#

all i remember is the same color balls like in pool

vivid cave
#

haha yeah, it's 15 reds, 1 yellow, 1 green, 1 brown, 1 blue, 1 pink and one black
you pot alternatevily a red and then another color, reds give 1 point, other colors give more point, highest break is 147

#

anyway thanks for your help!

mortal hare
#

np

#

SpawnPlayer's packet - A negative Current Item crashes clients

steady warren
#

Hi guys! So if you've played the Hypixel Skyblock, you noticed that there's a 'system' that when you walk or jump into a block, it'll get you to the other mine island - taking this as an example - So I was wondering how would I do that in java using the spigot api. Sorry for my broken English...

mortal hare
#

well i haven't played hypixel skyblock but i imagine you walk on a block and it teleports you to another location, right?

vivid cave
#

i think it makes you connect to another server

steady warren
#

I just want to make that 'animation'

mortal hare
#

sorry, can't help I have no idea what kind of animation you want to achieve

steady warren
young knoll
#

It just launches the player

mortal hare
#

velocity?

steady warren
#

It doesn't just 'teleport' the player to the location, it launches you there.

young knoll
#

I believe itโ€™s just velocity

#

Might mount you on an invisible entity, donโ€™t remember

mortal hare
#

why tf does intellij suggest you using enhanced for loop instead of numeric one

steady warren
mortal hare
#

when its slower if its not the linkedlist

#

because it uses iterator

young knoll
#

Easier to understand for the reader

mortal hare
#

it decompiles very ugly

#

with iterator

#

and while loops

#

wtf is Pointer<V> function interface

#

in java 16

#

oh its

#

paperspigot function interface ๐Ÿ˜„

#

i really thought this is some new java shit ;D

tender shard
#

I think enhanced for is way better because the performance doesn't matter unless you loop over 100k things and it's more readable imho

mortal hare
#

im a C/C++ style guy

quaint mantle
#
for (int i = 0; i < list.size(); i++) {
    Element e = list.get(i);
}
for (Element e : list) {

}
mortal hare
#

i prefer to cache list.size() into variable too

#

i do

#
for (int i = 0, k = list.size(); i < k; i++) {
  Element e = list.get(i);
}
#

but some don't like it how i write it

#

since its "unreadable" for them

quaint mantle
#

the performance difference is minimal

#

and why even do it?

mortal hare
#

i abuse for loops with their conditions

#

its just seems more clear to me

#

what it does

#

for example if i just to for loop without any order in mind, or loop it backwards i do

golden turret
#

iterator ๐Ÿ˜Ž

mortal hare
#
for (int i = list.size(); --i > -1;) {
  // Code
}
#

that's evil though

#

but micro optimization

#

i saw this loop somewhere in stackoverflow

#

but stopped using it because it makes people confused

#

its apparently one of the fastest for loops you can write from arraylists and primitive arrays

#

i saw somewhere in benchmarks on stackoverflow

tender shard
#

if you need that kind of optimization, you probably have way bigger issues in the code though lol

golden turret
#
ListIterator<E> iterator = list.listIterator();
while (iterator.hasNext()) 
  iterator.next();

while (iterator.hasPrevious()) {
  E element = iterator.previous();
}``` ๐Ÿ˜Ž
wide flicker
#
list.forEach(e -> { ... });
mortal hare
#

its that my mindset is built like that

#

its a bad habit

unreal quartz
#
try {
    String str = list[0];
    // ...
} catch (ArrayIndexOutOfBoundsException ignored) { }
try {
    String str = list[1];
    // ...
} catch (ArrayIndexOutOfBoundsException ignored) { }
try {
    String str = list[2];
    // ...
} catch (ArrayIndexOutOfBoundsException ignored) { }
// ...
golden turret
#
public int getSize(List<?> list) {
  return getSize0(list, 0);
}

private int getSize0(List<?> list, int current) {
  try {
    list.get(current);
    return getSize0(list, current + 1);
  } catch (IndexOutOfBoundsException e) {
    return current;
  }
}```
quartz valve
#

how can i get needed items for a recipe?

mortal hare
#

collect it ingame

#

guys you should switch to top taskbar on windows

#

so comfortable

#

one swipe with mouse to top vs two to the bottom

chrome beacon
quartz valve
#

Interface Recipe

chrome beacon
#

There is no way then

quartz valve
#

hmm

#

or how can i get it from Material?

chrome beacon
#

You need to identify what type of recipe it is and then call the right methods for that type

tender shard
chrome beacon
quartz valve
tender shard
#

check whether the RecipeChoice is a MaterialChoice, then cast it

#

or whether it's an ExactChoice, and cast it to that then

mortal hare
#

does any of you have ideas why BukkitCommandWrapper of brigadier node implements run() method which dispatches the command but its never used anywhere since bukkit has its own command API

#

it adds the implementation to the command dispatcher

#

but its never used

#

since the command works even without brigadier

quartz valve
tender shard
#

Recipes

chrome beacon
tender shard
#

check the thread I opened

chrome beacon
#

Oof sorry for ping

paper viper
#

but then again, Stream filter does the same job most of the time

tender shard
#

Iterators can be useful to check whether another element exists

#

e.g.

StringBuilder sb = new StringBuilder();
Iterator<String> myStrings = stringlist.iterator();
while(iterator.hasNext()) {
  sb.append(iterator.getNext());
  if(iterator.hasNext()) sb.append(", ")
}
paper viper
#

well, streams can do that too lmfao

tender shard
#

might be, I didnt say it's required, just that they can be useful

paper viper
#

you just provide it

#

inside a method

#

for stream

golden turret
#

String.join(", ", list.toArray(new String[]{}))

tender shard
#

there's always 10 different ways. Everyone should just what they like

tender shard
#

then it gets more complicated

golden turret
#

stream.map

tender shard
#

as said there's always a thousand possibilities

young knoll
#

I use SQL to join my arrays

paper viper
#

Why would you want to ever use an iterator over a loop for checking items inside an array tho XD

#

thats so much work

tender shard
#

I pass my objects via ProcessBuilder to a bash script

paper viper
#

id rather not import shit xD

#

cause im lazy

tender shard
#

my IDE does the imports for me

young knoll
#

I send my objects to a foreign datacenter for processing

tender shard
#

Joining Strings as a Service

paper viper
#

Nah use unsafe

young knoll
tender shard
#

we could make so much money

paper viper
#

Make the array native

#

modify it with C

#

๐Ÿ˜Ž

golden turret
#

๐Ÿ˜Ž

tender shard
#

let's just completely get rid of java and go back to assembler

#

or machine code

paper viper
#

Yeah lets get rid of portability and compatability

#

who needs that even?

tender shard
#

ikr?

golden turret
#

just do the compatibility yourself

tender shard
#

yeah libraries suck

#

I cannot read anyway

paper viper
#

now implement for every OS

#

ez

tender shard
#

I have another idea

#

why even code something when we can just employ people who do the data processing

young knoll
#

Does it involve fire

golden turret
#

lets write code in the paper

tender shard
#

but how do I count how many people I already have when I already gave them all my abacuses?

young knoll
tender shard
#

I had to write code on paper in high school

#

but they didn't care about a forgotton semicolon or stuff like that

#

basically pseudo code was enough most of the time

golden turret
#

;-;

tender shard
#

but I didnt study it or something, it was just normal school

mortal hare
#

our IT classes be like: Do some word, excel then do whatever you wantโ„ข

acoustic pendant
#

for getting the damage that an entity has done to a player, how do i define the
Player player = ... ?

young knoll
#

In the EntityDamageByEntityEvent getEntity will be the player

acoustic pendant
#

don't understand

#

i mean

#

how can i do this?

young knoll
#

You can't

#

e.getDamage is a double

#

getDamager can be a player

acoustic pendant
#

well, i want to see the damage that a player deal to a entity

#

so "getDamager" should fine?

#

well

#

no

#

getDamager is for EntityDamageByEntityEvent

young knoll
#

Which is what you need

acoustic pendant
#

to see how much damage you did in one hit

young knoll
#

You need EntityDamageByEntityEvent

acoustic pendant
#

is the player considered an entity?

tender shard
#

event.getDamage() returns the damage.
event.getEntity() returns the entity that was damaged
event.getDamager() returns the entity that damaged the victim

tender shard
tender shard
acoustic pendant
#

great question

tender shard
acoustic pendant
#

ok, i'm silly ๐Ÿ˜„

tender shard
#

Entity -> Damageable -> LivingEntity -> HumanEntity -> Player ^^

acoustic pendant
#

ye ye, ty ๐Ÿ˜„

#

but

tender shard
#

but?

#
    @EventHandler
    public void onDamage(EntityDamageByEntityEvent event) {
        Entity victim = event.getEntity();
        double damageDealt = event.getDamage();
        Entity attacker = event.getDamager();
        
        Bukkit.broadcastMessage(attacker.getName() + " dealt " + damageDealt + " damage to " + victim);
    }
tidal hollow
#

Good afternoon, wanted to ask if anyone has any code that makes hostile creatures hit the player :cpep:

mortal hare
#

hostile creatures do hit the player?

#

they're hostile?

#

do you mean follow you?

tidal hollow
#

something like that

tender shard
#

you can force a mob to damage another entity using NMS with doHurtTarget(Entity)

#

following requires changing the pathfinder I think

young knoll
#

Or

young knoll
#

You can do .damage(entity)

mortal hare
#

there's literally setTarget()

#

in the API

young knoll
#

That as well

tender shard
#

ah nice

#

I never did any mob things

civic apex
#

i can never seem to remember which slots getRawSlot and getSlot represent

tender shard
#

getRawSlot is slot numbers for the InventoryView IIRC

civic apex
#

but where do you start

tender shard
#

while getSlot represents the slot in the inventory itself

paper viper
#

getSlot = relative to inventory itself

civic apex
#

top or bottom?

paper viper
#

getRawSlot = index based from both inventories

civic apex
#

starting on which inventory

tender shard
#

I'd just test it and then write it down for further checking ๐Ÿ˜„

paper viper
#

Yeah

tender shard
#

I think it starts on the top inventory

#

I mean

paper viper
#

forums dont have much info

#

or docs

tender shard
#

getRawSlot starts on the top inv

#

like in a furnace, the coal is slot 0 I THINK

#

either the coal or the thng you are burning

paper viper
#

it varies too

acoustic pendant
#

Is there any javadoc to get the entity that is damaged?

tender shard
#

one of those is 0

tender shard
acoustic pendant
tender shard
#

np

#

but the javadocs explain it perfectly, it's the first result on google when you google the event name

#

it only lists one method (getDamager) because the other methods are part of the super class (EntityDamageEvent)

#

EntityEvent#getEntity is the damaged entity
EntityDamageEvent#getDamage is the amount of damage
EntityDamageByEntityEvent#getDamager is the attacker