#development

1 messages · Page 27 of 1

lyric gyro
#

your comment however was not

tired olive
#

how would u know

lyric gyro
#

I think I know what I consider my own time worth

tired olive
#

u maek no sense

lyric gyro
#

it's my own time

#

it makes total sense

#

I am the one to decide if I find my own time I myself spent on doing something worth it or not

bitter basin
#

why are you even testing code, if your not 1 shot writing ur code with perfection, then you shouldn't be a programmer

dark garnet
#

alr so what do i do?

tired olive
#

what ur doing is fine

dark garnet
#

but it doesnt work :/

tired olive
#

why not

dark garnet
#

shadowJar doesnt generate javadoc or test file

tired olive
#

move the test plugin out of the src/tests directory

#

thats usually for automated tests

#

make a test plugin module

dark garnet
tired olive
#

put the plugin in there

dark garnet
tired olive
#

good job

dark garnet
tired olive
#

code it like a normal plugin

sharp hemlock
#

The worlds smallest violin

#

🎻

dark garnet
#

still need help Sadge

dusky harness
#

it won't automatically add the stuff in test-plugin to the jar

#

why not just add like a test command instead?

#

idk how your test-plugin works

#

but if it was using mockbukkit it'd be in tests

dark garnet
dusky harness
#

but why not combine it all into one?

dark garnet
#

wdym?

dusky harness
#

and have like a config option or constant for test

#

what do you have in test-plugin?

dark garnet
dusky harness
#

tbh I'd just make a command that tests the api

dark garnet
#

i want a file to be compiled

#

so i can run it on an actual server environment

dusky harness
#

I mean like why not combine it into the main module

dark garnet
#

cause then the api would include the test plugin which is unnecessary, cause no ones ever gonna use it

dusky harness
#

make another module

#

multi module gradle project

dark garnet
#

isnt that what i did?

dusky harness
#

ig that's the only way to do it

#

no

#

that's a source set (?)

dark garnet
#

ok how do i make another module

dusky harness
#

okkk ill leave this part to someone else

#

🙃

dark garnet
#

but i still need to find a way to have gradle shadowJar also generate javadocs jar (doesnt have to be uber)

tired olive
#

here

dark garnet
# tired olive here

Task 'javadocJar' not found in project ':AnnoyingAPI'. Some candidates are: 'javadoc'.

tired olive
dark garnet
tired olive
#

try

java {
    withJavadocJar()
}
dark garnet
#

o wait that made the gradle shadowJar javadocJar command work nice

#

ok last issue i think
so rn in the main build.gradle.kts, i have this:

plugins {
    java
    id("com.github.johnrengelman.shadow") version "7.1.2" apply false
}```however, since `java` is there, when i run `gradle build` in the root directory of the entire project, it generates an empty jar file in `build/libs` (as well as the `build` folder in general). how can i prevent it from generating the `build` folder when running `gradle build`?
lyric gyro
#

uh the proper solution is to not have the java plugin there

#

idk about the whole build folder but you can stop it from creating a jar with tasks { jar { isEnabled = false } } or something similar, i don't remember the exact field name

dark garnet
lyric gyro
#

well you see, no

#

gradle is more versatile than you'd think

dark garnet
lyric gyro
#

well yeah it's not "just remove it"

#

it's a tad more "complex" if you have a simple setup

dark garnet
tired olive
#

you could just run the test task nvm

#

its the exact same as build but doesnt run the jar task

dark garnet
upbeat shuttle
#

can someone help me to build a jar file for my plugin?

#

i think my issue is with the pom.xml file

bright pier
#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

bright pier
#

Paste the build file then

upbeat shuttle
bright pier
#

Huh? I said build file, since you said that's the one with the issue

upbeat shuttle
#

you mean the .xml file?

#

im new to this whole thing how do i get the build file?

bright pier
#

The pom.xml

#

What makes you think something is wrong with it

upbeat shuttle
#

because build artifacts button is greyed out which i think i need to do that to have it build the jar file

#

i tried building project and i think it does that succesfully

#

Executing pre-compile tasks...
Running 'before' tasks
Checking sources
Copying resources... [ChatPoll]
Running 'after' tasks
Finished, saving caches…
Executing post-compile tasks...
Finished, saving caches…

#

the second file i pasted is the pom.xml

#

hmm now i am getting this error "Unresolved dependency: 'net.md-5:bungeecord-chat🫙1.16-R0.4-deprecated+build.6'"

upbeat shuttle
#

hmm i got it to compile and it loads my plugin in game but the command /poll doesnt work

sharp cove
#

Someone that has experience with Laravel?

#
    public function storeCSV(Request $request){
        $request->validate(rules: [
            'file' => 'required|mimes:csv'
        ]);```
#

Because why doesn't this validation work? The mimes dont work

#

Please @ me

wary dust
#

Hey, anyone know how to pull an image from an API using C#

#

I'm struggling with it

spiral prairie
#

what kind of api?

wary dust
#

im capping nvm

marble nimbus
#

is there a better way to communicate between bungeecord/waterfall and paper except plugin messaging? just wondering

patent zephyr
#

Hi, I'm trying to work with configs, but when I restart the server the config resets. Does anyone know how to solve this issue?

#

and the config setup func:

forest jay
#

I have a layout setup, with a number of plots, and they are assorted sizes. In between the plots, I want paths. I only want paths when the plots are occupied, so they need to be custom. I can get a schematic, but I dont want a hundred different schematics for each use case. Is there anyway to take a long path schematic and crop/cut off the part that I dont need?

forest jay
#

nevermind, I might have lost it.

dusky harness
#

RadioScanner

#

iirc

dense drift
#

Yeah, sockets are nice

leaden sinew
dark garnet
#

hi, for some reason gradle is adding an old classpath to my jar file

#

xyz.srnyx.testplugin, i renamed it to xyz.srnyx.annoyingexample, the testplugin one doesnt even exist anywhere

#

ok i fixed by removing build/classes/java/main/xyz/srnyx/testplugin

split rivet
#

hi

#

one question about deluxe menus

#

it's possible i create a item and when click say to put a value

#

when i put return to menu with the args provided

#

?

split rivet
#

sure

dark garnet
#

#dev-general message
@icy shadow i unfortunately took ur advice... but what would relocating do exactly, and exactly how would i go about doing it if i did do it?
also, how can i make it so that when checking for dependencies, i can prevent stuff like this:
PluginA has dependencies DiscordSRV and ViaVersion
PluginB has dependencies DiscordSRV and EssentialsX
since PluginA and PluginB both depend on DiscordSRV, it'll be downloaded twice, how do i prevent that?

dusky harness
#

i unfortunately took ur advice
lol

dusky harness
#

but what would relocating do exactly, and exactly how would i go about doing it if i did do it?
idk what u mean

dark garnet
dark garnet
dusky harness
#

I mean ppl host maven central mirrors but I don't think one for spigot/modrinth/etc are needed since you're not downloading it each time (I'd assume it'd be cached, no?)

dusky harness
dark garnet
#

so in the example i gave, the api would download DiscordSRV onto the server

dusky harness
#

wait huh

#

your plugin installs other plugins?

dark garnet
dusky harness
#

downloads if specified?

#

like in config?

dark garnet
#

i think i scared dkim away

#

