#help-development

1 messages · Page 2275 of 1

undone axleBOT
waxen plinth
#

I'm pretty sure it's on ItemMeta

#

Look at the docs for Attribute and AttributeModifier

thick gust
#

How can u make spigot plugins compatible for multiple versions? (1.18, 1.19, etc)

eternal oxide
#

don;t use NMS

#

set teh api version in the plugin.yml to the lowest you want to support

#

build against the minimum version you are to run on.

river oracle
#

If you want to use api on newer versions use reflection and proper logic

#

Cache fields on runtime if your using them a lot as well

unborn kiln
#

Is there a way to add custom blocks with custom textures via spigot build tools?

dusk flicker
#

via build tools? no

#

via plugins, sure

unborn kiln
#

I'm just trying to make a custom block like this

#

But I don't know how to go about doing it

#

Nothing that I saw on the internet really met my expectations/hopes

stuck flax
#

How do I completely freeze a player, I don't want them to be able to move, turn their camera (etc)

pastel juniper
#

``
public class RedPanda extends Fox {

public RedPanda(Location loc) {
    super(EntityType.FOX, ((CraftWorld) loc.getWorld()).getHandle());

    this.setPos(loc.getX(), loc.getY(), loc.getZ());

    this.setCanPickUpLoot(false); // Can Pick up Loot
    this.setAggressive(false); // Aggressive
    this.setBaby(false);
    this.setCustomNameVisible(false); // Custom Name Visible
}

}
``
can sb explain to me how to add passengers on this fox

waxen plinth
somber hull
#

if (!itemStack.hasItemMeta() || (!itemStack.hasItemMeta())) return;

#

I think i meant to do if (itemStack.getItemMeta() == null || (!itemStack.hasItemMeta())) return; and just had an aneurism

pastel juniper
somber hull
pastel juniper
somber hull
#

np

pastel juniper
#

XD

somber hull
#

Lmao

#

I know that feeling

#

