#help-development

1 messages Β· Page 835 of 1

echo basalt
#

I've seen upwards of 1ms for each call

waxen plinth
#

I'll make sure to avoid that then

echo basalt
#

Player#getLocation returns a new location

#

Location#getBlock returns a new block

waxen plinth
#

ok that makes sense

lost matrix
#

More than one usage means im creating a new variable.
I dont make exceptions there.

echo basalt
#

I just assign all variables at the top and re-use them whenever

waxen plinth
#

one of the worst things about java is that heap allocations are a byproduct of virtually all meaningful work

ivory sleet
waxen plinth
#

it's so gross

echo basalt
#

So that if I want to use it again I don't need to refactor

waxen plinth
#

Location should 100% be a value type

#

same with Block

echo basalt
#

go write RustySpigot

waxen plinth
#

πŸ₯²

#

someone's already doing it

echo basalt
#

call it Plumber or something

lost matrix
#

Faucet

waxen plinth
#

did you see that imlucid denied evolution

#

isn't it funny we worked for that guy

#

and took it seriously

#

πŸ’€

echo basalt
#

Well

#

Bro got depresso and canceled the entire project

#

I don't think I've been paid for it more than once

#

I did sell some minigames

#

for $$$

waxen plinth
#

damn

echo basalt
#

made a couple grand on top of the couple grand I was paid to write them

waxen plinth
#

I had a few preexisting minigames I wanted to sell and put into use somehow but they were old and riddled with issues

echo basalt
#

get gud

#

but yeah I never took it 100% seriously

#

The pay was also subpar

waxen plinth
#

mm

#

I don't remember what I got paid but I think I settled for less because I was excited to work on a minigame core

remote swallow
waxen plinth
#

and then quickly became unable to work on it because of mental health

echo basalt
#

could've done your research :)

#

I based my entire core around minikloon's state system

#

think yours was just a bunch of kit logic

waxen plinth
#

I mean sure but what they paid is reflected in what they got

echo basalt
#

we had to scrap most of it

#

and the entire project lmao

waxen plinth
#

I don't doubt it

echo basalt
#

it might still come out of the dead

waxen plinth
#

I wish they'd had me write a minigame alongside it instead of the core first

#

whenever I try to build an abstraction in a vacuum it ends up not working very well

#

I need to adapt it alongside an implementation of its use case, and this has proven itself time and time again

echo basalt
#

I'm working on some minigame infrastructure stuff rn, might resell it to him

waxen plinth
#

he's trying again?

echo basalt
#

well no

#

But I did tell him about the idea a few months ago and he was super interested in buying it

#

and told me that the project might be restarted in ~6-8 months

#

well it's been 6 months

waxen plinth
#

nice

#

hope you get in touch with him and make bank off the loser

#

you might be able to find a better buyer though

echo basalt
#

I'm not doing exclusive reselling I'll prob resell my stuff like 5-6 times

waxen plinth
#

if I were to make a really good core I'd probably just open source it

echo basalt
#

I'm not just making a minigame core

orchid trout
#

like this?

echo basalt
#

that's the least of my concerns

echo basalt
waxen plinth
#

I would want to abstract every part of minigame development

quaint mantle
#

lol

waxen plinth
#

in order to get a feel for it I'd probably want to write a few minigames first, then start building abstractions around it and retrofit them into the existing games, and slowly build higher and higher level abstractions to target problematic areas that have a lot of boilerplate

quaint mantle
#

yo so uh

echo basalt
#

going to be writing the entire infrastructure and sell it as a package

quaint mantle
#

boxbeam i tried to abstract my plugin into like

waxen plinth
#

oh hi good timing

quaint mantle
#

a bunch of configs and stuff and it just seems rly unneccessary

lost matrix
orchid trout
echo basalt
orchid trout
#

ijm actually supid

#

wthank you

waxen plinth
#

so you're trying to make the full package, front to back

echo basalt
#

Yep

waxen plinth
#

could spawn a lot of minigame servers

quaint mantle
echo basalt
#

And a solid minigame core that lets me make a minigame in like a day

waxen plinth
#

I'd be very interested to see how that plays out

echo basalt
#

wtf am I saying with a week it takes like 2 hours rn

waxen plinth
#

lol

echo basalt
#

Worst case scenario I just spin up my own bootleg network

#

And try to fit 800 people in a single dedi

waxen plinth
#

hmu if you do set that up

#

I'd be interested in trying to write a minigame in your framework and making something for your server

echo basalt
#

gotta rewrite half of it but I'll make it work out

waxen plinth
lost matrix
# orchid trout like this?

Btw you should probably reduce your nesting my refactoring the codeblock into a method and referencing it with

CompletableFuture<Profile> future = CompletableFuture.supplyAsync(() -> loadProfile(discordId));

It gives your anonymous method an actual name and makes it more readable by adding secondary information.

echo basalt
#

I also gotta work on my skyblock core :p it'd allow me to do player housing n stuff

waxen plinth
#

you're not showing us any code or getting specific

quaint mantle
#

nothing

#

i just kept it the way it is

#

cause it works

#

lol

waxen plinth
#

but you said you abstracted it and made it very config based

quaint mantle
#

oh I tried but it just seems so like dumb lol

orchid trout
waxen plinth
#

ok so do you want to tell us what you tried?

#

like how were you implementing it

quaint mantle
#

ill need a config for every item, and descriptions for every item, then ill need a config for the character the item belongs to

waxen plinth
#

and what was the code for that looking like

#

lots of manual save and load calls?

lost matrix
quaint mantle
#

no

#

so

#

I made a dc bot and I had this config system where it's very easy to get configs Repository#getConfig(Class) kinda like that and it's easy to register them too

lost matrix
echo basalt
#

All fun and games until you have multiple copies of the same config for different stuff

#

For example, map files

orchid trout
#

it makes it harder to read code form e

echo basalt
#

I really hate nasty code

#

brb putting chicken in the air fryer

waxen plinth
lost matrix
# orchid trout it makes it harder to read code form e

That is counter intuitive. If your methods have proper names, then you can read your code like a book.
You should be able to inferr what your method does by its name, making you read one word instead of 30 lines and having the same understanding of your code.

quaint mantle
#
public interface ConfigService {

    void loadAndRegister(@NotNull Object config) throws IOException;

    <T> @NotNull T get(@NotNull Class<T> configClass);

    @NotNull List<@NotNull Object> getRegistered();

    void save(@NotNull Class<?> configClass) throws IOException;

    boolean isSaved(Class<?> configClass) throws IOException;
    
    boolean isRegistered(Class<?> configClass);

}

I used generics dw but this was what i copied

waxen plinth
#

ok, so is it using reflection to load config values or something?

quaint mantle
#

gson

waxen plinth
#

gotcha

#

seems pretty good

orchid trout
quaint mantle
#

bruh

#

i cant post imgs

waxen plinth
#

gotta verify

quaint mantle
#

iok here

orchid trout
#

?verify

lost matrix
quaint mantle
#

yeah my old acc

#

gone

remote swallow
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

quaint mantle
#

and i aint doing allat to msg staff to change my dc

#
@Config(name = "StartUpConfig")
public class StartUpConfig {

    @Mandatory
    private final String token;
    private final String motd;

    public StartUpConfig(String token, @Nullable String motd) {
        this.token = token;
        this.motd = motd;
    }

