#development

1 messages ยท Page 88 of 1

river solstice
#

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}

dark garnet
#

thats done in setupAnnoyingAPI with the JavaVersion.VERSION_21 parameter

#

but i added it by itself anyways

#

and still didnt work

river solstice
#

try adding that anyways?

dark garnet
#

ye i did

#

but still didnt work

river solstice
#

weird, no idea then

#

invalidate caches maybe

dark garnet
#

i did and deleted all gradle caches

#

i have no idea where its even getting 17

river solstice
#

whats ur gradle wrapper version

dark garnet
#

8.12

river solstice
#

and whats env var JAVA_HOME set to

dark garnet
#
------------------------------------------------------------
Gradle 8.12
------------------------------------------------------------

Build time:    2024-12-20 15:46:53 UTC
Revision:      a3cacb207fec727859be9354c1937da2e59004c1

Kotlin:        2.0.21
Groovy:        3.0.22
Ant:           Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM:  21.0.2 (GraalVM Community 21.0.2+13-jvmci-23.1-b30)
Daemon JVM:    C:\Program Files\Java\GraalVM 21 (no JDK specified, using current Java home)
OS:            Windows 11 10.0 amd64
dark garnet
river solstice
#

echo %java_home% if on windows

dark garnet
#

changed to regular Java 21, still didnt work

dark garnet
river solstice
#

damn ur project ir cursed or smt

dark garnet
#

๐Ÿ˜ญ

river solstice
#

uh, try going
Settings >
Build, Execution, Deployment >
Build Tools >
Gradle

dark garnet
#

ye i did, i set to project sdk

river solstice
#

๐Ÿ’€

dark garnet
#

but its also not working in cmd prompt so its not an issue with intellij

river solstice
#

thats very odd, out of ideas tbh

dark garnet
#

ok ok

#

its because of my custom paper function

#

i think

river solstice
#

which is?

dark garnet
#

o.m.g.

river solstice
#

thats a classic ig

dark garnet
#

๐Ÿ˜ƒ๐Ÿ˜ƒ

river solstice
#

I was about to say you could explicitly set javac in build.gradle

compileJava.options.fork = true
compileJava.options.forkOptions.executable = '/path_to_javac'

#

tho not sure if that would even help

dark garnet
#

๐Ÿ˜„

#

๐Ÿ™‚

river solstice
#

lol

dark garnet
#

patch isnt 5+ ๐Ÿ˜ญ

river solstice
#

congrats, u found a bug

#

๐Ÿ›

proud pebble
#

wouldnt 1.21 just return java 8?

dark garnet
#

nah 21 > 18

#

so it passes the 1.18 check for java 17

#

ok to check so this doesnt happen again
this is correct, right?

if (version.minor > 20 || (version.minor == 20 && version.patch >= 5)) return JavaVersion.VERSION_21
proud pebble
#

looks right

dark garnet
#

ok imma just account for minecraft 2.x.x while im here ๐Ÿคฃ

#

gonna assume it runs on java 21

proud pebble
#

i have a feeling that itll never go past 1.x

river solstice
#

never gonna happen

#

lol

dark garnet
#

well

#

what about in the next 100 years

#

it might

river solstice
#

we will all be dead by then

dark garnet
#

my code wont be ๐Ÿคž

#

ai will surely need it

river solstice
#

if earth doesn't exist then your code wont either

dark garnet
river solstice
#

maybe in 200 years

dark garnet
#

yeah!

#

oh

neon pewter
#

if we dont destroy earth in the process that is

hoary scarab
#

Anyone make use of Java22 Class File API?

graceful hedge
#

Yea I touched it

hoary scarab
#

Any example usage?
How does it compare to external libs?

graceful hedge
#
  1. I think they had some good examples on their JEP page
  2. No clue, that was the first class file api I touched
#

Used the one from second preview btw

minor summit
#

it's pretty nice

#

it comes as stable in 24

hoary scarab
#

Still not seeing how to just change strings though. Looks like you can manipulate everything else.

minor summit
#

i guess you can find all ldc that point to a string you want and change them to ldc another string you want

#

and then do the same for constant fields and annotations trollface

#

last i checked it didn't let you arbitrarily change the CP

hoary scarab
#

I'm basically mimicking placeholders like spigot.

#

Just trying to modify the strings

minor summit
misty light
#

bump

dense drift
#

override getPlaceholderList

misty light
#

Do you have an example? Or what class is getPlaceholderList? Not finding the right one to override. and I'm looking through various repos like the Player one and I'm not finding any trace of getPlaceholderList

slim vortex
#

Got a question that AI seems to be stuck on. I want to write a local desktop app using: frontend in React/electron, backend in Java. How can I get them to coordinate the port to communicate on and avoid clashes with already bound ports?

ancient nacelle
#

hey, i was trying to get shulkers to scale to 16x size with the scale attribute, but apparently its hard locked at 3. is that something that can be changed server side? do we know?

#

plugins, i mean

worn jasper
#

is your plugin the only plugin present?

#

Uh

#

can you show more logs than just that

#

lol

#

and the code for your gui

dusky harness
#

you need to add api-version to your plugin.yml

#

