#help-development

1 messages · Page 1930 of 1

red sedge
#

lombok is amazing okay

#

How can I make it so whenever a player interacts with a noteblock, it places the block on their hand just like it would be when they click stone or something while also running the blockplaceevnet instead of interacting with the noteblock please im going to die

grim ice
#

whats wrong with lombok

quaint mantle
#

So you want to write a getter method instead of annotations?

red sedge
#

no

grim ice
#

nah ive found the solution

red sedge
#

they want a annotation for multiple variables

#

i think

grim ice
#

gepron helped me

red sedge
#

OH

grim ice
#

honestly this is a java question that im disappointed on myself that im asking

#

uh

#

so

#

should I make a class

red sedge
#

never happened

#

no problem

grim ice
#

for my fields

red sedge
#

no...

grim ice
#

I have way too many fields on my main

red sedge
#

why...

grim ice
#

class

red sedge
#

why would you do that...

blazing scarab
#

Technically, it's a compiler hack - the Java compiler isn't designed to modify code, so it can cause difficult to debug errors, or worse.
Breaking, like, on every major java release.

grim ice
#

is it fine having 15 fields on my main

red sedge
#

yes.

blazing scarab
#

But there's philosophical reasons as well

grim ice
#

ok

blazing scarab
#

Well, for one, I don't think you should use setters at all. Immutable objects are a much better way of transferring data than mutable ones.

For two, you should avoid getters if you can, and instead move behavior into the object rather than operating on it externally. This enables better design choices; it lets you do things like use multiple implementations of the same interface. You end up with less casts, less switch statements, and more polymorphism. It's a more object-oriented style of code and is much cleaner overall.

late sonnet
blazing scarab
#

When you debug and review lombok code, you have to think in terms of the code which would be generated. This is non-negligible mental overhead, and for what gain? It would be better to write the code yourself or have the IDE generate it, depending on the demands of the situation.

grim ice
#

btw how to access getters made by lombok

#

im new on it

late sonnet
blazing scarab
#

To be honest, i don't find lombok too much useful in my code base

late sonnet
#

if you need make things in the get better make the get method

blazing scarab
#

you need an intellij plugin. Cringe!

#

although lombok has @Delegate.. Java pls add

quiet ice
#

Use your IDE's auto-refractor thing instead tbh

blazing scarab
#

can IDEA generate delegate method calls?

red sedge
#

Does blockplaceevnet place the block?

glossy venture
#

?

red sedge
#

calling blockplaceevent

glossy venture
#

You mean when you dispatch it

red sedge
#

will it place the block...

glossy venture
#

No

red sedge
#

so I have to place the block and then clal the event?

glossy venture
#

Also blockplaceevent is for players so i dont recommend calling it from your plugin

#

Why do you want to call the event

red sedge
#

im listening for interact event

#

and if the player clicks on a noteblock

#

i need to cancel the interact event

#

and call blockplace evnet

glossy venture
#

Oh ok

#

Sure

#

Place the block and then call the event

#

With the player

red sedge
#

okay

#

uh

#

other question

#

is tehre a way to check if a item is placeable/a block

#

nvm i can just check the material

grim ice
#

and another one

#

iirc u can do it with nbt

#

idk why would u ever do that

#

but yes

red sedge
#

interact event, get item, how can I aget the hand the iutem si being held

red sedge
#

oh

#

sorry didnt notice that existed

#

my brain is giving up

naive bolt
#

i want to set someone to spectator then when they do a command it exits spectator to their location they joined spectator and the gamemode they joined from

#

will i need to use a database?

hasty prawn
#

No

naive bolt
hasty prawn
#

Just get the user's current gamemode

naive bolt
#

when someone does
/vs spectate <player> it needs to save location for when they do /vs leave and teleport them to the location they ran /vs spectate and to set them to the gamemode they were in

dusk flicker
#

Map.

hasty prawn
#

Map.

obtuse ferry
#

I'm trying to get the number of xp a player has but I can't seem to find a method?
#getTotalExperience() is total overall ever
#getXp() is a percentage
#getExpToLevel() is xp to the next level

red sedge
#

uh

#

getmaxexp?

obtuse ferry
red sedge
#

why do you need it?

dusk flicker
#

?jd

tardy delta
#

Integer.MAX_SIZE prob or even long

naive bolt
#

how do i exit out the startup process

tardy delta
#

the onEnable of a plugin? or are you talking about a server?

naive bolt
#

nvm i foind it

tardy delta
#

._.

tardy delta
#

wouldnt make sense to store all gained xp ever

torn shuttle
#

did anyone else get a dude on spigot DMing you about promoting their online code course for a % of the profits on class sales?

naive bolt
#

why does this happen

tardy delta
#

are you doing it in onLoad?

naive bolt
#

yes

tardy delta
#

thats onEnable

naive bolt
#

Yes

#

i will change it

torn shuttle
#

man this is a bit of a shady one

tardy delta
#

what is your name - yes

torn shuttle
#

any forums staff lurking

proud basin
#

yes

obtuse ferry
tardy delta
#

eehh

naive bolt
#

yes

tardy delta
#

it says it stopped and it started

obtuse ferry
naive bolt
#

it still says Error occurred while enabling VulcanSpectate

obtuse ferry
tardy delta
hasty prawn
#

@obtuse ferry You'll probably have to calculate their current experience yourself

tardy delta
#

load or enable?

naive bolt
#

load

hasty prawn
#

Just use the exact same formula Mojang uses to calculate experience per level, add those all up, and then use getExp() to find the remaining based on the percentage

tardy delta
#

dont do stuff in onLoad unless you know what youre doing

tardy delta
#

especially not dependency wise

#

do you have your dependency in your plugin.yml too?

naive bolt
#

no i want to display my own message

torn shuttle
#

last call before I give up any forum staff lurking?

obtuse ferry
hasty prawn
tardy delta
#

...i mean do you have depend: [Vault] or something in your plugin.yml?

#

or softdepend

obtuse ferry
hasty prawn
#

Yay....

tardy delta
#

?paste your plugin.yml

undone axleBOT
naive bolt
#

i dont want it to say the ugly massive message

tardy delta
#

and set the code you're doing in onLoad in onEnable

