#help-development

1 messages · Page 262 of 1

tender shard
rotund ravine
#

To create a unique implementation of rayTraceBlocks that returns all the results it hits on the way to maxDistance, you can use the following approach:

  1. Create a List object to store the results of the block hits.
  2. Set the current position to the starting position, and set the current distance traveled to 0.
  3. Calculate the step increment for each axis based on the direction vector.
  4. Iterate through the blocks between the starting position and the maxDistance. In each iteration:
    1. Calculate the next block to check based on the direction vector and the step increment.
    2. Check if the block at the calculated position is solid. If it is, add it to the list of results and continue to the next iteration.
    3. If the block is not solid, increment the distance traveled by the step increment and continue to the next iteration.
  5. When the loop finishes, return the list of results.
    Here's an example implementation in Java (probably won't work):
import java.util.ArrayList;
import java.util.List;

import org.bukkit.block.Block;
import org.bukkit.util.Vector;

public class RayTracer {

    public static List<Block> rayTraceBlocks(Vector start, Vector direction, double maxDistance) {
        List<Block> hits = new ArrayList<>();

        // Calculate the step increment for each axis
        double xStep = direction.getX();
        double yStep = direction.getY();
        double zStep = direction.getZ();

        // Normalize the direction vector
        double length = Math.sqrt(xStep * xStep + yStep * yStep + zStep * zStep);
        xStep /= length;
        yStep /= length;
        zStep /= length;

        // Set the current position and distance traveled
        Vector pos = start.clone();
        double distance = 0;

        // Iterate through the blocks between the start and maxDistance
        while (distance < maxDistance) {
            // Calculate the next block to check
            int x = (int) Math.floor(pos.getX());
            int y = (int) Math.floor(pos.getY());
            int z = (int) Math.floor(pos.getZ());
            Block block = pos.getWorld().getBlockAt(x, y, z);

            // Check if the block is solid
            if (block.getType().isSolid()) {
                // Add the block to the list of hits and continue to the next iteration
                hits.add(block);
            }

            // Increment the distance traveled and the current position
            distance += Math.sqrt(xStep * xStep + yStep * yStep + zStep * zStep);
            pos.add(new Vector(xStep, yStep, zStep));
        }

        return hits;
    }

}

This implementation will return a list of all the solid blocks that the ray trace hits on the way to maxDistance.

round finch
tender shard
#

fuck google, I tried it in java and it returns 2

#

it is 2 in java

round finch
#

CB_shrug you must be right

rotund ravine
round finch
#

gei-oogle

tender shard
rotund ravine
#

it's correct

karmic grove
round finch
#

wtf

#

why math!

tender shard
round finch
#

why is there multi outcomes in math omg

#

i'm familiar but damn

tender shard
#

because both 4*4 and -4*-4 return 16

round finch
#

yeah double minus = plus

#

except on my bank account

tender shard
#

can relate

#

my bank recently started adding negative interest

#

and thaaaat sucks

round finch
#

i've negative rent

#

i owe money to my bank

tender shard
#

it sucks

round finch
#

it with interest

#

it will be fine then i get back on track

#

Christmas was so expensive

tender shard
#

lmao wtf

#

seems like I was kinda rich in september

round finch
#

oh graph

round finch
#

if i just knew about investing

river oracle
#

It's pretty much a gamble short term

round finch
#

stoink

round finch
#

lmao

river oracle
#

I think I'm down 25% all time, but it's just the way the market is heading rn

tender shard
#

damn I had over 10 million in september

round finch
#

bruh wtf

#

how you spend that much

river oracle
tender shard
#

I'm at 3 now lol

river oracle
#

Oof fall off sad

round finch
#

awh

river oracle
#

I should have taken a short position in tsla a while back they were over valued

tender shard
#

tsla?

river oracle
#

Hinesite is 20 20 tho

river oracle
tender shard
#

ah ok

river oracle
#

Crazy Twitter mans company

tender shard
#

yeah

#

fucking jerk

#

also he's ugly

river oracle
#

I took a short on tsla for my stock sim last year but for some reason I didn't with my real money should have been more confident with my play

round finch
#

it can be worse trust me

#

like twitter being sold to microsoft

river oracle
#

Atleast should have done options

tender shard
#

I once had a client who always went for stocks. I was like "how the fuck can you play with your money like that" and he answered "well sometimes you win, sometimes you lose, that's how it works" lol

remote swallow
#

oh alex, do you know if i can change the boot option list in grub, to change windows as my main boot not mint

river oracle
#

Just boot to grub menu imo it's easiest

#

That way you can choose super easily

tender shard
#

install "grub-pc" then you get a fancy GUI where you can change it

remote swallow
#

on windows or mint

tender shard
#

sudo apt-get install grub-customizer

#

on mint

river oracle
#

Isn't it default on mint?

tender shard
#

idk

river oracle
#

It is on Ubuntu

tender shard
#

then it probably is on mint too

river oracle
#

But the delay is set to 0 upon install you need to config it

#

I have a 5 second delay prior to boot

tender shard
#

WHERE IS MY BF

remote swallow
#

mines like 10 seconds before auto boot to linux

remote swallow
river oracle
#

There Is hockey's you can press between the boot of bios being over and os startup to get into grub

tender shard
#

ah yes, the hockeys

remote swallow
river oracle
tender shard
#

give him back

remote swallow
#

it does i just want to make my auto boot windows not mint

river oracle
#

Then there really isn't a point it's super trivial to switch just press down arrow an enter once

tender shard
#

you aren't gay, you have no need for my bf

#

give it back

remote swallow
#

but what if i want to press the power button and walk downstairs

river oracle
#

Grub is better than windows boot system hands down

crisp quail
#

Could I have any assistance? My code errors out and spits:

Cannot resolve method 'getRelative' in 'BlockFace'