    @NotNull
    public String getToken() {
        return this.token;
    }

    public Optional<String> getMOTD() {
        return Optional.ofNullable(this.motd);
    }

}
remote swallow
#

just email md

#

takes a few min

quaint mantle
#

and here's an example

waxen plinth
#

yeah that looks really nice

quaint mantle
#

thanks

orchid trout
waxen plinth
#

similar to my own config system

#

but using gson

orchid trout
#

that returns completablefuture

quaint mantle
#

then I would do this: configService.loadAndRegister(new StartUpConfig(null, null));

#

now that I think abt it

echo basalt
quaint mantle
#

I might remove the constructor parameters

waxen plinth
#

yeah

quaint mantle
#

but

waxen plinth
#

then you could set defaults in the class

quaint mantle
#

ye

lost matrix
waxen plinth
#

that's what I was gonna suggest

quaint mantle
#

but now think about this for a bunch of items

#

like hundreds lol

waxen plinth
#

yeah

#

I mean do you not have a way of storing them in a generalizable form

quaint mantle
#

store what

waxen plinth
#

like a base custom item class that stores all the regular properties

quaint mantle
#

no lol

waxen plinth
#

and some optional meta which can be a subclass attached to it only for items that need more special properties

#

so every item has special properties like that?

quaint mantle
#

this is what a custom character is lookin like rn

waxen plinth
#

in that case, a class per item sounds pretty standard - the only real alternative would be to pass around lambdas for any overridable functionality

quaint mantle
#
public class KnightCharacter extends CustomCharacter {

    public KnightCharacter() {
        super(
                new CustomCharacterInformation.Builder()
                        .setVerse(CharacterVerse.CLASSIC)
                        .setReferenceName("classic_knight")
                        .setDisplayName("Classic Knight")
                        .build(),
                new CustomArmorEquipment.Builder()
                        .setHelmet(() -> new CustomItemBuilder(Material.IRON_HELMET, "classic_knight_helmet")
                                .setName("<gray>Knight's Helmet")
                                .setLore("<gray>Just a good old knight's helmet.")
                                .build())
                        .setChestplate(() -> new CustomItemBuilder(Material.IRON_CHESTPLATE, "classic_knight_chestplate")
                                .setName("<gray>Knight's ChestPlate")
                                .build())
                        .setLeggings(() -> new CustomItemBuilder(Material.IRON_LEGGINGS, "classic_knight_leggings")
                                .setName("<gray>Knight's Leggings")
                                .build())
                        .setBoots(() -> new CustomItemBuilder(Material.IRON_BOOTS, "classic_knight_boots")
                                .setName("<gray>Knight's Boots")
                                .build())
                        .build(),
                List.of(
                        () -> new CustomItemBuilder(Material.IRON_SWORD, "classic_knight_sword")
                                .setName("<gray>Knight's Sword")
                                .setLore("<gray>This sword could have some history",
                                        "<gray>behind it.")
                                .build()
                )
        );
    }
}```
waxen plinth
#

hmm

#

at that point I feel like it's better to be able to load that from config or something

#

then you could write it out in a much more concise format

#

and define any special behavior separately in the code

quaint mantle
#

lol

waxen plinth
#

like you could imagine it looking like this in config

quaint mantle
#

the thing is tho

#

I dont want characters and custom items to be coupled

echo basalt
#

None of this needs to be set in code

#

You can make a parser and read all of these values from a config

waxen plinth
#
characters:
  Knight:
    verse: CLASSIC
    referenceName: "classic_knight"
    display_name: "Classic Knight"
    helmet: ...```
#

^

lost matrix
# orchid trout

I think this looks better. Why is your method package-private?

orchid trout
#

i have my database in my manager class

#

its public in manager class

#

super epic not confusing

waxen plinth
lost matrix
orchid trout
#

so i dont have to have instance of manager and database when i need them

waxen plinth
#

and then you could make a wrapper class that is passed the config and can specify any additional behavior

#

if there is no additional behavior it can just be the base class like Character or something

#

make a registry that stores them by their reference name in a Map<String, Character> and you're set

quaint mantle
#

Uh

#

so I don't use my old config system?

waxen plinth
#

well it looks like you weren't loading these with the old config system

quaint mantle
#

Wdym wasnt

waxen plinth
#

you're using a builder

quaint mantle
#

Oh I meant the one using gson

waxen plinth
#

that could work

waxen plinth
#

if not, I have a config library which can

quaint mantle
#

Well

#

I choose json cause snake yaml or whatever it's called looks kinda weird to use

#

And json looks fine with the pretty printint

waxen plinth
#

probably annoying to configure by hand though

waxen plinth
#

you just define your data and it will serialize and deserialize it automatically

quaint mantle
#

Lmao

#

What doesn't red lib have πŸ’€

waxen plinth
#

exactly

#

I wouldn't use its command manager though

#

Ordinate is much better

quaint mantle
#

ok so

#

well

#

when I end up having my configs

#

Do I pass in a ConfigurationSection, or a concrete class

#

like KnightBootsConfig

remote swallow
#

for red lib?

waxen plinth
#

concrete class

#

the point of the deserialized object is to abstract away the config layer

#

and provide the data directly

quaint mantle
#

So...

#

A config for each item basically

remote swallow
#

sounds a bit pointless

#

you can have 1 config for all of it

waxen plinth
#

again, there's no way you're getting overridden behavior per item unless you have a class per item or pass around lambdas to define that behavior

#

or somehow make all of that behavior expressible through config

river oracle
waxen plinth
#

I'm literally saying you don't have an additional config for each item

#

each item can be deserialized into a common config class storing all of the base metadata

#

and then you can attach additional behavior if you want to by either wrapping it in a class that defines that behavior or passing around lambdas

#

but even if you do define that additional behavior, you're not redeclaring the config logic, you're just reading the config data from variables

ivory sleet
#

We just love those bean and orm libs

#

:^)

waxen plinth
#

serialization has always been the source of way too much boilerplate

#

gotta get rid of it somehow

ivory sleet
#

Yeah true, there is that aspect to not neglect

waxen plinth
#

one of my favorite things about rust is that you can just slap a #[derive(Serialize, Deserialize)] on any type and basically be able to convert it to any serialization format

#

json, toml, yaml, xml, I think it might even work for sql

#

raw bytes

ivory sleet
#

Oh yeah, but rust is just a chad language in general lol

waxen plinth
#

fr

echo basalt
#

bro came back from the dead just to shit on java

quaint mantle
#

That was the original plan

ivory sleet
#

Maybe do it similarly to how mc does it, I mean that has its disadvantages also, but yeah just an idea

cyan void
#

i got this code but it dosent tdo the breaking when its netherite i know its not because of the config because all the others work:


import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDamageAbortEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitTask;
import uk.co.agwoo.zelrpg.Functions;
import uk.co.agwoo.zelrpg.ZelRPG;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

