#help-development

1 messages · Page 711 of 1

upper hazel
#

i think WG schematic help with it

shadow night
#

wtf is this wg shit you talking about

upper hazel
#

bruh i do error

#

shit I just realized how it translates

lost matrix
# shadow night wtf is this wg shit you talking about

wg = worldguard
He means we = world edit
They have an api where you can create classic world edit schematics
or copy/paste regions.

I can also explain a way to you on how to copy a region between two points by yourself if you want to.

shadow night
lost matrix
# shadow night Yes, I want to do it myself, without some kind of api even tho I do have worlded...

Yep i get that. Alright ill lead you through.
First we want to scan the block data for each block in this region.
Step one: Find out how to properly iterate over x, y and z from the lowest to the highest point.

    Location cornerA = ...;
    Location cornerB = ...;

    Preconditions.checkState(cornerA.getWorld().equals(cornerB.getWorld()), "Locations must be in the same world.");
    World world = cornerA.getWorld();

    int xMin = ...;
    int xMax = ...;
    int yMin = ...;
    int yMax = ...;
    int zMin = ...;
    int zMax = ...;

    for(int x = xMin; x <= xMax; x++) {
      for(int y = yMin; y <= yMax; y++) {
        for(int z = zMin; z <= zMax; z++) {
          
        }
      }
    }
  }

Complete this code for me and send the result.

shadow night
#

Hmm

lost matrix
#

Just the xmin xmax etc part

