#help-development

1 messages · Page 596 of 1

dull schooner
#

yep thats actually true, but usualy this bit is enough to simple tasks

fluid river
#

well, but headers are not supposed to have impl

hazy parrot
#

that was joke

fluid river
#

i mean yeah you can do that ofc

#

but still

dull schooner
#

comparing c++ to java i actually prefer java, but that doesnt mean i like java

#

i think the verbose thing is important but it shouldn't be required

fluid river
#

well, comparing java to kotlin, it uses like completely different approach

quaint mantle
#

hi, my custom config files doesn't save the .addDefault(). I already made a save method

fluid river
#

and it's simplified to the point where it's easier to write, but harder to read/understand

#

when workin on a big project

fluid river
quaint mantle
dull schooner
#

dont get me wrong, for big projects java is very good

#

but if you're thinking in a bunch of small tasks, is very annoying

fluid river
#

what's the problem

quaint mantle
#

the config doesn't save

#

Example I add default things and doesn't save

dull schooner
#

i think there's a saveConfig() method?

#

dont know for sure

fluid river
#

is that so hard to copypaste original config code from stash

#

and just change "config.yml" to your filename

hazy parrot
#

why are you using addDefault tho

fluid river
#

?stash

undone axleBOT
hazy parrot
#

i never found myself in need to use it

quaint mantle
#

to create parameters

hazy parrot
#

just add your config to resources and call JavaPlugin#saveResource

quaint mantle
#
// This is an example.
config = new CustomConfig("mongodb.yml");
config.getConfig().addDefault("mongo_uri", "Your connection uri");
config.saveCustomFile();
tribal valve
#

How to get the arrow sender, like if arrow damaged player, how i would get the entity that shoot the arrow

fluid river
#
public class CustomConfigManager {

    private File customConfigFile;
    private FileConfiguration customConfig;

    public CustomConfigManager() {
        var dataFolder = JavaPlugin.getProvidingPlugin(CustomConfig.class).getDataFolder();
        customConfigFile = new File (dataFolder, "customconfig.yml");
    }

    public void saveCustomConfig() {
        try {
            customConfig.save(customConfigFile);
        } catch (IOException ex) {}
    }

    public void reloadCustomConfig() {
        customConfig = YamlConfiguration.loadConfiguration(customConfigFile);
        InputStream defConfigStream = getResource("customconfig.yml");
        if (defConfigStream == null) return;
        customConfig.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
    }

    public void saveDefaultCustomConfig() {
        if (!customConfigFile.exists()) saveResource("customconfig.yml", false);
    }

    public FileConfiguration getConfig() {
        if (customConfig == null) reloadCustomConfig();
        return customConfig;
    }
}```
#

copypaste to every plugin

#

this is 100% original spigot code

remote swallow
#

customconfig.ymn

fluid river
#

with custom word added everywhere

quaint mantle
#

but if yo uwant to create another config with other name?

fluid river
#

add more similar methods with configname instead of customconfig, or add parameters to methods

#

second approach will increase methods complexity but still

fluid river
quaint mantle
#

emm, but that is for a single file

fluid river
#

alr, adding 2 specially for you

#
public class CustomConfigManager {

    private File customConfigFile, localeFile;
    private FileConfiguration customConfig, locale;

    public CustomConfigManager() {
        var dataFolder = JavaPlugin.getProvidingPlugin(CustomConfig.class).getDataFolder();
        customConfigFile = new File (dataFolder, "customconfig.yml");
        localeFile = new File(dataFolder, "locale.yml");
        saveDefaultFiles();
    }

    public void saveCustomConfig() {
        try {
            customConfig.save(customConfigFile);
        } catch (IOException ex) {}
    }

    public void saveLocale() {
        try {
            locale.save(localeFile);
        } catch (IOException ex) {}
    }

    public void reloadCustomConfig() {
        customConfig = YamlConfiguration.loadConfiguration(customConfigFile);
        InputStream defConfigStream = getResource("customconfig.yml");
        if (defConfigStream == null) return;
        customConfig.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
    }

    public void reloadLocale() {
        locale = YamlConfiguration.loadConfiguration(localeFile);
        InputStream defConfigStream = getResource("locale.yml");
        if (defConfigStream == null) return;
        customConfig.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
    }

    public void saveDefaultFiles() {
        if (!customConfigFile.exists()) saveResource("customconfig.yml", false);
        if (!localeFile.exists()) saveResource("locale.yml", false);
    }

    public FileConfiguration getCustomConfig() {
        if (customConfig == null) reloadCustomConfig();
        return customConfig;
    }

    public FileConfiguration getLocale() {
        if (locale == null) reloadLocale();
        return locale;
    }
}```
quaint mantle
#

where xd

fluid river
#

done

#

now you have locale and customConfig

#

each file is treated individually

quaint mantle
#

but you need to create more methods each one you need

fluid river
#

except saveDefault

#

yeah, one more save, one more reload and one more get

#

cuz you don't want to save config if you changed locale

#

and only need to save locale

earnest fiber
#

does anyone know how PersistentDataContainer#set() is supposed to work with PersistentDataType.TAG_CONTAINER? Since PersistentDataContainer is an interface, I'm not sure what to instatiate to create a new container

fluid river
#

what are you trying to do

quaint mantle
fluid river
#

set() uses Key and Value

earnest fiber
#

trying to use PDC to store a Location, but I want pitch and yaw, so I don't think an int array will work

#

and there doesn't seem to be an option for double array

fluid river
#

umm

#

you need to serialize your location

eternal oxide
#

write a custom type or use morePDC

fluid river
#

to string at least

chrome beacon
#

?morepdc

undone axleBOT
fluid river
#

or use morepdc

#

^^

eternal oxide
#

sec I have a Location

#

if thats all you need

fluid river
#

you can serialize location to string like

eternal oxide
#

?paste

undone axleBOT
earnest fiber
#

oh yeah string would work as a base type. I was trying to figure out what to do since the custom ones need to reduce down to one of the original types

fluid river
#

"world;107.0;98.55;290.153;90.0;0.7"

#

and then use string.split(";");

#

and build location from the array

earnest fiber
#

should be simple enough. Thanks for the tip!

fluid river
#

but morepdc is better i'm sure

#

thanks alex

eternal oxide
fluid river
#

oh @quaint mantle you do one instance per file

#

Config factory

#

my bad

quaint mantle
#

i'm lost now xdddd

earnest fiber
#