i hope hes not crying rn :(

dusky harness
dark garnet
dusky harness
#

also uhh i personally have a plugin which calls spiget like 20 times every time i start the server

#

lol

#

it was difficult to find a pastebin service with non-strict ratelimits that could allow editing

dark garnet
#

waht????????

#

just make ur own? thats what i did :/

dusky harness
#

it doesn't allow editing though ☹️

dark garnet
#

it could tho

#

would just have to switch to a different paste thingy

dark garnet
dusky harness
dark garnet
#

so all the plugins using api checks dependencies before any of them even start downloading

dusky harness
#

i do the second one

dark garnet
#

what jar file would be opened

dusky harness
#

every file in plugins/

dark garnet
#

but when dependencies r checked (on load), none of the dependency files exist yet, cause none of them have been downloaded

dusky harness
#

but once you download them

#

they exist

dark garnet
#

but then they'd already be downloaded...

dusky harness
#

I thought that's what you were asking

#

if it's already downloaded or not

dark garnet
#

nono

#

if another plugin using my api has the same plugin marked as a dependency

dark garnet
dusky harness
#

it would be downloaded it plugins/
so check if it already exists
if it doesn't, download it
if it does, do nothing

dark garnet
dusky harness
#

block the main thread

#

it's in onLoad anyways and it shouldn't take a while so it doesn't matter

#

unless onLoad is async

#

ig u can check that but i dont think it is

dark garnet
#

wait sry they're checked onEnable

dusky harness
#

probably shouldn't be but now you're sure it's sync

#

im 99.99999% sure onEnable runs sync

dark garnet
#

is there any other way? blocking main thread sounds dangerous and a bit excessive

dusky harness
dark garnet
dusky harness
#

with its library loading feature

#

iirc

dusky harness
#

like

#

for example luckperms

#

are you downloading it and enabling it on the same server run?

#

since if so, you'd have to use onLoad probably

dark garnet
dusky harness
#

yeah I'd use onLoad then

#

since then you're going to be calling onLoad and onEnable in onEnable

#

which may cause issues

dark garnet
#

alr then there is new issue

dusky harness
#

it also might conflict with other (soft) dependencies

#

and loadbefores

dark garnet
#

i want the plugin to load after the dependencies are installed

#

hmmmmmmmmmmmmmmmmmmmmm

#

what if i just loaded the dependencies?

dusky harness
#

spigot might try loading it twice

dark garnet
#

no

#

all plugins load at the same time

dusky harness
#

the dependency of the dependency I mean

#

no they don't

#

well they don't load at the same time

#

they load in a for loop

dark garnet
#

so pretty close

dark garnet
#

and it looks like it wont

dusky harness
#

link?

dark garnet
#

spigot first gets a map of all the files, and then runs a for loop to load each of them

dark garnet
dusky harness
dusky harness
#

ok too many "dependency" words

#

here's an example

dark garnet
#

the dependencies wont have been downloaded yet

#
  1. Spigot gets plugin files (plugins)
  2. Spigot loads plugins from plugins
    a. Plugin using API is loaded
    b. Plugin downloads dependencies
    c. Plugin loads dependencies
  3. Spigot enables plugins
dusky harness
#

This isn't true but let's say LuckPerms depends on PlaceholderAPI

Your plugin depends on LuckPerms
Your plugin downloads and enables LuckPerms BUT PlaceholderAPI hasn't enabled yet because that file has not been reached yet in spigot's for loop
LuckPerms fails to enable due to the missing dependency
Later, PlaceholderAPI downloads the files

dark garnet
#

if luckperms depends on placeholderapi, then my plugin would also declare placeholderapi as a dependency

dusky harness
#

alr then it should work

dark garnet
#

wait would it

dusky harness
#

you can look at plugwoman's code for the plugin loading/enabling

#

you'll have to call onLoad and onEnable at the correct times though

dark garnet
#
if (enable && dependency.enableAfterDownload && manager.getPlugin(dependency.name) == null) {
    try {
        // Load and enable plugin
        final Plugin dependencyPlugin = manager.loadPlugin(dependency.getFile());
        dependencyPlugin.onLoad();
        manager.enablePlugin(dependencyPlugin);

        // Register commands
        PluginCommandYamlParser.parse(dependencyPlugin).forEach(command -> plugin.commandRegister.register(command, dependencyPlugin));
        plugin.commandRegister.sync();
    } catch (final InvalidPluginException | InvalidDescriptionException e) {
        plugin.log(Level.SEVERE, "&4" + dependency.name + " &8|&c Failed to load plugin!");
    }
}```
#

maybe i should just live with multi-download

#

ok im going to sleep

dusky harness
#

Good night

#

Don't let the bed bugs bite!

silver quarry
#

Hi

#

Help me pls

#

I have luckyperms installed on the bungeecord

#

How to make placeholders work

#

Plugin placeholder himself is on the other bedwars server

#

For some reason, it does not work on the bungeecord

dark garnet
lyric gyro
#

smoking crack

dense drift
proud pebble
#

ive already lost count

leaden sinew
#

You should find them

dark garnet
leaden sinew
#

What

#

Nothing happened

lyric gyro
#

I suggest crying

#

It won't solve anything but it feels good

dense drift
#

I already did that 😦

dark garnet
#

here's some examples, but the source codes arent available so you could try decompiling (if ur using intellij u could use that): https://advancedplugins.net/category/addons (ones starting with T-)
if u do decompile, just make sure to not use any of it's code, else it'd be against whatever license they have

dusty prawn
#

Hello, I'm making my first plugins and i want to die

#

can someone help me?

broken elbow
#

with which part? dying or making a plugin?

dusty prawn
#

first part would be awesome

#

i mean, the first you said hahaha

broken elbow
#

Ah. Well then, I present you:

mental cypress
#

What are you trying to do, and what do you have so far?

dusty prawn
broken elbow
dusty prawn
broken elbow
#

Now time to wait for both Discord and Minecraft to ban me because talking about this kind of stuff is against their TOS.

#

😭

dusty prawn
#

for each player

mental cypress
#

Alright so it sounds like you want a list of location objects.

mental cypress
#

And then you would loop over all over the players in that team and for each one pick a random entry from the list of locations

#

I don't think Java has a random method on their lists, does it? I'm still in Kotlin mode.

broken elbow
#

I have to learn python

#

it sucks

dusty prawn
#

I copied another plugin, i dont want to create a public plugin because I'm a twitch streamer and i just want to use it in my server

#

so i will show you what i have give me a sec

mental cypress
#

Okay!

broken elbow
#
    List<Integer> list = Arrays.asList(firstElement, secondElement, thirdElement, etc);
    Random random = new Random();
    int randomElement = list.get(random.nextInt(givenList.size()));

This is a simple way to get a random element from a list in Java. It indeed does not have a method provided like Kotlin.

#

A thing to note is that you can get duplicates as it doesn't remove the elements from the list. Also you should probably not create the Random object every time you get an element

mental cypress
#

That is correct. You can make a one-off function that just calls a class initialized random object.

dusty prawn
#

if (cmd.name.equals("randomwarp", ignoreCase = true)) {

  if (args.size == 0) {
    sender.sendMessage(ChatColor.RED.toString() + "You have not specified a spawn arena name!")
    return true
  }
  if (args[0].isEmpty()) {
    sender.sendMessage(ChatColor.RED.toString() + "You have to specify a warp channel!")

    return false
  }

  // Here i want to set the myPlayerTarget var to each players of the args[1] team
  }

// these 3 lines work perfectly, it teleports my players to the random warps, but only to specific players
    val locList = locationMap[args[0]]!!
    val `in` = randInt(0, locList.size - 1)
    if (myPlayerTarget != null) {
      myPlayerTarget.teleport(locList[`in`])
}
return true

}

#

this is the part i need to correct

#

the only thing i need is the team part, make every player tp

mental cypress
#
public class MyClass {
    private final Random random = new Random();
    private final List<Location> locations = new ArrayList();

    // Stuff here, maybe add locations to the list.

    public Location getRandomLocation() {
        return locations.get(random.nextInt(locations.size()));
    }
}

That might be the class setup that would have the random and the list of locations and then there's the function to pull a random location from that list.

#

You need to have your list of members in the group somewhere, so you need to iterate over all those members and then player.teleport() them.

dark garnet
dusty prawn
mental cypress
#

I mean Team is not a thing in Minecraft. You have to make that yourself.

#

Actually Scoreboard Team might be a thing but yeah.

mental cypress
#

In terms of what he is wanting, I doubt it's that.

dark garnet
# dusty prawn and for the teams is there any Team.members or else?

if ur using minecraft's scoreboard teams it'd be Team#getEntries, which returns a list of player names im pretty sure (so you'd use Bukkit#getPlayer to turn the name into a Player)
if ur not using scoreboard teams it'd be something different, depending on what ur using

dusty prawn
#

the command 7/team join,and etc doesn't exist in minecraft? maybe i was using a plugin and didn't know

dark garnet
dusty prawn
#

hhmmmm okey okeyyyyy, thankyouu

dark garnet
#

if u need help with getting the Team lmk

dusty prawn
#

unfortunately here in my country it's super late, i entered the server as a last resource hahaha, tomorrow i will try again and probably come back here to cry a little bit more, thank you so much @dark garnet @mental cypress and @broken elbow 😁

dusky harness
#

this is kotlin

#

btw

#

so you can use the random function

dark garnet
#

it is...

dark garnet
dusky harness
#

there's a bunch of stuff that can be changed but since they're new I'll just leave it how it is

dark garnet
dusky harness
#

yeah
i basically only said the above message just because I wanted to show that it's not kotlin in its full potential

#

🤩

#

kotlin = best

dark garnet
#

lucky u did say something else we'd be continuing to help in java 💀

dusky harness
#

i can't believe no one noticed lol

#

the first line is kotlin 💀 💀 💀

dark garnet
#

not used to seeing new devs (or at least new mc devs) start in kotlin

dark garnet
pulsar ferry
#

To give you credit, it can be a bit hard without it being on a codeblock

dark garnet
#

im going to literally actually irl start crying

lyric gyro
#

smoking crack

dark garnet
edgy lintel
#

Wrong gif but you get the idea
Java > kotlin

#

Java + kotlin < all

wet fox
#

Is there a way to create new servers from a plugin in velocity?

bright pier
#

I have little experience with velocity, but I would have to guess you wouldn't be able to. You'd need to manually make them

wet fox
#

You can change the config and use the reload command in order to do it, this is why I would guess it would be possible via the API

bright pier
#

Changing an already existing file and running a command is one thing, but Creating an actual server...

wet fox
#

Yeah I mean adding the server onto the config file programatically

#

Not actually creating the minecraft instance

wet fox
#

Seems like something to look into, thanks

willow willow
#

Ghost ping?

dusty prawn
#

Hello, It's me again

dusty prawn
#

(I deleted this message 😛)

dusty prawn
#

var board = Bukkit.getScoreboardManager()!!.newScoreboard
var myBoard = board.getTeam(args[1])

  for (player in myBoard.  <HERE> )
  {
    val locList = locationMap[args[0]]!!
    val `in` = randInt(0, locList.size - 1)

     player.teleport(locList[`in`])
  }
#

Okey i think i have something, i just need how to get players from the team

dense drift
#

d;team#getentities

uneven lanternBOT
#
@NotNull
Set<String> getEntries()
throws IllegalStateException```
Description:

Gets the Set of entries on the team

Returns:

entries on the team

Throws:

IllegalStateException - if this entries has been unregistered\

dense drift
#

@dusty prawn

dusty prawn
#

Thankyou Gaby

#

I did it!! i achieved my first goal!! yeeeeeyyyy (Spoiler i did not)

#

var board = Bukkit.getScoreboardManager()!!.mainScoreboard
var myBoard = board.getTeam(args[1])

  for (player in  myBoard!!.entries )
  {
    val locList = locationMap[args[0]]!!
    val `in` = randInt(0, locList.size - 1)

     Bukkit.getPlayer(player)!!.teleport(locList[`in`])
  }
#

It now works, but only for 1 player

#

Okey, Its because geyser renames them with .(name) any clue?

dusty prawn
#

now i did it

echo birch
#

Help please.
I have the code
` @EventHandler
public void test1 (PlayerInteractAtEntityEvent click) {
Player player = click.getPlayer();
ArmorStand stand = (ArmorStand) click.getRightClicked();

    if (stand.getScoreboardTags().contains("VehicleMP")) {
        stand.addPassenger(player);
   
    }
}`

And it causes this exception
Internal Exception: java.lang.IllegalStateException: EntityDismountEvent cannot be triggered asynchronously from another thread.

proud pebble
forest jay
#

I want check if a player is somewhat looking at an entity. I dont need their crosshair on the entity, I just need it with -45 yaw and +45 yaw of the entity. How can I get the direction of the entity from the players perspective? Or is there a simpler way to accomplish what I want done?

molten wagon
#

I get this error, I have done like the guides I find when google to set up modules and dependencies. But of some reason can't it find the class when compile.


[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] H:\idea\Cheststorage\Core\src\main\java\org\brokenarrow\storage\CCH.java:[17,34] error: cannot find symbol
  symbol:   class DatabaseAPI
  location: package org.brokenarrow.storage.api
[ERROR] H:\idea\Cheststorage\Core\src\main\java\org\brokenarrow\storage\database\Database.java:[4,34] error: cannot find symbol
  symbol:   class DatabaseAPI
  location: package org.brokenarrow.storage.api
[ERROR] H:\idea\Cheststorage\Core\src\main\java\org\brokenarrow\storage\database\Database.java:[40,42] error: cannot find symbol
  symbol: class DatabaseAPI
[ERROR] H:\idea\Cheststorage\Core\src\main\java\org\brokenarrow\storage\CCH.java:[285,8] error: cannot find symbol
  symbol:   class DatabaseAPI
  location: class CCH
[INFO] 4 errors 
[INFO] -------------------------------------------------------------
dark garnet
#

and remember that locations will be reused (as in 2 players can be teleported to the same spot), but i assume thats what u want

dark garnet
#

wait why do u need the direction the entity is looking?

forest jay
#

For a chat plugin. I only want the chat to trigger when the player is semi looking at the npc

#

So I need the players yaw

#

And then I still have yet to figure out the yaw that will hit the entity

dark garnet
#

have u tried using ray tracing with a bigger raySize (i think default is 0.1 or something)?

#

d;world#raytraceentities

uneven lanternBOT
#
@Nullable
RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize)```
Description:

Performs a ray trace that checks for entity collisions.

This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.

Returns:

the closest ray trace hit result, or null if there is no hit

Parameters:

start - the start position
direction - the ray direction
maxDistance - the maximum distance
raySize - entity bounding boxes will be uniformly expanded (or shrinked) by this value before doing collision checks

forest jay
#

I think I can use this with the players look direction and then using a raysize of 3 to expand the hitbox by 3 times.

dark garnet
#

wait will the result return a list of entities? or just one? if it just returns 1, it might not work if other players r nearby (unless u add a predicate)

forest jay
#

its just one

forest jay
#
Entity entity = newPlayer.getWorld().rayTraceEntities(newPlayer.getLocation(), 
    newPlayer.getLocation().getDirection(), 
    3, 
    3, 
    entity1 -> entity1 instanceof Player && !Bukkit.getOnlinePlayers().contains(entity1)).getHitEntity();

if (entity == null) {
    continue;
}```
dark garnet
#