ex ```yml
api-version: 1.21

worn jasper
#

I'd assume he already had that

#

xD

#

if not uh

#

welp

vast sundial
#

Hello i'm creating plugin for prison and i made an custom pickaxe item but its breaking blocks weirdly and i've tried alot of things, and i was not able to fix it so i need your help.

#

there's the bug

#

can anyone help me please?

vast sundial
#

So what's your issue

viscid veldt
#

alright

#

so

#

im using intellji community edition, and the minecraft development plugin

#

for some reason, I can't build the plugin

vast sundial
#

Yeah I use it too

viscid veldt
#

the run button says "The file in the editor is not runnable"

vast sundial
#

I think I know what ur on

viscid veldt
#

I hope you do

vast sundial
#

U use maven or Gradle to build?

viscid veldt
#

both dont work

vast sundial
#

Ohh

#

So u can't click run button yeah?

viscid veldt
#

yea

vast sundial
#

I watched plugin tutorials

#

And there was something to do

#

Lemme check real quick

vast sundial
#

It should work fine

#

Use maven tho

viscid veldt
vast sundial
viscid veldt
#

โค๏ธ

vast sundial
#

Or u just starting like me?

viscid veldt
#

I started like 5 months ago but then I went over and started Luaua

vast sundial
#

Can you help me with my issue now?

viscid veldt
#

whats your issue

vast sundial
# viscid veldt whats your issue

Like when I'm 1 block away of block I'm breaking it's working good, but if I'm 2 blocks away from the block I'm breaking the hole is in weird position

viscid veldt
#

if I see something that might help I'll try and give it to you

celest patrol
#

Can anyone help me, when I put the placeholder dependency in my plugin this appears:

[WARNING] Failed to download maven-metadata-placeholderapi.xml [https://repo.extendedclip.com/releases/]
[WARNING] Failed to download maven-metadata-placeholderapi.xml [https://repo.extendedclip.com/releases/]
vast sundial
#

The warnings you're seeing indicate that Maven is unable to fetch metadata for the PlaceholderAPI dependency from the repository (https://repo.extendedclip.com/releases/). This could happen if the repository URL is incorrect, down, or if there are connectivity issues. Here's how to troubleshoot and fix the issue:


  1. Correct PlaceholderAPI Repository

Ensure that your pom.xml includes the correct repository for PlaceholderAPI. Replace it with the following:

<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>


  1. Add PlaceholderAPI Dependency

Add the correct PlaceholderAPI dependency in your pom.xml:

<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version> <!-- Use the latest version -->
<scope>provided</scope>
</dependency>


  1. Check Internet Connection

Ensure your internet connection is stable, and Maven can access external repositories.


  1. Force Maven Update

Sometimes, cached metadata can cause issues. Force Maven to update dependencies:

mvn clean install -U


  1. Use a Local JAR File

If the online repository is inaccessible, download the PlaceholderAPI JAR manually from SpigotMC or its Maven repository and add it to your project manually:

  1. Download the JAR file.

  2. Add it to your project in a local libs folder.

  3. Update your pom.xml:

<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/placeholderapi-2.11.3.jar</systemPath>
</dependency>


  1. Verify Repository URL

Test if the repository URL is accessible via a browser:

Go to https://repo.extendedclip.com/content/repositories/placeholderapi/.

If it doesn't load, the repository might be temporarily down. Wait or use the manual JAR method.

#

Try these

celest patrol
dense drift
#

@celest patrolhttps://repo.helpch.at/#/

celest patrol
#

What is this dependency for?

dense drift
#

what?

vast sundial
celest patrol
vast sundial
vast sundial
dense drift
#

alternative for the other repo

vast sundial
#

Like pastebin

celest patrol
#

I accidentally said dependency, it's a repository, what does this repository do?

celest patrol
celest patrol
#

didn't work

#

I think I put the placeholder wrong in the plugin

#

it's not working

#

@dense drift

#

can you help me please

#

Can anyone help me, I put the right dependency in the plugin but the placeholder doesn't work on the scoreboard

woeful tundra
#

Someone help me, I can't put placeholderapi in my plugin, I've already searched in several places including chatgpt

vast sundial
#

Why ur using multi account lol

vast sundial
#

Oh global mute lol

woeful tundra
#

I give up then this placeholder never works

river solstice
#

it works

#

you are just not doing it right

#

dont shift the blame when you yourself dont know how to do it

#

and provide more information rather than "it does not work"

woeful tundra
#

ok

#

Can we talk in private? I can't send a photo here @river solstice

neat pierBOT
woeful tundra
#

I speak Portuguese and I'm using a translator so if I say something wrong...

river solstice
#

I dont help in dms

woeful tundra
vast sundial
wheat ether
#

hi guys i'm trying to integrate placeholderapi into my plugin and i'm running into errors in pom.xml
Dependency 'me.clip:placeholderapi:2.11.6' not found

sterile hinge
#

did you add the repo

wheat ether
#

i did it

#

i fix it

#

thanks

lyric gyro
#

Hey how can I speak to support

serene oyster
woeful tundra
#

Can someone help me? I can't install PlaceholderAPI as a dependency in my plugin. I've searched in many places, even on the official website, but I can't figure it out.

woeful tundra
#

I didn't understand.

#

I speak Portuguese and I am using a translator.

woeful tundra
#

I've been trying to put the placeholder in my plugin for 3 days now.

#

but I can't do it at all

dusky harness
proud pebble
#

can you post your code? or a link to the project on github or something

#

so we can see what youve already done

coarse abyss
#

1eur who solves the issue

proud pebble
#

all i can think is eww to skript

#

arent 1.12 and below ids hard coded? not sure why giving the id for healing 2 would give anything but

proud pebble
woeful tundra
#

Can someone help me put a placeholder in my plugin? If possible in Portuguese please.

digital temple
#

Is there currently a way to communicate with backend servers through Velocity, even if no player is online?

dense drift
#

If you can install something like redis on your server, yes. Plugin messaging requires a player.

digital temple
worn jasper
worn jasper
#

Might be a bit unneeded

#

Db queries are fast enough

dusky harness
#

๐Ÿคจ

#

I'm pretty sure Db queries should be cached
Even if it's redis

dusky harness
serene cairn
#

You can just use SQL or whatever

#

Database queries are not tha slow

#

Just do them async

#

and use CompletableFutures etc

dusky harness
#

Yeah but some stuff needs to be done same tick

#

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

#

Although besides that it should still be done outside of the main thread imo

#

Maybe my wording was confusing so I edited the messages ^

serene cairn
#

Ditch the cache

#

Database queries take less than a second most of the time

dense drift
dusky harness
#

And servers can have like a hundred plugins

#

So you don't want to fill that 0.05s up with a network and database request

dusky harness
#

Especially in events

worn jasper
serene cairn
#

never do db/network stuff on main thread???

worn jasper
#

otherwise, caching is only required in very specific and small cases lol

#

this is not one

worn jasper
dusky harness
#

You don't know the specific use case and they asked specifically for sync/caching

worn jasper
#

well they already said it

#

"economy plugin"

serene cairn
#

and sync is just database

#

u dont need fancy stuff

dusky harness
# worn jasper "economy plugin"

But I mean the specific use case
Also I never said caching is required
You guys are essentially saying caching is definitely not the way to go, which is why I said what I said

dusky harness
serene cairn
#

caching is only good for single server

worn jasper
#

unless you go the "microservice" route

#

and make a rest backend or smt

#

and handle things via that in all servers

worn jasper
#

where it is required? yes, it is not required

#

lol

#

otherwise, db queries take 20-70ms, 100ms at extreme cases maybe, assuming a decently well made DB

#

storing it in cache for those extra few ms that arent even handled in main thread

#

might not be worth it

dusky harness
worn jasper
#

specially since handling caching and cross server stuff, is simply a mess

serene cairn
#

To put it simply: Just use a database and ignore the caching stuff
It's not worth the pain

#

Caching is harder for multiple servers

#

I would only use caches for single servers

worn jasper
#

besides, caching is somewhat of a premature optimization

#

lol

dusky harness
#

Whatever
I'm not going to keep repeating myself so I'll just wait to see when - or if - they elaborate to respond to them directly

nova grail
#

is anyone here good with cheat engine

vast sundial
#

Do I need database for Minecraft server with economy and stats like blocks broken etc?

digital temple
#

I don't use the database directly without caching because third-party plugins use the VaultAPI, and there are no existing async methods. As a result, the main thread freezes whenever a plugin requests a balance or tries to deposit or withdraw something, as they need and wait for the EconomyResponse.
For now, I have implemented a Jedis Pub/Sub system for multi-server communication without the need for a real player (Plugin Message).

  • As a bonus, by using Redis, extreme speeds can be achieved, allowing my economy plugin to process a massive number of users within milliseconds without the main thread ever freezing. This also includes better thread safety.
    @serene cairn @worn jasper @dusky harness
digital temple
vast sundial
#

Only one

#

Trying to make prison server tho

digital temple
vast sundial
#

Then idk yet

digital temple
vast sundial
digital temple
#

than you need mysql/maridb as storage

vast sundial
#

Why I need it tho?

digital temple
#

because sqlite is a local file storage system

vast sundial
#

Can't server write this data in plugins or something?

digital temple
#

data in plugins are always temporarily. If you stop your server, all data is lost

vast sundial
#

Ohh

#

Okay now I get it

digital temple
#

Because this data is stored in the memory, which is a volatile storage.

vast sundial
#

Yh Ik

#

Also if I can ask which plugin is good for multi currencies

#

Like I want tokens and money as a virtual currency

#

But idk what economy plugin to choose

digital temple
#

If you wait few days i release my Economy plugin as Beta ๐Ÿ˜„
Currently its in Alpha

vast sundial
#

Oh cool

digital temple
vast sundial
#

I need like trades with money and tokens inputs

digital temple
vast sundial
digital temple
vast sundial
#

So there will be no scamming

digital temple
#

sign input also supported

vast sundial
#

U make trade plugin along with economy plugin?

digital temple
#

na /pay <name> opens a sign where you can enter the amount of money. If you looking for a Trade plugin, you can use Trade System from Spigot

vast sundial
#

Ik right

digital temple
vast sundial
#

But is trade system compatible with your plugin?

vast sundial
digital temple
worn jasper
digital temple
worn jasper
#

and has full compatibility with vault

#

a plugin

dense drift
worn jasper
#

but fair

digital temple
#

can you send it ?

vast sundial
dense drift
#

They require worse, a player ๐Ÿ™‚

worn jasper
worn jasper
dense drift
#

Meh

#

You can buy aditional ports for 1$ or so

digital temple
dense drift
#

You can't have one size fit all

vast sundial
worn jasper
digital temple
#

1.21.4 latest

worn jasper
worn jasper
digital temple
#

ah nah wait we are in 1.21.4 or isnt it ?

#

xd

worn jasper
#

what?

#

we are....

vast sundial
worn jasper
#

ofc

digital temple
#

these thousands of versions are confusing ...

vast sundial
#

Like is it better in performance or smth?

worn jasper
#

no idea about that but it has a much more modern infrastructure

#

and api

digital temple
#

but what you mean by better performance ? Its still an interface. So the Economy plugin itselfs contolles the speed/efficency

digital temple
#

i mean @worn jasper

worn jasper
#

yeah

#
ServiceIO addresses these issues by offering robust nullability annotations, comprehensive documentation, and well-maintained source code. In addition, ServiceIO enables asynchronous data loading and provides access to cached results, enhancing performance and scalability.
#

welp

digital temple
#

ah it caches itself stuff ?

worn jasper
#

it appears so?

digital temple
#

mhh sounds interresting.

#

so, third party plugins can still use the outdated non async economy implementer, but ServiceIO just store the balances in mem ?!

#

i dont get it

vast sundial
river solstice
digital temple
#

you are using 1.21.3 spigot api in your code. Maybe update to 1.21.4 as the new default mc server version

vast sundial
#

Nah cuz I use purpur which 1.21.4 is still in development

digital temple
#

many things changed here. For e.g the customModelData was changeing

digital temple
vast sundial
digital temple
#

because their enchanting registrar system is crap

vast sundial
pulsar ferry
# vast sundial Code review anyone pls?

Small plugin, only thing really worth mentioning is that your RegisterPlugin is an util and you shouldn't need an instance of it, just having the methods be static instead, since well, it's an util class

river solstice
# vast sundial Code review anyone pls?

weird use of "setupDependencies", rather bad name
you are not setting anything up

RegisterUtil is a variable and should be lowercase.
If its really just an util class it could probably just have static methods and no need for instantiation.

pulsar ferry
#

And on the other plugin, don't use sout use the logger

digital temple
pulsar ferry
#

MysticPickaxe

river solstice
#

also in BlockBreakListener dont create a new instance of Random at line 71

#

assign it to a static variable

digital temple
#

and do not use displayName.replace("&", "ยง")
instead take a look into the AdventureAPI

pulsar ferry
#

Or use the old chatcolor translate something something method if you're still using legacy colors

river solstice
#

also I dont really see the need for "RegisterPlugin" class. Personally I would keep those methods in the main class
if not, those methods should be static imo.

digital temple
#

or use this methode if you dont want to use adventure

import net.md_5.bungee.api.ChatColor;
String text = ChatColor.translateAlternateColorCodes('&', someMessage);
vast sundial
river solstice
river solstice
pulsar ferry
#

hoping it's not a kangarko video

river solstice
#

does not mean its a good practice

digital temple
#

There are only ChatControl ads

vast sundial
river solstice
#

as for anything else, cant really see much on phone

digital temple
#

You have create 2 times MythicPickaxe classes . For Commands and for the ItemStack

#

maybe call it GetPickaxeCommand

vast sundial
#

Can I make class name different than command?

#

Okay that's a good to know thing

digital temple
#

you can name them as you want

river solstice
#

also util class named MysticPickaxe is kind of weird imo

#

id rename

#

or refactor appropriately

vast sundial
digital temple
#

Split the register class in two
RegisterEvents
RegisterCommands

#

And always create debug logs.

river solstice
digital temple
#

logs = console outputs xd

vast sundial
#

Like a debug

river solstice
#

util class with a single method, probably PickaxeCreationUtil with a "create" method or smt

digital temple
#

trust me, if your project becomes bigger, you need to love debugs

vast sundial
#

Also with the blockresetlite I had alot of problems with worldguard

#

Because it's 7.0 API is f'ed up

#

Terribly weird

digital temple
vast sundial
#

Older apis were more stable

vast sundial
#

Also I need to add /plugin reload to both of my plugins lmfaooo

digital temple
#

The core plugin is approximately 6MB in file size, while your actual plugin is only around 100-500KB in the end.

worn jasper
digital temple
vast sundial
#

Thanks y'all for code review recode tmrw

digital temple
vast sundial
worn jasper
worn jasper
vast sundial
worn jasper
#

for now

#

but support can break at any moment

digital temple
#

not 100%

worn jasper
#

#HardForkBaby

digital temple
worn jasper
#

well if you aren't using latest then that's already a bad start

#

lol

digital temple
#

1.8 minecraft servers

vast sundial
worn jasper
#

they are a bad start

#

and a bad thing in society

worn jasper
#

at least not true anymore

#

paper hard forked

vast sundial
#

So I can use paper plugins on spigot?

digital temple
#

older versions are a fork. For now Paper add much own stuff to it

worn jasper
vast sundial
worn jasper
#

starting in 1.21.4, paper has nothing to do with spigot

#

while for now spigot plugins still work, it's just a matter of time till spigot loses support once paper start doing api changes

worn jasper
#

lol

vast sundial
digital temple
#

use paper as server software, and code with spigot api. If Paper becomes the main api for coding stuff, then switch

#

easy

worn jasper
#

that's the worst advice I have heard ngl

digital temple
worn jasper
#

also, why would someone force themselves to use spigot api ๐Ÿคข

worn jasper
#

and more logical too

vast sundial
#

And why don't use purpur?

digital temple
#

PluginMessages still only be triggering if a player is conencted

worn jasper
vast sundial
digital temple
#

purpur is shit

#

sorry

vast sundial
worn jasper
#

purpur is a fork of paper with more configuration

vast sundial
#

Can you explain it to me?

worn jasper
#

if you say purpur is shit

#

you say paper is shit

#

lol

vast sundial
#

Fax

digital temple
#

i hostet a network with purpur and many plugins are not working correctly. (Enchanting Plugins)

worn jasper
#

from ALL the paper forks, purpur is quite literally the single one that makes sense to have

worn jasper
#

as said, purpur provides way more configurability

#

and if you disable a certain feature

#

it can break plugins

#

lol

vast sundial
#

I need purpur to have more configuration for my prison server lol

worn jasper
#

customization comes at its costs

digital temple
#

the only "better" thing is that some stuff are handled async

worn jasper
#

lol

digital temple
#

i believe its the Food consumting or something else

worn jasper
#

which is basically irrelevant

#

lol

digital temple
#

just visualls

worn jasper
#

either way, if you want more options

#

there is nothing wrong in using purpur

#

it's essentially just paper with addons

#

and hard fork applies to it too

vast sundial
worn jasper
#

so, it will lose spigot support once paper loses it

#

spigot itself has legit no other fork besides those forks keeping 1.8 alive

digital temple
#

there still people who use spigot as server software ?

worn jasper
#

if you forget those, spigot is the most irrelevant software nowadays

digital temple
#

same as OptiFine

worn jasper
#

spigot is still used for a somewhat optimized server without losing much vanilla behaviour

vast sundial
worn jasper
#

since paper is performance focused, it's not the same

digital temple
#

i heard about MultiPaper

worn jasper
#

so, mostly private smps use spigot

worn jasper
#

hard

#

lol

digital temple
digital temple
vast sundial
worn jasper
#

but that's normal lol

digital temple
#

and 99% of all existing plugins are incompatible

worn jasper
#

Folia also requires a beefy machine

worn jasper
#

legit no way

#

lol

vast sundial
worn jasper
#

it's not platform dependent lol

#

nor hardware dependent

digital temple
worn jasper
#

no?

#

why would it?

digital temple
#

or was it multipaper

worn jasper
#

probs multipaper

digital temple
#

could

#

im gonna sleep now, have a nice evening/night

worn jasper
#

cya

vast sundial
#

Gn

broken elbow
# worn jasper since paper is performance focused, it's not the same

Yeah but it is much more configurable. In my experience I was able to get closer to the vanilla experience on Paper. It has been a couple years though so maybe that has changed. But at some point I remember needing to replicate some vanilla behaviour that was fixed on Spigot and Paper but Paper made it configurable.

vast sundial
#

What do you think about using skript instead of making plugins?

worn jasper
worn jasper
#

we don't say that word around here

#

illegal

broken elbow
#

eh

#

it's alright

#

if you know what you're doing

#

The main reason it is disliked is because people that lack knowledge in the basic concepts of programming end up making lag machines.

#

No idea what the performance difference between a java plugin and a skript that do the same thing is.

worn jasper
#

the diff grows exponentially

#

for a /site, essentially none

#

for a bedwars, huge

#

random ex. but ye

#

skript is made with lots of spaghetti code

woeful tundra
#

help

forest jay
#

With what

prime helm
#

is it possible to host a minecraft server on a discord bot host?

#

๐Ÿค”

#

f.e. if i have a high end bot hosting, can i run a minecraft server on it

hoary scarab
#

Technically yes. But your host might punish you for doing so.

#

Might as well pay for a vps at that point.

river solstice
vast sundial
#

guys so i did a rewrite

#

is it good now?

coarse abyss
#

hello

#

i have this probelem recently

#

anyone knows how to fix?

coarse abyss
#

Blasix1x sent 1251 packets in a tick. Terminated the connection!

torpid raft
# vast sundial https://github.com/vRefilv/MysticPickaxe

looks nice, but i'm curious about this code

if (nearbyBlock.getType().isAir() || nearbyBlock.getType() == Material.BEDROCK) {
                                continue;
                            }

                            // Trigger BlockBreakEvent for each block
                            BlockBreakEvent blockBreakEvent = new BlockBreakEvent(nearbyBlock, player);
                            plugin.getServer().getPluginManager().callEvent(blockBreakEvent);

                            // If the event isn't cancelled, break the block naturally
                            if (!blockBreakEvent.isCancelled()) {
                                nearbyBlock.breakNaturally(item);
                            }

is it really necessary to continue if the block is bedrock? and if so, why not continue for other unbreakable blocks eg. barriers, command blocks, etc

#

also pretty sure this message lies

plugin.getLogger().warning("Invalid mining area specified in config. Defaulting to 3x3.");

and never defaults to 3x3, and just cancels that pickaxe mine action entirely

vast sundial
#

You're right

#

I need to fix it all

torpid raft
#

since right now i think its possible for a scheduled block to be forgotten if the server restarts after it is mined but before it is refreshed

vast sundial
polar patio
#

hi guys i'm trying to integrate placeholderapi into my plugin and i'm running into errors in pom.xml
Dependency 'import me.clip.placeholderapi.expansion.PlaceholderExpansion;' not found
Update: Still need help

polar patio
vast sundial
#

You need to add repository

#
    <repository>
        <id>placeholderapi-repo</id>
        <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
    </repository>
</repositories>```
#

