#development

1 messages · Page 103 of 1

brittle thunder
#

No

pure crater
#

Yeah

brittle thunder
#

Thats not what I mean

#

The number of threads is inversely proportional to the shared time per thread

#

The more threads you have

#

Lesser time a single thread would get to execute

pure crater
#

Yeah

brittle thunder
#

And switching between threads and processes is also another factor, moving the different values inbetween. So lesser time for a thread would also mean more waiting time for data transfer

pure crater
#

Yeah

lyric gyro
pure crater
#

Yeah

graceful hedge
#

Are we talking just concurrency, parallelism or simply asynchronous code?

leaden sinew
#

Yeah

graceful hedge
dense drift
#

So I'm trying to debug some code with IIJ, if I set a breakpoint where a method is used, it stops the program there, but if I put one inside that method, it doesn't, any idea why? Or do breakpoints work only with your own code

sterile hinge
#

it needs to match the source code, so it might not work if line numbers are different for example

lyric gyro
#

More so the opposite LOL. Make sure your problem is truly solved by going to another thread

high edge
#

A dropped item would be an entity, so PDC

regal idol
#

guys

#

it cannot be unregistered

#

Failed to unregister expansion: DiscordSRVUtils

#

even with api it doesnt unregister

broken elbow
regal idol
#

thx it worked

broken elbow
#

yes. update to 1.17. ez

#

I believe you can set nbt tags to entities with that

regal idol
broken elbow
#

no idea

dusky harness
#