public class BlockDamageListener implements Listener {
    private final Set<UUID> damagingPlayers = new HashSet<>();
    public BukkitTask task;
#
    public void onBlockDamage(BlockDamageEvent event) {
        Player player = event.getPlayer();
        ItemStack heldItem = player.getInventory().getItemInMainHand();
        FileConfiguration config = ZelRPG.config;

        if (Functions.isPickaxe(heldItem.getType())) {

            int delay;
            if (heldItem.getType().equals(Material.WOODEN_PICKAXE)) {
                delay = config.getInt("timings.tools.pickaxes.wooden");
            } else if (heldItem.getType().equals(Material.STONE_PICKAXE)){
                delay = config.getInt("timings.tools.pickaxes.stone");
            } else if (heldItem.getType().equals(Material.IRON_PICKAXE)){
                delay = config.getInt("timings.tools.pickaxes.iron");
            } else if (heldItem.getType().equals(Material.GOLDEN_PICKAXE)){
                delay = config.getInt("timings.tools.pickaxes.golden");
            } else if (heldItem.getType().equals(Material.DIAMOND_PICKAXE)){
                delay = config.getInt("timings.tools.pickaxes.diamond");
            } else if (heldItem.getType().equals(Material.NETHERITE_PICKAXE)){
                delay = config.getInt("timings.tools.pickaxes.netherite");
            }

            else {
                delay = config.getInt("timings.tools.pickaxes.wooden");
            }

            player.sendMessage(heldItem.getType() + "");

            damagingPlayers.add(player.getUniqueId());

            task = Bukkit.getScheduler().runTaskLater(ZelRPG.getInstance(), () -> {
                if (damagingPlayers.contains(player.getUniqueId())) {
                    event.getBlock().breakNaturally();
                }
                damagingPlayers.remove(player.getUniqueId());
            }, delay);
        }
    }

#
    public void onBlockDamageAbort(BlockDamageAbortEvent event) {
        Player player = event.getPlayer();

        damagingPlayers.remove(player.getUniqueId());
        if (task != null) {
            task.cancel();
        }
    }
}```
ivory sleet
#

Ehm

#

Every time the event is called, u just store the a new bukkit task

#

Is that intended? I mean you basically forget about the older ones

ivory sleet
#

I pretty much meant how they structured their design after items, materials etc

quaint mantle
#

Yeah how

waxen plinth
#

one class per

ivory sleet
#

I mean they have some sort of type inheritance such that there is a base/universal type all item subtypes derive

#

But yea

minor junco
#

Damn whats this if else clause hell I'm witnessing

quaint mantle
ivory sleet
#

I mean, not sure every item does need its own class

#

But maybe a subset of items do shrug

quaint mantle
#

why not I be consistent with it

ivory sleet
#

I mean sure, but on the other hand, dont overdo it and keep it simple

#

look at mc’s source

#

They keep their code open for extension

quaint mantle
#

maybe I should make a core for this and have extension plugins

ivory sleet
#

that is, you’ll see some materials with custom classes, and some materials just represented with the base material class

#

Or well they call materials for items but you get the point :)

quaint mantle
ivory sleet
#

If you want

inner mulch
#

can someone explain why tf sometimes == or .equals() have different results?

if you dont want to explain just ignore it dont throw lernjavas at me pls

ivory sleet
#

okay here is the rule basically

#

if A.equals(B) is true
then A == B should always be true
the converse is not necessarily true

A.equals(B) may be true even though A == B is false, this implies that there might be cases where different objects C and D are not the same (C != D) but their data/content is the same so C.equals(D) still holds true

ivory sleet
#

yeah

#

For instance if you do something like
A = new String("test".toCharArray());
B = new String("test".toCharArray());
then A != B is true or equivalently A == B is false

yet A.equals(B) is true

inner mulch
#

okay, yeah thats kinda confusing, i guess i need to adapt to .equals()

proud badge
#

Whats the best way to make a multipaged chat answer?

ivory sleet
#

equals() basically tests if two objects contain the same data

#

And if the two objects are the same object, then ofc the data will be the same

inner mulch
#

ok

proud badge
#

Coreprotects lookup feature has multiple pages of information.

#

I have a similar query feature for my plugin

#

Well in the works

ivory sleet
#

do u have an image or sth of how it looks? :>

proud badge
#

Whats the best way to store the information so the player can run the command to go to the next page?

proud badge
#

oh image wait

#

1 sec let me boot up my test server

proud badge
ivory sleet
#

I think you keep the pages absolute

#

And in the command you just provide the TUI if needed

#

(Like a next/previous/jump to, buttons)

#

Else ned, to calculate lines and pages etc, modulo usually works great :)

quaint mantle
#

is it ok if I override java's classes

#

like

#

I rename something to Character

ivory sleet
#

What exactly is that class doing

#

I can prov cook up a better name for u

proud badge
#

I think ill make like a /query fromindex command, for example if it goes 20-13, I’ll use a text component that does /query fromindex 12 (cause 12 is 1 less than 13) and it will go from there

quaint mantle
#

CCharacter?

ivory sleet
#

Maybe sth like Symbol, Letter, Digit etc

#

instead

quaint mantle
#

what

#

no

ivory sleet
#

Name for the class

quaint mantle
#

like character as in person

ivory sleet
#

Oh

#

User maybe?

#

Profile perhaps?

quaint mantle
#

nah that's kinda misleading

#

my server name is CharacterWar

ivory sleet
#

yeah, but code wise the names can be different yk

#

And then when u display it to the end user, translate it back

quaint mantle
#

bruh

#

user sounds like a user tho

#

it's like

#

someone that

#

idk how to explain

proud badge
#

Variable/object names dont really matter in java if youre the only developer

#

And you can understand what you meant

ivory sleet
#

I mean it’s convenient not to use the names of classes that already exist in the java std library

quaint mantle
#

do u think a "Person" is a good class name πŸ’€

ivory sleet
#

Sounds fine

quaint mantle
#

nah im just override character

#

never rly seen the character class being used anyway

hasty oyster
#

Maven CLI Invocation

quaint mantle
#

how can I enforce something like this (getItem()) that the item has a pdc which contains a specific namespacedkey

public interface CustomItemProvider {

    ItemStack getItem();

}
carmine mica
#

to rephrase, you want to enforce that the item returned by getItem has a matching pdc key?

quaint mantle
#

yes

#

or has a pdc key set

carmine mica
#

I mean there isn't a way to do it at compile time, but at runtime, wherever you call getItem, just verify a key has been set

#

you could add the key yourself if you added another method to get the key, and then when you call getItem you add the key yourself

#

but that is more of a structural change

quaint mantle
#

okay

#

ill just add it in the docs

astral pilot
#

does Location#subtract mutates itself?

echo basalt
#

Yes

#

Opinions on an item abstraction API?

public class MyPhone extends CustomItem {

  @Override
  public ClickResult handleClick(Player player, ItemClickContext context) {
    // The context is basically a PlayerInteractEvent wrapper 
    Menu menu = ...;
    menu.open(player);

    return ClickResult.PREVENT_ACTION;
  }

  @Override
  public String getIdentifier() {
    return "phone";
  }
}
#

I could change all the clickresult logic to the ItemClickContext object

#

Or should I do something a bit more picky

#
@Override
public ClickContext getClickContext() {
  return ClickContext.builder()
    .limitTypes(ClickType.LEFT)
    .entityPolicy(EntityPolicy.IGNORE_ENTITY_CLICKS)
    .filter((player, context) -> player.isSneaking()) // shift-left click
    .build();
}
#

Seems like I'm overengineering clicking

floral hedge
#

I made a custom intelligence system for my plugin
the code i use to update it (along with relevant feedback) is this

Score score = Objects.requireNonNull(Objects.requireNonNull(Plugin.getInstance().getServer().getScoreboardManager()).getMainScoreboard().getObjective("Intelligence")).getScore(p.getName());
if(score.getScore() < 1000) {
    score.setScore(score.getScore() + 1);
    Plugin.getInstance().getLogger().info(p.getName() + " damaged " + e.getEntity().getName() + ", gaining 1 Intelligence.  Current intelligence: " + (score.getScore() + 1));
    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Intelligence: " + score.getScore() + "/1000", ChatColor.AQUA.asBungee()));
} else {
    Plugin.getInstance().getLogger().info(p.getName() + " damaged " + e.getEntity().getName() + ", but they are at max Intelligence.  Current intelligence: " + (score.getScore() + 1));
    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Intelligence: " + score.getScore() + "/1000 " + ChatColor.RED + ChatColor.BOLD + "MAX INTELLIGENCE", ChatColor.AQUA.asBungee()));
}```

