#help-development

1 messages · Page 241 of 1

tender shard
#

just call "saveDefaultConfig()" in your onEnable method

mystic terrace
#

done

#

now should appear right?

#

im gonna try

tender shard
#

well, first delete your config.yml in your plugins folder

#

then try it again

#

saveDefaultConfig() simply writes your included config.yml to a file, unless it already exists

mystic terrace
#

but if in the future I wannt to update the plugin, they have to remove their config.yml to make the updated one?

tender shard
#

erm well, yeah

mystic terrace
summer scroll
tulip nimbus
remote swallow
mystic terrace
#

yes it is

tender shard
#

this is how I update config files

remote swallow
mystic terrace
#

in onEnable method

remote swallow
#

check that the config.yml is in the jar, it might be the compiler not including the config

mystic terrace
tender shard
#

are you using maven?

mystic terrace
#

yes

tender shard
#

if so, ?paste your pom.xml pls

#

?paste

undone axleBOT
remote swallow
#

?paste

undone axleBOT
mystic terrace
tender shard
#

looks good. how did you compile? "mvn package"?

mystic terrace
tender shard
#

do "package"

#

not "compile"

#

"compile" only compiles the .java files but it doesnt put it into a .jar file

#

"package" is like "compile + put it into a .jar file"

mystic terrace
#

I knew that, i just pressed there by mistake

#

I'm going to try if now works

remote swallow
tender shard
remote swallow
#

i mean how does it actually save the new config

mystic terrace
#

Nope

#

It stills empty

#

for some reason

tender shard
#

I've written that a few years ago

remote swallow
tender shard
#

yeah

remote swallow
#

because the config it is trying to make already exists and it wont overwrite it

mystic terrace
#

I'm removing it just to see if the comments displays in config.yml

#

But I'm deleting them and creating new ones

tender shard
#

saveDefaultConfig() is nothing more than

if(!new File("config.yml").exists())) {
  saveResource("config.yml", true);
}
mystic terrace
#

and still

tender shard
#

are you on windows?

mystic terrace
#

yes

tender shard
#

open your .jar with winrar or similar

#

and check if it actually contains your stuff

mystic terrace
tender shard
#

and that's also what it saves, right?

#

if so, everything's working?

#

looks fine to me

mystic terrace
#

Yes, but the comment doesn't displays on the server

#

Like

remote swallow
#

what mc version

mystic terrace
#

1.19.2

remote swallow
#

im more confused

tender shard
#

show a screenshot of the "final" file pls

#

the one that your plugin creates

mystic terrace
#

it's empty

#

because the spawn one appears once I create the spawnpoint

#

that works good

#

I Just want to know how I can put the #

tender shard
#

show your onEnable() method pls

