#help-development

1 messages ยท Page 221 of 1

remote swallow
#

anyone got ideas?

untold patio
#

I thought of adding a player to an arraylist when they join but Idk if there is a better way to do it

ivory sleet
#

arraylists scale bad for that

#

so yeah a hashmap might be better

dim bronze
#

i personally find it easier to have the server run inside intellij unless it's not possible

remote swallow
#

that probably is, just seeing if i can make it not need me to copy the stuff into ij

untold patio
#

c;

ivory sleet
#

gl :)

dim bronze
#

?

sterile token
#

Why checking if B extends BaseGuiBuilder<G, B> again?

dim bronze
#

it's not exactly checking it

#

it's so it will make sense when G and B are used as return types in the abstract class

sterile token
#

I mean i understand generics, but no that complicated

dim bronze
#

its a builder so it returns itself

sterile token
#

oh ok

dim bronze
#

but itself is B (when extended)

sterile token
#

sorry i didnt know hard generics, i just know simple ones

dim bronze
#

no need to apologise

#

we're all learning

untold patio
#

Ok, so according to what I just read, the hashmap (for creating a homes plugin) should receive the player name as key, and the home as value?

#

Oh

#

Why not name?

#

I know UUID is an identifier but I thought I could use name

#

Ohhh

ivory sleet
#

lets say morice_0 switches their name to Conclure in minecraft

#

now they would have access to my homes

dim bronze
#

also storing the player as the key isn't great because the object changes if the player relogs

untold patio
#

Ohhh alright

untold patio
worldly ingot
#

Technically speaking if it's in a Map it won't matter because maps are based on hashCode() and equals(), which check the UUID

#

but ye

untold patio
#

Uuid the value

dim bronze
dry forum
#

whats the best way to let a plugin work with bungee & spigot? should i make a module for each or smthn

dim bronze
#

maybe that was an offline server

worldly ingot
#

They won't == each other, but they will equals() each other

dim bronze
#

of course

#

but has the hash function always just used uuid?

worldly ingot
#

Yes

dim bronze
#

must have been using an offline server then

untold patio
#

How can I get the player UUID in this main class

#

Or should it be Player

ivory sleet
#

well, you mean like getting a specific player?

untold patio
#

Hmmm, I guess... because a home must be only a player's

dim bronze
#

well you'd want some commands for this to work

remote swallow
#

What would be the best way to get a specific string a stringlist

untold patio
untold patio
#

This is my home class

remote swallow
# dim bronze explain?

eg i have 5 different strings on a string list in config (getting from #getStringList) and i wanna try and pick a random one out of the list so would need to get a specific one

dim bronze
#

random number between 0 and the length of the list exclusive?

remote swallow
#

okay

ivory sleet
sterile token
#

Because you are using* a big object for no need

dim bronze
#

that objects in memory anyway

sterile token
ivory sleet
#

the Player is alr in memory

#

sure if you use the map past a single player's session, then you might have it filled with old player objects

dim bronze
#

only a reference to that memory is stored in the hashmap

#

just realised that its hash is never stored :P so what i said was wrong

eager knoll
#

Can I reference things in the config.yml of a dependency in my plugin?

dim bronze
#

yes but you probably shouldn't

sterile token
eager knoll
#

Yes

ivory sleet
#

creppy, I mean a HashMap does store both hash and a reference to the K instance

fluid river
ivory sleet
#

or did you mean something else?

dim bronze
#

no i meant that. I need sleep. My brain worked, then doubted itself

ivory sleet
#

lol yeah nw

sterile token
ivory sleet
#

cuz u have the Node<k,v> array internally iirc

#

if they didnt change it

fluid river
#

hi conclure

ivory sleet
#

hello

sterile token
#

what a long time bro

ivory sleet
#

hai

fluid river
#

bruh

ivory sleet
#

ye

dim bronze
#

my train of thought was the reference to player is held and it calculates the hashcode of each on a get call
but thats no longer O(1)

sterile token
#

i rlly miss you

dim bronze
#

i was right the first time lol

ivory sleet
#

oh well im here right now

sterile token
ivory sleet
#

nothing really

ivory sleet
sterile token
ivory sleet
#

well, we have a lot of others who help people in these channels, dont we?

sterile token
#

yeah but you are diff from all others

ivory sleet
#

but yes, I havent coded much in the spigot api lately

sterile token
#

I mainly understand when some ppl helo me

#

I have some of them which i umderstamd better or explain better

ivory sleet
#

thats nice :)

sterile token
#

and you are one of those

#

Which explains amazing

ivory sleet
#

sometimes, but I am used to enterprise terminology which confuses a great set of people here as ive come to understand it, but im glad ive been able to help u, maybe we could move this convo to #general speaking of which

sterile token
#

ok

#

soorry

winged anvil
naive loom
#
int entityId = player.getEntityId();

        PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(entityId);
        EntityCreature creature = null;
        WorldServer ws = ((CraftWorld) player.getWorld()).getHandle();

        PacketPlayOutSpawnEntity spawnPacket = new PacketPlayOutSpawnEntity(creature); // creature is not null, i just removed the logic that selected what creature the player should be disguised as.
        try {
            // c field

            Field entityIdField = spawnPacket.getClass().getDeclaredField("c");
            entityIdField.setAccessible(true);
            entityIdField.set(spawnPacket, entityId);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }

        Bukkit.getLogger().info("A little bit of magic for these dumb ass packets!");
        Bukkit.getLogger().info("Player Entity Id = " + entityId);
        Bukkit.getLogger().info("Spawn Packet Entity Id = " + spawnPacket.b());

        for(Player onlinePlayer : Bukkit.getOnlinePlayers()) {
            CraftPlayer craftPlayer = (CraftPlayer) onlinePlayer;
            EntityPlayer entityPlayer = craftPlayer.getHandle();

            entityPlayer.b.a(destroyPacket);
            entityPlayer.b.a(spawnPacket);
        }
