#help-development

1 messages · Page 496 of 1

wary topaz
#

if I say i'll think about it will you get off my back

tender shard
#

it violates the OOP idea if a command takes the main instance and then register itself through that

wary topaz
#

because as I can see the playercount is still -1

compact haven
#

no because one day you'll publish this horrendous code on github and I'll have a heart attack

wary topaz
#

this is private code for my private server

tender shard
#

why do you keep calling that twice

#

call it ONCE to get the channel, then call getInt() to get the count

wary topaz
#

how can I get the server?

tender shard
#

using readUTF()

wary topaz
#

so whats the order

tender shard
#

getUTF() for the server, then using getInt() for the count, I guess

wary topaz
#

ah so replace readUTF with get

echo basalt
#

pretty sure this is all documented

compact haven
#

it doesnt send the name of the server

tender shard
compact haven
#

you send the name, it responds with PlayerCount then the int

#

its pretty clearly written on the doc

wary topaz
#

oh

compact haven
#

sorry

#

it DOES send the name of the server

wary topaz
#

String server = in.readUTF(); // Name of server, as given in the arguments
int playercount = in.readInt();

tender shard
#
String server = in.readUTF(); // Name of server, as given in the arguments
int playercount = in.readInt();
compact haven
#

it DOES NOT send "PlayerCount"

wary topaz
#

clearly does send the player count

compact haven
#

sorry that I didn't put quotes around clearly the message type

wary topaz
#

so the channel ?

compact haven
#

😕 give me a minute here

wary topaz
#

if (subchannel.equals("PlayerCount")) { if (in.readUTF().equals("survival")) { serverSelector.survivalPlayerCount = in.readInt(); } }

tender shard
#

no

#

dude

wary topaz
#

so there isno channel?

compact haven
#

no he's actually right though

tender shard
#

bungeecord is the subchannel

compact haven
#

"BungeeCord" is the channel

tender shard
#

oh

compact haven
#

"PlayerCount" is the sub channel

tender shard
#

my bad

compact haven
#

its okay this is a mess

wary topaz
#