remote swallow
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
mystic terrace
#
@Override
    public void onEnable() {
        Bukkit.getConsoleSender().sendMessage(name + ChatColor.GREEN + " It's now working correctly!.");

        registerConfig();
        registerCommand();
        saveDefaultConfig();
remote swallow
#

thanks

tender shard
#

what does "registerConfig()" do?

remote swallow
#

remove the registerConfig() method then see if it works

mystic terrace
#

Sorry I deleted just the ko-fi thing just for preventing

remote swallow
#

there was a kofi link?

mystic terrace
#
public void registerConfig(){
        File config = new File(getDataFolder(), "config.yml");
        configPath = config.getPath();

        if (!config.exists()){
            this.getConfig().options().copyDefaults(true);
            saveConfig();
        }
    }
remote swallow
#

yeah, remove the call for that in the onEnable then see if it works

tender shard
#

yeah

mystic terrace
#

Now works

#

tysm ^^

tender shard
#

nice

#

the problem was that you saved the empty config before calling saveDefaultConfig()

mystic terrace
#

And sorry for making probably dumb questions, but I'm try to learn java and minecraft dev at the same time

tender shard
#

no problem

#

that's what this channel is for lol

mystic terrace
#

And since im newbie I have this dumb questions

remote swallow
#

thats fine, exactly what i did

#

except i didnt use this channel

mystic terrace
#

they do

#

?spoonfeeding

#

i dont remember the command

#

but ye

tender shard
#

or ?learnjava lol

remote swallow
#

?spoonfeed ?

tender shard
#

?learnjava

undone axleBOT
tender shard
#

?spoon

undone axleBOT
#

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

mystic terrace
#

yes

#

that

remote swallow
#

there you go

mystic terrace
#

so

#

it's like

#

._.

remote swallow
#

ive only seen 1 other person do

#

?learnjava!

undone axleBOT
remote swallow
tender shard
#

spoonfeeding is indeed not that good, but you just asked a valid question, so if anyone uses this command, they are a jerk, lol

mystic terrace
#

Because I'm not asking for a full code, I'm trying to manage by myself with that

#

Just little details that I don't know

#

to impove

#

btw

tender shard
#

all good

mystic terrace
#

to test more versions of the plugins

#

I have to create servers 1 by 1 and test them?

#

or there's another fastest way

remote swallow
#

test on the lower version you want to support

tender shard
#

spoonfeeding is like
"how can I check if the block is a valid chest location?"

A valid answer should be "Just check if the block is air, if the block above is air too, and if the block below is solid."

A spoonfeeding answer would be

    private static boolean isPossibleLocation(Block block) {
        if(!block.getType().isAir()) return false; // Block above must be air
        if(!block.getRelative(BlockFace.UP).getType().isAir()) return false; // Chest block must be air too
        if(!block.getRelative(BlockFace.DOWN).getType().isSolid()) return false; // Block below must be solid
        return true; // All good
    }
remote swallow
#

if theres nms you would need servers for each version

mystic terrace
tender shard
#

no

remote swallow
#

if you want to support lets say 1.16 and higher just add 1.16 api and everything is backwards compatible

tender shard
#

if you only use the API (if you have "spigot-api" in your pom instead of "spigot"), then it usually runs in every version just fine

mystic terrace
tender shard
#

and then check whether it says "spigot" or "spigot-api"

mystic terrace
#

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

#

Find it

tender shard
#

looks good

mystic terrace
#

yes, I was looking for it

tender shard
#

it will probably run in every version

mystic terrace
#

Okey okey

tender shard
#

or did you specify an "api-version" in plugin.yml?

remote swallow
#

if you need or have multiple servers , i would recommend putting them all in separate folders in a central location with a bat looking something like

 @echo off
set /p "param=Server: "

cd %param%
java -Xmx2048M -Xms1024M -DIReallyKnowWhatIAmDoingISwear -jar server.jar nogui```
and just name the folders versions
tender shard
#

pls also show your plugin.yml @mystic terrace

mystic terrace
#

name: SimpleSetSpawn
version: '${project.version}'
main: mrstreeet.simplesetspawn.SimpleSetSpawn
api-version: 1.19
authors: [ MrStreeet ]
description: A simple set spawn plugin.

commands:
simplesetspawn:
aliases: "sss"
permission: "simplesetspawn.admin"
description: Main command
setspawn:
description: Set world spawn point.
spawn:
description: Teleport to the world spawn point.

tender shard
#

oh ok

#

you have "api-version: 1.19"

#

change that to 1.13 and then it will magically work in every version (even versions older than 1.13)

mystic terrace
#

okey, thanks for that!

tender shard
#

np

mystic terrace
#

I don't know in which versions I want to make it, because it'll be my first plugin that I want to post

#

It's simple? yes

#

could be useful for ppl? I think so

#

And I want to add like particles and stuff

#

but idk

tender shard
#

spigot will always check "is this server currently running a version that's equal or newer to what the plugin suggested in plugin.yml?" And if yes, it will try to run the plugin - if no, it will not do that. But before 1.13, it didn't read the "api-version" anyway. So yeah, just set it to 1.13

mystic terrace
#

i have to learn a lot

tender shard
tender shard
#

if you do not care about 1.8, then just go for 1.19.2

remote swallow
#

one tip ill give, dont say or want to do thinks you know you cant, do things you can then work up to them

tender shard
#

+1

tender shard
mystic terrace
#

There's any possibilitty to add more than one permission in one command?

#

to make it like

#

you need this or this

remote swallow
#

in plugin.yml no, in code checking yes

mystic terrace
#
if (sender.hasPermission("simplesetspawn.setspawn"))
#

for example

#

I have that one

#

there's any way to make it

#

you have this one or this one?

remote swallow
#

if (player.hasPerm(perm1) || player.hasPerm(perm2)) run

mystic terrace
#

with ||

#

okey

#

now I know it

remote swallow
#

|| = or
&& = and

fresh timber
#

if I want to remove all of the mobs in a specific world on the start of the server or when my plugin enables, it gives me an error saying that bukkit cannot get world "nether" cus return value of bukkit.getworld("nether") is null this works in any other method besides the onenable (havent tried ondisable but that is not what i want)

#

how can I get this to work

remote swallow
#

nether isnt a world

fresh timber
#

bruh

#

I named it that

remote swallow
#

does the server know that

mystic terrace
#
if (p.hasPermission("simplesetspawn.setspawn") || p.hasPermission("simplesetspawn.admin"))
fresh timber
#

and it works in any other class

fresh timber
#

cus it works anywhere else

mystic terrace
#

I dunno why I'm creating 2 permissions, only admins it's going to put setspawn commands

#

XD

#

I'm gonna make it more simple

remote swallow
#

oh also follow DRY

mystic terrace
remote swallow
#

DRY = dont repeat yourself

#

might happen on some methods

#

because they have 2 different ways to be called but run the same code

fresh timber
#

I tested it on that but I am not using it

#

but im just saying how can I remove all mobs in a certain world on the enable of the plugin

fresh timber
#

wdym

#

it does everywhere else

amber vapor
#

hi all help

fresh timber
#

cus I made it

tender shard
#

it's usually called "world_nether"

amber vapor
#
[01:10:35 WARN]: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.RuntimeException: Unable to access address of buffer
        at io.netty.channel.epoll.Native.read(Native Method) ~[patched_1.8.8.jar:git-PaperSpigot-445]
        at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.doReadBytes(EpollSocketChannel.java:678) [patched_1.8.8.jar:git-PaperSpigot-445]
        at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:714) [patched_1.8.8.jar:git-PaperSpigot-445]
        at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe$3.run(EpollSocketChannel.java:755) [patched_1.8.8.jar:git-PaperSpigot-445]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [patched_1.8.8.jar:git-PaperSpigot-445]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:268) [patched_1.8.8.jar:git-PaperSpigot-445]
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [patched_1.8.8.jar:git-PaperSpigot-445]
        at java.lang.Thread.run(Thread.java:831) [?:?]
fresh timber
fresh timber
#

I renamed it

tender shard
fresh timber
#

well then why does it work everywhere else

#

and I can go there

tender shard
fresh timber
#

I use a plugin called multiverse core to do it

amber vapor
tender shard
remote swallow
# remote swallow because they have 2 different ways to be called but run the same code

example being

command class without following dry:

public boolean onCommand(Stuff go here) {
  if (sender.hasPermission(perm1) {
    sender.sendMessage("You are sus");
  }
  if (sender.hasPermission(perm2) {
    sender.sendMessage("You are sus");
  }
}

Command class with following dry

public boolean onCommand(Stuff go here) {
  if (sender instance of Player player) { 
    if (sender.hasPermission(perm1) {
      sendSusMessage(player);
    }
    if (sender.hasPermission(perm2) {
      sendSusMessage(player);
    }
}

private void sendSusMessage(Player player) {
  player.sendMessage("You are sus");
}
fresh timber
#

idk when it loads the worlds

#

I put it in on enable

amber vapor
tender shard
fresh timber
#

yes

tender shard
#

ok then you have 2 options:

#
  1. Either add Multiverse as "depend" in your plugin.yml
#

or

#
  1. Simply delay what you are doing by one tick
#

option 1 is probably better

fresh timber
#

yea, I tried delaying it, it did not work

#

but I delayed it like 4 secs

#

same thing

tender shard
#

hmmm show your code pls

fresh timber
#

ill try to do depend

#

I tried it a while ago I dont have code from when I tried it but I could try it again

amber vapor
tender shard
fresh timber
#

I used Bukkit.getScheduler.runtasklater

#

ig ill show u what it is rn

tender shard
#

I can only help you if you use a recent version

fresh timber
river oracle
#

Holy

fresh timber
#

lmao

river oracle
#

?paste ftw

undone axleBOT
tender shard
#

show your plugin.yml pls

fresh timber
#

yes

#

ok

amber vapor
#

problem for minecraft version ?

fresh timber
tender shard
tender shard
#
depend:
- Multiverse-core
fresh timber
#

ok

#

do I needa add anything to pom.xml or anything, ive never used depends

tender shard
#

nope

#

just add it to plugin.yml, that should do it

fresh timber
#

ok thx

remote swallow
#

a depend means your plugin will only load after that plugin has loaded, if that plugin does not exist your plugin will not load. If you use a soft-depend it means your plugin will load if that plugin does not exist but if that plugin does exist it will load after that plugin has loaded

tender shard
#

^

#

if it still doesn't work, let me know, then we can debug it further

tender shard
#

hm okay, gimme a sec pls

fresh timber
#

k

tender shard
#

sorry my bad

#

it should be "Multiverse-Core"

#

(uppercase "C")

#

in plugin.yml

fresh timber
#

caps count xd

tender shard
#

yeah lol

#

the SimplePluginManager uses a very straightforward Map<String,Plugin> 😄

fresh timber
#

what would happen if 2 plugins depended on eachother

tender shard
#

then you're fucked

fresh timber
#

lmao

tender shard
#

it won't work, it will complain about "cyclic dependencies" or sth like that

fresh timber
#

lol ok

#

welp no errors

remote swallow
#

wouldnt it just throw 2 errors and shut up

tender shard
#

yeah well

#

it will tell you sth like this:

remote swallow
#

they would have to send them both like nanoseconds apart

tender shard
#
[Plugin1] Could not load plugin 1 because of cyclic dependencies
[Plugin2] Could not load plugin 2 because plugin 1 isn't loaded
#

sth like this

#

I am not 1000% sure though, I never experienced this problem

fresh timber
#

yea uh this did not give any errors but does not kill

tender shard
#

does not kill?

#

wdym?

fresh timber
#

there are still like 20 piglin brutes in nether

#

should kill all of em

#

on enable

tender shard
#

didnt we talk about this ealier today?

#

you HAVE to load the chunks

fresh timber
#

hm?

tender shard
#

you cannot simply kill entities in unloaded chunks

fresh timber
#

that was not today

tender shard
#

idk lol

fresh timber
#

was like a week ago

tender shard
#

oh well then I was talking to someone else today

fresh timber
#

but I tried the thing that loads them

tender shard
#

anyway, you either have to load the chunk, or edit the .dat files directly

fresh timber
#

oh wait I gotta load them in on enable xd

#

I loaded them 20 sec after server start

#

or plugin start

tender shard
#

do you know the location of your piglins that you wanna kill?

fresh timber
#

yes

tender shard
#

oki then you can just add a "plugin chunk ticket"

fresh timber
#

yep

fresh timber
#

I got it

#

thx

tender shard
#

or well

#

if you only wanna kill some entities, you don't even need a ticket

fresh timber
#

oh uh ok

#

what I needa do

tender shard
#

you could also just call "World#getChunk"

#

(in the same tick)

fresh timber
#

oh thats what I do

tender shard
#

Example:

fresh timber
#

Location loc = new Location(Bukkit.getWorld("nether"), -21, 70, -69);
Chunk chunk = loc.getChunk();
chunk.addPluginChunkTicket(WildGamesSkyMining.getInstance());

tender shard
#

Yeah wait

fresh timber
#

u gave me that like a week ago xd

tender shard
#

getChunk() already loads the chunk

#

so you're already fine

#

you can simply delete the "chunk ticket" line

fresh timber
#

oh xd

#

kk

#

does it still do it if its in a variable?

tender shard
#

sure, but it will only work if you only need the chunk for like 1 tick

#

if you need to keep it loaded for more than one tick, then you indeed need the "chunk ticket"

fresh timber
#

oh ok

#

if its all in on enable, the kill entity and the getchunk, itll work right?

tender shard
#

it "should" work 😄

#

you'll have to try it out

fresh timber
#

🤨

tender shard
#

I am like 99% sure that it should work just fine

remote swallow
#

should™️

tender shard
#

exactly lol

#

there is always a high chance that I might be mistaken

remote swallow
#

if theres something im not 100% sure on i just say iirc or im pretty sure but i might be wrong

tender shard
#

same, but in this case, I am really like 99% sure

#

that's why I said "I'm 99% sure" lol

remote swallow
#

lol

#

lmfaoo

tender shard
#

haha

#

I am only responsible for 467 messages

remote swallow
#

ive only saidit like 61 times

tender shard
#

n00b

remote swallow
#

yer

#

only been here like 6 months

tender shard
#

welp

#

I've been here since 2019 but I got banned a few times lol

#

?userinfo

undone axleBOT
#

Chilling in offline status

Joined Discord on

<t:1570988034>
(<t:1570988034:R>)

Joined this server on

<t:1659361247>
(<t:1659361247:R>)

Roles

<@&690689768996208726>, <@&695824786605080576>

remote swallow
#

i found the exact time i started my first plugin

#

17th of june

river oracle
remote swallow
#

and the first breakdown i had from it was about 12 hours later

remote swallow
#

how are you not in their disc

tender shard
remote swallow
#

bds

river oracle
#

because I'm only in like 4 other discords

remote swallow
#

ya what

tender shard
#

wtf is bds

remote swallow
#

betterdiscord = bd

#

im in 60 servers

tender shard
#

ohhh

#

I uninstalled BD like a few months ago

river oracle
#

security issues?

#

idk how much I trust it tbh lol

remote swallow
#

it broke on the 27th of september because discord changed typescript compiler

tender shard
river oracle
#

I don't use plugins

#

I've never even installed one

#

I just wrote my own CSS from a template

remote swallow
#

oh use openasar

tender shard
#

all I miss from "normal" discord is to shut up messages from people I have blocked

remote swallow
#

it makes discord run somewhat quciker

river oracle
#

doubt

remote swallow
#

also allows you to disable auto updater

tender shard
river oracle
#

yea discord optimization for me is not really a worry either

#

my cpu is pretty unaffected

tender shard
#

my PC is quite beefy lol

remote swallow
#

why

#

why

#

why

river oracle
#

My PC > MFnalex PC

tender shard
remote swallow
#

alex is your name alex or jeff or something completely different

river oracle
tender shard
river oracle
#

fuck

remote swallow
#

who wants to guess the bottleneck on my pc

tender shard
remote swallow
#

its not what you expect

river oracle
#

yo thats your server

tender shard
#

oh yeah

#

mb

river oracle
#

not a fair comparisson

tender shard
#

1 sec

#

but I dont have neofetch installed on my pc

river oracle
#

i don't think its on windows

#

just go to the about section in directx

tender shard
remote swallow
river oracle
#

windows moment

#

holy fuck

#

?paste

undone axleBOT
river oracle
#

next time please

tender shard
#

damn

#

why do you use packets to send titles

#

are you using a 7 year old version of spigot?

river oracle
#

^ true thats a tad sus

#

I bet you he is

sacred fractal
#

This is code from TitleAPI

#

I am trying to understand how it works

tender shard
#

what version do yo uuse?

river oracle
#

this code looks 7 years old tbh

tender shard
#

spigot has a method to send titles using the API

sacred fractal
tender shard
#

you can send titles directly

river oracle
#

spigot has a method to send titles

tender shard
#

no need for any "titles api"

tender shard
#

this ^

river oracle
#

this ^

kind hatch
#

this ^

sacred fractal
river oracle
#

idk look at spigot implementation

#

?stash

undone axleBOT
tender shard
#

"PacketPlayOutTitle" in older versions

#

I don't know the name for recent versions since packets aren't needed anymore

#

ClientboundSetTitleTextPacket in 1..19

sacred fractal
#

Where are you finding this information if you dont mind me asking? A link would be appreciated

tender shard
#

tbh I simply googled "title spigot" for the 1.8 name,. and for 1.19 I just entered "Title" into my IDE and then checked it through

#

HOWEEEEVER

#

if you already know the old names, you can just check the mappings

#

?switchmappings

tender shard
#

damn I didnt know

remote swallow
tender shard
#

I just wrote those blog posts for fun, idk

remote swallow
#

its been sent in total 152 times

tender shard
#

haha

#

nice

#

whenm I wrote thi sstuff, I never realized that other people will actually read it

remote swallow
#

lul

river oracle
#

lol

#

cuz I cbf to explain when someone already has

tender shard
river oracle
#

gross

#

I use adblocker so doesn't bug me

tender shard
#

fun fact:

#

I use this weird erm... "adult movie" website sometimes

river oracle
#

ublockorigin is the best adblocker

tender shard
#

and they also have ads

#

but it doesnt bug me since apple has a builtin ad blocker

remote swallow
#

i have 4 adblockers

river oracle
#

bro just get UBlockOrigin

#

you only need that one

remote swallow
#

i have it

river oracle
#

than delete the others

#

UBlockOrigin is super effective

#

I've not seen an ad in years

remote swallow
tender shard
#

btw I just snacked some clonazepame so I might just pass out in the next few minutes lol

remote swallow
#

if i ever see ads i get another adblocker

river oracle
#

clonazepame

tender shard
#

benzodiacepines

remote swallow
#

its a tranquilizer

tender shard
#

drugs against anxiety

river oracle
#

do you need them or just for the hell of it xD

humble tulip
#

Oh anxiety

#

But ur abusing them tho😂😂

tender shard
#

I need them. But I only take this stuff very infrequently

#

so I am not used to it

wet breach
humble tulip
#

Benzos are addictive

river oracle
#

most anxiety drugs are addictive

tender shard
#

and when I snack benzos, I always only take a tiny dose

humble tulip
#

Lmfao

remote swallow
remote swallow
tender shard
#

e.g. the normal pill for clonazepame is 2mg, I only took 0.5mg

tender shard
river oracle
#

I've never taken my anxiety meds

tender shard
#

which ones did you get?

river oracle
#

Xanax

tender shard
#

oh

#

don't eat that

#

xanax is horrible

remote swallow
#

i got prescribed melatonin but it wasnt enough and i cant swallow pills i managed to take it like 3 times

#

i havent used it since

tender shard
#

you cannot snack it because you're afraid of suffocating and stuff, right?

river oracle
tender shard
remote swallow
#

2:10am seems like a great time to sleep

tender shard
#

xanax is horrible, pls don't use it

river oracle
#

🤷🏽‍♂️ never had to so its whatever

tender shard
#

you can keep it as "backup drugs" but just don'T use it every day

river oracle
#

I don't have a daily med

tender shard
#

good :3

wet breach
# remote swallow

I am very aware of the medication. My younger brother takes it for muscle spasm. At low dosages it works as a muscle relaxer. Higher dosages for eplilepsi which he does have.

river oracle
# tender shard good :3

only time I've gotten close to taking them was when I was about to go to the ER, but I calmed myself down

tender shard
#

xanax is alprazomale right?

river oracle
#

yea

#

iirc

tender shard
wet breach
river oracle
tender shard
river oracle
#

I feel like i wouldn't be myself anymore even if its my anxious self

tender shard
#

I literally cannot leave the house without being drunk or on drugs

#

it sucks D:

#

(and not in the good way)

eternal oxide
#

Easy fix, don;t leave the house

tender shard
#

Elgar is so smart

river oracle
#

oh I was gonna say easy fix become unaddicted

#

but

#

I guess not leaving the house is easier

tender shard
#

why did I even snack those drugs

#

so unnecessary

#

I dont even have to leave the house for the next 1.5 days

#

yeah anyway I'm going to sleep now

#

have a nice day everyone ❤️

river oracle
#

bruh just knocked himself out

ionic dagger
#

how would i view all of the possible return values from .getCause()?

humble tulip
#

you will see them there

ionic dagger
#

Thank you

ancient topaz
#

I'm making sort of a packet log thing

#

for my server

#

and I need to save whether a player needs to be sent a certain packet

#

that they can toggle off with /filter

#

but im not gonna make like 20 different lists

#

and store players

#

idk how i would do it

civic wind
#

Bro takes xannies tf u need help

granite burrow
#

Is there a way to see if a player is drinking a potion? I want to detect when they start drinking a potion, and ensure that they are still drinking the potion after x time. I tried to use the PlayerItemConsumeEvent and PlayerInteractEvent, however, neither of these can accomplish my task. When drinking the potion the player interact event only fires once, and the item consume event only fires after the potion is consumed. Any help would be greatly apperciated

torn shuttle
#

I have the distinct feeling that someone somewhere would vehemently object to how I am building this code

pseudo sluice
#

does anyone know why this is happening

midnight shore
#

Whenever the interact is fired register in a map the player

#

Then whenever the consume fires remove it

#

If you continously register ticks in that time

#

You could get the drinking time

quaint mantle
#

is there a way to make a furnace smelt faster for certain players?

earnest forum
#

#setTotalCookTime(int)

#

from this event

#

and the int should be in ticks

#

@quaint mantle

#

though this isn't a player event

#

it'll be a bit weird since a furnace smelting is not player-specific

#

its a block

quaint mantle
#

ah ok

idle loom
#

I'm getting a java.lang.IllegalStateException: zip file closed when making a reload command for my plugin

This is my code

            Plugin pl = Bukkit.getPluginManager().getPlugin(Main.getInstance().getDescription().getName());
            if(pl == null) {
                player.sendMessage(UChat.component(error() + "&cUnable to reload plugin. Invalid plugin."));
                return true;
            }

            Bukkit.getPluginManager().disablePlugin(pl);
            Bukkit.getPluginManager().enablePlugin(pl);```
#

pl isn't null

#

I have a check for that

quaint mantle
#

I guess I could add an attribute to the itemstack when the player places it in the furnace and check it on smelt

honest vector
#

Cna you guys help me

#

But I can't explain until i show you the ss

chrome beacon
quiet ice
#

It is Safe to ignore, in the worst Case you need to exclude those files

#

But don't ask how exclusions work - I am Not at my PC for a LONG (~6 hours) time now

pseudo sluice
kindred valley
#

Any problem?

twin venture
#

Hello , how i can check if a player recieve an item , iam not talking about PlayerPickUpItemEvent , iam talking about getting items from [chests all actions (Right click , left click , shift right click , shift left click), and pickup]

tardy delta
#

include me as author when taking over big parts pls

#

brr what was i doing: private static final Map<Class<?>, ThrowingBiFunction<Object, Connection, PreparedStatement, Exception>> STATEMENT_PREPARERS = new IdentityHashMap<>();

remote swallow
#

Inventory drag event

twin venture
chrome beacon
#

Yeah and InventoryClickEvent

#

It's both events

twin venture
#

that's look complex

#

xd

echo basalt
#

bit simpler

#

you seem to abstract it a bit too much

#

Your whole Result class is just a stripped down optional

#

or a weird future

echo basalt
#

why the fuck is this erroring with ProtocolLib

tardy delta
round finch
#

Stole gif

opal juniper
echo basalt
#

yes it was giving a nasty exception

#

pretty sure it was just my connection cutting out in the middle of packet sending

#

because working on 2G+ data

#

isn't the best

echo basalt
#

yes it was that stupid

tardy delta
#

About the pojo thing

formal bear
#

Could someone explain me how to properly shadow apis? ```plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java'
}

group 'pl.botprzemek'
version '0.1-REMASTERED'

repositories {
mavenCentral()
maven {
name = 'sonatype-oss-snapshots'
url = 'https://oss.sonatype.org/content/repositories/snapshots'
}
maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}

dependencies {
compileOnly 'org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT'
implementation 'net.kyori:adventure-api:4.12.0'
}

jar {
actions = []
dependsOn('shadowJar')
}

shadowJar {
relocate 'net.kyori:adventure-api:4.12.0', 'shadow.adventure-api'
minimize{
exclude(dependency 'org.spigotmc:spigot-api:.')
exclude(dependency 'org.spigotmc:spigot:.
')
}
}```

#

Right now it's not working

quaint mantle
#

Yooo guys SwapEvent doesn't called when player Press "F" in Inventory How can I cancel it?

remote swallow
#

not that i last remember it doesnt

quaint mantle
#

Yeah

remote swallow
#

the item swaps from main hand to off hand while an inventory is open?

quaint mantle
#

Wait I'll upload the code with

#
    @EventHandler
    public void onMove(PlayerSwapHandItemsEvent e) {
        Player player = e.getPlayer();

        System.out.println("TEST");

        if (!SkyExcelNetworkCosmeticMain.guiUtil.pageMap.containsKey(player) || !SkyExcelNetworkCosmeticMain.guiUtil.typeMap.containsKey(player)) return;

        e.setCancelled(true);
    }
#

It doesn't work

remote swallow
#

well is the player in pageMap or typeMap

molten hearth
#

does the client not like having air as the cursor item or smth

remote swallow
#

can it even get air on the cursor

molten hearth
#

im trying to and its ignoring the fact I tell it to set it to air

#

💀

#

so I have a shmol dupe issue

remote swallow
#

its probably because air isnt an actual item that can be obtained anywhere

remote swallow
#

try setting the cursor to null

molten hearth
#

I fixed it by setting that button ItemStack to air and telling the client not to cancel the click

#

now I created a button duper

#

AAAH

glad prawn
#

Ok

molten hearth
#

Ok

remote swallow
#

have the button their untill they click something in their inventory then set the button to nothing so they can put the item there

molten hearth
#

hmm the issue seems to only have been with shift clicking

remote swallow
#

easy fix

molten hearth
#

whenever I was holding a cursor item and shift clicking it stole the button

#

I just disabled shift clicking

remote swallow
#

dont have the button in the first place

molten hearth
serene sigil
#
[13:29:03 ERROR]: Could not load 'plugins\ZMP.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
    at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:178) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:155) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:421) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:278) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1122) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:303) ~[paper-1.19.jar:git-Paper-81]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
    ... 7 more