shadow night
#
int xMin = -9;
int xMax = 8;
int yMin = 50;
int yMax = 60;
int zMin = 7;
int zMax = 57;```
should be something similar to that, if I understood you right
lost matrix
#

Given two locations (A and B) find out min and max for x, y and z of those two locations.

#

Hint: You can utilize Math.min and Math.max for this.

thin iris
#

how can i disable enchantments ?

#

like on a config

lost matrix
thin iris
#

cant i just make a list of enchantments

#

and make a config from that

lost matrix
#

If you have a plugin for that

thin iris
#

yes i can code

quaint mantle
#

I need this
event to move items in inventory in specific world

#

what is event name

lost matrix
# thin iris how can i disable enchantments ?

This is a very intricate question. Because what exactly do you mean by "disable enchantments"
Do you want to mitigate the effects?
Do you want the enchantment to no occur on the enchantment table?
Do you want to block enchantments from villagers or dungeon chests as well?

thin iris
lost matrix
quaint mantle
lost matrix
#

sage dragon
#

How does Minecraft search for Nether Portals?

Because of the way my world is handled, I apparently need to make my own portal logic...

sage dragon
#

So I need to bypass this, since I can't just remove the plugin that cancels it

lost matrix
#

That sounds like a hacky solution

sage dragon
#

Yeah, but it's just for my own server 🤷

lost matrix
#

Isnt there a bypass permission in the plugin?

sage dragon
lost matrix
#

What are nether portals used for then if they are blocked?

sage dragon
lost matrix
lost matrix
sage dragon
#

allow-nether is set to true

thin iris
sage dragon
lost matrix
sage dragon
lost matrix
#

Thought something like that

quaint mantle
#

Which event should we use to move the items in my inventory?

lost matrix
zinc lintel
#

is there a way i can change the nametag above the players head?

quaint mantle
#

nms

zinc lintel
lost matrix
#

You can also do that without nms

zinc lintel
quaint mantle
#

ie putting the item in the 1st slot into the 2nd slot.

lost matrix
# zinc lintel how

There are a ton of different approaches to this.
It all depends on how many side effects you are willing to include.
Do you want to change only the name above his head or also his name
in the tab list or the name he has in chat

lost matrix
zinc lintel
quaint mantle
lost matrix
quaint mantle
#

yes

lost matrix
lost matrix
zinc lintel
quaint mantle
lost matrix
lost matrix
zinc lintel
quaint mantle
#

Or u gotta do each individual

lost matrix
#

You cant listen for abstract events

quaint mantle
#

Figured

#

Do you know where in Minecraft / spigot code it loads the items into a players inventory (from player data)

#

I’m tryna fork spigot to load items from db

lost matrix
#

Why do you need a spigot fork for that?

#

Just do it via a plugin

quaint mantle
opal slate
#

@lost matrix can you help me with executable items?

lost matrix
#

Ah, no idea but i would follow the bread crumbs from the login handling

#

Sure, what do you need

opal slate
#

I would like to know if it is possible and if so how, with which external plugin or with Executable items, if it is possible to add two items. that is to say. item "a" in slot "t" of the inventory, item "b" in slot "y", I open the inventory and take item "a" in my hand as if to move it to the inventory, and I move it above the item "b", as if to stack them. now I try to stack them and what I would like to happen is that a certain item "c" appears in the item "b" slot. and items "a" and "b" disappear from the inventory

#

is difficult but i REALLY need it

#

i tried activator inventory click, but i can only set the slot, not the specifical item.

eternal oxide
#

Why not just create a crafting recipe like everyone else?

opal slate
#

is too easy hahaha

#

no no i was joking

wet breach
#

or use a different inventory that is made for combining items

#

and you can set the result however you want

opal slate
#

yeah tell me a plugin

eternal oxide
#

you can do it, by checking the item on the cursor when you click the inventory

opal slate
#

i didn't found it

lost matrix
#

Sure, you can do that. So your plan is to combine items if they land in the same inventory.
This can be done using the InventoryClickEvent and some logic.

eternal oxide
#

check if thats one of your items, then check the clicked item is the other

quaint mantle
#

7smile7 do you know hypixel skyblock crafting menu

lost matrix
#

Yeah

opal slate
#

guys, no I don't understand anything about it, I was looking for someone who could give me a quick tutorialguys, no I don't understand anything about it, I was looking for someone who could give me a quick tutorial

quaint mantle
#

How do you recon the quick crafting works

robust helm
#

When creating a prefix for example §8§l[§5§lHello§8§l] without legacy chatcolor, is there any other way than combining 3 textComponents?

opal slate
#

i maybe create only chaos if i try it

lost matrix
robust helm
#

§ was better

#

but ty

lost matrix
quaint mantle
#

I believe that shows

opal slate
wet breach
#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

lost matrix
pseudo hazel
pseudo hazel
#

otherwise there is no reason to fork in the first place

#

wait im confused

#

my bad xD

#

I read too much today 😫

wet breach
#

seems they want someone to lead them through step by step to create this custom crafting thing they want

pseudo hazel
#

yeah

#

which isnt really what we do either

wet breach
#

regardless not many if any will do that lol

pseudo hazel
#

you should read the docs and learn how to use the api

quaint mantle
wet breach
#

no

pseudo hazel
#

if you know java, this wont be too easy to understand

opal slate
quaint mantle
#

You bot talking to me tight

#

I’m so lost

pseudo hazel
wet breach
#

no

opal slate
#

is an italian Bee?

pseudo hazel
#

my bad

#

?

quaint mantle
#

Cause I wasn’t asking for any code

#

I was just curious about smth

pseudo hazel
#

an API stands for application programming interface

wet breach
#

indeed you were not

#

so it must not be you then 😉

pseudo hazel
#

in this case I am just referring to spigot

wet breach
pseudo hazel
#

yeah sorry for the confusion

quaint mantle
#

So I thought you was taking to me

wet breach
#

oh

#

well the other guy was asking about someone showing them tutorials in how to make it and etc

quaint mantle
#

Hey everyone! 👋 I'm fairly new to the Minecraft development scene and I'm eager to improve. I'd really appreciate any constructive criticism on my plugin, PixelPaste. Whether it's praise or pointers, your feedback will be invaluable for my development journey. The code is open-source, and you can check it out directly via the GitHub link on the Spigot plugin page.

🔗 PixelPaste on Spigot
https://www.spigotmc.org/resources/pixelpaste.112531/

Thanks in advance for taking the time to help me out! 🙏

quaint mantle
pseudo hazel
#

I kinda dont wanna redirect you but there is actually a thread on this channel meant for feedback directly if you want more looksies #1100941063058894868

quaint mantle
#

a one class nested directories

#

i see no reason to do that

quaint mantle
#

Your talking about the packing structure?

#

yes

#

i dont like that you out every class into different directories

#

like math has only MathUtil

#

which you dont need to do

pseudo hazel
#

and imo your package and class naming is a bit vague

quaint mantle
#

and the naming of the directories doesnt impact the actual name of classes

#

It's designed for the ease of implementing other features and readability. These packages, ''whether empty, or 1 class" are essentially placeholders for future implementations. The code is heavily abstracted (franky overengineered) for this ease of use.

#

I see.

#

but like

pseudo hazel
#

well you can always extract it out into more packages later

quaint mantle
#

the names are vague

#

you can always just do what Steaf said

pseudo hazel
#

I agree, take for instance the logic package, all code is in my mind considered "logic"

quaint mantle
#

however the java class doesnt even have in name logic or something

#

and MathUtil would rather be in util class than math class

#

I see, your questioning the relevance of the package names to the inner classes. That makes sense, they should be relevant to the classes function. I will look into that more.

#

your directories are only made for one classes

#

instead of multiple classes

#

you have also multiple logic directories

#

in different places

pseudo hazel
#

same for core

quaint mantle
#

Adding additional packages might look like overkill at first, but it's really about future-proofing your code. Personally, I prioritize ease of use and readability when I'm coding. But for a production-ready plugin, these concerns should be minimized.

pseudo hazel
#

what is the difference between core and logic in your opinion?

quaint mantle
#

i mean

#

logic should be in core right?

#

Are you referring the 'core' that's a inner package of the Command package?

#

there is many core packages in your project so

#

It's referring to the 'core' of the commands package, containing the core classes for functionality.

pseudo hazel
quaint mantle
#

and they all have the same problem

pseudo hazel
#

and what's in logic if the functionality is in core

quaint mantle
#

what i would do is first remove the packages in utilities and bring all the class on the same level package

#

The functionality of the command system is in core. Each package has a inner core package that holds the main functionality. The name 'logic' may not be appropriate though.

quaint mantle
#

I appreciate the constructive feedback on the package structure and naming conventions in PixelPaste. I understand the concerns about over-complicating the directory structure, and I'll look into simplifying it. The intent was to future-proof the code, but I get that it might be causing more confusion than it's worth right now. I'll also reconsider the naming of the 'core' and 'logic' packages to better reflect their actual functionalities. Thanks again for the insights, they're invaluable for a newbie like me.

pseudo hazel
#

okay

#

also

#

as for your processing setup, it looks fine

#

but one thing is nagging at me, is2D

#

you should really have 2 classes, Process2D and Process3D

quaint mantle
#

look at std library in java btw, many classes are on the same level package

pseudo hazel
#

thats why you made an interface for a processor I imagine

quaint mantle
#

That's correct. Thanks for pointing that out.

quaint mantle
#

and then just implement for both

pseudo hazel
#

this also extends to PixelCommand in some regards, but its not really switched on too much

quaint mantle
#

I originally had 2 classes, however I figured I would put it in one to minimize duplication of similiar code. But your approach seems more reasonable now that you mention the interface.

pseudo hazel
#

whats IEProcess mean

#

its always about a balance between code duplication and having your code be usable/readable

quaint mantle
#

Is the approach I have with returning a Bukkit Runnable while waiting for confirmation seem reasonable?

quaint mantle
#

people use it in c# and other languages too

#

lol

pseudo hazel
#

right

#

I never use prefixes

quaint mantle
#

now you will see :troll:

pseudo hazel
#

it should not matter for your code whether its an interface or not

#

everything is an interface to some extent

#

because you are always interfacing with the class

quaint mantle
#

just try not to use abstract classes and use final classes

#

final class are not extendable

quaint mantle
# pseudo hazel you say you want to minimize duplication, but tbh, you already have a process2D ...

I would like to get your guys opinion on my argument for keeping it on class.

Reusability: Both methods are essentially doing the same thing—resizing an image. Keeping them in the same enum ensures that anyone using this enum immediately knows that there are multiple strategies for resizing images.

Ease of Use: Consumers of this enum don't have to search for a separate class or method to find alternate resizing strategies. They just need to pick a different value from the same enum.

Abstraction: The abstract method resize is implemented differently for each enum value, which is a nice use of polymorphism. This can make adding more resizing algorithms in the future easier. Just add a new enum value and implement the resize method for it.

Context: Having them in the same enum provides context that both are resizing strategies, which can be helpful for code readability and maintainability.

However, I understand following Single Responsibility Principle and that it's important.

Could you guys provide productive counter arguments so I can tell the pros and cons?

pseudo hazel
#

what enum are you talking about exactly?

quaint mantle
#
 RESIZE_2D {
        @Override
        public BufferedImage resize(BufferedImage image, int maxDimension) {
            int originalWidth = image.getWidth();
            int originalHeight = image.getHeight();
            double aspectRatio = (double) originalWidth / originalHeight;

            int newWidth = Math.min(maxDimension, originalWidth);
            int newHeight = (int) (newWidth / aspectRatio);

            BufferedImage resizedImage = new BufferedImage(newWidth, newHeight, image.getType());
            AffineTransform transform = new AffineTransform();
            transform.scale((double) newWidth / originalWidth, (double) newHeight / originalHeight);
            AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
            op.filter(image, resizedImage);
            return resizedImage;
        }
    },
pseudo hazel
#

which class is this?

quaint mantle
#

Strategy

pseudo hazel
#

should not be in utils as its teh basis for your whole plugin

#

and this also has not much to do with the whole Process thing

quaint mantle
#

i feel like just creating one selead interface and some classes

#

instead of enums

pseudo hazel
#

using an enum is fine, but dumping all your logic in it does not make sense

#

furthermore, the upper half of resize seems identical

#

you can extract this into a separate function

quaint mantle
#

I see, I was misunderstanding you guys at first. I was referring to the Strategy class not the process class. Ill look at that class again with your points in mind.

pseudo hazel
#

and then you will have less duplication and more reason to keep it split

quaint mantle
#

Fair.

pseudo hazel
#

I would keep the strategy enum, but instead create a class around it that you can easily extend like ResizeStrategy and have ResizeStrategy2D and ...3D with just a single method resize, making ResizeStrategy a functional interface

#

or like an easy to use interface

#

and then just have some switch or if statement to resize depending on the enum value

quaint mantle
quaint mantle
pseudo hazel
#

then you can even just reuse resizing or combine them for other weird stuff

#

eehm

#

I only made a single plugin

#

xD

#

and its not a shining example of good java code since I only started doing actual java with this plugin

quaint mantle
#

Well, I have to say I'm impressed. For someone who doesn't use java, you know a lot about it's concepts (or just generic oop concepts).

pseudo hazel
#

I mean my dayjob is programming in c++ so oop is not foreign to me

quaint mantle
#

Even then, this project still looks impressive to me.

pseudo hazel
#

its just teh java nuances are kinda lacking

quaint mantle
#

C++? Diabolical

pseudo hazel
#

I didnt even know you could do that stuff with enums until you showed me

quaint mantle
#

Ah, well im happy we both learnt something.

pseudo hazel
#

yes I mean I have been working on this off an on for a few years so it has gotten relatively big for a simple minigame

quaint mantle
#

Makes sense. I'm still new to spigot development. I'm just trying to learn as much as possible so maybe I can get a job before I have to do a speech class next year for my major.

#

Spigot development(for me) is like a gateway for learning how to problem solve better in code. Not really for getting a 'job'.

#

Also my ADHD brain needs constant dopamine and if I don't see something happen after a few minutes I lose all motivation. Hence why I started MC development.

abstract totem
#

Is there any guides on the new way to make custom player heads
Current code VVV

   PlayerProfile pp = Bukkit.createPlayerProfile(UUID.fromString(skullinfo.getId()));
   pp.setTextures(); //What goes here???```