@Override public void onPluginMessageReceived(String channel, Player player, byte[] message) { if (!channel.equals("BungeeCord")) { return; } ByteArrayDataInput in = ByteStreams.newDataInput(message); String subchannel = in.readUTF(); if (subchannel.equals("SomeSubChannel")) { // Use the code sample in the 'Response' sections below to read // the data. } }

this is from the docs

compact haven
#

change it to this please

#
    @Override
    public void onPluginMessageReceived(String channel,Player player,byte[] message) {
        System.out.println(channel);
        if (! channel.equals("BungeeCord")) {
            return;
        }

        ByteArrayDataInput in = ByteStreams.newDataInput(message);
        String subchannel = in.readUTF();
        String server = in.readUTF();
        String count = in.readInt();
        System.out.println(subchannel);
        System.out.println(server);
        System.out.println(count);

        if (subchannel.equals("PlayerCount")) {
            if (server.equals("survival")) {
                serverSelector.survivalPlayerCount = count;

            }
        }
    }
#

because something is wrong here, but pretty sure the code is working

wary topaz
#

illsend you the result when it compiles

tender shard
compact haven
#

thank you

#

@wary topaz modified

tender shard
#

yes, better now

compact haven
#

forgot to change the actual things, only added debugs

#

ty alex

tender shard
#

np

compact haven
#

if u already ran its okay Ethan

tender shard
#

i fucking hate myself for using the "gson" field in the interface, but there's no better way D: why can't interfaces have private fields

compact haven
#

the debug prints would be the same

#

it just wont actually work

compact haven
#

I cant remember the exact reason but they aren't treated regularly

wary topaz
#

remember to check line30

compact haven
#

what in the world even is this for

#
        try {
            Bukkit.getScheduler().scheduleSyncRepeatingTask(this,() -> {
                ByteArrayDataOutput out = ByteStreams.newDataOutput();
                out.writeUTF("PlayerCount");
                out.writeUTF("survival");
            },20L,300L);
        } catch (Exception a) {
            Bukkit.getConsoleSender().sendMessage("Error with scheduler, (IS BUNGEE OFFLINE??)");
        }
#

that does literally nothing

#

like literally nothing

#

bungeecord messaging channel only works with a player

wary topaz
#

o lol

compact haven
#

a Player has to send it

#

because plugin messages are just sent as packets to the player's connection, which is intercepted by the proxy and never sent to the client

#

which is why at least 1 player has to be online to exchange info with the proxy, and also the channel messaging system's fatal flaw

#

that's why your code doesn't work btw

wary topaz
#

damn

#

Ihave an idea

compact haven
#

ngl I have no idea why u had any hopes for that to work

#

you just create a new stream

#

it doesnt' go anywhere

#

💀 like literally is eaten by the GC right after

wary topaz
#

whenever a player opensthe gui they willsend the request

compact haven
#

yes

#

that's how it's meant to be done

#

very revolutionary

#

while you're at it fix the constructor problem

flint carbon
#

guys is there an alternative for new MyPlugin()

compact haven
#

what

wary topaz
#

wtf

compact haven
#

how does an even worse thing come along

tender shard
compact haven
#

alex send ur blog

wary topaz
#

?di @flint carbon

undone axleBOT
flint carbon
#

sorry for quoting an older message but ur already online

tender shard
#

allow to send messages between spigot<>spigot and spigot<>bungee

wary topaz
#

without a player?

flint carbon
#

but i use dit to access the config

tender shard
tender shard
flint carbon
#

used it

wary topaz
#

alrill tr it

tender shard
#

I only know git and diff, but no dit

wary topaz
#

should I remove everything?

flint carbon
#

        val databaseConfig = plugin.config.getConfigurationSection("database")!!```
#

(this is kotlin)

tender shard
#

do not call MyPlugin()

flint carbon
#

instance?

tender shard
#

have you read my blog post?

#

which method did you choose? Static getter, or dependency injection?

flint carbon
#

reading it rigth now

tender shard
#

oki

wary topaz
#

alex do I have to upload a plugin tomy server?

compact haven
#

should just be something shaded as a lib

#

I doubt alex would make it an actual plugin

tender shard
#

or what are you talking about

compact haven
#

nvm

#

u need to add it

tender shard
#

but it requires both, a mysql and a redis connection

#

it wasn't meant for the public, I only wrote this like yesterday

compact haven
#

ja I never heard of PlayerDataAPI so was just guessing it was a library

tender shard
#

but sure, feel free to use it if it helps you

wary topaz
#

I have a mysql, my server runs on ubuntu

flint carbon
tender shard
#

wdym

compact haven
#

its meant to be made by the PluginClassLoader

tender shard
#

yes

compact haven
#

so you are never meant to call the constructor

tender shard
echo basalt
#

mm this is a very weird approach

tender shard
#

since you're using kotlin, you cannot even use a static getter without black magic called companion objects

echo basalt
#

and you're restricting yourself to mysql

tender shard
#

kotlin is a bit behind java, so in your case, just go for DI

regal scaffold
#

I'm using spark to debug

tender shard
#

does kotlin even support static init blocks?

regal scaffold
#

But some plugins aren't being displayed

wary topaz
#

where can I download the jar file alex?

regal scaffold
#

Says it didn't show up on the profile but it's literaelly working in the background

compact haven
#

tf does that q even mean lol

#
init {

}
#

though im curious, what does java have that kotlin lacks

tender shard
#

that is a normal init block

#

not a static one

tender shard
#

verbosity

compact haven
#
companion object {
  init {
    ...
  }
}
echo basalt
#

Yeah this is definitely not how I'd do stuff

tender shard
#

the redundancy of needing to shade kotlin-commons

#

or kotlinstd or whats it called

#

or stdlib

compact haven
#

an init inside of a companion object will function the exact same as a static init

tender shard
#

whatever its called

#

java also features the superiority of thinking that the type is more important than the name of something

flint carbon
#

companion object is the same as static inner class

#

or very similar

#
        private lateinit var instance: Plugin

        fun getInstance(): Plugin{
            return instance
        }
    }```
echo basalt
#

Alex I can see you having a bunch of problems in the future with the way you're running your impl

tender shard
echo basalt
#

For one you're hardcoding yourself into mysql

tender shard
#

wdym

#

where?

echo basalt
#

Everywhere

tender shard
#

example?

echo basalt
#

if you wanted to one day add support for mongo you'd be fucked

#

and would have to rewrite a bunch of stuff

tender shard
#

I despise mongodb very much

echo basalt
#

fuckin

#

Amazon S3

#

SeaweedFS

#

Postgres maybe

#

Firebase

#

whatever

flint carbon
#

people use firebase with minecraft?

echo basalt
#

Anything that's not straight up mysql

compact haven
#

does he not abstract data from the database impl?

tender shard
#

what even is Seaweed or firebase

echo basalt
#

seaweed is self-hosted s3

compact haven
#

SeaweedFS is a kewl file storage system

echo basalt
#

firebase is amazon's thing

flint carbon
#

firebase is google

echo basalt
#

oh eah

compact haven
echo basalt
#

firebase is google's

#

fuckin

#

Cassandra

tender shard
#

I never understood the advantages of nosql

echo basalt
#

whatever

tender shard
echo basalt
#

NoSQL doesn't stick to a table, you can insert whatever you want

compact haven
flint carbon
echo basalt
#

Mongo is basically json

tender shard
#

you guys gotta understand, I'm a fucking lawyer and not someone who studied IT stuff lol

echo basalt
#

but actually bson

flint carbon
#

is it like binary json or something

echo basalt
#

I have an IT degree and I'm still an idiot but people like options

#

I personally despise sql at work

#

because writing queries takes brain power

tender shard
echo basalt
#

and with mongo I can just insert it all in a Map<String, Object> and automatically serialize it

flint carbon
#

wait @tender shard why were you saying i needed an init

tender shard
#

I mean... relational stuff is good, sanitized stuff

tender shard
echo basalt
#

ANYWAYS

tender shard
#

I only said kotlin doesn't support it

compact haven
#

but it does

echo basalt
#

I'd probably make a packet system first

#

that just communicates with redis

tender shard
#

kotlin allows you to use weird companion objects to recreate something that, in the end, behaves similar to java's actual static features

echo basalt
#

or if you want to pull one from my books

tender shard
#

but it's not the same

echo basalt
#

abstract away the packet system so you can implement RabbitMQ in the future

flint carbon
#

does init exist in java?

echo basalt
#

or raw sockets depending on whoever

echo basalt
#

yes,that works

tender shard
#

but yeah have you ever seen someone saying "oh, I need a bit of data. thank god I am using RetardDB instead of mySQL?" because I haven't

flint carbon
#

i'm learning java as i create these minecraft plugins because i don't really know java 😆

echo basalt
flint carbon
#

since i'm used to kotlin

echo basalt
#

Half my customers ask for mongo

compact haven
#

alex stop making bad claims

echo basalt
#

as a second option

compact haven
#

you're killing me

tender shard
echo basalt
#

I've had a client DM me asking for S3 support

compact haven
#

their backend code is not for 1.8

tender shard
#

yeah it's even older

compact haven
#

they just support it

echo basalt
#

their backend is 1.7.10 ported to 1.8

tender shard
#

it's 1.7

compact haven
#

oh

flint carbon
compact haven
#

what the fuck

flint carbon
#

since anyone can start using it for free

tender shard
#

good luck

flint carbon
echo basalt
#

Their technical debt is too high to actually port shit

tender shard
flint carbon
echo basalt
#

mongo is basically remote json

#

sql is remote Table<C, R, V>

tender shard
#

"mongo" is a german insult word against disabled people, and the dude who invented it was german, soooo... very questionable name.

echo basalt
#

if that's legit your only argument

flint carbon
#

alex do you use kotlin?

tender shard
#

only when I have to contribute on projects that already use kotlin

#

I try to avoid kotlin

#

I don't like it for a few reasons

flint carbon
#

do you know if hashmaps are often used?

tender shard
flint carbon
#

for minecraft with kotlin*

tender shard
tender shard
#

so yes, very often

echo basalt
#

just make an interface and like 19 impls

flint carbon
#

so like

<Player,JSONObject>

echo basalt
#

ew using players as keys

tender shard
#

do not use Players as keys, they are throw-away objects

echo basalt
#

Because I'd honestly do your entire system different

#

keeping all the data on redis, automatically juggling it

#

pull data to an in-memory cache and register it to receive packets

wary topaz
tender shard
#

keeping everything on redis? all data is lost on restart

echo basalt
#

Redis and any instance the player might be on

#

With some autosaving to your backend database

#

Redis has less latency but it's also volatile

flint carbon
wary topaz
#

yes

#

UUID #1

echo basalt
#

And if you're using SSL it becomes single-threaded iirc

tender shard
regal scaffold
#

Hey

#

So

#

I have a very weird situation

wary topaz
#

whats your situation

echo basalt
#

idfk it's like 4am and I'm partly burnt out

#

a few hours

#

like 3

tender shard
#

10? 20? 3?

#

(roughly ofc 😄 )

echo basalt
#

yeah 3-4 hours ish

regal scaffold
#

I have a core system, which does a lot of stuff. And the core itself is actually barely taking resources in the timings report. But, I was able to point down that some features are causing network lag on the players, but 0 impact on the server

echo basalt
#

To rewrite this clunky system

tender shard
wary topaz
#

so whats the problom?

regal scaffold
#

Sometimes, players will straight up get disconnected, while the server is perfectly responsive. Yes, packets are used on the core a lot

echo basalt
#

euh

#

idk chief

tender shard
#

not enough?

regal scaffold
#

I'm trying to figure out how I can see exactly where the "dos" is coming from

echo basalt
#

that'd double my net worth but like

wary topaz
#

LMFAO

echo basalt
#

it isn't compelling enough

compact haven
#

lmfao

echo basalt
#

to actually pull your code

tender shard
#

it's not worth more than 50€ to me, so well, decide for yourself

wary topaz
#

iwill do control a + backspace for 50$

echo basalt
#

I'll do my best to copypaste existing code for 50€

wary topaz
echo basalt
#

you really like these flowers

wary topaz
#

yo google tryna hang out?

tender shard
compact haven
#

Alex if it ain’t broken don’t fix it

echo basalt
#

Let's see

tender shard
#

but I wanna see what a "better solution" would be

#

and if I could get a "propery solution" that's future proof and'd work with other storage systems too, why not

#

yeah anyway, I'll first of all put some nasty smoke into my breathing organs

echo basalt
#

I have something like this at work

#

gotta comment but can't bother

wary topaz
#

what is a java.io.EOFException

echo basalt
#

End of file

regal scaffold
#

Network performance issues

river oracle
echo basalt
#

It's a completablefuture but fancy

river oracle
#

how so

compact haven
#

can u paste that FancyFuture I’m curious how it’s Fancy

tender shard
echo basalt
#

it handles exceptions automatically, has a slightly better thread pool that doesn't crash when it runs out of threads

compact haven
#

I mean that’s called a database abstraction layer

echo basalt
#

which also handles this

#

and this

tender shard
echo basalt
#

Redis can store that automatically

river oracle
#

What is the purpose of redis? Is it used just for data transport between different parts of a network

echo basalt
#

Redis is data transport but also a central cache

compact haven
#

or for key value caching Y2K

tender shard
compact haven
#

I mean why would you store a player and not their UUID

river oracle
echo basalt
#

If you can convert it to a byte array

#

it can

tender shard
echo basalt
compact haven
#

like if you have any horizontally scaled system, you can cache on the app and at the network (redis)

echo basalt
#

if a player can pass through this

#

it'll work

tender shard
echo basalt
#

then just fuckin serialize it to nbt

#

and push the nbt through

#

Sure I can make a serializer thing

#

type adapter type deal

tender shard
#

Good luck in serializing a connection that uses internal IPs only that one spigot server hae access to

compact haven
#

I decided to make my iPhone naked a few days ago and I already have like 100 micro scratches on my screen lmfao

echo basalt
#

Your system can't handle it either ;)

compact haven
#

idk how people can do this

tender shard
echo basalt
#

Because we don't store a fucking bukkit player in redis, we just write whatever we need?

tender shard
#

idk earlier you sent a screenshot that implied you can just store any "object" and it'll just work

#

and you said "redis handles that automatically"

echo basalt
#

You'd never be in a use-case scenario where you'd need to store a bukkit player and read it on bungee

compact haven
#

typically objects don’t have weird shit in it like Spigot objects do

echo basalt
#

because bungee would have a seizure too

#

not just redis

compact haven
#

most POJOs don’t contain non-serializable data like a connected socket connection

tender shard
#

I wouldn't call a connection "weird shit" tbh

echo basalt
#

Just apply some common sense

tender shard
#

I mean, a player is required to have a connection

#

how else would it work

echo basalt
#

You can just write the player's data to nbt, write it out

#

read it back

compact haven
#

sure, but that’s obviously not data transferable

echo basalt
#

and you'll have basically everything

wise mesa
#

is there a way to check if the server is currently shutting down

echo basalt
#

onDisable gets called

wise mesa
#

okay nevermind then

tender shard
wise mesa
#

i want to skip my on enable method if the server.shutdown has already been called

#

just return at the beginning

tender shard
#

^

#

requires NMS, of course

wise mesa
#

ah

#

thanks

#

it'll probably just be easier to add a method to the other plugin that might shut down the server during enable to check if it did that

#

that didn't make sense but

tender shard
#

why the heck would a plugin shutdown a server o0

wise mesa
#

whatever

tender shard
#

only /stop is supposed to do that

wise mesa
#

too tired

tender shard
#

and SIGTERM etc

wise mesa
#

my plugin shuts down the server on startup if a certain condition isn't met

#

its just for my own personal usage

#

nothing public

#

but I'd like my other plugin to not go through the startup process

#

if the first one decided to shut it down

tender shard
#

then add an API method or sth

wise mesa
#

that's what I'm gonna do

echo basalt
#
try {
  new Thread(System::gc).run();
} catch (Exception ignored) {
  System.exit(0);
}
#

async garbage collector

wise mesa
#

lol

#

.run

tender shard
echo basalt
#

ehh

#

gotta love how you need reflections to access unsafe

wise mesa
#

could at least do .start() :p

tender shard
echo basalt
#

nah its genious

#

that way some fucking idiot faces an exception and quits

#

but if he knows what he's doing

#

he'll have access

west solar
flint carbon
#
        private var instance: MyPlugin = MyPlugin() // i think this line is causing the error?

        fun getInstance(): MyPlugin {
            return instance
        }
    }```

```[00:30:16] [Server thread/ERROR]: Could not load 'plugins\plugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Plugin already initialized!```

Anyone know how to avoid this
compact haven
#

yes stop initializing your plugin yourself

#

didnt we cover this already

#

MyPlugin is already created by the PluginClassLoader, which also loads the classes in your jar

flint carbon
#

i got it

compact haven
#

though I will admit Spigot & Kotlin is such a PITA to work with

#

and of course I've broken probably 180 design principles with that code

#

now I just DI everything w/ Java 😈

river oracle
#

val prefix = ChatColor.translateAlternateColorCodes('&', "&8[&e&lChaos&6&lRoulette&8]&7") the fact this is outside the class makes me go bonkers

compact haven
#

oh don't worry

#

not just you

#

i used kotlin there because I was lazy and needed to develop quickly

#

cursed solutions were just possible with kotlin

river oracle
#

went through a kotlin phase the right back to the good old java

compact haven
#

out of those 4

#

1 isnt mine (the fork)

#

and hte last 2 are incomplete

#

kinda funny

#

I finish like nothing

river oracle
#

same here

compact haven
#

but no, I actually develop with both. For example, I'm writing a website backend in Kotlin atm

#

though I wrote a plugin for someone not too long ago with Java

river oracle
rough ibex
#

About
No description, website, or topics provided.

#

Classic.

river oracle
#

yep

compact haven
#

lmfao I don't even write a readme, why would I populate the GH description

#

only nerds do that shit

river oracle
#

wrote out an entire readme

#

for myself

#

cuz who tf else in their right mind would use my code

compact haven
#

erm I actually wrote an entire readme for someone elses project

#

but not my own

#

@remote swallow do u still update betteritemconfig

remote swallow
#

sadly not

#

i havent touched it in like 2 motnhs

#

i had to update it for one of my plugins but i didnt commit it

river oracle
#

oh though wait nvm I have to fix something with that library first

#

I just get sucked into a billion projects

#

I have a problem

#

I said I'll focus on one project at a time and it got me to this

#

4 projects

rough ibex
#

rookie numbers

river oracle
#

5 large tasks in 2 projects

#

that I've yet to split apart

rough ibex
#

I have 36 projects

river oracle
#

and this is just the stuff I've put in my damn app

rough ibex
#

80% never will see the light of day

remote swallow
regal scaffold
#

If I want to get the index 0 I just do packet.getWatchableCollectionModifier().read(0);

#

But doing packet.getWatchableCollectionModifier().read(21); says out of bounds even tho that's the index for the glow color

river oracle
#

But I gotta fix a bug

remote swallow
regal scaffold
#

Ebic halp

remote swallow
#

wat

remote swallow
#

packets are above my level

tender shard
#

UnfriendlyHateBuffer

regal scaffold
#

The index in website says 21

#

But now that I look at it

#

It might be only for the new display entities

wet breach
#

well just keep in mind that while although some packets have an index

#

it doesn't always mean they have to be present

regal scaffold
#

Fair

wet breach
#

so always worth checking if its an optional data

regal scaffold
#

For older versions?

#

Why would index 20

#

Return that

#

What am I even accessing lmao

wet breach
#

yes there you can see previous protocol versions

#

what version you need?

regal scaffold
#

1.17.1

#

Ok but hold on

#

It seems like the glow color

#

Has to do with the scoreboard team

wet breach
#

thats for 1.17.1

regal scaffold
#

Thank you

wet breach
#

link if you ever need other versions

regal scaffold
#

Uhhh

#

I can't even find the glow

wet breach
#

its probably in the metadata

regal scaffold
#

Ah yes

#

There it is

wet breach
#

metadata is an optional thing btw that can be set later

#

so you can end up getting a metadata packet that has nothing in it

regal scaffold
#

Yeah I have checks for it

#

But I am slightly confused here

wet breach
#

also keep in mind, that if you are using protocolLib

#

wiki.vg and protocollib will at times not line up

#

because protocollib will change the structure to make it easier sometimes

regal scaffold
#

Oh

#

Ok that makes sense

#

It's a bit hard this

#

So far I've been able to make a specific player glow for another specific player only

#

But the color thing is turning out to be weird

wet breach
#

lol

eternal oxide
#

you just want one player to see another player glow? do they need to see eachother?

regal scaffold
#

Nono I done that part perfectly

#

Just the color setting of the glow

#

I think I need to do the scoreboard part by packets too

wet breach
eternal oxide
#

why? it's all in the API

regal scaffold
#

?

#

wut?

#

Scoreboard stuff?

wet breach
#

yes

regal scaffold
#

But it's not working using scoreboard

eternal oxide
#

one sec

wet breach
#

but also I believe setting glow too

regal scaffold
#

Still white

#

Not only for specific players

#

Glow applies to everyone

#

I need just given player to see the glow

eternal oxide
#

glow applies to who is set to be able to see it

regal scaffold
#

Wait really? I don't even need packets?

#

lmao

wet breach
#

Well, doesn't hurt that have learned to mess with packets

#

may come in handy in the future 😛

eternal oxide
#

?paste

undone axleBOT
regal scaffold
#

I think you're wrong about the glow

#

Pretty sure players glow for everyone

wet breach
#

well, lets see what ElgarL comes up for you

regal scaffold
#

Which is why the Player#setGlowing() goes on the player

wet breach
#

they are pretty good 🙂

regal scaffold
#

I am curious

#

He is pretty good

#

?jd-s

undone axleBOT
eternal oxide
#

example

#

use as you like

regal scaffold
#

But but but

#

Hold on

eternal oxide
#

This adds all Mobs to a group which glows a changing colour

regal scaffold
#

Yes but

#

All players can see the mobs glow

#

I only want X player to see the mobs glow

#

It's the huge difference

eternal oxide
#

you cna set options on the Team

#

one sec and I'll test it

#

testing

regal scaffold
#

Same here

sharp kayak
#

Cant connect the player to another bungee server using p.sendPluginMessage(plugin, "bungeecord:main", b.toByteArray());, no error messages.

#
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);

