#help-development

1 messages · Page 131 of 1

rough drift
#

tried it 16 times

eternal oxide
#

What type of block?

rough drift
#

any

#

I just need a light source so ppl can see in a closed room

shadow zinc
#

looks like a packet job

rough drift
#

I'd prefer if there wasn't a need for packets, though if it is strictly necessary fine

eternal oxide
#

Use the Material.LIGHT block to create light

rough drift
#

I kind of need people to be able to place blocks though

#

I guess just send it client side?

vital sandal
#

how to prevent player from editing armorstand ?

kindred valley
#

I would cancel clickjng event at specified block

#

But idk if its applying before i click

severe marsh
#

How can I get name of this item?

#

I've tried item#getType()#name() but it returns RECORD_7

drowsy helm
solar kayak
#

I wanna ask why I cant build on unclaim lands

drowsy helm
pulsar parcel
fluid river
#

woke up

#

where are noobs

#

show me

fluid river
drowsy helm
#

You cant call new Scoreboard

#

Use ScoreboardManager#getNewScoreboard

fluid river
drowsy helm
#

That too lol

fluid river
#

❤️

wraith apex
fluid river
severe marsh
#

It returns null in case it's "default" item

#

Anyways, I found a solution

odd wedge
quasi flint
#

add a check

#

if the item is null

#

and be happy

glass mauve
#

how can I calculate the exact position (x, y, z) a player clicked a block with PlayerInteractEvent?

#

is there alr. given code for this math?

fluid river
#

??

eternal oxide
#

yes

fluid river
#

Event#getClickedBlock()#getLocation()

#

or you mean location of which part of block is interacted

glass mauve
#

yea, but will this give me just int coordinates? I want the exact location of the block the player clicked

eternal oxide
#

I was fairly sure there was, sec

fluid river
#

just a vector from player eye location

#

to block at direction

#

and loop until location is not the block

chrome beacon
#

Wasn't it like getClickedBlockFace or smth

glass mauve
#

yea, I tried it with getEyeLocation.toVector and direction but couldn't get the math to work

glass mauve
#

iirc

eternal oxide
#

No you can only get teh BlockFace. Nothing more detailed than that. I believe paper has teh actual clicked spot

fluid river
#

And so on

#

not coordinates

chrome beacon
#

Ah I see they need the exact coords

fluid river
#

or university

glass mauve
#

no im still in school and we didn't learnt vectors yet

serene sigil
#

how do you detect if a player puts an item in a chest/any gui?

fluid river
eternal night
#

I wanted to say there is a method for the exact interaction point

#

on the player interact event

fluid river
#

on paper only

eternal night
#

but that is paper only 😅

serene sigil
#

lol

fluid river
#

Just go to javadocs

#

lol

#

and get all events which extend InventoryEvent

grim ice
#

Wow you guys really suck at helping people

serene sigil
fluid river
grim ice
#

if you want to help someone, that is

eternal night
fluid river
#

I am not helper

#

and i provided link

grim ice
#

use this

serene sigil
#

omg

grim ice
#

check if the clicked inventory is a chest

serene sigil
#

wow

grim ice
#

and if the item clicked is not null

serene sigil
#

they provided a link :OOO

grim ice
#

only if ur not using paper btw

fluid river
#

There are not only chests

serene sigil
#

im using spigot

fluid river
#

but enchantments

#

and trades and crafting tables

#

and so on

#

if you need all, you probably should use more events

glass mauve
serene sigil
#

what is the event where u detect if a player opens a gui?

glass mauve
#

ah found it

fluid river
serene sigil
#

InventoryOpenEvent?

fluid river
#

if doesn't suit you create own event and listen to it

serene sigil
#

found it

serene sigil
#

and is there a way to detect which inventory u opened?

#

like a Material?

#

or

#

sth

#

idk

versed flint
#

player.getOpenInventory().getTitle() or sum like that

serene sigil
#

the title could be renamed tho

#

i tried player.getOpenInventory().getType().equals(InventoryType.ANVIL)but it didnt work

fluid river
#

check holder

#

op

serene sigil
#

?

serene sigil
#

plz

#

i need

#

help

#

uwu

fluid river
#

inventory.getHolder()

serene sigil
#

doesnt work

fluid river
#

bro holder of inventory

#

that player opened

#

not player's inventory

serene sigil
#

oh

#

nvm

#

player.getInventory().getHolder().getOpenInventory().getType().equals(InventoryType.CHEST)

#

like this?

#

nop

#

doesnt work @fluid river

fluid river
#

brooooo what the fuck is this

serene sigil
#

lol

fluid river
#

learn logic

#

on inventory open event

eternal oxide
#

When are you trying to see what type the inventory is? In what event?

fluid river
#

get the inventory

#

which is opened

#

and get it's holder

serene sigil
#

event.getInventory().getHolder().equals(InventoryType.CHEST)?

serene sigil
eternal oxide
#

Which Event?

serene sigil
#

InventoryOpenEvent

eternal oxide
#

then don;t be silly. The event has the inventory

serene sigil
#

?

eternal oxide
#

event.getInventory()

serene sigil
#

no, i want to detect if a player opens a chest

#

in an if

#

and then say sth

eternal oxide
#

its always a player opening the inventory in the event

serene sigil
#

only for chest

#

yes

wraith apex
#

this will help

#

Check the block clicked

eternal oxide
#

if (event.getInventory().getType() == InventoryType.CHEST)

wraith apex
#

many plugins use chest inventories as GUI's

eternal oxide
#

He only asked if it was a chest

serene sigil
wraith apex
serene sigil
#

he*

eternal oxide
#

InventoryOpenEvent only triggers when a Player opens an inventory

upper shadow
eternal oxide
#

of course it works

serene sigil
#