this worked in version 1.20.1, but upon updating to 1.20.4 it no longer updates the score of the scoreboard, is there any reason as to why this may be?
echo basalt
#

this hurts to read

spark flower
#

hello!
how to disable this inventory sort?

sullen marlin
#

?jira

undone axleBOT
floral summit
#

so, I'm trying to make a Placeholder in my plugin that changes every few minutes. but I don't know how to give it a timer.
basically I have a txt file with a list of things I want it to display and I want it to go to the next line of the file every like 5 minutes but I dont know how to setup a timer for it.
any help is appreciated!
please ping me when u respond!

floral summit
#

I think it might just be what I wanted. thanks!!

icy beacon
#

Is it possible to disable this auto-condensing in intellij?

#

I want it to look like this

remote swallow
#

At the top of the project files theres three dots clicl that go into the tree appearance and disable compact middle packages

icy beacon
#

Ooooooooooo

#

Thanks πŸ™‚

twin venture
#

hi why this keep giving me null?

#

this one exactly :

#

also the cosmetic data is there in the mongodb :

#

the players is also in the mongodb :

worn yew
#

does anybody know how to invert world edit selection i want to make only some chunks/areas are avaibale other block/chunk will be deleted

cyan void
quaint mantle
#

I have:

Map<String, Object> serializedMap = itemStack.serialize();
String itemStackString = String.valueOf(serializedMap);

and i saved the string somewhere. Now i want to get "serializedMap" back, how would i do it?

quaint mantle
worn yew
quaint mantle
#

itemStackString returned {v=3578, type=DIAMOND_SWORD, meta=UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"Teast@Teast"}, enchants={FIRE_ASPECT=2}}} so i think it works?

lost matrix
#

What is your original plan?

quaint mantle
#

to save the itemstack as a string

#

and vise versa

chrome beacon
#

Save where and why

lost matrix
#

What data object does this String get written in?

cyan void
dry hazel
quaint mantle
#

not a yml file tho

lost matrix
lost matrix
quaint mantle
worn yew
lost matrix
worn yew
#

any way can you help me with world edit tho

clever lantern
#

any guides to testing plugins? idk what to use, mockito or mock bukkit, maybe both idk ?

shadow night
twin venture
quaint mantle
twin venture
chrome beacon
worn yew
quaint mantle
lost matrix
twin venture
#

this is null for some reason :

lost matrix
quaint mantle
# lost matrix Why not just use yml for this?

0.0;0.0;0.0@minecraft:chest[facing=north,type=single,waterlogged=false]@13@SPLITINDEX@{v=3578, type=DIAMOND_SWORD, meta=UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"Teast@Teast"}, enchants={FIRE_ASPECT=2}}}

#

this is how it looks like full

#

yes i know its bad

lost matrix
quaint mantle
#

i can just use getItemStack with yml

lost matrix
#

Right, so then what is your argument for txt

twin venture
quaint mantle
lost matrix
#

Why not use a raw binary file then?

quaint mantle
chrome beacon
quaint mantle
#

the files it generates should be used in plugin resource

chrome beacon
#

You can disable filtering

lost matrix
#

What are you trying to filter?
I sure hope you wont filter files by their content, because that can get horribly slow, really fast.

quaint mantle
#

its not mine

lost matrix
#

Ah you can exclude bin files from being filtered

quaint mantle
#

but ye i could do exclude but do it for every file?

#

wait i could just exclude a custom extension

#

thanks

dry hazel
#

wildcards exist yea

twin venture
lost matrix
#

Yeah just create your own .utter_rubbish extension and let it not being filtered.

shadow night
#

utter rubbish

chrome beacon
#

.bin

lost matrix
quartz dove
#

Hey all my name is Shiv im a beginner dev. Im trying to make a building minigame based on random prompts that are stored in the config file. So far the command "/prompt get" works well where a book is given to the player with a random string in the page from the config. What i need help with is adding and removing these promts from the config file with the commands /prompt add <msg> and /prompt rem <msg>

eternal oxide
#

?configs

undone axleBOT
eternal oxide
#

just alter what you want in the config and call saveConfig()

worn yew
shadow night
#

If I remember correctly, yaml can do stuff like

map:
  - key: value
``` right?
quaint mantle
#

not just the string

eternal oxide
shadow night
#

Hmm

#

just

map:
  key: value
```?
eternal oxide
#

yep

shadow night
#

And that map element can be gotten as a HashMap, right?

eternal oxide
#

yes

#

get("map")

#

well that returns a ConfigurationSection but call getValues() on it to get the backing Map

shadow night
#

Nice

twin venture
#

the data is already in the databse for both the cosmeticWrapper and the player data ..

#

but it send null when i try to get the Cosetmic object

#

why i use Wrapper , cuz gson don't support abstract class serliztion

lost matrix
twin venture
#

and i tried to do it without the transient keyword , and with

twin venture
#

i tried , it doesn't

#

it send me a really long gson errors

#

this is where i create the CosmeticWrapper :

#

and i use it here :

#

this is only in lobby , cuz i don't want the file creation of the glass comsetic in all servers , that will be so redundent

#

only in lobby , and after that it will load it to mongodb, and from there other servers can get it from mongodb

lost matrix
#
  1. Show me where you create your mongo collection.
  2. Print out what document.toJson() looks like.
twin venture
#

last pic is onEnable

#

in Lobby

lost matrix
#

Show me where you create your mongo collection.

twin venture
#

it works i mean the mongo , connect no problem

lost matrix
#

Ok, then print out what your document.toJson() returns.

twin venture
#

alright 1 moment..

#

some values are null weird??

cyan void
#

they can probaly help u better

twin venture
#

yeah it still giving me null ..

faint aspen
#

what is null? document?

#

or the result of toJson?

twin venture
#

the cosetmic it self..

fair crest
#

hey

twin venture
#

this one

faint aspen
#

yeah bc its transient

fair crest
#

Hey guys, how do i make a loaded crossbow?

#

using Java

twin venture
shadow night
#

What does transient even do

quiet ice
shadow night
#

Ah

twin venture
quiet ice
#

Why did you even apply transient here?

faint aspen
#

this GSON instance how did you create it, did you provide any configuration via the builder to create the instance?

#

Does it work now for some reason?

twin venture
brisk estuary
#