```Could someone tell me why this doesn't work? The Spawn Packet Entity Id is being set to the Player's Entity Id. (ver. 1.19.2)
#

One of the issues is just me not being able to move after these packets are sent and when I go into third person person my skin / disguise just isn't present. (while in first person I can see my hands)

golden turret
#

I am experiencing a bit of lag when trying to use the Random like 100k times at once

#

It is for a reward system

#

the player can open all of his keys at once

ivory sleet
#

myeah

#

well, its across one thread?

golden turret
#

yes

ivory sleet
#

hmm so, well have you tried SplittableRandom

golden turret
#

nop

ivory sleet
#

idk if its any faster, (usually used with parallel streams and stuff) but iirc its quite fast

golden turret
#

hm

#

but like

#

I use things like Collections.shuffle

#

and SplittableRandom does not extends Random

#

so I cant use it there

ivory sleet
#

oh yeah

#

they forgot to add so that it takes RandomGenerator instead

#

:c

#

hmm

dim bronze
golden turret
#

Well I am

dim bronze
#

then nevermind

golden turret
ivory sleet
#

wizardly

#

you could shuffle the collection in another thread

#

ofc it complicates things

remote swallow
#

For some reason essentials.getUser(Player).getNick(false, false) is returning them with suffix and prefix even tho it has the 2 false's, im so confused why

ivory sleet
#

like collection thread safety

#

anyway here

#

splittable is 3-4 times as fast

#

compared to normal

#

score is in nano seconds per operation

#

.5 in error (for splittable)

dim bronze
#

is there any need for a while true there? seems like a lot of iteration

golden turret
#

it is to be sure that there will be a reward

ivory sleet
#

alr, maybe try to copy paste the shuffle method

#

but with a splittable random

#

and if thats still not enough, maybe use another thread to do it

dim bronze
#

couldn't you scale the chances so that only 1 random call needs to be made?

#

its too late for me to think how

#

its just a weighted random

ivory sleet
#

yea that too

dim bronze
#

its taking so long because you may have small chances

#

there is absolutely no need to iterate more than once to get the correct reward

#

i have always used a treemap in the past to save iterating each time

rare rover
#

Just a question

#

Wanting to dive into ? And T

ivory sleet
#

because the type passed doesnt matter Id assume in this case

rare rover
#

Ohh

#

I see

golden turret
#

generics

rare rover
ivory sleet
#

I mean

CrateReward<?> is a supertype of CrateReward<A> and CrateReward<B> which is probably why they return a term of that type

golden turret
#

the generic for the CrateReward is to specify the reward type

winged anvil
#

is there a way to get the plugin version specified in the plugin.yml

ivory sleet
#

yea

#

PluginDescriptionFile iirc

winged anvil
#

ty

ivory sleet
#

can be retrieved through Plugin

winged anvil
#

yes

golden turret
#

yo

#

just remembered

#

the getRandomReward

#

is called 1m times

#

because the player can open all of his keys at once

#

so even if I use the weight thing

#

it will be called 1m times

ivory sleet
#

well

#

might be necessary to do it asynchronously then?

golden turret
#

I think it is possible

ivory sleet
#

yeah, just pool the threads tho

#

(I assume a cached thread pool would be fine here [maybe with a max size configured on ur own tho])

golden turret
#

but

#

this is the code

ivory sleet
#

uh

#

I was thinking that you call necessary getRandomReward calls in CFs

#

CF.supplyAsync(() -> {
...
}, pool)

golden turret
#

nha

ivory sleet
#

cuz that there isnt async at all

golden turret
#

ik

#

so

#

whenCompleteAsync?

ivory sleet
#

no but like completedFuture() is the issue

#

because it just takes a value a returns a dummy future that wraps the value

golden turret
#

the play method is executed only 1 time

#

the thing that interest us is in the for

ivory sleet
#

hmm well, you could use whenCompleteAsync

#

but arent there parts that you wanna do sync?

#

like the inventory stuff

golden turret
#

only this needs to be sync

ivory sleet
#

yeah guess you can send that to the bukkit scheduler then

#

anyway you dont need to use the future before

#

from what it looks like

golden turret
#

the future is for the animation stuff

#

so when the animation ends

#

future.complete()

ivory sleet
#

alr

golden turret
#

cool

#

moved it to async

#

and it is very fun

#

seeing this literally every time

#

1 million rewards ๐Ÿคก

ivory sleet
#

wait

#

certain rewards are command based?

golden turret
#

yes

ivory sleet
#

ah damn

#

that might be hard then

#

I mean either way, 1mill rewards are a lot to process

golden turret
#

yes

#

I am talking with the client about it now

#

he said that a play may have 100k keys

#

imagine a server with 30 players and each player opening all of their keys at once

ivory sleet
#

yeah

#

there are certain tricks you could use

#

lets say the rewards vary from the command
/hello dodo
and
diamond

#

you could simply map the rewards to the amount of times they've been drawn

golden turret
#

still

#

there is a message sent when you win a reward

ivory sleet
#

and for commands, you might just wanna limit it, lets say they unlock a permission, that should only happen once

golden turret
#

imagine sending 1 million messages

ivory sleet
#

yes shorten it down

#

just have a summary

#

like

#

Iron Sword x64

#

or sth

golden turret
#

oh boy

#

the client will need to think better then

#

I was thinking something like

#

100 keys

#

or 50

#

but he is thinking about 100k ๐Ÿ’€

ivory sleet
#

lol

#

I mean it might be doable

#

as said

golden turret
#

yea

#

but what about the commands

ivory sleet
#

for money, count that to and execute the pay function only once

winged anvil
#

wow

golden turret
#

the problem is that the command can be literally anything

ivory sleet
#

yeah

#

well ask the client what type of commands they're gonna put there

golden turret
#

and i dont want to write something to read what the command is

#

I have a /crate items too

#

to see your items

ivory sleet
#

because well... 100k is a lot to expect

golden turret
#

imagine having 100k items

winged anvil
#

actually, nvm

golden turret
#

I think the only way would be writing a helper method

ivory sleet
#

^

golden turret
#

It is still sending the messages lol

ivory sleet
#

๐Ÿฅฒ

wet breach
#

o.o

echo basalt
#

Ayo this probably sounds sketchy asf

#

but how can I like

#

Copy all fields from an instance of the super class

#

to the parent object that I'm inheriting

#

Like a

public class B extends A {

  public B(A original) {
    // copy all original values to super object
  }

}
#

Trying to use unsafe but it no worky

untold patio
#

Hi guys, I'm back!

#

This is my code so far

#

How's it looking c;

vocal cloud
winged anvil
#

prolly the best code of 2022

rare rover
#

Lol

untold patio
#

xd

winged anvil
#

check if the sender is an instanceof Player before casting lol

vocal cloud
#

Please learn java

#

Please ๐Ÿฅบ

rare rover
untold patio
#

Don't you learn java by experimenting with it?

winged anvil
untold patio
#

Ok, why no?

winged anvil
#

dont experiment with spigot

#

id say learn the foundation of java, experiment with that, and then apply to spigot

jagged monolith
jagged monolith
#

Otherwise you'll get errors if something like console uses the command.

untold patio
winged anvil
#

and make sure args.length > 0 before trying to grab args[0]

untold patio
#

and now I want to start implementing it to spigot

untold patio
winged anvil
#

?paste

undone axleBOT
untold patio
#

Better?

#

c;

winged anvil
#

yes

#

easy improvements

untold patio
#

I'll keep them in mind

#

ty c;

vocal cloud
#

Combine the ifs. I assume you're using java 8? If not then java 17 allows for variable declaration in the if as well

untold patio
#

Guys, a question, I'm new using hashmaps, how could I get the UUID of the user in the hasmap to verify if it's the same than the sender's

winged anvil
#

you cant index a hashmap

#

just use .containsKey()

jagged monolith
#

^ containsKey() would be the best way

untold patio
#

Like this? c;

winged anvil
#

yes

jagged monolith
#

Looks good

worldly ice
#

what's the point of the for loop there

jagged monolith
worldly ice
#

well yes but why have it there

#

doesn't seem like you need to loop

vocal cloud
#

You should never be looping over a map.

jagged monolith
#

They didn't add the rest of the logic when they sent that screenshot so can't say why they need it or not

worldly ice
#

i'm assuming they were doing originally that to check if the map contains a key

jagged monolith
#

Without the rest of the logic hard to say

vocal cloud
#

It looks like they're using it as a list

sullen sierra
#

Can someone please help me Iโ€™m trying to use redis bungee but it just keeps saying pinging?

fluid river
wet breach
#

you really don't need a new random instance

#

instead make a random instance, and then just call Random.nextInt()

golden turret
#

I was using ThreadLocalRandom.current()

wet breach
#

only time you really need a new random instance is if you need something close to true randomness

wet breach
#

so creating a random instance outside of your code so those code blocks can get an instance and then re-use that instance. It should help alleviate some lag ๐Ÿ™‚

vast kelp
naive loom
#

It just set based on the players kit and it would be a specific mob with their given world.

#

It should of disguised me into a creeper.

vast kelp
#

That's fine, but I'm saying most won't take your word for it. Add if (creature==null) return; before your comment, test it, then ask again with the new code. That is, if you're not willing to share in entirety

fading spindle
#

im having a trouble with using hashmaps, this usually doesn't happen to me i made a hashmap in main class and when i try to use it in another class it doesn't register here is another screen shot

#

do i need to import an API for hashmaps?

wet breach
#
public HashMap<String, Integer> getKillstreak() {
    return killstreak;
}
#

then you should be able to access it more easily via DI

#

?di

undone axleBOT
fading spindle
#

it still doesn't allow me to resolve the method in a player event's class

wet breach
#

because you are not using di

#

if you don't know how to do basic java programming then you probably shouldn't be making plugins

fading spindle
tribal rivet
#

?learnjava

undone axleBOT
round finch
#

uh you quoted it out

quaint mantle
#

Hey, how can I make custom world generation? I want to replace all the world generation with my own.

#

is there a way to view packets per second on client

quaint mantle
#

??

quaint mantle
#

Hey, how can I translate 1.16 NMS to 1.19 NMS?

chrome beacon
#

You rewrite the code

quaint mantle
#

Isn't there like a website that helps you do that?

chrome beacon
#

Screamingsandals can help with mappings

mighty pier
#

rename it to SomethingPlugin

topaz cape
#

ugh right Army guy. you've seen worse

quaint mantle
#

What's DedicatedServer#getCustomRegistery from 1.17 in 1.19?

sullen marlin
#

Why do you need it

sterile token
#

People mustnt be coding with spigot nor bungeecord api without java knowledge

mighty pier
#

thats like

#

what most people do

mighty pier
quaint mantle
#

im not a dev but why do ppl buy the src to a plugin if java decompilers exist? can java decompilers be inaccurate or smth?

hazy parrot
#

it can be really inaccurate

#

try to decompile some plugin and the compile it again

#

i mean not necessarily inaccurate

#

but harder to understaind

quaint mantle
#

ohh

#

alr ty

hazy parrot
echo basalt
#

Some idiot developers use tools

#

to scramble the code

#

it's reversible but a pain in the ass

quaint mantle
#

isnt that good tho

echo basalt
#

nope

quaint mantle
#

to stop leakers

echo basalt
#

it won't stop leakers

#

also piracy has a weird stance

#

no piracy = easier distribution = easier word of mouth advertising

#

piracy = harder to manipulate, still easy to distribute if it doesn't have DRM

#

all code eventually gets cracked

#

But on one side, I guess it's easier to pay 100$ for source code than pay some developer like me 30$/hour for 8 hours of work

ivory sleet
cobalt marlin
#

i'd die before i willingly let skids like the people in this discord use my code for free

#

i don't think most people that write decent code would like to work for free

quasi flint
#

it doesnt stop em

#

with a bit of work

#

naming variables etc

#

it can be understood somehow what does what

#

not saying its not a pain in the ass

#

but doable

cobalt marlin
#

it's doable but no one would bother because rewriting it is faster

sterile token
#

Its what I do with my libraries

#

๐Ÿ˜‚

elfin atlas
#

Is there a way to check if a pressure plate is pressed outside of the PlayerInteractEvent (so just checking the current state)

rocky tree
#

Hi, anyone know how I can set to run a command (from console) in a HoverClick event?
Example:

if(player.hasPermission("hi.hi)) {
TextComponent msg = new TextComponent("Hi");
msg.setClickEvent(Here the console makes the command /hi, for example);
player.spigot().sendMessage(msg);
}
echo basalt
#

you can make a command that just redirects to console

#

so like

#

/runconsole plugins

#

would just get all args and call dispatchEvent

rocky tree
#

So, make another command and run that?

echo basalt
#

ye

rocky tree
#

Mh ok, now I try, thanks

sterile token
# echo basalt ye

Could someone link me a tutorial about reading server packets answer from a Socket?

echo basalt
#

no โค๏ธ

eternal oxide
#

google java example client server

sterile token
eternal oxide
#

sockets are not spigot

sterile token
#

No

#

I mean im simumsti ga cmient

#

I need to emulate a server real connection

#

๐Ÿ˜ฌ

drowsy helm
#

Simumsti ga cmient

sterile token
#

I just need to read spigot sever packets responses

#

Because i have already done the handshake and login packet. And the client joins the sever but before 1m aprox its get auto disconnected

eternal oxide
#

you need to send a keep alive packet

sterile token
#

Yeah but when?

#

I need to read sever responses first

#

But packets formarts are really weird

#

And i when i sout the DataOutputStream I just get random numbers displays

#

If not I wouldnt e asking

eternal oxide
#

you can;t sysout the stream. you need to read it per byte

#

wiki.vg will tell you what teh format of each packet is

sterile token
#

Hmn

#

Were im looking at it

#

And i cannot find that...

eternal oxide
sterile token
#

And Where ezplI show to read it

#

Its just said that packet id and the fields it has, nothing readingrelated

#

๐Ÿค”

eternal oxide
#

correct. thats what you need

#

you need to know what is IN each packet type

sterile token
#

But how iread

#

๐Ÿ˜ก

eternal oxide
#

That allows you to read it's contents

#

you already have the stream

sterile token
#

I use data input stream?

eternal oxide
#

yes

sterile token
#

And how i know its the correct packet response

eternal oxide
#

If the protocol says the packet contains a Long you readLong

sterile token
#

Ok

#

And for packet identifier

#

Because im sout the data input stream and display random numbers

eternal oxide
#

I've not looked to see but I'd guess teh ID is an Int or a Long

sterile token
#

Because the display numbers are from 0 to 223

#

And also negativos

#

I really co fjse

#

I really understand having a simple example about reading

eternal oxide
#

There is a section on data types

sterile token
#

What?

#

What data types

eternal oxide
#

it even has example code on reading each type

sterile token
#

I just need a example about reading the packets from socket stream

eternal oxide
#

the stream is just a byte array

#

read it into a bytearray and parse it

sterile token
#

So i convert the stream I to an InputStreamBytdArray

eternal oxide
#

no, just readBytes

sterile token
#

Hmnn

#

But the sever responses are Long and string etc

#

๐Ÿค”

eternal oxide
#

yes

#

you read to an array and parse it as teh examples show on wiki

sterile token
#

Not joking dont really understand

#

The wiki doesnt help a lot to me

#

I mainly a visual perdรณn

eternal oxide
#

look under the Data_types

#

there is sample code

sterile token
#

I dont understand without specific and clarify example

#

Please give a hand doing a simple packet reading example

#

Its not so diff for you that undrtstand

#

๐Ÿ˜ฌ

shut meadow
#

hello when a player joins the game he gets a custom message which status he or she as.

But i want that the message is send after the Join Message "... joined the game" because atm its send before this message could someone help me please?

opal juniper
molten hearth
#

what he's trying to say is the minecraft protocol is designed like fucking unstructured aids and is there a full example of actually parsing the packet

#

I have seen checkers web games with a better protocol

sterile token
#

Yeah in other words the wiki its a mess

eternal oxide
#

MC protocol is only bad because of its Bigendianness

sterile token
#

So how i can read packets responses ๐Ÿค”

opal juniper
molten hearth
#

I think if mojang provided a json serializer for the packets it would be quite nice

robust sinew
#

if I use Bukkit#getPlayer, does it return null for offline players and names that don't exist?

opal juniper
#

yes

robust sinew
#

ok thanks that's what I need

sterile token
molten hearth
opal juniper
#

maybe its just broken english then

opal juniper
eternal oxide
#

a protocol should be efficient and small, not readable

sterile token
#

I meanwhydontjustsendcodeinsteadofmakingpeoplewhodontunderstandlostingtheirtime

molten hearth
opal juniper
#

look at protobuf

#

serialises to binary but is super efficient

molten hearth
#

you can literally just do packet['id'] and you get the packet ID and then you know what to read

opal juniper
#

mojang should use protobuf

sterile token
#

Just sping poof aboutreadi a packet because both of us lost our tkme

molten hearth
#

I do not like the idea of using binary for structured data

sterile token
#

I will try using Netty so because java default things really shity

#

๐Ÿคก

#

Sorry if sound rude but would you help or not?

quaint mantle
#

if i want to make a plugin for 1.8, what SDK do i use in intellij?

sterile token
#

So them we dont lost our time

undone axleBOT
quaint mantle
#

and still the best

#

ty

opal juniper
#

best response ever

#

pin that

quaint mantle
#

^

untold patio
#

:x

molten hearth
#

bruh Player z

untold patio
#

Ye

untold patio
#

Is this a good way to get information from a hash map?

#

(Imma delete the picture later)

quaint mantle
#

IntelliJ only lets u choose mc version between 1.12-1.19. Which 1 for 1.8?

#

do i just choose 1.12

untold patio
#

Thank you c;

quaint mantle
#

im using the minecraft development addon

molten hearth
#

1.8.9?

#

I think you mean 1.8.8

molten hearth
#

lmao

#

well 1.8.9 isnt in the repo

#

yeah

#

redirection would be noice

#

understandable

#

who has

sterile token
#

I mean he is really new

#

Because if he is not using maven

#

If not using maven neither gradle its really weird

floral drum
#

meow

dire marsh
#

Since most servers depend on 1.8

floral drum
#

hi zack

round finch
#

just here to solve some easy problems

sterile token
round finch
#

i'm kinda boredom

#

ngl ๐Ÿ˜ฆ

#

eh that sounds like work

#

just here to solve problems

#

๐Ÿค”

#

Can't lie System and Logic is fun to me

cerulean lynx
#

hi, i have a problem, i have a main class and another class named HelloCommand.java, i created a new command but i dont know how to register command i was read some docs but still cant understand

#

can anyone help me?

cerulean lynx
#

i will read this thanks

untold patio
#

I just tried my plugin in-game and this is the message that shoud list the name of the homes the user has

chrome beacon
#

Use the home name instead of the home instance

untold patio
#

Hmmm but should I create a variable that gets the name of the home?

#

Because I'm using a hashmap so Idk

#

This line gets me the home instance

#

According to the UUID, but how can I access the attributes of the home instance

cerulean lynx
dim bronze
quaint mantle
#

what api-version do i set in my plugin yml for a 1.8 plugin

quaint mantle
#

y not?

dim bronze
#

api-version isn't in the plugin.yml spec for <1.13

quaint mantle
#

ohh ok

dim bronze
# untold patio Yes

homeList.get() will give you a home instance, so now all you have to do is call getHomeName on top of that

#

not sure what zacken is trying to say?

untold patio
#

I don't understand this :c

#

No, the name, because it was sending me the instance

#

So what I want to show the users is the home name

#

Hmmm no

#

No

hasty prawn
#

Did you figure it out Shadow?

rocky tree
#

There is a method to do a command on HoverClickEvent from console without create another command?

cerulean lynx
#

why this is gives error

untold patio
#

I think it's because of the ""

#

It's asumming it's text

#

Not enchanment instance

#

Idk, maybe I'm wrong

cerulean lynx
dim bronze
untold patio
#

Try Enchantment.

#

It should say all the enchantments available

dim bronze
#

you need to pass an Enchantment to the addUnsafeEnchantment method

cerulean lynx
#

๐Ÿ˜„

dim bronze
#

I'm not getting mad, just suggesting that you get a good understanding of java before moving on to spigot

untold patio
#

What I told you

#

Instead of Unbreaking

#

Enchantment.(here comes the enchantments available)

cerulean lynx
#

ohh

#

thank you man

#

it worked

untold patio
#

c;

dim bronze
untold patio
#

Guys :c I tried this, and it's working nicely but, for example, If I create many homes, when I list them (with a command) it only shows me the last one I created

dim bronze
untold patio
#

:0

dim bronze
#

the hashmap relates a uuid -> Home

#

you can either use a list of homes as the value in the map, or create your own user data class which contains a list of homes

untold patio
#

Ohhh

#

An arraylist of homes could be?

rocky tree
# dim bronze could you rephrase the question?

When I click on the text (made with TextComponent) I want the console made a command (without create a new command contenent Bukkit.getServer().getConsoleServer() etc).
Is it possible?

dim bronze
#

yes, assuming you mean ArrayList<T>

untold patio
#

Yeah,

#

Thank you again c;

dim bronze
# untold patio Yeah,

although convention says that you should just use the type List<T>. There's no need to expose the actual implementation of the collection, just knowing that it's a list is sufficient enough to use

#

Seeing people use notnull annotations in java makes me happy

#

if you have that mentality maybe you should switch to kotlin ;)

hasty prawn
untold patio
#

Oh, I'll use this and then I'll share it with you c;

rocky tree
hasty prawn
#

You want to run a command that doesn't exist?

dim bronze
#

Yeah, I think morice answered it nicely though

#

but it needs to be executed when the text is clicked, which would require a command to be run

rocky tree
rocky tree
hasty prawn
#

Oh

#

Hmmge I think you'll probably have to add another command that does basically the same thing but only Console can run

#

Or add another argument telling the command that console is running it

dim bronze
#

The more important question is why does the console have to run it?

hasty prawn
#

I assume to bypass cooldowns

dim bronze
#

If you are giving players the permission to use the command through text, surely they should just have permission to run the command?

rocky tree
#

yeah, but in every case I have to pass it on clickevent

#

because it happen when u click on the text

untold patio
#

Like so? c;

rocky tree
#

so there is a method or I have to create a second command and pass it?

untold patio
#

Ok

#

But if I don't use the loop, how would it know which home I want to delete

rocky tree
#

mh ok

untold patio
#

Like this c;?

#

Alright c;

#

Ty c;

#

I removed the UUID from this class because I'm already giving one in the hashmap

#

Is it ok like that?

#

Oh didn't read, alr! ๐Ÿ˜„

#

Alr! c;

#

In this case, it asks me for a list of homes, but I don't have one in the beginning

tardy delta
#

probably want to have a method PlayerHomeData::addHome(Home)

#

not much sense to both have a constructor param and that method

dim bronze
#

there is if it's being serialised

tardy delta
#

my playerdata is just setup with an ::addHome method and im calling that one instead of creating a collection and then passing it in

#

recently switched to mongo now smh

#

doesnt

dim bronze
#

it has its uses for relational data

#

but most of the time when making plugins you're dealing with data that is better modelled by a document

#

that with relations

tardy delta
#

doesnt it also perform better in terms of performance when you have a big database?

dim bronze
#

not sure

#

once again I guess it depends on the use

tardy delta
#

in one that's fucked up

dim bronze
#

mongo is going to be a lot slower at 'table joins'.

tardy delta
#

dont want to try that and dont need it anyways

dim bronze
#

and because all of the information is generally stored in one document rather than multiple because joins don't fit the mongo workflow, you tend to get larger packets sent to the user

#

of course, this is why graphql is fitted nicely for querying mongo databases

untold patio
#

Thank you c;

dire marsh
#

i swear people have been arguing about sql and mongo for a week in this channel now

#

both have their benefits and downsides

river oracle
#

what is a mongo

#

I only know about mangos

#

Only reason I like mongo more is the java drivers lmao so much easier for my brain

#

working on a sql api rn for myself though lol

tardy delta
#

i was working on a reflective gson alike sql api and i gave up

#

too difficult to handle normal level transactions

#

that combined with annotations was driving me crazy

untold patio
#

Me again c;

#

I register the commands like this, but it looks like it's not getting the second command

#

The first one is working nicely

tardy delta
#

any error?

untold patio
#

Nop

#

D;

tardy delta
#

please ensure me PlayerHomeData is not a player specific thing

untold patio
#

...

#

I got lost :c

tardy delta
#

you probably want to go for player specific home data

#

so you would end up with a Map<UUID, PlayerHomeData>, assuming PlayerHomeData has a Map<String, Home> or smth internally. PS an UUID is just an identifier to get a player from

#

cuz now all the homes are stuffed together ig and there no way to distinguate between players

#

is dintinguate even a word idk

#

uh well why having homedata twice

#

my first plugin had a Player field shared in a base command class lol, another player executing and stuff broke

untold patio
#

Oh, I forgot to check for player UUID

#

Hahaha, this is my first time using hashmaps and creating a plugin that contains many information for specific players

tardy delta
#

we learnt arraylists today in college smh

#

me just speedrunning all exercices

#

they using an arraylist in a place where a hashmap is better but anyways

untold patio
#

Time for a break

tardy delta
#

we havent learnt yet so cant use it lmao

untold patio
#

Better?

#

Now it checks for player UUID

#

@last temple

#

Could I send you a friend request?

quaint mantle
#

Anyone has any idea on how to override the existing /msg command /

tardy delta
#

what am i looking at

quaint mantle
delicate lynx
#

register your own /msg command

#

it will just override it

tardy delta
#

have you tested it?

quaint mantle
#

Would you mind if you could help me in DMs?

tall dragon
untold patio
#

So they get the information about their homes

quaint mantle
#

@untold patio new to java ?

tall dragon
#

fair point.

untold patio
tall dragon
#

thats not proper english.

quaint mantle
#

?learnjava

undone axleBOT
fervent prawn
quaint mantle
#

@fervent prawn where are you from ?

fervent prawn
untold patio
quaint mantle
tardy delta
#

there is no such method

#

player.spigot().sendMessage(TextComponent)

kind hatch
#

Spigot ain't bungee though.

untold patio
grizzled oasis
#

Hi if I use zstd to make a yaml file or a sqlite file for making it lighter can that be a good idea?

kind hatch
#

Not true, indian tutorials are something different.

tardy delta
#

spigot tutorials only learnt me to abuse things

quaint mantle
#

I mean it's better than just looking at stuff and not understanding anything.
He has to start somewhere and learn somehow.

quaint mantle
tardy delta
#

and not even talking about Unsafe or Runtime class

quaint mantle
#

I didn't say that he's the best.

tardy delta
#

i learnt all my shitty code from codedred

quaint mantle
#

Coz maybe I haven't watched much of spigot tutorials and that the only one I know ?

kind hatch
#

Smh, none of yall every watch thenewboston?

tardy delta
#

no

kind hatch
#

๐Ÿ˜ข

tardy delta
#

looking thro gh repositories is far more useful in my eyes

kind hatch
#

Make them hold different data. Or make them execute different commands.

quaint mantle
#

Would anyone help me on overriding the existing /msg command?

#

It used to work with just a regular CommandExecutor before, but not anymore.

kind hatch
#

CommandPreProcessEvent?

tardy delta
#

dont plugin command basically override vanilla commands?

kind hatch
#

For the most part yea.

tardy delta
#

i saw essentials doing it, and the only way to call the vanilla one was calling /minecraft:give

delicate lynx
#

they will override /msg, but /minecraft:msg is there

kind hatch
#

Makes sense though

quaint mantle
#

Well it wont override the existing command.

#

I mean the /minecraft:msg will still be there as you said.

#

But it used to working with just a CommandExecutor class before, but it doesn't work anymore.

kind hatch
#

You registered the command and defined it in the plugin.yml?

quaint mantle
#

Mhm.

#

I'll try it once again but it didn't work last time.

kind hatch
#

Do you have any other plugins installed that have a /msg command?

mental frigate
#

hello guys, can someone help me with loottable?

#

i want to create loottable with 6 items

#

each of the items having different drop chance

sterile token
sterile token
#

I just realize how much rude i was

#

I just was a stressed because i couldnt find any real example about reading server packet reponses from mc protocol

elfin atlas
#

Is there a way to check if a pressure plate is pressed outside of the PlayerInteractEvent (so just checking the current state)

glossy venture
sterile token
#

And yes i have an input and output from Socket

glossy venture
#

gotta get encryption and compression sorted, and then you can check https://wiki.vg for the packet formats

#

compression is not required

#

if you just make sure to send the server to disable compression

sterile token
#

I mean i have done basic steps, Hadshake and Login, so my fake client got conneted to sever but after 1m aprox get disocnnected

#

Many ppl told me im missing keep alive packets

glossy venture
#

yeah

#

otherwise the server times you out

sterile token
#

Just to clarify im not doing a boot java program for shuting down proxys nor severs

glossy venture
#

should be the same

#

oh

#

lmao

#

ok

sterile token
#

I will use for some private project

#

related to PMC (Plugin messaging channel)

glossy venture
#

aight

sterile token
#

You know i will troll the sever

#

๐Ÿ˜‚

#

By emulating a real connection

#

Which just connect to each sever a fake client and stays connected for ever

#

Let me open the project

glossy venture
#

i made a framework for server and client networking

worldly ingot
untold patio
glossy venture
#

just need to reimplement the protocol network codec to match the minecraft protocol format

sterile token
sterile token
#

Mainly the conversions

glossy venture
#

packages?

#

pakcets?

#

you mean

sterile token
#

Yeah sorry

glossy venture
#

wdym by conversions

kind hatch
sterile token
#

They are all binary and i need to decode them, etc

glossy venture
#

yeah

#

you can make your streams into data streams

worldly ingot
#

icic

sterile token
#

Yeah i did that

glossy venture
#

then you can do shit like .writeInt(int)

#

you do that per packet

sterile token
#

But when i sout data input stream getByte() to get the packet id

worldly ingot
#

I guess because it's mostly hidden I've just not realized underlines were even possible, nor have I had any compelling reason to try it lol

sterile token
eternal oxide
#

I said before you don't sysout

kind hatch
eternal oxide
#

You readByte to get the packet info, however many bytes is required to read the packet type

glossy venture
sterile token
#

I would understand better with a simple example about reading a packets

#

But let me send what i have for now

eternal oxide
#

a Packet is not readable as a single unit. it's not like a string

sterile token
#

So we dont talk in air

sterile token
eternal oxide
#

each packet you have to break up into it's constituent parts

kind hatch
sterile token
sterile token
glossy venture
#
DataInputStream in = new DataInputStream(socket.getInputStream());

// read packets
while (socket.isOpen()) {
  // read packet type
  byte type = in.readByte();

  // switch type
  switch (type) {
    case 69 /* hello world or something */ -> {
      // read utf string
      String str = in.readUTF();
      System.out.println("Received 69: " + str);
    }

    default -> continue;
  }
}
``` @sterile token
#