Operator '==' cannot be applied to 'org.bukkit.inventory.Inventory', 'org.bukkit.event.inventory.InventoryType

eternal oxide
#

Yes it can its an Enum

quaint mantle
#

you forgot the getType()?

serene sigil
eternal oxide
#

use teh actual code I gave you

wraith apex
#

if (event.getInventory().getType().equals(InventoryType.CHEST))

#

how about that?

eternal oxide
#

== for comparing enums

wraith apex
#

but the above also works

serene sigil
wraith apex
peak wharf
#

Hey, i Want to do a xp system... Its better to use MySQL for save the level and the XP of Each player in Each server or i need to use other things ?

eternal oxide
#

is the same data to be used across different servers?

wraith apex
#

the only thing you're saving yourself is a null check

wraith apex
#

level should be calculated from the xp

kindred valley
#

Elgar

peak wharf
#

Different for Each server

eternal oxide
#

Then theres no point in using SQL at all

#

just store it in the players PDC

#

?pdc

peak wharf
#

Okay thanks i will check this

upper shadow
#

database has TABLES

#

just seperate the tables ¯_(ツ)_/¯

wraith apex
#

that or you can just store it in a simple .txt file

chrome beacon
#

PDC all the way

upper shadow
#

not recommended

eternal oxide
#

No point in either PDC is the answer

kindred valley
#

olivo

upper shadow
#

how if theres many people are playing together

eternal oxide
#

His data is relevant only to each player on that server

upper shadow
wraith apex
#

to re-iterate he said Different for Each server

#

so PDC or txt doesn't matter

#

txt is easier to access and read

#

it's convenient

chrome beacon
#

PDC is much easier to use and easier to store

eternal oxide
#

Do you just like arguing? He already stated that hsi data is server specific. Not used on other servers so not needed outside that server

kindred valley
#

Pdc is big piece of dogshit

chrome beacon
#

It's not

eternal oxide
#

Its direct player data. Store it ON the player itself (PDC)

wraith apex
#

I know what PDC is...

eternal oxide
#

PDC = NBT wrapper

wraith apex
#

thanks for the patronising tone though

upper shadow
kindred valley
#

No reading

eternal oxide
serene sigil
#

also one tiny tiny question: how to make it so if u open a chest inv and theres an ender dragon egg on the floor, u cant pick it up until u closed the inv?

quaint mantle
hazy parrot
kindred valley
chrome beacon
kindred valley
upper shadow
#

we use mysql or sqlite

wraith apex
upper shadow
#

to store player things

wraith apex
#

it can

upper shadow
#

because it can be currupted

kindred valley
eternal oxide
#

Now you are just wasting my time. He stated he wants to store Level and exp. It takes LESS storage to simply put that in the PDC than to create a whole file system or save to SQL.

wraith apex
#

lol

kindred valley
#

Yes pdc is original

eternal oxide
#

ok troll

charred blaze
#

if you teleport player on 0.01 and then 0.02 and 0.03 will it be smooth walking? :D

charred blaze
serene sigil
kindred valley
eternal oxide
charred blaze
serene sigil
wraith apex
#

yes it will...

eternal oxide
#

Walking animation

charred blaze
#

hmmm

eternal oxide
#

teleport every tick will simply slide the player to each new location

wraith apex
#

try it for yourself

upper shadow
#

i can make world border

#

with throw player animation

hazy parrot
eternal oxide
wraith apex
#

xD

#

talk about stubborn

#

There is a walking animation

#

because that's how walking works

eternal oxide
#

Teleport triggers NO animations. It simply moves teh player to a new location

wraith apex
#

I've done this before

#

teleporting an entity really small distances causes them to appear as if they walk

upper shadow
#

however mysql doesnt

eternal oxide
#

No, it causes them to slide to the new location. The client extrapolates teh movement and slides them. Zero animation

serene sigil
#

❤️

kindred valley
#

I mean listen for inventory event and check if the player is in inventory, make a boolean like

boolean isPlayerinInv;

And in listen for 'isPlayerinInv` at item pick-up event and if the situation is true set event cancelled.

quaint mantle
serene sigil
#

ty

kindred valley
#

Cute e grill lol

quaint mantle
#

E-Grill moment

quaint mantle
serene sigil
#

oh god

#

wtf is that giant link

quaint mantle
#

google redirect link

#

my bad

serene sigil
#

lol

upper shadow
quaint mantle
#

Malware ok I changed it

#

xO

upper shadow
wraith apex
#

Same goes with entities

charred blaze
#

hm

wraith apex
#

So depends on if you care about the player themselves seeing the animation

glass mauve
#

what are all reasons why a block disappears/despawns/breaks etc

#

or will BlockBreakEvent handle all of them?

serene sigil
#

wdym by that?

peak wharf
#

player.playSound(Location location, Sound sound, float volume, float pitch)
This line play sounds for all players ?

ivory sleet
#

iirc no

#

world::playSound

glass mauve
#

player.playSound is a non static call, so it seems its only for that player

peak wharf
#

because i just need to play sound for a specific player

#

okay perfect

#

thanks

wraith apex
#

then I think you're all set

#

Oh and a rare case of enderman picking up and moving blocks

glass mauve
#

ok and what about commands etc

wraith apex
#

commands that change blocks?

glass mauve
#

cant you somehow remove/replace a block via commands?

ivory sleet
#

Yes

#

It’s possible

molten hearth
#

how do you think worldedit does it lol

wraith apex
#

through /setblock, /fill,/ clone

wraith apex
glass mauve
#

how can I handle that / catch that

molten hearth
#

Still replaces a block tho

#

Just overly complicated methods

wraith apex
#

but not the same way vanilla commands do

ivory sleet
molten hearth
#

I don't think I ever used vanilla commands in my life ngl

wraith apex
molten hearth
#

Maybe summon over 7 years