In the lines of:

        if (block.getType() == Material.RED_BED) {
            Bed bedData = (Bed) block.getBlockData();
            Block head = bedData.getFacing().getOppositeFace().getRelative(block);
tender shard
#

no you are zacken

river oracle
#

Re: 1.8????

crisp quail
#

I'm using intelij

tender shard
#

are you using maven?

crisp quail
#

yes

round finch
#

does that mean you only s...xly attacted to hyper people? 😏

tender shard
#

which version do you have for spigot-api in your pom.xml?

round finch
#

this is just joke ofc

crisp quail
quaint mantle
#

so the loops

#

that I was doing it perfercly works it generates tihs code:

#
World pW = ((Player) p).getWorld();
                        pW.getBlockAt(((Player) p).getLocation().add(-2, 2, -1)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-2, 2, 0)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-2, 2, 1)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-2, 2, 2)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-2, 3, -1)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-2, 3, 0)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-2, 3, 1)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-2, 3, 2)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-1, 0, 0)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-1, 0, 1)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-1, 1, 0)).setType(Material.COBBLESTONE_SLAB);
                        pW.getBlockAt(((Player) p).getLocation().add(-1, 1, 1)).setType(Material.COBBLESTONE_SLAB);
                        pW.getBlockAt(((Player) p).getLocation().add(-1, 2, -1)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-1, 2, 2)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-1, 3, -1)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(-1, 3, 2)).setType(Material.STONE);
                        pW.getBlockAt(((Player) p).getLocation().add(0, 0, 0)).setType(Material.STONE);```
round finch
#

ok tell that to person then

quaint mantle
remote swallow
#

?notworking

undone axleBOT
#

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

quaint mantle
#

just put it in the code and it generates a structure

river oracle
quaint mantle
#

it copies the object it game and converts it into this code

river oracle
#

Not on my watch time machine time mother fucker

river oracle
round finch
quaint mantle
river oracle
#

What kinda loop creates more code

remote swallow
#

why does it create code

quaint mantle
round finch
#

there is simple ways to do this

remote swallow
#

okay

quaint mantle
#

just copy it in game with command and it creates a code with that you paste it into ur plugin code and voala ur structure is there

river oracle
#

That seems like a very very very very bad way to do this

#

Very very bad

remote swallow
#

^^

round finch
#

^^!

opaque scarab
#

@quaint mantle Why not iterate through a set of coordinates? That would save so many lines

river oracle
#

Because that is just god awful. Why not use config files and have more abstract code? Only reason I can think of is not understanding basic abstraction concepts

river oracle
quaint mantle
#

for example

river oracle
#

Use config files hell I'd reccomend you use .schematic files

quaint mantle
#

how would you create a house with code ?

river oracle
#

Iirc there are apis for doing that like fawe iirc

quaint mantle
#

no without apis

river oracle
#

So you hate yourself

#

Ic

#

Make your own .schematic file

#

Good luck

#

That's the best solution

#

What you are doing now is not scalable in any sense

#

You need to make your own file type and make it parseable by your plugin simply no way round that any other method just wouldn't make sense.

quaint mantle
river oracle
#

Myes you expect too much from people and have a horrible user experience being constructed

onyx fjord
#

so line per block?

remote swallow
#

seems like a great moment to tell you to learn java

river oracle
#

Basics I'm kind

#

?learnjava!

undone axleBOT
round finch
#

definitely better to have files

#

copy and pasting like 10,000 times is bad programming

quaint mantle
#

yo chill out

round finch
#

i mean in practice

#

nah it is true

#

and i'm very chill and cosy thank you

fluid river
#

Hello comrades

#

where are noobs

#

show me

echo basalt
#

🪞

fluid river
#

i asked to show noobs

round finch
#

fava

fluid river
#

not mirror emoji

remote swallow
#

jree fava lesons?

fluid river
#

yes

round finch
#

yes

#

that

echo basalt
fluid river
#

that

echo basalt
#

pointing at the noob rn

fluid river
#

maybe

remote swallow
#

that is also pointing at you

#

noob

fluid river
#

and at you

round finch
#

well that means you point to yourself too

echo basalt
#

it is not :)

opaque scarab
#

@fluid river In case you haven’t got the gist, he is saying your a noob

subtle folio
#

&data ?

fluid river
#

at all of us

echo basalt
#

I'm not perpendicular to my monitor

subtle folio
#

pointers ?

#

c?

echo basalt
#

me

#

you turtle

round finch
#

i c no pointers

fluid river
subtle folio
#

🚪

echo basalt
#

I love joe

round finch
#

mama

opaque scarab
#

@fluid river ImIllusion

fluid river
echo basalt
#

cyrei

fluid river
echo basalt
#

in case you didn't notice

fluid river
#

carefall

echo basalt
#

he trollin

#

this guy

subtle folio
#

but useless

round finch
fluid river
subtle folio
#

yus

round finch
#

click and scroll

#

to look at awful code

subtle folio
#

right right

#

garbage collection is way cooler smt

#

smh

fluid river
#

can gc collect discord emojis

#

?

#

how

subtle folio
#

-_-

round finch
#

someone better make that fava language real

subtle folio
#

gaga??

fluid river
#

i'm too lazy

echo basalt
#

if GC worked real good, @fluid river wouldn't be here

fluid river
#

like a turtle

subtle folio
#

🐢

fluid river
round finch
echo basalt
round finch
#

something is cookin

#

sea food?

fluid river
#

probably 'd have left this channel

subtle folio
#

guys my code is broken, how to fix

p.sendTurtle();

#

heap moment

#

all my homies like stack

round finch
#

is the turle even real

echo basalt
#

my code broken how do I fix

method = p.send_turtle;
method()

round finch
#

that must be the problem

subtle folio
#

malloc(deeznuts**)

echo basalt
#

python moment

fluid river
#

hey guys how do i code scdehuler which scdehules after server restart + 5 nanosex. I had been wanting to store player's inventory lore and history to hashmap of primitive ints. So when scdehuler scdehules i run -Xmx128M and pass lore as args

also where is a way to increase tickrate to 21

omg i just attended to i'm using 1.4.6. Can anybody provide me MNS guide(ya know NBT)

also why do i keep getting Unsupported class file version(52.0) error when running need for speed mine crafted

umm and in the end why doesn't it work

nigAss().get().put(1, 228);
HashMap<Integer> mep = new HashSet<String>();
player.sendMessage().mep.get(4), 4);```
it's underlined with red and i have chinese intellij from my father and i forgot how to read it
round finch
#

@OverrideDeez

echo basalt
#

I use java unsafe Chad

subtle folio
echo basalt
#

nah

round finch
#

gigachad sorry i use binary

fluid river
#
int* bruhWhat = (int*) malloc(1488*sizeof(int));```
echo basalt
subtle folio
#

is that when your mom was born

fluid river
#

nig

subtle folio
#

LOL

fluid river
round finch
#

damm time traveler i see

fluid river
#

imagine not compiling with brain

harsh totem
#

How do I force people to use this texture pack? because people can just choose to not use this texture pack in game

fluid river
#

you never tasted StackOverflow in brain

echo basalt
#

imagine tryna flex something you don't know how to do, ending up looking like a monkey and still thinking you're right

round finch
#

he?
hehe

echo basalt
#

this u

subtle folio
#

Check out this

fluid river
#

if player didn't accept then kick him

subtle folio
#

don’t do that

harsh totem
round finch
#

you wanted to know

#

now see for yourself

echo basalt
round finch
#

dont trust client

echo basalt
#

sure hacked clients can send whatever response they want

#

but you can't control that

round finch
#

*sends fake response

harsh totem
zealous scroll
#

Is there a reason we can't cancel ChunkUnloadEvent in higher versions?

subtle folio
harsh totem
zealous scroll
fluid river
round finch
#

Wait, Fava? (Always has been jree

round finch
#

beyond server itself you have no control

subtle folio
#

pray 🙏

remote swallow
round finch
#

bad pratices

#

@round finch

#

imposter @round finch

#

:)

subtle folio
#

Why can maven find my package that is clearly on github packages? this is my pom ```xml
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/tazpvp/NR-Core</url>
</repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot-api</artifactId>
        <version>1.19.2-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>world.ntdi</groupId>
        <artifactId>nrcore</artifactId>
        <version>1.0.8</version>
        <scope>provided</scope>
    </dependency>