#

wha-

naive bolt
#

i dont what this

#

i want a custom one

tardy delta
#

if you softdepend you wont have it

#

thats not even massive

naive bolt
#

true i dont need this cusotm message

tardy delta
#

this isnt custom

naive bolt
#

I know

#

im not gonna add my own

#

imma just depend them

tardy delta
#

two things to do
for your dependencies (lemme take Vault as an example)

  • let your plugin depend or soft-depend on Vault so add **depend: [Vault] ** or softdepend in your plugin.yml
  • place the code from your onLoad in your onEnable
hasty prawn
#

Pretty sure he's just removing all of it and going with depend:

red sedge
#

so uh quick question

naive bolt
#

why isnt it an action bar

red sedge
#

how can I make it so if PlayerInteractEvent in one class is cancelled

#

the same interact event in another class will be cancelled aswell

tardy delta
#

bruh

#

ChatMessageType.ACTION_BAR + "" will call the ::toString method of ChatMessageType

young knoll
#

Yeah that’s not

tardy delta
#

use player.spigot().sendMessage(ChatMessageType.ACTION_BAR, /i belive it takes a textcomponent/)

young knoll
#

How you do that

naive bolt
#

whats the text comonent for bukkit

obtuse ferry
ivory sleet
hasty prawn
red sedge
obtuse ferry
red sedge
#

I looked at th jd

#

it says Normal is the default

ivory sleet
#

Yes

red sedge
#

I set the 2nd eventlistener to low

ivory sleet
#

Therefore you want one of your callbacks to have a different priority

hasty prawn
#

^^

young knoll
#

Low comes first

red sedge
#

oh/

ivory sleet
#

Such that the order of execution is guaranteed to not be arbitrary 🙏

young knoll
#

If you cancel in low it will be canceled in normal

red sedge
#

ohhh

young knoll
#

If you cancel in normal it will be canceled in high

red sedge
#

I thought it would be reverse?

red sedge
hasty prawn
#

It makes sense when you think about it

red sedge
#

does it tho?

ivory sleet
#

It does

hasty prawn
#

Low is first so it can be overriden by higher priorities

ivory sleet
#

^

red sedge
#

oh

#

it actually does

#

huh

young knoll
#

The highest priority has the final say

hasty prawn
#

MONITOR, duh

young knoll
#

Shh

#

Don’t be like that

obtuse ferry
hasty prawn
tardy delta
red sedge
#

if youre making a enchanting system you want to check the total exp

#

not the exp on the current level tf

naive bolt
#

is it same

young knoll
#

Yes

tardy delta
#

use that

tardy delta
obtuse ferry
tardy delta
#

wha-

red sedge
#

i agree

#

very much

hasty prawn
young knoll
#

Even vanilla is weird

obtuse ferry
tardy delta
#

nvm xp is weird

obtuse ferry
#

I literally already sent them

young knoll
#

With commands you have to change level and points separately

red sedge
#

thats really weird

#

tbf minecraft is weird

tardy delta
#

keep calm ladies and gentlemen ._.

young knoll
#

Minecraft is very weird

hasty prawn
#

Screw the warden we want an XP system rewrite Madge

obtuse ferry
#

💯

young knoll
#

Nah

red sedge
young knoll
#

System works fine for players

tardy delta
#

ive never seen a warden in vanilla are they even ingame

red sedge
#

no

tardy delta
#

🙄

red sedge
#

they were delayed

#

for the 2nd time

#

BUT now it has its own city and shit

tardy delta
#

what are these stupid mc trailers sometimes

#

lmao more chance to get killed

young knoll
#

The city looks like it’ll be cool

red sedge
#

because the highest priority would have the highest priority to check

#

so it would check the first

young knoll
#

The highest priority has the final say in canceling

hasty prawn
#

^^

red sedge
#

yeah but it has the HIGHEST priority so it should be the first

young knoll
#

It can override the cancellation of lower priorities

red sedge
#

since like in a queue if you have a higher priority than someone you dont go behind them

#

maybe i shouldnt think of events as queues huh

young knoll
#

Think of it as a queue for a ride

#

But the later people can kick the earlier ones off when they get to the front

#

And yes I know no ride queue works that way

red sedge
#

yeah so higher priority should come the first

#

like

#

:enterance:
a
b
c
d

#

think of it

young knoll
#

No

red sedge
#

if youre like a vip in a queue youd enter first

#

because you have priority

young knoll
#

Because you can’t kick someone off if they haven’t got on yet

red sedge
#

eh ig if i stretch it enough it makes sense

tardy delta
#

the highest priority has the final say

#

if you think about it, it makes sense

red sedge
#

ig

tardy delta
#

lowest is executed first as it can be cancelled by higher priorities

young knoll
#

I mean

#

It really doesn’t matter if it makes sense to you, it’s clearly documented

tardy delta
#

decompile EventPriority enum kekw

ancient jackal
#

if I want to save a serialized and encoded object to a player's datacontainer, would I be able to retrieve it from the OfflinePlayer interface?

ancient jackal
#

nevermind, it just seems to not exist

naive bolt
tardy delta
#

player.spigot().sendMessage i said

naive bolt
#

indeed you did. sorry for my dumbness

obtuse ferry
#

What's the most efficient data type for several items all of the same data type with set length which doesnt change BUT I want to add the collections of items together

#

I would use Object[] but I need to be able to add them to make one of said collection of items

ivory sleet
#

List<Object> perhaps?

#

by having LinkedList, or ArrayList as implementation

obtuse ferry
limber mica
#

lets say a player has 500 chips and I want to check if they can bet but they need to have double of what they have. How would I go about to check that

#

so if they have 500 they would need 1000 etc...

red sedge
#

*2..

obtuse ferry
red sedge
#

wtf

quiet ice
#

double of what they have?

young knoll
#

I assume to bet 500 you need 1000

quiet ice
#

So player x has y amount and player z must bet y * 2 or what?

young knoll
#

So check if they have >= bet * 2

quiet ice
#

Geolykt overcomplicating things again

spiral light
#

can someone explain whats happening there ?

limber mica
#

but now if they bet 2 and they have 500 chips it won't work

young knoll
#

Why

#

Balance >= bet * 2