yep - use NBTInjector (you'll see it in NBT api wiki)

dense drift
#

@regal idol open an issue on papi repo

leaden sinew
#

How would I display text in the left right of screen?

#

With a resourcepack

wintry grove
#

what is it?

dusky harness
# wintry grove kill me but PDC?

PersistentDataContainer
A data container persistent across restarts

applies on TileEntitys (blocks that store extra data such as a chest), Entitys (cows, etc), and ItemStacks

#

(it uses nbt "behind the scenes" iirc)

wintry grove
#

oh okay

abstract gate
#

im making a team per player

#

team = board.registerNewTeam(player.getUniqueId().toString().substring(0,15));

#

i get no errors but in game the team isn't there

storm stream
#

Good day, I've been struggling with this for many days now. I'm trying to include an external library, javacord, in my project, the standard seems to be maven. Now, I've gotten lost in a mess of to shade or not to shade. I've used gradle before and grade shadowJar is very simple and works when I have javacord in main/resources, using mvn package however, I haven't gotten it to work yet, https://paste.helpch.at/ocoyotejan.xml is my POM, my log is https://paste.helpch.at/efokiyucun.coffeescript. File structure: https://imgur.com/a/cZqCt57

dusky harness
#

maven and gradle has a section for repositories (URLs where it downloads the jars) and dependencies (because each repository can have multiple libraries)

#

you put those lines into your pom.xml/build.gradle

#

(also you need tier 2+ to post images)

storm stream
#

Oh that makes a lot more sense

#

Thank you!

shell moon
#

When was Action.COPY_TO_CLIPBOARD added?

void orchid
#

a while ago i believe

shell moon
#

1.15 or 1.16

void orchid
#

even older than that? isn't COPY_TO_CLIPBOARD the same as SUGGEST_COMMAND?

#

just different naming

shell moon
#

no

#

suggest writes it in your chat

#

copy copies directly to your clipboard

void orchid
#

aha

molten wagon
#

I´m not soo good on fields. I get this error [17:05:42 WARN]: java.lang.IllegalArgumentException: Can not set final org.brokenarrow.storage.menus.redone.MenuButton field org.brokenarrow.storage.menus.redone.testMenu.LinkButton to java.lang.Class but has yet not find how to fix it.

proud pebble
#

your trying to change something with the final keyword

molten wagon
shell moon
#

code

broken elbow
#

ugh. it shouldn't be final if you plan on changing it, which sounds like what you're doing

molten wagon
#

I try with out final and that not work ether.

    private void getFieldButton() {
        for (Field field : this.clazz.getDeclaredFields()) {
            field.setAccessible(true);
            if (MenuButton.class.isAssignableFrom(field.getType())) {
                try {
                    MenuButton fielddata = (MenuButton) field.get(this.clazz);
                    buttons.add(fielddata);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
        }
    }

proud pebble
molten wagon
molten wagon
#

https://paste.helpch.at/aduraxoqit.http

is say [17:55:12 WARN]: java.lang.NullPointerException: Cannot invoke "org.brokenarrow.storage.menus.redone.MenuButton.getItem()" because "this.LinkButton" is null

I add this to field, from this in other class (call this inside constructor).

    private void getFieldButton() {
        for (Field field : this.clazz.getDeclaredFields()) {
            field.setAccessible(true);
            if (MenuButton.class.isAssignableFrom(field.getType())) {
                try {
                    MenuButton fielddata = (MenuButton) field.get(this);
                    System.out.println("test " + this);
                    buttons.add(fielddata);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
        }
    }
abstract gate
#

when i use my command

#

it says /life <args>

#

which is what my plugin.yml says

#

why does it do this

pulsar ferry
#

You're returning false in the command method

abstract gate
#

oh

abstract gate
#
                        if (x <= 1 && y == 0) {
                            sender.sendMessage("§cYou must have more than 1 life and they must have 1 or more lives");
                        }```
#

what here is wrong

#

x is the lives the sender

#

y is the lives of the receiver

#

y must be 1 or more

#

x must be 2 or more

lyric gyro
#

What's wrong?

#

Does it not send the message?

inner valley
#

what is wrong with the code i have a seperate class for the timer only the timer does not work in minecraft

#

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.plugin.Plugin;

public class RCKlik implements Listener {
    private Machine plugin = (Machine) Machine.getPlugin(Machine.class);

    public void onClick(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (event.getHand() != EquipmentSlot.HAND) return;
            Block block = event.getClickedBlock();
            if (block.getType() == Material.PURPLE_GLAZED_TERRACOTTA) {
                Player player = event.getPlayer();
                (new CountDownTask(this.plugin, player, event.getClickedBlock())).runTaskTimer((Plugin)this.plugin, 0L, 2L);
            }
        }
    }
}```
#

the right click event class ^^

#

import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;

public class CountDownTask extends BukkitRunnable {
    private int time;

    private int seconds;

    private Machine plugin;

    private Player player;

    private Block c;

    public CountDownTask(Machine plugin, Player player, Block b) {
        this.plugin = plugin;
        this.time = 9;
        this.c = b;
        this.seconds = 20 - 1;
        this.player = player;
    }

    public void run() {
        this.time--;
        if (this.time == -1) {
            this.time = 9;
            this.seconds--;
        }
        if (this.seconds != -1)
            this.player.sendTitle("Huts", this.seconds + "." + this.time, 0, 60, 0);
        if (this.seconds == 0 && this.time == 0) {
            this.player.sendMessage("Test");
        }

    }

}
#

the countdown class ^^

dense drift
#

You forgot to annotate the method with @EventHandler

inner valley
#

should I put the @EventHandler at the top of the countdown class?

#

ooo i see

#

in the click class I dont annotate the @EventHandler

lyric gyro
#

annotate the method with @EventHandler

inner valley
lyric gyro
#

not the class

cinder forum
#

why is eventhandler needed 🤔

inner valley
#

i see

lyric gyro
#

because they want to handle an event??

#

public void onClick(PlayerInteractEvent event) {

cinder forum
lyric gyro
#

That's the way you tell Bukkit "hey I want to handle this event"

#

by annotating it

cinder forum
#

ok but why is it designed like that
its nit possible to register it without it?

lyric gyro
#

.-.

#

Minecraft server loads all the plugins before starting to enable even a single plugin right?

#

it's designed like that because it is

pure crater
lyric gyro
#

So in my onEnable method all the plugin show be loaded

#

loaded yes, not enabled

#

okay so can I get a list of all the loaded plugin in my onEnable()?

#

just the name not instance obviously

cinder forum
lyric gyro
#

Just stuff your shit into a listeners list

#

what

pure crater
cinder forum
#

wdym

pure crater
#

🤦‍♂️

#

just annotate the method man

#

dont ask why

#

lmfao

lyric gyro
#

any idea

#

In reality it’s because spigot is dog shit

#

And there events suck

lyric gyro
#

Stupid slow

lyric gyro
#

PluginManager#getPlugins?

#

I don't think so

#

????????????????

#

some plugin won't be enabled when I will use #getPlugins() cause the plugin that will enable after my plugin will be present on that list

#

do you want a list of loaded plugins or of enabled plugins?

pure crater
#

^?

lyric gyro
#

loaded

#

PluginManager#getPlugins

#

that's literally what you want

#

oh

#

hmm

#

okay thanks I will try'

lyric gyro
#

Which is what you want

rich junco
#

Anyone know of an open source project similar to the ECloud system for storing addons remotely?

inner valley
#

I added a cooldown to my code but it doesn't work the message is sent but the event.setCanceld() doesn't work because it still executes

#
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            Player player = event.getPlayer();
            if (event.getHand() != EquipmentSlot.HAND) return;
            Block block = event.getClickedBlock();
            if (block.getType() == Material.PURPLE_GLAZED_TERRACOTTA) {
                if(cooldown.containsKey(player.getUniqueId()) && cooldown.get(player.getUniqueId()) > System.currentTimeMillis()){
                    long tijd = cooldown.get(player.getUniqueId()) - System.currentTimeMillis();
                    player.sendMessage(ChatColor.RED + "Je zit in een cooldown periode van " + tijd/1000 + " seconden.");
                }
                else {
                    cooldown.put(player.getUniqueId(), System.currentTimeMillis() + (10 * 1000));
                }
                player.updateInventory();
                event.setCancelled(true);
                (new CountDownTask(this.plugin, player, event.getClickedBlock())).runTaskTimer((Plugin)this.plugin, 0L, 2L);

            }
        }```
proud pebble
#

cant you just rely on server time for the timer?

inner valley
#

what do you mean?

#

Yes i can

#

but how do I add the server time to the code?

proud pebble
#

im blind your already doing it

#

system.currenttimemillis

inner valley
#

I thought what do you mean but I already did it

proud pebble
#

can i ask what the cooldown is supposed to prevent?

inner valley
#

I have a separate class for the countdown timer in the screen maybe that's the problem

proud pebble
#

what is the plugin doing?

inner valley
#

It does bring a countdown timer in my screen when I right click sand

#

but with the cooldown the cooldown message is sended but he doesn't cancel the event

sage thorn
#

hey, how can i read something from file? like deluxemenu has so you create new menu in a config and it reads it

inner valley
#

it doesn't cancel the countdown timer

inner valley
#

it doesn't stop the contdown timer on run

#

Does anyone know the problem?

sage thorn
sage thorn
#

deluxemenus was a example

broken elbow
#

oh

#

my bad

inner valley
#

problem solved^^

#

I had to "return;" put underneath

lyric gyro
#

I can get the loaded plugins

#

PluginManager#getPlugins?

#

ya those are loaded plugins

#

I wanna check if a plugin is enabled

#

oh I misread the q

#

if there's anything like Plugin#isEnabled() or PluginManager#isEnabled(String) etc or similar then that would be it

#

nope

#

doesn't have that

#

then it's not a thing on bungee

#

Ahh

#

F

#

than how does bungee handles depends?

#

it renders the dependency tree before loading and enabling each plugin

#

once the dependency tree is built it iterates through it, orderly, to load and enable each one

#

Ahhh dang

#

that's the same case on any platform as well, fabric, bukkit, sponge, velocity, ...

#

hmm got it the problem is my extensions can't have something like that cause my plugin don't handle the load and enable thing

limber hedge
#

Anyone know how I can add a color gradient to a string?

shell moon
#

After using
while(matcher.find()){
//Should i use here matcher.group(0) or 1?
}
Can someone explain? eyes_shake

#

and whats the difference with matcher.group()

dusky harness
#

(just a guess)

shell moon
#

I'm using replaceText method from adventure and it has

component.replaceText(TextReplacementConfig.builder().match(textPattern).replacement((matchResult, builder) -> {

#

not sure what should i use to get the matched string by regex

loud sorrel
#

Hey guys, I'm working on a plugin rn and it's my first time using my custom api. It has various methods and objects like Timers and an ItemBuilder, just misc stuff that I use to be more efficient. I have shaded my jar, though I'm getting a NoClassDefFoundError error when loading the plugin. FYI, I have an objected called KatCore which extends JavaPlugin and has random methods like "registerCommands", "registerEvents", etc.

#

Any ideas?

#

?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

loud sorrel
leaden sinew
loud sorrel
#

No, I'm shading the plugin. It's a custom api so I don't want other players to have to download it.

#

I'm fairly new to shading though, could that be the issue? I've been researching it but I can't tell if I'm missing anything

leaden sinew
#

I don't remember much about maven, I use Gradle

loud sorrel
#

Ah ok

#

Any other ideas of why it may be failing? I don't think I did it wrong, but I'm not sure

leaden sinew
#

How are you building it?
Are you doing maven package?

loud sorrel
#

Yes

#

also, the output file name has "-shaded" in it, so I know it was shaded

leaden sinew
#

Dependencies with system are similar to ones with scope provided.

#

Try removing that possibly

loud sorrel
#

ok

#

I'm trying a new method rn, but I'll do that one next

#

nvm it didn't work

#

I'll try that

#

Process terminated 😦

leaden sinew
#

What was the error?

loud sorrel
#

That haha, unfortunately that was all i got

#

"Proccess terminated"

#

within Intellij, it wouldn't compile

#

Also, I tried doing running "shade" plugin in the maven tab and it said this:

#

Failed to create shaded artifact, project main artifact does not exist.

#

What does that mean?

leaden sinew
#

Try adding this to your repositories

  <repository>
    <id>repo</id>
    <url>${basedir}/src/libs/KatCore-1.0-SNAPSHOT.jar</url>
  </repository>
#

And keeping what I said before

loud sorrel
#

ok

leaden sinew
#

And removing <systemPath>

loud sorrel
#

And version, bc it marked it as an error

#

Or would I just mark it as provided like with the spigot import?

leaden sinew
#

Which part?

loud sorrel
#

<version> was marked as an error after i did what you said. I removed it and got process terminated

leaden sinew
#

Could you show which part?

#

Was it

        <dependency>
            <groupId>com.katnissali</groupId>
            <artifactId>KatCore</artifactId>
            <version>1.0</version>
```?
loud sorrel
#

Yes, the version tag

#

Also, I found this warning: 'dependencies.dependency.systemPath' for com.katnissali:KatCore:jar should not point at files within the project directory, ${basedir}/src/libs/KatCore-1.0-SNAPSHOT.jar will be unresolvable by dependent projects @ line 81, column 25

loud sorrel
#

Ok, so I have to add the maven install plugin one sec

#

Still got an error 😦

leaden sinew
#

Switching to Gradle may be easier lol

loud sorrel
#

haha

#

So any other ideas?

leaden sinew
#

Not really sorry, other than adding it to a remote repository

loud sorrel
#

Ok thanks anyway

shell moon
dense drift
#

if you have a regex like \d+ and a string aa11bb22cc33 each loop will give you a group of numbers. So matcher.group() will be 11 then 22 and then 33, each of them being an individual match

#

group(index) is used when you have matching groups.
For example, lets use a derialized location world_name;x;y;z world;1;2;3 and the regex (\w+);(\d+);(\d+);(\d+).
0 (or matcher#group()). world_name;x;y;z world;1;2;3

  1. world_name world
  2. x 1
  3. y 2
  4. z 3
#

@shell moon

shell moon
#

So basically to get the full matched i simply need group() right?

dense drift
#

yes

shell moon
#

What i have this: world_name;5;6;7 world;1;2;3

#

That as string

#

How would i get the first location

#

Matcher m = pattern.match(string)
while(m.find()) {
m.group() //return world_name,5;6;7 and the second time returns world;1;2;3?
The first time .group(1 2 3 4) would return world_name 5 6 7 respectively?
}

#

Yessss

dense drift
#

Nice

shell moon
#

Now the question is whats the difference between matcher and matchresult

#

As adventure gives matchresult

#

I guess .group() would return the whole string matched

high edge
#

I mean did you read the method?

#

It's probably documented

shell moon
pulsar ferry
loud sorrel
#

Sorry, what do you mean? I know maven but I am still fairly novice

pulsar ferry
loud sorrel
#

Where would I execute that cmd?

pulsar ferry
#

In the terminal, or if you're using Intellij there is a button on the maven tab to execute commands

loud sorrel
#

Oh man I think i figured it out. Not sure yet (nor how i did it) but it might work

green sky
#

I am trying to get a placeholder from another plugin to use it in mine, but I can't find any info online, can someone help me with this?

forest jay
#

how can I change the name tag above a player?

#

I know it has something to do with packets, I just couldnt find any tutorials that worked

green sky
#

I use it and it works

forest jay
#

I want it built into my plugin and customizable from my code

#

does TAB have a API?

green sky
#

i donth think so

#

but it can use placeholders

dusky harness
forest jay
#

I figured it out

dusky harness
#

ooh

#

how'd you do it?

forest jay
#

I used teams and scoreboards

dusky harness
#

did it work?

forest jay
#

I set the prefix for the team to the rank of the player

#

yeah

#

it works

dusky harness
#

show code :))

forest jay
#

heres the api

#

use that

dusky harness
#

ah

#

wait tablist?

#

oh

#

oh i thought u meant another nametag

#

above the nametag

forest jay
#

yeah, this edits the text above a players head. there should be a folder called api, just use the NameManagerAPI class in there, I modified it a bit for my use, but it should do the job.

#

not tablist

dusky harness
#

wait im confused xD

forest jay
#

you can make it effect tablist

dusky harness
#

the player's nametag or a nametag above the player's nametag?

forest jay
#

players nametag

dusky harness
#

ah

#

rip ☹️

neat pierBOT
#
FAQ Answer:
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait

Source

forest jay
dusky harness
#

oh? 👀

forest jay
#

I think

void orchid
#

are you using flex?

#

display: flex

#

flexbox

#

never mind then

formal crane
#

How can i use placeholders like %luckperms_primary_group_name% in my plugin?

broken elbow
#

you use the PlaceholderAPI#setPlaceholders method

formal crane
#

i tried:

        String playerRank = "%luckperms_primary_group_name%";
        playerRank = PlaceholderAPI.setPlaceholders(p, playerRank);
        e.setFormat(Format.chat("&8[" + playerRank + "&8] " + p.getName() + "&7: " + ChatColor.RESET + e.getMessage()));``` but got this error https://paste.helpch.at/fitiyocano.cs
#

oh wait

broken elbow
#

you need to give it a string format

formal crane
#

forgot to download the expansion

broken elbow
#

or that I guess

formal crane
#

ty for helping 🙂

broken elbow
#

oh makes sense. it was searching for a string format %l

#

and that's not valid

wooden loom
#

do anyone know a good tutorial online about how to create and use your own api?

graceful hedge
#

Hmm, it’s just a set of classes (usually interfaces) which specifies a behavior, that you can depend on in another module/plugin. The idea is to hide implementation details such that when they change, the api goes mostly unaffected by the change.

wooden loom
#

yeah, but I don't know how to connect the api with a new plugin I make.. So I don't know how to connect the api via maven with my new plugin

graceful hedge
#

Publish to maven local

wooden loom
#

is there a tutorial for on youtube or something?

graceful hedge
#

Hmm nope, although there exist many in real life practice references on places like GitHub and such.

There probably exists yt tuts. Just don’t know any.

wooden loom
#

ah okey

quartz ledge
#

Hey, I'm making a clickable menu with armorstands, I got everything, unless a little detail I want to add: that when your cursor is targetting a item, it gets closer to you

#

Thanks!

loud sorrel
#

Could someone show me how to publish to maven central? thx

alpine goblet
#

help me

lyric gyro
median glen
#

Hi guys I'd like to ask for help, how can I see javadocs and sources in the IDE for the spigot api?

#

Ah I just found out, right click pom.xml and Maven -> download sources and documentation.

lyric gyro
#

How do i setup shadowjar to my minecraft plugin? Using gradle

brittle thunder
#

Add the plugin

dusky harness
brittle thunder
#

thats pretty much it

dusky harness
#

yugi

brittle thunder
#

yes?

dusky harness
#

any update to slimjar? fingerguns

brittle thunder
#

Im removing the mirror and just pointing directly to central

#

Oracle is too much of a hassle to deal with

dusky harness
#

if you want i can help with maven central unless you can figure it out by yourself 🤷

#

or i can just send u a website that makes the process more clear

brittle thunder
#

dw, I'll let you know if I find any issues, thanks 😄

dusky harness
#

alr

broken elbow
#

imagine dkim helping

#

yugi

dusky harness
#

i was so close 😩

#

lol

sudden sand
dusky harness
#

😌

sudden sand
#

gradle supremacy

lyric gyro
dusky harness
lyric gyro
#

I have done that already

dusky harness
#

then gradlew shadowJar/gradle shadowJar or Gradle Button (in sidebar) -> Tasks -> shadow -> shadowJar

lyric gyro
#

I thought it was on the website

#

Now i feel dumb

#

Just did that

dusky harness
#

then build/libs/YourPlugin-Version-all.jar

lyric gyro
#

I don't see a YourPlugin-Version-all.jar file at all

dusky harness
#

did you run the shadowJar task?

lyric gyro
#

Yep

dusky harness
#

are there any files in build/libs?

lyric gyro
#

It took time

#

Now it is there

#

I guess the file to use is SoundyMain-0.1-all.jar

dusky harness
#

yep

lyric gyro
#

Thank you so much

dusky harness
#

np

proud pebble
#

lets say i wanted to store a username and password in a database, where would i store the salt,

from the places ive looked they suggest just storing it with the user and pass hash,

username | salt | hash

#

is this a good idea or would storing it elsewhere be better?

broken elbow
#

well. the whole idea of salt is for people to not be able to just guess the password by checking the hashes against each other. if you store the salt there, its like you didn't use it at all

lyric gyro
#

not really?

#

Salts just prevent from checking passwords against a pre-computed hash map

broken elbow
#

exactly. but if they got the salt and the hash

#

oh wait

#

Ic

#

what you mean

lyric gyro
#

If someone manages to retrieve the hashes + salts they would need to compute every possible password hash + your specific salt just to get your password

#

And they can't even use it to compare if it's the same as someone else's

broken elbow
#

yeah yeah. makes sense

lyric gyro
loud sorrel
#

Hey, I'm having this very strange thing w maven rn. I added a debug line earlier to my custom api which is included in a plugin I'm making. Now, though I removed it, it still prints. I've removed the line, recompiled the plugin, and replaced the file in my new plugin. I have even decompiled the api before adding it to check and there is no debug line. Yet, every time I compile the plugin again and decompile to check, the line is still there! I have no idea where it is getting the old .jar of my api, can someone help? Here's my pom: https://paste.helpch.at/sijufasufu.xml

#

I have tried everything: restarting my computer, importing the api manually through file explorer while intellij was closed, the file with the debug line doesn't even exist anymore so I have no idea why this is happpening

lyric gyro
#

I’m assuming you need to shade the jar

loud sorrel
#

I am

#

It is pulling the old version with the deubg line

#

Even though the file doesn't exist

lyric gyro
#

You need to replace it with the right jar then

loud sorrel
#

I even tried reverting both projects (the api and current plugin) back to the initial commit in github (which was about an hour back) and it still didn't work

lyric gyro
#

If you’re recompiling your api it shouldn’t have your debug line

loud sorrel
#

I did. I compiled my api, checked it with a decompiler to make sure the line was gone, then added it. I compiled my new plugin and checked it w the decompiler, it had the line.

#

That's what I mean, maven is taking the wrong file but I don't even know what file it is because it's gone.

lyric gyro
#

Code does not lie in that sense. You’re local depending on your api anyways so I’m confused.

loud sorrel
#

Wdym local on my api

lyric gyro
#

KatCore?

loud sorrel
#

Yes, I know it must be getting it from somewhere but I can't figure it out, or maybe maven has it stashed away somewhere

#

Yes, my api

lyric gyro
#

Just look for it in your external libraries

#

And if it has a little arrow

#

Or look in your libs folder

loud sorrel
#

Yep, I did that, it doesn't have the debug line

lyric gyro
#

Try changing group id and artifact :3

#

Not much I can do tbh. It seems more a simple user error somewhere

loud sorrel
#

Yeah. Wdym, changing it where

lyric gyro
#

In your pom and in your “api”

loud sorrel
#

But do you mean the folder names or in the pom of my api?

lyric gyro
#

Is your api a maven project?

#

If so you shouldn’t be depending on a local jar then

loud sorrel
#

Yes it is

#

Wdym?

lyric gyro
#

How you have system path

#

Delete that

#

Make your scope compile

loud sorrel
#

ok

#

The project me.katnissali:PluginManager:1.0-SNAPSHOT (C:\Users\curly\IdeaProjects\PluginManager\pom.xml) has 1 error
[ERROR] 'dependencies.dependency.systemPath' for com.katnissali:KatCore:jar must be omitted. This field may only be specified for a dependency with system scope. @ line 84, column 25
[ERROR]

lyric gyro
#

Make your scope

#

Compile

loud sorrel
#

I did

#

that was the error

lyric gyro
#

Delete system path

loud sorrel
#

ok

#

should i make a repo for it then, bc it's not going to know where to find the file

lyric gyro
#

That’s the point of maven

#

When you compile something with maven it’ll place it into your .m2 folder

#

So you can then just depend on it somewhere else. No need to actually have the jar to depend on hand

loud sorrel
#

Ohhh how do I make it place it in the .m2 folder

#

Maybe that's where its getting the file from

lyric gyro
#

It already is

loud sorrel
#

Sorry, I'm a bit new with maven

lyric gyro
#

If you compiled your api with maven it’s in your .m2

#

Everytime you compile noe it’ll update for your other projects

loud sorrel
#

I found it! (i think) I found the file in my .m2 folder and decompiled it. low and behold it had the debug msg 😄

lyric gyro
#

Yep meaning you never recompiled your project

#

And you were depending on it wrong

loud sorrel
#

Yeah. So I tried recompiling the project and it's not generating a new .jar in my m2 folder

lyric gyro
#

Show your apis pom

loud sorrel
#

Ok

lyric gyro
#

And you’re running mvn clean install or package?

loud sorrel
#

Yes package

#

I occasionally run clean to rule out any other bug causes, but install causes a wierd bug for my plugin

lyric gyro
#

That’s not good

loud sorrel
#

It makes spigot go all haywire and I cant import inventory objects

#

So I had to import it manually with systemPath

#

That seemed to work

lyric gyro
#

Definitely some diff under lying problem

loud sorrel
#

If I do it with repo and provided scope it doesn't work

lyric gyro
#

I personally don’t even use maven. Shit sucks tbh

#

Gradle > all. Which still uses your .m2

loud sorrel
#

Any suggestions?

lyric gyro
#

Your core should be building to your .m2

#

If it built there in the first place

loud sorrel
#

Wdym, sorry

lyric gyro
#

Every time you run mvn install it should be replacing the jar

#

As long as you changed something iirc

#

Or that’s just gradle

loud sorrel
#

Ok so I did that and it updated

#

Theres a new file in m2

#

Hey you there?

lyric gyro
#

Gg now it should work fine

#

From your other plugins

loud sorrel
#

Uh I still have that error though

pure rampart
#
public class KickCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player) {
            Player p = (Player) sender;
            if (p.hasPermission("punishments.kick")) {
                if(args.length == 2) {
                    if (Bukkit.getPlayer(args[0]).isOnline()){
                        Player a = Bukkit.getPlayer(args[0]);
                        TextComponent KickMessage = new TextComponent();
                        KickMessage.setText("You Have been kicked");
                        a.kick(KickMessage);
                    } else {
                        p.sendMessage("Player is not online");
                    }
#

'kick(net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component)' in 'org.bukkit.entity.Player' cannot be applied to '(net.md_5.bungee.api.chat.TextComponent)'

#

i get this error

lyric gyro
#

You are using the wrong component

pure rampart
#

oh

#

which component is it?

lyric gyro
#

Says it in the error 🙂

pure rampart
#

chief if i knew what was going on i wouldnt be here in the first place

loud sorrel
#

Hey quick question, how should I import my api if I'm not doing it by local jar?

#

Bc now its not shaded

#

the api files aren't showing up in the decompiler

void orchid
#

what is your group id + artifact for your API?

loud sorrel
#

api is com.katnissali

void orchid
#

that doesn't seem right... could you paste your api's pom in here?

formal crane
#

How could i make this shorter?

        list.add(Material.IRON_ORE);
        list.add(Material.GOLD_ORE);
        list.add(Material.LAPIS_ORE);
        list.add(Material.DIAMOND_ORE);```
void orchid
formal crane
#

but its only for those specific ores

dusky harness
#

you could do list.addAll(Arrays.asList(Material.COAL_ORE, Material.IRON_ORE))

void orchid
#

or that ^

loud sorrel
void orchid
#

it's not included because your api's scope is "provided"

#

change it to "compile" if you want maven to include the API to your plugin

loud sorrel
#

ok

#

i think its gonna work 😄

#

give it a sec though

#

omg tysm you solved both my problems

void orchid
#

you're welcome :)

formal crane
#

So i have this hashmap in my main:
public static HashMap<Material, Double> grindCoins = new HashMap<>();
I also add some things in the hashmap in the onEnable:

grindCoins.put(Material.IRON_ORE, 16.70);
grindCoins.put(Material.GOLD_ORE, 18.00);
grindCoins.put(Material.LAPIS_ORE, 20.00);
grindCoins.put(Material.DIAMOND_ORE, 23.50);```
And i try to use this hashmap in a other class but it is null:
```rsGrinding.grindCoins.get(e.getBlock().getType())```
And i wouldnt know why its null, anyone that could help?
#

oh

dusky harness
#

public static hashmap 🥶
rsGrinding might be null

formal crane
#

is this static abuse?

dusky harness
#

yes

formal crane
#

Is static abuse bad or is it just a coding rule?

dusky harness
#

well there are no coding rules

#

but it's bad practice to do so

#

(and it's bad to have public fields too)

but going back on topic, try printing out System.out.println("is null: " + rsGrinding == null)

formal crane
#

How do i get lists & main instances without static abuse?

formal crane
dusky harness
#

oh 🥲

#

alr

dusky harness
# formal crane How do i get lists & main instances without static abuse?
public final class CoolPlugin extends JavaPlugin {
    private Map<Material, Double> grindCoins = new HashMap<>();

    @Override
    public void onEnable() {
        final Other other = new Other(this); // Other(this) = constructor - look below
        other.method();
    }

    public Map<Material, Double> getGrindCoins() { 
        return grindCoins; // can be generated in IJ using Alt + Insert
    }
}

public final class Other {
    private final CoolPlugin plugin;

    public Other(CoolPlugin plugin) { // a constructor, notice above it's new Other(this), this = CoolPlugin instance
        this.plugin = plugin; // asigning it to a field above
    }

    public void method() {
        plugin.getGrindCoins().add(Material.IRON_ORE, 5.0);
    }
}
#

(also known as Dependency Injection since you're "injecting" the CoolPlugin "dependency" to Other)

formal crane
#

static abuse is easier 🥲

dusky harness
#

🥲

lyric gyro
#

and leads to errors as you might be experiencing

#

easier != better

dusky harness
#

btw emily

lyric gyro
#

gtg byeee

dusky harness
#

oh

#

:(

broken elbow
dusky harness
#

i wanted to give more explanation

trail burrow
#

incompatible types: java.util.Comparator<java.util.Map.Entry<java.lang.Object,V>> cannot be converted to java.util.Comparator<? super java.util.Map.Entry<java.lang.String,java.lang.Integer>> Need a good place to understand this mess

void orchid
#

that's so ugly...

lyric gyro
dusky harness
# lyric gyro Okay I'm back, wachu need

whats the purpose of getters/setters if you don't modify anything else in the getters

or is it just so that if you do need to change it you don't have to change the rest of the code?
and good habits?

brittle thunder
#

pretty much

dusky harness
#

alr

brittle thunder
#

Then theres the case of hiding mutability in some cases

#

Which falls into the same pit ig

lyric gyro
#

Yeah it's so you can do changes in the future to the getter/setter without it being ABI breaking

#

I mean it's not for that exclusively

brittle thunder
#

A🅱️ I

lyric gyro
#

But it's one of the advantages

brittle thunder
#

😌

#

The setter also allows validation on the set values

#

So someone doesnt just go around setting unnatural values to your fields

lyric gyro
#

Yeah

#

Like null 🥶

dusky harness
#

kotlin 😌

lyric gyro
#

Hot garbage

sterile hinge
#

null is only an issue when misused tbh

lyric gyro
#

the billion dollar mistake

broken elbow
#

null is only an issue when the null pointer points to it tbh

sterile hinge
#

it would be worse if the null pointer would point to a valid reference

lyric gyro
#
for(String s : plugin.getConfig().getStringList('board.body')){

            }``` Long time since i did this, but why does `board.body` return `Too many characters in character literal`
pure crater
#

Strings are defined as quotations

#

not single quotation marks

dusky harness
#

" = String, ' = character

pure crater
#

Hah slow

#

jkjk

broken elbow
lyric gyro
#

Stuff like lists , lower level classes, and shit you can pass through constructors from your main class.

trail burrow
#

this don't work (Map)this.leaderboard.entrySet().stream().sorted(Entry.comparingByValue().reversed()).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> {return e1;}, LinkedHashMap::new));
this does (Map)this.leaderboard.entrySet().stream().sorted(Entry.comparingByValue()).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> {return e1;}, LinkedHashMap::new));I need the list to be in reverse?

lyric gyro
#

How would i use .replace() in a arrayList?

graceful hedge
#

you got List::replaceAll

#

so basically
list.replaceAll(element -> {
return blah;
});

#

and then if you just want to keep an element, return the argument

digital mesa
#

Hi! I'm trying to update a plugin that's not working on 1.17.1 and the developer is no longer actively developing the plugin. It works fine on 1.16.5. The plugin in question is called "Alchema" and uses cauldrons to let the player craft different items by just throwing them into the cauldron while it's heated up and filled with water. This exception is generated by the plugin whenever a cauldron is placed in the world, any idea why this is?

#
        at wtf.choco.alchema.cauldron.AlchemicalCauldron.canHeatUp(AlchemicalCauldron.java:312) ~[Alchema-1.1.3_Test.jar:?]
        at wtf.choco.alchema.cauldron.AlchemicalCauldron.update(AlchemicalCauldron.java:498) ~[Alchema-1.1.3_Test.jar:?]
        at wtf.choco.alchema.cauldron.CauldronUpdateHandler.run(CauldronUpdateHandler.java:86) ~[Alchema-1.1.3_Test.jar:?]
        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.17.1.jar:git-Paper-388]
        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[patched_1.17.1.jar:git-Paper-388]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1567) ~[patched_1.17.1.jar:git-Paper-388]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:490) ~[patched_1.17.1.jar:git-Paper-388]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1483) ~[patched_1.17.1.jar:git-Paper-388]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1282) ~[patched_1.17.1.jar:git-Paper-388]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-388]
        at java.lang.Thread.run(Thread.java:831) ~[?:?]```
#

There's also this, if the cauldron is filled with water to the max.

tight junco
#

okay i need help

#

kotlin is being dumb

graceful hedge
#

run dekotlin

#

and convert to java

tight junco
#

no

neat pierBOT
#
FAQ Answer:
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait

Source

dusky harness
#

:)

tight junco
#

shut up dkim

#

this function in java

#

fine

#

in kotlin, shit itself

icy shadow
#

kotlin bad

tight junco
#

you people are helpful

lyric gyro
#

kotlin bad

broken elbow
#

one of these days I'll just start abusing my mute powers

#

lol

pulsar ferry
lyric gyro
icy shadow
#

so true bestie

tight junco
steel silo
tight junco
#

just tell you how to make the entire plugin

steel silo
#

oui

lyric gyro
#
List<Entry> builder = new EntryBuilder().build();

            for(String s : plugin.getConfig().getStringList("board.body")){
                builder.next(s
                        .replace("[", "")
                        .replace(", ", "")
                        .replace("]", ""));
            }``` I have been stuck on this for over an hour now, anyone have an idea how i would do this?