oh yeah, MorePDC has a type for double arrays. It looks pretty lightweight, so I might just use that

chrome beacon
#

MorePDC can just save Locations directly

#

No need for double array

#

Locations are configuration serializable

smoky anchor
#

Heyo!
Currently on some version of 1.19.4 and can not update yet
Can somebody check if isKeyboardClick checks for SWAP_OFFHAND on newer versions ?
Seems to me that it should be considered a keyboardClick

earnest fiber
fluid river
#
public class CustomConfig {

    static File dataFolder = JavaPlugin.getProvidingPlugin(CustomConfig.class).getDataFolder();

    private File file;
    private FileConfiguration conf;
    private String fileName;

    public CustomConfig(String fileName) {
        this.fileName = fileName;
        file = new File (dataFolder, fileName + ".yml");
        if (!file.exists()) file.createNewFile();
    }

    public void saveCustomConfig() {
        try {
            conf.save(file);
        } catch (IOException ex) {}
    }

    public void reloadCustomConfig() {
        conf = YamlConfiguration.loadConfiguration(file);
    }

    public FileConfiguration getCustomConfig() {
        if (conf == null) reloadCustomConfig();
        return conf;
    }
}```
sterile breach
#

Hello, I need advice

in my plugin i need database system,

At first I was just thinking of doing it this way:
when something needs to be changed -> sql query
but for perfs it's not terrible, what was suggested to me,

create a hashmap which the uid (key) and in value an instance of a class which contains the equivalent of the columns,

then at the start of the server I transfer the database into my hashmap, and all my modifications I make them inside this one, then every 5 minutes I save the hashmap in the database.

Is it a good idea ?

fluid river
#

on crash it dies

tender shard
#

i always wonder why so many people's servers randomly crash, it has never ever happened to me

#

is everyone running a 100 player server on a 512mb aternos server or what lol

shadow night
#

Lol

fluid river
#

but at least it's better than saving changed to SQL from your hashmap on server disable

distant wave
#

ive already asked here but it didnt work, how can i increase player swim speed?

fluid river
#

is that even possible lol

#

isn't it affected by walkSpeed

distant wave
#

its not

fluid river
#

sad

distant wave
#

ive tried a lot of stuff

shadow night
#

Dolphin effect? Does it work for more than 1 level tho?

distant wave
#

nope

#

tried that

#

also attributes

#

didnt work

fluid river
#

that's still 100% copy of default bukkit code, but for case when you create a file and it's not present in .jar(so it's a super custom config)

smoky anchor
# distant wave didnt work

if you really need it, one way would be to manually apply velocity
would be scuff as fuck and quite laggy for ppl with higher ping

tender shard
shadow night
distant wave
#

or atleast i tried

shadow night
#

Well, sounds like you did something wrong then

sterile breach
fluid river
shadow night
smoky anchor
distant wave
quaint mantle
fluid river
#

what

smoky anchor
fluid river
#

no

#

why

fluid river
#

for what reason it should be new

#

if YamlConfigurations methods are static

quaint mantle
fluid river
#

oh

#

remove ()

smoky anchor
fluid river
#

It's a class name, by which you call a static

quaint mantle
distant wave
fluid river
#

are your configs present in the final jar or you just create them for random game event?

smoky anchor
fluid river
#

?

distant wave
quaint mantle
#

like for a server core

shadow night
#

A server core?

smoky anchor
fluid river
#

?

#

i asked if your files are present in the final plugin jar

distant wave
fluid river
#

when you build it, are they in resources folder

#

or not

quaint mantle
#

here a core is called a plugin (util) taht manages the base of teh server

quaint mantle
fluid river
#

show it

quaint mantle
fluid river
#

show your code

#

conf is null by default

#

you are using save for some reason

quaint mantle
fluid river
#

and i don't have createCustomConfig method in my code

smoky anchor
fluid river
#

show code where you instantiate a new CustomConfig

quaint mantle
sick ermine
#

Is a new player object created when logging out of the server?
should i use UUID for this?

remote swallow
#

yes

fluid river
#

and you didn't use what i gave you

remote swallow
shadow night
#

What is an OfflinePlayer then?

sick ermine
remote swallow
#

no

#

but trying to use it for anything wont work

fluid river
#

don't call save here

shadow night
fluid river
#

you need file.createNewFile() here

echo basalt
#

I'd split the map logic into a separate class

sick ermine
fluid river
echo basalt
#

Finally someone that gets it

distant wave
fluid river
smoky anchor
echo basalt
#

depends

#

usually it's a state enum

fluid river
#

and what's wrong with an enum

quaint mantle
echo basalt
#

At work I do something like that

smoky anchor
distant wave
#

well i did this but now im swmming super slow

fluid river
#

values are not in it?

echo basalt
earnest fiber
#

so I'm back again... MorePDC lists a "shadowJar" section along with the repository and dependency. I'm assuming this is meant to move the API into the package at build time, but I'm not sure how it works. Is it handled automatically when I run the jar task?

#

(this is referring to the build.grade file)

rare rover
fluid river
#

guy needs free shadow gradle lessons

rare rover
#

Exciting

fluid river
#

help him

echo basalt
#

Anyways a phase is just uhh

fluid river
#

a phase is just a synonim to state

#

ig

echo basalt
#

a kind of state where you can register listeners and tasks when it starts

fluid river
#

cool

echo basalt
#

and when the phase ends, things clean up and the phase is no longer active

fluid river
#

imagine having this all on cpp

#

💀

echo basalt
#

There's also the vanilla mechanics system that lets you disable certain vanilla features dynamically

fluid river
#

aren't you developing fucking base to every possible minigame

echo basalt
#

pretty much

fluid river
#

😉

echo basalt
#

I made TNT tag in like an hour

quaint mantle
#

How should I go about this? I removed our implementation line for sdk and just switched it to only the jvm kotlin plugin and its still included im pretty sure I need to include kotlin for it tow ork (they are all using the same kotlin plugin because we have our projects as modules and they all define kotlin in the master build.gradle.kts not induvidually)

java.lang.LinkageError: loader constraint violation: when resolving method 'void me.nopox.stuff.Serializers.useGsonBuilderThenRebuild(kotlin.jvm.functions.Function1)' the class loader 'Commands-1.0.jar' @5ea86494 of the current class, me/nopox/commands/Commands, and the class loader 'Stuff-Remapped-1.0.jar' @4def2336 for the method's defining class, me/nopox/stuff/serializers/Serializers, have different Class objects for the type kotlin/jvm/functions/Function1 used in the signature (me.nopox.commands.CommandsPlugin is in unnamed module of loader 'Commands-1.0.jar' @5ea86494, parent loader java.net.URLClassLoader @27fa135a; me.nopox.stuff..serializers.Serializers is in unnamed module of loader 'Stuff-Remapped-1.0.jar' @4def2336, parent loader java.net.URLClassLoader @27fa135a)

earnest fiber
#

nvm I found the docs for Shadow

fluid river
#
  1. copypaste entire codebase
  2. change name to MyAwesomeMinigame
  3. change game logic a bit
#
  1. done
echo basalt
#

You don't need to copypaste the entire codebase

#

You can just add it here

fluid river
#

not like i'm going to

distant wave
#

why cant i just multiply the velocity, why does it have to be so hard to make bruv

fluid river
#

what is going on there

#

get players direction(should be a unit vector)

fluid river
#

if not then .normalize()

#

multiply by some value

#

and set to player's velocity

#

boom done

#

also velocity should work different in water

echo basalt
#
Location from = event.getFrom();
Location to = event.getTo();

Vector direction = to.getDirection();
Vector difference = from.clone().subtract(to);
fluid river
#

iirc

echo basalt
#

from - to = vector that pulls from -> to

fluid river
#

cuz water resistance is much higher

fluid river
echo basalt
#

to - from = vector that pulls to -> from

#

it might seem a bit backwards

#

either that or I'm tripping

fluid river
#

you do end - start

fluid river
#

to get the vector directing from start to end

distant wave
fluid river
#

and what was wrong

distant wave
#

im very fast

#

like too fast

fluid river
#

umm, lower your value

distant wave
#

altough the multiplier is 1

fluid river
distant wave
fluid river
#

the one which is suggested to you by guys here

fluid river
#

but multiplying by one is not changing anything

quaint mantle
#

How do i check if a player has any of these for permissions?
testPermission1, testPermission2, testPermission3 and testPermission4

fluid river
#

so are you too fast with this piece of code or with another

distant wave
#

yes

#

with this

fluid river
fluid river
#

and has length of 1

#

and velocity(according to docs) saying that it's 1 block per tick or smth similar

#

so you need to multiply by value, which is smaller than 1

#

try .2 for example(should be 4 blocks per second) which is somewhere on move speed

quaint mantle
distant wave
#

ohh its changing

echo basalt
#

&& is AND
|| is OR

quaint mantle
#

BUt || dosent work

distant wave
fluid river
#

if (player.hasPermission(1) || ... )

echo basalt
#

If statement not scalable if you want to test for 20 permissions instead of just 4

fluid river
#

you need a for loop

echo basalt
#
public boolean hasAny(Player player, String... permissions) {
  for(String permission : permissions) {
    if(player.hasPermission(permission)) {
      return true;
    }
  }

  return false;
}
#

Simple enough

fluid river
#
for (String perm : perms) {
    if (player.hasPermission(perm)) {
        doYourCode();
        return;
    }
}```
echo basalt
#