#

i cant load my plugin

#

i have a plugin.yml tho

remote swallow
#

plugin.yml needs to be in resources

serene sigil
#

ye i just switched to maven..

#

idk much about maven

remote swallow
#

still needs to be in resources

serene sigil
#

yay now it works!

#

tysm

#

i have one more question tho

#

how do u make a book and quill gui open for a player?

#

i have nms

chrome beacon
#

As far as I'm aware you can only open a written book

#

Not a book and quill

remote swallow
#

^^, the book and quill writing is client side

serene sigil
#

but cant u open it and like save the text if u press done?

serene sigil
mint barn
#

Hi, I have a problem with my event not recognizing a player when creating a nether portal. The documentation says getEntity() returns the portal creator but it doesn't work

Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Entity.getName()" because the return value of "org.bukkit.event.world.PortalCreateEvent.getEntity()" is null

event.getEntity() : Returns the Entity that triggered this portal creation (if available)

My code:

@EventHandler
    public void createPortal(PortalCreateEvent event) {
        if (event.getReason() == event.getReason().FIRE) {
            Bukkit.getServer().broadcastMessage("Un portail a été allumé ! " + event.getEntity().getName());
        }
    }
eternal oxide
#

and the Player is not always available in the event

undone axleBOT
serene sigil
#