try {

    out.writeUTF("Connect");
    out.writeUTF(server);

    p.sendPluginMessage(plugin, "bungeecord:main", b.toByteArray());

    out.close();
    b.close();

} catch (IOException e) {

    plugin.getLogger().info(e.getMessage());

}
eternal oxide
regal scaffold
#

I can't even get that to work

#

It's so weird

eternal oxide
#

so in thoery you could enable the glow using packets

eternal oxide
#

but color using Teams

sharp kayak
#

coz the "BungeeCord" just goes straight to error

eternal oxide
regal scaffold
#

nono

#

So

#

I just disabled my packet listener

#

And I still see the glow lmao

eternal oxide
#

ah

regal scaffold
#

Ok I fixed that part

#

I think

#

Changing players glow effect

#

Color isn't that easy

#

It works perfectly on mobs

#

Just not players

eternal oxide
#

you add players by name not UUID

regal scaffold
#

That makes sense

#

Jesus

eternal oxide
#

mobs by UUID.toString, Players by name

wet breach
#

since mobs don't really have names, their uuid is their name

regal scaffold
#

Ok now next step

#

Making it work with packets

sharp kayak
eternal oxide
#

you could just use teams to control colors and enable glow via packets

regal scaffold
#

Yeah

#

Doing that

#