you need to read more data based on the type

sterile token
#

I need to decode that in.readUTF() right?

glossy venture
#

this should work

#

not for minecraft

#

but general packet reading

eternal oxide
#

You are getting there. you just have to break up the packet more once you know what type it is

glossy venture
#

might have to handle encryption

sterile token
#

oh ok

#

I mean encryption is optional

#

To what i read

worldly ingot
#

Sure, but I believe it's enabled for all online mode servers

eternal oxide
#

eg the keep alive packet is a ping packet (I think)

#

so it contains one Long

sterile token
#

Elgarl

sterile token
#

Just if you didnt see it

eternal oxide
#

I did

sterile token
#

Oh ok

eternal oxide
#

pretty sure teh keep alive isn;t a varInt though

sterile token
#

I need to liste for ping packet push and answer it on the fake client

peak depot
#

how can I get the owner if for example the entity is an arrow / trident in EntityDamageByEntityEvent

sterile token
#

What should i first decode? I have setup the DataInputStream

eternal oxide
quaint mantle
#

Anyone here from germany that uses Vodafone and knows how to IP Forward ?

#

I'm having issues with my IP not being forwarded

eternal oxide
#

For the keep alive read teh packet description I linked.

#

The server send it to the client at intervals, you need to reply with the same packet payload