if(hasAny(player, "one", "two", "three"))

fluid river
#

or ^^^

quaint mantle
#

No i mean if i have like 8 permissions and i want to check if a player has any of these 8

echo basalt
#

make a list out of those 8

fluid river
#

copypaste immlussion's method

#

and use it

echo basalt
#

and do a for loop

distant wave
#

holy crap it works

#

tysm everyone

fluid river
#
if (!hasAny(player, "myplugin.fly", "myplugin.god", "vault.die")) return;```
echo basalt
#

joe.mama

fluid river
#

if you are doing this in moveevent, don't forget to check if player is in water

quaint mantle
#

I dont get it
So it this right

        Player player = (Player) sender;
        public boolean hasAny(String permissions) {
            for(String permission : testPermission1, testPermission2, testPermission3, testPermission4) {
                if(player.hasPermission(permission)) {
                    return true;
                }
            }

            return false;
        }
undone axleBOT
echo basalt
#

yeah it's learnjava time

ivory sleet
fluid river
#

jearnlava

rapid garden
#
if(firstItemMeta.hasEnchants() && secondItemMeta.hasEnchants()){
                    Map<Enchantment, Integer> enchantmentsMap1 = new HashMap<Enchantment, Integer>();
                    for(Map.Entry<Enchantment, Integer> entry : firstItemMeta.getEnchants().entrySet()){
                        Enchantment enchantment = entry.getKey();
                        int enchantmentLevel = entry.getValue();

                        enchantmentsMap1.put(enchantment, enchantmentLevel);
                        Bukkit.getLogger().info("Item 1 Enchantment: " + enchantment + " - " + enchantmentLevel);
                    }

                    Map<Enchantment, Integer> enchantmentsMap2 = new HashMap<Enchantment, Integer>();
                    for(Map.Entry<Enchantment, Integer> entry : secondItemMeta.getEnchants().entrySet()){
                        Enchantment enchantment = entry.getKey();
                        int enchantmentLevel = entry.getValue();

                        enchantmentsMap2.put(enchantment, enchantmentLevel);
                        Bukkit.getLogger().info("Item 2 Enchantment: " + enchantment + " - " + enchantmentLevel);
                    }


                    ItemStack resultItem = new ItemStack(firstItemMaterial);
                    EnchantmentStorageMeta resultItemMeta = (EnchantmentStorageMeta) resultItem.getItemMeta();

                    int i = 0;
                    int j = 0;
                    for(Map.Entry<Enchantment, Integer> entry : enchantmentsMap1.entrySet()){
                        Enchantment key = entry.getKey();
                        int value = entry.getValue();

                        if(enchantmentsMap1.containsKey(key) && enchantmentsMap1.get(key) == value){
                            resultItemMeta.addStoredEnchant(key, value+1, true);
                            Bukkit.getLogger().info("Result: " + key + " - " + value);
                            i++;
                            i = i + value+1;
                        }
                    }

                    final int enchantmentsDone = i;
                    final int levels = j;

                    resultItem.setItemMeta(resultItemMeta);
                    event.setResult(resultItem);
                    this.getServer().getScheduler().runTask(this, () -> event.getInventory().setRepairCost(30));
                }

Am I missing something? Shouldn't this work?

smoky anchor
#

try explaining what it should do and what it is not doing

rapid garden
#

Combine enchanted items and get a resulting item past the default limit. Ex. Fortune III + Fortune III = Fortune IV

unborn sable
#

Can I set a spawn egg's NBT so it spawns for example a librarian villager?

quaint mantle
remote swallow
unborn sable
smoky anchor
#

?img

undone axleBOT
echo basalt
balmy beacon
#

Is it possible to send debug info from the server to the client such that it will be written in client log files?
(Obviously you can just send chat messages, which are saved in log files, but ideally I don’t want to display anything on the screen, because it’s debug info)

smoky anchor
misty zenith
#

when i changing the gamemode to survival from spectator this happening why ?

@EventHandler
    public void onDamage(EntityDamageByEntityEvent e){
        if (e.getEntity() instanceof Player damageGetter && e.getDamager() instanceof Player damager){

                    e.setCancelled(true);
                    damageGetter.setHealth(20);
damageGetter.teleport(ArenaManager.getTeam(damageGetter).getSpawnLocation());
                    damageGetter.setGameMode(GameMode.SPECTATOR);
                    arena.playerDeath(damageGetter);

// after 5 seconds:
for (UUID id : timeTORespawn.keySet()){
                int t = timeTORespawn.get(id)-1;
                timeTORespawn.put(id,t);
                Player player = Bukkit.getPlayer(id);
                if (t == 0)
                    try {
                        timeTORespawn.remove(id);
                        player.teleport(ArenaManager.getTeam(player).getSpawnLocation());
                        KitManager.getKit(player).equip(player,ArenaManager.getTeam(player).color);
                        player.setGameMode(GameMode.SURVIVAL);
                    }catch (Exception ignored){}
            }
unborn sable
shadow night
#

is there a way to know when the player is clicking the space bar?

smoky anchor
young knoll
#

There is no API for it

smoky anchor
shadow night
#

but I need to also know when in air

eternal oxide
#

you can't jump when in the air so can't detect

echo basalt
smoky anchor
shadow night
earnest fiber
#

are PDCs on players preserved on death? I remember having to hook into the death event to copy over NBT for a mod a long time ago

echo basalt
#

actually nvm my solution has nothing to do with your problem

#

it's just an elegant way of handling spectators

smoky anchor
rapid garden
#

Tbh I don't know what half of them mean

shadow night
misty zenith
smoky anchor
#

?paste

undone axleBOT
smoky anchor
shadow night
#

I want to make like semi flying, like not normal flying, but a little bit, maybe like jetpack or something

rapid garden
smoky anchor
#

well for that sneaking midair might be a bit better, you can control the velocity of player more precisely
tho again, ping is an issue

smoky anchor
mellow edge
#

what is spigot using to colorfully display player joining in yellow? because cmd doesn't support ChatColor colors

smoky anchor
remote swallow
rapid garden
#

So I should just use ItemMeta resultItemMeta = resultItem.getItemMeta();?

smoky anchor
#

yes

tranquil beacon
#

I'm not sure if this is the right place to ask the question, but can someone help me resolve this error? Thank you.

tranquil beacon
#

I replaced spigot-api with spigot because I want to use NMS. So, is it okay if I have this warning?

#

I understand! Thanks!

ivory sleet
#

Wdym establish

#

U just use getConnection on w/e thread

#

with try-with-resources

shadow night
#

can I somehow make my plugin not kick players for flying when they fly too high with my jetpack kinda fly?

#

or is it about disabling enabling flying on the server?

young knoll
#

You gotta disable it on server

shadow night
#

oof

#

but ig

orchid trout
#

everything in my plugin works except the commands

#

no errors in console

#

8o7gasfd

#

i had no permissions

sage patio
#

how i can save a text like this into a String:
[{"translate":"a"},{"text":"test","font":"default","color":"#2804f9"}]
from config?
snakeyml does not allow that and shows a lot of errors because of " and more ...

eternal oxide
#

first try surrounding the entire thing with ` `

spare hazel
#
switch (clickedItem.getType()) {
            case GOLDEN_HOE:
                closeInventory(p);
                new SkillGui(player, "Farming", Material.GOLDEN_HOE).openInventory(p);
                break;
            case STONE_SWORD:
                closeInventory(p);
                new SkillGui(player, "Combat", Material.STONE_SWORD).openInventory(p);
                break;
            case STONE_PICKAXE:
                closeInventory(p);
                new SkillGui(player, "Mining", Material.STONE_PICKAXE).openInventory(p);
                break;
            case JUNGLE_SAPLING:
                closeInventory(p);
                new SkillGui(player, "Woodcutting", Material.JUNGLE_SAPLING).openInventory(p);
                break;
            case CRAFTING_TABLE:
                closeInventory(p);
                new SkillGui(player, "Crafting", Material.CRAFTING_TABLE).openInventory(p);
                break;
            case ENCHANTING_TABLE:
                closeInventory(p);
                new SkillGui(player, "Enchanting", Material.ENCHANTING_TABLE).openInventory(p);
                break;
            case BREWING_STAND:
                closeInventory(p);
                new SkillGui(player, "Alchemy", Material.BREWING_STAND).openInventory(p);
                break;
        }

why does this code open all the guis?

fluid river
#

wdym all

#

this code is disgusting tho

#

yeah

spare hazel
#

it opens a gui for each skill defined on this switch case statement

chrome beacon
#

It's also ignoring the fact that you shouldn't close or open inventories directly in the click event

spare hazel
chrome beacon
#
 The following should never be invoked by an EventHandler for InventoryClickEvent using the HumanEntity or InventoryView associated with this event:

    HumanEntity.closeInventory()
    HumanEntity.openInventory(Inventory)
    HumanEntity.openWorkbench(Location, boolean)
    HumanEntity.openEnchanting(Location, boolean)
    InventoryView.close() 

^^ From Javadocs

spare hazel
#

why?

eternal oxide
#

results may vary

spare hazel
#

there should be a reason

#

i asked why is my switch case statement is executing all the code and got i shouldn't close or open inventories directly in the click event

mellow pebble
#

what is your opinion is it better to make plugin in kotlin or in java ?

eternal oxide
#

Your switch will not be opening all the inventories at once

flint coyote
#

oh no he mentioned kotlin. Time to die

eternal oxide
#

but opening inventories in teh client event can have vey random outcomes

mellow pebble
#

why do you think so

eternal oxide
spare hazel
#

?img doesnt work for me
alternatives?

undone axleBOT
eternal oxide
#

first follow the javadocs. Do not close/open inventories in the click event.

spare hazel
mellow pebble
#

but type inference is fine unless you are not trying to get value of that type ?

eternal oxide
#

don;t bother calling close at all as opening one will close th eold.

#

to open a new you do a runTask#

mellow pebble
#

we can say it is really simple langauge simple to look at read and work with

spare hazel
eternal oxide
#

yes

spare hazel
#

but whatever leme try again

shadow night
#

is there some event for when an item gets destroyed in any way? Cactus, lava, fire, void, whatever

paper trout
#

hey does enyone know kotlin?
i'm getting this error: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics for java 8
and onJoinEvent isn't working
i can give more details as needed

mellow pebble
undone axleBOT
mellow pebble
#

let us see your code

shadow night
mellow pebble
mellow pebble
shadow night
#

problem is, it seems like there is no such event which is not good

spare hazel
#

how to build directly onto the plugin folder?

paper trout
paper trout
#

i've tried meny ways to do join event

spare hazel
paper trout
#

i tried that one

shadow night
remote swallow
#

do you shade the kotlin sdklib or whatever it is

mellow pebble
#

it is playerJoinEvent

remote swallow
#

variable naming doesnt matter

shadow night
#

I wonder if I can somehow track a certain item on ground

remote swallow
shadow night
paper trout
#

ok

mellow pebble
shadow night
spare hazel
mellow pebble
paper trout
#

i wanted to try something new

rapid garden
#

Isn't Kotlin like a superset of Java?

shadow night
paper trout
#

and it did nothing :
no console error and no message

mellow pebble
#

for items dropped by destruction or something like that really dont have any clue

remote swallow
mellow pebble
spare hazel
mellow pebble
shadow night
#

I thougt bukkit was full of events and stuff, but in reality, it just has no events I need

spare hazel
paper trout
rapid garden
spare hazel
shadow night
#

I would bet even mojang doesn't need these events

mellow pebble
#

i made recently plugin in kotlin and yeah it is quite simple th

paper trout
#

but how do i regester it?

shadow night
#

also, I'm not some kind of mage to be converting nms stuff to bukkit and vice versa

remote swallow
paper trout
#

not alot

remote swallow
#

learn more java first

spare hazel
paper trout
#

i do it in my spare time but i'm not a pro at it

#

this is how i learn

#

i play and experement

remote swallow
#

this is kotlin, you wont learn java by doing this

mellow pebble
paper trout
#

and i learn as i go

#

obviously

#

i heard korlin was easier then java

shadow night
remote swallow
#

but it should be getServer().getPluginManager().registerEvents(this, this)

paper trout
#

so i wanted to check it out

remote swallow
#

a lot less people here know it

rapid garden
spare hazel
shadow night
#

it only needs to be able to track the item, that's it

eternal oxide
#

Many java devs have zero interest in kotlin. It's too close to a scripting language than programming.

mellow pebble
shadow night
#

ElgarL, I've been told to ask you about my problem

eternal oxide
#

problem?

mellow pebble
eternal oxide
#

yeah we don;t want simpler

#

we want precise

paper trout
#

hey now it works, but i'm still getting this NoClassDefFoundError :\

shadow night
# eternal oxide problem?

basically, I want to be able to know when a certain item is destructed in any way by the void, cactus, lava or anything at all, but I need to either have an event for when the item is gone or an event for when the item lands on ground and then to track it

rapid garden
shadow night
shadow night
#

I know

eternal oxide
#

you'd do better to think of a different way to handle your item

#

why do you want to track it so accurately?

mellow pebble
# paper trout hey now it works, but i'm still getting this NoClassDefFoundError :\

first of all if you are trying to learn java by coding plugins dont do it dumb way try to do it right way so you dont have to throw your knowledge in trash once you find out it is not prefered to make listeners and commands in the same class which is also main class of the plugin and second of all is to learn basics before even trying to go and learn plugins as it will make it easier for you

echo basalt
#

I remember my homie once made a plugin that was like "item dropped by X, picked up by hopper, landed in a chest opened by Y" and it was a shitshow

shadow night
eternal oxide
#

you would lose track of it if the chunk unloads

shadow night
#

which means it will also work as a chunk loader

eternal oxide
#

you can;t guarantee to track it 100%

#

why not simply prevent it being dropped?

rapid garden
paper trout
#

i'm not learning java for the sake of learning java, i'm learning java to make plugins for my own server
if i could write plugins in python my life would be 100 times easier lol
i have passed a java learning session in the past but over the years i kinda forgot it

eternal oxide
#

I never mentioned performance, I said precision

shadow night
quiet ice
shadow night
#

why do I always come up with the most complicated shit

tribal valve
#

Do I need to use maven to build plugins? Cuz Im using my own build artifact

eternal oxide
#

Workign with Spigot Maven is recomended for building

shadow night
#

mavern

tribal valve
paper trout
#

and like everything in the project is going fine really but i don't know how to get rid of this kotlin/jvm/internal/Intrinsics issue
like is java ment to have that? or is it ment to be imported into the JAR and isn't?

shadow night
dry forum
#
        wc.type(WorldType.FLAT);
        wc.environment(World.Environment.NORMAL);
        wc.generatorSettings("2;0;1;");
        world = wc.createWorld();```