And it's working correctly

#

So if I want a team for each color

#

Do I literally do that?

eternal oxide
#

yes

regal scaffold
#

So how about RGB support

#

Dynamic create teams?

eternal oxide
#

in that example it cycles the colors using a runnable

#

teams are permanent once created

regal scaffold
#

Is performance bad if I create too many teams?

eternal oxide
#

just use the color as the team name

regal scaffold
#

Is it not a better idea to just do the color using packets too?

#

It's part of the metadata

eternal oxide
#

upto you, if you go packets for colors too you just have more non API code to keep updated

regal scaffold
#

Well, I would like some assistance figuring it out

#

Because I wasn't able to

#

?paste

undone axleBOT
regal scaffold
#

That works perfectly to enable glow ]

#

But the color is what's killing me

eternal oxide
#

why b |= 0b01000000;?

regal scaffold
#

I was doing 0x40 before

eternal oxide
#

which should be correct

wet breach
#

0x means hexadecimal fyi

regal scaffold
#

Both

#

Both work just fine

eternal oxide
#

ok

wet breach
#

0b means binary

regal scaffold
#

Yeah it's the same value

wet breach
#

so yes either would work because they are just different formats to specify the same thing

eternal oxide
#

yep, just seemed odd when teh wiki uses hex to use binary