sterile token
#

0x20 -> Should be convert into int right?

eternal oxide
#

its a Byte

tardy delta
#

thats just a hexadecimal representation of 20

sterile token
#

ok

floral mantle
#

Hello everyone again, I have a small question. How can I set a speed of particles? I have a code like this and Intellij doesn't show me anything related to speed in this function?

attacked.getWorld().spawnParticle(Particle.SMOKE_NORMAL, attacked.getLocation(), 50, 0.25, 0.25, 0.25);
sterile token
floral mantle
#

i also checked some youtube videos

sterile token
#

oh ok

floral mantle
#

if you have arrow object

#

like Arrow arrow = ...

tranquil dome
#

How can I find out whether a potion is a splash potion or drinkable potion (1.8)

#

For itemstacks ^

peak depot
sterile token
eternal oxide
#

yes

floral mantle
eternal oxide
#

be sure to send that long back to the server as your keep alive packet

peak depot
sterile token
eternal oxide
#

I've not used netty

sterile token
#

Ok i ask because is what bungee and spigot use for NET

eternal oxide
#

I guess it all depends on how my protocol you are looking to implement

#

if it's just a little then stick with java sockets

floral mantle
eternal oxide
#

its a TCP connection so very simple

peak depot
sterile token
#

I mean let me explain you my idea and you told me if its small or something really big. I mainly trying to emulate fake connections for using Pluging Messaging Channel without players