</dependencies>```
remote swallow
#

dont you need a / at the end of urls

zealous scroll
karmic grove
remote swallow
#

most want a /

subtle folio
tardy delta
remote swallow
tardy delta
#

dont know how it works but whatever, as long as my parser does it correctly

rotund ravine
karmic grove
#

ill open thread

tardy delta
#

what is it then

karmic grove
#

Custom raytracer crashing server

tardy delta
#

tf

#

ij saying 2

#

what is this for bs

#

could be related to this

spring minnow
#

My gif plays in modifying mode but not in the page

remote swallow
#

servers are probably down

spring minnow
#

i'm using imgur

spring minnow
remote swallow
#

spigots servers

spring minnow
#

so should i just wait?

remote swallow
#

pretty much

subtle folio
spring minnow
subtle folio
#

let me check

#

nope not there ;-;

spring minnow
subtle folio
eternal night
#

provided KEKW

subtle folio
#

bc i have the jar on my server

#

what's wrong with provided?

remote swallow
#

if you are trying to shade it in dont you need compile scope

eternal night
#

I thought you want to shade the jar ?

#

yea

subtle folio
#

hmm let me test

spring minnow
subtle folio
#

yes

spring minnow
#

does it get loaded correctly?

subtle folio
#

yes

spring minnow
#

then idk xD

subtle folio
eternal night
subtle folio
#

causes errors that don't occur in other plugins that use provided

#

idk why it's breaking in this one

eternal night
#

that just seems like, wrong

#

lol

#

not class path related just

#

bad code

subtle folio
#

huh??

#

nothing wrong with my code !!11!1

eternal night
#

I mean, do you really want to shade here ?

#

or is nrcore another plugin

subtle folio
#

its another plugin

eternal night
#

then you don't want to shade

subtle folio
#

that's what i was saying ;-;

eternal night
#

why is there a shade plugin KEKW

subtle folio
#

so then why am I getting a class not found exception?

subtle folio
eternal night
#

you are depending on the other plugin ?

subtle folio
#

yes

eternal night
#

in your plugin.yml

subtle folio
#

yes

#

its the right name i promise

eternal night
#

and world.ntdi.nrcore.utils.command.CommandFunction actually exists KEKW

#

a weird package name

#

I ought to say

fresh timber
#

in a bukkit runnable, how can I check if a player is currently mining a certain block?

subtle folio
#

nrcore?

eternal night
#

no the world prefix

subtle folio
#

oh its my wbesite

eternal night
#

ah

subtle folio
#

but yes it actually exists

eternal night
#

also in the jar on the server ?

subtle folio
#

let me jdgui qr

fresh timber
#

in a bukkit runnable, how can I check if a player is currently mining a certain block?
pls I needa do this I couldnt find it anywhere 😭

subtle folio
subtle folio
#

i just restarted my server

#

and it fixed itself

rotund ravine
#

You should always restart smh

fresh timber
#

best way to fix anything lol

subtle folio
#

💀

fresh timber
#

💀

eternal night
#

😅

subtle folio
#

if it comes back ill delete the server

#

and restart the os

tardy delta
#

rd /S /Q server

subtle folio
#

sudo rm -rf /

tardy delta
#

only know the cmd commands

subtle folio
#

unicks >

orchid gazelle
#
    public List<Location> getProjectionPoints(Location bulletStart, Vector direction) {
        List<Location> projectionLocations = new ArrayList<Location>();
        double distance = 0;
        RayTraceResult RTres = bulletStart.getWorld().rayTraceBlocks(bulletStart, direction, 1000);
        distance = RTres.getHitPosition().length();
        Location targetLocation = bulletStart.add(RTres.getHitPosition());
        Location l = bulletStart;
        Vector vector = targetLocation.toVector().clone().subtract(bulletStart.toVector()).normalize().multiply(2);
        double length = 0;
        while(length < distance) {
            l.add(vector);
            projectionLocations.add(l.clone());
            length += 2;
        }
        return projectionLocations;
    }

Somehow it is not giving me any locations, any ideas?

sour tundra
#

Replace the l.clone() call with l so that the modified value of l is added to the projectionLocations list.

orchid gazelle
sour tundra
#

maybe try to printing stuff liike print out the values of l, vector, and length at the beginning of each iteration of the while loop, and verify that they are being updated correctly

tardy cedar
#

any way to check if a player is in a lush cave?

#

lush cave is a standalone biome?

#

oh nice. thanks

#

didnt know that

valid basin
#

Does anyone know a way to save player's potion effects to the potion bottle and drop it to the floor on death?

tardy cedar
#

is there a way to increase the amount of ore a mined block drops

rotund ravine
#

yes

tardy cedar
remote swallow
#

you want to change the amount a block drops?

tardy cedar
#

yeah like a coal ore block drops 5 coal instead of otherwise

remote swallow
#

block drop item event

rotund ravine
#

To double the amount of ores that an ore block drops in a Spigot plugin, you can use the setDrops method of the BlockBreakEvent class. Here's an example of how you could do this:

@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
    Block block = event.getBlock();
    if (block.getType().name().contains("_ORE")) {
        List<ItemStack> drops = event.getDrops();
        drops.add(new ItemStack(block.getType(), 1));
        event.setDrops(drops);
    }
}

This code will listen for block break events and check if the broken block is an ore block by checking if the block's type name contains the string "_ORE". If it is an ore block, it will get the current drops for the event and add another ore item to the list. Finally, it will set the modified list of drops back to the event.

This will cause the ore block to drop two ore items instead of one when it is broken. The code will work for any type of ore block, as it checks for any block type with a name that contains "_ORE".

Or for a single ore you can do this.

@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
    Block block = event.getBlock();
    if (block.getType() == Material.IRON_ORE) {
        List<ItemStack> drops = new ArrayList<>();
        drops.add(new ItemStack(Material.IRON_ORE, 2));
        event.setDrops(drops);
    }
}

This code will listen for block break events and check if the broken block is an iron ore block. If it is, it will create a list of drops containing two iron ore items and set that list as the drops for the event. This will cause the iron ore block to drop two iron ore items instead of one when it is broken.

Note that this code will only work for iron ore blocks. If you want to double the drops for other types of ore blocks, you will need to add additional conditions to check for those block types and add the appropriate item to the drops list.

tardy cedar
quaint mantle
#

can anyone please tell me how to set a multiple lined mob name? thanks (1.19.3). Should I use packets? I tried with passenger but not work

covert yacht
#

Is there a way to not make the server hang when we create a new world ? Actually when i create a new world the whole server is just frozen like if it was reloading 🤔

rotund ravine
covert yacht
#

Hmm 🤔

robust light
#

can potion effects be negative? For example strength -2?

rotund ravine
#

What you can do though is.

"
Have 2 servers, connect them via a bridge.
When server 1 (main) wants a world created it can request Server 2 to create it.
Then Server 1 copies it over async afterwards, and loads it sync.
"
Should cut down on the lag @covert yacht

covert yacht
#

Yeah why not 🤔 , and is a folder copy gonna make the server hang ? Like if i use pre generated world and copy the folder whenever i need it so i don't need to use too much ressources to generate a world 🤔

rotund ravine
#

@covert yacht the loading should make it hang a bit depending on ur hdd/ssd speed. The transfer of the world can be done async.

covert yacht
covert yacht
#

well

#

forget that

#

that will make people on server 2 lag too

rotund ravine
#

yeah

covert yacht
#

so there's no point doing that

#

good bad idea

echo basalt
#

depends actually

#

paper can load chunks async iirc

#

and SWM should allow async worlds

austere solstice
#

Hello guys. I was wondering when player click to text then how can we send directly message to player.

answer_1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, //player.sendMessage("test")));

rotund ravine
austere solstice
#

We can't do that without register command?

rotund ravine
#

You can

covert yacht
rotund ravine
#

@covert yacht Fairly certain generating new worlds still fall on sync. So it would still hang it a bit

covert yacht
austere solstice
#

I get it. Thanks both of you guys @last temple @rotund ravine

echo basalt
#

you can make it run a command with a uuid

#

and associate a task with a uuid

#

but it can very easily cause a memory leak unless you use premade tasks :)

rotund ravine
echo basalt
#

like

atomic swift
#

how do i drop an item at a specific location

rotund ravine
#

@atomic swift world.dropitem method

echo basalt
#
private final Cache<String, Runnable> cache = CacheBuilder.newBuilder().expireAfterWrite(5, TimeUnit.MINUTES).build();

public String makeCommand(Runnable runnable) {
  UUID uuid = UUID.randomUUID(); // is this the method? I don't remember.
  tasks.put(uuid.toString(), runnable); // we're using strings instead of the UUID object itself because parsing the UUID when reading commands takes longer
  return "/" + uuid;
}

@EventHandler
public void onCommand(PlayerCommandPreProcessEvent event) {
  Player player = event.getPlayer();
  String command = event.getMessage();

  if(command.startsWith("/")) {
    command = command.substring(1); // I don't remember if the message starts with "/", but it might
  }

  Runnable task = cache.asMap().get(command);
  
  if(task == null) {
    return;
  }

  cache.invalidate(command);
  task.run();
}
#

type deal

#

so like

rotund ravine
#

I mean sure, but you can do it easier.

echo basalt
#
Player player = ...;

String command = makeCommand(() -> {
  player.sendMessage("You are a gangster.");
});

setClickAction(RUN_COMMAND, command)
#

type deal

#

Shouldn't leak that bad as tasks are only kept for like 5 minutes

#

we can do one better and invalidate after the client receives 250 chat packets

#

or quits :)

midnight shore
#

how can i fix this?

charred blaze
#
        PlayerTasks.put(player.getUniqueId(), runnable.getTaskId());```