I screenshotted the first time i help[ed someone lmao

pastel juniper
#

XD

somber hull
#

Im not very familiar with gson

#
    public DataManager(StartupClass plugin) {
        configFile = new File(plugin.getPlugin().getDataFolder(), "data.json");
        System.out.println("1");
        try {
            fileWriter = new FileWriter(configFile);
            System.out.println("2");
        }catch(IOException e){
            e.printStackTrace();
            System.out.println("err");
        }
        initializeConfig();
    }
    
    /**
     * Should only be used by this class to grab/create the config
     */
    private void initializeConfig() {
        
        try {
            if (!configFile.exists()) {
                gson.toJson(new Data(), fileWriter);
                System.out.println("4");
            }
            config = gson.fromJson(new FileReader(configFile), Data.class);
            System.out.println("5");
        } catch (IOException e) {
            System.out.println("6");
            e.printStackTrace();
        }
    }
    
    /**
     * Gets the Data object the config is held in.
     * @return Returns the config object.
     */
    public Data getConfig() {
        return config;
    }
glossy scroll
# pastel juniper

yea its ok i dont feel like having a 14 year old accuse me of static abuse

somber hull
#

GetConfig is returnning null

glossy scroll
#

im just gonna use static

#

cant think of another way to do it thats elegant

somber hull
#

Wich is good

glossy scroll
#

honestly i would just use an 8x8 pixel image of wings and just translate it into particles

#
for (int y = 0; y < image.getHeight(); y++) {
            for (int x = 0; x < image.getWidth(); x++) {
                int rgb = image.getRGBAt(x, y);

                if (rgb == 0)
                    continue;

                Location loc = player.getLocation().clone();

                double newY = image.getHeight() - y;
                double newX = image.getWidth() / 2.0 - x;
                newY *= (3.0 / image.getHeight());
                newX *= (3.0 / image.getWidth());

                //get position relative to player. += is to move it to the player's back
                float deltaZ = (float)(newX * Math.sin(Math.toRadians(loc.getYaw())));
                float deltaX = (float)(newX * Math.cos(Math.toRadians(loc.getYaw())));

                loc.add(new Vector(deltaX, newY, deltaZ));
                Color color = Color.fromRGB((rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff);
                // spawn particle with color/loc
            }
        }
#

thats my code

#
                "Ex8po48r5D8udJVq43HdjqJ3LSXx+mAAAAAAAAAAAA8nk4Nf2SJAAAAA10Uk5TAP///////////////y0EQa0AAABZSURBVBiVdUxJE" +
                "sAgCIsUJhz8/3sLWPFSc8gGE+CK0Wa52WFINuOpnF40eerMrAKoJRckPKoxhtJWhhjNQz10/bIejsaN3vw1vukKGnqgssaAnsadcPB/" +
                "5AXUbAHBZ7eW9wAAAABJRU5ErkJggg==");```
#

my image

#

that is what I personally did

#

something like this

#

the Base64 I have is iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAACdQTFRFAAAA5j Ex8po48r5D8udJVq43HdjqJ3LSXx+mAAAAAAAAAAAA8nk4Nf2SJAAAAA10Uk5TAP///////////////y0EQa0AAABZSURBVBiVdUxJE sAgCIsUJhz8/3sLWPFSc8gGE+CK0Wa52WFINuOpnF40eerMrAKoJRckPKoxhtJWhhjNQz10/bIejsaN3vw1vukKGnqgssaAnsadcPB/ 5AXUbAHBZ7eW9wAAAABJRU5ErkJggg==

#

you can try to decode it to an image

#

for an example

glossy scroll
#

I also used org.bukkit.Color

#

oh oops

#

apparently its a custom class i wrote

#

hold on

#

?paste

undone axleBOT
glossy scroll
#

ignore UtilError

#

just use e.printStackTrace or smt

#

yea something like that

#

just whatever you normally put in a catch block

white talon
#

how can I add an invisible item frame to the bukkit inventory? (in the game we usually type /minecraft:give @p item_frame{EntityTag:{Invisible:1b}} to get it)
I have this code right now, there I defined a display name tag, but I didn't found how to define the invisible tag for that
https://paste.md-5.net/hipesezate.http

somber hull
glossy scroll
#

are you using org.bukkit.util.Vector?

glossy scroll
#

entity tag meta is not exposed in the Bukkit API

#

you would need to access NMS

white talon
glossy scroll
#

net.minecraft.server

#

in this case, you would be accessing craftbukkit

white talon
#

is there easy way to do this?

glossy scroll
#

it prevents your plugin from being used on multiple versions without modularizing

white talon
#

like just import net.minecraft.server;?

glossy scroll
#

well in this case

#

your itemmeta would be

#

CraftMetaEntityTag

white talon
#

new at spigot dev

#

should I change ItemMeta to CraftMetaEntityTag

#

it doesn't allow me to import net.minecraft.server;

glossy scroll
#

actually

#

hm

#

i think this is not possible

#

without some really crazy stuff

white talon
#

is it so hard to spawn an item with custom tag?

#

not even custom, vanilla tag but custsom defined

somber hull
glossy scroll
#

you would just make an 8x8 image

#

or any size, i just use 8x8 cuz thats easiest

#

and you can draw anywhere on that image to create your shape

#

yes... just be aware the processing power is n^2 for whatever iamge you choose

#

so thats

noble lantern
#

Yes but it doesnt exist in that class

glossy scroll
#

4096 iterations

noble lantern
#

hence why your getting the error calling this

glossy scroll
#

you could probably optimize it by only storing necessary values

#

and looping over the pixelsy ou need

#

but i think my solution is pretty simple for smaller images

noble lantern
#

Like name tag?

white talon
#

no

noble lantern
#

PDT?

#

NBT?

#

MetaData?

white talon
#

I wanna add an invisible item frame to the inventory

#

nbt yes

noble lantern
#

For invisible hmm

#

i beileve

white talon
#

usually we are typing this in game /minecraft:give @p item_frame{EntityTag:{Invisible:1b}}

#

to get it

noble lantern
#

You can get the block data of the ItemStack that is a ItemFrame

#

and then ItemFrame#setInvisible(true)

#

and then get the block data back to ItemStack

#

it entity

#

whatever tf its called

#

tile entity

#

that

white talon
noble lantern
#

or you could use NBT tags

#

i cant remember the exact process behind this, i know it for NoteBlocks but theyre a real tile entity

#

where as it seems ItemFrames are barebone entities

#

i know what you can do

#

here this is way easier

#

are you on 1.14?

white talon
#

???

#

1.18.2

noble lantern
#

or higher

#

perfect

#

?pdc

noble lantern
#

add a pdc tag of whatever with a key of invisible and a value that will represent "true" to you

#

and when someone placed that ItemStack with the invisible pdt, get the block location, get the entity at location, cast to ItemFrame (Cast check i mean) and then setInvisible

white talon
noble lantern
#
@EventHandler
public void onInteract(PlayerInteractEvent e) {
    if (!e.isRightClick()) return;
    if (e.getItem().getType() != Material.ITEM_FRAME) return;
    if (!e.getItem().doesntHasPdcTag()) return;

    // do that stuff i said
}
#

psudo code

#

but what you can do ^

white talon
noble lantern
#

because you didnt define your pluginInstane variable

#

You can use DI or a static getter

#

?di

undone axleBOT
white talon
#

or something?

#

what should I type for this variable

noble lantern
#

its your pluginInstance

#

ie

#

an instance of your plugins main class

river oracle
#

String PluginInstace? interesting one

noble lantern
#

not a String

noble lantern
#

Thought this was standard by now smh

white talon
#

my main class is called BuildingHacks

river oracle
#

learn some more java before you continue do yourself a favor

noble lantern
#

or dependency injection

#

which is way nicer

white talon
#

hmm error is gone

paper viper
#

?learnjava btw for resources

undone axleBOT
noble lantern
#

wth yall doing with all this 16x16 8x8 64x64 stuff

#

server icons?

#

okay i see the rocket scientists are in the channel

#

oh fr

#

thats actually interesting

#

like no vector and velocity math whatsoever?

#

if so that is quite literally rocket science

#

ggs (good jobs)

#

thats cool asf i hope to see this plugin around some day that sounds dope

#

You could let players draw theyre own wings

#

I would personally just have ymy wings be 2 penises, but thats me

buoyant walrus
#

Does SpigotMC have an API for updating resources?

noble lantern
#

i mean yes and no

#

like for pushing updates right

buoyant walrus
#

Yes.

noble lantern
#

It has an API, just not sure if its publicly exposed/documented

#

you could 100% reverse enineer it using f12 console while pushing and update tho

#

just get the rest urls and bam

buoyant walrus
#

Hmm, okay. Thank you.

noble lantern
#

Oh i forgot spigot uses Xenforo

#

might be of help for firguring it out

buoyant walrus
#

I looked it up and Xenforo itself requires Administrators to create an API key

#

But there is options to limit it to a certain users permissions

noble lantern
#

check your cookies for a user key

#

might be one there

#

will likely be encrypted tho

shell wraith
#

Is this of any use?

buoyant walrus
#

Sadly not, that seems to be a read only api.

#

I'm trying to publish a resource.

noble lantern
#

I would assume your can execute POST as long as you can find your user JWT token or something

buoyant walrus
#

I'll look into it, thanks Burchard

noble lantern
#

idk how to saerch cookies in chrome or ide check

#

yep

#

xf_user

buoyant walrus
#

Cloudflare might be an issue.

#

Depending on how it's setup

noble lantern
#

Im just not sure if this is encrypted or not which will be another issue, might not be though

#

I mean requests are executed client side anyways i beileve

#

so shouldnt be

#

posted client side**

#

not executed

#

that would be bad lol

buoyant walrus
#

Cloudflare sometimes checks browsers

noble lantern
#

just send a fake user agent

#

Like mozilla or smthn

shell wraith
#

FYI xf_user is $userId. ',' . $this->prepareRememberKeyForCookie($auth['remember_key']);

noble lantern
#

hmm

#

what does prepare do? Does it do any encrypting?

#

or just sets the cookie to the client

#

as long as the token isnt encrypted by spigot before it reaches xf this should all be doable

buoyant walrus
#

I doubt I can use this to access the actual REST api though

#

It will likely only give me access to the form

noble lantern
#

why not REST apis are mostly public

Idk how xenforo really works, but a REST server is a REST server

#

and anyone can contact a REST server

iron glade
#

Anyone has an idea why when I save my default config this
Color: 222:31:18
turns into this
Color: 801078 ??

noble lantern
#

encapsulate it

#

"222:31:18"

iron glade
#

tried that and than it works

#

but the funny thing is i have another one above it

#

and there it works like that

#

without " or '

noble lantern
#

show your yaml maybe the one above is valid yaml with it

buoyant walrus
iron glade
#

the Color from Join stays as it is when using saveDefaultConfig(), the one from Quit gets weird

#

also if I put " or ' in front of both colors, the one from join gets saved without those " or ' while the one from quit has them

noble lantern
#

for profile post endpoint

#

this is the data structure

#

youll have to figure out wtf those token are

#

theres multiple in the bottom one seperated by commas

#

its 100% just a basic rest server

#

you could send this exact request with a rest client in your browser

#

i dont have a resource to upload or else ide upload its schema

That one likely requires some type of stream though maybe

buoyant walrus
#

I'm more worried about the cookies imo

noble lantern
#

this is where ifound my rest info at

#

yeah cookies is gonna be a bitch bc they will refresh

#

idk the timer for a spigot token refresh

#

so this solution would only be temporary until cookies on your browser reset with new tokens

buoyant walrus
#

Also most of the forms have a _xfToken field

noble lantern
#

i know what the second and third one is

#

1st comma is your user id

#

2nd idk, it looks like some internal user id

#

and the 3rd is one of your cookies

buoyant walrus
#

Oh, it's reproducible

noble lantern
#

yes

#

it is

buoyant walrus
#

The second one looks like a timefield

noble lantern
#

okay even better

#

both xfToken fields in my sceenshot

#

are the same

#

so you just need, your user ID, the internal ID

#

annnd

#

this cookie here sec

#

xf_session

buoyant walrus
#

Yeah, that might be do-able then.

noble lantern
#

is the key you need

buoyant walrus
#

Would still be nice to have a proper api key, that would mean I wouldn't have to mess with cookies. If there is some way to get one looks at forums staff I'd love to know 🙂

noble lantern
#

dont think theyde do it sadly

#

just opens up security vulnerabilities that they have to worry about

buoyant walrus
#

It wouldn't be a permission issue. The api has built in restrictions.

#

For permissions

#

But yeah, I'll work on this method for now, thanks Burchard

#

I think I have everything I need now

#

As long as Cloudflare isn't too restrictive

noble lantern
#

there is CF cookies so you can maybe do something with those too if they arrise

#

i dont think youll have an issue with cf

buoyant walrus
#

On certain configurations cloudflare will detect non-standard clients

#

And changing the user agent won't do anything

noble lantern
#

oh this gonna suck

#

every single cookie

#

you need to pass into your physical rest request (Not the data of it)

buoyant walrus
#

Every one of them?

#

I mean if the data doesn't matter that won't be an issue

#

But I figured only some of them would be needed

noble lantern
#

that in the POST request headers

#

you might be able to make a java program to snag cookies from your browser, idk

buoyant walrus
#

They often don't check every single cookie

noble lantern
#

nah likely not like the certs and colornames

buoyant walrus
#

You can often copy it to a curl request

#

Not sure if that includes cookies..

#

It does

noble lantern
#

cant find the button on chrome sad

#

and i cant viewraw on headers

#

only for response

#

all in all why would you even wanna do this

#

sounds like more pain than its worth

#

even if there was a publicly documented api

buoyant walrus
#

If there was a publicly documented api it would make it a lot easier to publish updates when I make a release on github

#

Most of the cookies are unneeded by the way

#

I can't post images

noble lantern
#

link ur acc to spigot

#

disc acc

buoyant walrus
#

Oh, okay.

#

As you can see it doesn't contain the color ones and such I think

noble lantern
#

anything special happen or nah

buoyant walrus
#

I got some binary content back

noble lantern
#

Yeah color ones just seem to be for colors of the website or some other bs

#

yeah its likely a buffer of some sort

#

might need to do it through a java program or nodejs

buoyant walrus
#

I mean I don't much care about the content

#

If it works

noble lantern
#

oh yeah true your only posting a file

buoyant walrus
#

nods

#

Not even a file

#

Just a link to the new release on github

#

So I don't have to worry about having to send a whole file in the POST

noble lantern
#

ohh even smarter

#

so

#

idea

#

to avoid ALL this shit

#

make a tag called LATEST on github

#

point your spigot url to that

#

when you update, make a tag for your old code and upload

#

delete old latest, reupload to new latest tag

#

url stays the same

#

code changes

buoyant walrus
#

It wouldn't send an update on the site.

noble lantern
#

ez

buoyant walrus
#

So users wouldn't know anything changed

noble lantern
#

oh shit

#

damnit spigot

#

i cant win man

#

yeah no easy way to do it unless optics lurking and laughing at us

#

or choco

#

"hehee dumbasses there is documentation all along"

buoyant walrus
#

Lol.

#

That would be nice.

#

I mean I got most of it figured out. As long as cloudflare isn't a d* it should work.

#

I can't test it until the next update of my plugin

noble lantern
#

your biggest thing is just gonna be the session tokens

#

cause those definatly change idk how often tho

buoyant walrus
#

True, but those should stay the same for quite a while hopefully

noble lantern
#

a lot of standard experations are ~4-8 hours

#

or 30 minutes

#

its either 4 or 8 hours, or 30 minutes lol

#

never see anythin different

#

JWT's default experation is 30 mins iirc

buoyant walrus
#

Shouldn't it be longer if you have remember me selected? o-o

noble lantern
#

oh no 24 hours

#

remember me is just so the website knows to store your session

#

typically thats a client sided button, nothing on the server ever happens

#

if its unchecked, the session just goes to a variable in the code

#

checked, saves session to from cookies

#

i worded the last one badly

#

cant fix it

#

you know what i mean lol

buoyant walrus
#

Well, let's hope we can use it for longer

#

Still a pain tho

noble lantern
#

at that point i would just manually update it ngl

buoyant walrus
#

True..

noble lantern
#

Cause its useless if you gotta go to it every few hours updating a token

buoyant walrus
#

I'll contact forum staff and ask for an API key

noble lantern
#

maybe theyll give it, never know

buoyant walrus
#

Mhm, it's worth a shot.

noble lantern
#

i think getLocation returns the players feet location

#

so just go one block above

#

if != Air hes crawling or suffocating

#

and if getLocation if head location

#

same thing

#

cause his head will be where his feet are lol

#

i was about to say - 1 from the y but then realized it would be same location haha

#

caught myself

#

just use player location

#

yes that one

#

i just with javadocs said if it was feet or head, but for you it wont matter

#

ofc

#

oh no

#

not that

#

you need to get the block above

#

and check if its type == air or not

#

if its air, hes likely standing up

#

you may wanna check both feet and head locations

sterile token
#

Any good idea for a mines plugin?

noble lantern
#

and see if both blocks above both are air

Because in some circumstances a player head can have air above, but the feet can still be under a block making the player crawl

noble lantern
#

with upgradable sizes and stuff

sterile token
#

They did it open source?

humble tulip
#

I was working on it

#

Gave up cuz lost motivation

hardy swan
#

This is a git question, any reason why rebasing deletes newly added files?

quaint mantle
#

Because you're rebasing

hardy swan
#

That doesnt make sense

#

Ok not really deletes newly added files, but some new commits are lost

#

😦

#

Fml

hardy swan
echo basalt
#

isAir is 1.14+, might break backwards compatibility

lost matrix
echo basalt
#

👀

buoyant viper
#

if block instanceof air

#

wait this isnt nms

glossy scroll
lethal coral
#

Do client borders that are created & set to a player persist?

lost matrix
lethal coral
#

Alright thank you

vocal cloud
#

Tryitandsee kinda thing

noble lantern
wicked totem
#

im having a bit of trouble rn setting the type of a block. for some reason i can get the type but cant set it. would the fact that i am doing this in a timer be the issue? when i run the set type it does break the timer so thats what im assuming. if so what might be a workaround?

weak kayak
#

i think it's fair to not want to support them but i personally like to

spare marsh
#

Quick question. So I am doing this to spawn a Ender Dragon to a player but it spawns a phantom. The ID of a Dragon in 63

#
PacketContainer packet = manager.createPacket(PacketType.Play.Server.SPAWN_ENTITY_LIVING);
            packet.getIntegers().
                    write(0, 343).
                    write(1, (63);
            packet.getDoubles().write(0, p.getLocation().getX())
                    .write(1, p.getLocation().getY())
                    .write(2, p.getLocation().getZ());```
echo basalt
#

cross reference it with wiki.vg for the version you're running

#

Or you can just debug the entitytype iregistry

#

in 1.18.1 I know it's IRegistry.Z

#

@spare marsh

somber hull
#

Getting a funky error

#

Exception while handling onBottomClick, slot=4 java.lang.UnsupportedOperationException: null

#

itemList.add(itemClone);

#

ItemList seems to be empty, but not null

echo basalt
#

how did you get that list

somber hull
#

ANd thats the issue

echo basalt
#

Collections.emptyList ?

somber hull
#

new ArrayList<>();

echo basalt
#

usually that issue only happens with Arrays.asList or Collections.emptylist

somber hull
#
        if (!playerListMap.containsKey(playerUUID) || playerListMap.get(playerUUID) == null || playerListMap.get(playerUUID).length() == 0) {
            return new ArrayList<>();
        }
#

Oh

#

wait

#

I might be using asList

#

return List.of(SerializationUtils.deserialize(playerListMap.get(playerUUID)).clone());

#

Leme see where the issue stands in this area of the code

#

leme debug rq

somber hull
#

This is the issue

#

Deserialize returns a ItemStack[] that needs to be a list

somber hull
echo basalt
#

use an arraylist

somber hull
somber hull
#

But it wont let me clone it now because its not an object

#

How do i clone a collection?

#

nvm

#

new ArrayList<>(ListToClone);

somber hull
#

Ok

#

I fix

crude charm
#

I want to make a system where players can put an item in a menu and can retrieve those items through a different means later and when they reopen the menu, the same items with the same nbt properties will be there. How should I go about storing this? I want it to be scalable to hundreds and thousands of players, not just a config file, system memory or something that can easily break

lost matrix
#

Back the inv in a collection and use it in both events

hardy crystal
crude charm
reef lagoon
#

Where are hashmaps stored

ivory sleet
#

in memory

shadow zinc
#

hashmaps op

#

I got a question

#
        for (String arg : args) {
            switch (arg) {
                case "-all":
                    clearAll = true;
                case "-force":
                    //This arg automatically confirms cluster deletion
                    toBeConfirmed.add(playerAsPlayer.getName());
                case "-world":
                        world = Bukkit.getWorld(args[1]);
                        if (world == null) {
                            MessageUtil.sendMM(player, plugin.getLanguageManager().getString("commandGeneric.errorWorldNotFound", null));
                            return;
                        }

            }
        }```
#

for something like this

#

where I create a command that has -args

#

is it best doing it like this?

#

or is there another way that is easier to manage?

#

I tried experimenting with enums but it started to get confusing

lost matrix
# shadow zinc or is there another way that is easier to manage?

A switch case is ok. There are better ways of parsing flags in a command. Usually you have something called the command stack of which you pop arguments.
Command:

/command -type nether -force -world super cool world

Resulting in this command stack:

world
cool
super
-world
-force
nether
-type

You pop until you get a processable command. Everything before that is an argument.

pop > world
pop > cool
pop > super
pop > -world = processable
# invoke '-world' with 'super cool world'
pop > -force = processable
# invoke '-force'
pop > nether
pop > -type = processable
# invoke '-type' with 'nether'
shadow zinc
#

then a simple for loop to check for flags?

lost matrix
#

Are we speaking about the identifier (String representation) or the invoceable?

#

You create a Stack<String> from the String[] args

#

And then pop arguments from the top

#

Let me write an example

shadow zinc
#

I wrote this up

#
        Stack<String> argsStack = new Stack<>();
        for (String arg : args) {
            argsStack.push(arg);
        }
        while (!argsStack.isEmpty()) {
            String arg = argsStack.pop();
            if (arg.equalsIgnoreCase("-all")) {
                clearAll = true;
            } else if (arg.equalsIgnoreCase("-force")) {
                clearAll = true;
                world = playerAsPlayer.getWorld();
            } else if (arg.equalsIgnoreCase("-world")) {
                String worldName = argsStack.pop();
                world = Bukkit.getWorld(worldName);
            }```
#

is that what you were talking about?

#

this is better for me, I just kinda hate the if statements

lost matrix
summer scroll
#

How can I know how to calculate the number of the Bit Mask? I got confused, all I know is If you want to enable all skin parts, you need to put 127 byte.

lost matrix
summer scroll
#

Ah okay

lost matrix
#

And if you want to just set every bit to '1' you simply do

byte flags = 0xFF;
#

Wait thats unsigned

summer scroll
#

Can I like assign value outside the instantiation?

#

Like originally I had byte flags = 0x01; but I want to add another value let's say 0x02, is it possible?

lost matrix
#

So your question is: Can i do declaration without initialisation

lost matrix
#

At any point as long as its not final

summer scroll
#

Basically I want to have an option to enable/disable specific skin part on the config.

lost matrix
#

Ah i see what you mean. One moment

lost matrix
summer scroll
#

I never seen that lmao, |=.

#

Anyways, thank you so much!

shadow zinc
lost matrix
shadow zinc
#

all g, no rush

lost matrix
# shadow zinc all g, no rush
public class WorldCreationCommand implements CommandExecutor {

  static class WorldCreationAccumulator {
    public void force() {
      // Do stuff
    }

    public void world(String name) {
      // Do stuff
    }

    public void type(String name) {
      // Do stuff
    }

    public boolean complete() {
      // Do stuff
    }
  }

  private static final Map<String, BiConsumer<WorldCreationAccumulator, List<String>>> PROCESSORS =
          new ImmutableMap.Builder<String, BiConsumer<WorldCreationAccumulator, List<String>>>()
                  .put("-force", WorldCreationCommand::force)
                  .put("-world", WorldCreationCommand::world)
                  .put("-type", WorldCreationCommand::type)
                  .build();

  private static void force(WorldCreationAccumulator accumulator, List<String> arguments) {
    accumulator.force();
  }

  private static void world(WorldCreationAccumulator accumulator, List<String> arguments) {
    accumulator.world(String.join(" ", arguments));
  }

  private static void type(WorldCreationAccumulator accumulator, List<String> arguments) {
    accumulator.type(String.join(" ", arguments));
  }

  @Override
  public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
    Stack<String> commandStack = new Stack<>();
    commandStack.addAll(Arrays.asList(args));
    List<String> commandArgs = new ArrayList<>();
    WorldCreationAccumulator accumulator = new WorldCreationAccumulator();
    while (!commandStack.isEmpty()) {
      String element = commandStack.pop();
      if (PROCESSORS.containsKey(element)) {
        PROCESSORS.get(element).andThen((acc, list) -> list.clear()).accept(accumulator, commandArgs);
      } else {
        commandArgs.add(element);
      }
    }
    return accumulator.complete();
  }

}
#