there must me a way

mint barn
#

I did not proofread myself sorry for my mistake

#

I just wanted to detect when a player creates a portal

serene sigil
#

basically what i wanted to do is create a profile system: u do /profile and it opens a writable book where u can put in ur profile, and then press done. another player can now do /profile <urname> and then see what u wrote there via a written book

twin venture
#

Hello friends , what does InventoryDragEvent exactly do ?

remote swallow
#

This event is called when the player drags an item in their cursor across the inventory. The ItemStack is distributed across the slots the HumanEntity dragged over. The method of distribution is described by the DragType returned by getType().

twin venture
#

so just to be sure , this is a code i made to ask some questions :
1- from what i understand from this event i can use it to check for the inventory that i got items from ?
2- check for the specfic items ?
3- check for the amount ?

#

what iam trying to achieve , is a bit tricky to do :
when ever a player get 8 ENDER_PEARL , and he got 8 of it . the quest should be done , but only 1 time per game .

wet breach
#

didn't we like have a discussion of this yesterday or day before?

#

I am pretty sure this was discussed already

twin venture
#

yes but i didn't really understand the best way of achieve this

wet breach
#

I distinctly remember something something tasks and timers

#

now I have to go search

twin venture
#

i hope you can explain the events i would need to use , one by one .. this quest is required ..