on the second line console says that it have not been scheduled yet
#

how can i fix that?

rotund ravine
#

PreLogin -> before login

rotund ravine
#

yes

charred blaze
#

i scheduled it above that line

kind hatch
#

That's more or less how you would do it.

remote swallow
#

yeah pretty much

subtle folio
#

How do I give github actions build tools !?

fading spindle
#

?docs

#

?eventlist

#

?javadocs

#

any event for a player joining the server the first time

undone axleBOT
remote swallow
#

ahem

#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

remote swallow
#

"THATS JUST SPOONFEEDING!!!!!!!!1111111"

round finch
#

ree

#

yeah it is simple

acoustic widget
#

Hello any idea on why my cursor goes in the bottom center when i'm clicking button in my custom GUI

undone axleBOT
acoustic widget
#

ok 2min

#

i'll try whitout

#

oh...

#

I need that because i want to change the title

#

Can i update inventory title ?? whitout reopening

#

i'll try whitout closing so

remote swallow
#

people were talking about that being a pr earlier

#

yeah

river oracle
acoustic widget
#

Yeah it works, but I have to remove my removePlayerInventory from my onInventoryClose event

river oracle
#

theres nothing you can do to fix that without using packets

#

or ig without closing works maybe

fresh timber
#

does player.sendBlockDamage only send it for one tick or smthin?

#

cus im trying to use it for a custom block breaking system and it is rly glitchy and disappearing and reappearing when I mine

echo basalt
#

with packets :)

#

very simple but basically you reopen the container with the same id

echo basalt
#

they time out after like 5 seconds?

#

you need to re-use the same id for each block and give fatigue so the client can't predict it

fresh timber
#

it like flickers kinda lol

echo basalt
#

for the id thing, just use the block location's hashcode

long zephyr
#

someone? :(

faint sedge
#

Hey Guys, i've tried switching to 1.19.2, so i downloaded spigot 1.19.2 and added it to my referenced library but i still can't import import org.bukkit.plugin.java.JavaPlugin;

#

Do you know why ?

echo basalt
#

how are you adding spigot to your project?

#

Are you using a version control system like Gradle or Maven?

acoustic widget
faint sedge
echo basalt
echo basalt
faint sedge
fresh timber
#

its ok it just kinda flickers

echo basalt
fresh timber
#

ah dang

echo basalt
#

add a negative mining fatigue effect

sullen marlin
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

echo basalt
#

and send the packet with the player's entity id

remote swallow
#

use gradle or maven

fresh timber
#

why do that

#

and how to do that

echo basalt
#

to make the client not predict

faint sedge
#

i absolutely have to use maven or graven if i want it to work ??

sullen marlin
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

remote swallow
#

that tells you what jar to depend on if you dont want to

sullen marlin
#

there are 3 options in that list, only 1 of which is maven/gradle

#

please read

remote swallow
#

i would highly recommend using maven or gradle though

faint sedge
#

Oh tysm i didn't understand it was for me :)

echo basalt
#

all my homies coding in bytecode

fresh timber
#

xD

remote swallow
#

i code in brainfuck

fresh timber
#

💀

#

🤯

echo basalt
#

paypal seriously using base64 strings on their URL

remote swallow
#

that reminds me

#

i was gonna make a paypal and debate on taking comissions

round finch
#

question md_5
why is spigot fork of the old bukkit api
it is 2022

echo basalt
#

it's time you start

sullen marlin
#

what does that question even mean

echo basalt
#

yo md

remote swallow
#

the one problem i have, i havent touched nms, packets or like half of spigot api yet

echo basalt
#

I heard you use the logi mx master 3

remote swallow
#

and i dont know all of java

echo basalt
sullen marlin
#

yes

echo basalt
#

I only started touching nms after 3 years

fresh timber
#

nms is so weird

sullen marlin
#

theyre nice mice, though they only last 2-3 years on average :\

round finch
#

why isn't just it own stand alone thing? just wondering

echo basalt
#

do you use any other logi products?

#

I really enjoy my mx keys

sullen marlin
#

what do you mean?

round finch
#

similar to bukkit

#

idk the history

sullen marlin
#

uh I dont think so, might get an mx keys for laptop though

round finch
#

so excuse me if i sound kinda dumb

remote swallow
#

are you asking why is spigot a fork not a standalone thing

echo basalt
#

mx keys automatic backlight so nice

echo basalt
#

for bitches like me who just walk out of their pc and let it go on standby by itself

sullen marlin
#

because its helpful to have old plugins work and not just make a new API for no reason?

round finch
#

than you EpicEbic

remote swallow
#

i wonder if i can make my computer auto hibernate if my pc is not doing stuff for an hour

round finch
#

backwards compatibility yes

echo basalt
#

keyboard uses proximity sensors to turn on the backlight when my hands are on it

#

and turns itself off once I'm not using

faint sedge
#

is it normal if it has been downloading for 10Mins ?

remote swallow
#

buildtools?

faint sedge
#

yes

remote swallow
#

yes that is normal

faint sedge
#

do u have an idea of the size of it ?

remote swallow
#

no idea on teh size

faint sedge
#

is this sentence english btw ?

remote swallow
#

yeah

faint sedge
#

kk

remote swallow
#

normally it takes 20min for me but can take longer depending on your hardware

faint sedge
#

how can I uninstall it ? Cause i'm only installing it for a test

orchid gazelle
#

hello, how do I get the EXACT Direction(As a Vector) a player is looking at with their crosshair

#

since player.getEyeLocation().getDirection()gives me weird outputs

sullen marlin
#

what is weird about it

orchid gazelle
#

well then my vector is just wrong lol

#

the direction is just wrong

#

hmmm wait maybe something else is wrong

#

I just get wrong outputs for my particles:

    public List<Location> getProjectionPoints(Location bulletStart, Vector direction) {
        List<Location> projectionLocations = new ArrayList<Location>();
        double distance = 0;
        RayTraceResult RTres = bulletStart.getWorld().rayTraceBlocks(bulletStart, direction, 1000);
        distance = RTres.getHitBlock().getLocation().distance(bulletStart);
        Location targetLocation = bulletStart.clone().add(RTres.getHitPosition());
        Location l = bulletStart;
        Vector vector = targetLocation.toVector().clone().subtract(bulletStart.toVector()).normalize().multiply(1.2);
        double length = 0;
        while(length < distance) {
            l.add(vector);
            Bukkit.getLogger().info("vecLoop: " + l.clone().getX() + ";" + l.clone().getY() + ";" + l.clone().getZ() + " | length=" + length + " | distance=" + distance + " | Vec=" + vector.getX() + ";" + vector.getY() + ";" + vector.getZ());
            projectionLocations.add(l.clone());
            length += 1.2;
        }
        return projectionLocations;
    }
#

when targetting the Block 19 -59 50, im getting the output 21 -62 50

sullen marlin
#

uh why do you keep adding the vector

#

youre trying to make a line right?

orchid gazelle
#

well yes

#

im making a bullet

sullen marlin
#

in which case you just want scalar multiplication, not vector addition

orchid gazelle
#

uhm but this kind of works

#

it just got this weird offset

round finch
#

taking math notes

orchid gazelle
#

lol

round finch
#

?iamlazy

orchid gazelle
#

ok so

#

I noticed that I it is wrong to do the multiply(1.2)

#

but I still have some offset, and the offset is not there when I look in a specific direction

#

somehow the vector is wrong

faint sedge
#

In 1.19, putting the .jar plugin in the plugins folder isn't working ?

jagged monolith
#

Wait, which jar are you putting in the plugins folder?

faint sedge
#

i'm exporting to jar from my java project and then i'm putting it into the plugins folder

jagged monolith
#

And? Do you get any errors when trying to start the server?

faint sedge
#

Nope !

jagged monolith
#

?paste the full startup log, an what's the plugin called

undone axleBOT
faint sedge
#

Oh in fact yes

#

Just found it

#

Do u know how to fix it ?

jagged monolith
#

What java version are you using

orchid gazelle
faint sedge
#

Your compiler is using a newer java than your server is running.

orchid gazelle
faint sedge
jagged monolith
faint sedge
#

Did you ask for a number ? :p

#

I've downloaded java 19

#

Java SE Development Kit 19.0.1 downloads

jagged monolith
#

Downgrade to Java 17

faint sedge
#

Do i just have to dl it and to open it ?

jagged monolith
#

Remove Java 19, Then download and install Java 17, and convert your plugin to use Java 17 and re-build it

faint sedge
river oracle
#

What version you running your server on mate

#

Do u even know???

jagged monolith
#

What does the output of java --version show

faint sedge
#

C:\Users\loual>java -version
java version "17.0.5" 2022-10-18 LTS
Java(TM) SE Runtime Environment (build 17.0.5+9-LTS-191)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.5+9-LTS-191, mixed mode, sharing)