This is a bit crammed and should probably be split into several classes.
And some abstraction is also something to consider

shadow zinc
reef lagoon
#

is 17MB for a plugin normal

shadow zinc
#

1.7

#

might be okay

#

17

#

thats a lot

royal vale
#

What's the difference between getPlayerListName and getName?

opal juniper
shadow zinc
#

what libraries you get in there?

opal juniper
#

That’s huge

reef lagoon
#

uh jda

opal juniper
#

what mc version are you targeting

#

@reef lagoon

reef lagoon
#

i got jda mongodb and log4j

formal bear
#
    public static void connectPlayers(Player player, String server) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("Connect");
        out.writeUTF(server);
        player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
    }

Is it written correctly to change players server? It does not seem to work for me, when passing player and server name on bungee

reef lagoon
opal juniper
#

ok - use the library loader

reef lagoon
#

what's that

#

I'm using maven btw

lost matrix
shadow zinc
#

are shadowing your entire p stash?

opal juniper
#

look at “libraries”

formal bear
reef lagoon
#

alright thank you

lavish folio
#

in 1.8 servers how can i get crop age?

noble lantern
#

NMS only

#

sadly

#

thankfully*

#

I dont think those methods were added till 1.12ish

#

somewhere around that time

lavish folio
#

?

summer scroll
#