wait

forest jay
#

well no, because an NPC is a player

#

it is a ServerPlayer

dark garnet
#

oh

#

that is weird

forest jay
#

I already tried the first part alone

#

its weird, an NPC is like a fake player

#

it isnt considered an online player, but is still a "player"

dark garnet
#

r u using java 16+?

#

also if u have other npcs in ur world, u should add another check to make sure its the right one, unless it doesnt matter what npc it is

forest jay
#

I am using Java 17

forest jay
#

I was having issues of the npcs being triggered by other npcs as well

#

that is where the check for if it was an online player came in

dark garnet
# forest jay I am using Java 17

u should do this then: entity1 instanceof Player player1 && !Bukkit.getOnlinePlayers().contains(player1)
just for consistency and readability

forest jay
#

yeah I have the pattern variable in my current code

dark garnet
#

o ok, i dont get such privileges in java 8 Sadge

forest jay
#

yeah, that is one of the big reasons I am coding for 1.19

#

just the straight up java features are worth it

dark garnet
#

ye im only doing 1.11+ cause its an api

forest jay
#

ah

#

I am building my own network, and I just going to make a backwards compatible system to allow previous versions

dark garnet
forest jay
#

yeah. and then I am modifying the server jar to make it as bare bones as physically possible for my server

dark garnet
#