#

do what?

#

Making it add a line to the scoreboard using .next for every line in the config

steel silo
tight junco
#

ima be honest

#

no

steel silo
#

goddamnit alr

tight junco
#

no one is gonna tell you how to make the entire plugin

lyric gyro
#

^

tight junco
#

we're devs, we give vague solutions

icy shadow
#

i am!

icy shadow
#
  1. learn APL
#
  1. profit
tight junco
#
  1. make plugin
  2. stonks
lyric gyro
#

We can help with specific things

steel silo
#

ok

sharp cove
#

Why does it say its a unreachable method?

tight junco
#

because the method is unreachable

sharp cove
#

but why

pure crater
#

you returned before or exited app or something

sharp cove
#

o

#

lol

tight junco
#

does anyone know how much kotlin likes java 17 Susge

sharp cove
#

i am fucking stupid

sharp cove
pure crater
#

np

sharp cove
#

oversaw that lmao

steel silo
#

can someone help me with that

lyric gyro
#
player.sendMessage(staff.getName() + ChatColor.GREEN + " Bans: " + banCount);
```?
spice ore
#

How can I make a placeholder that uses a player name
%placeholder_[player name]_test%

steel silo
#

how would i "staff.getName()"

lyric gyro
#

if you have their ban count then you surely have to have some sort of identifier, either the Player/OfflinePlayer object, the UUID or the player name

steel silo
#

im using litebans connected to a mysql and there is a "banned_by_name" column in the mysql how would i get that banned_by_name and get the ban count for that STAFF member and not the entire bans

stuck rain
lyric gyro
#

how did you get the ban count in the first place?

steel silo
stuck rain
#

Does it take a name or a uuid?

stuck rain
#

Please just answer the question without flooding image links

Looks like it takes a uuid, you can use the mojang player api to convert it to a name object, or if they’re online then Bukkit.getPlayer(<uuid>)

dusky harness
#

is the uuid field a string (varchar) or binary?

steel silo
#

string i think

dusky harness
#

wait

#

banned_by_name is the user that banned the other user

stuck rain
#

^this sounds like a smarter idea lol

steel silo
#

alright i am trying it

steel silo
stuck rain
formal crane
#

How do i use NMS again?

I did the following things but nms isnt working:

  • added mavenCentrak() & mavenlocal()
  • changed 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' to 'org.spigotmc![spigot](https://cdn.discordapp.com/emojis/913903832558346340.webp?size=128 "spigot")1.16.5-R0.1-SNAPSHOT'
  • builded nms using buildtools in a folder on my desktop
dusky harness
#

?

dusky harness
formal crane
#

cant import it aswel

dusky harness
#

whats the error when building/reloading gradle?

formal crane
#

ohw lol its fixed by restarting gradle even tho i already did that twice & i even restarted intellij, ty

lyric gyro
#

you don't need nms for "custom payload" packets btw

formal crane
#

i just use the labymod examples

lyric gyro
#

💀

#

ok lol

steel silo
formal crane
#

but this is weird

#

it worked for 1.12.2

leaden sinew
#

Has anyone had this error Cannot invoke "net.minecraft.nbt.NBTBase.getTypeId()" because "element" is null
While loading ItemStack from a config file? It happens when I do ItemStack#getItemMeta() or ItemStack#toString(),
and ItemStack is not null

#

Nvm I'm dumb

trail burrow
#

this don't work anymore worked for Java8, using Java16 now this.leaderboard = (Map)this.leaderboard.entrySet().stream().sorted(Entry.comparingByValue().reversed()).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> {return e1;}, LinkedHashMap::new));

leaden sinew
#

What's the error?

trail burrow
steel silo
#

@dusky harness

dusky harness
#

nvm

steel silo
#

What

#

@lyric gyro u speak to him

lyric gyro
#
List<Entry> builder = new EntryBuilder().build();

            for(String s : plugin.getConfig().getStringList("board.body")){
                builder.next(s
                        .replace("[", "")
                        .replace(", ", "")
                        .replace("]", ""));
            }``` I have been stuck on this for over an hour now, anyone have an idea how i would do this? The problem is that i'm trying to do .next and add every single piece in `board.body` to the builder which is using ScoreboardLib, does anyone know what would help me solve this issue?