Is it possible to keep player's chat box opened without the player need to do anything?

lavish folio
#

if i print this event.getBlock().getState().getData() i get POTATO(7) i can get only 7?

noble lantern
torn oyster
#

should I make my plugin in 1.13.2, or 1.19?

noble lantern
#

and its -

#

1.14+

torn oyster
#

i'd prefer maximum compatibility

noble lantern
#

not 1.13

#

1.14 for PDT

#

that way you never need to touch nbt

#

👌

#

1.13 has performance issues anyways, uses lots of ram

torn oyster
#

does any server even use 1.13-1.17 anymore

noble lantern
#

who has the graph

summer scroll
torn oyster
#

lemme check bstats

noble lantern
#

bstats never works for me

lavish folio
torn oyster
#

does for me 🤷

noble lantern
torn oyster
hybrid spoke
#

its not possible

noble lantern
#

you would need to simulate keydown on the client somehow

#

likely only doable with mods

torn oyster
#

clearly, it is best to develop for 1.18-1.19

noble lantern
#

1.14 isnt too much different from 1.18-1.19

#

just use string values for your materials

#

and your mostly fine

torn oyster
#

eh

noble lantern
#

EG dont hard referance enums

#

just getMaterial(StringName)

torn oyster
#

I think it's more worth it to develop for 1.18.2-1.19