Hey, I have a plugin already in production and I want to include a new feature, which will be basically a NPC with a RightClickEvent. The two options I think I have is using the Citizens API or using pure nms. The thing is that I don't want to force the servers that are already using my plugin to download Citizens, so I guess the best option would be using pure NMS. It's a 1.19+ plugin, so apparently nms packages names do not include the version, so I don't know how it would work having different nms dependencies in the same project if they have packages with the same name. Also, my maven project is not a multi module one. Does anybody know how I should proceed in this case? (I have just started with nms)

twin venture
#

this si the gson builder i have

faint aspen
twin venture
#

should be

faint aspen
#

so you dont know?^^

twin venture
faint aspen
#

maybe log or inspect the json (for the cosmetic) which you give gson

#

Could be something wrong with the encoding of the text maybe

twin venture
#

Gonna check it out

fair crest
#

Yo guys. how do i make it so it gives a player a loaded crossbow

faint aspen
#

what do you mean by loaded?

#

ahh sorry

#

I read "bow" for crossbow it makes sense xD

quiet ice
#

So getItemMeta of your item, cast it to CrossbowMeta, invoke said method on it and use setItemMeta on that itemstack again.

short raptor
#

Can BlockPlaceEvent ever be triggered by enderman placing a block?

#

In which case I assume event.getPlayer would be null

shadow night
#

That's a very interesting case

faint aspen
#

Called when a block is placed by a player. says the docu so I guess only player can trigger this

short raptor
#

Yeah I think so. getPlayer is also marked as nonnull

#

So there couldn't be any case where it doesn't give a player

quiet ice
#

Paper defines the player as @NotNull in the constructor, so yeah

#

Though it is a good question what event will be called for this - EntityBlockFormEvent comes to mind, but that is unlikely to be the case

#

Well there is EntityChangeBlockEvent, that is probably the one being used

magic raptor
#

Guys I have a very weird issues, what are the causes for Bungeecord to return false to a ping request using the api? Even if the server is online (for sure, it's not timeout).

#

The ping api is really weird tbh, functions 1 time on 100

sterile sapphire
#

When your in a project and the wrighting is red how do u import the class?

hazy parrot
#

Hover over and alt+enter

#

Assuming ij

quiet ice
#

Ctrl + Shift + O in Eclipse

sterile sapphire
quiet ice
#

It's CommandSender

#

Notice the difference in casing

sterile sapphire
#

Oh yea

#

That’s annoying, thanks

quiet ice
#

Uh, generally autocompletion should nullify that problem, as long as you eagerly accept the IDE's suggestions

short raptor
#

I am trying to stop the player's block from getting consumde when he places it, but this event doesn't work. If I put + 1 on the setamount line, then he starts gaining block

#

What is causing that behaviour

#

I don't want to just use inventory.additem because then it could go into any stack

#

I need it to return to the same stack

quiet ice
#

Could it be that they are ghost items?

short raptor
#

I will check right now but I doubt it

#

Nope it's not a visual thing

quiet ice
#

Also, beware that you can place block via the OffHand - make sure to use getHand();
The easiest approach would be to schedule the change the next tick, but that isn't great

short raptor
#

I was thinking of schedule but then it's got a weird lag

#

And thanks about the get hand I didn't realise

quiet ice
#

You could cancel the event and handle it yourself, but that is also a bit bogus

short raptor
#

Yeah then I have to place the block myself and there are edge cases and it's getting complicated

#

I mght have to just schedule it

quiet ice
#

I'd try player.getInventory().setItem(event.getHand(), event.getItemInHand().clone());, but that'd be stupid if it works

short raptor
#

Oh that's clever

#

I'll tryt it

#

It works!

#

It's got the item pickup squish animation thing on the hotbar but that's ok

#

Better than scheduled solution

quiet ice
#

Bruh what

short raptor
#

Thanks man

short raptor
#

It has no effect

#

Very weird

quiet ice
#

That was more of a joke than anything else. There might be a bug somewhere in spigot I guess

short raptor
#

lmaoπŸ’€

quiet ice
#

Or just some really undocumented behaviour

quaint mantle
#

How to make SpigotLibraryLoader download/load my deps or its own thing?

remote swallow
#

cant use the built in one, use something like libby instead

chrome beacon
#

Something changed

#

So you're not making a plugin

sick willow
#

ah, blind me. sorry..

fair crest
#

i don't fully understand

#

im new to this

quiet ice
#
CrossbowMeta meta = (CrossbowMeta) itemstack.getItemMeta();
meta.addChargedProjectile(arrowItemstack);
itemstack.setItemMeta(meta);
#

+/- a few inaccuracies

versed moss
#

could anyone help me here? im trying to make it so that when ever the player closes the inventory it writes to the hashmap, if the title of the inventory is the players name. here is the inventory close event, and the inventory code: for some reason, it does not change the hashmap when ever i close the GUI

rare garden
#

uwu

twin venture
faint aspen
fair crest
twin venture
faint aspen
versed moss
#

nope

#

here is where it is initialised

faint aspen
#

then log all the keys in the hashmap so you know if the keys are in the same way as you want them to be

fair crest
faint aspen
#

maybe import missing?

quiet ice
#

Do you have any idea of what you are doing?

quiet ice
umbral ridge
#

ArrowItemStack doesn't exist

quiet ice
#

Jesus people, why do naming conventions exist?

umbral ridge
#

ArrowItemStack exists in net.minecraft?

#

idk

quiet ice
#

arrowItemStack is obviously a variable, and a variable needs to be declared and initialized

umbral ridge
#

XD

shadow night
#

πŸ’€ ya guys took so long to notice it's a variable

fair crest
#

i said i was new

umbral ridge
#

i didnt look at the code

#

just the conversation

umbral ridge
quiet ice
#

If I used ArrowItemStack it would be a class, and that would be syntactically incorrect as you cannot pass a type that way (hell, why the hell would you even pass a type in there?) - if I wanted to do that I'd so ArrowItemStack.class, but again, that is not what we want (there isn't even an ArrowItemStack class as far as I am concerned).

umbral ridge
#

class names will always begin with an uppercase letter whereas variable names start with lowercase letter

fair crest
umbral ridge
quiet ice
#

ItemStack arrowItemstack = new ItemStack(Material.ARROW, 1); - with some room for error caused by me not having seriously touched bukkit for multiple years now

fair crest
twin venture
#

why this give me ?
spam this error?

#

what iam dooing wrong

#

iam so tired ..

quiet ice
#

recursive relations?

twin venture
#

i made a CosmeticWarpper ,cuz from what i understood , i can't use abstract class in gson serliztion

quiet ice
#

To be honest I have no clue what you are doing

clever lantern
#

how do i mock commands?

quiet ice
#

Like, I feel like this is a typical enterprise java moment

twin venture
quiet ice
#

whatever the cause, I cannot really know it from what you are providing us

faint aspen
#

provide the complete stacktrace at best

twin venture
#

no stacktrace it only send spam that

#

start from there

quiet ice
#

It's pretty evident that two different types both require each other for (de-)serialization, so the full stacktrace isn't all that needed

quiet ice
twin venture
#

xD?

#

nothing

quiet ice
#

I suppose your logger somehow doesn't flush it's outputs correctly. Whatever

#

Do you happen to know what version of GSON your server is running on?

twin venture
#

using 1.8.8 spigot for testing .

quiet ice
#

Ye, but to what GSON version does that correspond? Otherwise I'll be searching for a needle in a haystack