regal scaffold
#

I compared to some examples I found on forums

#

b |= 0b01000000; or b |= (byte) 0x40;

#

i'm 99% sure this doesn't apply to players

#

So I think the only way is indeed using scoreboards

eternal oxide
#

I see nothign in meta to set the color

regal scaffold
#

Yeah I thought so

#

But then

#

Packet scoreboards are needed

#

Because what if 2 different players select the same target

#

And select different colors

wet breach
#

always good to learn 🙂

eternal oxide
#

you would have to handle updating teams on a per client basis

cobalt thorn
#
if(!config.getStringList("whitelisted").contains(player.getUniqueId())) {
            Bukkit.broadcastMessage("Whitelist");
            player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cNot whitelisted"));
            return;
        }
whitelisted:
  - "cb321240-3f44-454e-9963-3f9476b981a6"

Even if i add myself in this whitelisted section i cannot use the command and im so confused why
even if the uuid is the same

regal scaffold
#

Last question

#

How can I create a new metadata packet completely

#

To not have to wait for the listener to receive one

#

If I want to enable/disable it

slim wigeon
eternal oxide
#

With protocol lib no idea

#

nms would be one of the ClientBound packets

wet breach
#

put everything you want in the metadata

eternal oxide
sharp kayak
#

Not able to receive pluginMessage sent on one of the Bungeeserver to another. No errors, there is nothing wrong with the code

cobalt thorn
regal scaffold
#

Wait nvm

#

1 sec

#

Using protocolLib

#

How do I access the index 0 byte types

sullen marlin
sharp kayak
sullen marlin
#

?paste

undone axleBOT
wet breach
regal scaffold
#

I believe so

#

Well, yes it is

wet breach
#

so you will get a byte, and each of those bits means something

eternal oxide
sullen marlin
#

it isnt going to appear on the server without bungee code

sharp kayak
#

It is connected with bungee, i have a code to connect a player to the other server and it works perfectly fine

sullen marlin
#