Try these

polar patio
#

life saver, thanks

vast sundial
#

I've tried to resolve this also but with worldedit lmao

polar patio
#

yea, cant figure that one too

dense drift
#

When asking for an user's input through chat is there any way to have tab completion?
I need the namespace key of a material and I want to help the user by suggesting them.
The only way I know is to register a dummy command or whatever and use that for completion.

worn jasper
#

the only tab completion in chat that I know of is the Player name one

#

which you can technically modify using PlayerInfoPacket but that would also change the tablist players

#

unless there is a way to bypass it

dense drift
#

nah I don't want to bother working with packets

coarse abyss
#

someone can help me

#

i cannot execute java 8

torpid raft
#

does the java executable file on linux use the .exe extension?

#

thats suspicious

broken elbow
# coarse abyss nope

When you say that you can not execute java 8, do you mean you can't run the program at all or does it fail at the java step?

#

You might need to mark the file as an executable before executing it

uncut zenith
#

Hey, so I'm making a Temp-Fly plugin. It is also the first time using Kotlin and ConfigLib for me. But I'm kind of running into a problem... I've fixed a lot of bugs like one language file not generating or generating incorrectly, since I'm trying to use dynamic languages with configlib. But now, I need a way to reload those messages and I can't find a way :(

So if someone could help me, this is the repository of my (not that well coded) code: https://github.com/kitoxis/nxltempfly

