#help-development

1 messages · Page 638 of 1

echo basalt
#

wot

eternal oxide
#

if only

echo basalt
#

yeah there's no plugin.yml resource pack info

young knoll
#

Why would they have to be compatible

echo basalt
#

but we can do code analysis :)

eternal oxide
#

we want alex to convert his RP merge program to a plugin

young knoll
#

You can intercept any resource pack as it gets sent to the client

#

And merge it then

echo basalt
#

ehh

#

icky

eternal oxide
#

yes but plugins don;t generally set teh RP, thats set on teh server at startup

young knoll
#

Maybe but it works for all packs

echo basalt
#

sure

#

we can do that

#

and have a sort of hash cache

#

and maybe a blacklist

eternal oxide
#

with a keyed registry any plugin could register their RP

young knoll
#

Catch the outgoing packet, dowload from the link it is sending, merge it, and then put the merged pack on a small internal http server and use that as the download link

echo basalt
#

perfect

eternal oxide
#

can;t rely on a local http server

young knoll
#

Why not

eternal oxide
#

woudl have to be uploaded by the server

#

bungee

echo basalt
#

I wonder if uhm

young knoll
#

Local servers are common

echo basalt
#

by having the client download a zip file from the url provided in the packet

young knoll
#

But yes external is also an option, just costs money

echo basalt
#

servers could act maliciously and somehow upload a weird zip virus

young knoll
#

Maybe

river oracle
#

https://github.com/Y2K-Media-Creations/Suketto/blob/master/build.gradle > Getting errors when compiling
https://github.com/Y2K-Media-Creations/Suketto/blob/master/bukkit/build.gradle > Line 21

error

Could not determine the dependencies of task ':shadowJar'.
> Could not resolve all dependencies for configuration ':runtimeClasspath'.
   > Cannot resolve external dependency de.themoep:minedown:1.7.1-SNAPSHOT because no repositories are defined.
     Required by:
         project : > project :bukkit

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
#

I'm literally DEPENDING ON IT

#

THE REPOSITORY IS THERE 😭

lost matrix
#

invalidate caches and restart

river oracle
#

i did already 😭

young knoll
#

Add the repo to your base build file

river oracle
#

already tried

#

I'll try again though

river oracle
#

@young knoll okay I fixed it with your method, but I'm confused

#

I need it in the local and the module directory

#

that seems redundant I feel like theirs a problem with my configuration

#

hmmm its because my main handles all my gradle shadowing vs each module individually

small current
#

how to use BlockPhysicsEvent to determine if block is broken due to another block being broken for example redstone torch being broken when the block that the torch is attached to is broken by a player or a redstone wire being broke when the block under it is broken

sterile breach
#

Hi, how to use hex color in a message ? Just &#hex ?

sage patio
#

any idea why?

hazy parrot
#

Strings are not mutable

#

String foo = bar.replace

kind hatch
shadow night
lilac dagger
#

or if you wanna add more
text = text.replace();
text = text.replace();

#

tho i don't recommend it, it doesn't scale well

young knoll
#

or just text = text.replace.replace.replace.replace

#

kek

shadow night
#

Exactly

#

But why set it, just return it

flint coyote
lilac dagger
#

there is actually

#

you can create a compiler

#

tokenize the string in advance

#

and then have a context that you can use to fill the token

shadow night
#
return text
    .replace(...)
    .replace(...)
icy beacon
#

i'm getting a NoSuchMethodError and i'm not using any reflection??
relevant part:

java.lang.NoSuchMethodError: com.roughlyunderscore.listener.JoinListener.<init>(Lcom/roughlyunderscore/KitPVPPlugin;)V
        at com.roughlyunderscore.KitPVPPlugin.initListeners(KitPVPPlugin.kt:345) ~[?:?]

line 345:

JoinListener(this).register(this)
// register method:
fun Listener.register(plugin: JavaPlugin) {
  plugin.server.pluginManager.registerEvents(this, plugin)
}

listener itself:

class JoinListener(private val plugin: KitPVPPlugin) : Listener {
  @EventHandler
  fun onJoin(event: PlayerLoginEvent) {
    val player = event.player
    if (plugin.purgeManager.beingPurged.containsKey(player.uniqueId)) {
      event.result = PlayerLoginEvent.Result.KICK_OTHER
      event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "&4&lYou have been purged.".formatColor())
    }
  }
}
#

i compiled this plugin with this class a couple days ago successfully

#

after some changes in the plugin it now throws this

lilac dagger
#

what's the line 345?

icy beacon
lost matrix
icy beacon
#

no

lilac dagger
#

i feel like this error shouldn't happen

flint coyote
#

Did you try to compile again? I had that happen before

icy beacon
#

hm, sure, 1 sec

lilac dagger
#

clean and install maybe helps

icy beacon
#

i got so flabbergasted i didn't even try recompiilng lol

#

nothing changed

#

i'm even more flabbergasted

lost matrix
#

Such an error is weird. Maybe if an exception is being thrown in a static block...

icy beacon
#

hm, i don't have any static blocks i don't think

lost matrix
#

Well you are implicitly creating a static block in Kotlin with

fun Listener.register(plugin: JavaPlugin) {
  plugin.server.pluginManager.registerEvents(this, plugin)
}
icy beacon
#

ah, fair, but it registers like 10 listeners before getting to the JoinListener

lost matrix
#

Make this method null safe

icy beacon
#

don't see why it could be problematic

#

i'll try to comment out the JoinListener and see if the problem is actually within this extension

small current
#

how to use BlockPhysicsEvent to determine if block is broken due to another block being broken for example redstone torch being broken when the block that the torch is attached to is broken by a player or a redstone wire being broke when the block under it is broken

icy beacon
#

after having commented it out, the error disappeared, so it seems that there may be a problem within registering the joinlistener. i'll try to do some extra null checks

prime epoch
#

in like 107 of your VagtshopSign class make an if statement to make sure your hand isnt empty

lost matrix
icy beacon
#

i replaced my registration line with

server.pluginManager.registerEvents(JoinListener(this), this)

and i'm still getting the error, so the problem is not within the register function 🤔

prime epoch
#

to just add on with what 7smile7 said, just make sure your code is null safe, its a simple mistake that gets everyone

flint coyote
#

that's why "hasItem()" exists

lost matrix
#

Dont you have air in your hands now?

#

On default

#

Ah wait. Can be fired by your feet as well.

#

And the offhand

hazy parrot
#

Can you send it

flint coyote
#

I'm not even sure if AIR is returned for the hands

icy beacon
#

just this

lost matrix
#

lightshot

icy beacon
#

i'm trying to comment out various parts of the listener rn to rule out possible reasons

lost matrix
icy beacon
#

wouldn't it all be messy due to kotlin?

#