#

Java 17

noble lantern
#

you would still likely wanna do the material thing as theres new materials between the two iirc

noble lantern
#

if you do that your plugin will likely support down to 1.14 automatically

torn oyster
#

my plugin uses A LOT of materials

noble lantern
#

unless theres some new event or method created your calling

#

yeah so your likely not even referancing materials anyways

torn oyster
#

yeah it's all config

reef lagoon
torn oyster
#

is Material.valueOf not good?

noble lantern
#

yeah so you can develop for 1.18-1.19, and tell people if it works on 1.14 good for them

#

tbh

#

im not sure the difference

#

ive used both

torn oyster
#

what Java version is 1.14?

noble lantern
#

hmm

#

not sure

#

sec

summer scroll
#

Java 8 right?

noble lantern
#

noo

#

1.12 was last java 8 release

#

ik that 100%

torn oyster
#

so 11

noble lantern
#

nah i think ive ran it with 16 before

#

in fact

#

lemme try with 16

#

update

#

ive never actually developed on 1.14

hybrid spoke
#

java 16 doesnt work with <1.16 iirc

noble lantern
#

ah so the last numbers do match

#

explains why i have jre 14 with 1.15

#

if you develop with jre 14 you can suport 1.15 lach

#

idk if 16 has new features you need or not