eternal oxide
#

It won;t work I'm afraid.

#

the server will not take any action on a PMC message if no players are online

sterile token
#

I will literally emulate fake connections which are real clients

eternal oxide
#

I thought you were just trying to create a fake connection to do something like monitoring.

sterile token
#

Oh no, i mean im trying to make it for PMC (Plugin Messaging Channel, just to short it)

eternal oxide
#

oh I see

#

you are creating a fake client connection to force PMC to be active

#

nice idea

sterile token
#

Yeah

elfin atlas
#

Does someone know why I'm getting this error when I'll try to cast BlockData to Powerable

java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftPressurePlateWeighted cannot be cast to class org.bukkit.block.data.Powerable (org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftPressurePlateWeighted and org.bukkit.block.data.Powerable are in unnamed module of loader java.net.URLClassLoader @25f38edc)
public static void check(Player p, BlockData data) {
Powerable plate = (Powerable) data;
}

I see no problem in the code.

sterile token
#

That why im being really ass-hol with the protocol

tardy delta
#

isnt it blockstate?

#

check docs

elfin atlas
#

BlockData

eternal oxide
#

in that case just stick with java sockets

sterile token
tardy delta
#

nope blockdata i see

eternal oxide
#

you pretty much only need to connect and keep alive

sterile token
#

