#help-development

1 messages ยท Page 629 of 1

vast ledge
#

.getRGB/(M

nimble oxide
vast ledge
#

You need to create the function getInstance();

young knoll
#

Or

#

?di

undone axleBOT
nimble oxide
pseudo hazel
#

i.e. pass a plugin instance along with the databseconnector constructor

vast ledge
#

Get outta here with ur dependency injection

pseudo hazel
#

lol

#

I mean in this it really doesnt matter

#

either make a static function or use di

nimble oxide
#

I just used static

#

too much work for di

echo basalt
#

bad help

#

bad advice

#

DI is good

#

quit being lazy

clear panther
#

guys i installed the NMS in my intejill but somehow ServerPlayer doesnt work

#

(i cant send ss dm for ss)

smoky anchor
#

?img instead

undone axleBOT
smoky anchor
sterile breach
#

Hello, using a concurrenthashmap can be better than a caffeine cache? (for cache storage)

clear panther
#

look at dm

echo basalt
#

ConcurrentHashMap is better used as a plain old hashmap in a concurrent environment

buoyant viper
#

ha, caffeine, Java

echo basalt
#

If you want it as a temporary cache with eviction, use caffeine

#

or because I'm lazy, guava

sterile breach
echo basalt
#

So.. a collection

buoyant viper
sterile breach
hazy parrot
onyx fjord
#

make ur own ๐Ÿ˜Ž its not that hard

clear panther
#

help my NMS seems not working

buoyant viper
onyx fjord
#

i dont trust this link

buoyant viper
#

that is the normal lightshot link

onyx fjord
#

theres a really similar domain with uncool stuff

#

a shocker website

buoyant viper
#

that ones pnrt

#

prnt is lightshot

river oracle
onyx fjord
#

i dont trust people with no embed rights

river oracle
#

Fr just verify

silent steeple
#

Wtf is โ€œThe Dupeโ€ ๐Ÿ˜ญ

onyx fjord
#

dude never heard of packages

buoyant viper
#

thats the image

sterile breach
#

how do I know if I should use a hashmap/competitor or a cache?

river oracle
silent steeple
#

Show the Pom.xml

buoyant viper
#

?paste it

undone axleBOT
smoky anchor
#

?conventions

chilly hearth
#

SNEEZE

onyx fjord
river oracle
onyx fjord
#

so it needs to be readable

river oracle
#

Idk I don't go digging through the files when using a library

#

I just use the docs

#

Unless I'm curious about implementation of a certain aspect

river oracle
onyx fjord
#

i like how commons are coded by apache

sterile breach
stiff knot
#

Hey does anyone know how I would go about clearing player crafting slots/item on cursor? Right now I can just use a simple inventory tweaks hack to get items I shouldn't have on my server

river oracle
onyx fjord
#

ze threads shall be safe

river oracle
#

I makw all my threads unsafe for fun

#

Nothing but unsafe threading

onyx fjord
#

just synchronize everything

#

easy fix

river oracle
#

public synchronized void ...

onyx fjord
#

๐Ÿ˜Ž

river oracle
#

Can't have errors if it's all synchronized

stiff knot
buoyant viper
#

cant wait for a season 2 if they ever make it for wonder egg

eternal oxide
#

depends you can still have race cionditions if you are not perfect with synchronise

onyx fjord
#

theres a propaganda making people not synchronize!

#

oh 50 times slower!!!

mellow pebble
#

Hi i was making UHC plugin and i got this error which is strange to me because i really do not have idea what is causing this problem so im just trying to ask you guys here if someone had this problem too or someone sees where is the problem ๐Ÿ˜…

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ZenithUHC: Fatal error compiling

river oracle
mellow pebble
onyx fjord
#

true computers these days are powerful so who cares

mellow pebble
#

and no signs of any errors in code

river oracle
#

Send your pom

#

?paste

undone axleBOT
mellow pebble
#

here you go

buoyant viper
#

1.8 sadgery

river oracle
silent steeple
#

๐Ÿ˜ญ

mellow pebble
#

gay.charon it is

#

was my domain before

mellow pebble
river oracle
#

To build

#

Are you using mvn package

umbral ridge
mellow pebble
onyx fjord
#

trol

umbral ridge
#

Ch4r0n.gay already exists

#

sike

#

xD

clear panther
#

๐Ÿ˜ฉ

silent steeple
clear panther
#

ok

mellow pebble
buoyant viper
mellow pebble
silent steeple
#

Do it

clear panther
onyx fjord
#

๐Ÿ˜Ž

clear panther
onyx fjord
#

what

smoky anchor
#

FUCK I super reacted again
I hate this feature

onyx fjord
#

cool what does it have to do with the screenshto

#

cool why seek help here

#

and why u delete messages

quiet ice
#

stop talking to yourself fam

mellow pebble
#

here is log

#

?paste

undone axleBOT
mellow pebble
silent steeple
#

Re run Maven using -X switch

#

Then paste

eternal oxide
#

paste teh full log

mellow pebble
undone axleBOT
mellow pebble
eternal oxide
#

yeah lombok farted. No idea why

buoyant viper
#

becos Lombok

tender shard
#

dont forget "mvn clean" afterwards

mortal hare
#

lightweight command api lol. I've started from this ^^ and now i have this and not yet even halfway there

mellow pebble
lilac dagger
#

i made one myself but it's smaller and only for the bukkit platform

mortal hare
#

this is for purpur

#

its coupled to the bukkit platform too

buoyant viper
mellow pebble
#

and it really seems lombok is the problem for some reason once i removed it it passed build normally without any errors

mortal hare
#

tbh constructing commands is pain in the ass but i'll be adding builder classes soon and factory classes to get the default Handlers

#

so that i wouldnt need to specify how its handled everytime when i want to design just a generic command from the core plugin

icy beacon
#

how would I split this string "19d" into "19", "d"?

#

i'm aware that String#split takes regex but i can't quite figure it out

echo basalt
#

you can use regex to parse that instead of String#split

icy beacon
#

ah i could

#

one sec

echo basalt
#

(\d+)([smhdw])

#

something like that

icy beacon
#

ty i'll see what i can do with this

#
fun String.timeToSeconds(locale: Locale): Long {
  val regex = Regex("([0-9]+)(${locale.years}|${locale.months}|${locale.days}|${locale.hours}|${locale.minutes}|${locale.seconds})")
  val matches = regex.findAll(this)
  var seconds = 0L
  for (match in matches) {
    val number = match.groupValues[1].toLong()
    val unit = match.groupValues[2]
    seconds += when (unit) {
      locale.years -> number * 31536000
      locale.months -> number * 2592000
      locale.days -> number * 86400
      locale.hours -> number * 3600
      locale.minutes -> number * 60
      locale.seconds -> number
      else -> 0
    }
  }
  return seconds
}

this works perfectly, can even optimize this by storing the regex for locales somewhere

echo basalt
#

precompile that pattern

icy beacon
#

yeah i think i'll put a timeRegex object in the Locale class

#

do you mean that?

echo basalt
#

yeh something like that

icy beacon
#

kk ty

#

wait is \d+ the same as [0-9]+

echo basalt
#

ye

icy beacon
#

alr

#
for (message in messages) {
  // :snip:
  locale::class.java.getDeclaredField(term).set(locale, definition.formatColor())
}

locale.timeRegex = Regex("(\\d+)(${locale.years}|${locale.months}|${locale.days}|${locale.hours}|${locale.minutes}|${locale.seconds})")

lgtm, hope it will work first try lol

stiff knot
#

does anyone have any ideas on how to prevent this exploit?

icy beacon
#

maybe clear the inventory fully when a player joins the lobby?

stiff knot
#

well yes, but there doesn't appear to be any way to clear the crafting slots/cursor item

icy beacon
icy beacon
#

i'm absolutely a 0 in packets though

#

unfortunately can't assist you with that

eternal oxide
#

teh crafting matrix is accessible via the player inventory

icy beacon
#

is it?

#

i thought it wasn't

eternal oxide
#

its just slot numbers

echo basalt
#

it is

#

slots 41-45

#

iirc

stiff knot
#

nope

#

i tried that already

#

it returns 1-4

icy beacon
#

somebody else wanted to set the crafting matrix items

#

but the slots weren't those unfortunately

eternal oxide
#

get teh Player inventory and set teh correct slots to air

#

if you want to clear everythign just loop over the inventory size

icy beacon
#

text wall

#

please use ?paste

ancient path
#

Oh sorry

#

?paste

undone axleBOT
ancient path
#

I donโ€™t know how to use that

eternal oxide
#

paste your code, click save, copy link to here

ancient path
#

Ohh ok

worthy moat
#

Hey I have a bungeecord server

#

How would I handle a ban?

ancient path
#

By banning them

icy beacon
#

ban the player from the main server

worthy moat
#

you mean ban the player in the main lobby?

icy beacon
#

yes

icy beacon
#

if you have multiple lobby instances, you can have a main main main server, to which you send all the players, and then distribute them to lobbies

#

and ban the player from that very main server

eternal oxide
#

sub servers should only be accessible via the lobby (so long as you properly secured your bungee install)

icy beacon
#

yep

worthy moat
ancient path
round finch
#

Data base ban list

icy beacon
#

a tutorial on creating a spigot plugin is easily found in youtube

ancient path
#

Ok Ty

icy beacon
#

but overall a tutorial on java is an expected prerequisite

#

if you don't know java it'll be very painful for you to code a plugin

#

it's like trying to read a german book but only knowing arabic

worthy moat
#

So in Bungeecord there is no way to ban someone? So I need to ban a player in the main lobby and kick him if he gets banned because he could be on another server instance and only if he goes back to the lobby he gets kicked

icy beacon
eternal oxide
#

unless you write/install a bungee ban plugin

icy beacon
#

that can also be done yeah

#

that's a more elegant approach

worthy moat
#

So the ban on the main server gets send from the proxy

icy beacon
#

i don't have experience with coding in bungee sadly

#

but i'd assume so

eternal oxide
#

if its a bungee ban plugin it woudl ban them from all

worthy moat
#

But there are multiple people which are telling me different options and many sound wierd...The first one is onJoin and looking if a player is banned and the other option is to ban him from the main lobby and the other option is to ban the player from every server

#

Which one is the right way for bungee?

eternal oxide
#

if you are doing a bungee ban plugin you don;t have to worry about any servers

woeful valve
eternal oxide
#

if you ban a player in a bungee plugin you log it so you remember it and can refuse their connection when they try to join again

#

you also disconnect them so they are kicked

ancient path
#

?paste

undone axleBOT
worthy moat
eternal oxide
#

?jd

worthy moat
#

?

eternal oxide
#

check teh players UUID in the PendingConnection

worthy moat
#

PendingConnection? You just the Login Event and then cancel it right?

eternal oxide
#

no

#

you are using bungee

#

so this is a Bungee plugin

#

in the LoginEvent I linked

#

check the PendingConnection to see if the Proxied Player UUID is banned

#

then cancel and setCancelReason

#

Events are from the API

#

for what reason?

#

you can cancel the events themselves

#

question is too vague to give an accurate answer

#

however

#

you can't "delay" a packet so you can do your async tasks.

#

Packets come in order and are processed in order

echo basalt
#

I mean it depends

#

All packets are received async yet some of them might need processing done in the main thread

#

Think of entity or block interaction packets

eternal oxide
#

Packets may not be received in tht order they are sent, but the actions the perform required an ordered sequence.

echo basalt
#

Because the block API is not thread safe

river oracle
#

Thanks Mojang smh smh smh everything should be thread safe ๐Ÿ˜ˆ

echo basalt
#

do it then

#

I've been thinking of making a packet-based block system where you can track blocks based off outgoing packets and have a snapshot of the player's world

eternal oxide
#

Thread safety after teh fact is a nightmare

#

yes

#

they don;t really care about the order of their packets

#

ie chat

chilly hearth
#

WTH

spare hazel
#

Does the client send its name when requesting the server MOTD?

dusty herald
#

I don't think so but I do believe I've seen some plug-ins save users IPs and generate custom motds based on them

#

So like user a joined with ip 123, oh look ip 123 is pinging us let's give them a different motd with user a in it or something

echo basalt
#

it sends its uuid iirc

#

uuid, client version

#

maybe even name

#

MOTD is just status 1

#

so actually no it doesn't send anything

vivid skiff
#

How can i check what slot was a item moved using the keyboard numbers in the player inventory using the InventoryClickEvent?

rose trail
#

Is RabbitMQ or Apache Kafka more suitable for exchanging free arenas between servers? Message plugins are not suitable, and I do not want to use sockets

chrome beacon
#

Redis uwu

mortal hare
#

is there any performance losses if i switched from arraydeque to arraylist?

lilac dagger
#

depends on the use case

mortal hare
#

they're both backed by array so i think they should be identical on the insertion

lilac dagger
#

arraydeque is optimised for adding on both sides

#

depends on your usage

mortal hare
#

i want to have list interface

rose trail
mortal hare
#

as an arguemnt

#

and deque doesnt allow that

#

since it doesnt implement list

lilac dagger
#

well yeah

#

list has get index and remove index

#

arraydeque is optimised for fifo filo

mortal hare
#

so i've decided to use ArrayList instead with .add() and .remove(list.size() - 1), for push() and pop()

chrome beacon
ivory sleet
#

Redis isnt actually good for messaging

chrome beacon
#

^^

ivory sleet
#

Its just that its an option

#

iirc kafka is good for micro apps

#

But it fails on a larger scale

mortal hare
#

just to support the interface which needs list as an arg

lilac dagger
rose trail
#

I'm just planning on doing an extension

ivory sleet
#

For instance rabbitmq clusters feature

#

Implementing that for urself raw socket wise is painful

lilac dagger
#

i'll see

mortal hare
#

there's also Stack which seems to implement list interface but idk if its an array based since it an old legacy class which should not be used naymore

lilac dagger
#

it's similar to bungee's from what i've seen

umbral ridge
#

Kafka isn't bad either or ActiveMQ or some prefer even Pulsar

ivory sleet
#

none said kafka is bad

#

But RabbitMQ is just really really good for enterprise and high scalability + availability

umbral ridge
#

The 3 I listed are all from Apache which is widely known and trusted ๐Ÿ˜„

#

All boils down to personal preference and needs of course!

lilac dagger
#

but it's definitely outdated

proper notch
#

holup did I just read kafka fails on a larger scale ๐Ÿ˜•. Kafka is amazing at scale - it was designed for it.

echo basalt
#

conclure what's your opinion on just using redis pubsub

#

my biggest complaint is that you can't send messages bigger than 32mb

proper notch
#

Kafka was designed from the ground up for scalability, availability with great failover capabilities and insanely big environments.

ivory sleet
#

You decompress and compress data

#

That decreases throughput

#

Kafka is known for being clumsy

mortal hare
#

it seems it works how i expected it to be after replacing deque

proper notch
#

I mean kafka overall doesn't have a throughput issue.

ivory sleet
#

Like its convenient

proper notch
#

Hell linkedin processes millions of messages per second.

lilac dagger
ivory sleet
#

Myea, well it sort of depends what exactly youโ€™re using kafka for

lilac dagger
#

tho it creates an object per element

ivory sleet
#

Its just that, rabbitmq, or activemq goes further

mortal hare
ivory sleet
#

I mean active is multi clustered

proper notch
#

Advanced kafka usage is... advanced and complicated - easy to mess up. RabbitMQ allows u to do a lot more stuff on-broker which some people like and definitely is better in some situations.

ivory sleet
#

So u sorta compromise some speed there but whatever

proper notch
#

My MC server was using rmq before but I moved it to kafka coz it made sense for what I was doing. The k8s operator for rmq was also annoying me (tbf the strimzi kafka one aint much better)

mortal hare
#

i prefer using ArrayDeque over LinkedList since linked list is really useful only if you have like bazillion insertions, but even in that case its not really worth it, since resizing arrays on modern machines seems as cheap as using linked list with high memory consumption and lots of cache misses

#

for like 8-9 insertions LinkedList is not worth it

ivory sleet
#

But it fails on a larger scale in regards to the flexibility u want in enterprise

proper notch
#

What kinda flexibility? Plenty of enterprises love it

ivory sleet
#

Like if you stream messages where messages are expected to be completely independent of each other including failure, and messages are not supposed to be altered myeah it does scale there

fluid river
#

free java lessons are back again

flint coyote
#

can you teach me kotlin?

fluid river
#

no, i only teach funny stuff

flint coyote
#

so no paper either? :(

fluid river
#

true

umbral ridge
#

$?

fluid river
#

in english?

flint coyote
#

"free"

fluid river
#

i guess like b1

flint coyote
#

xD

umbral ridge
#

free? yes

#

it's free?

#

thank you so much

fluid river
#

jree fava

flint coyote
#

nuker we have a verified voicechat where we can stream now

fluid river
#

fr?

#

oh shit truuuuue

#

finally Conclube

umbral ridge
#

teach me if-else statement

round finch
lilac dagger
#

if (statement) {
//do something
} else {
//do something else
}

fluid river
#
if (joeMomDead || joeDadDead) { leaveTheConversation(); } else if (joeGrannyDead) { startANewConversation(); } else { spamArguments(); }```
umbral ridge
#

XD

fluid river
#

ez

fluid river
umbral ridge
#

By the way, the best way to download my update jar file? I'm making an update class for my plugins. I've got an api endpoint and a link and if you access it, it starts to download the file, depends on the parameters. Any download async methods? Or what I should use?

fluid river
#

you just ask straight away

fluid river
#

idk what spigot might say about that tho

#

also why not just tell guys to update manually

round finch
#

If(JoeFamDiesInAfire){
Troll()
}Else{
FlintAndSteal();
}

fluid river
#

and restart the server

#

bro got flint'n'steel'd

umbral ridge
#

I could provide a download link in the console but.. I don't know

#

Is that a proper way?

fluid river
#

i mean yeah

#

just let guys download the new update

#

if they really need it

umbral ridge
#

I mean if you do it this way, it becomes optional which is kind of better I guess

fluid river
#

just send a link like 99% of plugins

umbral ridge
#

Yeah alright

fluid river
#

Essentials/LuckPerms and other plugins also just tell you that your current version is outdated

#

and toss a link

#

tho update-check can be disabled in config

umbral ridge
#

Yeah I've done that

fluid river
#

idk why but why not

#

i mean you can try coding that as personal project

chrome beacon
#

Spigot has an update folder that you should put your plugin in

fluid river
#

wha

chrome beacon
#

Though I don't recommend having an auto updater

lilac dagger
#

^

umbral ridge
#

Also a proper way to detect if server has an internet connection? Without try catch crap

lilac dagger
#

you just check a server

chrome beacon
#

I'd just try catch the connection

lilac dagger
#

and see if you get the statement or something like expected

fluid river
#

is there even a purpose to check that

lilac dagger
#

there's no Internet.hasConnection();

chrome beacon
#

Otherwise you'd end up like Samsungs Galaxy Store which doesn't work on Ethernet

#

Because they didn't think of it

umbral ridge
#

I'm actually making a minigame sort of that synchronizes with the db and need to periodically check if everything's ok. I'll write a wrapper for the connection I guess, I hate using try catch in main classes xD Unless if I create my own Exceptions

#

I generally love to handle everything so that there are no exceptions possible

#

So I kind of hate try catch

flint coyote
#

Well then just have an internet connection

#

๐Ÿ˜›

austere cove
fluid river
#

then why do you check for internet connection

austere cove
#

also iirc isValid(...) is not implemented on the SQLite driver included

fluid river
#

if you can just check if db conenction is alright

white root
#

Does <Player>.rayTraceBlocks() start the ray trace from the player's eye location? Or somewhere else?

inner mulch
#

how do i send pictures for reference in this channel?

lilac dagger
#

i can look for you

undone axleBOT
eternal oxide
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

chrome beacon
#

Also don't send text as an image

#

use pastebin

#

?paste

undone axleBOT
inner mulch
lilac dagger
#

@white root

#

yes

chrome beacon
inner mulch
chrome beacon
#

Probably passengers

white root
lilac dagger
inner mulch
lilac dagger
#

to find the method there

#

with ctrl shift

chrome beacon
lilac dagger
#

now it depends if you have used buildtools to get the spigot server dependency

inner mulch
#

i ve tried that once but the armor stands werent really following the player like a passenger

chrome beacon
#

?

inner mulch
#

the armor stand wasnt part of the player

#

even tho it shouldve been

chrome beacon
#

Sounds like you didn't add it as a passenger

quaint mantle
#

Hello, I am making a plugin that generates a world called "uhc", that coexists with the worlds "world", "world_nether" and "world_the_end". When entering the nether from the world "uhc" and leaving, you appear inside "world", but I want the players to appear inside "uhc". I have coded this, which works most of the times, but sometimes nether to overworld portals don't work, they don't teleport you anywhere. Am I doing smth wrong?

upper hazel
#

is it a great way to make a GOOD interface with good abstraction by creating a OWN interface for EACH method?

icy beacon
#

elaborate

remote swallow
quaint mantle
flint coyote
#

any other plugins that might mess with it?

#

Or a cancelled teleport event?

quaint mantle
#

the only plugins I'm using are worldedit and the one that has the code I sent, there's no event listener for any teleport events other than the PlayerPortalEvent

#

may a small world border have to do with my problem? I have tried getting really far inside the nether and creating a portal, but it tps me to a place inside the world border when it works

remote swallow
#

have you debugged it

quaint mantle
#

I'm doing that right now

dull goblet
#

Anyone know a good particle lib for 1.8-1.20 support

quaint mantle
# remote swallow have you debugged it

I have the exact world, with the exact portal where the issue happened while playing with some friends
now that I'm alone, with the worldborder set to the same size, I have gone to that portal in the nether and when I enter it, it generates one inside the overworld, which didn't happen when I was playing with my friends, they couldn't tp to the overworld

#

someone gotta explain to me why on a player death event i can get an entity but not player

echo basalt
#

it extends EntityDeathEvent

#

it returns the player anyways so

quaint mantle
#

huh

#

okay

rare sedge
#

This helped a lot

lean bone
#

Hey there! I am having issues moving the new display entites (the item display in particular) smoothly. I previously used armorstands and just teleported them, but that doesn't seem to work. I've also tried having the movement be on the matrix and having interpolation set up, but this does not seem to help. I've tested sending every tick (20/s) or every other tick (10/s) and have tried setting the interpolation duration to any value from 0-4 for both of these, but nothing seems to work. The weird thing is that I have no issues with rotation whatsoever, rotation is how I expect it to be when I update every tick with an interpolation duration of 2. How can I solve this?

#
        val display = sender.world.spawnEntity(sender.location, EntityType.ITEM_DISPLAY) as ItemDisplay
        display.itemStack = ItemFactory(Material.DIAMOND_HOE).setCustomModelData(6).build()
        display.itemDisplayTransform = ItemDisplay.ItemDisplayTransform.HEAD

        var tick = 0
        Bukkit.getScheduler().runTaskTimer(BandiCore.instance, Runnable {
            tick++

            if(tick < 100) {
                display.interpolationDelay = -1
                display.interpolationDuration = 2

                val matrix = Matrix4f().translation(0.0f, tick.toFloat() / 20f, 0.0f)
                display.setTransformationMatrix(matrix)
            }
        }, 0, 1)

Here is some example code of how I have done this (this is purely for testing so please ignore me not stopping the timer)

eternal oxide
#

is this supposed to follow something?

lean bone
#

Later this will follow a precalculated track

#

However right now I am just moving it up in a straight line

umbral ridge
#

How do you enable editor scroll zoom in Intellij IDEA?

#

(Ctrl + wheel up) is zoom in
(Ctrl + wheel down) is zoom out

icy beacon
umbral ridge
#

I just switched from Eclipse to it, after around 5 years lol

icy beacon
umbral ridge
#

Yeah just saw it

#

thanks

icy beacon
#

np

umbral ridge
#

awesome

umbral ridge
hazy parrot
#

shaded is with all dependencies

#

and original is just your code compiled

umbral ridge
#

Ohhh

shadow night
#

Just take the normal one

umbral ridge
#

Yeah I am just figuring this out because its all new

#

it's kinda nice though

#

better than eclipse for sure

#

imo

eternal oxide
#

all those jars are from maven.

umbral ridge
#

what's the pom.xml for?

#

never heard of it in eclipse

hazy parrot
#

its maven build configuration

#

its not ide specific, maven is build tool

#

you can use it in eclipse too

umbral ridge
#

should I ever touch it?

hazy parrot
#

sure lol

chrome beacon
#

When you want to change/update dependencies

hazy parrot
#

or edit overall build config

chrome beacon
#

or when you want to change how your plugin is built in other ways ^^

umbral ridge
#

ok so I've added vault I dont remember how but as a JAR. i haven't messed around with pom.xml. That's ok too?

#

But it works

chrome beacon
#

It won't compile

eternal oxide
#

no

umbral ridge
#

How do you add it normally

eternal oxide
#

in the pom

umbral ridge
#

How do I know the namespace and stuff

#

what to add and type

#

for eg. vault

eternal oxide
#

read the vault-api documentation

lilac dagger
#

usually the resource /plugin has documentation for it

umbral ridge
#

Oh ok

fast merlin
#

bump

umbral ridge
#

I love intellij

chrome beacon
umbral ridge
#

Is this how the folder structure should look like though?
I am not a fan of main and java things

#

and resources

mortal hare
#

src/main/java is the default location for gradle and maven projects to detect classes

#

you can change it

#

but in general no one does it

#

since it logical enough

umbral ridge
# mortal hare yes

In eclipse I used to do
main plugin class was located in .Main package
all events classes were located in .Events package
etc..

eternal oxide
#

package names all lower case

umbral ridge
#

I wanna play around with it how would I change it?

eternal oxide
#

you can remove main and java if you choose

#

it will build fine, you just have to specify your src folder for resources in your pom

umbral ridge
#

Got it, thanks

#

Also a shortcut to import all missing imports?

#

If you know

#

In Eclipse it used to be Ctrl+Shift+O

worldly ingot
#

I don't recall IJ having anything similar. I know you can import specific ones with Alt + Enter or something

#

I remember being frustrated trying to just import everything necessary and not being able to -,-

delicate lynx
#

there can be multiple imports for something however, so it's best to just check

unborn sable
umbral ridge
pseudo hazel
#

just use auto-import

#

easy fix

umbral ridge
#

plugin?

pseudo hazel
#

no

#

just a setting I think

umbral ridge
#

naaaaaah i'll leave it as it is

#

Also is there a way to show file extensions? I'm kind of used to it xD

lilac dagger
#

Do you guys miss the java.util.List; from the import class context in intellij?

#

It auto imports the java.awt one

#

Like why?

chrome beacon
#

I don't have that problem

pseudo hazel
#

I mean its all gonna be .java anyways

lilac dagger
#

I'll do a fresh install of windows + apps since i haven't done it in a long while

hybrid spoke
#

since then awt has a * import

#

then you can just go to list, ctrl+space and reimport the right one

icy beacon
mortal hare
#

is it just me or when I write my code in java the more i look at the solution, the more i hate it?

#

its not bad code, but its that feeling this should be better, that could be probably minimized etc

umbral ridge
mild sage
#

getting text form an anvil

umbral ridge
#

So that it doesn't piss me off further on, and I recently started adding all possible methods annotations and function header comments.. The code is so much better and readable

#

Helps, if you abandon the project and decide in a few months/years to return to it

#

You'll know exactly what you were doing and what is where

hybrid spoke
#

yeah well nah

#

i already puke when i look at code from 2 weeks ago

mortal hare
#

its fine as long as the codebase is not big

hybrid spoke
#

not because its not clean coded

pseudo hazel
#

depends on what you mean by minimized, but yes I feel like that too

mortal hare
#

when you write like 20 classes

#

for one module

pseudo hazel
#

oh yeah

#

for sure

mortal hare
#

the imposter syndrome kicks in

#

for me at least

pseudo hazel
#

that means the OOP has taken over your brain autopilot

umbral ridge
#

lol

#

I also can't resist OOP

mortal hare
#

i mean i've nearly finished my command api, that i've done in like 24 hours, it works fine, it has automatic tab completion, custom permission, execution, usage handlers, yet it feels like i've done some kind of shitty code

umbral ridge
#

Thats normal. To complete an entire project in 1 day feels akward..worthless.. in the first place

#

I am happy when I complete long-term projects that took me a few weeks

#

If it's like a few days project.. then it's whatever

mortal hare
#

is there any painless way to do integration/unit tests in spigot?

#

the thing is i have some OBC code so i cant just use mockbukkit

lilac dagger
#

I don't know ^

#

But i wanna know

hybrid spoke
#

everything that doesnt need visuals can be tested

pseudo hazel
#

just write code that works ๐Ÿคท

lilac dagger
#

To be honest i don't make that many mistakes anymore

hybrid spoke
#

just dont test your code

#

make your project open source

#

and wait for issues

lilac dagger
#

I feel like testing code id such a tedious process

#

I bet there are ways that you forget to account for to still face bugs

hybrid spoke
#

we had that with pathetic

#

we thought of everything

#

but thats the issue

#

since you maintain a big ass project you cant think of everything

#

changing stuff in this module could break stuff in that module

#

even tests could pass but bugs will still appear

#

and those who will run into the bugs are the ones using it

#

since they are the closest

lilac dagger
#

Yeah

#

I thought so

nimble oxide
#

Whats the problem here?

[20:56:56 ERROR]: Error occurred while enabling HytteMiner v1.0 (Is it up to date?)
java.lang.NullPointerException: null
        at com.marqus.hytteminer.DatabaseManager.DatabaseConnector.<init>(DatabaseConnector.java:12) ~[?:?]
        at com.marqus.hytteminer.HytteMiner.onEnable(HytteMiner.java:23) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:203) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched_1.8.8.jar:git-PaperSpigot-445]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
[20:56:56 INFO]: [HytteMiner] Disabling HytteMiner v1.0
[20:56:56 ERROR]: Error occurred while disabling HytteMiner v1.0 (Is it up to date?)
java.lang.NullPointerException: null
        at com.marqus.hytteminer.HytteMiner.onDisable(HytteMiner.java:59) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:323) ~[patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:360) [patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:336) [patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched_1.8.8.jar:git-PaperSpigot-445]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:203) [patched_1.8.8.jar:git-PaperSpigot-445]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched_1.8.8.jar:git-PaperSpigot-445]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]

Connector class: https://paste.learnspigot.com/ucuqimijej.java
Main class: https://paste.learnspigot.com/vuzopufoye.java

LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.

LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.

chilly hearth
austere cove
#

you're loading your connector class before you set your static instance. Such traps can be avoided by properly using dependency injection

chilly hearth
#

Wait why th

#

I send 1 and it got sended twice

#

Btw

#

My intellj not opening

proper notch
echo basalt
#

I generally just do this

#

So you can do registerPlaceholder("name", Player::getName);

#

and it'll be %whatever_name%

umbral ridge
#

?json

vast ledge
#

its

#

?paste

undone axleBOT
umbral ridge
#

does anyone got a util or a guide on how to handle json config files?

echo basalt
#

just use gson

umbral ridge
#

honestly I don't know much about it for java

echo basalt
#

So gson is basically magic

umbral ridge
#

got a link I can look at? or any info

echo basalt
umbral ridge
#

Thanks

vast ledge
#

heres my magic

umbral ridge
#

are those deprecation warnings

#

xD

vast ledge
#

No NullPointers xD

echo basalt
#

nah just static

umbral ridge
#

Oh ok but I'll do it myself. It wouldn't be a challenge if I didn't ๐Ÿค“

#

Any downsides to json? compared to yaml

vast ledge
#

Not as readable

echo basalt
#

less user friendly yeah

#

annoying formatting issues

#

yml is much nicer in the eyes

umbral ridge
#

I'll use it to store user data that isnt expected to be edited by hand

echo basalt
#

uhh

umbral ridge
#

and at the same time i want performance ig

#

yml can get slow

echo basalt
#

you want a database for that

vast ledge
#

if its cross server

echo basalt
#

not a shitty adaptation of a config server

echo basalt
vast ledge
#

but if he doesnt want a database

#

id go with JSON or binary

umbral ridge
#

No i dont want a db

echo basalt
#

you could use sqlite and with some minor changes support mysql too :p

#

or just go binary instead

umbral ridge
#

wouldn't reading&writing to binary take longer than just pure json files

echo basalt
#

depends on how it's set up

#

but no that's not how it works

#

json files are just binary encoded in a standard format

#

Sure if you know exactly what lines to write maybe it's faster

umbral ridge
#

I'm generally looking for a faster solution compared to yaml, and it doesnt have to be user friendly

echo basalt
#

Then yeah go binary

umbral ridge
#

How am i supposed to handle reading and writing to it

echo basalt
#

Just use guava's ByteArrayDataInput / ByteArrayDataOutput

umbral ridge
#

colors support, etc..

echo basalt
#

there's no need for colors

#

it's binary no one cares

vast ledge
#

Im just using JSON because i cant be bothered to have binary, and somebody should be able to edit it just in case

umbral ridge
#

Yeah I'll go with json/gson what imillusion sent me

echo basalt
#

gson sure

#

it's easy

umbral ridge
#

yml files for configuring, json for storing data

chilly hearth
#

A

#

?learnjava!

undone axleBOT
echo basalt
#

ayy you asking for yourself

#

finally some initiative

chilly hearth
#

Bruh

#

No

#

I jeas just getting confused on smth in the for and catch statement

#

Just reviewing that

#

Otherwise I told you iam the next Google CEO : )

echo basalt
#

cringe

chilly hearth
#

xD

mossy dock
#

is there a way to send through plugin messaging a command that the proxy should execute?

eternal oxide
#

you don't need PMC to execute commands on the proxy

umbral ridge
#

Any way to disable usages thing above every function/constructor

#

in intellij

mossy dock
eternal oxide
#

it has its own command interpreter

fluid river
#

you can just code ban command for bungee

fluid river
#

which builds a pen*s below banned player

#

shoots him to the sky and then laucnhes a firework when he reaches 255

mossy dock
mossy dock
echo basalt
#

Well

tacit drift
#

create some sort of bridge

mossy dock
echo basalt
#

With some clever engineering you can

mossy dock
echo basalt
#

making a plugin on bungee

#

that receives messages

fluid river
tacit drift
#

exactly

tacit drift
fluid river
#

so every server knows he is banned

#

also yeah you can send things to the bungee with a plugin channel

#

just send a message with like banhammer:execute channel

#

or smth similar

#

or just send player name

tacit drift
#

Also you can just create the pen*s thru packets :)))

fluid river
#

and when proxy receives the name it just bans the player

mossy dock
#

okay thanks!

tacit drift
#

so you would just have a bungee plugin

#

no need for a spigot plugin

mossy dock
#

okay

fluid river
#

penis ban hammer demo

#

in verified

next zinc
#

Where does #getLocation actually start on a player?

#

Is it their feet or their torso?

fluid river
#

feet

umbral ridge
#

feet

next zinc
#

Sick ty

fluid river
#

@umbral ridge

umbral ridge
#

xD

fluid river
#

come to vc

#

verified vc i mean

umbral ridge
#

loll

#

good job on the effort you put into it

#

especially the slow arrow one lol

outer river
#

hello, do someone know how can i delete itemflags and unspecifics meta from an item pls ?

clear panther
#

hello guys what is duplicate entry: net/minecraft/core/particles/Particle.class

fluid river
#

100% sure

outer river
fluid river
#

wdym

outer river
#

oh wait

#

i didnt tried this exactly

outer river
#

thx a lot bro

fluid river
#

jree fava lessons

clear panther
#

๐Ÿ˜ฉ

round finch
#

susge @clear panther

#

Sus

clear panther
#

wdym by sus

#

who you

fluid river
#

suuus

#

Alpacus

#

ding-ding-ding-ding

#

ding-ding-dign

#

tu-du-dung

round finch
#

Alpacsus

high pewter
#

How should I go about having my plugin ignore an existing config while testing? I'm currently developing a config, and don't want to code it to always over-write in-case I forget to undo it, but also don't like having to delete the config file manually every time. Is there a built-in way to handle this?

eternal oxide
#

no

#

deleting the file is not difficult

worldly ingot
#

At least that's what it's called in Eclipse and most other IDEs

high pewter
# eternal oxide deleting the file is not difficult

I mean no, but neither is starting up the server but people (including me) have came up with all sorts of different ways to have the server automatically start when we build the plugin lol
It's just tedious to have to do it every time you want to test a minor change to your plugin

eternal oxide
#

Not me

#

I stop start every time

high pewter
#

Bruh

eternal oxide
#

I do have my server copy a fresh set of plugins on startup.

high pewter
#

I do not envy your testing method lmao

eternal oxide
#

Write better code and you need less testing ๐Ÿ˜‰

high pewter
#

Do more testing and you can write better code

eternal oxide
#

well true I guess

umbral ridge
mellow pebble
#

?paste

undone axleBOT
mellow pebble
#

must be silly to ask but i cant figure out where i messed up basically i have setspawn command and i register it in function registerCommands which is called in onEnable and i still get error that Setspawn was not found

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

eternal oxide
#

case

mellow pebble
eternal oxide
#

oh class not found

mellow pebble
#

yup

#

but class is there it exists and no errors are shown

eternal oxide
#

open your jar with any compression utils and see if the class is there

fresh pagoda
#

Hi there

#

I'm learning spigot and I have an event problem

#

I'll send it

    @EventHandler
    public void onPlayerWroteOnBookEvent(PlayerEditBookEvent bookEvent) {

        BookMeta newBookMeta = bookEvent.getNewBookMeta();
        newBookMeta.setPage(1, "FUCK YEAH");
        bookEvent.setNewBookMeta(newBookMeta);
      
    }
mellow pebble
fresh pagoda
#

So, the problem is that for some reason it only changes the page 1 when i write stuff in a new page or when I swap the book slot

eternal oxide
#

I can;t help with kotlin

mellow pebble
#

but good call with opening jar cuz i would never see this literally

fresh pagoda
#

It changed only server side

brisk estuary
#

My pom.xml is apparently correct

#
<dependency>
            <groupId>org.geysermc.geyser</groupId>
            <artifactId>api</artifactId>
            <version>2.1.2-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
#
<repository>
            <id>opencollab-snapshot</id>
            <url>https://repo.opencollab.dev/main/</url>
        </repository>
pale hazel
#

Is making plugins a good way to learn programming?

brisk estuary
#

sure

fresh pagoda
eternal oxide
brisk estuary
#

Could I make a check and use the API only if it's present in the server?

#

or will it always throw that error?

eternal oxide
#

yes you can check

#

add a method that returns a bool isGeyzerMC

#

in that Class.forname(... and check for a valid GeyzerMC class

#

if its found return true, false on error

brisk estuary
#

ok, thanks

#

what about ```java
if (getServer().getPluginManager().isPluginEnabled("GeyserMC")) {
geyserApi = GeyserApi.api();
}

eternal oxide
#

yes

#

if thats the plugin name

#

you will need to add GeyzerMC to your plugin yml in softdepend

rare rover
#

what's y'alls thoughts on CompletableFuture?

#

some people tell me not to use them

#

ever

#

but i disagree

#

i kinda like them

echo basalt
#

there'll come a point in your time making plugins where you'll start to dabble in concurrent environments and they'll be great

#

because honestly who wants to deal with using runTaskAsynchronously for database IO

#

They're nice but you need to know how to use them

#

You'll also need to know how to work in a concurrent environment so you don't have weird issues because things will not work in order

#

But the end result will end up looking sleek

tender shard
#

there's always the same discussion on whether a future makes sense if all you do inside is to supplyAsync(). Imho it makes little sense.

someone who'd want to run this async could just create a future themselves with that method

Imho a future only makes sense if you do more than simply calling supplyAsync. If someone wants that done async, they could just wrap it into a future themselves

#

if however ofc you offer both variants, e.g. public X getX() and public CompletableFuture<X> getXAsync(), that's fine

storm granite
#

Does anyone know how I can set an extremely large portion of blocks to be different in the most optimised way? something about batches I really donโ€™t know? thanks

tender shard
#

it just makes little sense to wrap EVERYTHING into a future, e.g.
public CompletableFuture<Void> touchFile(String name) < - that's pointless

storm granite
#

I say extremely large, litterally any number

compact haven
#

Not necessary Alex

rare rover
compact haven
#

Sometimes itโ€™s good to complete a Void future when thereโ€™s even the slightest chance you need to depend on the action being completed

rare rover
compact haven
#

otherwise you need to guess โ€œit might be done after 70 ticksโ€ and hope it didnโ€™t errror

echo basalt
#

Anything that does IO deserves a future

compact haven
#

CompletableFuture everything in an api if it has the chance to be async, please

echo basalt
#

otherwise api misuse can end up in some severe freezes and people will blame you for it

#

wrapping a basic Map#get in a future is stupid

rare rover
#

That's what I do in my ConfigLib, somethings that's in ConfigInstance are async with some methods having synchronized since I dont want people who dont know what their doing have issues

#

Try to minimize the stress

echo basalt
#

I generally reserve futures for database stuff

#

And config write operations

storm granite
#

or is it just not possible to update blocks in batches?

echo basalt
#

Because starting the plugin and then shutting it down immediately due to an invalid config can get pretty tedious

rare rover
#

If I want like a async method that's delayed I'll use BukkitRunnable else I'd usally use CompletableFuture

shy finch
#

I tend to cheat and use a TaskChain lib... so if I need a sync callback I can do that easily without gross nested BukkitRunnable stuff

echo basalt
#

yeah but what if you're writing a public API

rare rover
#

Ig, it's harder to understand

#

But I have async and sync methods so if people dont know what their doing can just use the sync methods

echo basalt
#

For example on my Skyblock core (v2) I'm using futures for most non-instant tasks, like pasting an island, as well as anything that requires communication between multiple instances, like claiming ownership of an island

rare rover
#

And ConfigLib is available to the public

rare rover
echo basalt
#

Well

#

CFs use a thread pool

eternal oxide
#

you can have both sync and async methods. Just have the sync methods call .get on teh Future

echo basalt
#

So threads are kinda paused

rare rover
#

Oh

eternal oxide
#

yes

echo basalt
#

I strongly advise against joining futures

chilly hearth
#

@worldly ingot when payoneer payment method coming ?

rare rover
#
  • that'll have some performance issues
eternal oxide
#

get makes the method calling the Future wait for the return

rare rover
#

Since it has to wait for the thread to complete

worldly ingot
#

wtf is payoneer?

echo basalt
#

and there's no point in pausing a thread, spinning up a new one just do do a basic task

rare rover
#

Ong

echo basalt
#

It's like telling your friend to do XYZ and then waiting for them

chilly hearth
echo basalt
#

instead of just doing it yourself

rare rover
#

Yeah

#

Ofc

echo basalt
#

and not doing anything else until they're done

chilly hearth
#

Also my country doesn't have PayPal ;-;

echo basalt
#

sounds like a you problem

rare rover
#

I'm pretty cautious with using CompletableFutures anyways

chilly hearth
#

Fr

#

๐Ÿ˜ฆ

rare rover
#

I only use it for things that will probably be done once or not so often

echo basalt
#

I'd still recommend adding all those futures to some kind of collection so you can join them all onDisable

rare rover
#

Yeahh I've never done that before

#

I could do that

echo basalt
#

Just to be sure because the server might die while some futures are unfinished

rare rover
#

Ye

#

But I made sure everything is thead-safe that is getting accessed through async

#

Everything else is just normal

echo basalt
#

I like to just be lazy and slap a ConcurrentHashMap everywhere

eternal oxide
#

ConcurrentSkipListMap is love

ivory sleet
#

its like super slow but yeah

#

reasonable for an ordered map

rare rover
#

Everything is somewhat neat tho

    public synchronized static ConfigFile<?> createConfig(@NotNull ConfigFile<?> configFile, @NotNull List<CachedConfigField<?>> cachedFields) { 
         if (!configFiles.containsKey(configFile.getFileName())) 
             configFiles.put(configFile.getFileName(), configFile); 
  
         if (configFile.getDefaultFile().exists()) { 
             Bukkit.getLogger().info("[ConfigLib] Config file " + configFile.getFileName() + " already exists, skipping creation"); 
             return configFile; 
         } 
  
          long amountOfTime = new Timer().start(() -> { 
             ConfigCreator.writeFile(configFile, cachedFields); 
             return null; 
         }).get(); 
  
         Bukkit.getLogger().info("[ConfigLib] Created config file " + configFile.getFileName() + " in " + amountOfTime + "ms"); 
         return configFile; 
     }```
#

I do gotta make a system so it checks all the paths and sees if theres one missing

#

Easy enough tho

grim hound
#

Want the code?

#

It's pretty simple: get the existing file, and the newest file (copy into a file that you'll delete at the end of the method). Get the newest lines, and write the existing file whenever two lines that are the exact same up untill the ":" symbol (as the rest is user configurable). After that just write the newest lines with the user configuration into the existing file and delete the newest file. Auto-update without any downsides

#

Why... chicken tender?

#

But I guess you've got some custom classes, so I don't really know if you need this system

tender shard
grim hound
quaint mantle
#

Completable Futures, more like JS promises.

nimble oxide
#
[01:23:52] [Server thread/ERROR]: Error occurred while enabling HytteMiner v1.0 (Is it up to date?)
java.lang.NullPointerException: null
    at com.marqus.hytteminer.HytteMiner.onEnable(HytteMiner.java:36) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched_1.8.8.jar:git-PaperSpigot-445]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [patched_1.8.8.jar:git-PaperSpigot-445]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched_1.8.8.jar:git-PaperSpigot-445]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched_1.8.8.jar:git-PaperSpigot-445]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched_1.8.8.jar:git-PaperSpigot-445]
    at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:203) [patched_1.8.8.jar:git-PaperSpigot-445]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched_1.8.8.jar:git-PaperSpigot-445]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]

Command https://paste.learnspigot.com/deleduroyu.typescript
Database https://paste.learnspigot.com/ihetiyosad.java
Main class https://paste.learnspigot.com/jirovitozo.java

LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.

LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.

LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.

#

whats the problem?

nimble oxide
#

its command

tender shard
#

you didnt dexlare your command in plugin.yml

nimble oxide
#

oh I didnt put it in yml

#

jeez

#

its just like that right?

tender shard
#

no

#

add a colon

#

hytteminer:

#
commands:
  hytteminer:
nimble oxide
#

Thx <3, I forgot it

#

long time since I used commands actually.

tender shard
#

np. ever thought of using a command framework?

#

can highly recommend ACF

#

it's made by aikar

nimble oxide
#

Uhmm, can you link?

tender shard
grim hound
tender shard
#

there's a ton of other command frameworks, but

  1. this one was made by aikar, one of the (former?) paper devs
  2. it's extremely flexible, no need for any stuff in plugin.yml
  3. but unfortunately the documentation is a bit bad and you gotta figure some things out yourself.... or ask here again
#

basically using ACF you can reduce your normal command code by like 90%

nimble oxide
sturdy heron
#

how do you set the tint on an item?

#

not leather armor

nimble oxide
grim hound
tender shard
#
public class ExampleCommand implements CommandExecutor {

    @Override
    public boolean onCommand(final CommandSender sender,
                             final Command command,
                             final String label,
                             final String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("Only players can use this command");
            return true;
        }
        if(args.length == 0) {
            sender.sendMessage("Please specify a player");
            return true;
        }

        final Player playerToSayHelloTo = Bukkit.getServer().getPlayer(args[0]);
        if(playerToSayHelloTo == null) {
            sender.sendMessage("Player not found");
            return true;
        }

        playerToSayHelloTo.sendMessage(sender.getName() + " says hello to you!");

        return true;
    }
}
grim hound
#

Otherwise it's a custom texture

sturdy heron
#

I don't think so, I just know its possible to set the tint on any item and use it in a resource pack

tender shard
#

in ACF it'd be like this:

sturdy heron
tender shard
#
@CommandAlias("example")
public class ExampleACFCommand extends BaseCommand {

    @Subcommand("hello")
    public void onHello(Player sender, OnlinePlayer playerToSayHelloTo) {
        playerToSayHelloTo.getPlayer().sendMessage(sender.getName() + " says hello to you!");
    }
}
#

oh actually the normal example would be more complicated, I forgot that the normal command also needs a subcommand "hello"

#

but yeah as you can see, with ACF you can reduce all the boilerplate code from commands like parameters being another player, subcommands, player-only commands, etc bla bla

grim hound
#

Man, just make your own custom command

tender shard
grim hound
sturdy heron
grim hound
#

Well you make a texture pack

#

And you can either change the whole item

#

Or just an item with CustomModelData

sturdy heron
#

well I know there's a way to do it without custom model data

grim hound
#

But you'll have search that one up, I haven't really used that, ever

sturdy heron
#

origin realms allows you to dye any item

#

I have the tint setup in the model i just need to figure how to modify the nbt or what method i need to use

young knoll
#

Use leather horse armor

#

And just change the color

grim hound
#

A client cannot use textures that he doesn't have

#

So the texture must be provided in some way, by using a texture pack is the easiest probably

sturdy heron
sturdy heron
#

never checked but yep

grim hound
quaint mantle
#

Server with RPs ๐Ÿ’€

grim hound
#

You can tint a non-leather item without a txt, and only using leather horse armour and some voodo magic?

sturdy heron
#

well I was mistaken, it only works on leather items but you can modify the model of it so it doesn't matter

young knoll
#

You have 50 million models to work with

#

Iโ€™m sure youโ€™ll be fine :p

elder leaf
#

how can i get rid of these LF squares

young knoll
#

Letโ€™s see the code

elder leaf
rare rover
#

What's the server platform that has no api? Like it's the bare minimum for an mc server you get to create your own api?

#

I keep forgetting it

#

I wanna try it out

young knoll
#

Minestom

elder leaf
#

and i have -Dfile.encoding=UTF-8 in jvm flags

rare rover
#

Ty

young knoll
elder leaf
#

makes sense lol

young knoll
#

If you want an empty line just use a space

#

โ€œ โ€œ

elder leaf
#

yea

tender shard
young knoll
#

They provide a full api

#

You just have to make all the features yourself