The language object and the language manager are located here: https://github.com/kitoxis/NXLTempFly/tree/master/src/main/kotlin/lt/nxl/config/languages

Also, for some reason the files reload after a server restart/reload, but not when using /tfreload, but the settings file does.... (Reload fun in settings: https://github.com/kitoxis/NXLTempFly/blob/master/src/main/kotlin/lt/nxl/config/Settings.kt#L25)

pulsar ferry
#

That's a lot of companion objects with global nullable instances ๐Ÿ˜ฌ
Anyways, just from glaring at your code a possible issue is that you're likely not updating instances in the locales map

true ember
#

Is this the right channel for asking questions about bukkit / spigot api

pulsar ferry
#

Yes

true ember
#

Does anyone know how to create large explosion particles now? I only see explosion in modern versions and explosion emitter which was huge, but what happened with large?

uncut zenith
#

because it doesn't :\

broken elbow
uncut zenith
#

poof

green onyx
#

Hi, I have a problem with the NMS, when using the imports I get no error, but when compiling I get the error โ€œcannot access net.minecraft.core.HolderLookupโ€ and other errors, using 1.20.6 on the NMS.

https://pastes.dev/zxLSMkfr3O

dusky harness
#

and what are you using to compile

#

you might accidentally be using multiple build tools - one that your IDE is using, and another that you're using to compile

green onyx
dusky harness
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

dusky harness
#

and also you didn't touch any of this other than Project, right? (in ctrl alt shift s menu)

dusky harness
#

hmm ok

dusky harness
#

what command or button are you running to compile it?

#

pom.xml seems fine tho..

green onyx
green onyx
dusky harness
heavy kindle
#

When you save the config file, the comment lines are deleted. How i can save the config file properly?

dense drift
#

You cant with the bukkit config api

heavy kindle
broken elbow
dense drift
#

Or dont write the config after you save it for the first time

heavy kindle
heavy kindle
broken elbow
broken elbow
atomic trail
#

Can anyone help me with this gradle task? I want it to run the other task but with given args

    register("clearTables", JavaExec::class) {
        dependsOn("bootRun")
        doFirst {
            bootRun {
                args = listOf("clear")
            }
        }
    }
minor summit
#

that isn't really how tasks work, I'm afraid

#

that's a lie, I am not afraid of anything

#

bootRun is a task, what you want is to run a separate task from bootRun given that it has different parameters and configuration

#

idk what type of task bootRun is but let's say BootRunTask for the sake of it, you need to register a BootRunTask and configure it to your liking and depend on that

atomic trail
#

Yeah what I made makes no sense actually lmao

#

This should work tho right?

    register("clearTables", JavaExec::class) {
        group = "application"
        description = "Run the JAR with 'clear' argument"
        classpath = sourceSets["main"].runtimeClasspath
        mainClass.set("cc.valdemar.shop.ShopApplication")
        args = listOf("clear")
    }
#

I don't really need the bootRun task actually, just want to run the jar with given args

minor summit
#

yeah that'd do it

atomic trail
#

It just exits with code 1 and nothing else

#

Process 'command 'C:\Program Files\Java\jdk-21\bin\java.exe'' finished with non-zero exit value 1

#

Nothing else in the error

#

Ah there was something in the scan

#

Got it, ty

dark garnet
# dark garnet ok imma just account for minecraft 2.x.x while im here ๐Ÿคฃ

@proud pebble @river solstice sooooooooo ๐Ÿ’€ https://x.com/notch/status/1875230756437479658

@JohnnyS89206078 I basically announced minecraft 2.

I thought that maybe people ACTUALLY do want me to make another game that's super similar to the first one, and I'm loving working on games again.

I don't super duper care exactly which game I make first (or even if I make more), but I do know

#

oops didnt realize this was development support FLOOSH

green onyx
uncut zenith
#

Can anyone please help? I have tried like 10+ methods to reload the dynamic language files... BUT NEITHER WORKS :|
https://github.com/kitoxis/nxltempfly
This is my first project using kotlin and configlib
Locale Manager: https://github.com/kitoxis/NXLTempFly/blob/master/src/main/kotlin/lt/nxl/config/languages/LM.kt
Locale Object: https://github.com/kitoxis/NXLTempFly/blob/master/src/main/kotlin/lt/nxl/config/languages/Locale.kt

My current try was:

    fun reload() {
        TempFly.log(locales.toString())
        locales.clear()
        TempFly.log(locales.toString())
        loadLocales()
        TempFly.log(locales.toString())
    }

Where I tried debuging and the output I think was correct:

[11:51:33 INFO]: kitoxis issued server command: /tfreload
[11:51:33 INFO]: {en_US=lt.nxl.config.languages.Locale@2fc4fbae, lt_LT=lt.nxl.config.languages.Locale@74372dd5}
[11:51:33 INFO]: {}
[11:51:33 INFO]: {en_US=lt.nxl.config.languages.Locale@7d3b6bcb, lt_LT=lt.nxl.config.languages.Locale@59520e70}
vast sundial
#

How to use coins engine api

#

Whenever I try to use it

#

I get this

#

Caused by: java.lang.NullPointerException: Cannot invoke "su.nightexpress.coinsengine.CoinsEnginePlugin.getCurrencyManager()" because "su.nightexpress.coinsengine.api.CoinsEngineAPI.plugin" is null

broken elbow
#

You need the plugin installed.

vast sundial
#

Yes I have

#

I even did hookmanager

#

To coins engine load first

broken elbow
vast sundial
#

Idk can send u log file

broken elbow
#

Yeah. Put the log file in a paste bin service such as paste.helpch.at and send it here.

vast sundial
#

It is hard on phone tho

#

Here's the whole stacktrace

#

I have coins engine in plugin.yml dependencies

#

I have it in pom.xml as dependency

minor summit
#

do not shade coinsengine

#

mark the dependency in your pom as <scope>provided</scope>

vast sundial
#

i need help rn quick

#

Cannot resolve symbol 'me'

#

placeholderapi

#

i have it in pom.xml dependencies

ocean crow
#

@olive fulcrum feel this isnโ€™t a good link

vast sundial
#

Is it better to make smaller plugins for prison server and connect them

#

Or

#

One big plugin?

#

Like blockreset blockdrop rankups coinflip

dense drift
#

I like to create smaller plugins vs one big plugin

torn heart
#

^

vast sundial
#

How about like the same stuff

#

Like the same java class

#

I do the core plugin then?

proud pebble
dusky harness
#

personally I'd prefer 1 big plugin to reduce duplicate code

dusky harness
dense drift
fathom wave
#

Hey there! I was wondering what the development updates were for updating placeholder api for 1.21.4 please?

pulsar ferry
#

Does it not work on 1.21.4?

torn heart
worn jasper
fathom wave
dusky harness
worn jasper
#

it is not

#

but there is a difference

dusky harness
#

If you develop all the plugins then you can optimize it to be performant with each other

worn jasper
#

was just pointing it out

dusky harness
#

๐Ÿ‘

minor summit
#

i mean yeah there is also a difference in doing i + 2 than i + 1 + 1 but it's not noticeable

torn heart
#

tbf there isn't any difference at allif you're using any complied language but yea

vast sundial
#

Like somehow I need to connect them

#

And I have duplicate code like database class and economyutil class

#

For now I have
Blockresetlite
Blockdroplite
Coinfliplite
Rankuplite

#

And need to connect blockdrop with rankup to check if rank is high enough to get drop from blocks

#

So for now I did it with api

#

Also as I want the same config file

uncut zenith
#

There is the thing, I forgot what its called like jitlab or another service, where the github repositories automatically get uploaded as the api, so you can use that, then in the main plugin depend the plugins you want as the other plugins, and in the other plugins, depend the core. Then you will just have to figure out how to use that jitlab or smth

dusky harness
#

jitpack* but I would just do one big plugin

#

seems like you have a couple reasons to do 1 big plugin and no reason to do separate plugins so

#

weighing the options -> one big plugin

vast sundial
#

What about if I want to upload the plugins on for example spigot

#

And if I do one big plugin then it will have only one usage

#

For prison server

#

If I would make core or API for every plugin then they will compatible to each other but work without other plugins

river solstice
#

sure

sterile hinge
torn heart
sterile hinge
#

true

stuck hearth
dense drift
#

I have an API for a plugin made with interfaces. Some classes represent objects that will be loaded from config. Each clasa has an implementation, usually record ClassName() implements IClaassName.
I want to use Configurate to deserialize the objects but I run into an issue where it doesn't know what to deserialize IClassName as. Is there any way to tell configurate that the interface A is implemented by class B, like a map?

pulsar ferry
#

Polymorphic serialization, not sure if Configurate supports it, but you can try searching that term

minor summit
#

why not just tell configurate to deserialize ClassName instead Think2

dense drift
#

IClassName has methods that return other interfaces, and so does ClassName.

minor summit
#

oookay?

dense drift
#

What I meant to say is that it will then complain about IAnotherClass, but I have an implementation for that too.

dense drift
#
public class PolyDeserializer<T> implements TypeSerializer<T> {

    private final Class<? extends T> clazz;

    public PolyDeserializer(Class<? extends T> clazz) {
        this.clazz = clazz;
    }

    @Override
    public T deserialize(Type type, ConfigurationNode node) throws SerializationException {
        return node.get(clazz);
    }
}```
```java
.registerExact(ISpawnEgg.class, new PolyDeserializer<>(SpawnEgg.class))
.registerExact(ISpawnEggLevel.class, new PolyDeserializer<>(SpawnEggLevel.class))```
This seems to work for now.
worn jasper
#

@fringe spruce sus link help

slow plinth
#

I am trying to create some placeholders in my plugin but I think I am doing something wrong.
This it the logic

package com.striderdev.striderSimpleCloud.placeholderapi

import app.simplecloud.controller.api.ControllerApi
import kotlinx.coroutines.runBlocking
import me.clip.placeholderapi.expansion.PlaceholderExpansion
import org.bukkit.entity.Player
import java.util.logging.Logger

class GroupPlayerCountPlaceholderHook(
    private val controllerApi: ControllerApi.Coroutine,
    private val logger: Logger
) : PlaceholderExpansion() {

    override fun getIdentifier(): String {
        return "ssc_group"
    }

    override fun getAuthor(): String {
        return "StriderDev"
    }

    override fun getVersion(): String {
        return "1.0"
    }

    override fun persist(): Boolean {
        return true
    }

    override fun onPlaceholderRequest(player: Player?, params: String): String? {
        logger.info("onPlaceholderRequest triggered with params: $params")

        if (params == "test") {
            return "test works!"
        }

        if (params.startsWith("playercount_")) {
            val groupName = params.removePrefix("playercount_")
            logger.info("Extracted group name: '$groupName'")

            return runBlocking {
                try {
                    val serversInGroup = controllerApi.getServers().getServersByGroup(groupName)
                    if (serversInGroup.isEmpty()) {
                        return@runBlocking "0"
                    }
                    val totalPlayerCount = serversInGroup.sumOf {
                        val serverDetails = controllerApi.getServers().getServerById(it.uniqueId)
                        serverDetails.playerCount
                    }
                    return@runBlocking totalPlayerCount.toString()
                } catch (e: Exception) {
                    logger.severe("Error processing placeholder: ${e.message}")
                    e.printStackTrace()
                    return@runBlocking "error"
                }
            }
        }

        logger.warning("Unrecognized placeholder parameters: $params")
        return null
    }
}

And this is in the start logic to register it:

        if (server.pluginManager.isPluginEnabled("PlaceholderAPI")) {
            GroupPlayerCountPlaceholderHook(controllerApi, this.logger).register()
            logger.info("Placeholders registered successfully!")
        } else {
            logger.warning("Could not register placeholders: PlaceholderAPI missing.")
        }

Using /papi list shows that ssc_group is registered but neither placeholders actually return. That first logger.info doesn't even run.
What am I getting wrong?

dense drift
#

The identifier can not contain underscore @slow plinth

slow plinth
#

oh

#

thank you

river solstice
slow plinth
dense drift
#

I was thinking about that

broken elbow
#

Time to fix that.

west socket
#

Does anyone know if there is a consistent way to detect when a JVM process has "finished loading" regardless of server software?

#

I'm trying to make a sort of pterodactyl alternative, but am having issues with detecting when the server has fully started

dusty frost
#

Ptero just checks for a console message

#

That seems pretty software agnostic

west socket
#

Ah, thanks

#

Guess thereโ€™s no way to make it software independent

hoary scarab
#

Pretty sure there is an isLoaded method you can check in spigot.

west socket
#

Needs to be software independent, but thanks for letting me know about that

pure crater
#

Does anyone know why my resourcepack isn't working, unzipping and loading the folder in game works but the zip version just isnt working

#

for context, my plugin zips resources of a resource pack

#

and its creating this zip

#

but its not working in game

#

1.21.4 resourcepack

#

Diamond custom model data 1

uncut zenith
#

How to update a dynamic language values with configlib? The settings file auto-updates correctly. But since my languages are dynamic, they dont... but how do i make them to do that? My current code: https://github.com/kitoxis/nxltempfly

minor summit
#

you forgot the .com lol

uncut zenith
#

Frick

#

Xdd

#

I fixed it ;)

vast sundial
#

how to check in intelij what methods are depracted

#

my plugin shows as legacy

dull pecan
vast sundial
#

but they dont

#

oopsie im stupid

#

[22:02:35] [Server thread/WARN]: Legacy plugin ChatFilterLite v1.0.0 does not specify an api-version.

dull pecan
#

then they're not deprecated

dull pecan
vast sundial
#

yeah ik

#

i meant im stupid i forgot to put it into plugin.yml

dull pecan
#

Happens to best of us

#

I strongly recommend for you to use Minecraft Development Intellij Idea plugin, it generate boilerplate for plugin developemnt

vast sundial
#

i used it

#

but idk why it dont added api-version

#

to plugin,yml

#

that was the first time it did like this

dull pecan
#

weird

#

do you use latest version?

vast sundial
#

ye

dull pecan
#

Then I have no idea what happened

dark garnet
#

this is sort of a development question
i manage a minecraft events discord server where users can post events through a discord bot that they're hosting for other ppl in our server to play
we need a way to detect when their events end so that we can add features that would utilize it (ex: VC for the event that's deleted when event ends)
some ideas we had were like:

  • manual detection: host clicks a button when their event ends. cons: unreliable bc host might forget to click the button causing ppl to think event is still going on
  • "ai" plugin: each host that wanted to utilize the features that require end detection would install our plugin. it would use factors such as online players, chat activity, player movement, etc... to "guess" when an event has ended. cons: also unreliable and could have false-detections
  • manual with remidners: every like 30 mins the host is DMed or asked in-game whether their event is still going on. they either click Yes or No. if they dont respond in the next 30 mins, its assumed its ended. cons: some ppl have DMs disabled, it has 30-minute unreliability, if someones power goes out or something its false detection, its annoying cause hosts arent always looking in discord or paying attention to system msgs
  • player feedback: players click a button in discord letting us know the event has ended. once its reached a certain amount of feedback, its marked as ended. cons: definitely will be groups of ppl who abuse this on ppl they dont like, ppl might just not provide feedback
  • player feedback + manual: player feedback except it DMs/notifies host before confirming the event's been cancelled

if anyone's got any ideas please let me know, we've been struggling with this for months ๐Ÿ˜ญ ping if reply

dusty frost
#

i mean, the only reliable way is surely just to have the host choose when it's finished

#

if they made the event and started it, i hope they can be responsible enough to say when it ends lol

#

maybe they could even do it through the game or something? that way it's easier than alt tabbing to discord or something, and it would just shut down the server and whatever they're using

hoary scarab
#

Are the events timed based? Just end it after the elapsed time.

dusty frost
#

yeah if they can have the host specify the length beforehand, and maybe give them an option to add like 15min or 30min if the event is going longer than planned?

#

then it can end automatically but can proactively be fixed

digital palm
river solstice
#

idk why you dont just early return false on exception

#

and you shouldnt modify the original parameter via toLowerCase(), I would create a clone

digital palm
sterile hinge
#

why even have a string as who parameter

#

that all sounds extremely hacky

digital palm
#

Because I can't think of a better way to both include UUID's and some "group" value in the same parameter - and yes, it is extremely hacky, that's why I'm asking if anyone can find a "less hacky" solution^^

sterile hinge
#

I mean, why are you reinventing permission systems? All of them already have some kind of group concept

digital palm
hoary scarab
#

Yeah looks like it returns new String

river solstice
#

ah right lol, regardless, I prefer assigning it to a new valuable

amber spindle
#

Hi ,Does anyone know? how make custom recipe with custom item? Example : I want craft a mythic sword with mythic shards(with custom model) how can make it?I searching on internet or ask ai but its wont wanna work

hoary scarab
#

I'm not at my PC so I can't share my code but look into ShapedRecipe. Idk about newer versions but this use to only work with materials not specific items.

#

Could also check the craft or inventory click events.

dawn tinsel
#

from lightbulb.ext import tasks
ModuleNotFoundError: No module named 'lightbulb.ext'

WHen I try to run my bot it gives me this

#

I installed hikari and hikari-lightbulb?

#

Anyone know how to fix?

lyric gyro
#

Good morning, I'm actually developing some plugins which offers its own menu API, only used for the same plugins for custom inventories, and some menus offers the chance to go back to the previous inventory. Some of my customers use DM to create custom inventories, and sometimes, some of the inventories contains a button which refers to a command related to my plugins. When they open the inventory, the back button is shown up, but when they go back, the DM inventory seems to lose all tracking. I assume that, once DM detects that a player has closed the inventory, it stops tracking their inputs. I was wondering if there was any other case which had the same issue with a solution compatible for this kind of cases or if the best would be to give support to DeluxeMenus and reopen them through the API

idle heron
#

Hello i made a GUI with 6 enchantment books that have default enchantments like sharpness,unbreaking,looting etc and im trying to make an if statement that will check if item is ENCHANTED_BOOK with the name "Sharpness" for example anyone could help me with this?

solemn estuary
#

Is it possible to convert a gradle plugin to maven ?

#

( pls ping me )

icy vigil
#

gradle plugin? not really

#

@solemn estuary

solemn estuary
icy vigil
#

which gradle plugin you need to work on maven?

#

maybe there is a maven substitute

solemn estuary
#

It's a bazaar plugin like the one of Hypixel

icy vigil
#

oh

#

you talking about minecraft plugin

solemn estuary
#

Yep

icy vigil
#

I thought you were talking about build tool plugins

solemn estuary
#

Oh non x)

#

It's possible then ?

icy vigil
solemn estuary
#

<3

icy vigil
#

from what I see its a bit hacky

pulsar ferry
#

Downgrading ๐Ÿ˜”

sterile hinge
#

true

icy vigil
#

upgrading actually

#

maven > gradle

sterile hinge
#

nah

#

not even when maven 4 comes out

icy vigil
#

maven 4 when

dense drift
#

As long maven keeps using only xml, it won't have a chance to be superior to gradle ๐Ÿ˜ฌ

graceful hedge
#

Iโ€™m pretty sure someone almost successfully implemented maven with a gradle plugin in gradle lol

river solstice
#

huh

graceful hedge
#

yea, like reading pom.xml, and then mapping the structure to some gradle equivalent stuff etc

pulsar ferry
#

Tbh that doesn't sound like too hard of a thing to do, for dependencies at least, plugins would be different

river solstice
dense drift
#

The only good thing about maven using xml is that it is easy to convert it to gradle pepe_kek

pulsar ferry
#

You don't even need a converter either, just gradlew init on a maven project

stuck hearth
river solstice
#

no i mean why would you need a plugin in your gradle project to convert pom.xml

dense drift
river solstice
dark garnet
#

i want to transfer players using Player#transfer(...), is it possible without knowing the port?

#

cause u can run the /transfer command without specifying a port, but only if you dont specify a player (so only on urself), idk why

worn jasper
dark garnet
minor summit
#

nothing short of just trying every option, Minecraft will default to 25565 if unspecified both in the command and on the server list screen, it doesn't "figure out" anything

neon pewter
#

why it doesn't allow me to pass this into the document ?

graceful hedge
graceful hedge
graceful hedge
neon pewter
graceful hedge
#

Yea but you donโ€™t use Type**.**field tho

#

It should be a #, no?

#

Type#field, or #field if the Type is inferrable

neon pewter
#

oh right i forgot about that

graceful hedge
#

ur good fam, nw

worn jasper
#

there is no "find out"

dark garnet
#

thereโ€™s no port and itโ€™s not 25565

worn jasper
#

lol

#

although actually

dark garnet
worn jasper
#

yeah idk

#

get that data from DNS then? idk

dark garnet
#

โ€ฆโ€ฆ..

worn jasper
#

should probs ask in paper discord

dark garnet
river solstice
dark garnet
#

thatโ€™s velocity

river solstice
#

is .transfer on paper?

dense drift
#

What are you trying to do though? Send players to a server that's not yours?

dusky harness
#

you can get the port using DNS

#

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

#

but if it's SRV I wonder if putting just any random port will work

minor summit
#

i don't think Minecraft does anything special to resolve SRV records when trying to join a server?

#

like.. just default to 25565 that's literally what the game does

#

and things automagically work

dusky harness
#

oh yeah I was probably overthinking it

dark garnet
#

only 25565 works which is interesting

#

even tho the server's port isnt 25565 (and theres a different server with 25565 with same underlying ip)

#

thanks

solemn estuary
#

Hi !
I'm learning Java and I would like to know if there are some librairies I should learn to use ?

pulsar ferry
#

If you're learning Java I'd recommend sticking to base Java before diving into libraries, try learning by doing yourself what some libraries do
Once you get the hang of it then replace it with the libraries you want

torn heart
solemn estuary
icy sonnet
#

Can I add a constructor in my main class that extends JavaPlugin or is that bad practice?

spiral prairie
#

How are you going to... call that constructor?

hoary scarab
#

Magic

icy shadow
#

yeah bukkit literally wonโ€™t let you

spiral prairie
#

If you want to do something on init do it in the enable/load method

pulsar ferry
spiral prairie
#

You can probably

icy sonnet
#

I don't want to call the constructor

#

I'm trying to make a fileManager so I can easily create .yml files as needed

spiral prairie
#

Okay..?

pulsar ferry
#

And what does that have to do with the plugin having a contructor? thonk

icy shadow
spiral prairie
#

What does one have to do with the other?

pulsar ferry
#

Oh yeah I just meant having a contructor, not calling it

icy shadow
#

it sounds like you want to inject the plugin instance into the file manager class

icy sonnet
#

no like when I'm trying to do private FileManager filemanger;

#

it won't let me and says I need a constructor

spiral prairie
icy sonnet
#

thats why im asking

icy shadow
spiral prairie
#

Did you set the variable as final?

icy shadow
dusky harness
spiral prairie
#

If so; either initialize it there, or don't

spiral prairie
dusky harness
#

but are there any downsides to initializing it right away?

#

if you don't do anything else with it

pulsar ferry
#

Or you know private FileManager filemanger = new FileManager();

dusky harness
#

if matt says so then ig not

#

:))

icy shadow
pulsar ferry
#

Initializing it directly on the field or on the constructor are pretty much identical

icy sonnet
pulsar ferry
#

How so?

icy sonnet
#

I dunno the IDE keeps complaining

icy shadow
#

what is the error

pulsar ferry
#

And the complain is?

icy sonnet
#

Variable 'fileManager' might not have been initialized

icy shadow
#

You have two variables donโ€™t you

pulsar ferry
#

That makes no sense with what I sent

#

share screenshot

icy shadow
#

oops sorry reply fail

icy sonnet
#

methode in main:

public void createFiles() throws FileCantBeCreatedException {
        fileManager.createFile(CONFIG_FILE);
        fileManager.createFile(DEATH_MESSAGES_FILE);
    }
icy shadow
#

Need more code than that

icy sonnet
#

Change this instance-reference to a static reference.
Static member 'me. cozyleprechaun94.utils. FileManager. createFile(java. lang. String)' accessed via instance reference

#

here is main

#

here is filemanger class

icy shadow
#

Right so

pulsar ferry
#

Well you didn't even do what I sent lol

icy shadow
#

thatโ€™s not what we said to write

#

Yeah lol

icy sonnet
#

ah a sec

spiral prairie
#

I personally recommend going the way of Java basics before Spigot plugins :)

icy sonnet
#

Instantiation of utility class 'FileManager'

icy sonnet
#

I just never worked with files or ever got that error

spiral prairie
icy shadow
spiral prairie
icy shadow
icy shadow
icy sonnet
icy shadow
#

Oh lmao

#

So why do you even need it as a field

#

Just call the static methods

#

FileManager.createFile etc

icy sonnet
#

public void createFiles() throws FileCantBeCreatedException {
FileManager.createFile(CONFIG_FILE);
FileManager.createFile(DEATH_MESSAGES_FILE);
}

icy shadow
#

Yes

spiral prairie
#

Yes

icy sonnet
#

yea, but now it aint copying the contexts of the files from resources

spiral prairie
#

Also, you can just switch out your custom exception for a RuntimeException I don't think you need a custom one for that

icy sonnet
#

I learned it that way

#

AlwAys MakE cuStom ExcPtions blalala

spiral prairie
#

Ah interesting

dusky harness
#

I mean I guess it's better for clarity

spiral prairie
#

Ideally you'd pass on the IOException with the original stack

dusky harness
#

ah

spiral prairie
#

Because that contains the reason it failed

dusky harness
#

oh that's a simple fix

icy shadow
dusky harness
#

change line 25 to add a second parameter to e

icy shadow
#

Yeah

icy sonnet
#

and also "Define and throw a dedicated exception instead of using a generic one."

spiral prairie
dusky harness
pulsar ferry
#

AlwAys MakE cuStom ExcPtions blalala
when it makes sense to*

icy shadow
#

it doesnโ€™t happen automatically

#

All your method does is creates a file

spiral prairie
#

Imho an IOException is the perfect exception to throw on an... IO exception

icy shadow
#

I agree

icy sonnet
spiral prairie
#

e

spiral prairie
icy shadow
#

ageee

#

I love autocorrect

#

Itโ€™s so helpful

worn jasper
spiral prairie
#

I love when it starts correcting the real word to my version which I've misspelt 200 times over

dusky harness
#

out of curiosity
what word is it that you've misspelt 200 times?!

icy shadow
#

not even a word bro

worn jasper
#

hey, bootstrapping does allow you to pass args to the constructor of the main class

#

xD

spiral prairie
#

It's usually something like many HAHAHAH