#

What even is the issue?

#

Are you getting an error? Is something not working as expected?

dusky harness
#

how does that even compile tho

#

List#next isn't a thing

broken elbow
#

In C# how would I make a method that would work on all number types? All I do in that method is add and compare. I can't use IComparable since that only has comparation methods

lyric gyro
#
public void scoreboard(Player plr) {

        for (Player player: plr.getServer().getOnlinePlayers()) {
            String title = plugin.getConfig().getString("board.title");

            title = PlaceholderAPI.setPlaceholders(player, title);

            String finalTitle = title;

            ArrayList<String> body = new ArrayList<>(plugin.getConfig().getStringList("board.body"));

            Scoreboard scoreboard = ScoreboardLib.createScoreboard(player)
            .setHandler(new ScoreboardHandler() {



                @Override
                public String getTitle(Player player) {
                    return ChatColor.translateAlternateColorCodes('&', finalTitle);
                }

                @Override
                public List<Entry> getEntries(Player player) {
                    return new EntryBuilder()
                            .next(body.toString()
                                    .replace("[", "")
                                    .replace(", ", "")
                                    .replace("]", ""))
                            .build();
                }
            }).setUpdateInterval(2l);
            scoreboard.activate();
        }
    }``` To be exact, the issue is with getEntries making it add a new line for each line it should add to the scoreboard, this is what i have so far. If that made anymore sense
broken elbow
hard wigeon
#

what's the best way to load all chunks in a world? (that are already generated)

dusky harness
#

👀

hard wigeon
#

yes dkim? 👀

dusky harness
#

thats a lot of chunks

hard wigeon
#

not necicarily

broken elbow
#

nah. ez. just do World#GIveMeAllChunksBczImCool

dusky harness
#

c# naming

#

🤢

broken elbow
#

yes

dusky harness
#

no

broken elbow
#

dkim. you can leave if you don't like it

hard wigeon
dusky harness
#

idk if theres another way

#

¯_(ツ)_/¯

#

but thats how i did it

#

(and the command took a reaaaaaaaaaaaaaally long time to execute)

#

probably because it looped through every block and only used 1 thread

wintry grove
#

ez

dusky harness
#

he needs unloaded chunks

hard wigeon
#

^

wintry grove
#

god damn

#

then idk

#

but I also need help

dusky harness
#

and to prevent a lot of memory being used i'd also recommend using ChunkSnapshots (which i used in line 107) then unloading the chunk afterwards 🤷 (as you can always load them again if needed)

wintry grove
#

how do me get data from annotation in class

#

well actually how I also get the annotation suprakekw

dusky harness
#

1 sec

#

baeldung ftw

hard wigeon
#

that's easier

wintry grove
#

smh

#

well

#

thx

dusky harness
#

or else it'll probably crash the server

#

🙃

dusky harness
#

;-;

wintry grove
#

I'm not that smart to find out how to do it in classes suprakekw

#

atleast atm

dusky harness
wintry grove
#

noice

#

thanks

dusky harness
#

np

lyric gyro
#

isAnnotationPresent smh

wintry grove
lyric gyro
#

It was more of a comment for dkim

dusky harness
#

if it isn't present

#

iirc

pulsar ferry
#

It does not, it throws

#

d;jdk Class#geDeclaredAnnotation

uneven lanternBOT
#
default T getDeclaredAnnotation(Class annotationClass)
throws NullPointerException```
Description:

