#help-development

1 messages · Page 176 of 1

fluid river
#

umm

#

a lot of popular plugins have everything on pictures

quiet ice
#

So since images are only artistic flavour, just ignore the issue

fluid river
#

just as creative formatting

quiet ice
fluid river
#

I mean i'm gonna find you like 2 plugins rn

#

which have everything on pictures

pastel relic
fluid river
#

wait for 1-2 days

#

they will reappear

uneven wyvern
#

Does anybody knows how I can check, if an item is repairable?

fluid river
#

just a spigotmc thing

#

it usually erases my pictures in threads

#

and returning them back in 2 days

pastel relic
fluid river
#

then upload to different websites

#

and try using them instead of imgur

fluid river
grim ice
#

not really

#

there are ways for improvement

quiet ice
#

Required by rules

rough drift
#

Ayo illusion I got a suggestion: Pass in the menu, this allows you to not rely on outside variables :D

grim ice
#

e.g why use string ids

#
  • why is a variable named main, "main" doesnt speak for anything.
uneven wyvern
# fluid river if meta is instanceof Damageable i guess

Thats my code, I want to ask in the if(?) line, if the item is an item that can be demaged, but I dont´t know how, does somebody knows what I have to do there?

public static void repairHand(Player player) {
if(player.getInventory().getItemInMainHand().getType() != null) {
if(?){
player.getInventory().getItemInMainHand().setDurability((short) 0);
player.sendMessage(Message.REPAIR_HAND.getMessage());
} else player.sendMessage("This doesn't work.");
}
}

grim ice
fluid river
#

i literally pasted the solution

echo basalt
grim ice
#

main can literally mean many things

fluid river
#

if (item.getItemMeta() instanceof Damageable)

echo basalt
#

main is my plugin, module is my module

pastel relic
#

why?

quiet ice
#

Screen readers?

grim ice
#
  1. it can be a misspelling of "man"
  2. it can mean main plugin
  3. it can mean main menu
  4. it can mean maintainer
  5. it can mean main x (replace x with anything really)
quiet ice
#

Blind people (and people with poor eyesight in general) do exist

echo basalt
pastel relic
echo basalt
quiet ice
#

Also could spigot please have a dedicated place for rules

wind tulip
#

does anyone know how to find the binormal of a location's direction?

quiet ice
quiet ice
#

But the "Resource descriptions should be of good quality." is exclusive to premium resources though

tardy delta
floral drum
tardy delta
#

looks kinda terrible too

#

nested lambda brr

#

better

night copper
#

how can i get where the player is looking and spawn a tnt 10 blocks away?

wary topaz
#
Vector direction = player.getEyeLocation().getDirection();
Vector direction = player.getLocation().getDirection().normalize();
Vector direction = player.getLocation().getDirection();
tardy delta
#

does anyone knows a way to check if a Path object exists or is Files::exist sufficient?

sterile token
#

I would just use File

#

I mean i use File for everything, path, files , dirs

tardy delta
#

ye but im tired of writing so many lines just to create a file on disk

sterile token
tardy delta
#

kinda hot now

sterile token
#

aMAZIN

tardy delta
#

just added support for nested queries

sterile token
#

Fourten what repo are u using?

tardy delta
#

none?

sterile token
#

oh ok

tardy delta
#

coded this stuff myself

sterile token
#

I mean repo for putting the code

#

or is just private

tardy delta
#

private test thing

grim ice
#

except if you have some disability with your hands

tardy delta
#

java is as much javascript as car is to carpet

sterile token
tardy delta
#

lol

#

i hate that stuff

#

forgot to change logic smh

#

why not just fail silently java smh

echo basalt
#

watch me make a pro gamer move

sterile token
#

Fourteen could you help me to make an executor that allow to me to execute task with exceptions without needing you to try-catch them?

tardy delta
#

glad that works