#

14 has new switch thingie mahoozers iirc

torn oyster
#

which one added switch things

#

oh ok

noble lantern
#

i think it was 11 or 13

#

cipher might know

#

theyre like the history book

#

xD

opal juniper
#

are there even breaking changes to jdk?

noble lantern
#

java 14

#

was the version it got added

#

no just new syntaxes

torn oyster
#

what version is 522

#

52

noble lantern
#

16

#

i beileve

torn oyster
#

okay

#

that's what paper 1.14 was compiled in

noble lantern
#

well paper is weird

#

i would develop for spigot

#

if you develop for paper you cant put your plugin on spigots site

torn oyster
#

jdk 8 is 52

noble lantern
#

oh is it

torn oyster
#

Java 1.0 45.0
Java 1.1 45.3
Java 1.2 46.0
Java 1.3 47.0
Java 1.4 48.0
Java 5 49.0
Java 6 50.0
Java 7 51.0
Java 8 52.0
Java 9 53.0
Java 10 54.0
Java 11 55.0
Java 12 56.0
Java 13 57.0
Java 14 58.0
Java 15 59.0
Java 16 60.0
Java 17 61.0
Java 18 62.0
Java 19 63.0
Java 20 64.0

noble lantern
#

idk the numbers i know i see class error 52 a lot when im messing with reflection lol

#

even though im using jdk 16

torn oyster
#

so 1.14 was Java 8

noble lantern
#

nope

#

i run my server explicitly with 1.14

#

oh sorry

#

thought you meant 1.15

#

my bad

#

1.15 might support 15 jre

#

idk why java verisoning has 3 formats

#

fucking annoying

formal bear
#
    @Override
    public void onEnable() {
        getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
public class SendPlayerServer{
    public static void connectPlayers(Player player, String server) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("Connect");
        out.writeUTF(server);
        player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
    }
}

I'm getting annoyed, why it does not work...

noble lantern
#

so what exactly isnt working

torn oyster
#

yea lol

noble lantern
#

Are you calling connectPlayers somewhere?

vocal tundra
#

did you solve your java problem

noble lantern
#

who

#

me?

#

or lach

vocal tundra
#

ya

noble lantern
#

i had a java problem?

#

interesting

#

what was it lol i dont remember

vocal tundra
#

seemed like you were getting mad so I thought you did is all

torn oyster
#

burchard

noble lantern
#

no i was just trying to figure out java cryptographically signed versioning

#

lolol

formal bear
#
            player.sendMessage("Zostałeś przeniesiony na serwer " + args[0]);
            SendPlayerServer.connectPlayers(player, args[0]);

It does fire so idk

torn oyster
#

my donation got processed but I can't change my username

noble lantern
#

sup?

#

you need to make a forum post dont you

torn oyster
#

because the username is already taken by me

noble lantern
#

oh

torn oyster
#

on my alt

#

i don't know why I made an account called quared (I logged in to make sure it was mine, and yes, it was)

vocal tundra
#

is plugin freelance an ez way to make side cash

torn oyster
#

and idk what to do

noble lantern
#

if you have a really good lib

torn oyster
#

i've contacted support to delete the other account

noble lantern
#

yes, good lib allows you to shit out lots of plugins

vocal tundra
#

So each project you make you slowly build your library and become more powerful

noble lantern
#

thats what i do with BurchAPI

torn oyster
hybrid spoke
#

or if you just take commissions

noble lantern
hybrid spoke
#

and how good you are

vocal tundra
#

like a dev team for example

noble lantern
#

commissions arent bad especially if you sign up for senior team

vocal tundra
#

you know all those random dev teams

#

that get commisions

noble lantern
#

i worked for a commission team once, made a few hundred for some simple plugins

#

one was a chest shop plugin

#

another was just a simple /help gui with a bunch of weird config options i dont remember

#

but i did all that before i made any type of lib so i was constantly rewriting the same code

hybrid spoke
#

i mean i made a lot with it, but taxes are annoying

noble lantern
#

taxes?

summer scroll
#

the cuts

hybrid spoke
#

germany

noble lantern
#

ohh

#

yeah cuts are annoying but

#

minimum for dev projects was like 50$

#

so you made 30-40 min at all times for the lowest project

vocal tundra
#

I'm trying to figure out a way to use my plugin skills to make money

hybrid spoke
noble lantern
#

make free plugins

hybrid spoke
#

no

#

first verify

noble lantern
#

that too

torn oyster
#

lol

noble lantern
#

then make some free plugins

vocal tundra
#

all my stuff is private rn so I'd have to make free plugins...

torn oyster
#

does anyone know what to do in my situation though

noble lantern
#

or just sit around and help people in here, get your name out there

lost matrix
hybrid spoke
#

brand yourself

noble lantern
#

no ones gonna wanna hire you if you just come up and say "Ima a devloper"

#

have some past projects, some public github projects

#

etc

vocal tundra
#

my private repos are godly guys trust me

shadow zinc
#

Smile, can I do this with the code you showed me, will the affect the commands in any way?

hybrid spoke
#

take my money

shadow zinc
#
public class WorldCreationCommand implements CommandExecutor {

    private static Player playerAsPlayer = null;

    static class WorldCreationAccumulator {
        public void force() {
            toBeConfirmed.add(playerAsPlayer);
        }