tender shard
# abstract totem Is there any guides on the new way to make custom player heads Current code VVV ...

Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...

abstract totem
#

didint see this will check it out

#

worked well! Thanks

odd lark
#

Hello, do you know if there is a library (not a plugin) to display a player's face in the chat when he sends a message ?

wet breach
#

so core code is the foundation and doesn't necessarily contain just the minimum but the princible is minimum code necessary that is needed to make things work

pseudo hazel
#

I guess , but I think this structure works better for way bigger projects then

#

thats a good way to look at it though

#

I would just remove logic package and put the rest into the parent package directly

#

next to core

wet breach
#

ideally. good news is there is many design principles to follow

#

this is just one of the many

pseudo hazel
#

yeah

#

also just being consistent no matter what you do can also help I guess 😛

wet breach
#

yes

#

because if its consistent and you wanted to say change such a principle or need to make changes in many classes for the most part it should be fairly easy to know where you are looking or what needs to change

#

since every class and package should follow the same design

pseudo hazel
#

yes

wet breach
#

it is why many open source projects implement rules to creating PR's

tender shard
#
[X] I have read this and that bla bla bla ...
[X] I haven't read anything and simply checked all the checkboxes
radiant umbra
#

hello, i got 2 enums called Item and Weapon. This is my code (the top method is in the Weapon Enum and the bottom one in the Item Enum) https://paste.md-5.net/goyehavulo.cs

ItemStack itemStack = event.getItem();
        if (itemStack == null || itemStack.getType() == Material.AIR) return;
        System.out.println(1);

        Item item = Item.getByItemStack(itemStack);
        System.out.println(2);
        if (item == null) return;
        System.out.println(2.5);

        Weapon weapon = Weapon.getByItemStack(item.getItemStack());
        System.out.println(3);
        if (weapon == null || weapon.isMelee()) return;
        System.out.println(3.5);
``` ^ this is in a listener

i debugged my code a bit and it sucessfully is going through all items to find the right one and it has found it (so its not null). But when I try to get the Weapon by the itemstack from the Item (which was not null) it gives me a null pointer exception for the method `Weapon#getByItemStack`
#

it gives me a null pointer exception for a thing which was not null before

odd lark
sullen marlin
#

That's impossible

odd lark
sullen marlin
#

yes

odd lark
#

okay thanks

lost matrix
#

This is usually done with 8x8 pixels.
Meaning you need 64 font characters, replace them with shifted pixels and
color them using rgb chat colors. Its quite the hustle to get right.

slender elbow
#

and re-send the pack to every online player when someone new joins in :trollface:

lost matrix
kindred sentinel
#

how to get Potion from item?

Potion a = (Potion) ItemStack

Returns error

#

item.getItemMeta()?

#

if yes then how to add 1 level to effect?

quaint mantle
# kindred sentinel if yes then how to add 1 level to effect?

Something like this.

 public static Potion superDuperMegaUltraChickenNuggetPotionLeveler() {
        int magicalChickenNugget = 0;

        // String of bewildering operations
        magicalChickenNugget += Math.tan(Math.sqrt(42) * Math.random()) * 0;
        magicalChickenNugget += (int)(Math.PI * Math.E * Math.sqrt(2) - Math.PI * Math.E * Math.sqrt(2));
        magicalChickenNugget += (Math.log(1) + Math.exp(0) - 1);
        magicalChickenNugget += ((Math.sin(30) + Math.cos(60)) * 0);
        magicalChickenNugget += (Math.pow(3, 2) + Math.pow(4, 2) - Math.pow(5, 2));
        magicalChickenNugget += Math.abs(-2) + Math.abs(2) - Math.abs(0);
        magicalChickenNugget += (Math.round(Math.random() * 10) - Math.floor(Math.random() * 10));
        magicalChickenNugget += (Math.ceil(Math.random() * 20) - Math.ceil(Math.random() * 20));
        magicalChickenNugget += ((2 + 2) * (2 - 2) / 2);
        magicalChickenNugget += ((int) Math.sqrt(Math.pow(4, 2) + Math.pow(3, 2)) - (int) Math.sqrt(Math.pow(4, 2) + Math.pow(3, 2)));
        magicalChickenNugget += Math.floorMod(-1, 2) - Math.floorMod(1, 2);

        // Wrapping up the bedlam by actually doing something useful in Minecraft
        magicalChickenNugget += 1 + 1;

        // Create a new Potion and set its type to Healing
        Potion potion = new Potion(PotionType.HEALING);
        
        // Increment the potion level by 1
        potion.setLevel(potion.getLevel() + 1);

        System.out.println("Utilizing the Super-Duper Mega Ultra Chicken Nugget Potion Leveler, the potion level is now: " + potion.getLevel());
        return potion;
    }
kindred sentinel
#

0-0 it's ok but idk how to get potion type of the potion

#

there are no potion.getType

quaint mantle
kindred sentinel
#

yeah

quaint mantle
# kindred sentinel yeah

Here, is some sudo code

  public static void main(String[] args) {
        // Assume itemStack is an ItemStack object for a potion
        ItemStack itemStack = ...;

        if (itemStack.hasItemMeta() && itemStack.getItemMeta() instanceof PotionMeta) {
            PotionMeta meta = (PotionMeta) itemStack.getItemMeta();

            for (PotionEffect effect : meta.getCustomEffects()) {
                PotionEffectType effectType = effect.getType();
                System.out.println("Effect Type: " + effectType.getName());
            }

            // If the potion has a base effect (e.g. Healing, Strength)
            if (meta.getBasePotionData() != null) {
                System.out.println("Base Effect Type: " + meta.getBasePotionData().getType().name());
            }
        }
    }