https://pastebin.com/UrDJ93DG why am i getting this error?
paper trout
#

oh lol it's fine

fluid river
#

or it is fixed already

paper trout
#

yah i still have it

fluid river
#

so what exactly is the problem

echo basalt
quaint mantle
fluid river
#

u shadowed stuff

#

your mc version matches target

#

and same for java

paper trout
#

i compile from kotlin and in the compiled code i see this
which links to the NoClassDefFoundError

#

i used maven

fluid river
#

show your pom

#

and joinevent original code

river oracle
#

Maven plus kotlin must be a nightmare

fluid river
#

isn't kotlin meant to be used mostly with gradle

paper trout
#

hasn't been a nightmare for me honistly

river oracle
fluid river
fluid river
#

so it is

fluid river
paper trout
#

give me a second

paper trout
#

the pom

quaint mantle
fluid river
#

wait

paper trout
#

the compiled jar, what other jar would i use?

fluid river
#

isn't mc 1.16 not supporting java 8

paper trout
#

no thats 1.17

#

1.16 still uses java 8-11

quaint mantle
paper trout
fluid river
fluid river
#

there should be default .jar

river oracle
#

I've had the same issue my intellij just dies once a class gets over 200 lines which is a nightmare for my gui items which I usually store in enums

fluid river
#