        public void world(String name) {
            // Do stuff
        }

        public void type(String name) {
            // Do stuff
        }

        public boolean complete() {
            // Do stuff
        }
    }
summer scroll
#

sell courses 💀

noble lantern
#

ngl tho

#

i should sell courses

hybrid spoke
#

coaching for $3k/month

torn oyster
#

my plugin is going great so far

noble lantern
vocal tundra
#

do I need to make insane 100k line long free plugins

noble lantern
torn oyster
#

however, i did abandon it mid last year

shadow zinc
hybrid spoke
noble lantern
#

^

#

hence why

shadow zinc
#

Because passing it makes all take player

noble lantern
#

libs are essential in this

shadow zinc
#

and thats annoying

noble lantern
#

most developers create some type of libs for all theyre plugins

lost matrix
# shadow zinc Whats a clean way?
    static class WorldCreationAccumulator {
        
        private final Player sender; + constructor
        
        public void force() {
            toBeConfirmed.add(playerAsPlayer);
        }

        public void world(String name) {
            // Do stuff
        }

        public void type(String name) {
            // Do stuff
        }

        public boolean complete() {
            // Do stuff
        }
    }
hybrid spoke
summer scroll
#

true, libs make your life easier

noble lantern
#

little confused, im prolly just tarded

vocal tundra
#

but then ppl can just snatch your libs are the competition goes up

noble lantern
#

nah

#

they cant

#

you can private your lib

#

and shade it in

torn oyster
#

what's a Maven archetype

#

am I stupid for asking that

noble lantern
#

if someone goes through the process of ribbing your lib from decompiles class files they deserve it

#

i have no idea

hybrid spoke
# noble lantern wym by that

that you should make your plugins independent. i dont like plugins where you have to download 10 libs to get it to work

noble lantern
#

aerodactyl?

vocal tundra
#

lol

chrome beacon
noble lantern
#

lib is shaded in

vocal tundra
#

Never make your plugin depend protocol lib

noble lantern
#

not a standalone jar lib

#

i hate that shit

hybrid spoke
#

oh i thought of something like "XCore"

noble lantern
#

Nooo

#

fuuuuck that i hate having to download lib plugins

summer scroll
#

ProtocolLib

noble lantern
#

i wont use plugins that do that

vocal tundra
#

can i just post videos of private plugins and call it a day

hybrid spoke
#

ProtocolLib

#

yeah

noble lantern
#

except

hybrid spoke
#

lmao

summer scroll
#

lmao

noble lantern
#

for protocol lib

torn oyster
#

why can't they just shade ProtocolLib in?

#

lol

noble lantern
#

okay okay

#

xD

torn oyster
#

is it too big or smth

summer scroll
#

plugin size goes brrrrr

noble lantern
vocal tundra
#

because only weaklings use protocol lib

noble lantern
#

Not to flex or anything

lost matrix
#

Because its a standalone plugin and not just a library

noble lantern
#

but BurchAPI is like 30kb compiled

hybrid spoke
#

Protocolize dankfingers

lost matrix
vocal tundra
#

duplex

noble lantern
#

making it yourself

#

wha

hybrid spoke
#

Protocolize dankfingers dankfingers

vocal tundra
#

inject your own duplex handlers into the network thread

lost matrix
# vocal tundra duplex

Yeah for listening. But you have no abstraction for handling/sending the packets still.

vocal tundra
#

you have the duplex handler context

vocal tundra
#

you can send packets like that

noble lantern
#

but you know what i mean

hybrid spoke
#

who needs to send or listen to packets on spigot

#

if you can do it on bungeecord

torn oyster
#
public final class QuaredLib {
    
    private static JavaPlugin instance;

    public static void setInstance(JavaPlugin instance) {
        QuaredLib.instance = instance;
    }