#

its the hardest one yet xd

#

all other quests , event side is done and its working

wet breach
#

well it doesn't help that you seem to be a help vampire -.-

twin venture
#

yes it seem , i didn't give a chance to other people to get help

#

iam sorry about that ..

wet breach
#

That isn't what a help vampire is

twin venture
#

oh dangt i need to to go out for 30 minutes xd

wet breach
#

help vampire is someone who continuously asks for help and solutions from a community without giving anything in return

twin venture
#

oh i see ..

#

i will try to help other if i can from now on ..

mighty pier
#

how do i make itemstack enum

wet breach
#

anyways point is, you have been asking for help since 2021 from a simple search, have you not learned how to get over obstacles such as this or learned anything from the api that is at your disposal? o.O

#

Like try to attempt to solve your problem instead of continously asking for help till someone gives you code XD

mighty pier
#

killer you would not get hired anywhere

twin venture
#

about how to do it diffrently

wet breach
#

there is about 20 different ways you could solve this all with varying degrees of efficiency and what not

mighty pier
#

make your plugin

#

ask someone to review it

#

profit

mighty pier
remote swallow
molten hearth
#

Enum.valueOf(itemStack), silly 😏

wet breach
#

like, you could just create your own Enums if you really need to lol

remote swallow
wet breach
#