I thought i need something else for them working

#

Mainly a packet

eternal oxide
#

are you wanting to send a PMC message to the server from your fake client?

hasty prawn
hazy parrot
elfin atlas
hazy parrot
#

If you look at the error

#

Nd that won't work

#

As pplate isnt powerable

elfin atlas
#

Its a pressureplate that gets pressed

sterile token
elfin atlas
sterile token
#
Client FakeClient has been connected to ....
Keep alive: -4012685007291559508
Keep alive: 5667363623437616032
Keep alive: -8285215939478023833
Keep alive: 8126511915762176
Keep alive: -2376493228367933081
Keep alive: 2161727821172533093
Keep alive: -2664723604519644825
Keep alive: 15998686113536
Keep alive: 4539628424424154981
Keep alive: 6012716073026322447
Keep alive: 8797284204544
Keep alive: -6627891276605681305
Keep alive: 19755289338112
Keep alive: 8092422760333824
Keep alive: -4610560118520409753
Keep alive: 8058342194840064
Keep alive: -6844064058719465113
Keep alive: -6411718494491897497
Keep alive: 6012716073026322447
Keep alive: 8797284204544
Keep alive: -6051430524302257817
Keep alive: -8934297235772796569
Keep alive: 13942470524672
Keep alive: -1440025980851580569
Keep alive: -4610278643543699097
Keep alive: -6339660900453969561
Keep alive: -3627120685966346102
Keep alive: -6716586487775150045
Keep alive: 8026184208948808119
Keep alive: -1850490519057384017
Keep alive: 7591839249313026556
Keep alive: 2025017085546653857
#