yes, because BungeeCord channelk is handled by bungeecord

#

mymclobby:rip is not

#

bungee isnt going to do anything with it

sharp kayak
#

Cant i register it and send thorugh the registered channel?

sullen marlin
#

sure, but it will be received by bungee

true perch
#

Is it possible to force an Optifine CEM to do specific animations in a Spigot Server?

sullen marlin
#

not another server on the network which seems to be what you want

sharp kayak
#

oh

wet breach
regal scaffold
#

Yup

wet breach
#

so. you would check if there is a 1 in position that corresponds to what you are looking for

sharp kayak
#

thx, ill try it

wet breach
#

this is called bitmasking

regal scaffold
#

Ahhhh

#

And if there is, change to whatever I need

wet breach
#

well you either set it to 1 or 0

regal scaffold
#

Interesting, alright, thanks a lot Elgarl and frost, I need sleep

slim wigeon
#

I need help with the Conversation API, I trying to get user input. I tried Anvil APIs but I heard that needs nms which I refuse to learn for many reasons

regal scaffold
#

Well yeah, bits only 1 or 0

wet breach
#

as the index above shows, position 4 is not used

#

which is good, because you can now split at that position without worry of what is there as well 😛

regal scaffold
#

How can you tell

#

From the vg

wet breach
#

in the meaning slot

#

says its unused was previously used for riding

#

but now it doesn't have a use

#

at least for now

regal scaffold
#

OH

#

Literallym

#

Ok ok I understand a bit more now

wet breach
#

also, there are some positions that can't be set at the same time

#

like crouching and swimming

#

both of those can't be set at the same time because it isn't possible to crouch and swim

regal scaffold
#

I’ll figure that out when I get a error or something doesn’t work xd

slim wigeon
#

Conversation API Help

wet breach
#

that is why they are equal distance in binary away from each other

eternal oxide
#

the best way to handle it all is constants then &

wet breach
#

also, keep in mind MC is LSB

#

meaning Least Significant Bit first

slim wigeon
#

The thread has been made, I asked a question multiple times and I don't know if any of you got me blocked. But I know rushing it is not a way to get it which I not. Without proper tutorials on the internet on how to use the APIs, I have no choice but to ask who has messed with the APIs like for my case, the Conversation API

wet breach
#

LSB = right to left meaning for that index, the top is at the right, and then goes left. MSB = left to right(top would be at the furthest left)

#

reason I point that out

#

now that you know how bitmasking works

#

you can turn that byte into an integer 🙂

#

if you add the byte value up, you can use integers to refer to what is or is not set lol

#

with a single byte, the integer only ranges from 0-255

slim wigeon
#

I followed that and I seeEnter waypoint name: nullThen I have to rejoin to use commands

eternal oxide
#

null?

slim wigeon
#

The prompt must have ran at start. Not allowing me to do anything

eternal oxide
#

at start? you mean during login?

slim wigeon
#

No, I mean when I run the conv.begin() like when I click "Add Waypoint" from my GUI, I don't know if I using the API wrong

eternal oxide
#

I've never used teh conversation API, not many have

wet breach
#

I have a plugin you can look at for example

wet breach
eternal oxide
#

handy 🙂

#

I was going to tell him he'd likely have to wait for frost

#

err not frost, choco 🙂

slim wigeon
#

Thanks, that is useful for my purposes. I see what I did wrong

wet breach
#

you are welcome

#

yeah Choco knows the conversation api too

slim wigeon
#

How do I get the user input using this? Is it acceptValidatedInput?

wet breach
#

it is set in the context

#

if you noticed, the two classes actually contain a bunch of inner classes

#

the context is a global variable that can be accessed from all the inner classes and all the inner classes are setting data in this context

#

it is also how you can share input from one to the other if need be

#

each class has a prompt that accepts input, the type of prompt dictates the type of input it is expecting

#

so, in my plugin, you can see that all the inner classes are chained together 🙂

#

to go from one to the other, you can however make it go backwards too as its just calling the relevant inner class

slim wigeon
#

I see, how do I end the conversation

wet breach
#

there are two ways to end it

#

so that line there is important

#

if at anytime the player types /quit

#

the conversation ends

#

the other way, is if you make it to the last prompt

#

this is the inner class that ends everything

#

if they make it that far

slim wigeon
#

Thanks

wet breach
#

but, the first link I showed you can make it anything you want, it doesn't have to be /quit

#

you could do, end

#

essentially it is just a string that should be unique if you want to end it early

small timber
#

how can I add someone a permission on command for example

#

do i need to use pex or luckperms api or can i do it with spigot

chrome beacon
#

Give the player a permission attachment

#

?jd-s

undone axleBOT
sullen marlin
small timber
#

i used command as an example, it's not actually going to be a command which adds it

static ingot
#

If you mean you want to grant one like a permissions plugin would, you'd use Permissible#addAttachment like Olivo said

static ingot
grim oak
sullen marlin
#

You probably need to shadow the library or whatever TF gradle calls it

polar atlas
eternal oxide
#

no point

#

unless you are doing different priorities

cinder abyss
#

~~class org.bukkit.craftbukkit.v1_19_R3.block.CraftBlockState cannot be cast to class org.bukkit.block.TileState (org.bukkit.craftbukkit.v1_19_R3.block.CraftBlockState and org.bukkit.block.TileState are in unnamed module of loader java.net.URLClassLoader @46ee7fe8)

Normally NoteBlock have a TileState ???