#

I'm running 1.12.2

#

With spigot 1.12.2 as it seemed logic

river oracle
#

Iirc 1.12.2 don't run java 17

#

I'm pretty sure that's java 11

vocal cloud
#

You should be able to run it on 17. Just that you don't really want to unless it's only a plugin for you and not some pub plugin

faint sedge
#

Ok i've tried with a lot of versions on another server and it's 1.17

vocal cloud
#

Because when people DL it and run it with the recommended version of java it won't run because it was compiled with a newer version

faint sedge
#

So what version do you think is the best ?

vocal cloud
#

Whatever version is recommended

#

Assuming it's a public plugin. If it's private it doesn't matter. If it's public you'll want to enable the largest group of people to be able to use it.

fluid river
#

jearn lava

#

jree fava lessons

river oracle
#

jearn lava

round finch
#

lree fava jessons

#

fun algorithm to make

#

replacing first letter

#

with next in line's first letter

hasty obsidian
#

Does anyone know is it possible to get the variant of the axolotl while it's in the bucket?

hasty obsidian
#

thx

ancient plank
#

Axolotl bucket meta but no goat horns 😩

hasty obsidian
#

How do I getVariant because when I run if (new AxolotlBucketMeta().hasVariant()){ it returns an error

ancient plank
#

an error

hasty obsidian
#

well

ancient plank
#

that's not

#

do you know java/spigot?

hasty obsidian
#

im pretty new to it

ancient plank
#

you get an itemmeta object from an itemstack, then check if the itemmeta is an instance of axolotlbucketmeta. afterwards you cast and voila, you have your axolotlbucketmeta

hasty obsidian
#

ahhh

#

ok

torn shuttle
#

anyone know off the top of their heads if there's a way to conditionally have one css style or a different css style based on some kind of if statement without tying it in with JS?

shadow owl
#

Hey all, what JDK version do you all use for Spigot dev nowadays? I remember I ran into some issues coding plugins for the public when I was using a too-new JDK earlier

shadow owl
plush shore
#

ah there is another java update.

kind hatch
torn shuttle
#

it's fine I caved in an am just doing it via js

#

I think I might've maybe been able to do it via media queries but those don't look dynamic

#

there's maybe some other math trickery I could've done in css but nothing as easy as just adding a window resize listener

raven fern
#
defender.addPotionEffect((new PotionEffect(PotionEffectType.BLINDNESS, 60, 0, false, false, true)));
#

why does this result in blindness 2

torn shuttle
#

aw heck yeah my webapp is now ultra responsive

muted crest
#

idk why i get this error but when i tryed to compare type with string to know if item is Pickaxe or other the game return false everytime :/

public Boolean isType(ItemStack item, Tool type)
    {
        String it = item.getType().toString();
        System.out.println("Item: "+item.getType()+" Tool: "+type);
        switch(type)
        {
            case ARMOR:
                System.out.println(it.contains("Helmet"));
                return (it.contains("Helmet") || it.contains("Chestplate") || it.contains("Boot") || it.contains("Legging"));
            case ALL:
                return (item.getType() == Material.BOW || it.contains("Sword") || it.contains("Axe") || it.contains("hoe") || it.contains("shovel"));
            case SWORD:
                return (it.contains("Sword"));
            case TOOLS:
                return (it.contains("Axe") || it.contains("Hoe") || it.contains("Shovel"));
            case PICKAXE:
                return (item.getType().toString().contains("Pickaxe") || (item.hasItemMeta() && item.getItemMeta().getDisplayName().contains("Hammer")));
            case HOE:
                return (item.getType().toString().contains("Hoe"));
        default:
            return false;
        }
    }```
delicate lynx
muted crest
#
public Boolean isType(ItemStack item, Tool type)
    {
        String it = item.getType().toString().toLowerCase();
        
        switch(type)
        {
            case ARMOR:
                return (it.contains("Helmet") || it.contains("Chestplate") || it.contains("Boot") || it.contains("Legging"));
            case ALL:
                return (item.getType() == Material.BOW || it.contains("Sword") || it.contains("Axe") || it.contains("hoe") || it.contains("shovel"));
            case SWORD:
                return (it.contains("Sword"));
            case TOOLS:
                return (it.contains("Axe") || it.contains("Hoe") || it.contains("Shovel"));
            case PICKAXE:
                return (item.getType().toString().contains("Pickaxe") || (item.hasItemMeta() && item.getItemMeta().getDisplayName().contains("Hammer")));
            case HOE:
                return (item.getType().toString().contains("Hoe"));
        default:
            return false;
        }
    }```
delicate lynx
#

again, it's case sensitive

#

you're making it lowercase but checking if it contains with a capital letter

#

diamond_helmet does not contain "Helmet"

#

change them to lowercase

muted crest
#

Ow my bad thnx for ur help bro

#

I'm having another error with checking Material

System.out.println(mat+" "+it.getType());
                                System.out.println(it.getType().equals(mat));
                                if(!(it.getType().equals(mat) && mat.equals(Material.AIR))) { 
                                    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.RED+"Cannot store that item !"));
                                    return; 
                                }```
drowsy helm
#

why not avoid this whole mess and use pdc

muted crest
#

Im not on the same problem

#

Now im storing item into an Inventory but i want to have only the same item (except when menu is empty)

#

its not really an inventory so i cant check if the slot is empty

drowsy helm
#

not really an inventory?

#

and whats wrong with tha screenshot? i cant see anything

muted crest
drowsy helm
#

interesting

karmic grove
drowsy helm
#

you can create an entity before you spawn it

karmic grove
#

o

#

do you have docs for this or somthing i cant firegure it out wothout spawning it

sullen marlin
#

Consumer third argument

#

?jd-s

undone axleBOT
charred blaze
#
        PlayerTasks.put(player.getUniqueId(), runnable.getTaskId());``` It says that task have not been scheduled yet (errors on second line) but it's scheduled on the first line as you see
#

how can i fix it?

sullen marlin
#

If runnable is a bukkitrunnable you should be calling runnable.schedule

#

There should even be a deprecation warning you