bigbrain sry i cant choose 😭

forest jay
#

I am not too worried about performance, but it is still good to consider

dusky harness
forest jay
forest jay
dusky harness
#

ah alr

#

just wanted to put it out there in case you haven't

#

¯_(ツ)_/¯

dark garnet
dark garnet
forest jay
#

ah, applies anyways

dusky harness
forest jay
dark garnet
forest jay
#

I know OVH has some controversy

#

I am not really sure what their issues were, but I have heard from a lot of people to stay away from them

dark garnet
forest jay
#

ah

jade wave
dark garnet
pulsar ferry
#

Wdym by "it'll be downloaded twice"?

#

Need more context and too lazy to go up and read all

forest jay
dark garnet
dark garnet
forest jay
#

I am currently using that

dark garnet
#

this is what i have:

final Location eye = tagger.getEyeLocation();
tagger.getWorld().rayTrace(eye, eye.getDirection(), range, FluidCollisionMode.NEVER, true, size, check);```
forest jay
#
RayTraceResult result = newPlayer.getWorld().rayTraceEntities(newPlayer.getLocation(), newPlayer.getEyeLocation().getDirection(), 3, 2, entity1 -> entity1 instanceof Player player1 && !Bukkit.getOnlinePlayers().contains(player1));

if (result == null || result.getHitEntity() == null) {
    continue;
}

if (result.getHitEntity().equals(getEntity().getEntity()))
    inDialogue.add(openPlayerDialogue(newPlayer));
dark garnet
dark garnet
#

mine uses 0.2 and it just barely goes off of the entity

forest jay
#

it is supposed to be a multiplier of their hitbox

#

I think*

dark garnet
#

cause 0.1 is if u want them to be looking directly at them

pulsar ferry
forest jay
# uneven lantern

raySize - entity bounding boxes will be uniformly expanded (or shrinked) by this value before doing collision checks

dark garnet
#

cause im making a laser tag plugin

forest jay
#

is it expanded by blocks?

dark garnet
#

i have no idea, i just continuously tested until i got what i wanted 💀 (which is 0.2, gives the player a little bit of aim assist, but not too much)

forest jay
#

ah

dark garnet
#

i was using 1 at first and every time we tested the game ppl would be able to shoot players way too easily (basically not actually hitting them)

dark garnet
forest jay
dark garnet
forest jay
#

I will send video in a few minutes

dark garnet
#

alr

#

btw u should probably make it check if the npc is nearby the player (maxDistance) so that it doesnt fire unnecessary ray traces (unless Entity#getNearbyEntities uses ray tracing, but idk)

#

d;entity#getnearbyentities

uneven lanternBOT
#
@NotNull
List<Entity> getNearbyEntities(double x, double y, double z)```
Description:

Returns a list of entities within a bounding box centered around this entity

Returns:

List<Entity> List of entities nearby

Parameters:

x - 1/2 the size of the box along x axis
y - 1/2 the size of the box along y axis
z - 1/2 the size of the box along z axis

forest jay
#

and then it loops through those and then does the raycasts

#

and it only raycasts every 5 ticks, which means it has a little lag, but doesnt slow down the server

dark garnet
#

ok so i should definitely relocate

dark crag
#

how is the real api
i need the api
the plugin is not working

lyric gyro
#

bro what

wintry frost
#

Are their any sources to see api changes from 1.19.2 to 1.19.3?

leaden plume
dark crag
#

Bro
Is not working
This
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
Is not working

spiral prairie
#

okay

dark crag
#

Bro I need the right api to program my coin system because the plugin doesn't work

pulsar ferry
#

At the end, the real api was the friends we made along the way

dark garnet
#

hope that helps

dark garnet
dark garnet
#

oh its literally just that ok

pulsar ferry
#

Yeah it's very simple

dark garnet
#

so like something i could put into the api to make that happen?

#

if not, how do ppl usually make an api, ensuring versioning isnt an issue and without requiring relocation?

forest jay
dark garnet
#

is this the correct way to relocate? or should the destination be in a different format?