#

500 is >= 4

limber mica
#

because

#

if the player has 500 chips

#

they would need 1000 according to the if statement

#

but if they bet 2 they should still be able to bet still

young knoll
#

Yes

#

Which they will using that statement

young knoll
obtuse ferry
young knoll
#

Hashset is primarily fast for .contains

limber mica
#

but then if I bet 500 it will it go through

young knoll
#

No it won’t

limber mica
#

but why exactly 4

young knoll
#

Because 2 * 2 is 4?

limber mica
#

their chip amount can go as high as 20000

young knoll
#

Okay

limber mica
#

anyways

young knoll
#

So what?

limber mica
#

it did go through still

young knoll
#

Balance >= bet * 2

#

It’s not a complicated statement

limber mica
#

but then they can't bet let say 3

young knoll
#

Sure they can

#

As long as they have at least 6

limber mica
#

nope

young knoll
#

Yes

#

That’s literally how math works

limber mica
#

I just tested it

young knoll
#

Balance >= bet * 2

#

Substitute balance and bet

#

Balance >= 3 * 2

#

So as long as balance is 6 or more, it will be true

raw ibex
#

Would this code work?

#
    public void FullIron(ArmorEquipEvent event) {
        Player p = event.getPlayer();
        if(p.getInventory().getArmorContents().length == 4) {
            level = 2;
        }
        
    }```
young knoll
#

Maybe

#

What is level

#

Actually no getArmorContents will always be 4 long

#

The entries may be null/air thought

raw ibex
#

it's public int level = 1

young knoll
#

Also the first line in that event does nothing

raw ibex
#

oh yea lol

#

i had that before

ivory sleet
#

in terms of time complexity HashSet wins in most cases

raw ibex
shy wolf
#

Hello,
any one know if is there a max particle that player can see / spawn?

ivory sleet
#

however you cannot have duplicates with a Set

raw ibex
#

is when someone has full iron, make level 2

ivory sleet
#

and a Set does not give you RandomAccess for instance

quiet ice
#

Hashset should probably have worse (base) iteration time too

ivory sleet
#

probably

#

I havent read the impl since a while back

quiet ice
#

Neither did I heh

ivory sleet
#

🥲

shy wolf
young knoll
#

No

#

Not without a client mod

shy wolf
#

i will make one

#

forge or fabric?

young knoll
#

Up to you

shy wolf
#

fabric

obtuse ferry
# ivory sleet and a Set does not give you RandomAccess for instance

I just discovered this, and this solution

// pick a random enchant from the set of possible enchants
int index = ThreadLocalRandom.current().nextInt(possibleEnchants.size());
Iterator<Enchantment> iterator = possibleEnchants.iterator();
for (int i = 0; i < index; i++) {
    iterator.next();
}
Enchantment enchant = iterator.next();

probably shoulve just stuck to arraylist 😐

ivory sleet
young knoll
#

Blah

#

I still need to write my own enchanting table since the vanilla one doesn’t like custom enchantments

young knoll
#

Yeah I’ll have that too

#

But still gotta have a vanilla table-style system

midnight shore
#

Hi guys! How can i send an Action Bar message in 1.17?

#

i'm using this but it does not work, nothing shows up

hasty prawn
#

You can still make it work with them

young knoll
#

Don’t show them in the preview

hasty prawn
#

Yeah, but you can still make them work

#

I did it 😛

#

I just prevented them from displaying

#

But they can be added as secondary enchantments

young knoll
#

Yeah but I don’t want that

hasty prawn
#

Welp KEKW

verbal heron
#

How do i check if an armor stand is able to be placed at the block the player is looking at?

midnight shore
#

?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!

spiral light
sterile token
#

Why when im tryin to send hover message in spigot server im gettin errors?

#

But when i test it on a server that its connected to bungee doesnt throw errors

#

🤔

hard fractal
#

Anyone know how to use ChatRender in event AsyncChatEvent?

young knoll
#

That’s paper

#

Ask them

naive bolt
#

how would i use a map to store

command_location
UUID
gamemode

so when someone does /sv spectate <player> it stores their current gamemode, UUID and location so when they do /sv leave it returns them to them coordinates and gamemode

young knoll
#

Make a custom class to hold the 3 objects

#

Map to that

naive bolt
#

ok time to stack overflow lol]

young knoll
#

You don’t know how to make a class with 3 fields?

naive bolt
#

na im rubish at java

young knoll
#

Learn java before trying to make plugins

naive bolt
#

i guess its same as my sub command handler

noble ridge
#

random AF question but how do i delete a plugin while the server is running?

young knoll
#

Stop the server

noble ridge
#

i used to be able to replace them without restarting the server

young knoll
#

Or use something janky like PlugWN to disable it

noble ridge
#

ahh i see

young knoll
#

You can replace but not delete

#

With windows anyway

noble ridge
#

ohh u right, replacing works, thank u @young knoll

naive bolt
#

this?

young knoll
#

No

#

Those are methods

#

And why are they strings

#

?learnjava

undone axleBOT
naive bolt
#

bro i just want to make a plugin

#

i know javascript

#

and java isnt too diffrent

young knoll
#

Yes it is

naive bolt
#

baso i need to select gamemode and location where UUID = player uuid

young knoll
#

Map uuid to a class containing game mode and location

midnight shore
#

TY! Nice to see you again, you are being so friendly : )

young knoll
#

We aren’t here to teach you how to make a basic data class, the internet has plenty of resources for that

red sedge
#

Intellij doesnt show my folders?

#

there is external libraries

#

but its empty

#

hold up

midnight shore
#

uhm... i tried and it still doesn't work, no errors and no info in console

#

there you go

red sedge
#

can I DM you the SS because it doesnt let me upload it and I refuse to verify

midnight shore
red sedge
young knoll
#

It’s a util method

#

It’s fine to be static

raw ibex
#

what would Bukkit.getBossBars return?

blazing scarab
fast temple
#

ive been searching up things about my issue and what im trying to do and it doesnt seem anyone has done anything like this even though i know it is possible, im new to coding although ive been writing most of my plugin so far all by myself im in 1.8 btw, but everything in this code works except for the fact that the event happens too fast, i tested it to send a message to me aswell as make the furnace cook instantly and it sends the message and it shows the arrow at the spot it should be but when i put the item in it makes the cook time instant before the item is even processed as being in there, is there any way to fix this
@EventHandler
public void CustomFurnace2(InventoryClickEvent e) {

Player p = (Player) e.getWhoClicked();
FurnaceInventory finv = (FurnaceInventory) e.getView().getTopInventory();
Furnace f =(Furnace) e.getInventory().getHolder();
ClickType ctype = e.getClick();

if(e.getView().getTopInventory() instanceof FurnaceInventory) {
    if((e.getSlot() == 0 || e.getSlot() == 1) && e.getCursor().getType() != Material.AIR) {
        finv.getHolder().setCookTime((short) 200);
        f.update();
        p.sendMessage("You clicked with an item in the furnace");

}
}
}
it wouldnt let me post it as a txt file for some reason but this is the code
@ivory sleet (ping for help)

#

i posted this in this and help server because i didnt know where to post it

sleek pond
young knoll
#

Yeah no reason for a pointless instance creation

#

Static is fine here

red sedge
naive bolt
#

can you set a gamemode and location on leave ?

mortal hare
#

can you do something faster in nms than one tick?

fast temple
#

does anyone know how to change the speed a furnace cooks in 1.8

peak depot
sleek pond
#

1.8 isn't supported

fast temple
#

i know how and have some working code but i have 1 issue

raw ibex
mortal hare
#

im thinking if using runnable is really safe way

naive bolt
mortal hare
#

since if someone intercepts faster than 1 tick

#

it could be vulnerable

mortal hare
#

but i doubt its possible

red sedge
#

ugh fine i will verify

peak depot
naive bolt
#

but what if the server has restarted

#

the plugin will have lost the stored data

young knoll
#

Save it

red sedge
young knoll
peak depot
blazing scarab
naive bolt
#

so its not possible to change a players location on leave?

red sedge
#

i mean

#

you can change it when they join

fast temple
red sedge
peak depot
#

you can try tp on PlayerDisconnectEvent but Idk if that will work

blazing scarab
#

b

raw ibex
#

what would Bukkit.getBossBars() return?

peak depot
#

static Iterator<KeyedBossBar>
getBossBars()
Gets an unmodifiable iterator through all persistent bossbars.

blazing scarab
peak depot
#

no when a player disconnects

raw ibex
#

how to remove all bossbars

#

Bukkit.removeBossBar()

peak depot
#

yeah thas what I ment

raw ibex
#

but what inside

tardy delta
#

the name i guess

craggy cosmosBOT
#

:dynoError: The AFK module is disabled in this server.

tardy delta
#

nah namespacedkey

grim ice
#

is using lombok bad

peak depot
red sedge
#

it doesnt really add anything

#

nor remove anytihng

tardy delta
#

yes very bad go to the shame corner

red sedge
#

it just kinda makes the source code cleaner

grim ice
#

actually since I have static fields

#

I will have to spam @getter

eternal night
#

pretty much an opinion game with lombok.

red sedge
#

isnt there parameters for it

eternal night
#

just don't use it when writing API

grim ice
#

Nope you're forced to @Getter for each static field

grim ice
red sedge
#

tf?

peak depot
#

wrong message

red sedge
# grim ice Why

because it can make people reading the source code confused

#

especially if htey dont know what lombok is

grim ice
#

bro what

peak depot
grim ice
#

how is @Getter confusing

#

besides u can just explain it in ur readme

red sedge
grim ice
#

if they dont know what would @Getter mean, they wouldnt understand any code either

red sedge
#

and now

#

im verified

#

im blu

grim ice
#

gg

eternal night
#

Well, lombok is pretty much not as easy to follow as you might think it is

grim ice
#

I'm an extreme beginner on it

eternal night
#

some magic annotation on top of a class does not really govern why I can call a getter

#

in my non lombok plugin vs code

grim ice
#

I only know @Getter @Setter

#

lol

eternal night
#

where I just want to use your API

red sedge
#

besides its far better than using public variables(ew)

eternal night
#

records are a thing

#

and when designing API you should focus on interfaces anyway so, not much space for lombok in the first place

red sedge
#

ew public variables

#

yes im a public variable

tardy delta
#

we will.. eat it...

red sedge
#

yes

grim ice
#

Just remembered

#

Is there some guide on coding libraries and APIs?

red sedge
tardy delta
#

gollum. gollum...

fast temple
#

can someone help me with this issue im having with the making the furnaces cook faster in 1.8

tardy delta
#

nah thats bad

red sedge
#

so i dont know thr issue

fast temple
#

well i was just wondering if someone wanted to try to help

red sedge
fast temple
#

why doesnt my code paste in chat?

hybrid spoke
#

and check it yourself

#

#registerEvents

naive bolt
#

ty

fast temple
red sedge
fast temple
#

because i was thinking about trying this

#

but i didnt know you could

peak depot
hybrid spoke
peak depot
#

its just for him to look it up I normaly use luyten

red sedge
#

then why recommend something that you dont use?

peak depot
#

no I used it back then it works for just copy pasting code

blazing scarab
#

FernFlower

quiet ice
red sedge
#

wtf is the difference

quiet ice
#

And QF > FF imo

red sedge
#

its just a decompiler use whatever tf want

quiet ice
#

Recaf is not really a decompiler

hasty prawn
#

Recaf is a bytecode editor isn't it

quiet ice
#

It is a bytecode editor, but it can also decompile with Forgeflower (I think), CFR and Procyon

hasty prawn
quiet ice
#
        <!-- http://files.minecraftforge.net/maven/net/minecraftforge/fernflower/ -->
        <dependency>
            <groupId>net.minecraftforge</groupId>
            <artifactId>forgeflower</artifactId>
            <version>${ff.version}</version>
        </dependency>
naive bolt
#

why cant i just use return in java

quiet ice
#

because in your current context it is nonsensical

hasty prawn
#

Interesting lol

quiet ice
#

In which way it is nonsensical I cannot say without looking at the code

#

Issues include attempting to use return in lambdas (well, it would work, just not as intended), or when a return value is expected

#

If you want to return from a method no matter what, use throw new RuntimeException("Programmer laziness"); instead

tardy delta
#

programmer laziness kekw

#

my cat just walked over my laptop lol

rotund pond
quaint mantle
#

How could i get the name of the server in the bungeecord?

#

I've tried using messaging channels

#

I had over 200 spigot servers

#

Minigames, etc

naive bolt
#

how do i get the config in a command file

#

if(sender.hasPermission(VulcanSpectate.getPlugin().getConfig().getString("permission"))){
doenst work

trim creek
#

wtf

#

If you need a permission use (sender.hasPermission("PERMISSION:STRING"))

#

You don't need to get a plugin's plugin.yml

naive bolt
#

i want to have a config.yml

trim creek
#

Create it

#

.-.

#

Into the same folder

naive bolt
#

i have

trim creek
#

where your plugin.yml is

naive bolt
#

i need to fetch the value

trim creek
#

and

#

on enable

#

save it

naive bolt
#

i have

#
    getConfig().options().copyDefaults();
    saveDefaultConfig();
#

but i want to get a config value from an external file

trim creek
#

Then you messed up the string

#

permission stands for

permission
naive bolt
#

# The permission required to use the plugin
permission: 'vs.use'

config ^

#

i want to get the vs.use in a command

trim creek
#

Well um...

#

Not sure if leaving the string a simple one is a good idea

naive bolt
#

wtf are you on about man

#

@ivory sleet can you help

tardy delta
#

._.

#

String permissionString = plugin.getConfig().getString("path.to.permission.string")

naive bolt
#

Non-static method 'getConfig()' cannot be referenced from a static context

tardy delta
#

if (player.hasPermission(permissionString))

naive bolt
#

ah can i not use it in the if statment

#

ok

tardy delta
#

you can

tardy delta
#

are you calling getConfig in a static context?

#

use dependency injection instead

#

example:

public class CommandManager {
  private final MyPlugin plugin;

  public CommandManager(MyPlugin plugin) { this.plugin = plugin; }
}```
#