near night
#
@Override
    public HashMap<Location, Integer> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        // Create a new HashMap
        HashMap<Location, Integer> map = new HashMap<>();
        // Cast the JsonElement to a JsonObject
        JsonObject object = json.getAsJsonObject();
        // Loop through the JsonObject and add the values to the HashMap
        for (Map.Entry<String, JsonElement> entry : object.entrySet()) {
            map.put(Location.deserialize(entry.getKey()), entry.getValue().getAsInt());
        }
        // Return the HashMap
        return map;
    }``` this is giving me Required type: Map<java.lang.String, java.lang.Object> Provided: String (as expected) but i cant think of any other way to do it
charred blaze
kindred valley
#

?

charred blaze
#

what am i doing wrong?

drowsy helm
#

use the scheduler

#

not the runnable

sullen marlin
#

No if it's a bukkitrunnable you have to use the runnable

#

?jd-s

charred blaze
undone axleBOT
sullen marlin
#

runTaskxxxx

charred blaze
#

runTaskTimer(Plugin plugin, long delay, long period)

#

you mean this one? ^

sullen marlin
#

Whichever is applicable for your situation

charred blaze
#

ok

charred blaze
#

uh

#

i get it

#

nvm

humble tulip
#

md_5

topaz cape
#

am i the only one with that one problem where ProtocolLib never worked for me on maven

#

at least never without it being on a system scope

#

it just shows it's working on Intellij there is no errors but it's not even in my .m2 folder

#

if there's anybody else with that problem just lmk that I'm not lonely 😭

drowsy helm
#

show your pom

hybrid umbra
#

is there any way to load a plugin from an outputstream?

#

like a jar output stream

orchid gazelle
tardy delta
quiet ice
quiet ice
#

Unless you want to do some truely dark magic java needs an URL somewhere at the very least

hybrid umbra
quiet ice
#

I guess you could do in-memory URLs but I recall that being not super fun

hybrid umbra
quiet ice
hushed pawn
#

How to find nearest block witch is not air under the sertain location?

quiet ice
#

For older versions of spigot it might even be easier to instantiate a https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java (through reflection hackery) with a dummy URL as it's path and doing the actual classloading through the parent classloader (which you c an easily do by overriding Classloader#findClass to return a bytearray defined in a map)

It could be possible for newer versions too, but I am not aware how well it would work

hushed pawn
quiet ice
#

If you want to keep your temporary jar as small as possible you could use my UnsafeValues hack in order to inflate the 0-length entries within the jar to their proper size

quiet ice
#

How that is actually done in a 3D world I cannot tell unless you want your plugin to be GPL

hybrid umbra
quiet ice
#

The issue is that JavaPlugin#getProvidingPlugin would break no matter what you do

quiet ice
#

It expects the classloader of the class to be a PluginClassLoader

hybrid umbra
#

hmm, will i even need that?

quiet ice
#

no idea, but protolib might

hybrid umbra
#

ah

rotund ravine
echo granite
#

Can I squash 2 git commits if one of them came from a merged branch? I've been working on a feature branch and I was forced to merge another branch into it, and now I cannot squash my commits... (I use gitkraken)
The bottom commit is from dependabot:

quiet ice
#

Are those two commits the last two commits?

glossy venture
#

how do you invert an int again

#

like binary invert

tardy delta
glossy venture
#

oh wait isnt it -

tardy delta
#

lol

glossy venture
#

no but i need it to invert the bits

tardy delta
#

~i?

glossy venture
#

oh yeah

#

thanks

tardy delta
#

me thinking that constructor call was the overhead but no

#

love it how the results are not equal \🤔

glossy venture
#

why does this one flag include like 70% of the lore

#

they had 32 bits to work with

rotund ravine
tardy delta
#

in that method it is

rotund ravine
#

It’s not deprecated yeah. Cause he just needs to call it differently.

topaz cape
#

and i can't use a single class

#

because there's no jat file to use

quiet ice
#

Then it doesn't find ProtoLib

topaz cape
#

jar*

#

it just thinks the dependency is there

#

and it doesn't get downloaded at all

quiet ice
#

Flush caches, hit the IDE with a hammer and so on

topaz cape
#

i tried both

#

i even restarted my pc

#

nothing really helpful

#

as if ProtocolLib is just my inner conscious being mad at me for the people i killed in Valorant and Minecraft

#

i haven't killed a single person in these games in a while

#

there was a grace period. i want more of that.

quiet ice
#

I am a complete IJ noob, but could you show the screen that looks roughly equivalent to this (with the protocollib jar extanded)?

#

Do note that this is eclipse, IJ will look vastly different

remote swallow
#

yes

#

look in external libs

#

it shows all libraries and you can look inside of them

topaz cape
#

it's not in there

#

lol

#

neither in maven dependency list of IJ

remote swallow
#

ill get a ss

#

one min

quiet ice
#

then it did not find it

#

Could you show your POM?

topaz cape
#

the funny thing is if i misspell ProtocolLib it shows an error

#

so it's sure it's ProtocolLib

#

and sure

#

1s

quiet ice
#

chances are either the scope is wrong or the classifier or type is the wrong one or you have set it in the dependency management block by accident

remote swallow
fierce whale
#

Is there a way to set inventory title to text componet?

topaz cape
twin venture
#

hi , what does this error mean : ?

#

co.aikar.commands.UnresolvedDependencyException: Could not find a registered instance

quiet ice
twin venture
#

ok i figured it out thanks

quiet ice
#

I guess you'd need to try force a refresh of the maven build (perhaps a full reload)

#

But again, I have no experience with IJ maven, so I cannot tell

twin venture
red sedge
#

how do i make the player damage an entity

#

i tried player#attack but it seems that the entity needs to be in range for that to work

fair zealot
#

hey, i want the use the vault api in my plugin to hook chat/economy. but both do not work. in the server the plugins (pex and craftconomy) are there and get recognized by vault, but my plugin does not hook into them

Here is my Vault method

    public void hookVault() {
        Plugin vault = this.getServer().getPluginManager().getPlugin("Vault");
        if (vault != null) {
            RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(Economy.class);
            if (economyProvider != null) {
                economySystem = economyProvider.getProvider();
                System.out.println("[Hook] Vault: Hooked with economy system");
            }
            RegisteredServiceProvider<Chat> chatProvider = getServer().getServicesManager().getRegistration(Chat.class);
            if(chatProvider != null) {
                chatSystem = chatProvider.getProvider();
                System.out.println("[Hook] Vault: Hooked with chat system");
            }
        }

    }

Here is the console output:

[13:43:51] [Server thread/INFO]: [Vault] [Permission] PermissionsEx found: Waiting
[13:43:51] [Server thread/INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
[13:43:51] [Server thread/INFO]: [Vault] [Chat] PermissionsEx found: Waiting
[13:43:51] [Server thread/INFO]: [Vault] Enabled Version 1.7.3-b131
[13:43:51] [Server thread/INFO]: [PermissionsEx] Enabling PermissionsEx v1.23.4
[13:43:51] [Server thread/INFO]: [PermissionsEx] Initializing file backend
[13:43:51] [Server thread/INFO]: [PermissionsEx] Permissions file successfully reloaded
[13:43:51] [Server thread/INFO]: [Vault][Permission] PermissionsEx hooked.
[13:43:51] [Server thread/INFO]: [Vault] [Vault][Chat] PermissionsEx_Chat hooked.
[13:43:51] [Server thread/INFO]: [Craftconomy3] Enabling Craftconomy3 v3.3.1-d99cf63-trv200
[13:43:51] [Server thread/INFO]: [Craftconomy3] Starting up!
[13:43:51] [Server thread/INFO]: [Craftconomy3] Loading the Configuration
[13:43:51] [Thread-83/WARN]: [PermissionsEx] The updater could not find any files for the project id 31279
[13:43:51] [Server thread/INFO]: [Craftconomy3] Loading listeners.
[13:43:51] [Server thread/INFO]: [Craftconomy3] Loading commands
[13:43:51] [Server thread/WARN]: [Craftconomy3] Loading Craftconomy in setup mode. Please type /ccsetup to start the setup.
[13:43:51] [Server thread/INFO]: [Vault] [Economy] Craftconomy3 hooked.

I got vault api with maven. here is the repo:

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>spigot-vault-api</id>
            <url>https://ci.ender.zone/plugin/repository/everything/</url>
        </repository>
    </repositories>


    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.18.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.milkbowl.vault</groupId>
            <artifactId>VaultAPI</artifactId>
            <version>1.7</version>
        </dependency>
    </dependencies>
worn tundra
#

Means the vault is perhaps somehow null?

#

Try doing some debug printing on nullability of

        Plugin vault = this.getServer().getPluginManager().getPlugin("Vault");
tardy delta
#

depending or softdepending on vault?

glossy venture
#

bruh why am i getting this stupid cryptic ahh error

* What went wrong:
A problem occurred evaluating script.
> No signature of method: module_1tvwuz28hz5f7m96ddjq2c1al.tasks() is applicable for argument types: (module_1tvwuz28hz5f7m96ddjq2c1al$_run_closure4) values: [module_1tvwuz28hz5f7m96ddjq2c1al$_run_closure4@25bc18b4]
  Possible solutions: hasMc(), tap(groovy.lang.Closure), wait(), any(), wait(long), files([Ljava.lang.Object;)
tasks { /* <- it says error is here */

    assemble {
        dependsOn(shadowJar) }

    if (hasMc()) {
        assemble { dependsOn(shadowJar, reobfJar) }
    }

    compileJava {
        options.encoding = 'UTF-8'
        options.release.set(17) }
    javadoc {
        options.encoding = 'UTF-8' }
    processResources {
        filteringCharset = 'UTF-8' }

    reobfJar {
        String mcS = hasMc() ? "+" + project.versionMC : "";
        String fn = project.name + "-" + project.version + mcS + ".jar";
        outputFile(new File("../builds/", fn));
    }

}
quiet ice
#

is there anything outside the tasks thing?

tardy delta
#

i feel the same pain as when i get a c++ linking error

quiet ice
#

I am pretty sure that everything would work if you ditch tasks and put it's contents a layer down

quiet ice
#

At least I never recall configuring such an object

orchid gazelle
#

ok so I know this is a really weird question and more like gameplay-experience orientated. With the following code, I am shooting at a block from a player-perspective. The bulletStart is the location of the right hand. This means that the target is getting hit like too much down-right, which means if you shoot a player you may miss even if you aim correctly(See example screenshot):```java
public List<Location> getProjectionPoints(Location bulletStart, Vector direction) {
List<Location> projectionLocations = new ArrayList<Location>();
double distance = 0;
RayTraceResult RTres = bulletStart.getWorld().rayTraceBlocks(bulletStart, direction, 1000);
if(RTres == null || RTres.getHitBlock() == null && RTres.getHitEntity() == null) {
distance = 1000;
} else {
distance = RTres.getHitPosition().distance(bulletStart.toVector());
}
Location l = bulletStart;
Vector vector = direction.clone();
double length = 0;
while(length < distance) {
l.add(vector);
projectionLocations.add(l.clone());
length += 1.05;
}
return projectionLocations;
}