and jar-with-dependencies.jar

river oracle
#

Mine has been freezing too in larger classes

tall dragon
echo basalt
#

my discord likes to die

#

when I type for long enough

paper trout
#

this is where the output of the jar goes and i only get one jar file

tall dragon
#

just having more ram wont change anything

river oracle
echo basalt
#

I run my intellij with 4gb and it works fine

remote swallow
echo basalt
paper trout
#

why not?

tall dragon
#

yea i got 8gb there

remote swallow
#

that way doesnt build with maven, so you dont shade kotlin

echo basalt
#

likes burning ram but

kind hatch
tall dragon
#

i also have some custom jvm flags that helped for me

-Xmx8048m 
-XX:ParallelGCThreads=4 
-XX:+ParallelRefProcEnabled 
+PerfDisableSharedMem

echo basalt
#

why would you have a file with over 500 lines

#

that's the real problem

kind hatch
#

I've worked on classes with over 2K lines at a time, 2GB is more than enough.

tall dragon
#

Help -> Edit Custom VM Options

echo basalt
#

still no

fluid river
#

with 99 switches

echo basalt
#

the class that parses all my configs and makes invs out of them is 200 lines at most

kind hatch
paper trout
#

so should i delete my artifact information and do this?

vast ledge
quaint mantle
paper trout
#