public void GenNoteBlock(Block block, Instrument instrument, int octave, Note.Tone tone) {
        block.setType(Material.NOTE_BLOCK, false);
        try {
            NoteBlock nblock = (NoteBlock) block.getBlockData();
            nblock.setInstrument(instrument);
            nblock.setNote(Note.flat(octave, tone));
            TileState tileState = (TileState) block.getState();
            PersistentDataContainer container = tileState.getPersistentDataContainer();
            container.set(new NamespacedKey(this, "instru"), PersistentDataType.STRING, instrument.toString());
            container.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave);
            container.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString());
            block.setBlockData(nblock);
            getLogger().info(block.getX() + " " + block.getY() + " " + block.getZ());
        } catch (Exception err) {
            getLogger().info(err.getMessage());
        }
    }```~~
#

no

eternal oxide
#

ah seems not for NoteBlock

#

odd

#

which version of 1.14 are you using?

#

?morepdc

undone axleBOT
cinder abyss
#

and I want to be crosscompatible from 1.14 to 1.19.4

rotund ravine
#

?blockpdc

undone axleBOT
eternal oxide
#

thats it

#

yeah, it will nto support 1.14 as ChunkPDC was not added until 1.16.3

cinder abyss
eternal oxide
#

so farthest you can go back is 1.16.3

cinder abyss
cinder abyss
eternal oxide
#

you could do 1.14 but you'd have to manage your own PDC store somewhere

cinder abyss
eternal oxide
#

no

cinder abyss
#

(updated)

eternal oxide
#

NoteBlocks look like they never had PDC so you would need to store data elsewhere.

eternal oxide
#

CustomBlockData only works back as far a 1.16.5 as it stores in the chunk PDC

cinder abyss
#

No need to register something ?java PersistentDataContainer customBlockData = new CustomBlockData(block, this); customBlockData.set(new NamespacedKey(this, "instru"), PersistentDataType.STRING, instrument.toString()); customBlockData.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave); customBlockData.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString());

eternal oxide
#

Silly question, why do you need to store a NoteBlock data in a PDC?

cinder abyss
#

so I need to store datas who aren't changed to reset the noteblock to the ore

#

Example :
Instrument = bell
note = 0

When you break the block below :
Instrument = harp
note = 0

eternal oxide
#

why not simply in the BlockBreakEvent check if teh block above is a Noteblock, if it is read it's settings and reset them 1 tick after the event has finished?

#

no need for storing any data then

eternal oxide
#

literally call a runTask in the BlockBreakEvent to restore the settings

cinder abyss
#

I think I get the noteblock after he has been updated

eternal oxide
#

so in BlockBreakEvent java if (event.getBlock().getRelative(BlockFace.UP).getType() == Material.NOTEBLOCK) {

eternal oxide
#

inside that you run a new task

cinder abyss
cinder abyss
# eternal oxide inside that you run a new task

I made this java Block noteblock = event.getBlock().getRelative(BlockFace.UP); if (noteblock.getType() == Material.NOTE_BLOCK){ NoteBlock nb = (NoteBlock) noteblock.getBlockData(); Bukkit.getScheduler().runTask(this, () -> { noteblock.setBlockData(nb); }); }

eternal oxide
#

yep, clone the BlockData so you know it won;t be changed

cinder abyss
#

I think it's working

#

I'll try

eager jacinth
#

Does anyone know why when I edit the name in WrappedGameProfile (PLAYER_INFO), it doesn't change in the tab? I need to use different packet or something?

quaint mantle
#

How do i send a action bar message?

eternal oxide
#

Bukkit.spigot().sendMessage(...

rough basin
#

How to change player's view? use location's pitch and yaw?

iron night
#

is it possible to send custom packet to a player?

#

i mean

#

with another id and structure

#

i wanna make plugin that sends clear chat packet and fabric mod that listens to it and clears chat on client

tardy delta
#

just send a few hundred empty lines lol

iron night
#

bad solution

orchid trout
#

some clients disable empty lines in chat

#

doesnt fabric have packets documented?

iron night
#

yes

#

but i haven't found anything about server side

#

maybe protocollib can do something...

eternal oxide
#

yes

orchid trout
#

why would you need to add anything

#

just try it normally

keen birch
eternal oxide
#

in your plugin.yml you should have main: org.onjoinx.weloinx.WeloinX

quaint mantle
#

does anyone know a way to set players prefix in bungecoord? because i believe the method i used in spigot doesnt work here

halcyon hemlock
eternal oxide
#

the error says you don't Caused by: java.lang.ClassNotFoundException: org.onjoinx.weloinx.WeloinX

quaint mantle
#

"java.lang.ClassNotFoundException: org.onjoinx.weloinx.WeloinX" you sure you spelled it correctly

halcyon hemlock
#

It's because your main JavaPlugin class is different

halcyon hemlock
#

did u refractor something?

eternal oxide
#

red error on the class?

keen birch
#

no

eternal oxide
#

looks like a big red ? on the class to me

grizzled oasis
#
    MessageDigest md = MessageDigest.getInstance("SHA-256");
    String text = "Text to hash, cryptographically.";

    byte[] digest = md.digest();

    String hex = String.format("%064x", new BigInteger(1, digest));

Hi, i used this code, but for checking if the password are matching?

quaint mantle
#

what are you trying to do

keen birch
eternal oxide
# keen birch

you have an out folder which means you built using artifacts not maven

grizzled oasis
eternal oxide
#

build with maven

quaint mantle
keen birch
grizzled oasis
fluid river
quaint mantle
#

What is wrong with this? it can't understand player.getMessage and its not broadcasting the message its just sending a normale message

    @EventHandler
    public void OnChat(PlayerChatEvent e){

        Player player = e.getPlayer();

        Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "A" + ChatColor.DARK_GRAY + "]" + " " + ChatColor.GRAY + player.getDisplayName() + player.getMessage());


    }

}
fluid river
#

there is a blue m sign on top left

quaint mantle
fluid river
#

package

eternal oxide
#

Not install

#

Package

halcyon hemlock
#

I use artifacts

#

¯_(ツ)_/¯

#

did you do 'include dependencies'?

quaint mantle
halcyon hemlock
eternal oxide
#

No it adds it to your local maven

halcyon hemlock
#

both work

eternal oxide
#

it does build it, but it also installs to your local maven and clutters up multiple build versions

eternal oxide
#

only install if you are going to depend on the plugin in another

keen birch
tardy delta
#

cast it to the appropriate meta class

quaint mantle
#

What is wrong with this? it can't understand player.getMessage and its not broadcasting the message its just sending a normale message

@EventHandler
    public void OnChat(PlayerChatEvent e){

        Player player = e.getPlayer();

        Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "A" + ChatColor.DARK_GRAY + "]" + " " + ChatColor.GRAY + player.getDisplayName() + player.getMessage());


    }

}```
eternal oxide
#