fun fact

#

Enums can implement interfaces for those that didn't know

tender shard
#

enums are kinda normal "final" classes, aren't they?

tardy delta
#

Records can too

wet breach
tardy delta
#

Fun fact you Cant explitly extend Enum class

tender shard
#

yeah

#

all I know is that you cannot extend existing enum classes

#

hewwo choco

tardy delta
#

Learnt about arrays today smh

worldly ingot
tender shard
#

yep that's what I meant

#

although wait

#

there is an isEnum() method on Class IIRC

tardy delta
#

Im dissapointed that you cannot extend Enum<T> directly

#

Wanted to write a generic enum

twilit roost
worldly ingot
remote swallow
#

you want inventory drag event

twilit roost
#

ah thx

tender shard
#

^ what epic said

#

you wanna listen to InventoryClickEvent

twilit roost
twilit roost
tender shard
twilit roost
#

oh bcs im dumb

tender shard
#

the InventoryDragEvent has a method getViews() or sth like that

twilit roost
#

oooh

tender shard
#

then just get the upper inventory from that

#

the lower inventory is ALWAYS the player inv

twilit roost
elfin atlas
#

Buttons pressing would count as Action.RIGHT_CLICK_BLOCK in the PlayerInteractEvent right?

tender shard
#

upper one is always the "actual" inv you are looking for

