#help-archived

1 messages ยท Page 48 of 1

tranquil rampart
#

no

keen compass
#

what does your startup script look like then

tranquil rampart
#

can i dm u wwith ss?

keen compass
#

going to assume this is windows

#

sure

marsh hawk
#

is the horse jump bar client side or can i manipulate it?

wooden harbor
#

Hello, I have a question pertaining about a certain plugin on the Minehut server, Plugin is called "Prism" and is not working although it shows green when I try to see if it's installed but for some reason the commands will not work?

sharp mauve
#

use core protect

frigid ember
#

by the way i would recommend not buying plugins from Demeng his staff team is toxic and they are banning lots of costumers that need help.

vale slate
#

your plugin config is corrupted

frigid ember
vale slate
#

the "Example:" is wrong tabbed

frigid ember
#

wdym

keen compass
#

prism is no longer maintained as far as I am aware

inland meteor
vale slate
#

there is one space to much at line 29 I think

frigid ember
vale slate
#

uhm could you send the new config?

frigid ember
#

those are the error message in console and the cocnfig

vale slate
#

try this one

frigid ember
#

@vale slate waw ty ๐Ÿ˜„

#

it worked tho

vale slate
#

Well then, have fun!

frigid ember
#

ty ๐Ÿ˜„

#

Hi, I changed the values to lose less food but I'm still losing as much, any idea?

`hunger:
  walk-exhaustion: 0.1
  sprint-exhaustion: 0.1
  combat-exhaustion: 0.1
  regen-exhaustion: 0.1`
#

i think 0.1 is too much

vale slate
#

Hi, I changed the values to lose less food but I'm still losing as much, any idea?

`hunger:
  walk-exhaustion: 0.1
  sprint-exhaustion: 0.1
  combat-exhaustion: 0.1
  regen-exhaustion: 0.1`

@frigid ember could you give us a little more information

frigid ember
#

I want to make sure that on my server, we slowly lose the food (in all possible situations). However, in this case, I am losing food much too quickly.

#

if u want to not lose food at all set to 0

vale slate
#

where have you set that and please send the complete file

frigid ember
#

@frigid ember read correctly my message please.

#

hey, no need to be pissed i just offered something, in case you are a PvP server

ripe niche
vale slate
#

obviously you have no var named matchingBlockTriggers defined

#

@ripe niche

ripe niche
#

@vale slate I do, as shown in the screenshot. The same variable that got the issue was used multiple times before that.

vale slate
#

could you send the whole class on

#

?paste

worldly heathBOT
quasi seal
#

does someone know how to make a citizens npc damageable ?

ripe niche
#

Yeah, give me a minute

#

It's erroring on line 61

ripe token
#

guys

#

someone know

#

how i regen my skyblock island every 5m (auto)

visual walrus
#

@quasi seal i think /npc gamemode survival

quasi seal
#

With the api I mean

rigid nacelle
#

@ripe niche I recommend you take a look at implicit else.

ripe token
#

?? how i regen my skyblock island every 5m (auto)

vale slate
#

?ask

worldly heathBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

ripe token
#

yes

#

i ask

ripe niche
#

@rigid nacelle How would that help my issue..?

#

@ripe token Then don't keep asking

quasi seal
#

@visual walrus do you have any idea ?

ripe token
#

but someone can help me?

vale slate
#

You have a very nested lambda structure

ripe token
#

its save my server

vale slate
#

@ripe niche

ripe niche
#

@ripe token They will get to you when they can.

rigid nacelle
#

@ripe niche It would help your code in general.

ripe niche
#

@rigid nacelle I mean, that's opinionated, but

#

ยฏ_(ใƒ„)_/ยฏ

rigid nacelle
#

Not really. It reduces cognitive complexity and you save lines.

ripe niche
#

@vale slate Nature of my plugin calls for such unfortunately.

quasi seal
#

Found it by decompilation, it's the GameModeTrait

vale slate
#

Lambdas have some features you need to be aware of

#

They are not working exactly like for loops

ripe niche
#

I'm used to C# coding, and I remember Java being different when it comes to lambdas, I'm sure there's something I missed.

vale slate
#

Well I need to define all your methods to recreate the error, could take a second

ripe niche
#

It's 5 am, I need to be heading to bed. Thanks for the help anyway, tonight.

#

I could give you the source tomorrow, if you're up to still help me by then. It's open source anyway

vale slate
#

kk

#

gn

#

?? how i regen my skyblock island every 5m (auto)
@ripe token Are you looking for a plugin or about to create one?

frigid ember
#

@ripe token Are you looking for a plugin or about to create one?
@vale slate i thimk he dont mean any of these 2

#

he asks like how to do it

vale slate
#

Then he/she should be a little more precise

frigid ember
#

true

versed forge
#

anyone know hhow to make a .structure file for 1.15.2

worldly heathBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

hollow thorn
#

you use structure blocks

#

or you can use the structure api in bukkit

versed forge
#

yh that does it as a .nbt

#

i need it as a .structure fule

ripe token
#

@ripe token Are you looking for a plugin or about to create one?

#

yes

vale slate
#

to which one? @ripe token

frigid ember
#

seems like i was wrong

ripe token
#

idk

#

i need good plugin

#

i just want

frigid ember
#

someone with nms experience

#

why does that not work

ripe token
#

regen my skyblock island auto

frigid ember
#

no console errors

ripe token
#

every 10m

frigid ember
#

just it quits

#

once i initiate that class, the function im calling exists

#

no console error

#

idk why

vale slate
#

I'm looking at it trooper

frigid ember
#

ty

#

thats just a snippet

vale slate
#

It's often a problem, bc NMS has no logging system

frigid ember
#
e.getPlayer().sendMessage("preee");
            e.getPlayer().sendMessage("is null: " + (e.getPacket() == null));
            WrappedPacketPlayInUseEntity packet = new WrappedPacketPlayInUseEntity(e.getPacket());
            e.getPlayer().sendMessage("post");```
#

thats my code

hollow thorn
#

@versed forge have you tride using a transformer

frigid ember
#

e.getPacket() aint null

#

"post" is never

#

sent

versed forge
#

no idk what that is @hollow thorn

hollow thorn
#

something like mp3 to mp4

#

but for your files

#

converter

frigid ember
#

@vale slate hows it?

#

still looking?

vale slate
#

It'll take some time, as i need to look what exactly this package does on the client side

versed forge
#

@hollow thorn cant find any for it ive searchded

#

thats why im confised

hollow thorn
#

i cant find the structure format

vale slate
#

@frigid ember what are you trying to do with playInPackets?

versed forge
#

dw found out my dev my it

hollow thorn
#

do you mean .schem

frigid ember
#

listen

#

i want to access the entity in PacketPlayInUseEntity

#

for example

#

and support 1.8 -> 1.15

#

the version part works

#

no console logs

#

or errors

#

so its hard

#

to know whats wrong

hollow thorn
#

WrappedPacketPlayInUseEntity packet = new missing a ;

frigid ember
#

?

vale slate
#

nms jokes

hollow thorn
#

oh sorry i got onfused by the newline

frigid ember
#

mfm

#

what is it

hollow thorn
#

also the is null doesnt show

frigid ember
#

??

#

just stop euan

#

lmao

#

stop it

#

you arent helping euan

#

sorry fam

hollow thorn
#
e.getPlayer().sendMessage("preee");
            e.getPlayer().sendMessage("is null: " + (e.getPacket() == null));
            WrappedPacketPlayInUseEntity packet = new WrappedPacketPlayInUseEntity(e.getPacket());
            e.getPlayer().sendMessage("post");```