dull whale
#
[20:37:10 ERROR]: Error whilst processing packet net.minecraft.network.protocol.game.PacketPlayInUseEntity@7a3fd9c2 for TheLudoBile[/127.0.0.1:54079]
java.lang.IndexOutOfBoundsException: readerIndex(2) + length(1) exceeds writerIndex(2): UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeDirectByteBuf(ridx: 2, widx: 2, cap: 256)
        at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1442) ~[netty-buffer-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.buffer.AbstractByteBuf.readByte(AbstractByteBuf.java:730) ~[netty-buffer-4.1.77.Final.jar:4.1.77.Final]
        at net.minecraft.network.FriendlyByteBuf.readByte(FriendlyByteBuf.java:1135) ~[?:?]
        at net.minecraft.network.FriendlyByteBuf.readVarInt(FriendlyByteBuf.java:469) ~[?:?]
        at net.minecraft.network.syncher.SynchedEntityData.unpack(SynchedEntityData.java:247) ~[?:?]
        at net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket.<init>(ClientboundSetEntityDataPacket.java:27) ~[?:?]
        at me.theludobile.shulkon.skyblock.NPCs.PrivateDialogue.talk(PrivateDialogue.java:37) ~[?:?]
fluid river
dull whale
#

what does this mean

tardy delta
fluid river
#

how can it be representation

tardy delta
dull whale
fluid river
#

version mismatch for skyblock i guess

tardy delta
#

love the fact that those bytebufs are friendly

#

mine arent :(

echo basalt
#

just use the proper constructor

fluid river
#

true

tardy delta
fluid river
#

thought it's not your plugin i mean

dull whale
sterile token
#

Have you learnt hava before coding?

dull whale
#

certainly

fluid river
#

ya know what constructor is right?

dull whale
#

of course

fluid river
#

IndexOutOfBoundsException: readerIndex(2) + length(1) exceeds writerIndex(2):

#

you messed up data

dull whale
#

Im just trying to give the client entity a custom name

#

and i dont know what messing up data means

fluid river
#

ya know move each new method to the next line and then check line which throws error

echo basalt
#

I'd generally recommend avoiding the read constructor

fluid river
#

will see 🙂

echo basalt
#

even though you can write the bytes directly

#

it's just stupid

tardy delta
#

hmm yes i love it when my code randomly stops executing without exceptions

echo basalt
#

Literally only there because the client makes an internal server

dull whale
#

how exactly are you saying I should do it

#

i didnt know this was a read constructor

echo basalt
#

This applies both to ProtocolLib and NMS

#

I'm writing a v2

#

probably coming around christmas

#

full crash-course into nms

sterile token
#

unsteable is correct for a menu button parameter?*

#

It will be to enabling/disabling button monving

echo basalt
#

manually resizing arrays like a pro

sterile token
dull whale
#

How do I even make a bytebuf with a byte array...

sterile token
#

weird

#

It create a thread

#

LMAo

dull whale
#

oh

#

that was a dum question

#

What is even the difference between copiedbuffer and wrappedbuffer...

undone axleBOT
dull whale
#

you're right sorry

tardy delta
#

ByteBuffer.wrap(new byte[size])?

#

or ByteBuffer.allocate(size)

night copper
#

How would you guys create like an iceberg for example, would you use particles or blocks or armor stands, please tell me whats the best way (the iceberg will be displayed for a short time)

tardy delta
#

ij database tab seems to be broken tho

quiet ice
tardy delta
#

if you want to have an empty array yes

#

was just responding to someone tho

echo basalt
quiet ice
#

Copied buffer is a strange name

#

But they are probably talking about netty bytebuf's not NIO ByteBuffers

tardy delta
#

ij ultimate is a bitch

wind tulip
#

Can someone help me get the tangent of a vector?

hazy parrot
#

Remote or local

echo basalt
wind tulip
#

tangent is the red line

#

the normal is the blue line

#

normal is basically the direction the vector is pointing to

tardy delta
#

just broke my ide

wind tulip
#

tangent is like that direction but perpendicular

tardy delta
echo basalt
#

so you want a perpendicular vector

wind tulip
#

more or less but not the binormal

#

the tangent specifically

sterile token
echo basalt
#

thing is, the red arrow could point left

tardy delta
echo basalt
wind tulip
#

it's used in lots of things

#

like say u have a line

#

and u want to construct a road around it

#

you'd use the tangent

#

or in my case

sterile token
#

I only know it because we use it on class with triangles

wind tulip
#

I want to make a particle circle

sterile token
wind tulip
#

what

sterile token
#

I dont know you tagged me?

wind tulip
#

I didn't though

sterile token
#

wird

#

I receive a tag

molten hearth
#

he didnt lmao

sterile token
#

How are you?

molten hearth
#

helloo

#

im doing good ty wbu

sterile token
#

fine trying to coding my menu api

molten hearth
#

nice nice gud luck

sterile token
#

thanks 🤍

molten hearth
#

np

tardy delta
#

prev time i let this run for an hour and still it didnt finish

molten hearth
#

stupid intellij ig

sterile token
molten hearth
#

if only vscode has proper support for java

sterile token
#

that why i use bash terminal directly

sterile token
#

VScode is amazing but not for java 😡

molten hearth
#

yeah the support really sucks for java but its amazing for stuff like JS or TS

#

dunno why they dont just add java support

#

smh

#

also good for py

sterile token
#

I would love something like Intellij with VSCode optimizations, shortcuts, etc

molten hearth
#

^

molten hearth
#

yeah

sterile token
#

I mean Vscode isnt code on rust?

#

I have seen a new editor coded in rust

molten hearth
#

no its built on JS and TS lol

quiet ice
#

Why not use Eclipse Eierlegendewollmilchsau?

sterile token
tardy delta
#

german?

sterile token
#

Eclipse is the best shit i have ever seen

tardy delta
#

hmm i click on a button and it does nothing

sterile token
#

If i have to use eclipse i would rather code in Vscode

quiet ice
sterile token
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.

sterile token
#

weird

#

who deleted my message?

quiet ice
#

Eierlegendewollmilchsau basically means something that does everything - hence that edition of eclipse is incredibly bloated

sterile token
#

You are making me feeling diases

tardy delta
#

ahh

sterile token
#

i really want to 🤢 now that i heard eclipse

#

eclipse 🤌🤌🤌🤌🤌🤌🤌🤌🤌🤌🤌

#

LMAFAO Eclipse SUCKS

quiet ice
#

Want to develop for rust? Eclipse Eierlegendewollmilchsau can do it. Want do develop in C/C++? Eclipse Eierlegendewollmilchsau can do it. Want to develop in Java? Eclipse Eierlegendewollmilchsau can do it. Want to do web dev? Eclipse Eierlegendewollmilchsau can do it too

tardy delta
#

ij can do it too, just with a plugin smh

sterile token
tardy delta
#

or you pay for another one of those ide's smh

#

webstorm works with js, doesnt it?

sterile token
tardy delta
#

i like the sync feature

quiet ice
#

Eclipse basically has the same system of having dozens of plugins

sterile token
#

Because i paid like $512 and i get access to all the shity jetbrains IDE

#

And none of them works so amazing than VScode

eternal oxide
#

I had to install a db plugin for eclipse and it's all I need

tardy delta
#

both the database system and @Language annotation seem broken now brr

tardy delta
#

the other stuff works

sterile token
#

System#arrayCopy() breaks everything

tardy delta
#

i got it for free

sterile token
tardy delta
#

got it for free for three years in college

quiet ice
#

I don't even use it at all. Saves a lot of money

tardy delta
#

hehe thats a shit amount of money

#

the only thing i would use is literally ij, webstorm and clion

sterile token
#

literally paid my country's minimum wage.

#

Even more

kind hatch
sterile token
#

In my case the student email i used get blocked

#

So i cannot register with it anymore

kind hatch
#

Bro how?

#

How do you manage to get a student email blocked?

sterile token
#

Its simply they dont allow more than 1 account with same email

#

🤔

#

isnt it like that on every site

kind hatch
#

Uhh, then change the password?

tardy delta
#

i mean this shit aint doing anything

sterile token
tardy delta
#

wtf the mouse cursed

sterile token
#

The | doesnt appear but i can write and move to another line

wind tulip
#

Hold on let me rephrase my question:
How do I find the orthogonal vector to another vector in spigot?

molten hearth
#

how to find orphans tutorial

tardy delta
#

only the deactivate and remove button works smh

#

guess they even havent implemented that feature

kind hatch
tardy delta
#

wdym?

molten hearth
#

have you tried import from clipboard? @tardy delta

tardy delta
#

the cursor is cursed on that vid ye but its normal

kind hatch
#

You had screen tearing of sorts not just a few minutes ago.

molten hearth
#

maybe you can just copy all your SQL and import from clipboard not sure

tardy delta
molten hearth
#

skill issue

#

perhaps because its importing nothing

tardy delta
#

maybe

#

none of those buttons does anything lol

molten hearth
#

tru

sterile token
#

I would love to github wiki allows you to upload the content using .md files

tardy delta
#

my mouse is really cursed with this capture thing

quiet ice
#

No, I think IJ is cursed

kind hatch
#

I mean, have you tried the good ol restart?

tardy delta
#

yep several times

#

lets throw those caches out ig

molten hearth
#

cached cursor position

kind hatch
#

Are you using the latest version or smth?

molten hearth
#

this reminds me, I tried MineColonies today

#

so fucking buggy lol

tardy delta
#

now it says an update lol

sterile token
tardy delta
#

smh need my laptop for 5 hours tmrw without charging

subtle pewter
#

How to fix

sterile token
tardy delta
#

lol works now

onyx fjord
#

is anyone aware how to open db-wal file?

subtle pewter
#

I’m sending chat colors

sterile token
#

?paste

undone axleBOT
sterile token
#

Code please

molten hearth
lost matrix
sterile token
tardy delta
#

db console kinda hot tho

subtle pewter
#

player.chat(ChatColor.stuff);

molten hearth
#

why are the column names red

#

triggering

subtle pewter
lost matrix
#

The coloring has to be done purely on server side

sterile token
#

Sounds ilogic what u telling

#

🤔

molten hearth
#

the plugins translate the messages the players dont directly use the colors

kind hatch
#

I'm a little confused too. I'm pretty sure you can send that symbol, it's just that it won't display visually.

lost matrix
#

They use the & sign and translate alternate color codes

sterile token
sterile token
lost matrix
#

The translation is done server side

tardy delta
#

heh ill just steal electricity of school with my 250 watt charger lol

sterile token
#

I dont know what is he doing...

#

Because he never sent code nor a cap

lost matrix
sterile token
#

notchian?

#

weird fucked closed english language

onyx fjord
#

🤦‍♂️

molten hearth
#

sorry I only use the jebian

kind hatch
subtle pewter
sterile token
onyx fjord
#

bro what

sterile token
molten hearth
#

./sqlite3 tmp.db-wal

lost matrix
#

And if the server detects them anyways then you get kicked without the message reaching the server

kind hatch
lost matrix
molten hearth
#

well no quite simply load 1.7.10 or something and send one and see if you get kicked

onyx fjord
molten hearth
#

lmao

onyx fjord
#

and idk SQL

sterile token
kind hatch
tardy delta
kind hatch
#

It fixed now fourteen?

sterile token
# tardy delta

Are u usuing reflections to assign the db properties to java?

tardy delta
#

yep update seems to fixed it

#

thank tho

kind hatch
#

Ok, now just don't update IJ until like 6 months from now and you probably won't have that many issues with it. lmao

tardy delta
#

lmfao

kind hatch
#

Like, deadass, it works. I was using IJ 2021 until recently.

tardy delta
#

this is basically what my select query is doing

#

actually wondering why i added a connector as param lol

#

ah i see

#

ill implement the rest of it in college lol, have to wait for three hours there

lethal coral
#

How can I ensure my plugin loads before all others on my server? I know there's pre/post world, but outside of that how would I do it?

eternal oxide
#

you can't guarantee it

sterile token
eternal oxide
#

you can't. What happens when two plugins ask to be loaded first?

kind hatch
#

What are you trying to have run before everything else?

sterile token
#

I think that the only reason for doing that

eternal oxide
#

Design your plugin so it doesn't matter when it loads

kind hatch
#

I mean, Multiverse loads worlds POSTWORLD and they are just fine.

sterile token
eternal oxide
#

yes it is

sterile token
#

Because you must load words before everything

lethal coral
#

the whole purpose of this plugin is to disable another plugin

kind hatch
#

You can still do that.

sterile token
lethal coral
#

yes but

#

I don't even want it to load anything

eternal oxide
lethal coral
#

I don't want its onEnable to run

#

I understand I can disable it

#

I just don't know how to ensure the onEnable doesn't run

sterile token
lethal coral
#

I am aware

kind hatch
#

Well, I'm not sure if it would disable it at this stage, but you could try calling the disable method in your onLoad() method.

eternal oxide
#

Why are you wanting to prevent another plugin from running onEnable?

lethal coral
#

because the plugin comes preinstalled on the server by the host

eternal oxide
#

Yeah, not going to help with that

kind hatch
#

I'm assuming it'll reinstall itself if you try to remove it?

lethal coral
#

yeah

lethal coral
#

would you like a random cosmetics plugin on your server running in the background?

kind hatch
#

Well, shitty host for one.
Second, no guarantee what I suggested would actually work. (Haven't tested it myself)

eternal oxide
#

You are obviously trying to bypass a hosts limits/protections

lethal coral
#

it's not a protection

#

look into it yourself

#

instead of making assumptions about other people you should be a bit kinder

chrome beacon
#

Just let it be there or pay for a host

#

If it comes preinstalled you should respect that since it's a free host

eternal oxide
#

I don;t need to be kinder. you are trying to bypass a hosts requirements.

lethal coral
#

lol

#

I will think again before asking for help here thank you for your time

eternal oxide
#

Thats obviously how they make their money to pay for your free hosting

lethal coral
#

they are funded by superleague (their parent company) the developers have said themselves they don't even break even

eternal oxide
#

So you want to remove one of their funding models even when you know they are making a loss?

#

Thats kind of you

lethal coral
#

they aren't necessarily making a loss, the break even is just with ranks and stuff

#

not including the massive amount of sponsorships they get with nickelodean

quaint mantle
#

Ew hapily

lethal coral
#

omg hi outspending!

quaint mantle
#

Hi!

lethal coral
#

how have you been

quaint mantle
#

Good, you?

sterile token
#

I mean never have you bypass a host?

#

😂

#

Its pretty sweaty

lethal coral
#

I've been solid actually just on my 4 day weekend

sterile token
#

I bypassed a host security once

sterile token
#

I remember that a friend explain me a vulnerability to inject malwares jars into the JVM

quaint mantle
#

Minehut moment

lethal coral
#

😬

sterile token
#

Host are so amazing that they dont restrict server JVM

quaint mantle
#

Ikr

sterile token
#

So you can inject things via spigot

lethal coral
#

me on my way to host another server on the server 🏃‍♂️

sterile token
#

a

#

who is tagging me?

fluid river
#

me

quaint mantle
#

No one?

lethal coral
#

I didn't see anybody tag you

fluid river
#

.

quaint mantle
#

Gotta love it

lethal coral
#

💀

lethal coral
wary topaz
#

before you ask the tpall is in my plugin.yml

quaint mantle
#

Because the plugin is disabled. Pretty self explanatory

worldly ingot
#

inb4 your reload command is doing

Bukkit.getPluginManager().disablePlugin(plugin);
Bukkit.getPluginManager().enablePlugin(plugin);```
lethal coral
eternal oxide
#

lol

grim ice
#

but im gonna assume its not

#

if u disable ur plugin, then the plugin cant reenable itself, because its already disabled

jaunty crag
#

how can i add Booleans that are always like part of the player in a way, like if they are ready or not ready

opal juniper
#

you should use plugin.onEnable() instead

#

call them directly thinksmart

jaunty crag
#

are u able to add things to the player class

#

like for example

opal juniper
#

no

#

you have to wrap it

jaunty crag
#

oh alright

#

how would I make a bool attached to the player

#

like a ready and un ready

night copper
#

now, how do I make this horizontally

opal juniper
#

class CustomPlayer
Reference<Player> player
Boolean whateverYouWant

night copper
opal juniper
agile echo
#

Hiii is there anyway of seeing what plugins are conflicting with eachother one of the plugins i’ve downloaded isn’t working and I have 0 idea why

jaunty crag
#

how can i teleport people from one world to another

#

does it just use the Player#teleport

opal juniper
#

Player#teleport with a location of different world

echo basalt
night copper
#

yeah but when I look in a X direction it works but when I look in the Z direction it doesnt

jovial radish
#

does anyone know how i can make an item uncraftable

night copper
#

my trigonometry is bad

lethal coral
#
    private Map<String, Command> getKnownCommands(SimpleCommandMap simpleCommandMap) {
        try {
            final Field knownCommands = simpleCommandMap.getClass().getDeclaredField("knownCommands");

            knownCommands.setAccessible(true);
            return (Map<String, Command>) knownCommands.get(simpleCommandMap);
        }
        catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

Why does this throw NoSuchFieldException?

sterile token
#

Wrong code

fluid river
#

open class sources

#

and check yourself

fluid river
#

might be cuz of mappings or smth

echo basalt
#

CraftCommandMap extends SimpleCommandMap

#

but doesn't contain the field

#

as it's inherited

#

so replace simpleCommandMap.getClass() with SimpleCommandMap.class

sterile token
echo basalt
sterile token
echo basalt
sterile token
#

wait wait

#

but that isnt obfuscated

echo basalt
echo basalt
sterile token
#

hmn

#

I dont really understand the diff

#

Explain how it works

#

I dont even understand how spigot worrks

echo basalt
#

CraftBukkit is the abstraction layer that implements bukkit and calls NMS internally

#

it also does some changes in NMS for things like events

eternal oxide
#

if it starts net.minecraft its NMS, if it has Craft at the beginning of the name its CraftBukkit (implementation). Everything else is org.bukkit (API)

sterile token
#

bukkit was previous name of spigot right?

echo basalt
#

uhh sure

#

Bukkit is a set of interfaces
CraftBukkit is Bukkit, along with the implementation of those interfaces
NMS is mojang's native implementation
Spigot is a fork of CraftBukkit that originated after Bukkit got DMCA'd

#

Where they changed the build system to use buildtools

#

to comply with copyright law

sterile token
#

So NMS works together with minecraft-sever right

lethal coral
kind hatch
lethal coral
sterile token
lethal coral
#

Wdym

sterile token
#

What do you need so

#

i dont know why spigot api doesnt have a getter for none of them CommandMap nor KnowCommands

echo basalt
#

hexic already got his stuff fixed

#

You can use the commandMap to inject commands without needing them on the plugin.yml

#

or you can inject a custom commandMap to fire new events

olive valve
#

Hello, I am having problems with rotating a sign 180 degrees. I am trying to fix my DeathChest plugin and I need to rotate the sign on the chest 180 degrees, and I can't seem to figure it out.
I've used:

  • Setting the Yaw
  • setDirection()
  • Directional
olive valve
#

okay ill try that thanks

stark nebula
#

Can someone link me to a decent tutorial on how to setup Intellij for older minecraft/spigot versions?
IE : If you use the Minecraft generator -> spigot plugin -> you only get options for 1.19.2-1.12 by default ; looking for a tutorial on how to set it up for other older versions ( aka 1.8 )

olive valve
eternal oxide
#

and rotate

olive valve
# eternal oxide and rotate
Rotatable dir = (Rotatable) loc.getBlock().getBlockData();
            dir.setRotation(BlockFace.NORTH);
            loc.getBlock().setBlockData(dir);
            // We need to update the state
            loc.getBlock().getState().update();```
like this?
eternal oxide
#

no

#

You can;t apply data to the block if you are to overwrite with a state update

olive valve
#

so remove the state update?

eternal oxide
#

that may work, or you will want to get a state and work on that before updating

olive valve
#

that didn't work

eternal oxide
#

then use teh BlockState

olive valve
#

okay

young knoll
#

You don’t need to touch the state to modify block data

wraith apex
#

How do you find out which slots are involved in a InventoryClickEvent when the click type is ClickType.DOUBLE_CLICK ?

#

Double Click will grab other items in the inventory that are the same and merge them until the stack is at max size

#

I'm trying to figure out how to get the raw slot ids that would reference where the double click is grabbing items from

spice shoal
#

Hey guys, how can I create or paste an emoji/chat_tag etc of oraxen on another plugin?
Should I use UNICODE?
if you how?

sterile token
rigid loom
#

So what i want to do is make it so that i can set a person's permission on initial join to be able to create a kingdom and remove it when they create a kingdom. However, i dont want it to be able to give the person the kingdoms.create permission if they are in a kingdom when they rejoin the server.

#

how would i do this?

remote swallow
#
if (p.hasPlayedBefore()) {
  return;
} else {
  //add permission
}
fluid river
remote swallow
fluid river
#

i think he needs another solution

fluid river
#

cuz not every player create a kingdom before leaving

echo basalt
#

the else is can be ommited

rigid loom
fluid river
#

just do that then

remote swallow
#

PlayerJoinEvent prob

fluid river
#

hey guys

#

as i can see you can't create a util class which works with files

#

like a full static util class

#

which works aroung plugin's folder

#

cuz you would need to pass a folder in constructor

fluid river
#

so will be forced to have instance

eternal oxide
#

You can, but you'd need to get a plugin instance each time

fluid river
#

so singleton or

eternal oxide
#

you can get that from JavaPlugin static

wraith apex
fluid river
#
public static void loadFolder(File f) {
    this.folder = f;
}```
in util class
wraith apex
#

not the other slots involved in a double click

hazy parrot
fluid river
#

and in onEnable

UtilClass.loadFolder(this.getDataFolder());
hazy parrot
#

add api as dependency

fluid river
#

wouldn't it work?

stark nebula
fluid river
#

Create

#

New

hazy parrot
fluid river
#

Java Project

eternal oxide
#

yes, but thats not really stateless

hazy parrot
#

JavaPlugin.getPlugin

fluid river
#

What is better for overall performance tho

eternal oxide
#

using JavaPlugin you can get teh loading plugin so you don;t need to specify any plugin name, making the util class portable

fluid river
#

calling getPlugin everytime or saving it to a static variable with a method called in onEnable

young knoll
#

Sounds like a micro optimization

eternal oxide
#

getting the instance is going to be slower as it is retrieving from a map, but not much

fluid river
#

i mean isn't this thing better

eternal oxide
#

its not a good design pattern

fluid river
#

than calling getPlugin() everytime i use util class

eternal oxide
#

for a util class

fluid river
#

so basically it's allowed but is a bad choice

eternal oxide
#

yep

fluid river
#

tho i still think it's gonna be kinda faster

#

i don't need instance itself tho

#

i just need folder

eternal oxide
#

a util class should not really require initializing

fluid river
vocal cloud
#

Don't instantiate util classes 😭

fluid river
#

isn't Singleton pattern kinda unofficial tho?

#

I heard it was defined in a book by Gang of Four

#

But wasn't mentioned in some Java-related books and documentation

vocal cloud
#

You don't use a singleton you use a static

fluid river
#

that's another question rn

#

not about util class for working with files in plugin folder

#

Back to the previous topic, if you have a loadFolder() method in a util class it won't break your program

#

just a "horrible design pattern"

#

but if this method is declared and used, you can easily avoid creating instance

#

cuz there is no real need in instance of FileManager with 99 static methods

#

The problem is, it can only get a folder by calling MainClass.getInstance().getDataFolder()

#

but if you have a loadFolder() method which you call in onEnable(), you can avoid getting instance of main class

#

so you would completely remove Singleton from your program

#

and only have DI and one class with static initialize method

#

Would be faster, but you would have folder path stored in memory as a cost

#

tho not a big deal

#

@vocal cloud what do you think about that

vocal cloud
#

You don't name a class util and instantiate it. If you want a config you can instantiate you use a different name

fluid river
#

i don't "instantiate" it

#

i just load a folder to static variable

#

without creating instance of FileManager

#

Lemme describe

#

in code

#

V "Util" FileManager class V

#

V Main class V

#

V and command class V

river oracle
#

what... :( what is this

#

this is a... odd.. design pattern

fluid river
#

Yeah

#

My own design pattern for minecraft

river oracle
#

what is it for?

fluid river
#

basically i want to avoid creating filemanager instance

river oracle
#

why

fluid river
#

and filemanager has all methods static

#

but the only way to get folder is by having singleton getInstance() in main class

#

from which you call getDataFolder()

#

but i want to avoid it too

#

cuz all of my static FileManager's methods require datafolder

#

and for each method i would call instance of main class which extends JavaPlugin

river oracle
#

hmm well if you don't like typing getInstance() just shorten the method name to instance or get

fluid river
#

I still think it's slower than my pattern

#

Just having datafolder saved in filemanager itself

#

gonna be faster

#

but i would need loadFolder() method in onEnable

fluid river
#

ClassName.instanceMethodName().getDataFolder()

river oracle
#

instanceMethodName() is so long lol

#

just do ClassName.get().getDataFolder()

fluid river
#

2 with static imports
import static me.carefall.course.ClassName.instanceMethodName;

instanceMethodName().getDataFolder()

fluid river
river oracle
#

thats just lazy then verbosity can help code clarity

#

I never use static imports unless I'm dealing with components

fluid river
#

Main.get().getDataFolder() vs folder

#

i can write folder 99 times with stored folder

#

or have two calls 99 times

#

without it

#

getting already pre-saved folder gonna be
a) faster
b) shorter

#

the only bad thing is guys would complain about it's not a real pattern

eternal oxide
#

In your util class just use JavaPlugin.getProvidingPlugin(this.getClass()) to get your plugin instance

fluid river
#

now it turns to three calls

#

getClass + getProvidingPlugin + getDataFolder

eternal oxide
#

you can make it a static block

#

so it runs only once

fluid river
#

you mean

hasty prawn
#

hol up are you really concerned about 3 method calls?

fluid river
#

static {
folder = JavaPlugin.getProvidingPlugin(this.getClass()).getDataFolder()
}

eternal oxide
#

yes

hasty prawn
#

What kind of super micro optimalizations are you doing

fluid river
#

truuuuue

#

alr i avoided method

fluid river
#

so you promise it would work for basic minecraft plugin this way

#

don't look at undrline

#

i just made all of this classes myself with no spigot dependency added

eternal oxide
#

if it were me I'd make it a private static method, then call it in a static final field

echo basalt
#

I got some motivation to write my NMS crash course

#

wrote a bit about packets and now I'm writing the entire tcp protocol

fluid river
echo basalt
fluid river
#

wouldn't it work this way tho

#

without static {}

eternal oxide
#

it may, test it and see

fluid river
#

isn't that some kind of pattern break again tho

#

having a static {} in util class

eternal oxide
#

kinda

fluid river
#

so glad i don't give a shit

eternal oxide
#

but it's allowing the class to handle its own initialization

fluid river
#

thanks for telling about getProvidingPlugin

#

never knew about it

fluid river
#

It's fully legal

river oracle
#

java won't deprecate static{}

#

it has its uses

fluid river
#

basically found a use for it

river oracle
#

if they did that version would die quick as fuck

fluid river
#

getting dataFolder from javaplugin in a static class

#

avoided DI and Singleton and everything else

#

tho is getProvidingPlugin using reflection

eternal oxide
#

I don't believe so

#

it doesn;t matter if it is though, it's a static final field so it only ever gets called once

hazy parrot
#
@NotNull
    public static JavaPlugin getProvidingPlugin(@NotNull Class<?> clazz) {
        Preconditions.checkArgument(clazz != null, "Null class cannot have a plugin");
        final ClassLoader cl = clazz.getClassLoader();
        if (!(cl instanceof PluginClassLoader)) {
            throw new IllegalArgumentException(clazz + " is not provided by " + PluginClassLoader.class);
        }
        JavaPlugin plugin = ((PluginClassLoader) cl).plugin;
        if (plugin == null) {
            throw new IllegalStateException("Cannot get plugin for " + clazz + " from a static initializer");
        }
        return plugin;
    }
#

in case you are really curious ^^

fluid river
#

so basically yes

#

reflection + static = ❤️

#

it worked

#

ez

quaint mantle
#

Question how can i support voting to bedrock users with nuvotifier?

remote swallow
#

using the correct votehandler

#

i know VotingPlugin supports bedrock users

quaint mantle
#

Does it work with votifier?

remote swallow
#

nuvotifier yes

quaint mantle
#

Yup it does

#

Ty!

#

❤️

quaint mantle
#

how would i fix this?

#
    at org.bukkit.craftbukkit.v1_19_R1.CraftRegionAccessor.spawnEntity(CraftRegionAccessor.java:400) ~[paper-1.19.jar:git-Paper-81]
    at me.outspending.mobgens2.Generators.summonMob$1$1.run(summonMob.java:45) ~[MobGens2-1.0.0.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.jar:git-Paper-81]
    at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1491) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1415) ~[paper-1.19.jar:git-Paper-81]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1188) ~[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) ~[?:?]
#

spawns mob

#

line:

var entity = spawnLocation.getWorld().spawnEntity(spawnLocation.clone().add(0.5, 1, 0.5), mob);```
echo basalt
#

Your "mob" variable is null

#

Filter your inputs

#

And learn how to read stack traces

visual citrus
#

[09:52:16] [Server thread/ERROR]: Tag not valid: null

#

what is this

#

i want to open menu if knowledge book is clicked

drowsy helm
visual citrus
#

@EventHandler
public boolean openMenu(PlayerInteractEvent e){
Item item = new Item();
Player p = (Player) e.getPlayer();
p.sendMessage(e.getItem().getType().toString());
ArrayList<Boolean> ability_useable = ability.get(p);
Action a = e.getAction();
Boolean f = false;
if(p.getItemInHand() == null)return false;
if((a == Action.RIGHT_CLICK_AIR || a == Action.RIGHT_CLICK_BLOCK || a == Action.LEFT_CLICK_AIR || a == Action.LEFT_CLICK_BLOCK) && e.getItem().getType() == Material.KNOWLEDGE_BOOK && e.getItem().getItemMeta() != null){
e.setCancelled(true);
p.openInventory(i);

drowsy helm
#

please use a codeblock

#

is there no proper error?

#

tag not valid: null is very vague

visual citrus
#

nope

#

no error except that

drowsy helm
#

so it happens when you interact with the book?

visual citrus
#

yes

drowsy helm
#

can you show the code where you give the book

visual citrus
#

Inventory i = (Inventory) p.getInventory();
ItemStack kbook = new ItemStack(Material.KNOWLEDGE_BOOK);
i.setItem(8, item.setSlot(kbook, "§d open menu"));

#

.setSlot is

#

public static ItemStack setSlot(Material material, String name) {
ItemStack item = new ItemStack(material);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(name);
meta.addItemFlags(new ItemFlag[]{ItemFlag.HIDE_ATTRIBUTES});

    item.setItemMeta(meta);
    return item;
}
drowsy helm
#

pls use codeblocks o-o

visual citrus
#

idk codeblocks

#

isn't it enough to use intelliJ?

drowsy helm
#

like that

visual citrus
#

ok

drowsy helm
#

looks fine to me

#

have you tried without the item flags

visual citrus
#

ill try it

#

nothing changed

drowsy helm
#

what version are you using?

visual citrus
#

1.16.5

visual citrus
#

ty

drowsy helm
#

according to this you have to set the title as it defaults

#

looks like a minecraft thing

visual citrus
#

ill try it

wary topaz
#

Everything is in the plugin.yml

#

When I removed the case tpall it worked

drowsy helm
#

woah

#

alotta nested if statements

wary topaz
#

Any solutions?

drowsy helm
#

so if oyu remove the case it works?

wary topaz
#

I'll try that.

drowsy helm
#

doesn't really make sense for the error given

#

no im asking if that is what you ar saying lol

wary topaz
#

wdym then?

drowsy helm
#

that

#

wdym by that

wary topaz
#

when I removed the code in the red it worked

#

wait nvm

#

it doesnt

#

;c

#

idk what to do than

drowsy helm
#

do you get an error on startup

desert loom
#

that log says the plugin is disabled.

drowsy helm
#

it says plugin is disabled

desert loom
#

yea that

drowsy helm
#

lmao just saw that

wary topaz
#

I used sharpkeys to replace my (shift + 7) with §

drowsy helm
#

using § is overall bad in code

#

just use translateColorCodes

wary topaz
#

Alr, but does anyone have a solution for the error?

drowsy helm
#

i asked you before

#

is there any error on startup

wary topaz
#

Let me try restarting

#

No errors on startup.

#

Wait.

#

I think it just fixed it

drowsy helm
#

the plugin is disabled it must be

wary topaz
#

but it didnt give me the debug message

#

there is no errors

drowsy helm
#

plugwoman

wary topaz
#

Yea

drowsy helm
#

also why not use a command framework

wary topaz
#

i bind my /bettercommands reload to reload the plugin

drowsy helm
#

will make your life a million times easier

wary topaz
#

it reloads with plugwomen

#

its a dev server

drowsy helm
wary topaz
#
  • I like to make changes like tiny text in quotes
drowsy helm
#

reloading doesnt always properly reset your plugin

wary topaz
#

mb

#

?paste

undone axleBOT
wary topaz
drowsy helm
#

still could be using old caches, the wrong jar etc

#

just because it prints doesnt mean it's a definite reload

quaint mantle
#

lmao

#

its clearly spawning it

#

it cant be

#

or im trippin

drowsy helm
wary topaz
#

Wait does anyone know why it's not sending the debug message?

quaint mantle
drowsy helm
#

stop using var bruh

#

this isnt js

quaint mantle
#

why

#

it better

#

xD

drowsy helm
#

java is a strongly typed lang

#

they only added var to avoid generics

#

not for lazy people to use all the time

quaint mantle
#

alr

#

fine

echo basalt
#

no comment

worldly ingot
#

mfw using var for literally every single type except the generic

echo basalt
#

wait am I tripping or is this guy using multiple maps instead of a basic data class

#

oh yeah Choco

wary topaz
#

also hi choco

echo basalt
#

@worldly ingot how does this make you feel

worldly ingot
#

die

wary topaz
#
case "tpall", "bringall" -> {
                    Bukkit.getConsoleSender().sendMessage("Debug");
                    return true;
                }

ma debug message is not bein sent

drowsy helm
#

is it still giving the error?

#

or nothing at all now

wary topaz
#

no

#

no error

#

just not giving me anything

drowsy helm
#

put a print statement just before teh switch

#

print whatever label is

wary topaz
#

bet

drowsy helm
#

and see if the method is even being executed

echo basalt
# worldly ingot die

maybe you should add events to Bukkit#dispatchCommand so I don't have to do this tomfoolery

worldly ingot
#

ServerCommandEvent?

wary topaz
#

om it worked

#

ty @drowsy helm i guess it fixed itself

echo basalt
#

Uhh not sure about newer versions but afaik that only fires when the console runs a command

wary topaz
#

I got both debug messages

drowsy helm
echo basalt
#

Then there's PlayerCommandPreProcessEvent

#

Which is fired during packet listening

wary topaz
#

i have no idea (get it cause intellij ik its stupid) but ill just go with it

echo basalt
#

There's PlayerCommandSendEvent which is fired when the player first logs in and brigadier sends all commands to the player

wary topaz
#

Cannot resolve method 'getServer' in 'Teleport'

echo basalt
#

ethan you gotta stop copypasting code

wary topaz
#

wdym?

river oracle
#

wtf am I looking at jesus christ

drowsy helm
#

this.getServer()

#

from a CommandExecutor?

wary topaz
#

ohhh i replaced this with player

#

😮 it worked !

#

time to make a clearchat :_)

wary topaz
drowsy helm
#

you are trying to make a colleciton of players a single player?

wary topaz
#

oh yeah I should make it a for loop

#

or a hashmap

desert loom
#

use a for loop

#

also, that if statement is probably unneeded.

#

CommandSender has a getName method that you can use

wary topaz
#

so my command works when I do bettercommands:clear but when I do /clear it goes to default mojang clear

vocal cloud
#

That's how it works?

wary topaz
#

I want it to override?

vocal cloud
#

Fork spigot?

wary topaz
#

like my /gamemode command overrided it

vocal cloud
#

No idea if you can since it's written that way to prevent overlap

wary topaz
#

oh wait I just had to restart it fixed itself

#

time to make a invsee 🙂

#

holly crap player.openInventory(target.getInventory());
actually lets me edit the inventory too, this saves me soo much time!

#

How can I set the inventory name?

wary topaz
#

How can I fix this/

echo basalt
#

It's more difficult than you think

#

The proper way is to create a fake tile entity so it can fire events

#

or set it at some very far location

wary topaz
#

Any quick way to do it?

echo basalt
#

eh not really no

wary topaz
#

You know the plugin essentials x?

#

Do you know how they do it?

#

So I can get source code

echo basalt
#

just look at the source code

wary topaz
#

Where?

#

Oh

echo basalt
#

github... just put some effort ffs

wary topaz
#

I really dont understand that

echo basalt
#

oh yeah there's Player#openWorkbench

wary topaz
#

;P

echo basalt
#

or you can just google stuff

#

Asking here should be your last resort

wary topaz
#

It wsa.

#

was*

#

Is there a Player#openAnvil

#

?

remote swallow
#

gotta tas you

#

?tas

undone axleBOT
remote swallow
#

also ?jd-s

#

?jd-s

undone axleBOT
wary topaz
#

There are no docs or anything on google that can help me

#

About opening an anvil inventory thats functional

remote swallow
vocal cloud
#

I doubt that google doesn't have an answer lmfao

wary topaz
#

thats not a reasonable answer..

#

How can it not be as simple as player#openworkbench?

remote swallow
#

spigot doesnt have a method for it i would guess

wary topaz
#
  • i have would have to do this for a loom, carto table, grindstone and more cause thats what my plugin is going to do
hybrid spoke
#

take a look at AnvilGui

wary topaz
#

Where?

hybrid spoke
#

?bing

undone axleBOT
remote swallow
#

nah

#

?google

undone axleBOT
wary topaz
#

?opera

#

;c

remote swallow
#

you only ever use bing becuase its not google

upper vale
#

since when was opera a search engine

wary topaz
#

wait opera is google

remote swallow
#

correct

wary topaz
#

;P

hybrid spoke
#

?bing

undone axleBOT
wary topaz
#

Well, if this is the case. I'm just going to halt on this project until they update and add inventorytypes for all guis. If they dont that will just suck.

#

Because I'm not spending 2 hours creating a gui for every utility when I can just get one from the creative menu

#

not 2 hours*

hybrid spoke
#

or you can be the one and either provide said api or PR it

wary topaz
#

2 months

#

I'm not a api guy

vocal cloud
#

Welp you gotta do it yourself or wait for it to get done

hybrid spoke
#

i'll do it for 35€/h

brave goblet
hollow pelican
#

I'm doing a custom fall damage system using my own custom health system (Scoreboard values if you're wondering) and I'd like to know how I could make fall damage scale with health since even 500 health would require me to fall from 80 blocks high to do any noticeable damage.

wary topaz
#

;O

#

let me look at it

hollow pelican
brave goblet
#

Or maybe not idk

wary topaz
#

I think thats for craftbukkit

#

maybe

vocal cloud
#

CraftBukkit stuff will work for Spigot

wary topaz
#

Its erroring though

vocal cloud
#

Does it use NMS?

wary topaz
#

no

#

wait actually yes

tender shard
#

if it throws errors, ?paste the errors

remote swallow
#

we need cafebabe commands to work mid messaegs

#

dont question my spelling blame speed

tender shard
#

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

tender shard
#

it's just REDv3

remote swallow
#

hmmm, who could enable it

#

i would guess md5

fickle mist
#

why do I get zero if I can’t get zero here (code below)

package dice.dice;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;


public final class Dice extends JavaPlugin implements Listener {
    public Dice() {
    }

    public static Dice plugin;
    static float dado;
    FileConfiguration config = this.getConfig();


    @Override
    public void onEnable() {
        plugin = this;
        this.getServer().getPluginManager().registerEvents(this, this);
        this.getConfig().getString("ran1");
        getCommand("dice").setTabCompleter(new ComCompleter());
        this.config.addDefault("ran1", "ag");
        this.config.addDefault("ran2", "op");
        this.config.addDefault("ran3", "ov");
        this.config.addDefault("ran4", "neg");
        this.config.addDefault("ran5", "sha");
        this.config.addDefault("ran6", "sluha");
        this.getConfig().options().copyDefaults();
        this.saveDefaultConfig();

    }

    String I = getConfig().getString("ran1");
    String II = getConfig().getString("ran2");
    String III = getConfig().getString("ran3");
    String IV = getConfig().getString("ran4");
    String V = getConfig().getString("ran5");
    String VI = getConfig().getString("ran6");

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }

    String dice;

public void main(String[] args) {
    dado = Math.round(Math.random() * 6);
    if (dado == 1) {
        dice = I;
    } else if (dado == 2) {
        dice = II;
    } else if (dado == 3) {
        dice = III;
    } else if (dado == 4) {
        dice = IV;
    } else if (dado == 5) {
        dice = V;
    } else if (dado == 6) {
        dice = VI;
    }
}
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (args[0].equalsIgnoreCase("1") && sender instanceof Player) {
            Player player = (Player)sender;
            String nome = player.getName();
            Bukkit.broadcastMessage("*" + nome + " get: " + dice);

        }

        if (args[0].equalsIgnoreCase("2") && sender instanceof Player) {
            Player player = (Player)sender;
            String nome = player.getName();
            Bukkit.broadcastMessage("*" + nome + " gets: " + dice + " " + dice);

            }

        if (args[0].equalsIgnoreCase("3") && sender instanceof Player) {
            Player player = (Player)sender;
            String nome = player.getName();
            Bukkit.broadcastMessage("*" + nome + " gets: " + dice + " " + dice + " " + dice);

            }

        return false;
    }

    public static void reloadConfiguration() {
        plugin.reloadConfig();
        plugin.saveDefaultConfig();
    }
}```
chrome beacon
#

That main method will never run in a plugin

remote swallow
#

that code is really bad and looks like its come from multiple classes

#

send the full class(es) on

#

?paste

undone axleBOT
young knoll
#

We should share your code here more often

#

:D

remote swallow
#

mine actually makes sense

young knoll
#
if (args[0].toLowerCase().equals("Hacking")) {
remote swallow
#

shut

#

it was like 7 and i hadnt slept

crimson terrace
#

F

fickle mist
remote swallow
fickle mist
fluid river
#

i found solution

#
if (args[0].toLowerCase().equals("HACKING".toLowerCase())) {}```
old cloud
#

I was gonna say how can „H“ ever be lower case 🙃