elfin atlas
#

Okay thx

tender shard
#

np

tender shard
#

sure but only if they clicked the top inv

#

after all, the player might also just click on the bottom inv

tender shard
#

?paste

undone axleBOT
remote swallow
idle loom
tender shard
#

does it work fine when you "properly" restart the server?

idle loom
#

There’s no error when the server starts

tender shard
#

okay then this is the issue

#

the /reload command is horribly broken and you cannot fix this from your end

remote swallow
#

just setting the plugin as disabled then enabled wont do anything

tender shard
#

you should simply stop using /reload and instead always "properly" restart the server

#

that's all I can tell you

remote swallow
#

alex they have the code on their reload command on the message with their error lol

tender shard
#

where? I havent seen it

idle loom
#

Everything works

fervent gate
#

I'm wondering how intensive SQL is. If I'm storing player balance in a db and I'm updating it every time a player spends/earns money. Would that be slow?

tender shard
glass mauve
tender shard
remote swallow
idle loom
#

Oh right, Main.getInstance() is from a library I’m using

tender shard
glass mauve
idle loom
#

It’s returning the plug-in name fine

idle loom
idle loom
#

Oh you’re not talking to me

remote swallow
tender shard
#

maven simply works, gradle always causes problems 😛

remote swallow
#

yucky maven

#

i like my like 30 like build files

idle loom
#

For?

remote swallow
#

replying to the other guy

#

prob

onyx fjord
#

is it possible to make player see hitbox of light block without holding it?

idle loom
twin venture
alpine cairn
#

Would it be possible to make a “anti air cannon” that detects a flying machine entering a designated area and spawns primed tnt on it? If so, would it be difficult to implement and would it potentially cause lag?

tulip nimbus
gray merlin
#

?docs

#

?javadocs

remote swallow
#

?jd

gray merlin
#

oh my god

gray merlin
#

thank you xD

alpine cairn
gray merlin
#

Pretty sure they just don't allow pistons to push past claim borders.

#

usually they can only do it from within actually

humble tulip
#

Making a plugin is easy compared to releasing it

humble tulip
#

I gotta take pics, vids, edit them

#

Write a wiki

gray merlin
tardy delta
#

or you dont give a shit and just place it on the forum

alpine cairn
#

Open source gang

gray merlin
#

everything is open source if you try hard enough

vocal cloud
#

Stadia moment

steady rapids
#

Hi, do you know if is it possible to "cancel a command event" to other plugins? (for example) if a user health is < 20, other plugins wont receive his chat commands

vocal cloud
#

Sounds like something that giving a permission or removing it would solve

alpine cairn
#

Right

#

Create a permission group for players below 20 health and create a check to assign players to that group when their health drops

tulip nimbus
#

I think using the event would be a lot easier than using permissions, not sure if one is objectively more efficient than the other though.

steady rapids
#

+1

vocal cloud
alpine cairn
#

How long do you think it takes to become proficient with the spigot libraries and coding plugins?

vocal cloud
#

If you know java then a few months

#

Assuming 2h a day of code writing

gray merlin
#

wait a minute

#

you mean to tell me we can name BOATS?!

vocal cloud
#

They are entities

gray merlin
#

yeah but like in normal mc we can't just casually go and name a boat

#

brooooo

vocal cloud
#

You can name a boat in an anvil

#

Not sure if it shows up above it though

undone axleBOT
gray merlin
#

but apparently we can do it in spigot ig

#

welp

#

life changing trust

#

me on my way to ?notworking you

hot panther
#

Hey, how can I use a Java application to check if a new entry has been added to a MySQL database, or how can I generally communicate between Java applications? (pls ping)

vocal cloud
#

That's only a headache because a for-loop solves that

eternal oxide
vocal cloud
#

Well you make an array and use a for loop to determine position.

#

The other number can be determined by powering

#

Idk if you can do 1e(3 * i) but that'd work

#

Ah no you'd have to .pow

#

Yeah, that

tardy delta
#

if you want more headaches look at the Math.pow impl

vocal cloud
tardy delta
#

Strictmath has the Math impl

#

its even deeper

#

look at FdLibm.Pow.compute

vocal cloud
tardy delta
#

geld

#

dutch lol

#

meh

mighty pier
#

fif sgsftds; the mdybiard lookx cool, ancjt us dcefijjtfely a henad turner

river oracle
quiet ice
twin venture
#

Hello , i was thinking somethine like this might work ? check when i close the inventory ..

undone axleBOT
twin venture
#

if the item is not ender pearl , return , if the player inventory dosen't have 8 pearl return

tardy delta
#