and then use plugin.getConfig().bla bla bla

trim creek
tardy delta
#

?di

undone axleBOT
midnight shore
#

I’ll try it tomorrow! Ty

tardy delta
#

ew public variables

quaint mantle
#

Does somebody else have maven problems when making a spigot project?

fast temple
#

is someone able to help me with an issue im having with furnaces in 1.8 where my code works but the event happens too fast so it doesnt actually make the cook time for the thing i put in the furnace faster

fast temple
#

because this issue is very weird to explain

#

this is the code:

#

@ivory sleet

tardy delta
#

poor conclure, got two tags now

midnight shore
fast temple
#

why? it says ping for help

tardy delta
#

code looks weird too

midnight shore
#

The one with the code

fast temple
#

how so

tardy delta
#

dont assume it is a furnace you're clicking in i think

fast temple
#

im not there is a thing checking for the furnace inv

#

also it works

#

the message i have at the end only sends if you click in one of the 2 spots in a furnace inv

midnight shore
#

Sorry I don’t understand the problem

fast temple
#

it also makes the cook time 200

#

exactly

tardy delta
#

FurnaceInventory finv = (FurnaceInventory) e.getView().getTopInventory();
if the top inventory is a players inventory

#

what will happen do you think?

fast temple
#

so basically the code is happening too fast