wraith apex
#

check if it's one of those commands and then parse the command yourself to figure out what block is being changed

ivory sleet
#

execute do be a dope command tho

wraith apex
#

are you checking a specific block?

#

how many blocks are you checking?

kindred valley
wraith apex
#

if it's not many blocks you could just have a continuous clock that pulses every second or so to check the type of a block

#

doesn't consume much in terms of resources

ivory sleet
kindred valley
#

I explained him thewhole situation

molten hearth
#

I tried execute when I was trying to exploit something but it wasn the type of execute i expected lol

wraith apex
#

everyone does that

molten hearth
#

I install essentials and /gmv

#

Gmc*

#

The only reason I ever used essentials tbh

wraith apex
#

I'm talking sp

molten hearth
#

That and /thru or through I forgot

#

I don't play sp

wraith apex
#

neither do I, but for testing

ivory sleet
#

You probably have used op, deop and whitelist

molten hearth
#

I be setting up a server just to play in sp

#

Ah shit I did use those

wraith apex
#

ye

#

another one

#

/plugins

#

:p

#

or /p

molten hearth
#

I don't think pl is vanilla

wraith apex
#

naw it's servers

molten hearth
#

Idek what /p does

wraith apex
#

oh

#

nvm

#

thinking of spigot

glass mauve
# wraith apex You'd have to have a listener for the command being sent

hm maybe I change smth instead of listening to everything etc,
how can I give a block custom data which dont need to be persistent?
I currently save it in the pdc of the chunk, but I have problems when breaking block etc
cause the pos -> custom data, stays when block breaks gets removed etc.

so should I listen to all these events and then reset the specific key myself or
should I try to use smth else which only stores information (an instance of a class)
to a block and not the position of the block

molten hearth
#

Lmao

wraith apex
# glass mauve hm maybe I change smth instead of listening to everything etc, how can I give a ...

You can't give a block custom data to my knowledge unless it's something that can have data like chest, furance, smithing table etc. I have a mechanic where I need a similar solution. I've only made sure vanilla behaviours can't screw up the block type (like breaking, explosions, pistons etc.) as for commands that can modify blocks I don't bother supporting, I don't expect regular players to have access to those commands. Though I don't know what your mechanic is for.

#

Adding support for any unknown plugin that can modify block type in it's own convoluted way is a nightmare to support for

ashen quest
#

if i build my plugin in java 8, it will run for servers using 17 right?

glass mauve
wraith apex
#

you can't do it the other way around though

#

Java 17 plugin on a Java 8 server is a no no

glass mauve
#

tho can explosion/pistons affect barrier blocks?
iirc you can only break it in creative right?

wraith apex
#

they can't be moved or exploded

#

they have the same blast resistance as bedrock

glass mauve
#

ok ty

ashen quest
glass mauve
#

hm I get an error when trying to remove a chunk pdc's while disabling a plugin:

PersistentDataContainer pdc = new CustomBlockData(block, plugin);
pdc.remove(blockKey);
#

jeff_media's CustomBlockData

vocal cloud
#

Can't do that when it's disabling

glass mauve
#

is pdc it self trying to register a task or is it customblockdata

vocal cloud
#

I'd check the method and see

glass mauve
#

yea true

drowsy helm
#

Whatever setDirty is

#

In CustomBlockData

glass mauve
vocal cloud
#

There's your issue

glass mauve
#

why is he adding it and then removing it

drowsy helm
#

Good question

glass mauve
#

also why is he removing it in a task

drowsy helm
#

Is dirty blocks just a list?

glass mauve
#

its a HashSet

#

so basically

drowsy helm
#

I feel like theres some obscure reason for that

glass mauve
#

its not even using blockentry here

#

@tender shard

drowsy helm
#

Maybe an unfinished method

glass mauve
#

he will maybe explain it

drowsy helm
#

Ping wasnt really necessary

glass mauve
#

ik, but its his "plugin" and yesterday he said I can ask if there are still questions about it

#

then I will just remove it myself

tardy delta
#

why not use just the api for that

#

TabCompletor#onTabComplete

vocal cloud
#

Just register commands? That'll give you the ability to tab complete them

eternal oxide
#

Thats the command map

vocal cloud
#

Don't need to

eternal oxide
#

register commands then Player#updateCommands()

#

You assign permisions to each command

#

the player will only see teh commands they have permissions for from the command map

#

not if they don;t have that permission

glass mauve
#

didn't work :/

serene sigil
#

hi, basically i wrote this code that detects if a dragon egg is in a players inventory and gives the player +100 levels, but if the egg is picked up by the cursor and its not in the inventory, then you loose those 100 levels, so the problem now is that if you spam left click in the inventory you start duping levels......

how do i fix this?
code:

@EventHandler
    public void inventoryClick(InventoryClickEvent event) {
        if (event.getCurrentItem().getType().equals(Material.DRAGON_EGG) && event.getClickedInventory().getType().equals(InventoryType.PLAYER)) {
            Player player = (Player) event.getClickedInventory().getHolder();
            player.giveExpLevels(-100);
        }
        if (event.getCursor().getType().equals(Material.DRAGON_EGG) && event.getClickedInventory().getType().equals(InventoryType.PLAYER)) {
            Player player = (Player) event.getClickedInventory().getHolder();
            player.giveExpLevels(100);
        }
    }```
iron glade
serene sigil
#

yea

serene sigil
#

ill show u

#

@iron glade

hybrid spoke
#

yeah obv

#

since sometimes you do 2 clicks at once

serene sigil
#

yea

#

but how do i fix that?

hybrid spoke
#

you could add a cooldown or whatever

#

or check if a click was made twice at the same time

#

and cancel the other one

serene sigil
hybrid spoke
#

you could check the interval between the clicks and if its <5ms or whatever cancel it

serene sigil
#

and what do i have to cancel?

hybrid spoke
#

the second click á la inventory click event

tardy delta
#

click á la inventory 🤡

#

french

smoky oak
#

?

sinful wadi
#

hey! i have a MC server with plugins and need some help, is anyone able to help?

#

I have a plugin that allows /back and /home, but it only works if a player is OPd, any way to change it so it works for anyone?

smoky oak
#

look up permissions

sinful wadi
#

im pretty unexperienced

#

where do i look for that

smoky oak
#

google spigot permissions how

sinful wadi
#

ty!

steady rivet
#

Is it possible to cancel a block break event but make it still drop the items?

tardy delta
#

drop the items yourself

smoky oak
steady rivet
#

I wanna say there is but I cannot remember

smoky oak
#

its part of the event i think

#

something something getdropitems

#

look up the jd

tardy delta
#

not sure if cancelling and still setting event.setDropsItems(true) will work

steady rivet
#

Moterius is correct here. I already tried that lol

#

I am gonna see if e.getBlock.getDrops(); does what I need since I see thats a thing

tardy delta
#

loop over it and drop them yourself

steady rivet
#

yeah thats what I just did haha

#

about to test it now

serene sigil
# hybrid spoke you could check the interval between the clicks and if its <5ms or whatever canc...

would this work?

if (event.getCursor().getType().equals(Material.DRAGON_EGG) && event.getClickedInventory().getType().equals(InventoryType.PLAYER)) {
            Player player = (Player) event.getClickedInventory().getHolder();
            player.giveExpLevels(100);
            event.setCancelled(true);
            Bukkit.getScheduler().runTaskLater(Main.getInstance(), new Runnable() {
                @Override
                public void run() {
                    event.setCancelled(false);
                }
            }, 5);
        }```
tardy delta
#

you cant cast an invholder to a player?

#

so no

#

?di might be smth to use for your plugin instance too

undone axleBOT
serene sigil
#

that part works completely fine

#

lol

smoky oak
# smoky oak

what's a methods erasure and why cant i overload like this?

long zephyr
#

guys someone knows why Hex Code doesnt works in NameTags ?

steady rivet
tardy delta
wet breach
tardy delta
#

mye just saw it in docs

#

kinda weird way to get a player tho

serene sigil
long zephyr
# steady rivet how are you formatting it?
public static String translateColorCodes(String message){
        if(message == null) return null;
        String startTag = "&#";
        String endTag = "";
        char COLOR_CHAR = ChatColor.COLOR_CHAR;
        final Pattern hexPattern = Pattern.compile(startTag + "([A-Fa-f0-9]{6})" + endTag);
        Matcher matcher = hexPattern.matcher(message);
        StringBuffer buffer = new StringBuffer(message.length() + 4 * 8);
        while (matcher.find())
        {
            String group = matcher.group(1);
            matcher.appendReplacement(buffer, COLOR_CHAR + "x"
                    + COLOR_CHAR + group.charAt(0) + COLOR_CHAR + group.charAt(1)
                    + COLOR_CHAR + group.charAt(2) + COLOR_CHAR + group.charAt(3)
                    + COLOR_CHAR + group.charAt(4) + COLOR_CHAR + group.charAt(5)
            );
        }
        String sr = matcher.appendTail(buffer).toString();
        String aux = null;
        try{
            aux = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(null,sr);
        }catch (Exception ignored){}

        if(aux != null){
            sr = aux;
        }
        return ChatColor.translateAlternateColorCodes('&', sr);
    }
tardy delta
#

tf

serene sigil
#

its InventoryClickEvent

long zephyr
#

i'm setting the name of the ArmorStand with setCustomName and sending a PacketMetaData

steady rivet
wet breach
long zephyr
long zephyr
#

but no in NameTag

#

x.x

steady rivet
long zephyr
tardy delta
#

ah (Player) event.getClickedWhatever()

#

forgot

steady rivet
# long zephyr ty :(

real quick. Are you trying to do nametags as in above the player or nametags like the item.

tardy delta
tardy delta
#

and private static final Pattern HEX_PATTERN = Pattern.compile("#[a-fA-F\\d]{6}");

#

const when

long zephyr
serene sigil
#

it breaks the server

#

use Bukkit.getScheduler

eternal oxide
#

depends how long the while loops

wet breach
#

it will loop a while

long zephyr
steady rivet
serene sigil
tardy delta
#

doesnt matter if it only runs half a ms or whatever lol

#

i think i'm going to jail by using lombok

echo basalt
#

lombok is fine

#

it gets converted to compiled code via a ton of jank

tardy delta
#

wow copilot what are we doing

ashen quest
#

How can I store a list of objects in YAML & then get them in code.

YAML syntax confuses me alottt

ashen quest
#

uhm i would not like serialization at this point

#

i just need to know how do u define a list of objects in yaml

eternal oxide
#

What objects?

ashen quest
#

like yaml objects

#

a ConfigSection with keys and values and stuff

#

a list of ConfigurationSections basically

eternal oxide
#

You need to read a YAML tutorial

#

?config

ashen quest
#

yeppp

#

?configuration

eternal oxide
#

there is somethign here but I can;t remember the command

ashen quest
#

?configs

undone axleBOT
ashen quest
#

ayy it was ?configs

long zephyr
ashen quest
#

no no iits not about reading

#

its about writing

#

i wanted to know the syntax

midnight shore
#

Hi, i want to display particles on a raytrace path, how can I?

long zephyr
ashen quest
#

I found it

smth:
  -
    key: value
#

smth is a listt

long zephyr
long zephyr
ashen quest
#

yes

#

well now i m kinda stuck, how do i serialize an ItemStack into a YAML object

#
  • does it store alllll of the data? like enchants as well?
ashen quest
#

how do u do it

long zephyr
#

wait me