relocate("xyz.srnyx.annoyingapi", "xyz.srnyx.annoyingexample.annoyingapi")```*`xyz.srnyx.annoyingexample` is the plugin*
lyric gyro
#

sure

river solstice
#

hey. I've a question with dependencies.
currently I have a quite big dependency (is not a plugin) that I shadow inside the plugin.
is there a way to just place it in the plugins subdirectory 'libs' or something like that and load it from there?

#

or since it's an implementation it wont work?

dark crag
forest jay
#

You are most likely importing it wrong

dark crag
#

@forest jay

dense drift
#

add the papi jar there and I guess it will work

#

it is highly recommended to use a build tool

forest jay
#

A build tool would make it way easier

wheat carbon
#

curious, did a youtube tutorial make you use eclipse?

forest jay
#

I don't know eclipse, I am a JetBrains guy, you might want to Google it.

wheat carbon
#

just curious how people stumble onto eclipse in 2022

#

i'm guessing it's ancient youtube tutorials

dark crag
dense drift
#

exactly piggy

#

idk, however you added spigot api @dark crag

#

tbf I found it more difficult at the beginning to build a jar using the built in thing than with maven

worthy quartz
#

maven is easy

#

slap some plugins and dependencies and mvn package does the heavy lifting for you :)

dark crag
neat pierBOT
dark crag
dense drift
#

no I mean, you add papi just like you added spigot api

#

idk the process, sorry

worthy quartz
#

don't use eclipse

dark crag
#

I already have

dense drift
#

after you figure this out, help yourself and change the tutorial you are watching

dark crag
worthy quartz
#

don't watch tutorials

#

read the docs

#

and use intellij

#

and maven

dense drift
#

reading the docs is not for everyone

worthy quartz
#

upgrading from eclipse to intellij is like upgrading from a toyota to a bugatti

worthy quartz
#

it's the same in the hardware parts

dark crag
#

The problem is I have no idea how to import plugins like Vault LuckPerms or something

worthy quartz
#

if I want to drive an IC I don't go on youtube and watch what to connect where

#

I open the datasheet of the specific IC and read how to make it work

dense drift
#

Starting by reading docs and reading docs later on to learn about a functionality are two different things

dark crag
#

Just tell me how the shit goes

dense drift
#

Max, nobody uses the default build tool of eclipse

worthy quartz
#

sorry, we're not your parents to spoonfeed you. first, you are not a baby, you can eat by your own. we can only cook you the food.

forest jay
#

Go there

#

Once you download it, install the Minecraft Development plugin. Then create a new spigot project, and it will set everything up for you.

#

Then it is literally pasting one line of code to add papi

worthy quartz
#

minecraft development plugin kinda sucks tbh

forest jay
worthy quartz
#

added with an a-hole developer and my bullshit meter skyrockets

dark crag
#

Boy are you betrayed YOU CAN ONLY IMPORT OTHER PLUGINS AT SHIT ECPLISE YOU HUSO fefefsfwwge

brittle thunder
#

The what

forest jay
#

What

worthy quartz
#

I didn't understand this one too

dense drift
brittle thunder
#

Please dont use eclipse's build system

forest jay
#

English please

dark crag
#

HUSO = Son Of a bitch

hoary scarab
worthy quartz
dense drift
#

kicked

worthy quartz
#

@dense drift please make a rule so that everyone who uses eclipse and asks questions about eclipse here shall be banned. Thanks <3

brittle thunder
# hoary scarab Why not?

Outdated, cumbersome, lacks in any sort of customizations to the build flow, requires local jar files for all dependencies,

worthy quartz
dense drift
#

the problem wasn't eclipse, but its build system

hoary scarab
brittle thunder
#

oh eclipse works fine with maven, havent tried with gradle, but the problem I mentioned is its inbuilt build system (in reply to ivan)

worthy quartz
brittle thunder
hoary scarab
#

I prefer the build path rather than maven or gradle

brittle thunder
#

No one wants to sit down and do all dependency resolutions by hand

hoary scarab
#

Only reason I use maven is for later minecraft versions because I make use of the spigot maven plugin

brittle thunder
worthy quartz
brittle thunder
brittle thunder
#

Have fun, ig?

#

lol

lyric gyro
#

you can't integrate it in CI

#

that is crucial to many devs

worthy quartz
# hoary scarab Yeap and I do xD

well what about if it is a open source plugin and I want to contribute? I'd directly be pushed back from contributing if it doesn't use maven or gradle.

worthy quartz
hoary scarab
#

37 dependencies currently in my minions plugin

broken elbow
#

oh. hi Yugi.

brittle thunder
#

Hi Gaby

#

Been a long time

hoary scarab
dense drift
#

I was wondering why it even exists, but looks like maven was released only 3 years after eclipse and ij were made

#

hey Yugi

broken elbow
brittle thunder
#

Oh shit

broken elbow
#

but funny

#

actually

brittle thunder
#

Sorry, got the chat mixed up

#

lol

#

hi Blitz

#

Hows life

broken elbow
#

Oh. That gif. 😍

hoary scarab
#

Generally my plugins only depend on spigot anyways cause I don't like depending on other api's
The api's I do depend on are because I allow support for them which of course can be toggled anyways.

brittle thunder
#

Orange Tan Man!

broken elbow
worthy quartz
brittle thunder
worthy quartz
# hoary scarab I would make my own

you know, I was just like you. naive, didn't want to use any libraries, etc. etc. but you have to discover libraries. they make our lives much easier.

brittle thunder
#

Also, on an unrelated note, cant afford a Tesla, going to build one on my own.

hoary scarab
#

I don't care about "easier" lol

broken elbow
dense drift
#

nor smarter

worthy quartz
#

gentoo users im looking at you rn 👀

hoary scarab
broken elbow
brittle thunder
worthy quartz
broken elbow
#

I think we won the war Yugi. It's been there for a long time now and it was not taken down yet

worthy quartz
#

@broken elbow @brittle thunder go change the channel please.

brittle thunder
broken elbow
#

@brittle thunder let's talk here. We don't want to bother the people in #development

brittle thunder
#

Ah yes!

broken elbow
broken elbow
worthy quartz
#

do you know any bhop csgo servers btw? im listening to that legendary bhop music and I'm in need of bhopping

broken elbow
#

62.122.213.93:7777

worthy quartz
river solstice
#

MrIvanPlays, almost every message I read from you seems to be missing
'☝️🤓'
lol

worthy quartz
warm spear
#

Hello, is there a way to hide splash potion effect when we throw it for specific players only ?

river solstice
forest jay
dusky harness
#

by potion effect he probably means like the potion effect status shown

#

which im not sure can be hidden

forest jay
#

he mentioned splash effect

dusky harness
#

yes

forest jay
#

which I would think would refer to actual splash effect / particles, not the gui, but idk

dusky harness
#

¯_(ツ)_/¯

worthy quartz
river solstice
#

why are you so cringe lmao

lyric gyro
#

oh my god shut up

worthy quartz
forest jay
edgy anchor
#

Heya! Looking for a hand with something that is probably very simple!

dense drift
#

d;potioneffect#potioneffect

uneven lanternBOT
#
public  PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon)```
Description:

Creates a potion effect.

Parameters:

type - effect type
duration - measured in ticks, see getDuration()
amplifier - the amplifier, see getAmplifier()
ambient - the ambient status, see isAmbient()
particles - the particle status, see hasParticles()
icon - the icon status, see hasIcon()

dense drift
#

Here @dusky harness

edgy anchor
# edgy anchor Heya! Looking for a hand with something that is probably very simple!