#

i can show you the issue with a screen share

midnight shore
#

Okay

fast temple
#

its very confusing and it seems no one else is having this issue

hasty prawn
#

Delay setting the cook time.

tardy delta
#

also wont it throw a classcast exception?

hasty prawn
#

Yes

wary harness
naive bolt
#

does the 1.18 api work on most other versions

hasty prawn
naive bolt
#

its simple set gamemode and teleport

#

no packet stuff

hasty prawn
#

Probably will be fine then

sullen marlin
#

best to use the API of the oldest version you want to support

minor otter
#

How would I test if for if the sides of a mushroom block are true or false

#

could I use BlockFace for that or does that handle which way a block is facing like a piston

quaint mantle
#

Hi

#

I make the spawners fall out when breaking. Faced with such a problem that the spawner of other mobs drop the spawner of a pig

minor otter
#

Thank you

twilit wharf
#

How can I change a mobs movement speed? (I am on 1.8 if that matters, it is a commision)

young knoll
#

NMS iirc

#

Don’t think the attribute API existed then

twilit wharf
twilit wharf
young knoll
#

Well the API didn’t exist

#

Maybe some third party one does

twilit wharf
#

would it be LivingEntity#getAttribute()?

#

with the new API?

young knoll
#

Yes

twilit wharf
#

ok, that doesnt exist on 1.8

twilit wharf
young knoll
#

check the forums I guess

chrome beacon
#

Or google

twilit wharf
chrome beacon
#

Oh well NMS it is

dry forum
#

why doesnt this work? ``` ScoreboardManager m = Bukkit.getScoreboardManager();
Scoreboard b = m.getNewScoreboard();
Objective obj = b.registerNewObjective(e.getPlayer().getName(), "dummy", "rank");
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
obj.getScore(e.getPlayer().getName()).setScore(e.getPlayer().getLevel());

    objectives.put(e.getPlayer(), obj);

    e.getPlayer().setScoreboard(b);``` it does nothing
hasty prawn
dry forum
#

wdym?

hasty prawn
#

Only thing I changed in your code was the display slot and the objective name.

dry forum
#

but if you press F5 you can see your nametag ive also tried it will vanilla scoreboards and i could see it

hasty prawn
#

You must have a mod doing that, and it's not displaying your scoreboard. I bet it's working and you just can't see it.

ivory sleet
#

What a precautious skin

hasty prawn
#

My username is Masks what'd you expect

ivory sleet
#

🥲

hasty prawn
#

:)

worldly ingot
#

Yeah that seems like the work of either a mod, or if you've seen it on another server, an armour stand above the player's head

dry forum
#

that part works but when i join its setting my number to 0 but i have 40 levels so it should be 40 <text> but its showing as 0

hasty prawn
dry forum
#

40 xp levels

#

i have 40 xp levels and i make it set the number to the amount of xp levels

#

but it doesnt show as 40 it shows as 0

hasty prawn
#

When are you calling that code

dry forum
#

wdym