but sure i will

hazy parrot
#

Yeah I'm pretty sure constructor is problem somehow, hence missing method is <init>

icy beacon
#

yeah, i commented out everything but the constructor and the error persisted

#

how weird

prime epoch
hazy parrot
#

Try to decompile it as smile suggested

icy beacon
#

?paste for me

undone axleBOT
icy beacon
#

the other lines of my code are basically just references to the init method

tender shard
#

huh

icy beacon
#

decompiled:

prime epoch
#

youre calling getState() which getclickedblock could still be null im presuming. so do something like java if (e.getAction() == Action.RIGHT_CLICK_BLOCK) { // your code here }

icy beacon
# icy beacon decompiled:

this is of a version where i commented out everything but the constructor so conveniently there's just the constructor

hazy parrot
tender shard
#

if you call your variabes "e" you should rethink your life choices

icy beacon
#

i'm so confused

chrome beacon
prime epoch
sterile breach
icy beacon
#

it could be, but the decompiled version is fine, so why would it be so?

#

and this does not happen to any of my other listeners

#

that also have this same constructor

brazen tendon
#

https://paste.md-5.net/onasivukik.java
My code almost works the only issue is that it doesn't always takes the nearby entity's, error that I get in console is index out of bounds 7 of 7.
Does someone know what is wrong?

prime epoch
lost matrix
icy beacon
#

in my 1 st message

icy beacon
eternal night
#

You decompiled the jar in the plugin folder ?

#

no duplicate jars in there ?

#

etc

icy beacon
#

yep

lost matrix
#

package? You using kotlin + maven??

icy beacon
#

yeah xD

#

i'm absolutely not familiar with gradle

#

so

#

yes

prime epoch
chrome beacon
prime epoch
#

whats teh error now

#

oh nonnoo

#

put it before

brazen tendon
prime epoch
#

wait ill show you hold on

brazen tendon
prime epoch
#
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (event.getClickedBlock().getState() instanceof Sign) {
    // your code here
}```
chrome beacon
undone axleBOT
chrome beacon
#

Also sent text in a paste

#

Don't screenshot text :/

#

?paste

undone axleBOT
chrome beacon
#

;/

prime epoch
icy beacon
#

i changed the constructor to an even more explicit constructor:

class JoinListener : Listener {
  private val plugin: KitPVPPlugin
  constructor(plugin: KitPVPPlugin) {
    this.plugin = plugin
  }

yet it is throwing the same error

#

i am actually probably missing something but i have no idea what it is

prime epoch
prime epoch
#

im guessing many things are also called Listener in java

icy beacon
prime epoch
#

it would

icy beacon
#

because my register method takes org.bukkit.event.Listener

#

no

#

i'm passing this class as an argument

#

it must be the listener

icy beacon
#

still though, yes

flint coyote
#

public class maybe?

chrome beacon
icy beacon
flint coyote
#

or are your other listeners normal classes aswell?

#

yes

brazen tendon
icy beacon
#

class is by default a public class in kotlin btw, and yes, all the other listeners are public

chrome beacon
icy beacon
#

just in case you didnt know

brazen tendon
prime epoch
#
    @EventHandler
    public void onInteract(PlayerInteractEvent e) {
        Player player = e.getPlayer();
        if (e.getAction() == Action.RIGHT_CLICK_BLOCK) return;
        if (e.getClickedBlock().getState() instanceof Sign) {
          // we already know bs is instance of sign
          // and we know bs isn't null
        }```
flint coyote
#

wasn't to sure since we run the all-open-plugin for kotlin at work lol

icy beacon
#

😄

chrome beacon
brazen tendon
prime epoch
# brazen tendon 15

im a little confused so what do you want this code to actually do. Can you send the full class and include it in a pastebin?

kind hatch
#

?paste

undone axleBOT
prime epoch
icy beacon
#

ok uh

#

i resolved the error by renaming the class

icy beacon
#

i think i know what the problem is, there's a dependency in my plugin that has a JoinListener as well

#

i'll just rename it to something more specific, in my case PurgeJoinListener

prime epoch
#

@icy beacon atleast you fount it

icy beacon
#

yeah 😄

#

in the least obvious place

#

thanks everyone for your time! happy coding :>

prime epoch
#

you know for the future now

brazen tendon
# prime epoch im a little confused so what do you want this code to actually do. Can you send ...

https://paste.md-5.net/ahobuzulic.java
the code makes a lightningline effect with each lightning having a delay on it so that you have a slow line that keeps traveling untill it hits it max distance. But I also want to add custom dmg to the entitys that get hit by the lightning.

execute() is a custom made event like dropping a item. (this works because a lot of other things uses this and don't give a error)

prime epoch
#
 @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
    public void onPlayerInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();

        if (!(event.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
        if (event.getClickedBlock().getState() instanceof Sign) {

            Sign sign = (Sign) event.getClickedBlock().getState();
#

that should be fine then

chrome beacon
#

They've shown 0 interest in learning Java they're just using you to write that plugin for them

prime epoch
#

oh it just sets to to a higher priority than other events, so it gets ran first. I may be wrong tho i actually didnt read the docs and im just guessing

chrome beacon
#

So it's changes takes priority

#

You'd know what you were doing if you had followed at least one Java tutorial we've sent you over the last few weeks

prime epoch
chrome beacon
#

instead of asking us for every step of the way

alpine urchin
#

Olivo is right

young knoll
#

This discord channel is for spigot development help

alpine urchin
#

Yup

young knoll
#

Not java basics help

alpine urchin
#

not Java help

kind hatch
flint coyote
alpine urchin
#

?learnjava

undone axleBOT
prime epoch
#

its not really java basics help theyre just encountering a problem with the API and not knowing how to properly solve it

alpine urchin
#

who are you

chrome beacon
alpine urchin
#

why aren’t you helping this unknown person

flint coyote
kind hatch
chrome beacon
alpine urchin
#

oh

#

ok

prime epoch
radiant umbra
#

Hello, im using Player#setInvulnerable() to set a players invincibility after death, im making a custom death system btw. The player is still not invincible. Should I delay the method like a few ticks?

prime epoch
#

but my point is im not trying to deter a young programmer thats trying and idm spoon feeding for abit. tbf all i spoonfed was like 4 lines of code aka the null check

small current
#

@icy beacon use pork for spam

#

haram

radiant umbra
chrome beacon
#

or maybe a tick after*

#

Oh and be aware of end portals triggering the event

prime epoch
alpine urchin
radiant umbra
#

respawn or death event

chrome beacon
#

respawn

radiant umbra
#

why tf

alpine urchin
#

otherwise they’ll keep coming for spoonfeeding

#

thats how it is

prime epoch
chrome beacon
# radiant umbra why tf

The player has no body when in the credits scene so it's respawned when exiting the portal

rotund ravine
#

You are respawned in the overworld etc.

remote swallow
prime epoch
chrome beacon
#

Yeah and they'll be back later today or tomorrow with the same question

prime epoch
#

we'll see

chrome beacon
#

I've already seen it happen

kind hatch
#

Just look at his message history.

quaint mantle
#

hello

kind hatch
#

It's not that hard.

remote swallow
quaint mantle
#

i need help about betterranks can anyone help me?

quaint mantle
#

thx

radiant umbra
# chrome beacon Set it in the respawn event

still doesnt work ```@EventHandler
public void onRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();

    Location loc = new Location(Bukkit.getWorld("world"), 149, 83, 560);

    player.teleport(loc);
    player.setInvulnerable(true);
}```
kind hatch
radiant umbra
#

trying

#

still doesnt work, delayed it by 5 ticks tho

prime epoch
radiant umbra
# prime epoch can you send the updated code

        Location loc = new Location(Bukkit.getWorld("world"), 149, 83, 560);

        Bukkit.getScheduler().runTaskLater(NewNanca.getInstance(), () -> {
            player.teleport(loc);
            player.setInvulnerable(true);
        }, 5);``` not the best solution tho
prime epoch
radiant umbra
#

yes

prime epoch
radiant umbra
#

thats what i thought as well

#

im using 1.16.5 spigot btw

chrome beacon
#

hm

mellow pebble
#

?paste

undone axleBOT
sterile breach
#

Hi, to use hex, i need to call function or just add "&#myhex mymessagecontent"

young knoll
#

That isn't the format for hex

#

It's &x&r&r&g&g&b&b

mellow pebble
#

Hi so i am making practice plugin and i am getting this error which im not usre why is happening because everything should be defined properly and nothing should return null value

https://paste.md-5.net/jizeduqago.cs

flint coyote
#

what's line 30?

#

PlayerListener.java:30

mellow pebble
#

in function onPlayerJoin i wrote line 30

#

playerDataManager.setPlayerData(player.getUniqueId(), new PlayerData(player.getUniqueId()));

flint coyote
#

then playerDataManager might be null

mellow pebble
#

manager is registered in on enable properly and the variable is initialized properly

flint coyote
#

because you probably never set it?

Can you show the full PlayerListener class?

mellow pebble
#

?paste

undone axleBOT
mellow pebble
#

it is calling playerDataManager from main class

radiant umbra
prime epoch
#

maybe set the player to spectator?

#

or if you have essentials installed you can set them to god mode

radiant umbra
#

nah all good, the players should be in survival anyways

#

just tested it with creative

prime epoch
#

or if you want invincibility then just give them like regeneration 1000

flint coyote
mellow pebble
flint coyote
#

yes

mellow pebble
#

weird but okay

flint coyote
#

how is it weird, you reference it in the listener but it's null when you create the listener

mellow pebble
#

weird how dumb am i

#

lmao

#

HAHAHAH

flint coyote
#

happens to the best of us. Sometimes you just gotta take a break

mellow pebble
#

well ty

wary harness
#

So I got premium plugin and would like to have some dependencies which are not compiled to plugin but will load dynamically with
libraries: feature in plugin.yml and for older version I will use dynamic loading which I got all workng code
Now premium plugins should work if machine dosn't have internet so offline
So "libraries:" feature in plugin yml will not work and for older version my dynamic loader will not eather
Can I provide all of dependencies in file uploaded to media fire as zip in description on spigot page so people can manually get it and install it?

sterile breach
flint coyote
rotund ravine
flint coyote
#

From the guidelines I just read that it is not allowed

rotund ravine
#

But you can also just let them know of your resources and tell them where to go get the library files 👌🏻

eternal oxide
#

Libraries are downloaded once and will then work offline

#

your implementation must do teh same for older versions

wary harness
# eternal oxide it has ot run at first start, after that it has be ok offline

So are u saying that when first time person installs plugin they should run it with access to internet?
Because I am using Libby which will load libs for older version same as "libraries:" feature in plugin.yml and it only needs access to internet onece to work after lib jars are downloaded it is not trying to get them on every start up of server

eternal oxide
#

correct

wary harness
#

ok

#

then I am all set up with no problems

river oracle
#

lets say theoretically I had to check idk 100 or so chunks to scan for specific blocks, how would I do that with BukkitAPI

eternal oxide
#

slowly

river oracle
eternal oxide
#

yes

river oracle
#

:} I'm interested

eternal oxide
#

slowly take chunk snapshots, pass them to a queue and process async

eternal oxide
#

you can process them as fast as you like, but you shoudl limit the speed you take them

river oracle
ancient plank
river oracle
#

I accidently ran an infinite loop which spawned in like 100s of Completeable Futures per loop every single iteration

white root
#

how do I end a hover event when using a ComponentBuilder?
if I had kt val message = ComponentBuilder("test. ").append("Hover over me! ").event(Event.fromText("Woah, magic! ")).append("Don't hover over me!") how would I make Don't hover over me! not have the hover event?

river oracle
#

normally it should only iterate a few times with one async call, but since I forgot to yk make the loop condiiton it kinda crashed my server

ancient plank
#

left too many heavy math things running synchronously, and eventually they all got VERY LARGE

#

overnight

lilac dagger
#

oh

timid hedge
#

How do i fade in and fade out on a title?

ancient plank
#

?jd-s

undone axleBOT
river oracle
#

beat me to it :(

timid hedge
ancient plank
#

I've never used the 1.8 api

timid hedge
#

Okay fair

river oracle
#

if you don't know Java which i've seen you've struggled with in the past have fun with NMS it only gets harder if you don't know what's going on. Best part about NMS is you are on your own

#

granted for such a legacy version you might beable to find something

visual tide
#

whats the error?

#

or maybe it doesnt and you have to do funny stuff

#

sec

river oracle
#

either packets or some command bullshit it looks like

visual tide
#

sendTitle(String title, String subtitle) should exists according to some docs i found

timid hedge
#

Yeah it does but fade in and fade out dosent

visual tide
#

resetTitle maybe

#

oh fade

#

oh

kind hatch
#

You have to send packets for timings pre 1.11

visual tide
#

iirc the api wont do that in 1.8

timid hedge
#

Okay thanks

nimble oxide
#

?

visual tide
#

get its type

nimble oxide
#

instead of hand

visual tide
#

getItemInHand().getType()

nimble oxide
#

Thx <33

clever lantern
#

someone knows why, if i try to ban player or even kick i get

Caused by: java.lang.NoSuchMethodError: 'void org.bukkit.entity.Player.kick()'
        at pl.namecraft.nccore.command.ExampleCommand.onCommand(ExampleCommand.java:35) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        ... 23 more```
chrome beacon
twilit creek
#

Is it possible to make Client-Side Items? I mean that you can drop an Item, that is only Client-Sided?

clever lantern
chrome beacon
#

Wdym how

#

You're probably depending on Paper and using their API

clever lantern
#

import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerKickEvent;
import org.jetbrains.annotations.NotNull;

public class KickCommand implements CommandExecutor {
    @Override
    public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command,
                             @NotNull String label, @NotNull String[] args) {
        if (commandSender instanceof Player sender) {
            Player playerToKick = Bukkit.getServer().getPlayerExact(args[0]);

            
            if (playerToKick == null) {
                sender.sendMessage("player not online");
                return true;
            }

            playerToKick.kick(Component.text("kik"), PlayerKickEvent.Cause.KICK_COMMAND);

            return true;
        }
        return true;
    }
}
chrome beacon
clever lantern
#

it compiles and everything

chrome beacon
#

You can't use that on Spigot

nimble oxide
clever lantern
#

what should i do

visual tide
#

but

#

warning

twilit creek
chrome beacon
river oracle
visual tide
chrome beacon
twilit creek
visual tide
#

cuz of the possibilty of players renaming items and other stuff

chrome beacon
visual tide
#

its just something that you should avoid

nimble oxide
#

so its impossible. 😄

clever lantern
visual tide
#

even so unless your environtment is really controlled i would not recommend it

#

but if you really wanna

#

get the display name from its itemmeta

pseudo hazel
#

use pdc

#

?pdc

pseudo hazel
#

and store some unique name in there

visual tide
#

you really should

nimble oxide
pseudo hazel
#

nbt

nimble oxide
#

?nbt

#

oof

pseudo hazel
#

and if you are using 1.8 you are already dead

#

eah there is no command for it xD

#

google it I guess

chrome beacon
#

or use NBT API

nimble oxide
visual tide
#

then use nbtapi

shadow night
#

I wanted to make pdc for 1.8, but I decided to fuck it

nimble oxide
#

I gotta do it aswell

#

danish people hates 1.9+ pvp

chrome beacon
shadow night
eternal oxide
nimble oxide
nimble oxide
shadow night
#

Viabackwards

chrome beacon
eternal oxide
#

nowhere near

nimble oxide
nimble oxide
eternal oxide
#

no

nimble oxide
#

They're.

pseudo hazel
#

1.8 client does have the cooldown indicator at all

#

as there was no cooldown

nimble oxide
#

wut

shadow night
#

You can imitate it by using titles, but only if you need

visual tide
#

thats what viabackwards does

shadow night
#

And geyser

visual tide
#

we dont talk about geyser

nimble oxide
#

HAhahaha

shadow night
#

The best setup would be something like a 1.16 server (for optimal performance) with viaforward, viabackwards, viarewind and some plugin to return old combat mechanics. You'll get a lot of the new api features and yet people will be able to join from 1.8 and play like normal

nimble oxide
#

you cant go up at ladders

timid hedge
nimble oxide
nimble oxide
#

Folk er hovedløse

visual tide
timid hedge
#

Enig

shadow night
timid hedge
#

Altså de ved ikke hvad de går glip af

maiden geode
#
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
    fun onEntityDamage(e: EntityDamageByEntityEvent) {

        // Only handle item frames, armor stands and end crystals
        if (e.entity !is ItemFrame && e.entity !is ArmorStand && e.entity !is EnderCrystal) return
        val location = e.entity.location

        if (e.damager is Player) {
            val player = e.damager as Player
            // Check the break blocks flag
            e.isCancelled = ListenerUtils.shouldCancel(player, location, "breakBlocks")
        }

        val projectile = e.damager as? Projectile ?: return
        val player = projectile.shooter as? Player ?: return

        // Cancel if the specified player doesn't have enough permissions
        e.isCancelled = ListenerUtils.shouldCancel(player, location, "breakBlocks")
        projectile.remove()
        }
    }

Hi,
I've got my little code snippet and have a question if it would be possible to get rid of "if" statement which is checking if e.damager is an instance of Player. I thought about creating a val player and assigning the value of e.damager (val player = e.damager as Player) to it but I'm not sure if it's gonna work as intended. Any ideas?

nimble oxide
# timid hedge Enig

Mit liv ville være så lettere hvis man kunne lave en 1.19/1.20 server, og man ville kunne lave så mange fede features

shadow night
chrome beacon
shadow night
#

Wait you can?

nimble oxide
#

yes

shadow night
#

Holy shit

nimble oxide
#

server.properties

timid hedge
nimble oxide
visual tide
shadow night
visual tide
shadow night
#

Super

nimble oxide
#

Legit kan 70 sprog med alt det man lære i dansk skole

timid hedge
#

Hahaha

#

Så er der bare tyskere der stort set kun lære tysk

maiden geode
#

I mean I know how it works but not everything XD

visual tide
#

well in that case probably try it and see

nimble oxide
maiden geode
maiden geode
# visual tide well in that case probably try it and see
override fun execute(sender: CommandSender, args: Array<String>) {
        val player = sender as? ConsoleCommandSender
        player?.sendMessage("test")
        val pl = sender as Player
        pl.sendColoured("Hi!")
    }

Possible to make it like that in the command but I can't find a way around it in the listener so I'll stick to the method I have now

chilly hearth
#

a

round finch
chrome beacon
#

Don't forget that this is an English only discord

round finch
quiet ice
#

I disagree.

sterile breach
#

Hi, if i good understand, un Java, hexcolor os like this

#1234xy is &1&2&3&4&x&y?

sterile breach
#

Ah yes

sterile breach
chrome beacon
#

ChatColor can convert hex

#

You'd need to locate the hex color your self though

sterile breach
#

And i can §#1234# directly ?

kind hatch
#

That's not the correct format.

young knoll
#

You can use #123423 in ChatColor.of

sterile breach
sterile breach
kind hatch
#

Yes, net.md_5.bungee.api.ChatColor

young knoll
#

Yes

sterile breach
#

Ah bungee no spigot directly?

kind hatch
#

The bungee chat color is included in spigot.

chilly hearth
#

Heh

young knoll
#

Wrong ChatColor

kind hatch
#

No

young knoll
#

?jd-bcc

kind hatch
#

Idk why the bukkit chatcolor seems to be obsolete, but you can just use the bungeecord ChatColor class.

late sonnet
#

Hi, any form to generate a new end world but with not dragon and the exit portal created? i wanna avoid make random things like kill the dragon later than spawn because need wait the animation and all the things :/

young knoll
#

You could reset all chunks except the centre few

#

And change the seed

kind hatch
#

Couldn't you also just change the spawnpoint in the end?

sterile breach
#

And without bungee, i cant translate ?

kind hatch
#

#of() isn't included in the bukkit ChatColor class.

sterile breach
#

&#1234# and i basic translate it. Is good?

kind hatch
#

?chatcolor

#

?hex

#

Is there not a command that shows the general way to translate hex color codes?

remote swallow
#

sadly not

#

one sec tho

#
public final Pattern HEX_PATTERN = Pattern.compile("&(#[A-Fa-f0-9]{6})");
    public final char COLOR_CHAR = ChatColor.COLOR_CHAR;

    public String translateHexColorCodes(String message) {
        //Sourced from this post by imDaniX: https://github.com/SpigotMC/BungeeCord/pull/2883#issuecomment-653955600
        Matcher matcher = HEX_PATTERN.matcher(message);
        StringBuffer buffer = new StringBuffer(message.length() + 4 * 8);
        while (matcher.find()) {
            String group = matcher.group(1);
            matcher.appendReplacement(buffer, COLOR_CHAR + "x"
                    + COLOR_CHAR + group.charAt(0) + COLOR_CHAR + group.charAt(1)
                    + COLOR_CHAR + group.charAt(2) + COLOR_CHAR + group.charAt(3)
                    + COLOR_CHAR + group.charAt(4) + COLOR_CHAR + group.charAt(5)
            );
        }
        return matcher.appendTail(buffer).toString();
    }
late sonnet
young knoll
#

It won’t spawn the dragon if you don’t reset the dragon battle data

young knoll
#

Which I think is stored in level.dat

maiden geode
kind hatch
arctic moth
#

buildtools failed while trying to update to 1.20 because it couldnt find some maven dep

sterile breach
remote swallow
#

i dont use the format so just send the first i found

remote swallow
sterile breach
#

Shadow?

remote swallow
sterile breach
#

And without bungee, is not possible to translate hex with basic spigot lib?

maiden geode
arctic moth
#

[ERROR] Plugin org.apache.maven.plugins:maven-jar-plugin:3.3.0 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-jar-plugin:jar:3.3.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1] when running buildtools 1.20

eternal night
#

bungeechat is a transitive depndency of spigot-api

arctic moth
maiden geode
kind hatch
maiden geode
#

It's much nicer to code with for me

sterile breach
remote swallow
#

no

#

its inside of spigot

arctic moth
sterile breach
arctic moth
#

fails on Spigot-API reactor step

chrome beacon
kind hatch
arctic moth
#

oh wait its telling me i should update maven or something

#

cant find stuff in local repo

arctic moth
#

im running it from the buildtools.bat

sterile breach
chrome beacon
#

??

arctic moth
#

curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate. looks like i might be using outdated buildtools too

kind hatch
#

Well, it would probably help if you always had an up to date version.

sterile breach
kind hatch
#

It does use ChatColor#of()

chrome beacon
kind hatch
#

Also, I don't think that bat script is really that good. Would be better if you ran BuildTools from the command line.

arctic moth
#

ahhh i updated the batch file and now it asks for jdk versoin

#

hmm just says done and nothing else

#

and thers no file

kind hatch
#

You'd probably be better off doing this manually.

chrome beacon
#

The download (of the BuildTools jar) failed

#

Yeah do it manually

river oracle
#

BuildToolsGui Soon 🙏

#

hopefully

kind hatch
#

The problem with that bat script is that it's looking for specific java versions that you may not even have installed.
The GUI will solve most of these problems once it's complete. :3

#

But in the mean time, gotta do it the old fashioned way.

sterile breach
serene sigil
#

how do i make the player burn?

kind hatch
#

Entity#setFireTicks()

serene sigil
#

thx

#

and what are the params?

#

oh nvm

#

got it

sullen marlin
#

?jd

sterile breach
sullen marlin
#

Yes

coarse elm
#

anyone can help me out i wanne send my players from my lobby to my survival world true a gui but nothing works

arctic moth
#

still fails on latest buildtools

#

same error

sterile breach
#

and .of returns what exactly?

kind hatch
arctic moth
sterile breach
kind hatch
kind hatch
# sterile breach so the same as translatecolor?

Yes. #FFFFFF is not a valid color code that minecraft can display. Minecraft uses the section symbol (§) to denote color.
#FFFFFF would get translated into §x§f§f§f§f§f§f using ChatColor#of("#FFFFFF")

maiden geode
twilit shadow
#

can someone please help me i have a portal plugin but only the people with op have accse to enter the portal

coarse elm
#

back in the day i knew it was possible but not sure now

maiden geode
#

Uh? So I guess it'd be better to ask such question on skript discord

maiden geode
sterile breach
twilit shadow
kind hatch
steady rapids
#

Can obfuscated plugins be uploaded to spigot? I've heared they must be decompilable but it's quite unsafe for devs.. is it like this?

sullen marlin
#

The rules are very clear

#

Read them

sterile breach
young knoll
#

Yes it must be decompilable and at least somewhat readable

shut mauve
#

Hi, i'm looking for customizing villager trades in spigot 1.20, but I can't find anything on the web, have you some documentation for me please ?

maiden geode
#
@EventHandler
public void onPlayerPortal(PlayerPortalEvent e) {
  if(!e.getPlayer.isOp()) {
    e.setCancelled(true);
  }
}

Should work, if you want to have that for a specific portal then check for event cause

maiden geode
shut mauve
young knoll
#

Because that’s adventure api

#

So you’d need to include adventure

kind hatch
#

One of these days Choco's component PR will finally get merged and then you can use components.

shut mauve
#

That wouldn't be a big deal ?

sullen marlin
#

sendMessage has components anyway if you want

#

Not sure what your point is

young knoll
#

Adventures Bukkit adapter only works with sendMessage

#

But with ChatColor.if you can use it anywhere

remote swallow
#

anyone here know ruby, dont even think about typing ?ask

#

more of a bundler issue but same thing

young knoll
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

remote swallow
#

ur a whore' josh

river oracle
#

Epic

remote swallow
#

hi

river oracle
#

Maybe should just ask and not look for experts on the issue

#

Don't just ask to ask

remote swallow
#

im gonna smack you

#

fine then

river oracle
#

Used ruby

remote swallow
#

i found just the docs and im trying to run it locally

#

sorry

quiet ice
remote swallow
#

both

young knoll
#

Tf is just the docs

remote swallow
#

just the docs

kind hatch
#

Projects that name themselves as common phrases give me mixed feelings.

young knoll
#

Are you over engineering javadocs for epic spigot lib

remote swallow
#

no

#

its wiki

#
young knoll
#

A wiki for what

remote swallow
#

anything you want

young knoll
#

Okay but what are you putting on it

remote swallow
#

simplechatgames stuff

#

or otherplugins

#

idk

young knoll
#

Nerd

#

What’s wrong with GitHub pages

remote swallow
#

this runs on github pages

#

it just looks better

young knoll
#

Or git book

remote swallow
#

could use gitbook

#

but why not host it myself

#

get shitted on

#

idk why you did

#

but yeah

peak depot
#

anyone using intelliJ knowing why it crashes when I try to copy paste (or any type of ItemStack copy pasting): java playerHiderInventory.setItem(2, new ItemBuilder(Material.RED_DYE).setName("§cNo Players").getItem());

fallen scaffold
#

can someone help me, why intellj only display { /* compiled code */ } and not the right code there? Ihttps://cdn.discordapp.com/attachments/431618303212126208/1133880277698097244/image.png

remote swallow
#

you have the java bytecode decompiler plugin disabled

fallen scaffold
#

nopehttps://cdn.discordapp.com/attachments/431618303212126208/1133881008027082885/image.png

quiet ice
#

Just use the Quiltflower decompiler plugin

quiet ice
#

Or really alternatively use Recaf

quiet ice
fallen scaffold
quiet ice
#

What leads you to believe that IJ is aware that this file is the right one?

fallen scaffold
#

i added it to the source file?

quiet ice
#

The proper way?

#

I know that in eclipse you'll have a serious pain if you try to do that if you also use maven or gradle at the same time

#

Unless you use next-tier gradle scripting you'll have similar issues with IJ I assume

fallen scaffold
quiet ice
#

Bundle that sources folder in a zip file (making sure that the "org" folder is in the root of the zip file), rename it to "spigot-1.20.1-R0.1-SNAPSHOT-sources.jar" and move the file into "$USER_HOME$/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT"

#

It is important that you get the format right though. That is the source files may not be "src/main/java" or similar

sullen marlin
quiet ice
#

Ouch. not even mojmapped I now realize

lilac dagger
sullen marlin
#

I don't know what that means but I'm sure the API can do it

#

And if it can't, well

#

?jira

undone axleBOT
sullen marlin
#

?contribute

arctic moth
#

How do I make the plugin disable after worlds are done saving n stuff?

lilac dagger
#

you can do it if each player has a different scoreboard but then you have to make teams/objectives for each scoreboard instance

arctic moth
#

Oh hi md5

quaint mantle
#

hey

#

im setting up server donation and i want them non p2w
is a private area for their house considered p2w?
along nick chat color sign color

tidal kettle
#

hello i want to make a /hub and for this, i use the "performCommand" but i see it didn't work with bungeeCord, can you help me?

sullen marlin
#

Can you be more specific

#

Spigot or bungee plugin, and which plugin provides the command

fallen scaffold
sullen marlin
#

You probably want a bungee plugin otherwise you need to use the messaging api

fallen scaffold
worldly ingot
#

Also components should make this more efficient should that get merged sometime soon

young knoll
#

Wink wink nudge nudge

worldly ingot
#

WINK WINK NUDGE NUDGE

tidal kettle
#

`@Override
public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
Player player = (Player) sender;
if (sender instanceof Player){
if (cmd.getName().equalsIgnoreCase("hub") || cmd.getName().equalsIgnoreCase("lobby")){
player.sendMessage(main.getConfig().getString("Hub_world"));
player.sendMessage("server " + main.getConfig().getString("Hub_world"));

            player.chat("/server");
            player.performCommand("Gamemode 1");
        }

    }`
icy beacon
#

it's 3:30 in the morning and I figured out the reason for 2 of my bugs

#

fucking sleeplessness

young knoll
sullen marlin
#

Won't work from a spigot plugin that's a bungee command

fallen scaffold
# sullen marlin 1.20.1 has no limit

[22:34:35] [Server thread/INFO]: [GameTest] [STDOUT] PREFIX length: 1032
java.lang.IllegalArgumentException: Prefix '§x§2§5§3§e§6§c§x§f§e§f§e§f§e§x§f§3§f§3§f§3§x§2§0§3§8§6§0§x§2§3§3§c§6§7§x§0§6§0§6§0§6§x§f§4§f§2§e§c§x§2§5§3§e§6§c§x§2§5§3§e§6§c§x§f§f§f§f§f§f§x§0§0§0§0§0§0§x§2§0§3§8§6§0§x§1§d§3§f§6§d§x§f§3§f§3§f§3§x§f§3§f§3§f§3§x§2§5§3§e§6§c§x§2§3§3§c§6§7§x§2§3§3§c§6§7§x§1§d§3§f§6§d§x§1§d§3§f§6§d§x§1§6§3§8§6§4§x§1§6§3§8§6§4§x§1§6§3§8§6§4§x§2§5§3§e§6§c§x§2§0§3§8§6§0§x§1§6§3§8§6§4§x§1§f§1§e§1§e§x§0§0§0§0§0§0§x§0§0§0§0§0§0§x§f§c§e§3§c§a§x§1§d§3§f§6§d§x§2§3§3§c§6§7§x§2§0§3§8§6§0§x§e§1§e§1§e§1§x§0§1§b§2§6§5§x§f§8§d§d§c§3§x§f§8§d§d§c§3§x§0§1§b§2§6§5§x§e§1§e§1§e§1§x§1§e§3§6§5§e§x§2§3§3§c§6§7§x§e§1§e§1§e§1§x§0§1§b§2§6§5§x§f§8§d§d§c§3§x§f§8§d§d§c§3§x§0§1§b§2§6§5§x§e§1§e§1§e§1§x§2§0§3§8§6§0§x§2§5§3§e§6§b§x§f§e§e§1§c§4§x§f§e§d§b§b§9§x§f§e§d§c§b§c§x§f§e§d§8§b§2§x§f§8§d§3§b§0§x§f§c§d§e§c§1§x§2§2§3§a§6§4§x§2§3§3§c§6§7§x§f§d§d§8§b§6§x§f§e§d§c§b§b§x§f§e§d§a§b§7§x§f§e§d§d§b§e§x§f§9§d§5§b§2§x§f§e§e§3§c§8§x§2§3§3§c§6§7' is longer than the limit of 64 characters (136)

Thats the error im getting :c

tidal kettle
sullen marlin
#

If the distance is less then one it'll be small

tidal kettle
#

like make it work

sullen marlin
#

Messages

tidal kettle
sullen marlin
#

Are the locations correct?

fallen scaffold
fluid river
#

is your code not working or smth

#

show your full class pls

#

or stream it

#

oh actually

#

what's your attacked location z

#

why is it same to x

#

and also why are your calculations so weird

#

@fast merlin

young knoll
#

Can’t you just use location.distance

eternal oxide
#

What are you trying to calculate?

#

if you have the players location and the location you are hitting location.distance is accurate

#

player.getLocation().distance(otherPlayer.getLocation())

#

thats the distance between two players

fast merlin
#

this is my current code

eternal oxide
#

he wants the actual distance I assume

#

why are you even messing with packets?

fast merlin
#

because packets better

#

on 4.2 reach

eternal oxide
#

clearly packets are not better if you can;t use them correctly

#

Just use teh API

#

the math is already done for you

fast merlin
#

but i want to use packet

eternal oxide
#

This output looks to have the correct distance between those locations

#

location1.toVector().subtract(location2.toVector()).length()

fluid river
#

And its valid

fast merlin
#

think my ehhh

fluid river
#

-203 -(-203) = 0

fast merlin
#

thingy messed up

#

ye

#

i fixed now

fluid river
#

251 - 251 = 0

#

0 + 0 = 0

#

So well, both values are a bit higher than 0

#

And squared

#

So 0.2 is perfectly valid

fast merlin
#

yes if figued out now

#

than kyou

fluid river
#

All of your tests were actually valid, cuz locations were really close to each other

#

And by squaring a number which is less than 1, you get a smaller number

glass mauve
#

is this fine:

        MapView view = Bukkit.createMap(world);

        for (MapRenderer old : view.getRenderers()) {
            view.removeRenderer(old);
        }

or will there be a problem because of removing while iterating?

eternal oxide
#

it will CME

glass mauve
#

what should I do instead?

young knoll
#

Iterator

glass mauve
#

so just like this:

        Iterator<MapRenderer> iterator = view.getRenderers().iterator();
        while (iterator.hasNext()) {
            iterator.remove();
        }

or do I still need to call view.removeRenderer?

young knoll
#

Looks good

#

Although idk if getRenderers is a copy

glass mauve
#

where to see the source code again?

#

with the implementation of the MapView?

#

found it

young knoll
#

Yeah so it’s a copy

glass mauve
#

yeah

young knoll
#

That means the original loop shouldn’t throw CME

eternal oxide
#

correct

glass mauve
#

yeah true

eternal oxide
#

so long as the renderer isn;t discarded

#

if it is it will still throw a CME

glass mauve
#

and then should I care about it?

eternal oxide
#

try it and see

quaint mantle
#

If you don't want to care about CME, use an Iterator

eternal oxide
#

if it's going to CME it will do it quite quickly

shadow gazelle
#

What is the maximum amount of food a player can have?

#

Without it being modified by something

quaint mantle
#

20

#

Or 10

#

I don't remember

young knoll
#

20

quaint mantle
#

10 would be half food bar

#

It works as player health

shadow gazelle
#

Wonder why docs say >= 20 in 1.18

quaint mantle
#

Where?

shadow gazelle
#

HumanEntity#getSaturatedRegenRate() and HumanEntity#setSaturatedRegenRate(int ticks)

#

it is for regen rate and not setting hunger or anything, but still odd

young knoll
#

Probably just Incase it somehow gets past 0

quaint mantle
#

am i need connection pool for my project dbs ? why ?

young knoll
#

You don’t need one

#

But it’s nice to have

quaint mantle
#

What harm could it do?

#

if i don't use

young knoll
#

You’d have to use only a single connection

#

Or handle multiple yourself

quaint mantle
#

wait

#

aa this confusing me

#

nvm

worldly ingot
#

The issue with single connections is that they execute things in sequence. They can't execute things in parallel (despite most databases supporting this). So if you perform some query that takes a few seconds and another query immediately after, your second query has to wait until the first one finished

quaint mantle
#

ahhh

#

i understand now

worldly ingot
#

Connection pools maintain a set of connections, some which stay open for a minute or two (or longer depending on how it's configured) after they were last used so it doesn't have to constantly close and reopen connections

#

Though you can get more than one connection at any given time and execute queries in parallel

#

Libraries like HikariCP just do it all for you so you don't have to write your own pooling

#

If your project is large enough, connection pooling is pretty much a must. Though if you're doing infrequent queries or updates, you'll be fine without it

quaint mantle
#

alright

#

btw how much pool am i need ?

#

10, 20 ?

remote swallow
#

id just let hikari handle it

quaint mantle
#

if i do 100 or more

#

will be lag ?

remote swallow
#

probably

quaint mantle
#

which one do u prefer for 2k 3k player server?

remote swallow
#

i just let hikari handle it

worldly ingot
#

I think Hikari defaults to 20 or something like that which is ample amount

quaint mantle
#

btw i save player moneys in db

remote swallow
#

i hope you cache the data

quaint mantle
#

wdym for cache ?

remote swallow
#

save it in a hashmap or use a caching lib like caffiene

#

you shouldnt ever query the db every time you need something, keep it in a hashmap update it every 15-60 min and remove on logout

quaint mantle
#

why am i need this ?

remote swallow
#

otherwise you query the db every single time a placeholder is called or a money update is called

#

which could be multiple per second

quaint mantle
#

alright i understand

#

but hikari not fix this ?

worldly ingot
#

Yeah, with money though you should be aware that money often can be updated so, y'know, update your cache occasionally

#

No, Hikari only just provides you with a pool

remote swallow
#

hikari can allow the querys, it wont cache it tho

worldly ingot
#

Caching just means hold the result of queries in memory. A variable or something

remote swallow
quaint mantle
#

now i will add changed money to hashmap first, after i add to db after i remove money from hashmap ?

remote swallow
#

you keep it in the hashmap the entire time the player is on the server

#

you update the value in the db every 15-60 minutes with the new value

quaint mantle
#

but if server crash ?

remote swallow
#

make sure each method has docs, ignoring private methods, that explains what it does, what it might return

remote swallow
#

not necessarily but it can improve what an ide shows

quaint mantle
#

after add to db

remote swallow
#

thats just unnecessary

#

save it to a map and then update the db, otherwise your just doing double the io

young knoll
#

SimpleSemVersion should probably be a record now

#

Yay records

remote swallow
#

no

#

im not a big fan of them

quaint mantle
#

What should I save to the database?
player rank ?
money?

remote swallow
#

stuff relating to the player

young knoll
#

What’s wrong with records

#

Lul

quaint mantle
#

I wouldn't have thought of this without you

#

btw i wanna tell my project

#

for get ideas like cache

remote swallow
young knoll
#

Perfect for you then

remote swallow
#

no

#

too werid for me

quaint mantle
#

hub datas

  • special money (this money works on all games, and to be bought with real money)
  • donator ranks (if player donate will get rank at all games)

game 1 datas

  • money (money for game 1)
  • level (level for game 1)

game 2 datas

  • money (money for game 2)
  • level (level for game 2)

which one am i need store in db ? so am i need store game datas ?

gray saddle
#

hi how would i reload multiple configs ?

remote swallow
#

set the variable again

gray saddle
#

getPlugin().reloadConfig(); only reloads config.yml

remote swallow
#

im guessing you have a FileConfiguration or YamlConfiguration variable for the config

gray saddle
#

yeah

young knoll
#

YamlConfiguration.loadConfiguration from the file again

remote swallow
#

^^

gray saddle
#

alr

glass mauve
#

is it true that I should avoid JavaPlugin.getPlugin(MyPluginClass.class)?

echo basalt
#

Looks ugly and serves no purpose if you're using DI properly

glass mauve
#

my class is in a library and why should I force the user to DI my own plugin?

echo basalt
#

Make a platform class or something

#

¯_(ツ)_/¯

echo basalt
#

ehh

glass mauve
#

or would it make sense to use the plugin that the user of my library created for the Logger?

echo basalt
#

I wouldn't advise for singletons but in this context it's whatever

echo basalt
#

You can just pass JavaPlugin instead of the specific type

glass mauve
#

I have a plugin/library which others use.
In that plugin is a class which wants to do logging.
Should I use MyPlugin.class's or the users UserPlugin.class's #getLogger?

echo basalt
#

Depends.

#

Is that method unique to the API or a utility method that'd be present in most generic plugins?

#

Ideally you'd use the API's logger to make it more specific where it's firing from

#

But for configs I can see you use the other plugin's logger

glass mauve
glass mauve
safe coral
#

hello, I have a problem ! I have these two files, default and default, and they are impossible to merge. What can I do, please?

echo basalt
#

I'd make some sort of platform system to allow your API to be easily shadable

#

but you can just DI the logger

echo basalt
#

it's just json data

safe coral
#

it's impossible

echo basalt
#

like make a fat jar

safe coral
echo basalt
#

I'm saying something like this

lost matrix
echo basalt
#

So your API plugin would just impl this and you DI the platform everywhere

safe coral
#

I can't do it, sorry: '(

echo basalt
#

So if you were to shade your API, you'd just make your plugin impl the platform too and pass your plugin as the platform

glass mauve
echo basalt
#

External users wouldn't care, this is literally just for shading

remote swallow
echo basalt
#

You don't need the platform interface if you're working with spigot exclusively, I'm saying something like

public class API {

  public static void init(JavaPlugin plugin) {
    MyAPI api = new MyAPIImpl(plugin);
    // register this somewhere
  }
}
public interface MyAPI {

  void doWhatever();
  int getWhatever();

}
public class MyAPIImpl implements MyAPI {

  private final JavaPlugin plugin;

  public MyAPIImpl(JavaPlugin plugin) {
    this.plugin = plugin;
  }

  @Override
  public void doWhatever() {
    plugin.getLogger().info("whatever");
  }

  @Override
  public int getWhatever() {
    return 0; //whatever
  }
}
public class MyAPIPlugin extends JavaPlugin {

  @Override
  public void onEnable() {
    API.init(this);
  }
}
echo basalt
#

I'd explain more about your commands

glass mauve
#

without using stuff like singleton etc

echo basalt
#

MyAPIImpl is hidden

#

Everyone will just use the MyAPI interface through RegisteredServiceProvider

#

Same way people use vault

#

you just need to register it

#

The fun thing about this is that

#

Let's assume you're shading the API instead of using it as an external plugin

glass mauve
#

ah you want me to use the ServicesManager

safe coral
#

can someone help me merge two json please?

echo basalt
#

You can just do

public class MyPluginThatShadesTheAPI extends JavaPlugin {

  @Override
  public void onEnable() {
    API.init(this);
  }
}
echo basalt
#

And it'll still work

safe coral
glass mauve
#

ah ok now I understand what you want, thanks

echo basalt
#

If you're feeling special you can make a static getter that returns your MyAPI instance

#

and maybe an isRegistered that just checks for null

echo basalt
#

This is how I explain my commands

orchid trout
#

im bouta blow

echo basalt
#

go for it

gray saddle
orchid trout
gray saddle
#
if (sender.hasPermission("score.reload")) {
      try {
            getPlugin().reloadConfig();
            YamlConfiguration.loadConfiguration(msgs);
            sender.sendMessage(colorize(msgsc.getString("Reload-Success")));
      } catch (Exception e) {
            e.printStackTrace();
            sender.sendMessage(colorize(msgsc.getString("Reload-Error")));
      }
} else {
      sender.sendMessage(colorize(msgsc.getString("No-Perms")));
}
young knoll
#

You need to actually do something with the return value of loadConfiguration

#

ie assign it to a field

gray saddle
remote swallow
#

you have a variable for it in ur main class dont you?

gray saddle
#

ye

remote swallow
#

so make a method that sets that variable again

gray saddle
#

load config works in main class but not in my reload command class

bitter rune
#

Mining block list: diamond, emerald, coal, netherite gold, calcite, gold, copper, diorite, granite, ancient debres, stone, netherite, end stone, am I missing anything? (The purple block in geodes, ).. I'm sure there's a list online somewhere

remote swallow
#

whats the list of

bitter rune
#

If it were an rpg mining related blocks

remote swallow
#

amethyst, andersite

#

deepslate and its ores

bitter rune
#

Completely forgot that's not stone down there

gray saddle
#

hey also to catch config errors should i use IOException?

#

wait nvm

young knoll
#

There’s also tuff and calcite

bitter rune
#

I use intellij IDEA and it usually recommends to add it after the "public void ()... It looks cleaner imo

arctic moth
#
Main.worlds.forEach(w -> {
            World world = server.getWorld(w);
            assert world != null;
            File folder = world.getWorldFolder();

            world.getPlayers().forEach(p -> {
                p.kickPlayer("World is being reset");
            });

            server.unloadWorld(world, false);

            assert folder.delete();
            Main.LOGGER.info("Successfully deleted " + w);

            WorldCreator wc = new WorldCreator(w);
            server.createWorld(wc);
            Main.LOGGER.info("Sucessfully regenerated " + w);
        });

for some reason this is not resetting the worlds or deleting the folders, its as if folder.delete() is somehow quietly crashing without setting off the assert

#

and yes i used forEach lol

lost matrix
#

Assertions arent enabled on default. They are a debugging feature you have to enable on your jvm.

arctic moth
#

oh

lost matrix
#

This is a common problem btw. Unloading a world wont free all resources immediately.

arctic moth
#

im guessing its autosave causing problems

lost matrix
#

Only in a hacky way. You simply call folder.delete() in a loop until the folder is actually gone.

arctic moth
#

hmm

#

doesnt apache have a file utils or something that waits for resources to be free

gray saddle
#

what exception do i use for config reload errors

lost matrix
arctic moth
#

oh it literally does the same thing

gray saddle
#

what exception would that be

native gale
#

Are plugins loaded before server ticks start or during the first tick?

slender elbow
#

before

#

unless you /reload :trollface:

native gale
#

Alright