I'm enquiring about a spigot plugin I'm writing, its a collection of "microplugins" which can be enabled and disabled on the fly, there is one class I need the entire plugin to be able to use and see updates on unanimously, how would I do this in Java?
(Because this class is how the features can tell whether they are enabled or disabled, and also communicate about their status
Essentially a "global" initialisation of this class, in the really stupid way of saying it
I was passing this class to each of the commands and features, but it seems to have fallen out of sync

#

I've been fiddling with static, but I'm not sure how to do it properly

#

Because I dont want to hand the controller itself to the individual features for the sake of "dont let things have more power than they need" each feature has a "meta" class which is able to control its specific status within the controller, preventing the feature from fiddling with things outside of its intended scope

#

I think thats where this is going wrong, when initialising the meta class I pass the controller into it, but when I update the controller elsewhere, the meta classes do not receive that update

#
    public void enableItemEco() {
        featureMeta meta = new featureMeta(featurecontroller, featurecontroller.ITEM_ECO, null);
        Material currencyItemType = Material.matchMaterial(getConfig().getString("ItemEco.currency-item"));
        commandSkeleton depositCommand = new commandSkeleton("deposit", new depositCommand(econ,this, helper,meta));
        commandSkeleton withdrawCommand = new commandSkeleton("withdraw", new withdrawCommand(econ,this, helper,meta));
        featurecontroller.setCommands(featurecontroller.ITEM_ECO, new commandSkeleton[]{depositCommand,withdrawCommand});
        if(getConfig().getBoolean("ItemEco.enabled")) {
            if(featurecontroller.getFeatureStatus(featurecontroller.VAULT_API) == featurecontroller.FAILED) {
                getLogger().warning("ItemEco has been disabled due to Vault API status FAILED. Please install > https://www.spigotmc.org/resources/vault.34315/");
                featurecontroller.disableFeature(featurecontroller.ITEM_ECO);
            } else if(currencyItemType == null) {
                getLogger().warning("Disabling ItemEco as item specified in config cannot be found");
                featurecontroller.disableFeature(featurecontroller.ITEM_ECO);
            } else {
                featurecontroller.enableFeature(featurecontroller.ITEM_ECO);
                getLogger().info("ItemEco is now enabled");
            }
        } else {
            getLogger().info("ItemEco disabled by config");
            featurecontroller.disableFeature(featurecontroller.ITEM_ECO);
        }

    }

#

Example of one of the actual parts which enables the features

#

the meta class, which is given to each of the commands and events

package life.ferret.ferretPlugin.FerretCoreTools;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

public class featureMeta {
    private featureController controller;
    private String featureName;

    private String disabledMessage = ChatColor.RED + "Feature is currently disabled";

    public featureMeta(featureController featureController, String featureName, String disabledMessage) {
        this.controller = featureController;
        this.featureName = featureName;
        if(disabledMessage != null) {
            this.disabledMessage = disabledMessage;
        }
    }

    public boolean iAmDisabled() {
        if(controller.getFeatureStatus(featureName) != controller.DISABLED) {
            return true;
        } else {
            return false;
        }
    }

    public void selfDisable() {
        controller.disableFeature(featureName);
    }

    public boolean continuePermitted(CommandSender sender) {
        if(iAmDisabled()) {
            sender.sendMessage(disabledMessage);
            return false;
        } else {
            return true;
        }
    }
}
edgy anchor
#

Sorry for the giant wall!

#

Any support is appreciated <33333

#

(This is after I have been fiddling with static methods btw, which is why it doesnt look like its an instance like it was before, Just realised those changes are in the copypaste)

#

originally the featurecontroller was an instanced object made in the main class of the plugin and passed around

#

(Edited so they are now back to the original instanced versions I was talking about

#

private featureController controller; is it this specifically which I want to make static? And nothing else? I feel that might be it

#

just where the classes are actually taking in the variable

#

I'm going to give that a try for learning purposes

#

Didn't seem to change anything

#

(Happy to open a branch of my repo to commit my current work to look at with someone!

signal grove
#

you have a disable function within each feature

#

you can store the boolean within that class, and leave the featurecontroller out of it

#

then you can also use it in your iAmDisabled() method

#

this way, you won't need static featurecontroller, nor do you need to inject it into each feature

#

something like this

#
package life.ferret.ferretPlugin.FerretCoreTools;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

public class featureMeta {
    private String featureName;
    private boolean enabled;

    private String disabledMessage = ChatColor.RED + "Feature is currently disabled";

    public featureMeta(String featureName, String disabledMessage) {
        this.featureName = featureName;
        this.enabled = true;
        if(disabledMessage != null) {
            this.disabledMessage = disabledMessage;
        }
    }

    public boolean iAmDisabled() {
        return !enabled;
    }

    public void selfDisable() {
        enabled = false;
    }

    public boolean continuePermitted(CommandSender sender) {
        if(iAmDisabled()) {
            sender.sendMessage(disabledMessage);
            return false;
        } else {
            return true;
        }
    }
}
edgy anchor
signal grove
#

ok, what i would do is have featurecontroller store a list or map of featureMeta objects

edgy anchor
#

And then feed those meta objects to the induvidual features?

#

which can call back to it?

signal grove
#

im not sure what you mean yet, i meant featurecontroller would store something like HashMap<String, featureMeta> allFeatures

#

then you could make calls such as

#

featureMeta feature1 = allFeatures.get('feature1');
feature1.disable()

#

something like that, is just pseudocode though

forest jay
#

I am raycasting from the player eyes in the direction of their eyes. I am running into issues of things colliding with the player from behind and triggering the raycast. I was thinking, I could just move the ray forward in the direction of the player's eye, but I cant figure out how to do that. Is there something built in for what? What would be the best approach? Thanks! 🙂

lyric gyro
#

there's a ray trace method that takes a Predicate, you can pass one that returns false when the entity is the player

forest jay
#

but it should only trigger when facing a NPC (which is technically a player), but when the collide, their hitbox cross into the raycast

lyric gyro
#

ignore the player

#

not every player

forest jay
#

but how do I know that it isnt a player I want?

#

the NPCs move around

#

that is why they collide

lyric gyro
#

you don't want the ray to collide with the player you're raycasting from, right?

forest jay
#

thats not the issue

#

it doesnt collide with the player it is raycasting from.

#

An NPC has the chance of walking into the player, at that moment, the NPC's hitbox collides with the raycast and the server thinks the player is look at it, even though it is behind/to the side of them.

#

does that make sense?

round sail
#

start the raycast forward so it’s coming from in front of the players eyes and not center of head. If that still produces that behavior in a way you don’t want I think you’d begin sacrificing accuracy to make it any better.

#

or idk if one of the ray trace methods has like a minimum distance thing.

signal grove
#

so you can get the players eye location, and add an offset of the players radius to it, in their eye direction

#
float radius = Math.sqrt(2*0.4*0.4); // Get a "rounded" radius circumscribing the hitbox.
Vector dir = player.getEyeLocation().getDirection().normalize();
Vector offset = dir.multiply(radius); 
Location startingLocation = player.getEyeLocation().add(offset);
#

you may need some more casting, this is just a guess

forest jay
forest jay
calm loom
#

How do I when a block is place send a message in chat?

broken elbow
calm loom
broken elbow
#

You use the PlayerInteractEvent

calm loom
#

tysm

broken elbow
#

the event has a method called getAction which will tell you what type of interaction was made

#

d;spigot PlayerInteractEvent#getAction

uneven lanternBOT
calm loom
#

Could you write an example?

#

im still kinda confused

#

i get the jistr

#

but im confused on how i would write that out

broken elbow
# calm loom but im confused on how i would write that out
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

public class RightClickBlockListener implements Listener {

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            event.getPlayer().sendMessage("You right clicked a block!");
        }
    }
}
calm loom
#

tysm man

calm loom
broken elbow
#
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

public class RightClickBlockListener implements Listener {

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            Bukkit.broadcastMessage(event.getPlayer().getName() + " right clicked a block!");
        }
    }
}
calm loom
broken elbow
#
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

public class RightClickBlockListener implements Listener {

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.DIAMOND_BLOCK) {
            Bukkit.broadcastMessage(event.getPlayer().getName() + " right clicked a diamond block!");
        }
    }
}
broken elbow
#

No

calm loom
# broken elbow No

TimerCommand.createTimer(); if i dont put any time in the parthensasies it will allow for the command sender to choose correct?