    public static JavaPlugin instance() {
        return instance;
    }

}

is this the correct way to make libs

#

idk i'm too dumb

noble lantern
#

i setup a external rest server, that from there i make users of my plugin download a client, that allows connection to that external rest server, from there i manually send strings like "OpenASign" to the rerst server, where the client is constantly sending a refresh rest request ever 5 milliseconds to listen for actions like this, from there the client i developed will execute the action from the rest server

#

works so well

#

idk why more ppl dont do this

#

like cmon guys lets start making real code now

#

nodebleed ensues

noble lantern
vocal tundra
#

most libs shouldn't need to be java plugins anyway

noble lantern
#

just make it public static

#

set it = this onEnable

#

my libs are carved in stone

torn oyster
noble lantern
#

sac

hybrid spoke
#

i love the naming btw

noble lantern
#

ill show an example

hybrid spoke
#

how pathetic

torn oyster
#

you shade it in

#

and in onEnable

#

do QuaredLib.setInstance(this)

noble lantern
#

i dont need to do that

#

usage is like this:

#

and my lib has entire access to the using plugin

#

do note you will wanna relocate your lib to a new package

#

with the maven plugin

#

if 2 plugins use the lib its gonna go catwhoncus

hybrid spoke
#

i wouldnt expect a lib to represent the main class which i can just extend to make another main class out of it

summer scroll
#

stream exist

noble lantern
noble lantern
hybrid spoke
vocal tundra
#

there's never a good design dammit...

hybrid spoke
#

then i would rather initialize the lib with the main class

noble lantern
#

no

#

Api.enable()

#

never

#

handsfree evrything

#

why even call methods?

#

its redundant

hybrid spoke
#

your lib should remain a lib. there have to be some sort of abstraction

opal juniper
noble lantern
#

it is a lib?

#

It handles instance based things

#

like MySQL

#

inventories

#

Why should i force api users to enable all this themself

#

when you auto enable it by default

#

and then if users dont want it they can call methods to disable it

vocal tundra
#

that sounds counterintuitive

hybrid spoke
#

sounds like a standalone plugin the user can hook into

noble lantern
#

No its not standalone

#

it requires a plugin to run

#

It provides DI for auto registration

vocal tundra
#

api should only enable features once a user actually calls a method related to said feature

ivory sleet
formal bear
#

I registered the "BungeeCord" channel in the main class, why nothing is happening when i sendPluginMessage 😵‍💫?

noble lantern
#

or disable specific commands from auto registering

ivory sleet
#

No I’m talking about unit tests

noble lantern
#

psssh

#

unit tests

ivory sleet
#

Because then you can mock the entire lifetime

#

But if your plugin automates it that part of the lifetime becomes in principle unmockable

hybrid spoke
#

mocking in unit tests

noble lantern
#

Tbf never use unit tests

#

so idk much about how they work

vocal tundra
#

pshhh unit tests

noble lantern
#

i just test the code myself and it works

#

bam

vocal tundra
#

way to ruin the fun conclure

ivory sleet
#

I mean not only unit tests, if you have higher level tests it’d still be highly appropriate

noble lantern
#

the only testing i do

#

is compiling logs and slapping it on the server to test

ivory sleet
#

Well you do, but your api consumers might actually be unit testing

#

In which you create unnecessary hassle for them shrug

chrome beacon
#

Test on production 😎

hybrid spoke
#

never test dankfingers

ivory sleet
noble lantern
#

yeah but tbf i dont really think for unit tests especially in mc plugins

noble lantern
hybrid spoke
noble lantern
#

Just advise them not to while using itshrugging

ivory sleet
hybrid spoke
noble lantern
#

i dont see any reason for unit tests its like just test it

vocal tundra
#

how does one unit test bukkit runnables

summer scroll
#

Does someone here unit tests their mc plugin?

noble lantern
#

plus im sure theres way to go around it

ivory sleet
#

Well depends

noble lantern
#

like said i have no idea how unit testing works

ivory sleet
#

Is the runnable gonna be executed async or on the server thread, is the runnable dependent on the server life cycle

hybrid spoke
formal bear
#

WTF it does connect but it does not redirect, when i disabled one server it returned "Cant connect to the server", player stays on the same server ;/

noble lantern
#

all my plugin does for auto registration is read the jar file at runtime for classes

vocal tundra
#

sync repeating dependent on server life cycle

noble lantern
ivory sleet
#

Professionally I have to unit test and work with design driven development

noble lantern
#

only things async are database calls and IO calls

hybrid spoke
#

DDD sucks

formal bear
noble lantern
#

and similar

summer scroll
ivory sleet
hybrid spoke
ivory sleet
vocal tundra
#

i'm out

noble lantern
ivory sleet
#

Yes

noble lantern
#

soo then theres no issue then

ivory sleet
#

But let’s say you’re able to isolate some of the business rules

#

Then you don’t need to emulate

hybrid spoke
noble lantern
#

you can do some things without the server

#

like for instance

ivory sleet
#

Yeah, tho I do prefer ddd over simply tdd

noble lantern
#

your not gonna be able to use the inventory system in tests

ivory sleet
#

Yes

hybrid spoke
#

TDD is aids as well

noble lantern
#

but database, file system, other things will be fine

ivory sleet
#

That requires mocking burchard

formal bear
#

wdym

noble lantern
#

that doesnt need a server instance

ivory sleet
#

Exactly

hybrid spoke
ivory sleet
noble lantern
#

wrong reply

#

was meant for conclure

formal bear
ivory sleet
ivory sleet
#

But probably not

eternal oxide
#

?paste

undone axleBOT
ivory sleet
#

We can use mockito and powermocks in case the library really sucks

noble lantern
#

nono its good

#

ive shown it in here a few times ik youve seen it lmao

eternal oxide
vocal tundra
#

if you wanna unit test packet stuff do you need a mock client

hybrid spoke
#

again, why would you mock in unit tests? arent they supposed to actually test a real case scenario with real logic?

ivory sleet
#

Yes

#

You’d mock that, if you use netty you might mock the channel, if you use the send(Packet<?>) you probably wanna mock the invocation object simply

noble lantern
#

i would assume it might be, not sure

eternal oxide
ivory sleet
#

Well I mock to isolate error sources, "assume everything else works, does this unit also work?" (Becomes important when you deal with external parties such as libraries or perhaps database connections etc)

noble lantern
#

ahh i missed that then

#

all looks nice to me, reminds me of NBTApi

#

wait

hybrid spoke
noble lantern
#

this is only called once?

#

i would assume you use that multiple times

eternal oxide
#

once at startup

noble lantern
#

oh damn im tarded i missed that okay nvm then

eternal oxide
mortal hare
#

i managed to break chromium css rendering

#

by just applying percentage values lol

noble lantern
#

i break css just by looking at it

#

i suck at it

mortal hare
#

this reminds me of windows xp

#

DWM problems

formal bear
#

Stilll nothing

#

other client is on the server

noble lantern
ivory sleet
#

I guess

#

But yes I did tell you about it

#

FJP - work stealing pool is good because it is actually capable of structuring its tasks to a parent child relationship but also the implementation is optimal to the other implementations

#

But on mobile devices idk

noble lantern
#

Kk sounds good, was working on my front and and needed to use futures for loading stuff bc the front end will freeze otherwise

Was considering yoinking my socket code over and that was the main concern

ivory sleet
#

Depends on how many cores they have

noble lantern
#

Yeah most the time its not a lot

#

its for android, and lots of snapdragon cpus have 2-4 cores

ivory sleet
#

Hmm

noble lantern
#

lemme see what my cpu is

ivory sleet
#

Either that, sadly we don’t have the structured concurrency api with virtual threads in any stable java version

#

Else I’d have pointed you towards that

noble lantern
#

oh wow, 8 cores for galaxy s9

ivory sleet
#

Hmm yeah you could go for a fjp

noble lantern
#

Yeah just sucks with mobile device support

ivory sleet
#

Or a fixed one with a min max size

noble lantern
#

cause a lot of cheaper androids have shitty cpus

spiral vault
#

How to do 1.19 spigot server? server.jar i mean

noble lantern
#

maybe i could go for a fixed pool with where the size is half of the os.threadCount method result, forgot the exact object that called it

noble lantern
#

Or are you asking how to start a 1.19 server

spiral vault
#

1.19 spigot

#

I tried to do it myself

earnest forum
#

go to the spigot download website

#

unless u mean the bootstrap

noble lantern
#

wow

#

the bot hates me

#

i cant send the link lol