#

oh

#

in a playerjoin event

#

i also have it auto update every 10 seconds

hasty prawn
#

You're making a new Scoreboard everytime

#

You need to add them all to the same one

dry forum
#

every player will have a different amount of xp

#

and what if 2 players have the same amount of xp

hasty prawn
#

Why would that matter

dry forum
#

you cant have multiple of the same number on a scoreboard?

young knoll
#

Yes you can

dry forum
#

oh?

hasty prawn
young knoll
#

Why wouldn’t you be able to

dry forum
#

i thought i tried it before and it didnt work

young knoll
#

That would be silly

hasty prawn
#

Indeed it would

young knoll
#

How else would a simple death scoreboard work

hasty prawn
#

Guess you'd just have to kill new players a bunch of times

dry forum
#

so now when a player joins it works but when another player joins the player that joined 1st gets their scoreboard set back to 0 then the 2nd player's works fine

        obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
        obj.getScore(e.getPlayer().getName()).setScore(e.getPlayer().getLevel());

        objectives.put(e.getPlayer(), obj);

        e.getPlayer().setScoreboard(Levels.b);```
in main class
```        ScoreboardManager m = Bukkit.getScoreboardManager();
        b = m.getNewScoreboard();```
#

also the updater

            OnJoin.objectives.get(p).getScore(p.getName()).setScore(p.getLevel());
        }```
hasty prawn
#

Add them to the same objective also, name it something like "rank" instead of the player's name.

dry forum
#

wdym add them to the same objective? how would that work

hasty prawn
#

Right now you're adding the scores to different objectives

charred echo
#

Help me with kotlin

dry forum
#

but if i made it static that wouldnt work since i use the objective to update the players score in a hashmap

#

i tried making it static but its just giving errors and says 0 xp levels for everyone

#
        obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
        obj.getScore(e.getPlayer().getName()).setScore(e.getPlayer().getLevel());

        objectives.put(e.getPlayer(), obj);``` obj is static and when a player joins it says 0 xp levels so now it doesnt work at all
muted sand
#

Which events would I have to track to only allow specific ItemStacks in an inventory?
Just a InventoryMoveEvent?

young knoll
#

That’s for hoppers

muted sand
#

oh oops-

young knoll
#

InventoryClickEvent

muted sand
#

ah thank you

languid saffron
#

So my question is how to open a project up in spigot

young knoll
#

You should be able to just import it

young knoll
#

Or if it’s a gradle/maven project, import it as one of those

languid saffron
#

its a gradle project

#

But when I open it, it doesnt tell me to select anything?

#

Just loads everything with errors

rancid hare
#

How to send a 1.18 GamestateChange packet?

#
  • PacketPlayOutGameStateChange
cedar hamlet
#

Ok so I got a question

#

I've been trying and trying to edit a .jar file

#

but I keep on getting different and different answers online

#

None of them workng

rancid hare
#

What do you want to edit?

cedar hamlet
#

how in the world do I just edit a .jar file in eclipse

rancid hare
#

.jar is like .zip (you cannot edit the file because it is a binary)

cedar hamlet
#

I can see it with JD GUI

rancid hare
#

Yeah you'd have to extract the files inside the .jar file and edit them and then combine them again to a .jar

cedar hamlet
#

ok

rancid hare
#

Yes

cedar hamlet
#

How do i do that

rancid hare
#

Just think of a .jar file like a .zip file

You wouldn't ever edit a .zip file, rather the content in it

cedar hamlet
#

Alright

rancid hare
#

You could download WinRAR

cedar hamlet
#

I have that

rancid hare
#

Perfect

#

Then just right click your JAR -> Open With -> WinRAR

cedar hamlet
#

Ok

rancid hare
#

Have you got it working?

cedar hamlet
#

I see the .class files now, I just import them all into eclipse?

rancid hare
#

Yeah you could

cedar hamlet
#

Ok, how do i do that

#

I thought I knew how but

#

apparently no

rancid hare
#

Just drag and drop

cedar hamlet
#

"The class file is not on the classpath"

rancid hare
#

I would recommend you to first extract them from your Winrar to a folder named the same as your jar

stuck wraith
#

why can't i mvtp world?

rancid hare
cedar hamlet
#

Now its saying "Source not found"

young knoll
#

Class files are compiled

#

You can’t just edit them easily

rancid hare
cedar hamlet
#

I feel like this should be something that can be done easily IMO, I don't understand why developers make it hard to work with

rancid hare
#

Tbh I am not very experienced with Eclipse, rather with IntelliJ

young knoll
#

It’s not developers

#

It’s java compiling code into intermediary language

rancid hare
young knoll
#

Developers can make it easy, it’s called open source

cedar hamlet
#

Add the content

#

I'm trying to edit the .class file

rancid hare
#

Which language do you speak natively?

cedar hamlet
#

To be frank I'm trying to mod an existing plugin

#

English, but to be fair, I'm not good at that either

languid saffron
quaint mantle
#

Cringe Intellij

dusk flicker
dusk flicker
quaint mantle
#

the hell what

dusk flicker
#

why is intellij cringe

quaint mantle
#

Java is cringe so Intellij aswell

dusk flicker
#

fair

quaint mantle
dry forum
#

why doesnt this do anything Silverfish as = e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), Silverfish.class); e.getPlayer().addPassenger(as); as.setCustomName("testname"); as.setCustomNameVisible(true); as.setInvisible(true); as.setGravity(false); the silverfish doesnt spawn

dusk flicker
#

did, you, actually spawn it?

young knoll
#

Yes

#

.spawn

dusk flicker
#

am I blind?

young knoll
#

Are you blocking the spawn event anywhere

dusk flicker
#

oh I see

dry forum
#

wdym block? also its registered, no errors

young knoll
#

Or using something like worldedit to block spawning

dry forum
#

no

young knoll
#

Peaceful mode?

dry forum
#

nope

#

i can do /summon silverfish and it works fine

quaint mantle
#
AlphaWolf wolf = new AlphaWolf(p.getLocation());
            WorldServer world = ((CraftWorld)p.getLocation().getWorld()).getHandle();
            world.addEntity(wolf);

this is how i spawn my custom Mob

#

works fine

solar prairie
#
import org.bukkit.entity.Wolf
import org.bukkit.entity.Player
import org.bukkit.
public class entity {

    @Override
    Player p =
    Wolf wolf = (Wolf);
    player.getWorld().SpawnEntity(player.getlocation(), EntityType.Wolf);
    Wolf.setTamed(true);
    Wolf.setOwner(player);
    Wolf.setAdult();
}
#

am I forgetting something?

#

player - .setTamed - .setOwner - setAdult - are all errors.

quaint mantle
#
public class entity extends EntityWolf
dry forum
#

i created a scoreboard to go below my name i removed the plugin that made it now the scoreboard is stuck there i tried removing the scoreboard with vanilla commands but it isnt working do i need to make a plugin to fix it or?

solar prairie
#

OH

#

Thanks lmao

#

Derp moment

quaint mantle
#

:D

solar prairie
#

public class Differentname { is this what you meant?

#

I made a new class and for some reason all of my imports are now invald 😒

quaint mantle
#

?paste

undone axleBOT
solar prairie
#

Jesus I am mistyping xD had an extra {

quaint mantle
#

this is what my class looks like

#

bro

solid lion
#

would anyone mind giving me some pointers of pulling Lists from config to do what i want?

solar prairie
#

How do I know what is inside of spigot.jar to use?

#

ex : setCustomNameVisible

#

like is there somewhere that tells me what to import to use?

solid lion
charred echo
#

Am I able to get an instance of a class with reflection and setting all fields to public?

buoyant viper
#

org.bukkit.craftbukkit im guessing

#

@quaint mantle

#

bukkits connection to net.minecraft.server basically

solar prairie
solid lion
#

this will show you all the classes and descriptions for each

solar prairie
#

Thats exactly what I have been missing. Thanks @solid lion @quaint mantle

solid lion
#

np!

quaint mantle
#

"Shitaru" ;(

solar prairie
#

I am so derped.

#

Lmao. Not intentional.

#

You helped me lots too ❤️ I swear.

solid lion
#

Can someone give me some help with my Config and pulling List values from it

for example

   Check BlockList in blocks section
        if player mines block stated in config then check droplist for drops from corresponding block, set original drop to air, drop item
        blocks:
            IRON_ORE:
                - IRON_INGOT```