twin venture
#

alr

#

let me check

#

ik why .. it wasn't working

ivory sleet
#

Probably wanna use mockito just

clever lantern
#

idk if i need to mock it, i used plugin.getCommand

ivory sleet
#

Or powermocks if you need to lol

#

I mean you can mock that tho

#

if you want

clever lantern
#

i just wanna test a kick command

#

so idk if mocking is necessary

#

sry im new to tests

ivory sleet
#

I can tell, its fine

#

Well usually when you test commands you end up needing to do integration, system or some other larger tests

atomic niche
#

mockbukkit

ivory sleet
#

Yes thats a thing but you rarely need mock bukkit for actual unit tests

#

Then you ought to be able to isolate units and mock its environment with mockito

umbral ridge
twin venture
shadow night
#

1.8 is awful in any case

twin venture
#

the plugin does not have any nms , so it should work on any .

#

i use 1.8.8 cuz its the lightest ..xD

ivory sleet
twin venture
quaint mantle
#

Why spigot unloads the deps first when disabling the plugin?

#

Using 1.20.2 spigot build

ivory sleet
# twin venture 8

Poor server, java 8 is significantly worse than newer versions in terms of gc performance etc

umbral ridge
pastel locust
#

hey there how can i make changes to a bossbar i created in a file in my plugin through another event file? ive tried so many different things including using the same file for everything but i just cant get it to work. v1.20.2

young knoll
#

?di

undone axleBOT
elder grove
#

Hello, does anyone know why even though the packets are good, the packets to players aren't getting sent? On 1.20.1 it works, but in 1.20.2 and 1.20.4 it doesnt anymore:

                public void send(Player to) {
                    try {
                        Object player = to.getClass().getMethod("getHandle").invoke(to);
                        Field connectionField = player.getClass().getField("c");
                        connectionField.setAccessible(true);
                        Object connection = connectionField.get(player);
                        Class<?> packetClass = Class.forName("net.minecraft.network.protocol.Packet");
                        connection.getClass().getMethod("a", packetClass).invoke(connection, packet);
                    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | NoSuchFieldException | ClassNotFoundException e) {
                        throw new RuntimeException("Error when trying to send packet: ", e);
                    }
                }

I've printed all of them, connection seems fine, so as the packet. I dont get any errors.

elder grove
#

I've tried for each server 1.20.1, 1.20.2 and 1.20.4 without viaversion and it still didnt work

#

and the method names to get connection and packet are the same from 1.20.1 to 1.20.2 and 1.20.4

#

but it only works on a 1.20.1 server

quaint mantle
#

Is the repository pattern strictly for holding data

#

like would it be misleading if I registered the data to some like bukkit listeners or something

hazy parrot
#

I mean it's pattern for separating data access logic, not sure what it have to do with listeners

quaint mantle
#

It's fine though ima just use a service class

hazy parrot
#

It's probably better

#

I can't see how repository will benefit u here

quaint mantle
#

Is a service just a fancy way of saying manager

hazy parrot
#

Are u referring to spring service?

hazy parrot
#

If so, it's not

ivory sleet
#

Almost all managers are some sort of service, all services may not be managers though

hazy parrot
#

Service is basically component inside of ioc container which holds some application logic

ivory sleet
#

But the term service is really vague

hazy parrot
#

Also assuming you are talking about spring

ivory sleet
#

Apart from spring i suppose lol

#

Yeah

quaint mantle
#

so what does a service do

quiet ice
#

If you talk about services in java I think of Java's ServiceLoader API

quaint mantle
#

maybe ill just use a manager

quiet ice
#

That is, a service is the implementation of a specification (most of the time that specification is an interface) which is dynamically discovered at runtime through the ServiceLoader API

ivory sleet
#

Yeah the module api thingy thing

quiet ice
#

Nah, JPMS is something different altogether, although it ties in nicely

ivory sleet
#

Well you’d use JPMS in conjunction with the service api

#

No?

quiet ice
#

You can use services even outside of modularity. For example SLF4J works like that, but plenty of other libraries use it too even outside of Java 9+

#

Okay it's me again with another incredibly specific question: Is there some maven plugin to generate jar-in-jars while having a lot of control over said process?
Basically I want to have a single of my own classes and a few dependencies bundled as usual, while all my other classes and dependencies are bundled in a jar within that jar.

Although I suppose I ought to use gradle for such accursed setups.

ivory sleet
#

Yeah I’d prob stick w gradle

ivory sleet
#

Well I thought it was mainly just for the JPMS even tho it has existed since java 8 if not earlier as well

quiet ice
ivory sleet
#

What bug are we talking about?

quiet ice
#

My custom classloader using the app classloader instead of itself to load a class

ivory sleet
#

Ah and I assume u want it to use ur custom cl instead?

quiet ice
#

Yep. I assume the fix would be as trivial as changing up the logic of Classloader#loadClass to not consult the plattform classloader, but I cannot exactly know what kind of issues that would cause.

ivory sleet
#

Yeah true, although that might be easier than an uber jar, anyway if you do end up with the uber jar stuff, I think luckperms does that as well so you might be interested in their gradle setup

quaint mantle
#

why do i need to cast this still