@frigid ember "is null: " doesnt seem to show in chat

frigid ember
#

thats old pic

hollow thorn
#

oh

frigid ember
#

im not gonna make a new one

vale slate
#

How do you catch the packets?

frigid ember
#

its not the listening part

#

i said

#

fi i remove the packet variable

#

it works fine

#

and "post" is called

#

????

#

its no syntax error kid

vale slate
#

and what is in the WrappedPacket, because this is not a NMS class

frigid ember
#

ik

#

i made it

#

??

#

its no syntax error

#

Wrapped.... is the class

#

the function i sent u

#

is inside

#

that class

hollow thorn
#

mabye try sending the class

vale slate
#

you sent me a If else line

frigid ember
#

that was ina func

#

that was in the clas

#

yk what fuc it

#

pece

vale slate
#

because obviously it hangs up in the constructor

frigid ember
#

no

#

it doesnt

#

i said fuc it

#

i sorta figured out myself and it wasnt cause of constructor

#

those classees i imported dont exist

#

i need a new class wrapper

quasi seal
#

The command /npc gamemode survival doesn't make the npc damageable

#

:/

frigid ember
#

ยฏ_(ใƒ„)_/ยฏ

formal nimbus
#

Hey, I need someone to explain to me PersistentData

#

I'm trying to make a unique identifier for items with special effects

#

and was told I should use PersistentData

#

this is what I have so far

#

I'm doing this to check

#

However, it doesn't seem to be working

#

I don't think I understand PersistenData or the NameSpaceKey

#

I've looked for a tutorial on it, or documentation explaining how it works

#

but I've struggled to find anything

#

also, is this static abuse? I couldn't seem to get any results without using static

#

Any help would be appreciated ๐Ÿ™‚

fleet crane
#

Yes you can't keep changing the key variable

#

Perhaps you need two key variables

tiny dagger
#

md, a buyer's account was stolen from him by one of his staff

#

would he be able to get it back?

fleet crane
#

Only if he owns the email used to register it

tiny dagger
#

oh yeah he does

#

i redirected him to tmp-support

#

he showed me paypal transaction and all that

granite cedar
#

@fleet crane I'm in the same society as you

frigid ember
#

oof

#

iont kno why my name always changes back man

hoary parcel
#

You are destined to be called retroope

#

R

celest garden
#

Hello, do you know any plugins to fast sell items in gui?

formal nimbus
#

@fleet crane ahh, so I need to create a new key for each item. That makes sense

frigid ember
#

my name keeps changin

red bolt
#

yo boys

#

i need some advice

#

do you think the mine academy course is worth purchasing ?

fading frost
#

what is the mine academy course

red bolt
#

its a course for development

fading frost
#

link?

red bolt
#

it costs $97 thats why im asking

fading frost
#

yikes

#

no

red bolt
#

im debating whether or not to purchase this

fading frost
#

Do you already know java

red bolt
#

yeah

#

a little bit above basics

frigid ember
#

nah dont do that

fading frost
#

even less reason to do this

frigid ember
#

dont learn from that

#

are u crazy

#

lmao

#

there are good enough or same level tutorials on yt

#

for free

red bolt
#

idk, it seems to have all scattered resources into one

fading frost
#

yt tutorials are also shit mostly

subtle blade
#

I don't usually recommend that course

red bolt
#

tried decompiling spigot to read the classes

#

didnt understand much

subtle blade
#

It's open source

red bolt
#

and i went and played wow

fading frost
#

The spigotmc wiki explains everything you need to know to get started and there are many free java courses

subtle blade
#

Spigot's wikis, Oracle's documentation. Really, lots of free resources that will do you significantly better

vale slate
#

^

fading frost
#

these courses are very nice and highly recommendable, in particular the first and the last one

red bolt
#

i dont think i need more java knowledge tbh

subtle blade
#

I've heard good things from Codecademy as well, though never used any courses myself

red bolt
#

maybe streams and features

#

and lambdas perhaps

#

future*

subtle blade
#

Those are syntax sugar and you don't really need them until you get into more advanced things

fading frost
#

it's something you certainly should tackle, but it's not part of the very basics

red bolt
#

i know the very basics

fading frost
#

mooc.fi is a good course from a university to learn object oriented programming

frigid ember
sturdy oar
#

sololearn is meh

fading frost
#

hyperskill is good for all people as they give you actual projects

formal nimbus
red bolt
#

do i have to practice algorithmic logic to get better with making plugins ?

formal nimbus
subtle blade
#

You're passing null to PersistentDataContainer#has()

#

GodBoots. It's null

sturdy oar
#

oh hecc that dark mode

formal nimbus
#

but it's not???

subtle blade
#

Mmmm the error says otherwise

formal nimbus
fading frost
#

do i have to practice algorithmic logic to get better with making plugins ?
Just follow a course

#

You don't have to view all the dry stuff separately

#

Once you start building stuff it'll come automatically

subtle blade
#

That key should be created on the spot, not conditionally on method call

#

It should be constant. private static final NamespacedKey GOD_BOOTS ... etc ...

formal nimbus
#

but then how do I reference it in the event handler?

#

if it's private?

#

oooh wait

subtle blade
#

Don't ask me. You have it private already lol

formal nimbus
#

yeah but it#s outside the method

#

it's prviate to the class

subtle blade
#

Yes

formal nimbus
#

*private

#

event handler in same class

#

but if I make it in the method

#

and make it private

#

then it won't be accessible by the event handler?

subtle blade
#

Yea, it wouldn't be a field. Just instantiate that field inline. No reason to do it in the method call. It's constant

#

By the point your playermoveevent was called, you have not yet called getItem("GodBoots")

formal nimbus
#

ah

#

OOOOOH

subtle blade
#