grand flint
solid lion
#

thatd be great! I already have my config setup and all my instances pulled to the class i wanna write the method in but god i suck at lists

solid lion
#

scream eclipse

grand flint
#

Old tutorial 🤷‍♂️

quaint mantle
#

Eclipse is just for OG´s

solid lion
#

i had to migrate to intellij cause of 1.18

grand flint
#

I learnt Java faster then I learnt how to use eclipse

quaint mantle
#

did u tried Python? best lang in my opinion

grand flint
#

Had to because of school 😭

solid lion
#

i dropped out of my java class in highschool cause my teachers accent was too thick for me to understand

quaint mantle
#

what accent

solid lion
#

uhhhhhh i dunno never asked it was def a thick asian accent

solar prairie
#

World getWorld(@NotNull am I not supposed to use @NotNull?

hardy swan
quaint mantle
#

how can i check if in a radius of 5 blocks ( 5x5 ) there is a stone block?
i have a position and i don't know how to do it

quaint mantle
brave sparrow
#

You don’t write that when you’re calling the method

solar prairie
#

so how would I make a method check correctly?

quaint mantle
#

what u want 2 check

solar prairie
#

Make sure they aren't in a world thats dangerous, such as nether or end upon execution.

glossy dirge
#

Hello can i do like this on config ?

Role: { Admin: 000000000000000000, Staff: 000000000000000000 }
solar prairie
#

Sec ill send what I got fully so far

brave sparrow
glossy dirge
brave sparrow
#

You just call getWorld(“world”) or whatever

quaint mantle
solar prairie
#

Okay so i'm overcomplicating it?

dry forum
#
        Pig pg = e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), Pig.class);
        e.getPlayer().addPassenger(pg);
        pg.addPassenger(as);

        PotionEffect fc = new PotionEffect(PotionEffectType.INVISIBILITY, 1000000000, 1, false);

        pg.setGravity(false);
        pg.setCollidable(false);
        pg.addPotionEffect(fc);

        as.setCustomName("testname");
        as.setCustomNameVisible(true);
        as.addPotionEffect(fc);
        as.setGravity(false);
        as.setCollidable(false);``` why doesnt the pigs customname show?
#

the pigs spawn

drowsy helm
hardy swan
#

you did spark a problem

quaint mantle
#

ok

hardy swan
#

there is no easy way to do this

drowsy helm
#

wdym its super easy

hardy swan
#

what constitutes a block to be out of reach

drowsy helm
#

dont they just want to check if a certain block is in a radius

hardy swan
#

yes

#

but blocks are not points

patent horizon
#

is there a java equivalent for kotlin's let

worldly ingot
#

I don't know Kotlin, but if it's just automatic typing, Java has var

patent horizon
#

uh no

#

it basically makes this super easy:

Bukkit.getPluginManager().let() { //whatever the syntax is
  it.registerListener()
  it.registerListener()
  it.registerListener()
  it.registerListener()
  it.registerListener()
}```
worldly ingot
#

I mean, not really. You could fake it I guess lol

        Consumer<PluginManager> consumer = it -> {
            it.registerListeners();
            // etc.
        };
        consumer.accept(Bukkit.getPluginManager());
worldly ingot
#

but that's just... not great haha

patent horizon
#

hmm

#

yeah

#

thought there would be something a bit closer

#

like maybe lambda or map()

#

couldn't get it to work in intellij though

drowsy helm
#

what would be the benefit of using that

#

i can't see how that would be more advantageous

patent horizon
#

registering every listener on plugin load

worldly ingot
#

It just avoids having to set a variable, that's it

#

Which is quicker I guess but meh, Kotlin devs and their shorthands

#

To answer your question, no, Java has no direct equivalent

drowsy helm
#

idk if its what you're getting at but you can use varargs?

solid lion
drowsy helm
#
public void registerListener(Listener... listeners){
  for(Listener listener : listeners){
    //whatever the register thing is
  }
}```
#

then you can just pass

registerListener(
  new listener1(),
  new listener2(),
  etc...);```