?

echo basalt
#

get better cpu lol

tall dragon
#

unfortunate :d

river oracle
kind hatch
#

Wtf? I use a 3700X and I have only ever gotten a lag spike once.

echo basalt
#

My ide's perfectly fine on a 5600x with 32gb ram total

vast ledge
river oracle
#

Windows skull

paper trout
#

all i have is base intelIj and Minecraft Dev (and Kotlin obviously)

echo basalt
#

5900x
1080p

quaint mantle
vast ledge
echo basalt
quaint mantle
#

Showing neofetch with windows

vast ledge
#

epic inkr

#

ikr**

vast ledge
echo basalt
#

breaker hasn't tripped in 45 days

river oracle
vast ledge
#

Had to restart my server recently 😦

echo basalt
#

gaming

vast ledge
#

yes

#

fact

#

😄

echo basalt
#

development isn't my life

#

I'm tired of this shit

young knoll
#

Why not

river oracle
quaint mantle
vast ledge
#

its kinda my life

river oracle
echo basalt
#

I've been doing it for 2/3rds of my life

#

gotta take a break eventually

river oracle
karmic mural
echo basalt
#

I do go to the gym

river oracle
paper trout
remote swallow
#

you havent built with maven

vast ledge
river oracle
echo basalt
paper trout
#

i litterally just click Build Project

remote swallow
#

that builds with intellij

vast ledge
remote swallow
#

on the right of your screen opent he maven tab

#

then lifecylces

#

then press package

paper trout
#

well that wasn't obvious they are seperate '3'

vast ledge
#

Im not sure, but we dont get taught vectors in school

#

there so fun tho

karmic mural
echo basalt
#

wakatime

#

I'm one of the 2 clowns that pay for it

vast ledge
#

Imagine paying

karmic mural
#

oh lmao

vast ledge
#

checks price

echo basalt
#

5 bucks a month

#

with student discount

paper trout
#

i just built with maven using the package option from lifecycle

remote swallow
#

use the top one

vast ledge
#

i pay more for my server

echo basalt
#

it's probably my biggest waste of money

vast ledge
#

true

karmic mural
echo basalt
#

so do I

#

but I actually use nitro

vast ledge
#

why

echo basalt
#

it's cool for uhh

#

sending videos at work

vast ledge
#

bruh

young knoll
#

💀

echo basalt
#

I had nitro classic but some idiot had to gift me full nitro on a month when I was broke

#

and nitro basic doesn't let me do the 1440p60 streams I need at work

paper trout
#

WOOOO!!!!!!

#

NO ERROR!!!

vast ledge
#

nice

karmic mural
#

Just twitch stream proprietary code bro /s

echo basalt
vast ledge
#

Btw, talking about not gaming...

karmic mural
#

wait that's not 1440p60fps anyways lol

paper trout
echo basalt
#

oh no blud's got 60 hours on csgo

vast ledge
paper trout
#

it's working

#

that totally didn't take like 2 hours of banging my head before asking lol

vast ledge
echo basalt
#

still salty they haven't replied to my applications

vast ledge
#

Hm

echo basalt
#

apex

vast ledge
#

hm

#

i dont play that

vast ledge
quaint mantle
#

Oh wait, wrong channel lol

vast ledge
karmic mural
#

Should we move this to #general though

echo basalt
#

nah

vast ledge
#

probs

echo basalt
#

this is fine here

vast ledge
#

not

echo basalt
#

it's character development

karmic mural
#

eh ok guess game

vast ledge
#

gets banned

#

apex

#

?

echo basalt
#

nah

vast ledge
#

valo?

echo basalt
#

that's not the apex banner

vast ledge
#

no valo aint on steam

karmic mural
#

Custom banners exist

#

or existed? My PUBG banner has been nuked

quaint mantle
echo basalt
#

prolly gmod or some degen game

echo basalt
karmic mural
echo basalt
#

yeah I was correct

karmic mural
#

lmfao yes

#

Most played game after Minecraft

vast ledge
echo basalt
#

I used to play minecraft a lot more when I was a kid

karmic mural
#

Wish I could know, cause I have played a lot of Minecraft

echo basalt
#

then I started making plugins

#

and now I despise opening the game

karmic mural
karmic mural
vast ledge
#

the torturing thoughts of what youve done and the pain you experienced while making plugins

echo basalt
#

people at school just used to be like

vast ledge
#

PacketPlayOut

echo basalt
#

"yo illusion help me solve this argument"

#

"can you use a hoe to melt items on a furnace"

vast ledge
#

<wa

#

yes

echo basalt
#

only if it's a wooden hoe

vast ledge
#

ye

#

it burns for 10 ticks

#

i think

#

not ticks

echo basalt
#

yet no one cares about how fucked the scaffolding block is

echo basalt
#

and how it recalculates its entire structure on any scaffold's block update

vast ledge
#

why does it burn for 60s

echo basalt
#

you can place a block next to a scaffold and the entire structure re-calcs its integrity

vast ledge
#

and string doesnt even burn

karmic mural
#

stop it you're scaring me

#

LOOK AT BUG

vast ledge
#

thats nothing

echo basalt
#

oh no p_

young knoll
#

I had to figure out why my custom block was being destroyed by water earlier

karmic mural
#

oh, I know. I just wanted to distract lol

echo basalt
#