ashen quest
#

ty fam

long zephyr
# ashen quest how do u do it
public static String encode(ItemStack item){
        if(item == null) return null;
        String encodedObject = null;
        try{

            ByteArrayOutputStream io = new ByteArrayOutputStream();
            BukkitObjectOutputStream os = new BukkitObjectOutputStream(io);
            os.writeObject(item);


            os.flush();

            byte[] serializedObject = io.toByteArray();
            encodedObject = Base64.getEncoder().encodeToString(serializedObject);
            io.close();
            os.close();
        }catch(IOException ex){
            ex.printStackTrace();
        }

        return encodedObject;
    }

    

    public static ItemStack decode(String encode){
        if(encode == null || encode.isEmpty()) return null;
        ItemStack item = null;
        try {
            ByteArrayInputStream in = new ByteArrayInputStream(Base64.getDecoder().decode(encode));
            BukkitObjectInputStream is = new BukkitObjectInputStream(in);

            item = (ItemStack) is.readObject();
            in.close();
            is.close();
        }catch (IOException | ClassNotFoundException ex){
            ex.printStackTrace();
        }

        return item;
    }
ashen quest
#

damnnn

#

ty familam

long zephyr
#

^^

long zephyr
ashen quest
#

no no

#

do u know JSON?

#

like this

[
  {obj},
  {obj2}
]
long zephyr
#

oh

#

i'm not the correct person xd

ashen quest
#

what does your encode function encode to?

#

yaml? or like b64?

long zephyr
#

Base64

#

but its work in yaml

ashen quest
#

gotcha fam

#

ill just store it as the value

#

wont cause any problems right?

long zephyr
#

noup

ashen quest
#
key: <b64 your code generates>
long zephyr
#

but ItemStack can be store in YML

#

no need seralize

ashen quest
#

how to?

#

i also need to store nbt data and stuff

green prism
#

How can I fix the fact that the inventory opens on onjoin but closes due to resourcepack loading? Can I make it open after the resource?

long zephyr
ashen quest
#

oh damn

green prism
echo basalt
#

completablefuture ?

wet breach
#

literally will let you do what you are wanting

echo basalt
#

in a sync environment

#

or a callable

#

type deal

wet breach
#

you wanted the inventory to open after the resource pack, that event will give you the status

#

all you have to do is check for the appropriate status and then open the inventory

green prism
#

Okay, we have a serious problem.
I am blind.

echo basalt
#

I wonder if we could do dynamic resourcepacks per-player

#

depending on context

wet breach
#

the statuses you can get

echo basalt
#

like, making special areas of the map that need a different pack

echo basalt
#

sure it would flicker a bit

green prism
#

But how can I check if there is no texture and then open the inv?

#

.SUCCESS? even if there isnt any texture?

wet breach
#

well if the server is setup to where it asks them to download, then if there is no texture they would have to have declined

#

otherwise they have accepted

#

once accepted, it will either be quick or take a few seconds for the status to be successful

echo basalt
#

man wants to check if it has been accepted prior to sending the request

wet breach
green prism
#

Honestly, I didn't understand what I want to do.
I noticed that when the texture is installed, (If there is in the server), the inventory gets closed

#

so I assume I have to check to see if the process is failed or success and if so open?

green prism
# wet breach this is technically possible

I understood my problem, I was going around it.
How can I know if the server has a resourcepack that will be installed to the player? I think I need to do this check at onJoin.

green prism
wet breach
#

well you are lucky you were here when I got off work 😛

#

otherwise you might not have known these things for a while XD

green prism
#

@chrome beacon taught me what I never understood about this

ashen quest
#

Does anyone know any GUI/Inventory APIs that make your life more sane

green prism
#

PlayerTextures textures = playerProfile.getTextures();
textures.setSkin(url);
playerProfile.setTextures(textures);

ItemStack head = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) head.getItemMeta();
meta.setOwnerProfile(playerProfile);
head.setItemMeta(meta);

ivory sleet
#

yeah

#

well one thing would be to cache the reflective look up

#

final Field profileField = skullMeta.getClass().getDeclaredField("profile");

#

cache it constantly

#

since every time you call that method, getDeclaredField will be invoked

#

which is, to say the very least not the lightest call

green prism
# ivory sleet cache it constantly

Personally, I am comfortable putting STATIC inventories with heads into a hashmap initialized at startup.
In the end, you don't feel the weight as much

ivory sleet
#

oh I wasnt talking about that, but Ig

green prism
#

I'm sorry, I didn't mean to reply ahhaa

ivory sleet
#

fair :>

green prism
#

Wait for Olivo

#

he's a legend

chrome beacon
#

1 sec

#

I got mfnalex to write a blog post about it

green prism
#

WOW! HE'S RESPAWNED!

tardy delta
green prism
ashen quest
hasty prawn
#

it is easy

abstract sleet
#

man do you want to get banned

green prism
#

cheater

hasty prawn
#

Sounds like a #help-server problem, and since you're using Paper you'll probably have to go there.

reef lagoon
#

I am godly at java

abstract sleet
#

after those pings I don't think you deserve help

hasty prawn
ancient plank
#

Don't ping random people for help @plucky citrus

#

No

abstract sleet
#

Can you go to the PaperMC discord?????

#

damn thats crazy

reef lagoon
#

Where would be the best place to store data about the player for a quest plugin

abstract sleet
#

you can use a relational database such as MySQL

chrome beacon
#

All textures are urls

#

Read the blog post 🙃

reef lagoon
abstract sleet
#

you can use SQLite

#

doesn't have to be remote

chrome beacon
#

What version are you on?

hasty prawn
#

Or JSON if you want a file

chrome beacon
#

💀

abstract sleet
#

update your server software

reef lagoon
hasty prawn
#

Generally YML is better for configuration and JSON for data storage IMO