Returns this element's annotation for the specified type if such an annotation is directly present, else null. This method ignores inherited annotations. (Returns null if no annotations are directly present on this element.)

Since:

1.8

Returns:

this element's annotation for the specified annotation type if directly present on this element, else null

Throws:

NullPointerException - if the given annotation class is null

Parameters:

annotationClass - the Class object corresponding to the annotation type

lyric gyro
#

else null
:mmLol:

#

stfu Clyde thanks for the reminder I'm poor

pulsar ferry
#

That's such a confusing docs, does it throw or not lmao

dusky harness
#

doesn't seem to

#

(Returns null if no annotations are directly present on this element.)

pulsar ferry
#

Yup i was wrong ugh

toxic roost
#

Is there an API for DeluxeTags?

trail burrow
mental cypress
#

No idea Ironic, sorry.

pure crater
mental cypress
toxic roost
#

But it looks like we’re just gonna make a whole plugin ground up anyway

#

Thanks though Glare.

mental cypress
#

Alrighty, sounds good.

knotty cave
#

Hey guys

#

Im allready contact discord

#

Support

#

But not have reply yet

dense drift
#

This is not discord support

knotty cave
#

But not have reply yet

#

Can anyone help me?

brittle thunder
molten wagon
#

is contains in list really slow to use?