nowadays I just do whatever

young knoll
#

Turns out any block with noCollision in its properties gets destroyed by water

echo basalt
#

make minigames or something

vast ledge
#

you havent experience the pain, the agony the FUCKING WILL TO SLEF DESTRUCT, WHEN YOU CAN DISABLE MONGO LOGGER ON STARTUP EVEN THO YOU SPENT 5 HOURS TRYING

echo basalt
#

how the fuck do you disable the mongo logger

vast ledge
#

Cnat*

karmic mural
#

But why do I get a Null exception WHEN I LITERALLY CHECK FOR NULL RIGHT BEFORE

vast ledge
#

IDK

#

I GAVE UP

echo basalt
#

it does everything but fire exceptions

vast ledge
#

Hey, oh yea today were gna send ur password, the connection uri everything in the console

#

But no

#

were not sending that one important exception

young knoll
#

I did manage to disable it once

echo basalt
#

mongo in a nutshell

vast ledge
#

TELL US THE SECRET

young knoll
#

Uhh

#

Let me see if I can find it

vast ledge
#

Even ChatGPT couldnt disable it

quaint mantle
echo basalt
quaint mantle
#

this way you can read/write to mongo without importing the mongo library at all

quaint mantle
vast ledge
quaint mantle
vast ledge
echo basalt
#

yeah I'm not a fan of that guide

quaint mantle
echo basalt
vast ledge
#

IT DOESNT WORK

#

I TRIED

vast ledge
#

EVERYTHING

#

I SOLD MY SOUL TO THE DEVIL

#

HE COULDNT HELP ME

quaint mantle
#

or you could decompile the mongo lib, edit it and recompile it so it doesnt log

karmic mural
#

💀

echo basalt
#

pov: hypixel

young knoll
#

I think the only thing I did was use an old driver version

#

💀

vast ledge
quaint mantle
#

i hope you are familiar with that unless its heavily obfiscated or sum shit

karmic mural
#

What would be the best way to check if a player is holding an item when PlayerInteractEvent triggers? 'cause I feel like it could be better

#

Currently I just get the main hand and check if the value is null or Air

young knoll
#

The event has a getItem

#

Then just null check it

karmic mural
#

thx

quaint mantle
karmic mural
#

Bro I've started on this plugin 3 times and I keep wanting to restart 💀 It's so dumb I can't seem to get it "right"

chrome beacon
#

You learn something each iteration

#

You wanting to restart shows that you've learned something

karmic mural
#

I think I should just get it fully functioning at this point, though. Dwelling too much over having things perfect will lead to insanity at some point

#

I think I borrowed too much code from the previous version, though. Some methods have proven to be... quite bad.

forest pumice
#

Is there anyway to check if a block was broken before in the on block break event?

vast ledge
#

catch nms packet

river oracle
vast ledge
karmic mural
#

It's all basically working it's just that I'm not satisfied with the code lol

vast ledge
vast ledge
#

is the code not clean?

river oracle
karmic mural
vast ledge
karmic mural
#

PDC

river oracle
vast ledge
river oracle
#

Virtual?

vast ledge
#

if your displaying the amount of items saved in the mass storage

#

why not use the metadata

#

lore**

#

ur updating it anyway

#

so why not

karmic mural
#

It's inconvenient

river oracle
#

Lore is bad PDC is gud

vast ledge
#

it efficient

vast ledge
karmic mural
#

Lore is simply for users sake

young knoll
#

So does lore

river oracle
vast ledge
#

but if you already have lore, why not utilize it?

karmic mural
#

What if I ever want to change the way lore is displayed?

#

Much easier to have it stored in PDC in that case

vast ledge
#

wdym?

river oracle
#

PDC more versatile

#

Easier to retrieve

#

And a better storage format in the underlying nbt

karmic mural
#

Like if I have "Stored: 500"
but then I want the number on a separate line

vast ledge
karmic mural
#

So if a player has an item with the first iteration, how do I then update it safely

#

I have to have a check for that in perpetuity

karmic mural
#

Instead of just changing the display style, and getting data from PDC

river oracle
#

Parsing takes more computing power than a retrieval from memory

vast ledge
#

but if ur already updating the number

#

ur writing

#

to mem

karmic mural
#

I'm updating the meta regardless, what's an extra operation?

#

I get the efficiency perspective, but we're running on GBs not KBs

vast ledge
#

i cant say much about optimization when im currently running a vector calc on every player move even

#

t

karmic mural
#

💀

echo basalt
#

Are you seriously arguing that parsing a stringlist that's visible to the end customer is more efficient than just using an internal data structure?

vast ledge
#

maybe...

young knoll
#

💀

vast ledge
#

I mean, why read once and write twice, when you could just read once and write once

eternal night
#

not to mention that lore has to be parsed from json on every getLore call

vast ledge
#

cries in inefficiency

wide coyote
#

lore is not for you to use or compare at all, its just for display and for the client

#

just use pdc or at least nbt

vast ledge
#

AnYwAyS, anybody wanna see my epic Entity that is def the best ever created?

wide coyote
#

same with the displayname

vast ledge
#

stop speaking in inefficiency, i dont speak that language

young knoll
#

Itemstack PDC type when

chrome beacon
#

?morepdc

undone axleBOT
chrome beacon
#

^ Alex already has a neat lib for that

young knoll
#

Not part of the official api

#

Invalid

#

-2/10

chrome beacon
#

Merge MorePDC with Spigot when

young knoll
#

Ask MD :p

chrome beacon
eternal night
#

promoting arbitrary formats for itemstacks to API sounds five head

vast ledge
#

why use pdc, save it in a binary file

young knoll
#

And then put the file into PDC!

vast ledge
#

Yes

opal juniper
#

or just, stop being lazy and do it yourself :)

vast ledge
#

?

opal juniper
#

write complete ItemStack -> YAML converter with all tags

young knoll
#

That already exists

vast ledge
#

Wait

#

i have a better idea

young knoll
#

ItemStack is ConfigurationSerializable

chrome beacon
#

Is is

vast ledge
#

Translate it to yaml, translate that to binary, use an encryption key on that, then put it in a pdc

opal juniper
#

i thought it only did some of the shit, mb

chrome beacon
young knoll
#

Ah I thought it used a BukkitObjectOutputStream to turn it into bytes

ionic terrace
#

If I change my config.yml file and then restart the server, my changes are being overriden with the config.yml file that was loaded when the server started. Any ideas why this is happening?

chrome beacon
vast ledge
#