Thats my sever output Elgar

eternal oxide
#

If I were you I'd just do it as a plugin on each server that connects a fake client via localhost

hazy parrot
eternal oxide
#

By having that single client always connected it will keep PMC active

sterile token
#

Atleast happen what should

#

I put it the keepAlive() method on a while and finally timed out because i never answer it

eternal oxide
#

yes, you are being disconnected because you are not responding to the keep alive packet

sterile token
#

Elegar i just write the long as a long back to sever right?

eternal oxide
#

yes

#

in a keep alive packet

sterile token
#

so sending the packet id + sever reponse right?

eternal oxide
#

yes

sterile token
#

[20:08:03 INFO]: FakeClient lost connection: Internal Exception: io.netty.handler.codec.DecoderException: Badly compressed packet - size of 20 is below server threshold of 256

#

Hahaha

#

I need to serialize it i suppouse?

eternal oxide
#

you should be using a single stream

#

then use a switch on teh first readByte

sterile token
#

Hmn

#

Single stream?

eternal oxide
#

you open one connection to the server over TCP

sterile token
#

Yeah

eternal oxide
#

then just listen for data

sterile token
#

Hmn messed up

#

Sorry

tardy delta
sterile token
tardy delta
#

๐Ÿ‘

eternal oxide
#

0x indicates it's a Hex value