wheat carbon
#

depends on list impl

#

arrraylist & linkedlist are o(n) for contains

molten wagon
#

I use List<Integer> but i get like 500ms and more

wheat carbon
#

do you have a lot of integers in the list?

#

also List<Integer> isn't the implementation

molten wagon
#

2

wheat carbon
#

then I highly doubt your 500ms measurement

molten wagon
#

I only use this, so i not set the implementation

    public void setFillSpace(List<Integer> fillSpace) {
        this.fillSpace = fillSpace;
    }
wheat carbon
#

well

#

regardless of that

#

with only 2 elements your list#contains isn't taking 500ms

#

something else is at fault

molten wagon
#

Is not much before that some can make this time. but I will add more places to debug it.
https://paste.helpch.at/edalemegev.cs

[09:23:12 INFO]: time timepreff 0
[09:23:12 INFO]: time after run code 0
[09:23:12 INFO]: time in fillSpace 6
[09:23:13 INFO]: timne for outloop534
[09:23:13 INFO]: time in fillSpace beffore 534
[09:23:13 INFO]: time 0
[09:23:13 INFO]: time timepreff 0
[09:23:13 INFO]: time after run code 0
[09:23:13 INFO]: time in fillSpace 534
[09:23:13 INFO]: time in fillSpace beffore 828
[09:23:13 INFO]: time in fillSpace 828
[09:23:13 INFO]: timne for outloop828
[09:23:13 INFO]: timne 828