**_Now my Question is, how do I make it so that the bullet hits the EXACT location on the target?_**
quiet ice
#

Or whatever this cursery is called

echo basalt
orchid gazelle
acoustic widget
#

How can i use debug without being disconnect with intelij ? If I'm too long my server is disconnected :
Disconnected from the target VM, address: '127.0.0.1:51389', transport: 'socket'

quiet ice
#

it is possible that you are experiencing rounding issues?

orchid gazelle
echo basalt
#

I already gave you my gun code

#

idk what's so complex about it

quiet ice
#

Uh, floating-point issues

echo basalt
#

just use raytrace, if the result is null, render a line with the range of like 60

#

if not, render a line between start and end pos

#

you gotta start splitting methods a bit

quiet ice
#

That rendering process does not seem to work correctly

echo basalt
#

Raytrace -> renderPoints(result) -> do shit with the same result

#

instead of calculating a result in the renderPoints method itself

quiet ice
#

They do not use that though

fair zealot
orchid gazelle
rotund ravine
#

@fair zealot What the name of ur plugin, show us your main class.
Your plugin.yml

quiet ice
#

I don't see where it does not work though

orchid gazelle
#

and your guns do not include the thing I am doing here

fair zealot
# rotund ravine <@274888734095441921> What the name of ur plugin, show us your main class. Your ...

Here is my main class

package de.ahmet.knockbackffa;

import de.ahmet.knockbackffa.commands.setup.SetupCommand;
import de.ahmet.knockbackffa.configuration.LocationConfiguration;
import de.ahmet.knockbackffa.configuration.MessageConfiguration;
import de.ahmet.knockbackffa.configuration.PluginConfiguration;
import de.ahmet.knockbackffa.database.MySQL;
import de.ahmet.knockbackffa.listener.ServerDefaultListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import org.bukkit.plugin.RegisteredServiceProvider;
import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.economy.Economy;

public final class KnockbackFFA extends JavaPlugin {

    public static String pluginVersion;

    // configuration
    public PluginConfiguration config;
    public MessageConfiguration messages;
    public LocationConfiguration locations;

    // database


    // api
    private Economy economySystem;
    private Chat chatSystem;

    @Override
    public void onEnable() {
        pluginVersion = getDescription().getVersion();

        loadConfig();
        loadSetupCommands();

        if(isReady()) {
            loadDatabase();
            loadCommands();
            hookVault();
            loadListener();
            getServer().getConsoleSender().sendMessage(config.getPrefix() + "§cThe game is ready");
        } else {
            getServer().getConsoleSender().sendMessage(config.getPrefix() + "§cThe game is not ready yet§8. §7Use §e/setup §7to set everything up");
        }

    }




    // loader section
    public void loadSetupCommands() {
        getCommand("setup").setExecutor(new SetupCommand(this));
        getCommand("setup").setTabCompleter(new SetupCommand(this));
    }

    public void loadCommands() {

    }

    public void loadListener() {
        PluginManager pluginManager = getServer().getPluginManager();

        pluginManager.registerEvents(new ServerDefaultListener(this), this);
    }

    public void loadConfig() {
        this.config = new PluginConfiguration(this);
        this.messages = new MessageConfiguration(this);
        this.locations = new LocationConfiguration();
    }

    public void loadDatabase() {
        if(config.isSqlEnabled()) {
            MySQL mySQL = new MySQL(this, config.getSQLHostname(), config.getSqlPort(), config.getSqlDatabase(), config.getSqlUser(), config.getSqlPassword());
            if(mySQL.getConnection() == null) {
                System.out.println("[KnockbackFFA] Disable MySQL and reload.");
            }
        }
    }

    public void hookVault() {
        Plugin vault = this.getServer().getPluginManager().getPlugin("Vault");
        if (vault != null) {
            RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(Economy.class);
            if (economyProvider != null) {
                economySystem = economyProvider.getProvider();
                System.out.println("[KnockbackFFA] Vault: Hooked with economy system");
            }
            RegisteredServiceProvider<Chat> chatProvider = getServer().getServicesManager().getRegistration(Chat.class);
            if(chatProvider != null) {
                chatSystem = chatProvider.getProvider();
                System.out.println("[KnockbackFFA] Vault: Hooked with chat system");
            }
        }

    }

    // method section

    public boolean isReady() {
        return locations.ready();
    }

    public void reload() {
        getServer().reload();
    }


    // getter section

    public Economy getEconomySystem() {
        return economySystem;
    }

    public Chat getChatSystem() {
        return chatSystem;
    }
}

echo basalt
#

What are you trying to do, that I am not?

quiet ice
echo basalt
#

raytrace blocks instead of blocks & entities?

quiet ice
#

It's very very frustrating that that is the case -.-

fair zealot
#

the isReady() method is true btw.

rotund ravine
#

Your @fair zealot plugin.yml?

fair zealot
#
name: KnockbackFFA
version: '${project.version}'
main: de.ahmet.knockbackffa.KnockbackFFA
api-version: 1.13
prefix: KnockbackFFA
softdepend: [ Vault ]
authors: [ ahmet ]
description: a knockback ffa remaster 

commands:
  setup:
    description: A KnockbackFFA provided command
  stats:
    description: A KnockbackFFA provided command
orchid gazelle
echo basalt
#

okay, just change the eyeLocation variable to the right hand location

quiet ice
#

I almost want to write a bot that replies "Yo, stop using the Bukkit registry" whenever it encounters RegisteredServiceProvider<Economy>

fair zealot
#

xD

quiet ice
#

Because that - whether you know it or not - is a bug waiting to happen

echo basalt
rotund ravine
#

@fair zealot I am guessing like geol said, whilst vault is indeed loaded. Your economy provider has not provided itself yet, and you can't hook into it yet.

rotund ravine
#