broken elbow
#

No idea what TimerCommand is

#

Is that your own code? Or where is that class from?

calm loom
#

can you not help me in that case

broken elbow
#

Well then you'll have to show me the class to know that.

#

Since your question makes no sense without context

calm loom
#

lemme try to figure it out and if icant ill come back to u

broken elbow
#

Alright 👍

mystic gull
#

Hello what is the most efficient way for item events, checking item displayName or adding a custom nbt tag and checking for it ?

pulsar ferry
#

NBT tag

broken elbow
#

And even better, if it's 1.14+ you can just use the built in PersistentDataContainer instead of having to work with NMS or to use a library/plugin like NBT API

hoary scarab
#

Itemstacks don't have PDC yet do they?

spiral prairie
#

._.

#

do item stacks have nbt?

hoary scarab
#

Yes

spiral prairie
#

so, yes

hoary scarab
#

Not asking about nbt. Talking about PDC which is usually limited to entities, certain blocks (tile entities) etc...

spiral prairie
#

pdc basically is nbt

hoary scarab
spiral prairie
#

no its not

#

pdc is bukkitValues in NBT

hoary scarab
#

If I rember right, Item has PDC but ItemStack has nbt. 2 different accessible objects

spiral prairie
hoary scarab
#

So it does have it now

spiral prairie
hoary scarab
#

Just say that xD

spiral prairie
#

just read my message xD

hoary scarab
#

You were implying nbt and pdc were the same which wasn't my question.

#

2 different objects

spiral prairie
#

?

#

i answered your question

#

my point was pdc being nbt but with a bukkit wrapper

lyric gyro
#

PDC is how you store things in the NBT within the API

#

NBT does not exist in API

#

Of course they are two different objects, they exist in two entirely separate realms

spiral prairie
#

^

#

if the thing has nbt, it 99.9% has pdc too

pulsar ferry
forest jay
#

I am having an issue using Paper 1.18.2, I put the API version as 1.12, as that is the lowest it is supposed to go down. But, it says invalid api version 1.12, is there a reason to this?

#

Here is the error if anyone needed it for references: ```
[20:51:52 ERROR]: Could not load 'plugins\LightLobbySystem-A.04-all.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.12
at org.bukkit.craftbukkit.v1_18_R2.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:375) ~[paper-1.18.2.jar:git-Paper-388]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:415) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:323) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.loadPlugins(CraftServer.java:418) ~[paper-1.18.2.jar:git-Paper-388]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:288) ~[paper-1.18.2.jar:git-Paper-388]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1164) ~[paper-1.18.2.jar:git-Paper-388]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.18.2.jar:git-Paper-388]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

dense drift
#

api version was introduced in 1.13, so the lowest value is 1.13

broken elbow
#

if you want to support lower than 1.13, just don't set that version at all. At least I believe that's what you have to do

dense drift
#

nah it works fine

#

the check only exists on 1.13+ anyways

dusky harness
#

It'd be nice if it had Sound compat too though

dense drift
#

just don't set that version at all.
i was refering to this

spiral prairie
#

using maven cause im updating an old plugin

#

but it aint worky worky

dense drift
#

check settings > build tools

dusky harness
#

No

dusky harness
spiral prairie
#

yes

dusky harness
dense drift
#

maven and then version

dusky harness
#

Jre is set to 17 tho

#

Hmm

spiral prairie
pulsar ferry
#

Maven ugh
Something something, it could be the Maven compiler plugin being outdated

#

Actually prolly not

#

Open the project structure menu thingy, and click on the modules portion and click on each module and see if they are using the correct sdk

spiral prairie
#

yeah checked that already

#

just used cli maven

#

worked

dusky harness
#

Lol

#

Maven bad

pulsar ferry
dark garnet
#

github github workflow/actions question
hi ive already hit my google limit for this issue, so im asking here now
i have 2 jar files generated in api/build/libs and 1 jar file generated in example-plugin/build/libs
i want to have all 3 of those jar files put into the root directory of the Artifact ZIP file when using actions/upload-artifact@v3.1.1
this is what i currently have:

- name: Upload artifacts
  uses: "actions/upload-artifact@v3.1.1"
  with:
    name: AnnoyingAPI
    path: |
      api/build/libs
      example-plugin/build/libs```however, the structure in the artifact zip file is like this:```
api/build/libs:
  1.jar
  2.jar
example-plugin/build/libs:
  3.jar```when it needs to be this:```
1.jar
2.jar
3.jar```
broken elbow
#

try setting the absolute path not the parent directory.

#

so

- name: Upload artifacts
  uses: "actions/upload-artifact@v3.1.1"
  with:
    name: AnnoyingAPI
    path: |
      api/build/libs/1.jar
      api/build/libs/2.jar
      example-plugin/build/libs/3.jar
pulsar ferry
#

*.jar if you don't care about the name

dark garnet
dusky harness
#

I probably have an example on my Bedwars repo

#

Cmon

dark garnet
#

L

dusky harness
dark garnet
#

This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
RIP

dusky harness
#

I got a little annoyed by all the dependency updates

#

Lol

dark garnet
#

u just use 1 path

dusky harness
#

Oh you wanted multiple paths

#

Hmmm

dark garnet
#

indeed

pulsar ferry
#

Did