I am unfamiliar with the API, but documentation serves well. I would check that out.

#

Obviously you can't implement that as is.

kindred sentinel
#

oh thx

kindred sentinel
#

oh i found out

quaint mantle
slender elbow
#

thank you for your contribution of utmost importance to the conversation, it is very much appreciated

worldly ingot
#

Thank you for your presence, Emily

slender elbow
terse pumice
#

Is there a way to get a players b64 texture without having to use NMS? Looking for solutions for 1.16 to 1.18 tooo

quaint mantle
eternal oxide
#

use the PlayerProfile

terse pumice
#

I was under the impression this was added after 1.18

eternal oxide
#

oh you want it pre 1.18

quaint mantle
#

Mojangs API is the only way, unless you find another API.

terse pumice
eternal oxide
#

you can do it with a little reflection

quaint mantle
terse pumice
#

Sounds good thank you

terse pumice
eternal oxide
#

pre 1.18.2 you'd need to use teh GameProfile

#

I've only done it for skulls

terse pumice
#

Yeah I understand the logistics of it, just not reflection as such

quaint mantle
terse pumice
#

I know you can do something along the lines of ((CraftPlayer) player).getHandle()

eternal oxide
#

are you just looking to read it?

terse pumice
#

Yeah was just looking for some resources more than anything, this should be great :)

eternal oxide
#

There is probably a field in the Player object you can use, or just create a new GameProfile using the correct UUID/namejava GameProfile profile = new GameProfile(id, name); profile.getProperties().get("textures")

smoky oak
quaint mantle
# radiant umbra Anyone got any ideas?

I would add debug statements to print the itemstack before passing it to weapon.getByItemStack to make sure its not null. Check inside your getByitemstack method to see if your potentially accessing a field on a null object. I would also check the stack traces. Its hard to help you without more code.

smoky oak
#

also you can do actual debugging with spigot, it takes a bit of setup tho

smoky oak
#

oh btw chat's async, right? Is there a sync event when people type in chat or do you need to do somesort of async->sync thing?

quaint mantle
#

I am improving the Structure API. I am adding a chainPlaced method which allows instead of placing the structure and entities in a single tick to split it in multiple ticks.
The only issue I got is that I want to support including entities (like placing them). I tried with teleporting them (using their Location as an offest), but they still don't appear/exist in game...

It seems that they don't really exist in the World implementation so I thought that maybe spawning them through the World interface would work but I just realized that there's not really a method that spawns them right...
I mean, there's not even a method in the API that copies an entity PersistentDataContainer to another and such and I wanted to not use NMS as much as possible, just trying to keep it Bukkit/Spigot API in order to improve maintenance

Does anybody knows a work around?

smoky oak
#

cant u clone the pdc

quaint mantle
#

How do I apply it?

echo basalt
#

While you're at it make a method to create an empty structure

quaint mantle
#

To the new spawned entity?

echo basalt
#

with given dimensions

smoky oak
#

...loop pdc keys?

#

is there a reason you couldnt just foreach the pdc keys and apply it to the new entity

quaint mantle
#

PersistentDataType<T,Z> type

#

How may I know which type is it?

smoky oak
#

ah that'd do it

#

you might get some mileage looping over the 'standard' pdc types tho

quaint mantle
echo basalt
#

Air

quaint mantle
#

Is it not possible with Structure API?

trim creek
#

can someone pls tell me how does the give potion effect stuff work? I got it working, but it only lasts for like... 1 tick

#

and that's..

#

...that's not something I want 😆

timid bridge
#

Hello, someone tried having the ownership of a premium plugin transferred to me but it said I don't have the requirements.

undone axleBOT
nova notch
smoky oak
#

if a recipe is registered by a plugin, does it still persist after the plugin is disabled?

river oracle
#

I'm not sure how Bukkit handles shutting down plugins while the server is still running

smoky oak
#

on a different topic

#

why does this work with inventories but not with recipes lolbruh