#
    public <C extends T> void loadAndRegister(@NotNull C config) throws IOException {
        Preconditions.checkNotNull(config, "config is null.");
        Class<? extends T> configClass = (Class<? extends T>) config.getClass();```
#

if the method knows C extends T, and we get its class so the class has to be of a type that extends T

slender elbow
quaint mantle
#

oh bruh

quiet ice
#

Yeah you can define it like that too, yeah.

quaint mantle
#

the class returns Class<?>

#

oops

ivory sleet
#

I think returns Class<? extends ClassType> no?

quaint mantle
#

nah just <?>

#

bruh

ivory sleet
#

Oh yeah nvm me

quaint mantle
quiet ice
ivory sleet
#

Actually Max, it should be Class<? extends T> @quaint mantle

quaint mantle
#

what should

ivory sleet
#

getClass()

quaint mantle
#
    @IntrinsicCandidate
    public final native Class<?> getClass();```
quiet ice
#

It should be Class<? super C>, no?

ivory sleet
#

Read the javadoc, but I thought it was weird to just be a wildcard type, I mean

ivory sleet
quiet ice
#

You cannot have it be anything differently because java does not have a "self" generic type

ivory sleet
quaint mantle
#

bruh i hate generics

quiet ice
ivory sleet
#

yeah extends it is lol

quiet ice
#

super is such a strange keyword, imo.

quaint mantle
#

ok so if I have a method like this

ivory sleet
#

well, it makes sense for consumers

quaint mantle
#
<C extends T> void loadAndRegister(@NotNull C config) throws IOException;

Do i need the generic C

ivory sleet
#

Not really

quaint mantle
#

alr

ivory sleet
#

I mean C erases to whatever T erases to

ivory sleet
#

And since you don’t really have some sort of type token or anything, presumably quite useless method type arg

quiet ice
#

It isn't needed for compilation, but it is needed for making a good API

quaint mantle
#
<C extends T> C get(@NotNull Class<C> configClass);

and for this one i can just have Class<? extends T> right

quiet ice
#

Actually no, my brain is melting right now

ivory sleet
#

I mean yeah generics is nice, but type erasure is… well… a mess

quaint mantle
#

why

quiet ice
#

It is only required API-wise if you want to return it, but not necessarily for consumption

quaint mantle
#

oh wait

#

im returning it

ivory sleet
#

Since you want to get the exact type of the Class<C> argunent

quaint mantle
#

i didnt even see it

#

lol

#

yeah I forgot i was returning the class

#
    @NotNull
    List<@NotNull T> getRegistered();

    void save(@NotNull Class<? extends T> configClass) throws IOException;

    boolean isSaved(Class<? extends T> configClass) throws IOException;
    
    boolean isRegistered(Class<? extends T> configClass);

these are all fine right

ivory sleet
#

I think you return List<? extends T> no?

#

first one

quaint mantle
#

i dont know

#

lol

#

whoever made this class needs to leave import org.checkerframework.checker.units.qual.C;

quiet ice
#

That is why you always exclude transitive dependencies

ivory sleet
#

Oh yeah checkerqual with its thousands of annots

quiet ice
#

Oh, and annotation frameworks need to be provided/compileOnly

quaint mantle
#

ima do some testing with this service lol

#

this config thing cause ion trust it rn

ivory sleet
versed moss
#

question: how would i add something to this because when ever i do, it deletes the old value, and replaces it:

HashMap<Player, HashMap<String,Location>> bagLocations = new HashMap<>();

HashMap<String,Location> baginfo = new HashMap<>();
bagNumber.put(p,num);
bagLocations.put(p,baginfo);
quiet ice
#

Map#compute is one way

#

However, I recommend to not use Player in maps, instead UUID should be used.
But it is fine to do so as long as you remove the player once they disconnect

ivory sleet
#

you have Map::replace as well

versed moss
#

Like, it stores the player's name, and then the other hashmap will have a load of other Strings aka the names of the beds/bags, and when i look at that it will give me the location of the bag, so if i used replace, would i need a value already there?

versed moss
quiet ice
#
map.compute(key, (finalKey, value) -> {
  if (value == null) {
    value = new HashMap<>();
  }
  // Do stuff
  return value;
});

finalKey being the same as key, but you can use finalKey inside your lambda without having to copy your key explicitly (though most of the time that is not needed)

versed moss
#

okay thank you!!

ivory sleet
#

Which is basically Map<R,Map<C,V>>

versed moss
#

thanks xD

ivory sleet
#

HashBasedTable.create() gives you one also :)

quaint mantle
#

How can i use Plugin.getResource in this context?
BukkitObjectInputStream in = new BukkitObjectInputStream(new GZIPInputStream(HERE));

#

Should i immedietly use InputStream instead of GZIP?

quiet ice
#

It depends on how your object is stored on disk

#

You can use PluginClass.class.getResourceAsStream("my-resource-file.dat") to obtain an input stream

#

Does anyone know how to obtain an absolute URL from a non-absolute URL?
So far I tried

                    URI uri = url.toURI();
                    if (!uri.isAbsolute()) {
                        arr.put(url.toString());
                    } else {
                        uri = Path.of(".").toAbsolutePath().toUri().resolve(uri);
                        arr.put(uri.toASCIIString());
                    }

but URI#isAbsolute returns true even for file://myJar.jar, besides the else branch does not seem to work either

ivory sleet
#

I’ve had issues with that as well in the past

#

Dont remember exactly how I fixed it, but I think I used a File object at some point

#

(Instead of Path)

quiet ice
#

Hm right, I can use that

quaint mantle
ivory sleet
#

Yeah well it was weird when I fixed it cuz I remember just freaking out

quaint mantle
#

i did some testing and everything I think works

#

idk if im doing this whole unit test things right tho

#
    @Test
    void getRegistered() {
        assertEquals(2, configService.getRegistered().size());
        assertTrue(configService.getRegistered().stream().anyMatch(c -> c instanceof ConfigOne));
        assertTrue(configService.getRegistered().stream().anyMatch(c -> c instanceof ConfigTwo));
        assertFalse(configService.getRegistered().stream().anyMatch(c -> c instanceof UnRegisteredConfig));
    }
quiet ice
#
Exception in thread "main" java.lang.IllegalArgumentException: URI has an authority component
    at java.base/java.io.File.<init>(File.java:425)
    at org.stianloader.smatterbuild.cli.sll.CLISLLJumploader.main(CLISLLJumploader.java:45)

great.

#

Okay, for some reason the filename is encoded as the authority? Great - seems as if I am working with malformed URLs

ivory sleet
#

lmao

short plover
#

Is there a way to determine if a block would change a noteblock's instrument or would I have to use NMS to do that?

quiet ice
#

Okay after fixing the problem at it's source it is gone now.

clever lantern
#

how do i fix it

#

i have adventure in my pom

quiet ice
#

that method will only exist under paper

#

Finally, progress!

clever lantern
quiet ice
#

At least not with spigot on the classpath

#

Under gradle you could've excluded spigot from the test classpath and added paper on the test classpath, but that is not possible under maven

pulsar monolith
#

Can anyone help me here? I am trying to sort the player list but everything I tried doesn’t work. By default it is sorted alphabetically, so I tried to put abc letters in front of the name but it’s still being sorted by the original username. I also tried creating teams, for example 00Owner 01Admin 02Supporter but no success..

quaint mantle
#
FirmlyMCMoon.getInstance().getResource("moon_house.dStructure");

This returns null, even tho that the file exists under src > main > java > resources

quaint mantle
hazy parrot
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

quaint mantle
#

Oh let me do verification

proud badge
#

does gradle make a difference if I dont care about build speed?

quaint mantle
clever lantern
#

gradle is more advanced but in some edge cases allows for more

quaint mantle
#

I disabled filtering for them, does it affect it?

hazy parrot
#

Can you check if that file is actually present in your jar

quaint mantle
#

its not

#

i guess filtering disabled removes them as resources.

#

i disabled filtering

#

fully

#

now its there

hazy parrot
quaint mantle
#

i am trying to fix it

#

the problem is in

BukkitObjectInputStream in = new BukkitObjectInputStream(inputStream);

are binary files even supposed to be a input stream?

#

they should be right

hazy parrot
#

Input stream is stream of bytes

#

Not sure about bukkit impl of object stream, but is should be checked exception

#

Meaning you should catch it

#

Yeah

quaint mantle
hazy parrot
#

Read this so article

quaint mantle
quiet ice
#

I have no idea what you mean with that

#

Is it a standard structure file? In that case, (Bukkit-)ObjectInputStream will not work. ObjectInputStreams can only decode stuff that was encoded via an ObjectOutputStream

quaint mantle
#

a custom class is serialized in it

quiet ice
#

And that class implements Serializable, right?

eternal oxide
#

what items are you serializing?

quaint mantle
quaint mantle
quiet ice
#

And that class has never been changed since it was written via an ObjectOutputStream, or changes to it did not impact it's compatibility?

ivory sleet
#

Gradle and maven can both be equally fast

quaint mantle
#

i only changed one function

ivory sleet
#

I mean gradle does have incremental build, task caching and the daemon runner

quiet ice
#

As long as that function had nothing to do with the serialization process it should be okay

ivory sleet
#

But i think maven got some upgrades also

quiet ice
#

Do you have filtering activated in your pom perchance? Although that cannot really cause EOFs afaik

quaint mantle
#

what might be different is the methods i used:

BukkitObjectOutputStream out = new BukkitObjectOutputStream(new GZIPOutputStream(new FileOutputStream(FilePath)));
BukkitObjectInputStream in = new BukkitObjectInputStream(inputStream);
#

maybe i should use the same methods...

quiet ice
#

If you GZIP it out, you need to read it via GZIP

quaint mantle
#

same issue

quiet ice
#

Although I never used that one, and it is a bit uncanny for me that you don't declare all three streams in a try-with-resources

quaint mantle
quiet ice
#

Did you invoke GZIPOutputStream#finish()?

quaint mantle
#

you mean close

quiet ice
quaint mantle
#

and yes i closed it

quiet ice
quiet ice
#

@quaint mantle Could you look into the contents of your jar file? (This can be done by renaming the *.jar file to *.zip if you don't already know that) and check whether your file hasn't been changed?

quiet ice
#

Even the path is the right one?

eternal oxide
#

@quaint mantle You can filter some and not others.```xml
<resources>
<!-- Include all resources -->
<resource>
<directory>resources</directory>
<filtering>true</filtering>
<includes>
<include>.yml</include>
<include>
.txt</include>
<include>*.json</include>
</includes>
</resource>

        <resource>
            <directory>resources</directory>
            <filtering>false</filtering>
            <includes>
                <include>*.nbt</include>
            </includes>
        </resource>
    </resources>```
#

compressed files (like nbt) must not be filtered.

quiet ice
#

well that would mean that the file in the jar has changed as a result of filtering.
And they even stated that filtering was disabled by them

quaint mantle
quiet ice
#

Just out of safety, does #getResource work now?

quaint mantle
#

yes

quiet ice
#

yeah then I have no clue what is going on

quaint mantle
#

How do I pass player chat signature into custom message? Or this even possible?

river oracle
#

you don't

#

chat signing won't work properly if any chat formatting is done

shadow night
#

You could, just in theory, do some crazy magic, but I'm not sure

carmine mica
#

its true on spigot cause it just uses the system chat packet iirc

#

but it doesn't have to be that way

shadow night
#

Hmm

carmine mica
#

it only checks if the signed potion is contained in the plain text serialized chat component

#

so if you add some prefix/suffix to the signed content, then it can still be signed

#

but spigot just redirects all chat to use the system chat packet iirc (if a format is set)

hazy parrot
#

But seems it's true

#

While the message always needs to be verified by the player that sent it, player display name, team name, and surrounding format can be freely defined by the server.

dire tapir
#

Hello, I have a problem with the BlockDamageEvent. It does not get triggered when the player keeps mining a block after a BlockBreakEvent has been cancelled. I tried using the BLOCK_DIG packet same thing. So basically the player starts digging BlockDamageEvent gets triggered -> finished mining, but BlockBreakEvent is cancelled -> starts digging again while still holding LMB, but then both BlockDamageEvent AND BlockDamageAbortEvent are not triggered. Is there an alternative thing I could do to detect this moment?

quaint mantle
#

Can I add stuff like prefix, suffix, e.t.c?

carmine mica
#

and red is unsigned

carmine mica
hazy parrot
#

You aren't talking about modifying format?

#

Mb ig

carmine mica
#

well in a way, yes, but not that way. Like if you take the signed string, and put it into a component with a prefix or suffix and put that into the unsigned content of the clientbound packet, it will show as modified, not unsigned.

#

there is the separate ChatType system which can define chat formats in datapacks which are synced to the client

#

but spigot has 0 API for that and setFormat does not use that at all, it just puts the whole thing into a system chat packet if you try to use setFormat with the non-default format

steel swan
#

is this the most optimal way to load all the chunks from x -1000 to x 1000 and z -1000 and z 1000?

remote swallow
#

that wont load them all

formal ether
remote swallow
#

chunks have there own x and z so you just need to add 1, it will also probably just die

steel swan
remote swallow
#

no

steel swan
#

like what i mean is, in here, we use coordonates of chunks not blocks?

remote swallow
#

coord of chunk in getChunkAt

steel swan
remote swallow
#

so yes what

steel swan
#

ok i get it

steel swan
remote swallow
#

chunk 10,20 doesnt contain block 10,20

steel swan
#

thx

rotund ravine
#

Ignore the following msg

#

?blockpdc

undone axleBOT
remote swallow
#

whos the blockpdc for

steel swan
rotund ravine
#

Jk some guy on paper

quaint mantle
quaint mantle
remote swallow
steel swan
quaint mantle
#

it might be slow becuase you are loading 252 chunks at once

#

wait too low

#

my math bad

steel swan
rotund ravine
quaint mantle
steel swan
subtle folio
#

lol

quaint mantle
#

?async

#

aw man

rotund ravine
#

Don’t use it async

echo basalt
#

pregenerating a world is fine

#

keeping the entire world loaded in ram is not

quaint mantle
#
Asynchronous (aka async) programming in Java is a technique for parallel programming that lets teams distribute work and build application features separately from the primary application thread. Then, when the team is ready with the feature, the code is synced with the main thread.
#

that is wrong

#

lol

#

dont listen to google

river oracle
rotund ravine
#

The server is sync

#

Wouldn’t matter much since spigot halts until it has generated le chunk

steel swan
#

So, you want me to put the chunk loading thing on an other thread?

river oracle
#

you can't

#

well you might beable to use PaperLib here

#

should help if your plugin is run on paper

steel swan
river oracle
brisk estuary
#

hey guys, I wanted to ask you about a "pattern" decision. So basically I have a class called MerchantManager and it represents a feature for my plugin that soft-depends on Citizens. The idea is to spawn a NPC every X time and then despawn it after Y time. It will be basically a merchant with a custom inventory and players can trade items with him. If Citizens is not enabled in the server, I'll just enable a command to access the same inventory/gui that would be accessible with the NPC. In the MerchantManager class I'll basically have the timing logic, so it will check if it's time to end the "merchant event", start it, etc and also get config settings. What's the best approach in this case? Like, I'll have two implementations of the event, one using Citizens and another one using just the GUI and a command. Should I have an interface like this:

public interface MerchantEvent {
  void start();
  void stop();
}

and then on the manager:

public void start() {
  // timing logic
  merchantEvent.start();
}
steel swan
quaint mantle
#

Craftbukkit modification

rancid ibex
#

How to cap enchanting that it doesnt go further than prot 3 and sharp 3 I had someone make a plugin for me but it doesnt work good

quaint mantle
#

Theres no way to speed up the chunk gen other than having powerful pc

remote swallow
rancid ibex
remote swallow
#

depends on the plugin

quaint mantle
#

I think bros gonna send jar πŸ’€

rancid ibex
remote swallow
#

did kacper code you a plugin

rancid ibex
remote swallow
#

@onyx fjord do you not do bug fixes or smth

rancid ibex
#

kaspiandev

#

did make it for me

#

(i payed him for it)

remote swallow
#

that is kaspiandev

rancid ibex
#

i thought u misstyped or smth

rancid ibex
remote swallow
#

sure

echo basalt
#
public interface MerchantEvent {
  
  void start();
  void stop();
  boolean isActive();

}
#

on your command you just check isActive

clever lantern
#

why when i do this plugin = MockBukkit.load(CorePlugin.class); this is thrown

#

sry i am new to tests

quaint mantle
#

It mean its not mocking