(not to mention creating an ItemStack every time PlayerMoveEvent is called isn't the best idea)

#

That IS should be constant as well

formal nimbus
#

I'm so dumb

#

that makes sense

#

thanks

subtle blade
#

o/

late tangle
#

I've created some HolographicDisplay placeholders, however they don't seem to get updated on my holograms until I do /hd reload. Any ideas?

dusky herald
#

Server: creates 1000 ItemStacks every 2 seconds

subtle blade
#

(not to mention creating an ItemStack every time PlayerMoveEvent is called isn't the best idea)
That IS should be constant as well

fading frost
#

the gc is bored it's fine

subtle blade
#

Yea. Lazy bastard. Just leaves all its garbage right until the very end. Put that guy to work!

formal nimbus
#

@subtle blade so if I create an item in a method, should I just run that method in onEnable()?

#

therefore it's created when the plugin is started

#

and then after than, I can just reference the item using method().item

subtle blade
#

Ideally you'd create an in-line constant for it as well using an ItemBuilder. There are some utility classes on the forums to help build items

formal nimbus
#

could I have a link?

subtle blade
#

There are plenty. You can pick among them. Do a Google search for site:spigotmc.org item builder and you'll find a few

formal nimbus
#

ok ty ๐Ÿ˜„

dusky herald
#

I'm just curious, since I havent worked with Spigot API for a few years

subtle blade
#

I have one of my own as well but don't think it's on the forums. In a few of my projects on GitHub you're welcome to use. Up to you

formal nimbus
#

๐Ÿ‘Œ

dusky herald
#

does the PersistentDataContainer still retain the data (aka store it in the world map or w/e) after server restarts etc

subtle blade
#

Yes

#

That was the goal was to interface over NBT

dusky herald
#

Noted, thanks

formal nimbus
#

I'm really confused on how to use persistent data tbh

#

I was told I could use it as a unique item identifier

dusky herald
#

You could

subtle blade
#

Yep. That's fine

formal nimbus
#

and have been trying to figure it out for a week lmao

dusky herald
#

There's other ways you could approach it too

formal nimbus
#

haven't found much documentation

subtle blade
#

It's mostly newer but there was a guide on it iirc

dusky herald
#

but seems like that would be best if you want that data to remain "persistent".

formal nimbus
#

I was originally trying to use custom nbt tags

subtle blade
#

That's pretty much what it is

formal nimbus
#

cause that's something you can do with vanilla command blocks

#

so I assumed that you could use spigot to give an item a custom nbt tag

#

which you could then look for

#

but apparently you can't

subtle blade
#

You can. PersistentDataHolder does exactly that

formal nimbus
#

are they the same thing?

subtle blade
#

It just wraps all that NBT under a Bukkit namespace

dusky herald
#

He just said PersistentDataContainer interfaces NBT lol

#

๐Ÿ˜„

formal nimbus
#

wfhwoguwguwegwe

dusky herald
#

Seems like they are the same thing, just one is an API

subtle blade
#

You could do /give @p diamond_sword{"Bukkit":{"myplugin:key":4}} and persistent data could be fetched using get(new NamespacedKey(plugin, "key"), PersistentDataType.INTEGER)

#

(I think that's the format, something close to that if not)

formal nimbus
#

right..

subtle blade
#

PersistentDataContainer just doesn't allow you to interact with vanilla NBT because that should all be encompassed by ItemMeta

dusky herald
#

Sounds great to me if you dont have to deal with manually storing the data

formal nimbus
#

why do you need the integer on the end though?

dusky herald
#

Probably an index of reference

formal nimbus
#

isn't enough to just have the plugin name and key?

subtle blade
#

To tell it what type it should return

dusky herald
#

oh wait

#

yeah

subtle blade
#

NBT doesn't hold type with the data

#

You have to tell it what it is in code

formal nimbus
#

ah

#

I see

subtle blade
#

You could probably call PersistentDataType.STRING and it would return "4"

#

You could probably call PersistentDataType.STRING and it would return "4"

sage flint
#

I just sat on a bank in the park, now my butt hurts. Any advice?

#

Sorry ๐Ÿคช

tiny dagger
#

walk?

gaunt fern
#

Is there a way to get ahold of Spigot 1.16 snapshot versions?

subtle blade
#

No

gaunt fern
#

alrighty thanks

subtle blade
#

Wow that was easy

#

Usually people argue with me lol

gaunt fern
#

why would I?

dusky herald
#

"Nah you dont know what you're talking about"

#

"Spigot staff sux nuts"

gaunt fern
#

you obviously know what you are talking about, and I was just asking politely to see if there was, but fair enough. Understandable

#

keep up the good work :P

dusky herald
#

You typically get people who are like, there has to be SOME way for us to get the 1.16 snapshot versions!

sage flint
#

walk?
Good point

#

Thx

subtle blade
#

But I NEED it!

gaunt fern
#

XD, I was mainly wanting to test it with my plugins and my server to see how it runs etc but its done when its done i suppose :)

subtle blade
#

It's more than likely that a majority of your plugins will work fine so long as they're using the API, not some hackery to support like... 8 versions in one

gaunt fern
#

great, glad to hear. Thanks for your assistance!

subtle blade
#

o/

dusky herald
#

Damn Choco

#

an actual appreciation

#

grats

#

๐Ÿฐ ๐Ÿฅณ

gaunt fern
#

I always appreciate help if it is given, i dont get these whiney kids going on. Its not like moaning will get it anywhere

subtle blade
#

PepeLOVEEEEEEE Decent people

#

It's great. I like people like you

gaunt fern
#

tis only polite

radiant pollen
#

Yeah, don't make politeness a big deal.

#

We have to normalize it.

#

loool

gaunt fern
#

I can help normalise it

#

one way or another >:)

frigid ember
#

true

sacred wave
#

Hi, does Player#getKiller take in account Arrows? So if I shoot a player, will this return me or null as the killer was Arrow?

#

or Tridents and other Player launchable entities...

median hill
#

i have a problem about the comand blocks being activated, i set it true in server properties and put it at the bottom of the list, but it keeps going up the list once i reload the server and still dont work.

sacred wave
#

@median hill try actually stopping the server, try to open the config after the server has been stopped and set it, then start the server...

median hill
#

@sacred wave i will try thank you

granite cedar
#

Hey i have a list of minecraft usernames i need to sort alphabetically

#

with numbers first any ideas?

fading frost
#

Just sort them by natural order

#

I.e. Collections.sort(names)

sacred wave
#
            = Arrays.asList("Aman", "Kajal", 
                            "Joyita", "Das"); 
  
        System.out.println("Before sorting:"); 
        stringList.forEach(System.out::println); 
  
        stringList.sort(Comparator.naturalOrder()); 
        System.out.println("\nAfter sorting:"); 
        stringList.forEach(System.out::println); ``` something along this way I guess
fading frost
#

Comparator.naturalOrder() is redundant when using the util method, but yeah that's the same thing

granite cedar
#
public List<String> sort(List<String> usernames) {
         usernames.sort(Comparator.naturalOrder());
    }```
#

o:

sacred wave
#

Your method does not need to return anything

#

as List's sort modifies the list itself...

granite cedar
#

ohh so it doesnt produce a new list ?

sacred wave
#

nope

granite cedar
#

ok cool now heres the thing

sacred wave
#

you need a new list?

fading frost
#

names.stream().sorted().collect(Collectors.toList())

#

Now you got a new list

hollow thorn
#

how does one load a structure file

#

from the src

granite cedar
#

im making a friends list. friends are stores as uuids, im getting the player names from the uuids in a database. then im sorting the names alphabetically and then adding them to an open gui. on issue is to create the player heads in the gui i need to include the uuid for each name somehow

fading frost
#

Use OfflinePlayers

#

Not just their names

granite cedar
#

example?

fading frost
#

Bukkit.getOfflinePlayer(uuid)?

granite cedar
#

what if fetching a player off uuid who never joined the server

fading frost
#

How would they be in your database then

#

Also how do you get the user name now

granite cedar
#

mini games network

#

from sql

fading frost
#

Wouldn't that be the same problem

granite cedar
#

bukkit.getofflienplayer is to get a player on that individual server

#

if players are friends

#

and one never joined the server their friend is on

#

and their friend tries bukkit.getoffline

#

that wont work

#

guess ill do a <username, uuid> map

#

Map<int, Map<username, uuid>>

fading frost
#

Bukkit.getOfflinePlayer is to get a player on that individual server
Wrong

granite cedar
#

so how does it work?

fading frost
#

It makes an api request if the player is not online

granite cedar
#

but isnt that rate limited?

fading frost
#

Yes

granite cedar
#

so then thats not a smart idea

#
public static List<Map<String, UUID>> getFriends(){
        
        return null;
    }```
#

im thinking something like this

runic wadi
#
@Override                                                     
public boolean equals(Object o) {                             
    if (this == o) return true;                               
    if (o == null || getClass() != o.getClass()) return false;
    User user = (User) o;                                                                             
    return Objects.equals(player(), user.player());           
}                                                             

does this look sound for a player wrapper class

fading frost
#

How do you want to get the player head otherwise

runic wadi
#

player() is weakreference of player's get method

granite cedar
#

im not concerned about getting the player head

#

ugh

fading frost
#

You sure? You got the same problem there

granite cedar
#

ill code and then you review brb

subtle blade
#
public static List<Map<String, UUID>> getFriends() {
    return null;
}```
Wow if that isn't relatable, I don't know what is
fading frost
#

lmfao

#

Not even an empty list

granite cedar
#

just wait watch my magic

fading frost
#

You're so unimportant it doesn't even bother to allocate a list for your friends

runic wadi
#

return Collections.emptyList()

tiny dagger
#

throw new Exception("Yup, still empty");

runic wadi
#
    public Player player() {
        return player.get();
    }

java bean syntax OUT. record syntax IN

#

no more getPlayer

#

now it's just player() OOOOOH

#

it feels so nice

#

wait... how do you do setters with this syntax? overloads? LOL

#

fascinating

sacred wave
#

Hi, does Player#getKiller take in account Arrows? So if I shoot a player, will this return me or null as the killer was Arrow?
@sacred wave Ok, in case anyone wondered, it is actually pretty smart, getKiller is returned even if Player was pushed to lava by some other player... awesome!

runic wadi
#

what how does it know

#

genius

dusky herald
#

@granite cedar using SQL?

tiny dagger
#

is getKiller in the bukkit api?

granite cedar
#
public List<HashMap<String, UUID>> getFriends(aPlayer ap){
        Map<String, UUID> map1 = new HashMap<String, UUID>();
        List<String> names = new ArrayList<String>();
        for(UUID uuid : ap.getFriends()) {
            String name = SQLUtils.getString("Players", "UUID", uuid.toString(), "name");
            map1.put(name, uuid);
            names.add(name);
        }
        names = sort(names);
        List<HashMap<String, UUID>> fin = new ArrayList<HashMap<String, UUID>>();
        for(String name : names) {
            ??
        }
        return fin;
    }
    
    public List<String> sort(List<String> usernames) {
         usernames.sort(Comparator.naturalOrder());
        return usernames;
    }```
dusky herald
#

@granite cedar you're storing player friends in a MySQL database, then just pull the UUIDs when the player logs in and store their friends list in their player class

granite cedar
#

confused by the arrow

subtle blade
#

Yes it does, Fr33, and yes it should take arrows into account, Dawon

granite cedar
#

@dusky herald already do that

subtle blade
#

It's the same value that determines whether the death message includes "by <player>"

fading frost
#

Your sort method is redundant

subtle blade
#

i.e. "<killed> was shot by <player>"

fading frost
#

Just use Collections.sort

dusky herald
#

Those are called shift operators

#

when you use >> >>> etc

runic wadi
#

class name aPlayer

#

oh no

granite cedar
#

look this will work if i can just fix where the ?? is

#

i think

sacred wave
#

@subtle blade awesome, thanks, I just tried it just to be sure, that will simplify my code a lot!

fading frost
#

Why do you return a list of hashmaps, don

tiny dagger
#

but does it work at on damage event? ๐Ÿค”

granite cedar
#

I need this return list for when i produce the friends in a gui

subtle blade
#

No because damage events are fired before death

tiny dagger
#

dang it

#

seemed cool

granite cedar
#

the map will provide the itemstack create method with the uuid and name

dusky herald
#

@runic wadi He should be a pro, and just call it Player ๐Ÿ˜†

subtle blade
#

There you can getDamager(), and in PlayerDeathEvent you have PlayerDeathEvent#getKiller()

dusky herald
#

just kidding

fading frost
#
  1. HashMap is not the type for that. You want to make a class that contains UUID and name
  2. Creating the player head requires an OfflinePlayer anyway. Why don't you just use that directly
tiny dagger
#

oh

#

so there is a damager too

#

nice

#

was it in 1.12?

#

๐Ÿค”

sacred wave
#

@subtle blade actually there is not getKiller in PlayerDeathEvent... I need to get it via getEntity...

tiny dagger
#

yeah dawon

#

that's the whole point

runic wadi
#

I am releasing a question:

Why would I not want to use a global static variable for something like a list of channels or regions that exists for the entire runtime?

subtle blade
#

Oh there isn't. Strange. Well, Entity#getKiller() would work at least

sacred wave
#

but that is easy enough, so not a problem at all...

granite cedar
#

you can just use entity damage event

#

to check for on death then get the causes

fading frost
#

@runic wadi idk, why wouldn't you?

sacred wave
#

actually Entity does not have it either...

#

it is under Player i guess...

granite cedar
#

you get who last damaged the player from entity damage event when you check if health is < 0

dusky herald
#

@runic wadi There's no problem with making a global static variable, it's just frowned upon because sometimes people use them too extensively, or when they really dont need to.

granite cedar
#

if its a projectile you get the shooter and check if player

dusty topaz
#

The reason you should make it private and have a getter is incase you want to modify functionality

#

By having a public static field

#

You cannot control or change the return

runic wadi
#

I mean I could make it a field of a channel or region manager singleton, but it's still accessed statically

dusty topaz
#

whereas if you want to change functionality down the line with a getter you can

sacred wave
#

Don, I know that, I was just wondering if the getKiller is not a simpler solution and it is and it covers even more cases, so ... ๐Ÿ˜„

runic wadi
#

okay I am about to use global state

#

hold onto something stable

dusty topaz
#

if you know it's not going to change then it's not that bad to do it

sacred wave
#

oh getKiller is under LivingEntity... not a Player...

dusty topaz
#

but it's just easier to have a getter if you might need to change it down the line

sacred wave
#

makes sense I guess..

runic wadi
#

well I could have a static getter instead

#

it's still backed by a private static field

dusty topaz
#

is it for a singleton object?

fading frost
#

That doesn't make much of a difference

runic wadi
#

I just don't see the reason to use a singleton

#

why is a singleton containing a list better than a class containing a static list

dusty topaz
#

incase you want to return a different list based on something later

#

you can control what a getter returns

fading frost
#

Global state shouldn't be mutable, that's all

dusty topaz
#

you can't control what a public field returns

trail zephyr
#

can I show ItemStack on hover event without touching NMS?

dusty topaz
#

yes

runic wadi
#
private static List<String> shrimps = new ArrayList<>();
public static List<String> shrimps() {
    return shrimps;
}

this gives me control of what is returned

prisma basin
#

hello i have plugin to ban player on bungecoord how to remove form tab sugestion /ban for normal player ?

dusty topaz
#

yeah, because in there you could return new ArrayList(); instead if you really wanted

runic wadi
#

that is not a singleton

#

so why a singleton

dusty topaz
fading frost
#

That doesn't really give you control

dusty topaz
#

it isn't a singleton because it's not your own object

#

you can still create more list instances

trail zephyr
#

@dusty topaz I don't understand, it doesn't say anything about showing item in chat

radiant pollen
#

@prisma basin Find a plugin that hides plugins. PluginHider or something like that.

dusty topaz
#

it very much does

#

look at events

runic wadi
#

oh yeah, it's a global list, i'm not talking about creating my own list implementation or other object

dusty topaz
#

yeah, so it's not a singleton, it's just a publicly accessible field

trail zephyr
#

@dusty topaz it just points to JavaDoc. I know about HoverEvent.Action.SHOW_ITEM, but this require JSON representation of item which is accessible only via NMS.

#

Iam asking for NMS-free way

dusty topaz
#

didn't see myself plugging minimessage but pretty sure it makes it really easy to show item

prisma basin
#

@radiant pollen but this is bungecord plugin i can't find tab completer bolker for 1.15 ๐Ÿ˜ฆ

dusty topaz
#

but you shouldn't need to use NMS with chat component api, so i'm not sure what you're looking at

trail zephyr
#

Chat-component API indeed offers a way to show item in chat, but it does not accept ItemStack, it accepts only JSON representation

prisma basin
#

hello i have plugin to ban player on bungecoord how to remove form tab sugestion /ban for normal player ?

dusty topaz
#

@trail zephyr then look into minimessage i guess

#

and kyori text

trail zephyr
#

Yeah I guess I will have to :/ thank you

dusty topaz
#

those libs are preferred by most to chat component api

#

(text is at least, minimessage just interfaces with text from strings)

prisma basin
#

all anti tab plugins have one thing in common they don't work on 1.15

granite cedar
#

is it posdsible to sort the keys of this?

#

Map<String, temp> friends = new HashMap<String, temp>();

sacred wave
#

use TreeMap?

granite cedar
#

i basically have the player name and their object in that map

#

need to sort the names by alphabet

fading frost
#

Again why do you use a map

dusty topaz
#

If you have a list of names, String is comparable

fading frost
#

And why do you not use OfflinePlayer

dusty topaz
#

So you can literally Collections.sort(stringList);

fading frost
#

This would be so much easier

dusty topaz
#

And it will order alphabetically

granite cedar
#

i need to sort a list of names yes

#

but i also have a player object attached to each name

dusty topaz
#

So do Collections.sort(list);

#

Collections.sort(myMap.keySet());

#

might need to make the keyset a list instance first

#

but you get the idea

granite cedar
#

heres what i ttempted, what do you think?

#
        Map<String, temp> friends = new HashMap<String, temp>();
        List<String> friendsNames = new ArrayList<String>();
        for(UUID uuid : ap.getFriends()) {
            temp temp = new temp(uuid);
            friends.put(temp.getName(), temp);
            friendsNames.add(temp.getName());
        }
        friendsNames.sort(Comparator.naturalOrder());
        List<temp> fin = new ArrayList<temp>();
        for(String name : friendsNames) {
            fin.add(friends.get(name));
        }
        return fin;
    }```
dusty topaz
#

You can just do Collections.sort(firendsNames);

fierce tinsel
#

does anyone know a placeholder for kills and deaths??

dusty topaz
#

and just return friendsNames

#
        List<temp> fin = new ArrayList<temp>();
        for(String name : friendsNames) {
            fin.add(friends.get(name));
        }
granite cedar
#

%kills% %deasths%

dusty topaz
#

this is pointless

#

this is returning the exact same thing

granite cedar
#

its returning the list of temp objects in alphabetical order is it not?

trail zephyr
#

Damn MiniMessage cannot show items in hover events

granite cedar
#

@sacred wave

dusty topaz
#

it is returning the exact same thing

#

you're looping through list a, adding to list b

#

that means lista.equals(listb);

fading frost
#

why did you call the class temp..

dusty topaz
#

@trail zephyr I guess he hasn't added that functionality yet - it's a new api

sacred wave
#

@granite cedar ?

granite cedar
#

because im not saving the objects anywhere

runic wadi
dusty topaz
#

should be able to just do with text anyway

fading frost
#

what

#

Also, again my question: how will you create the player heads?

granite cedar
#

@sacred wave look at my above code please

#

bruh

#

one thing at a time

fading frost
#

no

dusty topaz
#

if you're just going to ignore what I say don ยฏ_(ใƒ„)_/ยฏ

fading frost
#

This is important

granite cedar
#

i just need to get the friends list in alphebatical order

fading frost
#

Because most of what you're doing now is probably redundant

dusty topaz
#

we've told you how to do that

#

and you're still just asking the same question ๐Ÿคฆ

fading frost
#

Creating the player heads usually requires an OfflinePlayer

runic wadi
#

nvm i'm not modifying it async

fading frost
#

OfflinePlayers contain name and uuid

granite cedar
#

i know of a way to do it without that through my database

fading frost
#

and you can just get them, sort them and return them

#

how?

granite cedar
#

with my database

fading frost
#

...

#

I'm genuinely curious

dusty topaz
#

@fading frost you can create a skull with just a name

#
        ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
        SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
        skullMeta.setOwner(playerName);
fading frost
#

that... gets an offline player internally, I bet

granite cedar
#

thats deprecated

dusty topaz
#

you might be right

fading frost
#

How else would it get the texture

rigid nacelle
#

@granite cedar An identity set would probably be better in your case.

dusty topaz
#

querying mojangs api

fading frost
#

see, that's my point

granite cedar
#

mojangs api has limits which is why i use my own database for heads

rigid nacelle
#

Wrong tag.

granite cedar
#

example please @rigid nacelle

rigid nacelle
#

@runic wadi ^

dusty topaz
#
    public boolean setOwner(String name) {
        if (name != null && name.length() > 16) {
            return false;
        } else {
            if (name == null) {
                this.profile = null;
            } else {
                this.profile = new GameProfile((UUID)null, name);
            }

            return true;
        }
    }
runic wadi
#

a what

dusty topaz
#

this is 1.8 api code however

fading frost
#

and what does the GameProfile constructor do

dusty topaz
#

so things may have changed for 1.15

#

just sets the name and id

fierce tinsel
#

the placeholder %kills% and %deaths% doesnt work

fading frost
#

then it requests somewhere else

#

but it most definitely does

dusty topaz
#

yeah, i'm not seeing where it is setting the texture property either ...

#

I know this works, since I use it but now I'm confused as to if it is querying the api or just offline players

#

either way, in my case the offlineplayer will always be present so doesn't affect me too much ๐Ÿ˜„

runic wadi
#

oh I see

#

@rigid nacelle I simplified my question, I'm actually wrapping the player object so identity comparison wouldn't work

granite cedar
#
public List<temp> getFriendsObjectsInAlphabeticalOrder(aPlayer ap){
        Map<String, temp> friends = new HashMap<String, temp>();//for 
        List<String> friendsNames = new ArrayList<String>();
        for(UUID uuid : ap.getFriends()) {
            temp temp = new temp(uuid);
            friends.put(temp.getName(), temp);
            friendsNames.add(temp.getName());
        }
        friendsNames.sort(Comparator.naturalOrder());
        //now that the names are sorted we still need to return the List<temp> ordered by temps names in alphabateical order
    
    }```
runic wadi
#

it's a User containing a weak reference to a Player

granite cedar
#

explain please

runic wadi
#

colorize that shit

dusty topaz
#

Make a new List

#

And add a temp for each name

granite cedar
#

temp is the basic player object which contains data to show in the friend gui

sacred wave
#

@granite cedar I would listen to other guys here, your code looks far too complicated than it has to be...

granite cedar
#

@dusty topaz thats what i did but apparently im wrong

dusty topaz
#

it is a very inefficient way to do things

granite cedar
#
public List<temp> getFriendsObjectsInAlphabeticalOrder(aPlayer ap){
        Map<String, temp> friends = new HashMap<String, temp>();//for 
        List<String> friendsNames = new ArrayList<String>();
        for(UUID uuid : ap.getFriends()) {
            temp temp = new temp(uuid);
            friends.put(temp.getName(), temp);
            friendsNames.add(temp.getName());
        }
        friendsNames.sort(Comparator.naturalOrder());
        //now that the names are sorted we still need to return the List<temp> ordered by temps names in alphabateical order
        List<temp> fin = new ArrayList<temp>();
        for(String name : friendsNames) {
            fin.add(friends.get(name));
        }
        return fin;
    }
    ```
granite cedar
#

so this is ok after all?

dusty topaz
#

ugly. but sure

granite cedar
#

well how can i simplify/optimize it?

dusty topaz
#

by doing some googling

#

because this question is easily googleable

granite cedar
#

i dont even know where i went wrong

dusty topaz
#

well think what there could be inefficient

#

you're creating three different collections

#

and adding to all of them

granite cedar
#

im a self taught dev

dusty topaz
#

... so are most of us

granite cedar
#

tell me where i went wrong please

#

how else would i do this

dusty topaz
#

google it

#

how to sort map by key

sacred wave
#

what is wrong with TreeMap, again? ๐Ÿ˜„

fading frost
#

it is not what you need or want here

#

it sorts on insertion

sacred wave
#

And is it a problem?

fading frost
#

you don't need a map at all

rigid nacelle
#

@runic wadi IIRC, the spigot api comes with Guava so you should be able to just use Sets.newIdentityHashSet(), if not Collections.newSetFromMap(new IdentityHashMap<>().

fading frost
#

And is it a problem?
@sacred wave yes, it's spaghetti

#

temp temp = new temp(uuid);
friends.put(temp.getName(), temp);

#

where exactly does the name come from

#

why do you make all of this so complicated

granite cedar
#
public class temp {
    
    private String name;
    private UUID uuid;
    private String serverID;
    
    public temp(UUID uuid) {
        //fectehs data from sql
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public UUID getUuid() {
        return uuid;
    }

    public void setUuid(UUID uuid) {
        this.uuid = uuid;
    }

    public String getServerID() {
        return serverID;
    }

    public void setServerID(String serverID) {
        this.serverID = serverID;
    }
    
}```
fading frost
#

Uh oh

sacred wave
#

I guess, but when you try to get the item by the name, it will speed thing up, or am I wrong?

fading frost
#

please call it something else than temp

#

no, all of this is way too complicated and confusing

granite cedar
#

why does the name matter its just a temp player object

fading frost
#

the name matters because the class is not temp

#

it's in your code

dusty topaz
#

yeah, why does name matter, lets just call everything A, B, C, D

fading frost
#

you return it

#

But anyway, you could just make a list of those objects, populate it and sort that

#

idk what it is with maps and intermediate lists

rigid nacelle
#

yeah, why does name matter, lets just call everything A, B, C, D
@dusty topaz Self-obfuscation. smart :p

fading frost
#

completely redundant, all of it

dusty topaz
#

it's sane convention

dire whale
fading frost
#

you call variables temp sometimes because they're actually temporary

#

although that's not a good name in general

sacred wave
#

@fading frost so If I search for the Item I want by name with e.g. stream, it will be done quicker or at least in a same time as through hashing in a hashmap?

granite cedar
#

no its cause i dont want anyone understanding my code if it gets leaked

fading frost
#

are you serious

dusty topaz
#

.-.

fading frost
#

use an obfuscator then lol

granite cedar
#

i have de obfuscated plugins

#

havent foudn any that actuallly work

fading frost
#

@fading frost so If I search for the Item I want by name with e.g. stream, it will be done quicker or at least in a same time as through hashing in a hashmap?
@sacred wave this is about returning a friends list sorted by name

#

dunno what you're talking about

dusty topaz
#

obfuscators make it a lot harder than calling your player class temp lol

#

and just use jnic

granite cedar
#

true will probably use one when i finally publish my network

fading frost
#

screwing up your naming in the source code intentionally is just a bad idea

granite cedar
#

im the only one working on it

#

and i understand it

dusty topaz
#

then how will you hire more people

#

and how will it get leaked

fading frost
#

yeah, let's talk about that again in a year

dusty topaz
#

if only you have source

granite cedar
#

hell no

#

thats how things get leaked lol

fading frost
#

when more spaghetti is involved

dire whale
#

?

fading frost
#

this is just a non-argument

prisma basin
#

whats is alternative to PlayerCommandPreprocessEvent in bungecord?

sacred wave
#

@fading frost well firstly I was talking about Don's case, but then from what you were writing I got a feeling that using model of Map<String, Item> where string is part of the Item class is not worth it, so I am asking...

fading frost
#

Your case seems different

#

If you want to access your item by name, this is useful

#

Don otoh just wants to display all of them in the list order

granite cedar
#
Map<String, guiPlayer> friends = new HashMap<String, guiPlayer>();```
fading frost
#

again. why map

sacred wave
#

@fading frost hard to tell, I have something like this: private Map<TeamColor, Team> teams = new HashMap<>(); and of course I have Team#getTeamColor...

fading frost
#

just make a list of guiPlayer and sort that

granite cedar
#

because when getting the temp its not cached

fading frost
#

what

granite cedar
#

how

prisma basin
#

whats is alternative to PlayerCommandPreprocessEvent in bungecord?

granite cedar
#

how would i sort a list of temps by name?

tiny dagger
#

Arrays.sort(string list)

granite cedar
#

they are objects though

#

not names

tiny dagger
#

well

#

you need to make a comparable then

fading frost
#
List<Friend> friends = new ArrayList<>();
for (...) {
  // populate the list
}
friends.sort(Comparator.comparing(Friend::getName));
return friends;
#

simple

tiny dagger
#

then arrays.sort(array, objectcomparator)

granite cedar
#
public List<guiPlayer> getFriendsObjectsInAlphabeticalOrder(aPlayer ap){
        List<guiPlayer> friends = new ArrayList<guiPlayer>();
        for(UUID uuid : ap.getFriends()) {
            friends.add(new guiPlayer(uuid));
        }
        friends.sort(Comparator.comparing(friends::getName()));
        return friends;
    }```
#

idk how this comparing method is supposed to use parameter???

tiny dagger
#

why don't you implement comparable? ๐Ÿค”

granite cedar
#

bruh i dont even know what that is

fading frost
#

why would you

tiny dagger
#

custom object why not

fading frost
#

guiPlayer doesn't have an obvious natural order imo

granite cedar
#

how do i fix this? .comparing(friends::getName()));

fading frost
#

You might want to sort it by something else somewhere else

granite cedar
#

bruh

fading frost
#

you did not copy correctly

#

and/or don't understand lambdas and method references

granite cedar
#

i dont

#

what does :: mean

fading frost
#

method reference

#
Comparator.comparing(new Function<guiPlayer, String> {
    @Override
    public String apply(guiPlayer player) {
      return player.getName();
    }
});
```shortcut for this
#

or this Comparator.comparing((player) -> player.getName())

granite cedar
#

what is the -> do

fading frost
#

lambda

granite cedar
#

ok ill watch /read some tutorials on it and brb thanks

tiny dagger
#

i read -> as 'then do'

strange monolith
#

how do i make a server?

subtle blade
#

Even better, Player::getName

granite cedar
#

that didnt work

fading frost
#

yes it does

#

You just didn't copy correctly

#

and don't understand what it is

#

as mentioned already

sacred wave
#

@granite cedar what Java are you using?

#

it could be preLambda verion maybe...

granite cedar
#

i dont even know lol

fading frost
#

I doubt it

granite cedar
#

se-13

fading frost
#

nobody uses java 7 accidentally anymore

prisma basin
sacred wave
#

@fading frost well I had to ask...

granite cedar
#

ok so this method here will sort guiPlayer objects by their names alphabeticallty yes?public List<guiPlayer> getFriendsObjectsInAlphabeticalOrder(aPlayer ap){ List<guiPlayer> friends = new ArrayList<guiPlayer>(); for(UUID uuid : ap.getFriends()) { friends.add(new guiPlayer(uuid)); } friends.sort(Comparator.comparing(guiPlayer::getName)); return friends; }

prisma basin
fading frost
#

yes

granite cedar
#

and its better than this? public List<guiPlayer> getFriendsObjectsInAlphabeticalOrder1(aPlayer ap){ Map<String, guiPlayer> friends = new HashMap<String, guiPlayer>();//for List<String> friendsNames = new ArrayList<String>(); for(UUID uuid : ap.getFriends()) { guiPlayer temp = new guiPlayer(uuid); friends.put(temp.getName(), temp); friendsNames.add(temp.getName()); } friendsNames.sort(Comparator.naturalOrder()); //now that the names are sorted we still need to return the List<temp> ordered by temps names in alphabateical order List<guiPlayer> fin = new ArrayList<guiPlayer>(); for(String name : friendsNames) { fin.add(friends.get(name)); } return fin; }

fading frost
#

...obviously

#

lol

prisma basin
fading frost
#

wanna send it again

prisma basin
#

@frigid ember why?

radiant pollen
#

no, you should hide things people don't need to see.

prisma basin
#

i need hide /ban comand

#

beucase player don't have permision to that

radiant pollen
#

@prisma basin you probably have the plugin configured incorrectly.

granite cedar
#

then block a player from running /ban in command pre process event @prisma basin

#

lol you actually thought to hide the command but not actually block it code wise

prisma basin
#

AdvancedBan how to configure it to remove tab sugestion

#

@frigid ember this is bungecord

#

@granite cedar bungecord don't have pre process event

granite cedar
#

command pre process still blocks bungee commands

#

when on a spigot server

#

i think *

prisma basin
#

public void onPlayerCommand(PlayerCommandPreprocessEvent e)
{
onTabComplete();
if(e.getPlayer().hasPermission("admin"))
{
return;
}

#

work only on bukkit command

granite cedar
#

when a player tries to type /ban as a non op

#

cancel the command

prisma basin
#

yes

granite cedar
#

no player is going to be connected to your bungee server only your spigot servers, no?

prisma basin
#

but i need to remove this form /<tab>

granite cedar
#

then block cancel /tab

#

in command pre rprocess

prisma basin
#

public void onPlayerCommand(PlayerCommandPreprocessEvent e)
{
onTabComplete();
if(e.getPlayer().hasPermission("admin"))
{
return;
}

granite cedar
#

and when its cancelled print your own version of /tab

prisma basin
#

don't work

granite cedar
#

with the commands you want

prisma basin
#

i want to whitelist tab sugestion

granite cedar
#

your method doesnt do anything btw

#

setCancelled(true);

keen compass
#

I would probably find it easier to just nab the tab complete packet for this purpose, but that might be above your level though to make XD

prisma basin
#

public void onPlayerCommand(PlayerCommandPreprocessEvent e)
{
onTabComplete();
if(e.getPlayer().hasPermission("admin"))
{
return;
}
String[] cmds = e.getMessage().split(" ");
List<String> allowcmds = getConfig().getStringList("dozwoloneKomendy");
for(int i = 0;i<=allowcmds.size()-1;i++)
{
if(cmds[0].equalsIgnoreCase("/"+allowcmds.get(i)))
{
return;
}
}
e.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&',"&cNie ma takiej komendy /pomoc"));
e.setCancelled(true);
}

#

this is full code

wanton delta
#

my eyes ๐Ÿ˜ญ

keen compass
#

lol

granite cedar
#

onTabCOmplete()

wanton delta
#

Use ```code``` next time plz

keen compass
#

get ProtocolLib, use it to kill the tab complete packet ๐Ÿ˜‰

prisma basin
#

code @Override
public void onPacketReceiving(PacketEvent event) {

            if (event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE) {

                PacketContainer packetContainer = event.getPacket();
                String msg = ((String)packetContainer.getSpecificModifier(String.class).read(0)).toLowerCase();

                if (msg.startsWith("/")) {

                    PacketContainer pack = new PacketContainer(PacketType.Play.Server.TAB_COMPLETE);

                    pack.getStringArrays().write(0, messages);

                    try {
                        protocolManager.sendServerPacket(event.getPlayer(), pack);
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    }

                }

            }

        }

    });
wanton delta
#

@prisma basin is this for commands list or argument list

keen compass
#

commands

wanton delta
#

Use PlayerSendCommandEvent

keen compass
#

wants to stop commands from appearing in tab complete

wanton delta
#

Or something similar

#

And use event.getCommands().clear or whatever you intend to do

keen compass
#

but wants to implement a whitelist as well for commands that are allowed

wanton delta
#

Yea

keen compass
#

or blacklist which ever way you want to look at it

wanton delta
#

Essy

#

Just clear the list and add more commands

keen compass
#

if it were me though, I would just find it easier to kill the packet then to just check what players input all the time

wanton delta
#

Ive tried to use the packet method

prisma basin
#

i do it and all spogot command has removead but bunegcord command not

wanton delta
#

Didnt work for me

keen compass
#

you need to kill the packet that goes out, not the one incoming

wanton delta
#

I know

prisma basin
#

@keen compass how

wanton delta
#

@prisma basin have you tried my suggestion?

keen compass
#

if you don't know how @prisma basin I would probably not recommend messing with packets

prisma basin
#

i don't usung packets can you get me exaple

keen compass
#

use Martoph's suggestion

wanton delta
#

Cc2, try what i recommended

prisma basin
#

@wanton delta i try you sugestion its work to spigot command not bungecord command

keen compass
#

in case you feel like messing with packets anyways, https://wiki.vg for most of the data references in regards to packets

wanton delta
#

Then you need to add your bungee commands to a permission group

keen compass
#

I have packet filtering at the firewall level anyways, so most of the time I don't really need to code some things XD

prisma basin
#

this is make if player execute command server send to player you don't have permission and dont remove command from tab sugestion

#

@wanton delta

wanton delta
#

Where are you from

prisma basin
#

poland

#

using google translate

wanton delta
#

Thats ok. If you spoke spanish i could help a little bit better

prisma basin
#

@keen compass if i kill tab completer packet how to make tab completer whitelist

granite cedar
#

@fading frost still here?

fading frost
#

I'm afraid so

granite cedar
#

lol any way to optimize this?

fading frost
#

context?

granite cedar
#

i get all the temps from sql before starting the loop

#

then use the loop to add player heads to the gui

sacred wave
#

for (int i = 0; i < 54; i++) { ?

granite cedar
#

but if i do that how will i loop through the guiPlayers?

fading frost
#

it's a list isn't it

#

that has random access

keen compass
#

you would intercept the packet, read which commands it contains. If it contains commands that you don't want sent. Re-create the packet without that command in it and send it again @prisma basin

sacred wave
#

oh I see, well at the very least, please use i < 54, far more readable.... than !(i >= 54)

keen compass
#

that is gist of how it is done with packets

granite cedar
#

its the list of a players friends

subtle blade
#

No need for packets if you just want to remove commands from tab completion

#

Ah you're on Bungee

fading frost
#

@granite cedar yeah use a regular for loop as dawon said

keen compass
#

I didn't say it was the best way, just if I didn't want to make a plugin for the bungee server or mc servers, I would just do the packet way because I already do packet filtering at the firewall level anyways XD

granite cedar
#

but if i use that as he said how will i also loop through the players friends?

fading frost
#

it's a list isn't it
that has random access

#

List#get(int)

#

Or an iterator if you prefer that

granite cedar
#

ohh ok

prisma basin
#
        ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
         protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.HIGHEST, new PacketType[]{PacketType.Play.Client.TAB_COMPLETE}) {

            @Override
            public void onPacketReceiving(PacketEvent event) {

                if (event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE) {

                    PacketContainer packetContainer = event.getPacket();
                    String msg = ((String)packetContainer.getSpecificModifier(String.class).read(0)).toLowerCase();

                    if (msg.startsWith("/")) {

                        PacketContainer pack = new PacketContainer(PacketType.Play.Server.TAB_COMPLETE);

                        pack.getStringArrays().write(0, messages);

                        try {
                            protocolManager.sendServerPacket(event.getPlayer(), pack);
                        } catch (InvocationTargetException e) {
                            e.printStackTrace();
                        }

                    }

                }

            }

        });```
#

why don't work

keen compass
#

you are going to want the one from the server and not the one from the client

#

we don't care what the client sends, we care what the server responds with ๐Ÿ˜‰

prisma basin
#

@keen compass please give me exaple ๐Ÿ˜…

keen compass
#

I don't have an example on hand to give.

#

https://wiki.vg has most of the data you will need in packets and how they must be structured or what data has to be present and what data doesn't need to be

granite cedar
#
for (int i = 1; i < 54; i++) { 
            //inv add item
        }```
#

this will add 53 items starting from the second slot yes?

bronze marten
#

Yes

granite cedar
#

please explain the parameters

prisma basin
keen compass
#

already told you it would be

#

hence why I didn't recommend it as the way for you to do it, just pointing out that it is another way of doing it.

prisma basin
#
        ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
         protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.HIGHEST, new PacketType[]{PacketType.Play.Client.TAB_COMPLETE}) {

            @Override
            public void onPacketSending(PacketEvent event) {

                if (event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE) {

                    PacketContainer packetContainer = event.getPacket();
                    String msg = ((String)packetContainer.getSpecificModifier(String.class).read(0)).toLowerCase();

                    if (msg.startsWith("/")) {

                        PacketContainer pack = new PacketContainer(PacketType.Play.Server.TAB_COMPLETE);

                        pack.getStringArrays().write(0, messages);

                        try {
                            protocolManager.sendServerPacket(event.getPlayer(), pack);
                        } catch (InvocationTargetException e) {
                            e.printStackTrace();
                        }

                    }

                }

            }

        });

    } ```
#

sorry

bronze marten
#

Please paste online and send link lol

keen compass
#

there we go, looks better

prisma basin
#

error

keen compass
prisma basin
#

how to fix it

keen compass
#

the array contains a list of commands or strings that gets sent to the client depending on what the client asked for, also you need to listen for the incoming packet for tab complete because what you need from it is the transaction ID. If the transaction ID from the server going to the client does not match the client rejects it as well.

prisma basin
#

this is too hard ๐Ÿ˜… pleasr repair my code ๐Ÿ˜ฑ ๐Ÿ˜ญ

keen compass
#

relevant packet structure that the server gets

#

Yes, messing with packets can be difficult, with enough practice though it will be easy once you learn how the protocol for MC works ๐Ÿ˜‰

granite cedar
#

@fading frost public static List<guiPlayer> getTempsInOnlineOrder(aPlayer ap, List<UUID> uuids){ List<guiPlayer> online = new ArrayList<guiPlayer>(); List<guiPlayer> offline = new ArrayList<guiPlayer>(); for(UUID uuid : uuids) { guiPlayer guiPlayer = new guiPlayer(uuid); if(guiPlayer.isOnline()) { online.add(guiPlayer); }else { offline.add(guiPlayer); } } online.addAll(offline); return online; } thoughts? good?

fading frost
#

what is the point of the two lists

granite cedar
#

get the online first

#

so in gui it shows online first then offline

fading frost
#

ah

keen compass
#

Just use OfflinePlayer @granite cedar that player object has a method to check if their online, and you can cast OfflinePlayer to Player

prisma basin
#

@keen compass if i remove (msg.startsWith("/")) this is work ?

granite cedar
#

why are you so obsessed with offline player lol

fading frost
#

I'd rather compose a comparator that sorts by both the name **and **whether they're online or not

keen compass
#

I am not obsessed with offline player o.O

#

in fact that is first time I have suggested anything to you @granite cedar o.o

granite cedar
#

i would do that but if a player is looking for a certain friend

#

it will be a pain to look through an unlimited size friends list

#

so alphabetical for the friend gui i think is a necessity

#

but for showing party/clan members i want to show in order by online status and not alphabetical

#

so perhaps you have an idea to optimize the code i put above

fading frost
#

my suggestion doesn't change the outcome of your current method

#

it's just a more concise and (imo) better way

final verge
#

also by standard java naming conventions your guiPlayer class should be named GuiPlayer

fading frost
#

(I'd name it Friend, btw)

granite cedar
#

ok well i wouldnt mind if its like that for party/clan

#

thats actually better

#

how would i do that

fading frost
#

You can compose as many comparators as you want

keen compass
#

I don't know what your DB structure looks like, but your code can be optimized if you knew more about sql XD

granite cedar
#

and the gui player is used for more than players its used globally for all sorts of gui displaying

fading frost
#

What's the first thing you sort by

granite cedar
#

online status first

#

and then alpha betical

#

well actually

#

idk

#

cause id want offline and online to be in alphabetical order while the online players show first

fading frost
#

that's doable

granite cedar
#

thinking how

fading frost
#
Comparator.comparing(GuiPlayer::isOnline).reversed().thenComparing(GuiPlayer::getName).thenComparing(...)...
granite cedar
#

id say orderign alphabetically, then ordering by online status, then ordering the online players alphabetically, and then th eoffline alphsbatically and then adding all offline tothe online

keen compass
#

MySQL can order your data for you just fyi

fading frost
#

That's true

#

you should do that

prisma basin
#

@keen compass PacketType.Play.Client.TAB_COMPLETE is for /command <tab> whats packet is for /<tab> ??

keen compass
#

that packet is for both

fading frost
#

And you shouldn't put the database logic in your GuiPlayer class

granite cedar
#

why not

keen compass
#

DB queries should be ran from another thread

#

so as to not hold up the main thread

granite cedar
#

ohh i run them async with hikari in a seperate core plugin

#

i just use the api i made for it in guiplayer class

prisma basin
#

@keen compass if i /<tab> no error and don't have all command

keen compass
#

select name from user ORDER BY name;
example of how you can use the query to sort your data.

#

that is for Ascending order, descending order
select name from user ORDER BY name desc;

fading frost
#

DB queries should be ran from another thread
Doesn't really have to do with that, the point is that it clusters the logic of a simple data class

granite cedar
#

i need to get their uuids as well though

prisma basin
#

@keen compass how to clear it pack.getStringArrays()

fading frost
#

then do that

#

why do you select each individual friend anyway

keen compass
#

get the array, iterate or loop through the array for anything that contains the commands you don't want. Remove them from the array, re-create the packet plug modify array into that packet. Send packet

granite cedar
#

mate i just figured this out. its better to have in the friends list both the online players irst yes but alphabetically and then the offline players alphabetically XD

keen compass
#

you should be storing UUID's and not their names anyways

granite cedar
#
public static List<guiPlayer> getTempsInOnlineOrderAlphabetically(aPlayer ap, List<UUID> uuids){
        List<guiPlayer> online = new ArrayList<guiPlayer>();
        List<guiPlayer> offline = new ArrayList<guiPlayer>();
        for(UUID uuid : uuids) {
            guiPlayer guiPlayer = new guiPlayer(uuid);
            if(guiPlayer.isOnline()) {
                online.add(guiPlayer);
            }else {
                offline.add(guiPlayer);
            }
        }
        online.sort(Comparator.comparing(guiPlayer::getName));
        offline.sort(Comparator.comparing(guiPlayer::getName));
        online.addAll(offline);
        return online;
    }```
#

looking good right?

fading frost
#

no

keen compass
#

no need for the sorting if MySQL will do it for you

fading frost
#

^

granite cedar
#

this will show the online players first alphabeetically and then the offline players alphabetically

#

i store player data in json

#

strigns

keen compass
#

also you are adding all the offline to the online list

fading frost
#

why...

granite cedar
#

yes of course

#

i need to show the entire friends list

fading frost
#

why do you store players as json