#
public void onItemCraft(CraftItemEvent event){
  if(!(event.getRecipe() instanceof ClassExtendingRecipe recipe)) return;
#

its registering the recipe to the server

#

so where does that part where its a different class get lost?

river oracle
smoky oak
#

all im doing is server side tho

river oracle
#

InventoryHolders only work because it never has to be sent to the client (though its a bad practice regardless)

#

recipes have to be sent to the client

smoky oak
#

but if its crafted its still using a recipe aint it?

river oracle
#

arbitrarily extending a recipe class and adding stuff to it won't work

smoky oak
#

hm

#

recipe is using a namespaced key for identification but i can't seem to query it

river oracle
#

why would you ever need to query a recipe once its in the server

smoky oak
#

because its supposed to be enabled for specific players only

#

the problem is

#

recipe doesnt have a permission field, so it'd have to be handled in a 'u cant craft this' way in the event

#

but EVERYTHING else in my plugin is setup in a 'alright, you specifically can do this' kinda way

river oracle
#

I suppose you'd have to send packets to specific players instead of all to say the recipe is there and then not allow certain players to use it by using patterns

smoky oak
#

hm

#

do u know what the event is that makes the result appear on the right?

river oracle
#

not a clue

#

it exists though :P

smoky oak
#

wait wtf

#

how can you init a namespaced key with a plugin but not check if a namespaced key is inited with a plugin

river oracle
#

you don't really need to

smoky oak
#

i kind of need to check if its my plugin that made the key

#

terrible solution ™️```
NamespacedKey key = new NamespacedKey(this,"master");
String namespace = key.getNamespace();

river oracle
#

can't you just do .equals

worldly ingot
#

Yeah that's totally fine

#

getNamespace().equals(plugin.getName())

river oracle
#

I mean namespaced keys really just are pluginname:string so 🤷‍♂️

meager mantle
#

hi, does anyone know if what the warden throws is considered an entity? as is the wither with the heads it throws

sullen marlin
#

yes, wither skulls

meager mantle
sullen marlin
#

thats particles

meager mantle
#

What I want to do is that when that is activated, the place where it arrives appears a tnt, do you know if it can be done?

sullen marlin
#

particles arent tracked on the server, so not easily

meager mantle
#

And do you know if I can make it so that when the warden activates that, he also sends a wither head?

sullen marlin
#

I guess you could use EntityDamageEvent to check for a sonic boom and go from there

meager mantle
#

how would you check it?

sullen marlin
#

play with the event and see

#

warden with damage of 10 is one possible option

meager mantle
#

But how do I check when I activate the sonic boom?

sullen marlin
#

pretty sure a warden only sonic booms when they target and damage an entity

meager mantle
#

so how would you know when they point to an entity? Sorry, I'm a little new to entities

sullen marlin
solar sparrow
#

So guys, can anyone help me? How can I properly register my cargoReposity event in my main?

Main.class

public void onEnable() {
        this.getCommand("setargrupo").setExecutor(new SetarGrupoCommand(cargos));
        this.cargos.put("mod", "admin");
        if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new CargoPlaceholderExpansion(this).register();
        }
    }

CargoPlaceholderExpansion.class

    private CargoRepository cargoRepository;
    private final HIDTags plugin;

    public CargoPlaceholderExpansion(HIDTags plugin, CargoRepository cargoRepository) {
        this.plugin = plugin;
        this.cargoRepository = cargoRepository;
    }
upper hazel
#

I have a question about threads. I'm making a plugin like MKing but for newer versions
There are 3 streams.

WaitPlayerInGame - waiting until there are enough players to play
StartingGame - start the game
WinningTimer - timer for EACH player that counts the time

The question is in this place in the StartingGame class. When the timer is over it stops the StartingGame thread
And StartingGame itself creates new WinningTimer threads. Could it be that if the WinningTimer stops the StartingGame thread. The remaining WinningTimer threads will continue to work

#

this true?

#

or all be nice

lilac dagger
#

you can't reregister tasks

upper hazel
#

wdym

#

I can't create new WinningTimer threads?

#

will it always be 1?

lilac dagger
#

ah nevermind

#

i saw this

#

and i assumed you cached the waiting timer

upper hazel
lilac dagger
#

you're probably seeing this weirdly

#

you need some sort of phases or gamestate

upper hazel
#

1 wait thread, 1 game start thread, timer thread for each player

lilac dagger
#

always pushing from one to another

#

this looks like a headache to maintain in a month

upper hazel
#

lol

lilac dagger
#

i make minigames and i have 1 task sync and 1 single thread executor

#

it's pretty easy to maintain

#

tho it might be more difficult to debug lagg in your run this way

keen jackal
#

Do you do commissions?

lilac dagger
#

me?

keen jackal
#

Yep

upper hazel
#

but that means you put the game states in 1 thread

lilac dagger
#

not at the moment

#

well, all sync tasks are in 1 thread

upper hazel
#

I share them

keen jackal
#

One thing I've been stuck on is completing my minigame engine, it's been like 10 years lol

#

Literal mental block

#

On the bright side, making progress now

shadow night
#

What is a minigame engine?

keen jackal
#

Basically defines the structure for how minigames are created on the server, and manages them

lilac dagger
#

something like this

shadow night
#

It uses nms?

keen jackal
#

It can

lilac dagger
#

yeah

keen jackal
#

Depends on the needs

#

I'm making mine open source

#

But not complete yet

shadow night
#

Interesting

keen jackal
#

Totes should not airdrop me the code

#

😸

lilac dagger
#

oups sorry

#

i'm pretty proud of it myself 😄

keen jackal
#

😿

upper hazel
#

theads not will stop?

#

Timer tasks

lilac dagger
#

i don't think this will trigger

#

ever

#

you can't realistically ever be in the same exact location

lilac dagger
#

decimals will never match

#

also double has floating point innacuracies

#

use distance

#

or a selection and check if it's in selection

upper hazel
#

oh thenks but what the num i shold use

#

distance == 1?

lilac dagger
#

use <

#

<=

#

otherwise a similar problem will happen

upper hazel
#

1?

#

<= 1

#

or

#

I just need a player at a specific location

#

the more precise the better

lilac dagger
#

then lower the distance until you happy

#

usually you just wanna test your own code so you can learn from your mistakes instead of asking for help from others

#

you'll can't learn without making mistakes

upper hazel
upper hazel
#

Well, you told me that you can’t compare locations like that, so I won’t
😀

lilac dagger
#

sure, but i can't be here to guide you every time you need help

#

and the more your program advances the harder is for people to help you as they won't know how your code works

upper hazel
#

I know, but it’s more effective to ask complex questions related to flows than to solve them yourself for a long time

#

besides, I have limited time for this plugin

#

I simply don't have time to experiment

#

although when I tried to find a way to compare locations, I couldn’t find a way to compare them anywhere on the Internet and assumed that "equals" would work

wet breach
keen jackal
#

Just have to dig deeper when that happens

#

And use a debugger 😸

upper hazel
#

it's harder than you think

#

Well, personally, I have weaknesses in working with threads, especially when you think about their synchronization

keen jackal
#

🤔

#

Why?

upper hazel
#

if you have a large or complex code for you, you will have to spend a lot of time on it

keen jackal
#

Can you give me a scenario?

upper hazel
#

although it all depends on length and experience as well as on thinking

upper hazel
keen jackal
#

A scenario when you ran into a synchronization issue

upper hazel
#

scenario?

keen jackal
#

Like an example

upper hazel
#

oh ok

#

oh wait

#

not

keen jackal
#

Ah having multiple threads stopping each other

upper hazel
#

yea

#

this bad?

keen jackal
#

I'd probably either use a state machine or atomic booleans

upper hazel
#

but boolean requires checks. Are you saying that you can create a separate thread to check boolean?

keen jackal
#

So basically the logic would work like this

  • There is a method for switching states
  • When the state is switched, unrelated tasks will be cancelled
  • Related tasks will be started
#

And I'm guessing that these states will switch based on events

#

So we can call it in those listeners

#

Idk, just how I would do it

#

Probably can be simplified further if I was actually writing the code

shadow night
#

how do I get a location from a config file?

ivory sleet
#

or just new bukkit tasks?

upper hazel
#

bukkit

#

tasks

ivory sleet
#

and you run them asynchronously or nah?

#

cuz if you do, then thats pretty identical to booting up new threads

upper hazel
#

not async

radiant umbra
lost matrix
radiant umbra
lost matrix
radiant umbra
#

honestly, i could try that

lost matrix
# radiant umbra honestly, i could try that

You can add a tag like this on your item:

CustomItemType: "crystal_sword"

And then internally have a Map<String, Weapon>.
This way you can just look at the tag of the itemstack and have the weapon type in no time.

lost matrix
radiant umbra
lost matrix
shadow night
#

if I have to do it all myself, ig I have to

radiant umbra
ivory sleet
echo basalt
#

You can still keep the enum

#

But instead of doing raw checks on a listener (which is a bit more performant) you make a class for each item

#

And in my case I still use string keys because I'm an idiot

#

And the end item looks something like this

lost matrix
ivory sleet
#

good sign that indicates you're becoming better tho, so pog :)

lost matrix
#

I feel like im perpetually here.

#

Especially after getting deeper into machine learning and quantum computing for my master

onyx fjord
#

people that prompt exclusively

#

mfs life depends on openai credits

lost matrix
#

proomting away. I've started creating my own dataset and fine tuning a few models from huggingface. SDXL is an insanely complex base model which
has the potential to bring Midjourney grade generations to open source projects.

#

The main problem is that datasets are excrutiating to prepare. And that i need to write python PES_Yikes

echo basalt
#

Maybe you're there

#

But not in the spigot world

#

I'd say I'm about here in terms of spigot stuff

#

My biggest handicaps are like

#

not knowing anything beyond 5th grade math

ivory sleet
radiant umbra
ivory sleet
#

Yeah they don’t

#

That feature was added later

radiant umbra
#

yea

#

so, in the item enum I got this entry for example

FLAMETHROWER("flamethrower", ItemBuilder.from(Material.BLAZE_POWDER).name(Component.text(ChatColor.GRAY + "Flammenwerfer")).lore(Component.text(ChatColor.GOLD + String.valueOf(Weapon.FLAMETHROWER.getAmmo()) + "/" + Weapon.FLAMETHROWER.getMaxAmmo())).build()),```
and in the weapon enum this
```java
FLAMETHROWER(Item.FLAMETHROWER, 5, 3, 1000, 1000, 100, 1000, 0.0F, 0.0F, false, false),```
When I do Item#getByItemStack the item is not null, but when I try to do Weapon#getByItemStack with the itemstack from Item#getItemStack as an arg, the itemstack is null
#

but i can get an item ingame using Item#getItemStack

terse pumice
#

I am trying to get a player's textures by using reflection - I currently have the below but CraftPlayer is specific to versions, what is the best way to go about proceeding with this?

public static String getTexture(Player player) {
        CraftPlayer craftPlayer = (CraftPlayer) player;

        GameProfile profile;
        try {
            Method getProfileMethod = craftPlayer.getClass().getDeclaredMethod("getProfile");
            profile = (GameProfile) getProfileMethod.invoke(craftPlayer);
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
            e.printStackTrace();
            return "";
        }

        Property property = profile.getProperties().get("textures").iterator().next();
        return property.getValue();
    }
sullen marlin
#

Use the profile API

terse pumice
#

I offer support for versions pre 1.18

remote swallow
#

get their profile, get textures, get skin and format it from the url

remote swallow
#

if you cant you have to use reflection

terse pumice
#

I'm happy to use reflection

remote swallow
#

use Bukkit.getServer().getClass() and format it to remove after the v1_20_R1

terse pumice
#

Ooh ok

#

Awesome

#

Thank you, I'll give that a shot

echo basalt
#

can't you just

#

player.getClass()

remote swallow
#

yeah but invoking properties will need it

echo basalt
#

uhh no

#

GameProfile is authlib

remote swallow
#

oh true

eternal oxide
#

He only neeeds it for CraftPlayer

terse pumice
#

Ooh doing player.getClass() returns the relevant CraftPlayer class

#

awesome news, thank you

lost matrix
twin venture
#

dissallow shift click?
from first inv to player inv?

zealous osprey
lost matrix
#
  1. Check if clicked inventory is top inventory
  2. Check the InventoryAction
    This makes it easier to distinguish what is happening than checking if the click was a shift click.
lilac dagger
#

i recently learned that the cursor item is hold by the player class and not by event, it took me a while till i figure it out why i couldn't get the item in the player's hand

remote swallow
#

@ivory sleet have you used hibernate before with the libraries feature in plugin.yml

#

i feel like i saw you talking about it here at somepoint

ivory sleet
#

i have used it

#

but not with the lib thing

remote swallow
#

do you know spigot classloaders

ivory sleet
#

wym by that

#

ik how the classloading works yes

remote swallow
#

plugin classloaders spigot uses

ivory sleet
#

yea

#

what about them

remote swallow
ivory sleet
#

hmm yes

#

so essentially it seems like hibernate tries to load the class CustomDrop on its own

remote swallow
#

not my issue btw, just one that already exists

#

but pretty much exactly the same info

jagged thicket
#
            QueryBuilder<PlayerStats,String> qb = dao.queryBuilder();
// select 2 aggregate functions as the return
            qb.where().eq("gang","sus ");
// the results will contain 2 string values for the min and max
           GenericRawResults<String[]> rawResults = dao.queryRaw(qb.prepareStatementString());
            // page through the results
            List<String[]> results = rawResults.getResults();

            results.forEach(s -> System.out.println(Arrays.toString((String[]) s )));
#

[19:34:27] [Server thread/INFO]: [09ed5c77-bdd7-4436-8167-50f4eefe5144, ORANG3I, sus , rookie]
[19:34:27] [Server thread/INFO]: [89f6be0a-a27b-3415-86ef-c9acc095b61c, orang3ikr, sus , rookie]

#

this is the output

#

how do pull out the usernames alone

#

ORANG3I and orang3ikr

remote swallow
#

array[1]

ivory sleet
#

Yeah just index the array

lost matrix
#

Do you only want to query the names? In this case you need a projection.

jagged thicket
remote swallow
#

yeah just index the array

jagged thicket
#

yeah works thanks

lost matrix
jagged thicket
lost matrix
#

Sure, i just couldnt comprehend that simply accessing the array was your question...

jagged thicket
ivory sleet
#

@remote swallow

#

did u get that issue as well

#

I can try to fiddle with it

remote swallow
#

the issue coll found, i just thought of something to test

#

i could just sout the classloader in one of the classes and see what it says

#

and then hope i can access that classloader

#

so its the plugin classloader

#

but i added that

#

huh

#

i think the reason it doesnt work is because the class isnt loaded, at all

#

okay it isnt, thats jank

remote swallow
reef flower
#

Hi ! i have a big problem, i'm trying tro use Java Reflections in my plugin but my ide didnt know Reflections object... In my .jar file, Reflections is correctly shaded and the depenencie is in my maven pom.xml

#

Yes

eternal oxide
#

an Artifacts issue most likely

#

You likely are not using the maven tab to build your project

reef flower
#

i use

#

i shade with maven

eternal oxide
#

not if you use artifacts

lost matrix
#

But do you actually use maven?

reef flower
#

Yes

lost matrix
#

How do you compile?

reef flower
#

package

lost matrix
#

Show your pom

reef flower
#

can u send the quote for code plz

lost matrix
#

``

eternal oxide
#

?paste

reef flower
#

thanks

undone axleBOT
lost matrix
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
reef flower
#
    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.20.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <version>0.10.2</version>
        </dependency>
    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <relocations>
                                <relocation>
                                    <pattern>fr.toutcourt.moonapi</pattern>
                                    <shadedPattern>fr.toutcourt.moonapi.shaded</shadedPattern>
                                </relocation>
                            </relocations>
                            <outputDirectory>../../Minecraft Server/1.18.2/plugins</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
#

just the important code

eternal oxide
#

um your relocation pattern seems to be useless

reef flower
#

maybe

ivory sleet
#

@remote swallow alr it took some time to fix my env, but i think its fixable

eternal oxide
#

you only relocate your own api?

reef flower
#

no

#

i use reloaction in opther plugin

#

and it always work

#

but when i try to import org.Reflection in my ide, that didnt work

#

import org.reflections.Reflections;
if you prefere

quaint mantle
#

wait cant you use java built-in reflection in std

#

like this java.lang.reflect

reef flower
#

no Reflections is not in

#

i need to user org.Reflections

lilac dagger
#

aren't all reflections in java.reflect?

ripe moat
#

The .jar file i've set to come into my server when i press "rebuild", can i rename that file without it breaking the plugin in any way?

lilac dagger
#

java.lang.reflect*

chrome beacon
lilac dagger
#

i see

reef flower
#

IT WORKS NOW

#

What is this shit ????

#

My IDE in complitly broken

quaint mantle
#

do you use intellij?

reef flower
#

yes

cold pawn
#

Can the bounding box of an NPC, which was created using packets, be adjusted or resized? The NPC is currently in a sleeping pose, causing its bounding box to be too small. This makes it almost impossible for players to locate the interaction area when trying to interact with the NPC.

ivory sleet
#

@remote swallow what code did u use btw

lilac dagger
#

by raytracing nearby entities

#

with a bounding box of your own

remote swallow
mellow edge
#

how do I teleport a player but not kill him (e.g. if a player is falling and I tp it to X location it won't die from fall damage)

lost matrix
mellow edge
#

I meant if he has been falling before he will die then

lost matrix
mellow edge
#

which func exactly?

#

could I also set it's velocity to vector 0 0 0

remote swallow
#

or just in general

lost matrix
mellow edge
#

thank you

kindred sentinel
#

i can't get amplifier of base potion

#

like i have item stack of potion

#

and if i'm trying to get it's amplifier i'm getting it's meta

remote swallow
#

bc it doesnt have an amp

#

its either upgraded or extended

kindred sentinel
#

oh

#

and how to get it's minimum level?

#

there are only .getMaxLevel

remote swallow
#

its always 1 iirc

kindred sentinel
#

turtle potion 💀

remote swallow
#

that only has 1 level

#

but gives effects

kindred sentinel
#

nope, you can upgrade it

remote swallow
#

so its 1 and an upgraded 1

#

or 1 and 2, 2 is upraded 1

kindred sentinel
#

frst level of turtle potion:
slowness 4
resistance 3
scnd level of turtle potion
slowness 6
resistance 4

twin venture
#

hi trying to get the date but ..

#

it say 1970 ... smth

kindred sentinel
#

or something like that

twin venture
#

:p

kindred sentinel
remote swallow
#

cast it to potion meta, get base potion data, set it to upgraded, set base potion data, set potion meta back to item

kindred sentinel
#

and if potion is already upgraded?

remote swallow
#

cry

cold pawn
kindred sentinel
remote swallow
#

none that ive found, would probably need to use an enum or something and then figure out upgrade durations

kindred sentinel
#

😭

heavy bobcat
#

Does anyone know how to do something when a player closes a gui

#

like brodcast a message or something

tall dragon
#

InventoryCloseEvent

heavy bobcat
#

how can i tell if it is a specific gui

heavy bobcat
#

ok

lilac dagger
#

that is the premise

#

getdirection normalises it to 1 per block

#

so every time you add the vector on your location it advances it by 1 block

ivory sleet
remote swallow
#

the session factory?

ivory sleet
#

Myeah I assume that

#

The builder stuff basically, like ur onEnable

#

Cuz I didnt get anything

#

Like no errors

remote swallow
#

want the error too

ivory sleet
#

Yeah why not

cold pawn
remote swallow
lilac dagger
#

just make it 2 blocks 1 player location and the other a block above

#

if one of the check triggers stop the ray tracing and that's your npc

#

you do need to loop through your npcs or at least

#

get the angle and distance

#

to use those to reduce the number of checks

#

it's up to you what approach you take

kindred sentinel
fresh timber
#

Is it better to make plugins for your server separately like make multiple plugins for your own server or to make just 1 that does everything for your server? (or does it rly just not matter at all)

cold pawn
cold pawn
lilac dagger
#

you can also make it more precise with a custom bounding box

remote swallow
lilac dagger
#

a selection

cold pawn
twilit basalt
#

I want to update my premium plugin, but it says my file is too big, what can I do?

fresh timber
remote swallow
#

dont shade un-needed stuff, minimize, use the plugin.yml libraries feature

twilit basalt
fresh timber
twilit basalt
fresh timber
#

but it does make sense for organizing

remote swallow
#

do the last one then

#

if you support a lot of nms versions, pick the majors

twilit basalt
#

nope no nms

remote swallow
#

you shading much?

#

sql drivers?

twilit basalt
#

mysql driver yeah

eternal oxide
#

why?

remote swallow
#

use the libraries feature in pluign.yml

twilit basalt
#

because I had issues with it

twilit basalt
eternal oxide
#

?paste your pom

undone axleBOT
remote swallow
#
libraries:
  - 'group:artifact:ver'
twilit basalt
#

I have gradle but wait

remote swallow
#

and the kotlin std lib

twilit basalt
#

okay, so I can use compileOnly then?

remote swallow
#
libraries:
  - 'mysql:mysql-connector-java:8.0.33'
  - 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10'
remote swallow
#

also move all the adventure stuff

twilit basalt
#

I cant lol

#

that is on sona type repo

remote swallow
#

the snapshots are

cold pawn
remote swallow
#

the release versions arent

#

you should use snapshotss

lilac dagger
#

or distance check would fix it too

twilit basalt
#

what about javase from com.google.zxing?

lilac dagger
#

there are so many ways to solve it

slender elbow
remote swallow
#

thats with library loader

#

trying to not shade hibernate

remote swallow
remote swallow
slender elbow
#

never worked with hibernate but maybe you need to specify the ClassLoader somewhere?

remote swallow
#

tried it

#

didnt work

slender elbow
#

well you'd still have to, no? what if you change the thread context classloader?

cold pawn
lilac dagger
#

a min and max

#

with a is inside method

remote swallow
slender elbow
#

hm reading the stack trace it's trying to use its own classloader, there's probably another way somewhere to specify it, no clue otherwise

cold pawn
lilac dagger
#

no

remote swallow
#

same error even if it has that

lilac dagger
#

you have to make your own class

remote swallow
#

and its loaded by that classloader

twilit basalt
#

lol libraries from plugin.yml recuded the file size by 3mb

cold pawn
lilac dagger
#

no

#

create a selection class

#

that takes min and max

#

or at least with math min and max

#

and then check if they're in these 2

quaint mantle
remote swallow
#

afirst thnig that came to my brain so just wrote it

cold pawn
celest notch
#

I am having trouble making custom entities, what i am trying to do is have an interface containing the base entity logic like storing its custom health etc, and have various classes which implement it and add features like abilitys, custom weapons and armor, etc. What i am having a problem with is making it serialize into a yml file nicely.

cold pawn
# celest notch I am having trouble making custom entities, what i am trying to do is have an in...

Try checking out this video, it might help https://www.youtube.com/watch?v=3OLSfOkgPMw&t=509s

Time to continue our talk about Persistent Data Containers! In this episode, I talk about custom persistent data types. This allows us to save whole custom objects to the containers. This way, we can get more data out of our container without having to save multiple values or even multiple namespaced keys. I hope you all enjoy this video, see y'...

▶ Play video
quaint mantle
#

if persistent data is advanced then im a magician

fresh timber
#

pdc easy

celest notch
#

i ideally want to use ConfigurationSerializable though and store the data in yml files

cold pawn
celest notch
#

yml files are more commonly used and user friendly i might publish the plugin if i actually make it work

#

basically i can simplify my issue into one question, if i have a class which implements my customentity interface and serialize it in config, if i deserialize it will it still be a valid class?

cold pawn
celest notch
#

ok i'll come back in a bit if it doesnt work

cold pawn
lilac dagger
#

the player itself

#

the ray is still the ray

cold pawn
# lilac dagger the player itself

Ok I have most things figured out, the only question that comes to mind is how that would work for the body. From what I know the block location of the npc would be the block under its legs (Since its in the sleeping pose). So would the raytrace only work for its legs and not the body? Or am I missing something.?

lilac dagger
#

oh, then you have to mess with the selection to make it more like a sleeping person

remote swallow
#

@ivory sleet find anything?

ivory sleet
#

no

#

is colls prison thingy open source?

remote swallow
#

not atm, he'd probably add you though

#

@young knoll add conclube to prisoncore for hibernate debug

ivory sleet
young knoll
#

huh who what

remote swallow
#

conclube (helper above) to prisoncore to try fix hibernate shading

#

small jar

#

github is conclube too

young knoll
#

aight

cold pawn
remote swallow
#

@ivory sleet to make hibernate a library change implementation to bukkitLibrary in the core build.gradle

quaint mantle
#

how i can add the spigot lib to my plug in project

#

so?

small current
#

what is the event for when a player gets damaged by potion

#

and how to get the player that thrown the potion

remote swallow
# quaint mantle so?

publish it to a maven repo or mvn install it and add the respective maven info to ur other project

quaint mantle
#

ok thx can i have the link

remote swallow
#

for which

quaint mantle
#

the maven repo

remote swallow
#

maven central, jitpack, repsy

#

maven central requires a domain or a github package, jitpack uses github, repsy doesnt care

quaint mantle
#

ok

#

i can do it with my terminal it's ok or it need a specific thing

remote swallow
#

all are online just require local setup for setting the user and token

heavy bobcat
#

I am using an event listener for if someone closes and inventory to detect if they are clsing a gui, then if they are i reopen the gui

remote swallow
#

delay it a tick

#

?scheduling

undone axleBOT
heavy bobcat
#

but it opens an inventory not a gui

#

so i can take out items and stuff

remote swallow
#

you have to cancel the events

heavy bobcat
#

how can I do that

remote swallow
#

inventory click event and inventory drag event

#

call setCancelled(true) if it sur inv

heavy bobcat
#

ok thanks

#

and the second problem is

#

if i close it, it opens , but if i close it agian it doesnt open again

remote swallow
#

you arent recreating it the same

heavy bobcat
#

i using the same thing

#

just opening the gui

remote swallow
#

do you keep a view instance

#

InventoryView

heavy bobcat
#

i do if

remote swallow
#

you need to update that

tall dragon
#

maybe show some code

heavy bobcat
smoky oak
#

can you make a giant's move it's arms in other ways than attack and neutral?

lost matrix
smoky oak
#

so yes if modded

#

gotcha

quaint mantle
#

is there a way to get all loaded spawners?

#

im working on stacked spawners and not wanting to deal with storing spawner locations

#

and i need to tick them every 5s

celest notch
#

I'm still having trouble coding custom entities the problem that i'm having is whether i should use an interface or abstract class to handle custom health, etc and just implement/extend that but will that work with ConfigurationSerializable or will it just return the extended class and not convert it into the desired class

#

like for example if i had this:

public abstract class CustomEntity implements ConfigurationSerializable {

}

and this:

public class CustomZombie extends CustomEntity {

}

If i serialize the customzombie class into a config.yml and deserialize it will it return the CustomEntity or CustomZombie class, and also how would i handle the serialize and deserialize methods

pseudo hazel
#

if your customZobie has serialization it will be saved as a zombie

#

if only your custom entity has serialization then it will be saved as a custom entity

#

I think it depends on whether you implement the serialize function

#

i.e. dont implement it in your abstract class

#

or override it in your zombie class to add more stuff to it

#

oop style

celest notch
#

ok so i just use the abstract class as a base and put the actual serialization in the class that extends it

pseudo hazel
#

yes like I said at the end though you can have it both ways

#

but just make sure to actually register the class for serialization xD

#

but isnce its abstract you should never have to serialize your base class anyways

kindred sentinel
#

Does someone know the way to add 1 level to the base minecraft potion?

upper hazel
#

why this not reload config.yml plugin.getConfig().set("Location",location);
plugin.saveConfig();
plugin.reloadConfig();

pseudo hazel
#

maybe create an abstract function called serializeEntity() in customEntity and then implement serialize

#

but idk

#

that will probably require generic magic to get the type correct

celest notch
#

but the problem is i want the abstract class to have the basic variables that all custom entities have like custom health and stuff how would i handle that

pseudo hazel
#

well essentially you just make it like how I described

#

you implement serialize on both classes

celest notch
#

ok so that will work then i'll try it

pseudo hazel
#

and your child class will just call the super

#

if that doesnt work maybe create a protected function on your abstract called getSerialized() where it just serializes the base class and then combine that with the rest of the inherited class

twilit roost
#

wow ChatGPT feeling honorous

remote swallow
#

chatgpt doesnt like me

#

i ask it 1 thing and i get a response about cake

lost matrix
#

Sounds good to me. You dont like cake?

remote swallow
#

not when im having to talk to chatgpt

kindred sentinel
subtle folio
#

just store them!

lost matrix
quaint mantle
#

yes

subtle folio
quaint mantle
#

is there a way to find all loaded ones?

kindred sentinel
#

like.. even to upgraded

lost matrix
lost matrix
kindred sentinel
#

Okay, then how to get base potion duration and amplifier

#

like is there any enum or something like that to get base potion duration or base potion amplifier?

lost matrix
#

What version are you on?

kindred sentinel
#

1.19.4

lost matrix
#

I dont see anything that could be used to find out the default potion values.

kindred sentinel
#

oh...

#

then i should create new enum

#

💀💀💀 turtle master potion with slowness 4: Hello

remote swallow
#

anyone know if its possible to make custom advancements that work in all worlds, or is that just default

kindred sentinel
#

i think using datapacks it's possible

remote swallow
#

if its possible in datapacks i could probably nms it

lost matrix
quaint mantle
lost matrix
#

Getting the tile entities takes a few micros

echo basalt
#

it's cached when the chunk is loaded

lost matrix
remote swallow
#

thats nice

#

there is no internal block mine critereon

plucky anchor
#

can someone help me i dont know what commands to use to like withdraw and stuff

#

im trying to make a server for me anmd my ffriends and idk what to do

kindred sentinel
#

finally

#

(time in seconds)

#

oh shit i need color of the potions too

odd lark
#

I would like to do cleaner work on my plugins, so far I have not selected a build system.

but from what I understand it's better to choose one but I don't know which one adapts better to the plugin between Maven or Gradle ?

remote swallow
#

its entirely personal preference

lost matrix
#

Maven has a lot more coverage in spigot.
Gradle is used a bit more when working with paper.

I would suggest starting out with Maven and then trying out gradle at a later point in time.

odd lark
#

thanks you

kindred sentinel
#

How to get Color of hex?

#

like

#

i have hex

#

and i need object Color

#

from hex

#

but i need bukkit.Color

pseudo hazel
#

dont use bukkit color

#

use bungee's

kindred sentinel
#

but

#

i'm changing color of potion

#

lol

pseudo hazel
#

so

#

okay

kindred sentinel
#

not chatcolor

pseudo hazel
#

well maybe you can just convert it to bukkit color after

#

if you have a hex string, Bungee's ChatColor.of is the easiest way

kindred sentinel
#

and.. hot to solve this?

subtle folio
#

didn’t read full messages

kindred sentinel
#

it doesn't have fromRGB

#

Oh

#

OH