The most simple and dirty solution is just to register a taskscheduler that runs the code.

fair zealot
#

ooooh now i start to understand

orchid gazelle
# echo basalt rest works

tbh I did not use your code, just informed about some raytracing this and that, bukkit forums and then wrote the method myself

fair zealot
#

thank you very much ill try it now

orchid gazelle
#

so rest works is obvious

quiet ice
echo basalt
#

You're doing some weird wacky stuff with your code like doing raycasts on the render method

rotund ravine
quiet ice
#

ServerRegisterEvent is the way to do it

#

No other ways work without issues

echo basalt
#

Make a method that:

  • Does the raycasting
  • Renders the particles, based on the raycasting
  • uses the hit position to do damage / whatever
#

basically a shoot() method

orchid gazelle
fair zealot
orchid gazelle
#

im passing java handLoc, player.getEyeLocation().getDirection()btw.

echo basalt
quiet ice
#

whatever

quiet ice
#

You need to shoot from the eyes, not hand

orchid gazelle
#

shooting from eyes looks ugly imo

tardy delta
echo basalt
quiet ice
#

Then gl aligning the crosshair

orchid gazelle
tardy delta
#

ah its a flamethrower

quiet ice
#

You can't use the eye direction vector

#

That is for use

orchid gazelle
#

and what do I use then?

quiet ice
#

The hand direction vector

orchid gazelle
#

it always has about the same angle, no matter where I look

quiet ice
#

Really?

orchid gazelle
#

which is obvious

#

wait maybe I have an idea

quiet ice
#

Well I basically mean computing the vector between hand and the target

orchid gazelle
#

do I pass the yaw/pitch to the handLoc?

fair zealot
# quiet ice Yeah
    public void onServiceRegister(ServiceRegisterEvent event) {
        if(event.getProvider().getService().equals(Chat.class)) {
            chatSystem = 
        }

I have no idea from now on xD, chatSystem is RegisteredServiceProvider<Chat>

quiet ice
#

not truely

orchid gazelle
quiet ice
#

event.getProvider().getService() instanceof Chat

fair zealot
quiet ice
#

You just continuously add the vector of your hand onto it

orchid gazelle
#

in the method, bulletStart is the location of the hand

undone axleBOT
orchid gazelle
#

the direction is my eye-vector where im looking

echo basalt
#
public void shoot(Player player, Location handLocation) {
  Vector direction = handLocation.getDirection();
  World world = player.getWorld();
  double range = 100;

  RaytraceResult result = ...

  if(result == null) {
    renderLine(handLocation, handLocation.clone().add(direction.clone().normalize().multiply(range)));
    return;
  }

  Vector hitPosition = result.getHitPosition();
  renderLine(handLocation, hitPosition.toLocation(world));

  // do damage
}

public void renderLine(Location start, Location finish) {
  Vector offset = finish.toVector().subtract(start.toVector());
  double density = 0.3;
  double distance = start.distance(finish);

  offset = offset.normalize().multiply(density);

  Location current = start.clone();

  List<Location> positions = new ArrayList<>();
  for(double position = 0; position <= distance; position += distance) {
    current.add(offset);
    positions.add(current.clone());
  }
  
  // pass positions to your renderer / queue
}
quiet ice
quiet ice
tardy bane
#

I would like to get the tps of all plots, query whether they have reached a limit and, if a plot has reached the limit, the redstone should be deactivated or the RandomTickSpeed should be lowered. (Only for the respective plot)

quiet ice
#

  Vector offset = finish.toVector().subtract(start.toVector());
  double density = 0.3;
  double distance = start.distance(finish);

  offset = offset.normalize().multiply(density);

would be the vector you need according to @echo basalt ' code

echo basalt
#

that just renders a line between 2 points

#

but sure whatev

quiet ice
echo basalt
#

ye

fair zealot
#

to set the provicer

quiet ice
#

Yep

fair zealot
#

thanks!

quiet ice
#

Although ...

#

I'd do it in the event only

echo basalt
#

the vector that you need to add to start, 1/density*start times to get to finish

quiet ice
#

Perhaps do it once too in the onEnable block, but outside of that, no

orchid gazelle
# quiet ice Yep

when I replace the vector of the direction with the full vector of start to end, wouldn't my whole code after break?

#

or does it not because I normalize it?

quiet ice
#

Yep.

echo basalt
#

you clone and normalize it

#

even made my own algorithm

orchid gazelle
#

and for raytracing, I still use the direction of the eye?

echo basalt
#

nope

orchid gazelle
#

and then render the line with the vector between these 2

echo basalt
#

you use the direction of the hand

orchid gazelle
#

which is scuffed as hell isn't it

echo basalt
#

a bit

#

you'll need to do some correction

orchid gazelle
#

"a bit" for me was literally the opposite direction not mattering on any positions or rotations at all

echo basalt
#

uhh

#

how tf do you calculate it

orchid gazelle
#

^lol

#

the hand?

echo basalt
#

ye

orchid gazelle
#
            double yawRightHandDirection = Math.toRadians(-1 * player.getEyeLocation().getYaw() - 45);
            double x = 0.5 * Math.sin(yawRightHandDirection) + player.getLocation().getX();
            double y = player.getLocation().getY() + 1.45;
            double z = 0.5 * Math.cos(yawRightHandDirection) + player.getLocation().getZ();
            Location handLoc = new Location(player.getWorld(), x, y, z);
quiet ice
#

Locations don't encode rotation

#

They are points, not vectors

orchid gazelle
#

yeah so thats why it is scuffed

echo basalt
#

imo it should just be like

Vector offset = new Vector(0.2, -0.35, 0).rotateAroundY(Math.toRadians(yaw - 45);
Location handLocation = eyeLocation.clone().add(offset);

// correct yaw and pitch
float yawOffset = 5f; // mess with these nums
float pitchOffset = -3f;

handLocation.setYaw(handLocation.getYaw() - yawOffset);
handLocation.setPitch(handLocation.getPitch() - pitchOffset);
#

then you just mess with the numbers a bit

lusty stream
#

guys how does the durability of items work, iam trying to make it run something when a tool or armor reaches 10 points but it triggers it when the durability is like still full anyways

@EventHandler
    public void onItemDamage(PlayerItemDamageEvent event) {
        Player player = event.getPlayer();
        ItemStack item = event.getItem();

        if (item.getDurability() > 10) {
            return;
        }```
orchid gazelle
fair zealot
# quiet ice I'd do it in the event only
    public void hookVault() {
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onServiceRegister(ServiceRegisterEvent event) {
        if(!config.isVaultEnabled()) {
            return;
        }

        Plugin vault = this.getServer().getPluginManager().getPlugin("Vault");
        if (vault == null) {
            return;
        }

        if(event.getProvider().getService().equals(Chat.class)) {
            chatSystem = getServer().getServicesManager().getRegistration(Chat.class).getProvider();
            System.out.println("[KnockbackFFA] VaultHook: Hooked with chat system");
        }

        if(event.getProvider().getService().equals(Economy.class)) {
            economySystem = getServer().getServicesManager().getRegistration(Economy.class).getProvider();
            System.out.println("[KnockbackFFA] VaultHook: Hooked with economy system");
        }
    }```

I have done it like this now, but it does not register the events.

The event is not even run
echo basalt
orchid gazelle
#

ohhh nvm I didn't see that

#

imma try rq and see

echo basalt
#

add a bit of Z as well

#

like 0.2

#

because the hand is a bit ahead

#

you might need to permutate X and Z

orchid gazelle
#

can you explain what the "offset" is in your code pls?

echo basalt
#

just mess with the values a bit and you'll get there

lusty stream
#

🥺

echo basalt
#

offset is like

#

the hand position relative to the eye location crosshair

orchid gazelle
#

ah ok

#

so for Yaw, I use the eye location right?

echo basalt
#

basically this

orchid gazelle
#

ok imma try

twin venture
#

Hello , so for some reason i dont get the item ...
java.lang.IllegalArgumentException: Cannot copy null stack