tried to do bubble sorting in college :{

#

we couldnt use Arrays.sort :(

#

so no clue what i was doing

twin venture
#

like 2007 old ..

#

imagine that they still use windows 7 , in our college xd

tardy delta
#

our teacher is using smth ubuntu alike

twin venture
#

that's really noice

vocal cloud
#

v should just be i*3 not j. J doesn't need to exist.

#

you can then check if amount / v < 10 to know when you're good to format

zinc schooner
#

Am i able to change block type inside a scheduleSyncDelayedTask?

Bukkit.getScheduler().scheduleSyncDelayedTask(JavaPlugin.getPlugin(Plugin.class), new Runnable() {
      @Override
      public void run() {
        System.out.println("Block respawned");
        block.setType(blockMaterial);
      }
}, l);```
tardy delta
#

and use runTaskLater with a lambda instead

#

oh well

#

its sync so it will work yes

serene sigil
#

hi, basically what i wanted to do is create a profile system: u do /profile and it opens a writable book where u can put in ur profile, and then press done. another player can now do /profile <urname> and then see what u wrote there via a written book

is there a way open a writable book for a player with nms?

remote swallow
night sapphire
gray merlin
#

How do I spawn boats of different types, such as acacia, spruce, etc?

remote swallow
serene sigil
#

its easier lol

night sapphire
#

Yeah probably

river oracle
#

Oh nbm I see

#

Each boat is it's own material type iirc

#

Tho as usually my dumbass misunderstood

#

Unless there is some new api the type is in the nbt

gray merlin
#

AH! Thank you

#

That is it indeed!

#

Wait, no it isn't

#

I need an entitytype, not a material

#

,_,

#

@river oracle

eternal oxide
#

then EntityType.BOAT

sleek moon
#

Guys, simple question. Can I have 2 different objectives in a single scoreboard method?

quaint mantle
#

does anyone know why my plugin is not recognized in minecraft?

remote swallow
#

?notworking

undone axleBOT
#

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

tardy delta
#

console sayin anything?

quaint mantle
#

i do it on the server plugins folder but nothing happens

#

org.bukkit.plugin.InvalidPluginException: Cannot find main class `de.Matti'

#

Caused by: java.lang.ClassNotFoundException: de.Matti

quaint mantle
tardy delta
#

thats not a valid path

quaint mantle
#

why not

tardy delta
#

it needs the path after /src/main/java

subtle folio
#

Could also be you have to clean your maven

#

then rebuild

quaint mantle
#

it is

eternal oxide
#

main: in your plugin.yml is wrong

quaint mantle
#

how is it right

subtle folio
#

by not being wrong?

quaint mantle
#

my plugin.yml is main: de.Matti

subtle folio
#

What is your package structure?

eternal oxide
#

my bet you called your class Main and as such in your plugin.yml it would be yml main: de.Matti.Main

#

I also assume you upper cased your package

quaint mantle
#

im new in coding

#

lemme try

tardy delta
#

i once did that and since then ij refused to fix it

round finch
#

Package - path.class

naive bolt
#

How do i get the client version a player joined with? like 1.17, 1.19 etc

quaint mantle
#

org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: de/Matti/Main has been compiled by a more recent version of the Java Runtime (class file version 63.0), this version of the Java Runtime only recognizes class file versions up to 52.0

#

i have too new java?

round finch
#

What's your package name?

tardy delta
#

server is running outdated java ver

round finch
#

And Main

quaint mantle
tardy delta
#

smh

#

and youre compiling with what java version?

round finch
#

Wtf

naive bolt
#

(in response to myself) or protocol versions

eternal oxide
quaint mantle
#

idk

tardy delta
#

might just google number smh

vocal cloud
#

1.8 moment

tardy delta
quaint mantle
#

this?

quaint mantle
# tardy delta

<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>

<dependencies>
    <!--This adds the Spigot API artifact to the build -->
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot-api</artifactId>
        <version>1.16.4-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
#

is this it

desert loom
tardy delta
#

your server is using java 8 and youre trying to run a plugin compiled with java 19?

river oracle
tardy delta
#

dunno if mc 1.8 even supports jdk19

quaint mantle
#

so the error is the jdk

#

right

vocal cloud
#

Read the error

tardy delta
#

either compile your plugin with java8 or run your server with java 19 which i dont even know is possible

#

or 3) dont use mc 1.8

quaint mantle
#

there is only 1.8 to 19

remote swallow
#

if you must use 1.8 set your java version to 1.8 or 1_8 in pom.xml

tardy delta
#

just 8

remote swallow
#

i thought 8 was major minor

eager flax
#

player.getInventory().setItem(0, new ItemStack(Material.IRON_SWORD,1));

#

im tryna make an item stack with a custom name

#

how would I do that?

river oracle
eager flax
river oracle
#

ItemMeta

remote swallow
#

itemmeta

tardy delta
#

no need for 1

eager flax
#

ight

remote swallow
#
ItemStack myItemStack = new ItemStack(Material.IRON_SWORD);
ItemMeta myItemMeta = myItemStack.getItemMeta();
myItemMeta.setDisplayName("my name");
myItemStack.setItemMeta(myItemMeta);
player.getInventory().setItem(0, myItemStack);
remote swallow
#

ChatColor.GREEN + "my string name" // This will be green
ChatColor.GREEN.toString() + ChatColor.BOLD + "my string name" // This will be green and bold

eager flax
#

makes sense

#

thank you

#

im switching from visual bukkit to normal coding (if you know what that is)

#

so its a little bit difficult

remote swallow
#

whats visual bukkit

eager flax
#

like visual coding its cool

remote swallow
#

so its like scratch?

eager flax
#

kinda

#

yeah

#

are guis difficult to make?

#

on this

remote swallow
shell trench
#

I want to run a commend when a users clicks on a message in chat.
But this isn't clickable:

TextComponent line1 = new TextComponent("Test");
            line1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/say Hi"));

            player.spigot().sendMessage(line1);