tardy delta
#

ye ik that

eternal oxide
#

so 0x20 = 32 decimal

tardy delta
#

oh ye right i forgot how to make conversions

#

only learnt a month ago and i already forgot smh

sterile token
#

Elegarl

#

In confused to send the packet back and what you tell me about "you should be using a single stream"

tardy delta
#

is this netty that youre using?

sterile token
#

I using plain sockets

#

Because its not a big project to use Netty

tardy delta
#

what are you making?

sterile token
sterile token
tardy delta
#

nice nice

sterile token
#

Do you whats for

#

Im trying to trick PMC

#

๐Ÿ˜‚

tardy delta
#

doesnt that require a whole protocol impl?

eternal oxide
#

nope

sterile token
#

Just some packets

tardy delta
#

i dont know any of this so dont really know

sterile token
#

Because it wont do anything

#

lgarl could you help me again?

#

I didnt understand hat you mean

eternal oxide
#

just login, keep-alive and ping

sterile token
#

Sorry tho

#

I cannot understand what you mean

#

The other packets are wrong made?

eternal oxide
#

It looks like you are using a single stream so thats fine

sterile token
#

ok so what i need to change?

eternal oxide
#

but I'm not sure how you are calling your keep alive

#

are you just repeatedly calling it once you have sent the login?

sterile token
tardy delta
#

so just continuously responding with 0x20 and then sending the read long back

#

arent you blocking your socket with that?

sterile token
#

Im not sure

#

I always have socket block problems

tardy delta
#

put code behind that keepalive and youll see (ig it blocks)