abstract sleet
#

do you have to?

hasty prawn
#

You can definitely use YML for data storage, it's up to you.

chrome beacon
#

Then keep going with the reflection you were working on earlier

#

(or read the last part of the blog post) nvm that was 1.16

abstract sleet
hasty prawn
#

Yeah that works too I suppose

reef lagoon
#

I'll use JSON then

wet breach
reef lagoon
#

but it's faster

abstract sleet
#

^^ though it's just too convenient 😆

wet breach
#

its not

#

JSON is great for payloads

#

but it is not faster

abstract sleet
#

if your quest plugin is super simple and can work with a simple map of data then you can use the PDC though I still highly recommend just using SQLite

reef lagoon
#

i got scammed then

hasty prawn
#

Well neither was YML lol

hazy parrot
reef lagoon
#

well I said faster, not fast

wet breach
#

yaml is basically people making JSON a data storage medium

green prism
#

How can I make it so that if the server is sending a resourcepack and if it does it will open an inventory after success/download failed. Or if there is no resource to download/accept/decline..., open another inventory at join?

There is no isResourcepackRequired value in 1.16.5

abstract sleet
wet breach
#

yaml is built on top of JSON

wet breach
green prism
pulsar parcel
#

How can I add players randomly to teams to have the same number in each team? Specifically, I have made an onJoin() method and in that method I join players to teams. I thought of int team = random.nextInt(1,3); and then if (team == number) {team.addEntry(e.getPlayer().getName())} and that works, but I can't think of any way to split the players evenly.

wet breach
#

not entirely sure what you asking

wet breach
#

this lets you get the remainder and decide where they should be put

pulsar parcel
green prism
wet breach
#

probably will

#

not sure how that would be a counter to what I said though. That is the downsides of using outdated software

hasty prawn
#

It definitely will throw an error

#

The method won't exist on the 1.16 server PeepoShrug

abstract sleet
#

the 1.16 server does not have the method so it will not work regardless of however much you increase the spigot version

wet breach
#

I don't worry about outdated stuff

#

if you are using outdated stuff, then I am of no help

green prism
abstract sleet
#

if you use outdated stuff then you should be ready for any consequences :P

hasty prawn
#

frost do you only develop for the latest?

#

Or a few versions before as well

abstract sleet
#

what

wet breach
#

I have a plugin with over 80k downloads I think it is

#

and not once have I ever supported outdated versions

green prism
#

Well, leaving that aside, do you guys have any ideas for replacing isResourcepackRequired?

abstract sleet
#

LevelledMobs has been out since the 1.15 days and the vast majority of servers running it are 1.19.x, despite the latest version being compatible with 1.16.x onwards

wet breach
#

what it does take, is patience as well dedication to providing a quality plugin

wet breach
#

the only way would be to force the player to accept the texture pack

#

don't accept a decline as being valid XD

hasty prawn
#

I mean, PlayerResourcePackStatusEvent exists in 1.16.1

ashen quest
#

Do u guys know any Inventory prototypes tools? like u can design a prototype gui/inventory for referenace

wet breach
#

or disappeared

green prism
#

aaaarhugasdgfad.
I just need to make sure that the inventory doesn't close if some useless plugin sends a resourcepack

abstract sleet
hasty prawn
#

Well if you're not memorizing the entire javadocs for every version why are you here smh

wet breach
#

it was only like yesterday I remember armor stands not existing

#

and having to use invisible entities for holograms 😛

hasty prawn
#

ArmorStands were 1.8 weren't they?

wet breach
#

yes

#

because of holograms

#

so, how the holograms used to work actually relied on a bug

#

a bug that Mojang publicly stated they were going to patch in 1.8

hasty prawn
#

What really

ashen quest
wet breach
ashen quest
wet breach
#

if you set a horses age to a negative value, it turned it invisible all except its name tag

ashen quest
wet breach
#

this is how Holograms came about

wet breach
#

I know because I helped develop the first Hologram plugin 😛

#

Now, we don't take credit for discovering Holograms

abstract sleet
#

Thanks for the story. I didn't know people even attempted holograms back in the day

wet breach
#

just the making of the first plugin for it

hasty prawn
#

Now we have HolographicDisplays prayge

wet breach
#

Some person discovered this bug and it was a youtube video. Anyways me and few other bukkit dev staff at the time turned that into a plugin to provider it to serve owners as a feature

ashen quest
#

i get sage vibes from u

#

like the wise wise sages

wet breach
#

I know the developer for that plugin 😛

abstract sleet
#

Is filoghost still around?

wet breach
#

have no idea

#

wouldn't surprise me

hasty prawn
#

I mean HolographicDisplays is still updated afaik

#

Mar 12 2022 was last update

#

On Bukkit atleast

#

Oh, yeah filoghost committed to the repo 4 days ago, he's still around.

wet breach
#

Anyways

#

So one day some couple months before 1.8

#

Mojang states they are going to patch that horse bug and everyone got upset

#

because this meant that Holograms were going to go away

#

So Mojang was now forced to implement Holograms as a feature, hence armor stands are entities that can be invisible

#

Can thank HoloAPI and HolographicDisplays for making Holograms back then very popular 🙂

hasty prawn
#

Hey thanks! :D

wet breach
#

That is one of the biggest parts of history I enjoy having being part of

#

even if people don't know about HoloAPI anymore or that I helped XD

#

HoloAPI has 2 other developers that are not active in the MC scene as far as I am aware

#

DSH105 and CaptainBern

wet breach
modest garnet
#

Hey im aware this is not the place however i have a question about mongoDB, (if you dont know about mongo you can skip this q)

anyway ive got a "points" system which uses mongoDB for storage however i want a leader board command.
how would i filter through the database to get the top 10 members with most points

wet breach
modest garnet
#