wheat carbon
#

yeah I can't help you with that chunk of code

#

but I guarantee you the list isn't at fault

molten wagon
#

Hm is something inside the second for loop some are the problem.

molten wagon
#

Strange when I debug where I load it is like 0ms when I debug that part.

lyric gyro
#

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '}' at line 1
28.11 08:55:56 [Server] WARN at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
28.11 08:55:56 [Server] WARN at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
28.11 08:55:56 [Server] WARN at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
28.11 08:55:56 [Server] WARN at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1200)
28.11 08:55:56 [Server] WARN at litebans.ea.executeQuery(ea.java:115)
28.11 08:55:56 [Server] WARN at litebans.eS.executeQuery(eS.java)
28.11 08:55:56 [Server] WARN at litebans.gl.executeQuery(gl.java:13)

brittle thunder
#

What function should be used in a copy task for an absoute directory?

#

file always seems to provide an relative* one

#

oh wait nvm

#

got it

sterile hinge
molten wagon
sterile hinge
molten wagon
cinder forum
#

hi, should be sql operations async always or its not needed for smaller stuff

bright heath
#

how can i make a leaderboard type placeholder eg. leaderboard_position_1

sterile hinge
dusky harness
#
val world = Bukkit.getWorlds().first().checkNull("world")
val tempHandle = world::class.java.getMethod("getHandle").checkNull("tempHandle")
val tempEntity =
    tempHandle.invoke(world)::class.java.getMethod("getEntity", UUID::class.java).checkNull("tempEntity")
val entity = world.spawn(Location(world, 0.0, 150.0, 0.0), ArmorStand::class.java).checkNull("entity")
entity.isVisible = false
entity.setGravity(false) // just to be safe idk
val tempBukkitEntity = tempEntity.invoke(
    tempHandle.invoke(world).checkNull("tempHandle invoked"), entity.uniqueId
).checkNull("tempEntity invoked")::class.java.getMethod("getBukkitEntity").checkNull("tempBukkitEntity")
```anyone know why this errors out with `tempEntity invoked is null`?

example code using nms (but I'd prefer to use reflection): ```kt
val world = Bukkit.getWorlds().first()
val entity = world.spawn(Location(world, 0.0, 150.0, 0.0), ArmorStand::class.java)
val retrievedEntity = (world as CraftWorld).handle.getEntity(entity.uniqueId)
trail burrow
sterile hinge
dusky harness
#

hm

sterile hinge
#

not sure why you don't just access the nms entity through CraftEntity

dense drift
#

Thats very odd @trail burrow

#

The values are indeed inversed and are't random but int min and max values

trail burrow
#

yes it is. looks like a spigot issue not a plugin top me

#

the cords are where the play logs in

dense drift
#

How did you got there

alpine goblet
#

how rewards bot join

trail burrow
#

via bungee and thats where they logged out

sterile hinge
#

not sure if paper fixes these issues, but it's basically a vanilla problem

dense drift
#

Uh no idea, but it is weird

trail burrow
#

I think it might have something to do with BentoBox

formal crane
#

Is there a documentation on modules?

pure crater
#

you have to be more specific

sharp cove
#

This pops up when you try to connect to a server thats down.

sharp cove
#

Nvm did it with WinRAR or ZIP.

dense drift
sudden sand
#