path: |
  api/build/libs/*.jar
  example-plugin/build/libs/*.jar

Not work?

dusky harness
#

That should work

dense drift
#
      - uses: actions/upload-artifact@v2
        with:
          name: Package
          path: build/libs```
This is what I use
pulsar ferry
#

v2 visibledisgust

dense drift
#

yeah I disabled that workflow long time ago xD

dark garnet
dense drift
#

try to remove the jar part

pulsar ferry
#

Can you link me the repo?

dark garnet
lyric gyro
#

why the name lol

pulsar ferry
#

Yeah tried, couldn't get it to work, gl kek

hoary scarab
hoary scarab
hoary scarab
#

🤦

spiral prairie
#

your point was there were two different objects in the api

#

my point was pdc is nbt

#

i have no idea why youre having a tough time understanding it

#

and i dont know why youre trying to continue this beef

hoary scarab
spiral prairie
#

explain to me why that is dumb

#

i have time

hoary scarab
#

I didn't say it was dumb. I said they were 2 different objects

broken elbow
#

PDC just saves the tags as NBT tags under the BukkitValues tag

dense drift
#

yeah, pdc is just bukkit's nbt implementation, nothing more

spiral prairie
broken elbow
#

but yes they are different objects. one is a wrapper for the other one however

spiral prairie
#

i was making the point that anything that has NBT has PDC

#

what the two objects in the shitty bukkit api have to do with my point or your question is still a mystery to me. please elaborate

icy shadow
broken elbow
#

second most productive. pretty sure the most productive conversation was the one betwen mrivanplays and modi yesterday

icy shadow
#

oh yeah that was pretty good

dense drift
dark garnet
dense drift
#

anything that has NBT has PDC
is the other way around, if something has PDC it has NBT

dark garnet
spiral prairie
dark garnet
pulsar ferry
dark garnet
dense drift
#

Question: I use WE to create a custom enchantment that will destroy blocks in an area. What would be a good way to remove only blocks that are inside the mine region (a rectangle)? I was thinking about using EditSession#replace (since I need to access each block to create drops anyways) and check if its location is within mine's region

spiral prairie
#

WorldEdit?

#

oh

#

i thought you created an enchantment through WE

lyric gyro
#

lol

dense drift
#

the power of friendship

spiral prairie
#

i mean, if the area isnt too large, you could just go with bukkit

lyric gyro
#

eeeh

spiral prairie
#

loop through all coords and just break naturally

dense drift
#

god no

lyric gyro
#

hold up let me try something

#

this is gonna be terrible

spiral prairie
#

you can create a CuboidRegion

lyric gyro
#

oh god

#

this works

#

this is so terrible

#

/fill x1 y1 z1 x2 y2 z2 minecraft:air destroy

dense drift
#

smh

#

I will use WE, that's not the question

lyric gyro
#

i don't know if WE API lets you easily generate drops tho

#

like when "destroying" blocks

dense drift
#

oh no, my question is what would be a good way to check if block x is within the mine region

#

Something like this, the black rectangle is the mine and the red one is the region where blocks will be broken

#

I need to loop trough each block to generate the drops, if I can access the location via EditSession#replace(Region, Pattern) (I think it is pattern), that's fine I guess

lyric gyro
#

I feel like you're doing this the wrong way around

#

I would first generate the collection of blocks to destroy, and as you generate it check that it's within bounds (also let's you "fail-fast" and stop going forward once you "hit a wall"), and then batch-destroy them

proud pebble
#

when implementing enchantments inside of a mine i just checked if block isAABB and changing the drop if it was

lyric gyro
#

Because destroying them one by one and generating drops as you go is going to be slower, there are a bunch of special cases that make batch replacement faster

proud pebble
#

couldnt you just count how many of those blocks in a region is inside and outside of the black box and do some bs to generate the drops for all of them instead of doing it one by one

#

tho that would be less accurate afaik

#

i think when i attempted to do mass generation of drops i just forlooped from 0 to total blocks

dense drift
proud pebble
#

i think every tool ive seen for calculating drops just generated the drops X times for how many times its supposed to do it

signal grove
#

Is it a question of efficiently splitting the regioms or a question of how to break only certain blocks with drops

dense drift
#

I think something like this will do

session.replaceBlocks(
  region,
  Mask (vector) -> // check if the location is within the mine location and generate the drops according to its material
  Pattern () -> // set all blocks to air
);```
signal grove
#

Is fill destroy inefficient

#

I’m wondering if you can first delete the blocks outside the regions

#

Then just fill destroy the overlap to get the drops handled

dense drift
#

wdym?

signal grove
#

the question is about efficiently generating drops right

dense drift
#

Well, I was wondering how I can check if the block is within the mine region, but that is easy to solve because Mask providers a BlockVector3

#

About drops, in theory I think I need to check only certain materials that have different drops regarding if the pickaxe has silktouch or not

signal grove
#

Maybe a map of materials to their silk touch counterparts

#

And if it doesn’t exist as a key, it’s normal

dense drift
#

yeah yeah

dark garnet
#

blatant cap

dusky harness
#

¯_(ツ)_/¯

#

idk what that's happening lol

dark garnet
dark garnet
#

decompiling it from example jar it has package xyz.srnyx.annoyingexample.annoyingapi.command;

spiral prairie
flat anchor
spiral prairie
#

oh what the fuck sky what the fuck did you do

#

what the fuck github copilot

lyric gyro
#

why are you trusting a computer to do your job

spiral prairie
#

yeah

flat anchor
dusky harness
#

and now it's already got the popularity

#

and because no server owner knows about groovy

#

kotlin >

flat anchor
dense drift
#

Kotlin script >>

dark garnet
#

kotlin >>>

dusky harness
#

omg so many kotlin lovers

#

i love it

dark garnet
dusky harness
#

WOW

flat anchor
#

i am talking about simple scripting, kotlin much more strict in this case

dark garnet
dusky harness
#

yeah the kotlin part was mostly a joke for scripting

flat anchor
#

groovy is better for people who wanna move from js

dusky harness
#

groovy is a dynamic language

#

and is very lenient

#

although what's so bad with JS?

#

since it's already so popular with tons of examples and pre-made scripts

flat anchor
#

also, memory leak is still here

dusky harness
#

my code also has the memory leak - fortunately it's in a command, not every placeholder call, but I can't believe no one thought of this

#

lol

flat anchor
dusky harness
#

I do know that nashorn isn't exactly JS though

#

but is still as similar as possible

dusky harness
flat anchor
#

on this few lines, it'll produce leak

dense drift
#

I will look into this, thank you Max

dusky harness
#

oh lets go

#

we got a mod's attention on this

flat anchor
dense drift
#

According to some SO posts, looks like we can use a single ScriptEngine and just create new bindings for each execution

#

Though they say the nashorn engine is not thread safe, so I guess we can create a separate engine for each thread that is not the main thread (maybe a cache?)?

flat anchor
#

ThreadLocal exists

dense drift
#

I don't have much experience with threads, I need to look into that.

dusky harness
#

Baeldung ftw

dense drift
pulsar ferry
dark garnet
#

now im going to get bullied for being stupid and making silly mistake or something 😭

lyric gyro
#

probably

prisma briar
#

Can someone help me with this? For some reason it's always return false, I'm trying to make If the message starts with '#' it will send it to the team chat.

Code:

@EventHandler(priority = EventPriority.HIGHEST)
    public void onChat(AsyncPlayerChatEvent event) {
        Player player = event.getPlayer();
        String message = event.getMessage();

        Bukkit.broadcastMessage("message: (" + message + ")");
        Bukkit.broadcastMessage("message.startsWith(\"#\") = " + message.startsWith("#"));

        if (message.startsWith("#")) {
            event.setCancelled(true);
        }
    }
dense drift
#

my guess is it starts with a color code

prisma briar
dense drift
#

yea

prisma briar
#

Alright thanks! I'll try it out.

#

Damn, you're 100% correct what the hell

#

thank you so much

dark garnet
#

now its telling me to make sure the classes dont have any syntax errors... of course they dont... or else they wouldnt be able to be compiled...

sterile hinge
#

send full logs

icy shadow
#

ChatGPT is actually wrong a lot of the time

#

It's not groundbreaking by any means

dark garnet
#

i love when i change absolutely nothing and it just magically fixes itself, soooooo amazing

rugged bane
icy shadow
#

I'm not saying it's bad but probably around half of the things I've tried have given subtly wrong responses, especially if you're asking it for code

#

It'll just make functions and things up a lot of the time

rugged bane
#

Ahhh, yeah - I’ve only asked it questions like naming tests, and Amazon AWS stuff

#

Not really code so much

brittle thunder
dark garnet
#

but i use chatgpt to code all my stuff guys

#

if u dont then ur not a real programmer

icy shadow
#

it's good as more of a google alternative but for actual code questions it's really not great

brittle thunder
#

Mhm

rugged bane
brittle thunder
#

It does work with code if the question is very general

rugged bane
#

Amazing for asking questions that saved hunting google

icy shadow
#

yeah and also it's decent at stuff like generating text

brittle thunder
#

Specific to any libraries is well yea, expectly not too well

icy shadow
#

mm

mental cypress
#

I've had a decent experience with it so far.

icy shadow
#

yeah it's not bad by any means

#

has many good uses

dark garnet
#

BM where were u for the past week or so

icy shadow
#

busy

#

with life

#

going home to family for christmas and such