quaint mantle
# drowsy helm iterate from x-5 to x+5 then z-5 to z + 5 etc
for (x in 0 until (block.location.x + 5).toInt()) {
                        for (y in 0 until (block.location.y + 5).toInt()) {
                            for (z in 0 until (block.location.z + 5).toInt()) {
                                val detectedBlock = block.world.getBlockAt(x, y, z)
                            }
                        }
                    }```

that's right? (I'm using kotlin)
dry forum
#

why is there no method to make a snowball invisible

hardy swan
#

you can

dry forum
#

how

worldly ingot
#

As far as I'm aware, snowballs can't be invisible unless they don't exist ;p

quaint mantle
#

give them 500000 speed itselonhere

dry forum
#

i have them as a player passenger

drowsy helm
dry forum
#

because spawning silverfish is broken -_-

hardy swan
worldly ingot
#

Hm... workaround to making a snowball invisible might be to set the item stack to a

#

Yeah

#

lol, beat me to it

dry forum
#

that wont work i dont use a resource pack

worldly ingot
#

Well, no, but you would have to make one ;p

hardy swan
#

what if you set itemstack to air

worldly ingot
#

I don't think it lets you do that

#

Yeah, it would just be an empty item stack

quaint mantle
#

Is a reason but not an obstacle

drowsy helm
#

could you possibly use packets to delete the snowball entity?

#

but serverside it would still be there

dry forum
#

well i could also use silverfish but im 99% sure spigot is broken with silverfish spawning because Silverfish as = e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), Silverfish.class); doesnt work

hasty prawn
#

use spawnEntity

hardy swan
#

we need invisible arrows

dry forum
#

ah that works thanks

dry forum
#

how am i supose to make the customname show up because this doesnt work (name doesnt show up unless i go in gmsp)

        Silverfish as2 = (Silverfish) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation(), EntityType.SILVERFISH);

        as2.setGravity(false);
        as2.setInvisible(true);
        as2.setCollidable(false);

        as.setGravity(false);
        as.setCustomName("test");
        as.setCustomNameVisible(true);
        as.setInvisible(true);
        as.setCollidable(false);
        as.setCustomNameVisible(true);

        as2.addPassenger(as);
        e.getPlayer().addPassenger(as2);```
solid lion
hardy swan
#

if that is available to you

dry forum
#

nope

quaint mantle
dry forum
#

didnt know i did

burnt raven
#
wings:
  - red:
      image: purple.png
      duration: 1000
      name: "&c&lRed Wings"
      lore:
        - "&7These blood red wings will"
        - "&7show your intense pvp status"
        - "&7when worn!"
        - ""
        - "{duration}"
    - blue:
        image: red.png
        duration: 100
        name: "&9&lBlue Wings"
        lore:
          - "&7These ocean blue wings will"
          - "&7show your adventurous mindset"
          - "&7when worn!"
          - ""
          - "{duration}"

idk whats wrong with this YAML, its giving me this error
did not find expected key while parsing a block mapping at line 2 column 5

grand flint
#

Shouldn't -blue be in line with -red

burnt raven
#

oh

#

did not find expected '-' indicator while parsing a block collection at line 2 column 3

#

i get this now

#
wings:
  - red:
      image: purple.png
      duration: 1000
      name: "&c&lRed Wings"
      lore:
        - "&7These blood red wings will"
        - "&7show your intense pvp status"
        - "&7when worn!"
        - ""
        - "{duration}"
   - blue:
       image: red.png
       duration: 100
       name: "&9&lBlue Wings"
       lore:
         - "&7These ocean blue wings will"
         - "&7show your adventurous mindset"
         - "&7when worn!"
         - ""
         - "{duration}"
#

@grand flint

grand flint
#

I don't know, I'm not good at spigot development 🤷‍♂️

burnt raven
#

oh i fixed it it was that the sub properties were not indented properly

#

this is why json is better lmao

sharp flare
outer sorrel
#

how can i check if an item has certain tags?

sharp flare
#

what kind of tag

outer sorrel
#

i think nbt

#

im checking if an item is a custom item from a different plugin

#

this is what i was told in the support discord

only verify if has two tag
MMOITEM_TYPE
MMOITEM_ID
and verify with a builder if exist
sharp flare
#

u using nms or just spigot api?

outer sorrel
#

im using the spigot api

#

but idk what they use

sharp flare
#

what api version

outer sorrel
#

1.18.1

sharp flare
#

then it might be PDC not nbt

outer sorrel
#

whats that?

quaint mantle
#

?pdc

sharp flare
#

1.14 above uses pdc

outer sorrel
#

ill try that, thanks

sharp flare
#

if you don't know the key for the pdc of the custom item, you can try #getPersistentDataContainer#isEmpty

#

ItemMeta exist too if u want to know if its an custom item

solid lion
#

I was able to get my code to compile with no errors but now when i mine blocks the drops just thanos snaps out of existence

sharp flare
#

show code

solid lion
sharp flare
#

what are u trying to do

solid lion
#

its an autosmelt plugin, instead of hardcoding all my blocks and ores like usual im now creating a list in the config to choose what blocks drop what items on blockbreak

sharp flare
#

after breaking the block, it doesn't drop anything?

solid lion
#

nope not at all

sharp flare
#

show your blockbreak event

solid lion
sharp flare
#

ItemStack item = null;

#

inside your forEach

#

and the position is always 0

#

oh nvm thats correct

solid lion
#

lol

sharp flare
#

how about create a list for your itemstacks

solid lion
#

i did

#

thats the for statement

sharp flare
#

I'm having a hard time reading your code, use methods pls

quaint mantle
#

how to verify if the player has any slot empty?

sharp flare
#

and your cancelling your event at the bottom

solid lion
#

Basically its reading the config file like

       IRON_ORE:
            - IRON_INGOT ```
sharp flare
#

you can just not cancel it, and set the block type to air

#

and assign the drops

solid lion
#

oh lemme test that

sharp flare
solid lion
#

okay that event cancel is if the variable allowAutoSmelt is false

sharp flare
#

so if the allowAutoSmelt is set to false it will just drop the block drops instead of smelting it directly right?