does someone know how can I use the mojang mapping for 1.17.1 on gradle (I'm mean like "remap" the dependency at the compiling)

dense galleon
#

How can I cancel a Runnable task?

#

I have a class implementing Runnable, but I have no clue how to stop that runnable

#

since cancel() doesn't exist

#
 @Override
    public void run() {
        Thread.currentThread().interrupt();
        ```?
#

Like that?

lyric gyro
#

what ..?

#

what's the context of this?

#

is this a bukkit task?

dense galleon
#

No

lyric gyro
#

how are you starting it?

dense galleon
#

It's a runnable task

#

Bukkit.getScheduler().runTaskTimer(plugin, runnable, 0, 1);

lyric gyro
#

so it is a bukkit task

dense galleon
#

Idk it doesn't implement BukkitTask

lyric gyro
#

make it a Consumer<BukkitTask> if you want it to cancel itself; it takes the BukkitTask from which you can call cancel on

dense galleon
#

A what now

#

I remember someone mentioning that but I couldn't understand what a consumer task is

#

Should it implement Consumer<BukkitTask> instead of Runnable?

lyric gyro
#

For this case, yes

dense galleon
#

What do I override..?

lyric gyro
#

the only method there is to override

dense galleon
#

What do I do with accept though

#

Doesn't look like something that runs every X times

lyric gyro
#

neither does a Runnable on its own

dense galleon
#

i mean at least the Runnable looks like it runs something

#

accept doesn't sound like it does 😂

lyric gyro
#

it's the fact that you pass it to the bukkit scheduler that calls it periodically

#

not the name

dense galleon
#

I don't follow what I should be writing in the method

lyric gyro
#

it's the exact same thing but it takes the BukkitTask itself

#

you cancel it whenever you want

#

inside itself

dense drift
#

Caused by: FieldAccessException: No field with type int exists in class PacketPlayOutBlockChange.
how do you view nms source code for paper? 😅

dense galleon
#

Okay but do I write what I had in my run() method then?

lyric gyro
#

it's literally the exact same thing

#

oh my god

dense galleon
#

So I do

#

Or what

lyric gyro
#

???

#

so you do what?

dense galleon
#

Write what I had in my run() method in the accept(BukkitTask task) method?

#

I don't know how this works

lyric gyro
#

what do you want to do

dense galleon
#

Run my code once a tick

lyric gyro
#

until..?

dense galleon
#

Until a mob dies

lyric gyro
#

so you want to cancel the task when the mob dies

dense galleon
#

Yeah

lyric gyro
#

how do you determine when the mob is dead? in an event listener or what?

dense galleon
#

I mean... mob.isDead()

#

I had an instance of the mob in the runnable class

lyric gyro
#

Right, so inside the task you check if the mob is dead and if it is, you want to cancel the task

dense galleon
#

Yeah but I don't get it still

#

Do I write that inside of the accept method..?

lyric gyro
#

yes

dense galleon
#

And then task.cancel()?

lyric gyro
#

it's literally

#

literally the exact same thing

#

but you get the task itself if you want to cancel it from within

dense galleon
#

This feels weird but alright I'll give it a try

lyric gyro
#

weird how?

dense galleon
#

I don't get how task.cancel() will prevent the code in accept() from running

#

A runnable felt more intuitive as I wrote the code in the run() method, and if I wrote cancel() in there then the code wouldn't run anymore

lyric gyro
#

it cancels the task so the scheduler does not call it anymore

dense galleon
#

How do I start the task though

lyric gyro
#

with.. the scheduler?

dense galleon
#

Bukkit.getScheduler().runTaskTimer(plugin, mobTask, 0, 1); cause this gives an error

lyric gyro
#

what does it say

dense galleon
#

that it cannot resolve the method, one of the parameters is wrong but they shouldn't be

dense galleon
#

Ah

#

java.util.function.Consumer

#

not bukkit.util.Consumer

lyric gyro
#

💀

#

fuck bukkit

dense galleon
#

I assumed it was the bukkit one

lyric gyro
#

I don't even know where and if that one is ever used

dense galleon
#

Alright guess it works, thank you

proud pebble
#

i place an item on slot 19 in a custom chest inventory, it takes the item on the cursor at the time which could be any item and then adds that item to my hashmap

i click slot 49 or i close the inventory and it returns the value of the itemstack thats in that hashmap. the itemstack it returns is always AIR, which from what ive done should never be possible.

#

im stumped at this point why this is happening

#

as the method to set the value of this itemstack is called only once and has an if statement checking if its material.air

#

inside of the if statement starting at line 29 the value is what i expect

#

everywhere else out of that if statement is just Material.AIR

proud pebble
#

getcursor was the problem...

fringe crystal
#
    public static void dropItem(ItemStack item, Location loc) {
        Bukkit.getScheduler().scheduleSyncDelayedTask(ViperUHC.getInstance(), () -> loc.getWorld().dropItemNaturally(loc, item), 1);
    }```
#

can someone explain why this doesn't work?

#

The itemstack isn't air, and it is being ran

sterile hinge
#

not sure if every material can be dropped

fringe crystal
#

Have tried with various Materials

#

Also I'm pretty sure everything except Air can be dropped

cinder forum
#

Hi guys, I want to display MC server data in real time. Let's say chat. Backend is in Go so

  1. what is best way to send data from Java to Go?
  2. what is best way to display messages in real time without refreshing site? Websocket?
dusky harness
#
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getFileSystem()" because "path" is null
    at java.base/java.nio.file.Files.provider(Files.java:105)
    at java.base/java.nio.file.Files.exists(Files.java:2512)
```uhh anyone know why this is happening?
lyric gyro
#

"path" is null

dusky harness
#

oh

#

wait why is it null

#

🤔

#

File("config.yml").toPath().parent prints null

sterile hinge
#

read the docs

lyric gyro
#

:^)

dusky harness
#

but it does have a parent ;-;

sterile hinge
#

config.yml does not have a parent, something/config.yml has a parent

dusky harness
#

or do i have to use the absolute path

#

ohhh

#

ic

lyric gyro
#

electric blue sirywell

dusky harness
#

File(File("config.yml").absolutePath)

#

:))

lyric gyro
#

...

#

the fuck are you doing

dusky harness
#

how else do i fix

icy shadow
#

what in the fuck

dusky harness
#

oh

#

absoluteFile

icy shadow
#

im sorry thats going in the album

dusky harness
#

whoops

#

NO

lyric gyro
#

HAHA

#

yes

dusky harness
#

NO
NO

#

NO

#

AAAA

sterile hinge
dusky harness
#

😖

icy shadow
#

unlucky

lyric gyro
pure crater
#

use Path next time

lyric gyro
#

Alongside 6

pure crater
#

File 🤮

sterile hinge
lyric gyro
#

yes

stuck rain
#

Is there a way to set the servers view distance, while its running?

mental cypress
#

I think Paper has a world.setNoTickViewDistance() method, but I'm unsure of how well it works while the server is running.

#

I'd assume it does given that it's a method.

stuck rain
#

whats the difference between setViewDistance & setNoTickViewDistance?

cinder forum
#

no tick = you see it but the chunks are not ticked (plants arent growing etc.)

#

like nothingh is happening in them

stuck rain
#

ah alright thanks

cinder forum
#

is ok to make getConnection method (sql connection) static?

warm steppe
#

probably not, but eh, i do it and really who cares

icy shadow
#

so based

loud sorrel
#

Hey, I'm working on a plugin management plugin. It has to download plugins from spigot (w a link). I Fixed a 403 error, but now I need to fix a 503 error bc cloud fare is blocking me. I've experimented with different user-agents. Any suggestions?

hard wigeon
#

out of curiosity, would this work?

#

I asked copilot to do it, and it gave me that

dense drift
#

Afaik no

hard wigeon
#

👍

dense drift
#

But give it a try

#

So you typed the comment and it made the code or?

loud sorrel
#

Idk if it would work, but fyi, you wouldn't need to set the item stack again

#

Does anyone have a solution for my issue above?

pulsar ferry
#

Cloudflare makes working with spigot really annoying

hard wigeon
#

what is the data type of a Shulker Boxes' Block#getData?

lyric gyro
#

probably some combo of facing and color?

hard wigeon
#

how do I create a shulker box and fill it?

#

this doesn't work

                        block.setType(Material.GREEN_SHULKER_BOX);
                        if (!(block instanceof ShulkerBox)) return;
                        ShulkerBox box = (ShulkerBox) block;
                        NamespacedKey key = new NamespacedKey(instance, "spectral");
                        box.getInventory().addItem(new ItemStack(Material.BOW) {{
                            ItemMeta meta = getItemMeta();
                            meta.getPersistentDataContainer().set(key, PersistentDataType.STRING, "true");
                            meta.displayName(MessageUtils.miniMessage("<gold>Spectral Bow"));
                            setItemMeta(meta);
                        }}, new ItemStack(Material.SPECTRAL_ARROW) {{
                            ItemMeta meta = getItemMeta();
                            meta.getPersistentDataContainer().set(key, PersistentDataType.STRING, "true");
                            meta.displayName(MessageUtils.miniMessage("<gold>Spectral Arrow"));
                            setItemMeta(meta);
                        }});```
#

neither does using block.getData()

#

(the block is set, but nothing else)

loud sorrel
brittle thunder
loud sorrel
#

tysm

lyric gyro
hard wigeon
#

yes

#

it's air at the beginning

#

just gotten from coords

#

(and yes the chunk is loaded)

lyric gyro
#

Right, see the superclasses of ShulkerBox

#

and you'll see why that doesn't work

hard wigeon
#

oh I forgot javadocs

#

were... a thing