Take alook at my epic code

eternal night
chrome beacon
young knoll
#

Iirc paper has a different method

vast ledge
#

did i just see the word starting with p and ends with r

karmic mural
#

Dawg I stepped away for a few minutes, what happened 💀

vast ledge
#

notin

river oracle
#

It's spigot let's do it uwu

#

I like Alex's library though if it were to be merged with spigot we'd need to cut stuff out

young knoll
#

New spigot license

#

Any change you make in a fork you must propose as a PR

#

Or else you die

river oracle
#

Lol

#

Sounds like a horrible license let's do it

#

Whose hiring the mercenaries

vast ledge
#

Vectors are actually quite interesting

#

i like them

potent ibex
#
PacketPlayOutEntityStatus packet = new PacketPlayOutEntityStatus(
                        ((CraftPlayer) player).getHandle(), (byte) 35 
                );

is this method deprecated in spigot and paper api for 1.20.1?

vast ledge
#

BLYAT

potent ibex
#

seems doesn't work anymore

vast ledge
#

No paper

#

here

potent ibex
#

I mean same in spigot

eternal night
#

what do you mean "is this internal logic deprecated" kekw

#

it isn't even exposed

potent ibex
#

oh

#

k

eternal night
#

like, you need NMS access for that

#

it isn't API

potent ibex
#

oh okay then what should I add for NMS?

eternal night
#

?nms

vast ledge
#

build tools

#

or just use the link provided

potent ibex
#

is there gradle version for this?

vast ledge
#

no

#

buildtools

potent ibex
#

so only maven does work

vast ledge
#

NO

eternal night
#

you can use paperweight-userdev for gradle

vast ledge
#

BUILDTOOLS

eternal night
#

but that gets you all of paper

vast ledge
#

You build it with build tools

#

and import it with maven/gradle

eternal night
#

wtf are you talking about

#

you need reobfuscation

vast ledge
#

?

young knoll
#

Follow the guide

eternal night
#

^

#

just follow the guide yea

vast ledge
#

have i been doing it wrong my entire life

young knoll
#

It’ll have you run buildtools to get remapped jars and set up the maven special source plugin

ivory sleet
#

but kotlin compiles to jvm compatible bytecode

#

so does java

rapid garden
ivory sleet
#

no

#

kotlin interoperate java code

#

but no

#

they're syntactically different

#

if kotlin were a superset of java, it'd mean valid java code is valid kotlin code

#

which is not the case

rapid garden
#

Oh, I thought that was the case

ivory sleet
#

ye it isn't, keyword, they compile to the same type of bytecode

rapid garden
#

Like some Python libraries that let you write C code

ivory sleet
#

i dont think C is a superset of Py tho

#

like, a good example is perhaps json and yaml

#

yaml is a superset of json since valid json is valid yaml

rapid garden
#

Damn, I had it confused

#

Thanks for the clarification

ivory sleet
#

Yea no worries (:

echo basalt
#

grr just wasted the past hour debugging 1 line

#

spot the difference

unborn sable
echo basalt
#

definitely not the event handlers not cleaning up

unborn sable
#

Yea

echo basalt
#

which was breaking my "WaitForPlayersPhase" as it still had a stray listener that was breaking things

#

and I thought I had duplicate games

earnest fiber
#

Is there a way to store server-wide data in a Persistent Data Container, or is it better to just put it in a file? The closest thing I could find is World#getPersistentDataContainer(), but I'd rather it not be tied to a world

echo basalt
#

yeah you should just use a file

potent ibex
#

Okay so I did manage to send packet using protocol

#

but now it's just complicated to send other custom item instead of totem when player revives

tender shard
#

with my PersistentDataSerializer you can turn any PDC into json and vice versa

#

so yeah you could just save it to a file

#

the resulting json is also human readable and not some gibberish

quaint mantle
dry forum
#

whats the best way to make a mob walk along a certain block (wtith turns)

summer scroll
#

Is there in any way to disable bed night skipping? Like disable x/x players sleeping on right clicking bed.

pseudo hazel
#

just set the percentage to 100

#

its a gamerule

timber crescent
#

how can i make a froghead with skullmeta?

pseudo hazel
#

find a skin/player for it

#

and then its like any other skull

timber crescent
pseudo hazel
#

yes

#

idk how it works exactly, I just meant that its the same process for any other head presumably

timber crescent
#

this the give command im usin n every attempt i try to get it working in spigot api it dont work
give artcel skull 1 3 {display:{Name:"Frog"},SkullOwner:{Id:"6e0e69d8-ac58-40a1-baf8-68de9d85cff8",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDJjM2I5OGFkYTE5OTU3ZjhkODNhN2Q0MmZhZjgxYTI5MGZhZTdkMDhkYmY2YzFmODk5MmExYWRhNDRiMzEifX19"}]}}}

echo basalt
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

quaint mantle
#

If I make mutliple calls to persistantDataContainer.set

can I set the item meta after all of them or do I need to set them after each call?

placid moss
#

you can set after all of them

quaint mantle
#

how do I convert a component to a string

empty comet
#

Kinda going nuts over this one, i'm trying to do a daily bank interest system, but i'm stuck on how to check IF the player has reseted or not :/

#

I currently have the last reset time(code), the last connection of the player in time(code), the current time(code) of course

#
  LocalDateTime lastresetplusone = lastreset.plusDays(1);
  LocalDateTime current = LocalDateTime.now(ZoneId.of("America/New_York"));
  LocalDateTime lastconnection = ConvertStringTime(data.get(new NamespacedKey(plugin, "lastconnect"), PersistentDataType.STRING));
#

i think my problem is that the reset happen at 12pm, so i can't just check if the day has passed, i need to check everything, down to the minute/hour

quaint mantle
#

java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R1.inventory.CraftMetaFirework cannot be cast to class org.bukkit.inventory.meta.FireworkEffectMeta (org.bukkit.craftbukkit.v1_20_R1.inventory.CraftMetaFirework and org.bukkit.inventory.meta.FireworkEffectMeta are in unnamed module of loader java.net.URLClassLoader @27fa135a)

How is this possible?

lost schooner
#

So if I am doing Player.getInventory() how do I duplicate the inventory/save it for later so the data doesn't change out from under me when the player's inventory changes?

#

I tried making a new PlayerInventory and then realized it was an interface

#

It's been such a long time since I've used Java tbh

quaint mantle
#

yeah

lost schooner
#

How do I bind that to a variable and then restore it after?