wait whats the difference -1 the lowest 10?

tardy delta
#

i took a look in my books for college and i saw mongodb :(

wet breach
#

so if you want the person with the top points at the top it will be -1

#

and limit(10) will grab the first 10 results from that

modest garnet
fluid river
#

is points:-1 even a valid construction in Java?

modest garnet
#

?

fluid river
#

i never seen this

#

{value:-1}

wet breach
#

turn points into $points

fluid river
#

and it will give you a reason why it's red

wet breach
#

its probably the negative number

#

might need to add ''

worldly ingot
#

Lewi, are you writing in Java or MDB shell script?

worldly ingot
#

Right, so frostalf's example was a shell script ;p

modest garnet
#

oof

#

whats the best way for java if you dont mind

#

should of made it clear mb

worldly ingot
#

What are you using for libraries?

modest garnet
worldly ingot
#

Morphia?

modest garnet
worldly ingot
#

I meant for Mongo. How do you connect to Mongo ;p

wet breach
#

I don't spoonfeed, but knowing the shell way though should help you understand how to possibly achieve it in java depending on the lib you are using

vocal cloud
#

4.7.0 👀

worldly ingot
#

Ye. Depends on your lib

modest garnet
#

i cant lie i dont use mongo lol i just learnt most from some videos

and this is it

wet breach
#

but that driver looks old

worldly ingot
#

The concepts should be pretty interchangeable between frostalf's shell script and Java though

tacit yoke
wet breach
vocal cloud
#

Doesn't try with resources close the connection and thus the collection

wet breach
#

only if you do it properly

#

otherwise not necessarily

worldly ingot
#

oops

#

lol

tardy delta
#

hehe

wet breach
#

try (resource){} is the proper way for try with resources to auto close something

tacit yoke
wet breach
modest garnet
#

i tend to use sql

worldly ingot
#
MongoDatabase database = client.getDatabase("whatever");
database.getCollection("whatever").find().sort(new BasicDBObject("points", 1)).limit(10);
modest garnet
#

i might have found a solution tho

worldly ingot
#

In theory, that should work

#

At least given frostalf's example

#

Also not at all resource safe, handling closed connections, etc.

iron glade
#

Mongo in German can be literally used as an insult lol

tardy delta
#

same in dutch

#

thats why i hate that name

worldly ingot
#

Not sure what ascending is

wet breach
#

what exactly does it translate to?

tacit yoke
#

in italian too

vocal cloud
#

Can be in English too if you add more to the word

quiet ice
quiet ice
#

Could also be speech issues, idk. At least it isn't something that nice

wet breach
#

now that you said that, I am very much curious

quiet ice
#

I should know it given that I am german myself, but just knowing that it is an insult is enough for me

iron glade
tardy delta
#

discord on its best

vocal cloud
#

Yeah that's the word

#

It's considered extremely rude but tbh it sounds really funny

modest garnet
#

lol i use that word daily, its basically standard in uk haha

tacit yoke
# iron glade

same for italian and I'm guessing all close relative languages

iron glade
#

It's used quite often by teenagers in Germany as insult

wet breach
#

what the insult is

tardy delta
wet breach
#

you should compute it

#

even if it takes a million years to do so

vocal cloud
#

BigDecimal moment

tardy delta
#

mye

vocal cloud
#

If you have the memory BigDecimal has the number

tardy delta
#

precision kinda fails

#

bigdecimal only slow

wet breach
#

the other is down syndrome

tardy delta
#

hehe youre an old fish 🤓

wet breach
#

guess being called that in Germany is a big deal

#

I am going to use it on Minidigger

#

just to see how they react

tardy delta
#

lol

vocal cloud
tardy delta
#

either my calculator is wrong or my maths

#

probably last one lol

wet breach
vocal cloud
#

It's an insult in English too so I assume it's a European insult

quiet ice
wet breach
vocal cloud
#

I'd send the link but I can't. It's not a racist term it's just that it originally was used as a reference to a group of people and then eventually became used as a word for mentally slow

wet breach
#

I need to get my hands on a VR headset >>

#

so I can tinker with it

#

I need to progress the use of VR headsets in public

#

there is so many awesome things that become possible with them. Like how cool it would be to just get statues in your headset while walking around

#

or telling you how fast something is coming towards you

#

etc etc

#

would be neat to have a vr headset for driving XD

iron glade
tardy delta
#

Mongodb in my college books ;(

#

Literally only one page

vocal cloud
#

I love foreign textbooks that teach programming having English. It's so awkward

wet breach
green prism
#

is there any furnacegui api?
(for a clickable furnace)

tardy delta
#

got 300 pages of sql stuff

#

hehe smth to read

#

lol, both operands and result are doubles and still im not getting Infinity for the * one ;/

quiet ice
green prism
quiet ice
#

Although older teachers refrain from using english

quiet ice
wet breach
#

English is the best for programming

tardy delta
#

had to code in dutch in highschool :(

green prism
tardy delta
#

hated it

quiet ice
#

Try being more specific

green prism
#

bsdfgasgkadetg

quiet ice
#

Tip: While using the correct keywords helps, using the wrong keywords is very bad - try to use proper english words

green prism
#

I want to the left bar an up and down arrow and on the right the selection in the result

quiet ice
#

?jd-s

undone axleBOT
green prism
#

I'm lazy, something more like a simple api?

#

🙂

quiet ice
#

I mean setting those properties isn't that much of a deal

wet breach
#

they are going to sell you

#

so I think now we need to determine the price the opening bids should start at

green prism
#

0

#

hes my boy, you cant sell him

quiet ice
#

While yes, apis probably exist - I have never fumbled with it

quiet ice
quiet ice
#

And certainly not yours

green prism
quiet ice
minor fox
#

Does the client always end the title if a subtitle with shorter duration is sent, or is there a solution?

quiet ice
#

Do you want the furnace GUI to be fundementally different or is there something different you want

fair sable
#

Hello, I am trying to spawn armor stand with packets in 1.19.2 but no matter the entityType it always spawns alloy. Can anyone help? ```java
int entityID = new Random().nextInt();
final PacketContainer packetContainer = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);

            final int entityType = Integer.parseInt(args[1]);
            final int extraData = 1;
            packetContainer.getIntegers().write(0, entityID);
            packetContainer.getIntegers().write(1, entityType);
            packetContainer.getIntegers().write(2, extraData);

            packetContainer.getUUIDs().write(0, UUID.randomUUID());

            Location location = player.getLocation();
            packetContainer.getDoubles().write(0, location.getX());
            packetContainer.getDoubles().write(1, location.getY());
            packetContainer.getDoubles().write(2, location.getZ());

            ProtocolLibrary.getProtocolManager().sendServerPacket(player, packetContainer);
green prism
quiet ice
green prism
#

ok, I should stop

#

no more gayism

quiet ice
#

Although as you correctly identified managing/protecting the inventory is another question

green prism
#

I see, it sounds smart from the way you explained it, thank you

quiet ice
#

Only issue is that the properties are reset when the view is closed/reopened

long zephyr
#

Hello guys, i need help with something :(
i'm trying to translate the color of string with hex code,
but i'm getting the wrong color or just its not printing any color
its happens only with display names, in chat its working

code:
|| ```java
public static String translateColorCodes(String message){
if(message == null) return null;
String startTag = "&#";
String endTag = "";
char COLOR_CHAR = ChatColor.COLOR_CHAR;
final Pattern hexPattern = Pattern.compile(startTag + "([A-Fa-f0-9]{6})" + endTag);
Matcher matcher = hexPattern.matcher(message);
StringBuffer buffer = new StringBuffer(message.length() + 4 * 8);
while (matcher.find())
{
String group = matcher.group(1);
matcher.appendReplacement(buffer, COLOR_CHAR + "x"
+ COLOR_CHAR + group.charAt(0) + COLOR_CHAR + group.charAt(1)
+ COLOR_CHAR + group.charAt(2) + COLOR_CHAR + group.charAt(3)
+ COLOR_CHAR + group.charAt(4) + COLOR_CHAR + group.charAt(5)
);
}
String sr = matcher.appendTail(buffer).toString();

   return ChatColor.translateAlternateColorCodes('&', sr);

}

tardy delta
#

why didnt you use the damn thing i sent

#

also why tf use a stringbuffer, those are threadsafe and slow

#

hehe

echo basalt
tardy delta
#

mye

#

people just saying shit instead of giving an useful answer lol

molten hearth
#

imagine giving useful answers

tardy delta
#

imagine being useful

long zephyr
long zephyr
#

its still without works

tardy delta
#

lol wanna use a five line method or a hundred lines one

long zephyr
tardy delta
#

ok im out then

long zephyr
quiet ice
#

Does anyone know if the ${osgi.platform} substitution has any specially defined value in maven?

queen apex
#

Possible to create totem animation?

opal juniper
fluid river
opal juniper
fluid river
#

4 and 5

#

are swapped

opal juniper
#

yep

wet breach
#

it doesn't work on non-result producing statements

opal juniper
#

yea, i was just trying everything i saw on stackoverflow lul

wet breach
opal juniper
#

again, see previous comment

rotund pond
#

Hey, do you have the link to the topic about using getInstance in plugins ?

wet breach
opal juniper
#

that solved it

undone axleBOT
opal juniper
#

cant you just do JavaPlugin.getPlugin(YourMainClass.class)

#

but yeah, di it

wet breach
rotund pond
wet breach
#

but it generally isn't the main class where the problem arises

hardy lynx
#

Hello everyone! I wanted to ask a question: "But how do you publish your skript on SpigotMC" ?

rotund pond
hasty prawn
fluid river
# rotund pond Wdym ?

basically 3 lines of getter, one line of field declaration, on line in onEnable() of initialisation

#

And one line to use when you need

#

actually you can do it with 2 lines without getter, but only if java supports static imports

rotund pond
#

I don't understand

fluid river
#

Learnjava

#
private static YourMainClass instance; // 1

public void onEnable() {
    instance = this; // 2
}

public static YourMainClass getInstance() { // 3
    return instance; // 4
} // 5```
#

to use in other class

#

just use YourMainClass.getInstance() when needed

rotund pond
green prism
#

can I use java 17 plugins in 1.16?

twilit roost
#

I made one Util Plugin
and I want to use it in my other plugin

I have depends: set to Util
also I have shaded version of 2nd plugin in /plugins/ and Util plugin also included in /plugins/

#

but it still doesn't
work

by that I mean, utility plugin doesn't start?

lethal knoll
#

Got a question, I'm making a plugin to select 2 positions. Upon demand, it will remove all the blocks (like WE) between those points and upon demand also restore. Now the question is, how bad would be it to actually store every individual block location and it's data so that in case of a server crash, you can still restore the cuboid zone. Everything is stored in a custom config so it would mean that the entire file is loaded into the memory

fluid river
#

thought you need help with it

tender shard
twilit roost
#

yes I did
the Utility plugin works fine seperately
but doesn't work in other plugins

tender shard
#

well but you only do it in onEnable, why do you wait so long

#

set it in the init block

delicate lynx
#

static getter 🤦

tender shard
#
private static MyThing instance;

{
  instance = this;
}
twilit roost
#
private static Pelican instance;
{
    instance = this;
}
public static Pelican getInstance(){
    return instance;
}

so like this?

tender shard
#

yes

odd wedge
twilit roost
#

still same error
should I set scope to provided?

tender shard
#

oh yeah ofc you must not shade it into some othe rplugin