player.getMessage?

tardy delta
#

e.getMessage()

eternal oxide
#

e.getMessage()

tardy delta
#

and use AsyncPlayerChatEvent

#

this one should be deprecated

keen birch
tardy delta
#

💀

quaint mantle
#

What does it say 'org.bukkit.player.PlayerChatEvent' is deprecated in my Problems section?

At public void OnChat(PlayerChatEvent e){

hazy parrot
#

Because it's deprecated as fourteenbrush already mentioned

quaint mantle
hazy parrot
quaint mantle
#

Okay thx

cinder abyss
#

Hello, how can I change the texture of a block without texture pack ?
I think it's possible with protocolLib

young knoll
#

To the texture of an exiting block?

#

Or something brand new

cinder abyss
#

by a new texture

young knoll
#

You need a resource pack

#

If you just want to disguise it as another block you don’t

#

But if you want a brand new texture you need a resource pack

cinder abyss
#

okay thanks

quaint mantle
hazy parrot
#

what do you want to achieve

#

to change formatting ?

quaint mantle
#

Yes, i want to change so when you chat its broadcasting my custom message

rotund ravine
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

rotund ravine
#

Of what you changed.

quaint mantle
#


    @EventHandler
    public void OnChat(AsyncPlayerChatEvent e){

        Player player = e.getPlayer();

        Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "A" + ChatColor.DARK_GRAY + "]" + " " + ChatColor.GRAY + player.getDisplayName() + e.getMessage());


    }

}```
rotund ravine
#

And where do you register it

quaint mantle
#

Sry i forgot that part...
Im sorry, but now its broadcasting my message and the normal one, how do i disable the normal one?

rotund ravine
#

cancel the event.

#

This is not the optimal way to do it btw.

fluid river
#

learnspigot

pliant fjord
#

Who could modify the BedWars plugin please

#

I'm ready to pay

rotund ravine
#

?services

undone axleBOT
fluid river
hazy parrot
#

can't he just set new format ?

rotund ravine
#

Set the format

fluid river
#

cuz format is cringe

hazy parrot
#

if i understood what he wants

hazy parrot
rotund ravine
#

you're cringe

fluid river
#

it uses regex of String.format() method

hazy parrot
#

and what is cringe about it

fluid river
#

so if you missed a % sign or just typo'd in placeholder the thing just gonna crash

hazy parrot
#

just dont miss % lmao

rotund ravine
#

Don't typo.

fluid river
#

instead of working

hazy parrot
#

you literally have two placeholders

fluid river
#

but with %yourTypoPlaceholder%

rotund ravine
#

You just need to know what you are doing.

#

Don't pass it irrelevant stuff.

fluid river
#

and it's for others to use

#

you probably can check the string on having typos and remove the crashing elements

rotund ravine
#

Sanitize the input then.

fluid river
#

and error to console

#

but meh

#

in older versions it was better

young knoll
#

I imagine plugins like essentials chat use the format

#

Idk I haven’t looked

rotund ravine
#

It does

#

And it does so properly

fluid river
#

i'm not the only one who prefers cancelling the asyncchat and broadcasting with own formatting

rotund ravine
#

Not very easy to interface with your plugin then.

fluid river
#

slower bot more comfortable(less code)

fluid river
rotund ravine
#

I don't want to use your api.

fluid river
#

my last public plugin was like in 2019

rotund ravine
#

I want to use the event to interface with your plugin should there be a need to.

quaint mantle
#

So i have this:



    @EventHandler
    public void OnChat(AsyncPlayerChatEvent e){

        Player player = e.getPlayer();

        Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "A" + ChatColor.DARK_GRAY + "]" + " " + ChatColor.GRAY + player.getDisplayName() + e.getMessage());


    }

}```
And how do i cancel the normal chat message?
rotund ravine
#

I told you.

fluid river
#

e.setCancelled()

#

learnjava

#

or

#
e.setFormat(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "A" + ChatColor.DARK_GRAY + "]" + " " + ChatColor.GRAY + player.getDisplayName() + e.getMessage());```
#

and remove broadcast

rotund ravine
#

No

#

That's not sanitized.

hazy parrot
#

tf

rotund ravine
#

At all

fluid river
#

ez

rotund ravine
#

Can't wait till a player types some weird syntax

fluid river
#

oh true

young knoll
#

Someone get Bobby tables

fluid river
#

message can also have cringe inside

#

which breaks format

rotund ravine
#

You should use the format arguments not their name or message.

abstract sorrel
#

why does this throw an error?:
fileConfiguration.set("tablist.footer", Constants.DEFAULT_FOOTER);
fileConfiguration is a YAMLConfiguration and Constants.DEFAULT_FOOTER is an arraylist of strings

fluid river
#

what error

quaint mantle
#

If i am setting the e.setCancelled(); just above my broadcast its says 'setCancelled(boolean)' in 'org.bukkit.event.player.AsyncPlayerChatEvent' cannot be applied to '()' in my problems section

fluid river
#

bruh

#

cuz it has input parameter

#

true or false

abstract sorrel
#

ExceptionInInitialiserError, but if i replace Constants.DEFAULT_FOOTER with 0 it doesnt error

fluid river
#

in your case you need true

rotund ravine
#
e.setFormat(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "A" + ChatColor.DARK_GRAY + "]" + " " + ChatColor.GRAY + "%s%s");
abstract sorrel
#

?paste

undone axleBOT