#help-development

1 messages · Page 2236 of 1

humble tulip
#

U gotta cancel for both locations

gritty urchin
#

its not location dependent

#
    @EventHandler
    public void onPortalBreak(BlockPhysicsEvent e) {
        if (e.getChangedType().getId() == 90) {
            e.setCancelled(true);
        }
    }
}```
humble tulip
#

Oh u cancel for all portals and only one gets placed

#

What mc version are u developing for?

gritty urchin
#

1.8.8

waxen plinth
#

cringe

humble tulip
#

Check if the type is portal

#

Don't use id

gritty urchin
waxen plinth
#

skull

gritty urchin
#

💀

waxen plinth
#

☠️

gritty urchin
waxen plinth
#

You don't need to cancel the BlockPhysicsEvent bro

#

You pass false to setType

humble tulip
#

That makes sense😂

gritty urchin
#

Thanks man

#

how do i place an end portal frame below the two portal blocks

#

seems to not work

azure nova
#

Does anyone know how can i set a prefix beside the player name above his 3d character?

gritty urchin
#

set the displayname

#

to the prefix before it

azure nova
#

no but the displayname only sets the thing for the chat right?

gritty urchin
#

Player#setDisplayName(String name) changes above head name

azure nova
#

oh wait it does?

gritty urchin
#

yeah im pretty sure

azure nova
#

sorry I didnt knew that, cause i cant see my name in perspective.. lmao sorry

#

thank you for letting me know

gritty urchin
#

yeah im pretty sure

#

np

azure nova
#

@gritty urchin it didnt work sir

#

it only changed in chat

#

not above the player

heady spruce
#

Hi! Does anybody know how to shade your API into your Plugin using Maven? Thanks!

gritty urchin
#

you can try bukkit scoreboards

#

i think ive done it with that befroe

#

before

azure nova
native gale
#

oh

heady spruce
#

oh

dull goblet
#

How can i remove this from an itemstack?

#

i tried removing lore but that didn't work

heady spruce
#

maybe add itemflags or smth

azure nova
twilit roost
#

How can I put \ into a string?

inner fog
#
//\```
ornate mantle
#

crap pinged the wrong person

ornate mantle
#

also it wont appear for survival mode players

#

that shit is only for creative menu

twilit roost
ornate mantle
#

what

#

my guy what do you want to write

azure nova
#

no my code is literally the same as the above tutorial, but the tutorial is very vague as it plans to cover the api in a single thread

ornate mantle
#

if u dont wanna deal with discord formatting write it on notepad and screenshot it

#

``` works too

heady spruce
ornate mantle
#

anyways

twilit roost
ornate mantle
#

what do you need to write

#

you cant write \ raw because its an escape character

twilit roost
ornate mantle
#

to make it visible in strings u gotta do \\

#

ah

#

_\\ || /_

heady spruce
#

does anybody know to shade custom apis in your plugin using maven?

ornate mantle
#

this

twilit roost
#

thx

ornate mantle
#

how do i give players a potion effect on respawn?

quaint mantle
quaint mantle
#

wait a tick, then give it to them

ornate mantle
#

yeah ive tried that

#

doesnt work

quaint mantle
#

weird

echo basalt
#

wait a tick

ornate mantle
#

i waited an entire second

heady spruce
ornate mantle
#

thats 20 ticks

echo basalt
#

did you make sure that the potion effect time was in ticks too

ornate mantle
#

💀

echo basalt
#

you probably tried to add a 5 tick effect thinking it was 5 seconds lol

ornate mantle
echo basalt
#

Very common issue

ornate mantle
#

i know how ticks work

echo basalt
#

ok huh it's maxvalue lol

ornate mantle
#

1 second = 20 ticks

quaint mantle
ornate mantle
#

alr

quaint mantle
#

no need to wait a whole second

twilit roost
#

Any way to make ActionBar msg bigger?

barrely visible in the img

ornate mantle
quaint mantle
#

true

quaint mantle
twilit roost
#

without having to force ppl to scale up gui

twilit roost
heady spruce
heady spruce
gritty urchin
#

How can I prevent mobs from moving through a nether portal?

dull goblet
#

You can check the entity and if its a mob cancel the event

#

think the second one fits your needs more

quaint mantle
#

google it

#

not google maven

#

imagine google made a build tool

gritty urchin
dull goblet
gritty urchin
#

How

dull goblet
#

itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);

gritty urchin
#

thx

#

doesnt seem to work for me?

#

?

#

ive set the meta

#

yeah done that

crisp steeple
#

just wondering, is using Consumers or CompleteableFutures better for callbacks?

#

i would assume if im only calling it once that completeablefuture would be best

mortal hare
#

Future or CompletableFuture

dull goblet
#

Why is it that persistendatastorage getting a key doesn't work when it's referenced for another plugin? how can i make this work?

#

plugin A:
NamespacedKey nk = new NamespacedKey(plugin, "cointype");
itemMeta.getPersistentDataContainer().set(nk, PersistentDataType.STRING, "coin");
Plugin B:
NamespacedKey key = new NamespacedKey(EscLockupCells.get_instance(), "cointype");
return pdc.getOrDefault(key, PersistentDataType.STRING, "not coin");

quartz basalt
#

how do i change a players message with the message event (bungee)

ivory sleet
#

Consumer can do that as well with Consume::andThen but they’re just more inflexible, for instance when it comes to error handling and continuation

#

Also CFs do implement both CompletionStage (computation builder part) and Future (the future part)

sterile token
#

Lmao shity maven, im telling him to use a library that is installed on local repo and he is searching for it on remote repo. What i can do?

quaint mantle
#

How can I create a placeholder in my plugin which can be used by a scoreboard plugin so I can show playerdata?

sterile token
#

The plugin have his own discord for that type of things

quaint mantle
#

placeholderapi's server?

sterile token
#

Yeah their have a discord

quaint mantle
#

ah lemme try find it

agile anvil
#

Use*

sterile token
#

Yeah

#

There you have an example

quaint mantle
#

i need it as a general placeholder

sterile token
#

He?

#

Stress what code you have atm?

quaint mantle
#

for placeholders, none

sterile token
sterile token
quaint mantle
#

alright ty

sterile token
#

But you should read the wiki i sent

#

Because its pretty well documented

quaint mantle
#

Alright, I'll have another read again

sterile token
#

Yeah but i will send the code

quaint mantle
#

ty

sterile token
#
public class CoinsExpansion extends PlaceholderExpansion {
  
    private CoinsPlugin plugin;

    public CoinsExpansion(CoinsPlugin plugin) {
      this.plugin = plugin;
    }

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

    @Override
    public String getAuthor() {
        return "Alexito2060";
    }

    @Override
    public String getVersion() {
        return "1.0";
    }

    @Override
    public boolean persist() {
        return true;
    }

    @Override
    public boolean register() { return super.register(); }

    @Override
    public String onRequest(OfflinePlayer player, @NotNull String identifier) {
        switch (identifier){
            case "coins":
                return String.valueOf(this.plugin.getApi().getCoins((Player)player));
        }
        return null;
    }
}```
#

and then on main class:

new CoinsExpansion(this).register();

#

In your case you should replace the CoinsPlugin with what ever you want to pass into CoinsExpansion

#

@quaint mantle if you have any dought just tag me

quaint mantle
#
public class OrionGoldExpansion extends PlaceholderExpansion {
    @Override
    public @NotNull String getIdentifier() {
        return "oriongold";
    }

    @Override
    public @NotNull String getAuthor() {
        return "Stress";
    }

    @Override
    public @NotNull String getVersion() {
        return OrionGold.getInstance().getDescription().getVersion();
    }

    @Override
    public String onRequest(OfflinePlayer player, String params) {
        final User user = OrionGold.getInstance().getDatabaseManager().getUser(player.getUniqueId());
        if (params.equalsIgnoreCase("balance_formatted")) {
            return Common.format(user.getGold());
        }

        if (params.equalsIgnoreCase("balance")) {
            return String.valueOf(user.getGold());
        }
        return null;
    }
}
#

im static abusing but thats what ive got atm

crisp steeple
#

anyone know what happened to EntityPlayer#activeContainer in 1.18.2?

quaint mantle
#

aight

sterile token
#

Because switch is faster than if

#

Also its preferible to use DI over Singleton

sterile token
quaint mantle
#

not yet no

sterile token
#

Allright

quaint mantle
#

added that now

#

should i test?

sterile token
#

So after you change the if to switch, do that code onEnable()

quaint mantle
#

done all that

sterile token
#

Allright

#

Just export

#

And see if working

quaint mantle
#

bet

sterile token
#

In teory it should be working

#

If doesnt work try adding this lines on the expansion class

@Override
public boolean persist() { return true; }

@Override
public boolean register() { return super.register(); }

#

Also try doing: /papi list

#

If the expansion was loaded should appear on the list

quaint mantle
#

alright bet

#

testing now

sterile token
#

allr

quaint mantle
#

yep, thats showing on my scoreboard now

#

thanks

sterile token
#

Your welcome

quaint mantle
#

didnt need it

sterile token
#

Oh ok

#

Nice

unreal sandal
#

Hello, how can I get a custom head decoration for my plugin ?

agile anvil
#

What do you mean ?

agile anvil
unreal sandal
agile anvil
#

?google

undone axleBOT
unreal sandal
#

But okay thanks for your help

agile anvil
#

Well "decoration" is basically a skin on a player's skull

#

You even have plenty of plugin to do that

#

Such as head database

unreal sandal
#

But I need a decoration skull for my plugin. I would like to use the skull into a gui

agile anvil
#

Have you ever searched on google ?

#

Took me 0.1sec

small wren
#

Any good developers able to help me with creating a plugin?

#

I can pay ^^

eternal night
#

?services

undone axleBOT
unreal sandal
#

Yes, I searched on Google, but thank you, I think I didn't write properly my research. Thank you, but can you be less agressive. I did all my researches on Google and when I really don't find, I go on spigot discord, but that's really rare.

#

If you look my activity on this discord's server, you will see that is not all days that I go on this discord to have help.

agile anvil
unreal sandal
river oracle
#

Quick question about reflection and nms. I'm trying to expose some methods as I'm doing a bit of messing around. I'm quite curious how it works with remapped. Would I have to decompile the server jar and look for names in there or am I able to use the remapped names. The latter I don't think would work do to the names merely being remapped

#

if you need the obfuscated ones for example .c.d is it possible to find a source with those I can't find them

lost matrix
river oracle
#

hmm I'll test it out hopefully otherwise this will be a pain

lost matrix
ornate patio
#

ive got more of a java question

quaint mantle
#

ask it

ornate patio
#

so i have many many singletons in my plugin

quaint mantle
#

bad design

ornate patio
#

well like

#

what other choice do i have

quaint mantle
#

show what you mean

ornate patio
#

for example event listeners

river oracle
#

event listeners shouldn't be singleton

#

ever

ornate patio
#

why

lost matrix
quaint mantle
#

doesnt matter

river oracle
#

it doesn't make sense at all

quaint mantle
#

meh

ornate patio
#

ok point is, I have code similar to this for every singleton

public class NearbyPlayerComfortability implements LoopingTask<SuperiorHorse> {
    private static NearbyPlayerComfortability instance;

    public static NearbyPlayerComfortability getInstance() {
        if (instance == null) {
            instance = new NearbyPlayerComfortability();
        }
        return instance;
    }
#

is it possible to turn this into a class and extend it (or implement an interface)

lost matrix
#

they effectively are singletons. Doesnt mean they have to be used in a singleton pattern

humble tulip
#

I have some manager classes that are listeners to clean up stuff on leave and do stuff on join

ornate patio
#

some of my singletons are event listeners and something called "LoopingTask"s which is my own interface, so I need to grab the same instance for both parts of the program that accesses each part

humble tulip
#

I dont make them into singletons but i do pass them to other classes

lost matrix
ornate patio
humble tulip
lost matrix
humble tulip
#

Can u link those

#

Never read em

pallid forge
#

Scoreboard Questions

quaint mantle
lost matrix
#

google them

quaint mantle
#

^

#

one directive programming

#

listeners are to listen, not to provide data

ornate patio
eternal night
#

I mean, static stuff is not inherited

lost matrix
#

^

ornate patio
#

yeah

#

again, psuedocode

eternal night
#

I mean, but isn't that what you want ?

ornate patio
#

just wondering if its possible to turn this getInstance method into an interface that I can implement wherever I want

quaint mantle
#

no

eternal night
#

well no

#

interfaces are for object methods

lost matrix
#

If you want to not worry about your instance management then you should try a dependency injection framework like guice

ornate patio
eternal night
#

Well preferably singletons are pretty rare

#

if everything is a singleton, just make stuff static

ornate patio
#

i have many different event listeners, and I have other parts of my program that needs to access these listeners

eternal night
#

Well yea, use DI

river oracle
#

?di

undone axleBOT
eternal night
#

wait, stuff needs access TO your listeners ?

ornate patio
#

yes

eternal night
quaint mantle
#

bad design

river oracle
#

wiat hold up I got that backwards too

ornate patio
#

look look

quaint mantle
#

your listeners shall not provide data

eternal night
#

^

ornate patio
#

some of my classes implement Listener and a bunch of my own interfaces

quaint mantle
#

why

ornate patio
#

because each class handles one feature

quaint mantle
#

like?

eternal night
#

LOL

humble tulip
#

Single responsibility principle

#

I see

quaint mantle
#

im gonna see some real hardcoded shit in a second wont i

eternal night
#

"my classes implement Listener and a bunch of my own interface" -> "each class handles one feature"

humble tulip
#

Thanks for telling me abt that

eternal night
#

🤔

ornate patio
#

one file for managing the "Trustworthyness" stat, one file for managing players adjusting horse speed, etc

quaint mantle
#

show ur damn code

ornate patio
#

it has like 50 files how am i suppoed to do that

quaint mantle
#

show one

#

we should be able to tell from there

ornate patio
#

ok

#

here is an unfinished "feature" file

#

this is for managing when a player right clicks a stick while sitting on a horse

#

it'll adjust the horses speed

#

and display the speed on the action bar

tender shard
#

but I wonder what the purpose of this would be

ornate patio
#

so that i dont have to copy paste code everywhere

quaint mantle
ornate patio
#

well

#

what am i supposed to share lmao

river oracle
#

shouldn't all the data collection be handled internally inside of the event I don't get why you would want to collect data from it

quaint mantle
#

where your code is bad

ornate patio
#

for example in the code I sent, it also implements LoopingTask<Player>

#

which basically adds the runLoopingTask(Player) and getIntervalTicks method, so that an external task handler can call the runLoopingTask method every certain amount of ticks (specified by the getIntervalticks method)

modest garnet
#

INSERT INTO player_lives (UUID, Lives) VALUES (" + "'" + uuid + "'" + lives + ");");

can anyone see anything wrong with this? as i get error

quaint mantle
#

thats confusing to look at

modest garnet
#

lol

quaint mantle
#

@ornate patio show where ur code is bad

dull goblet
#

How could I store a string variable in a door? The door has to store a certain ID

ornate patio
#

ok here i'll show u something

#

the code in runLoopingTask is also unfinished

ornate patio
quaint mantle
#

its a lib

ornate patio
#

hell yeah

tender shard
# ornate patio so that i dont have to copy paste code everywhere

you could do something like this

public abstract class Singleton {

    private static final Map<Class<? extends Singleton>, Singleton> instances = new HashMap<>();

    public static <T extends Singleton> T getInstance(Class<T> clazz) {
        return (T) instances.get(clazz);
    }

    public Singleton() {
        instances.put(getClass(), this);
    }
}

and then just do ```java
Singleton.getInstance(YourSingletonClazz.class);

but it still requires you to create every instance once
river oracle
ornate patio
cedar gust
#

is there a way to make a honey block have the same knockback to a player as a slime block when pushed by a piston?

light warren
#

Hey, has anyone gotten EntityPortalExitEvent to work? It doesn't trigger at all for me if I try to push mobs through a portal

humble tulip
#

Also use preparedstatements

humble tulip
#

You can use pdc if it's not

tender shard
# ornate patio ah thanks

for a really dirty solution, you could also make all your singleton classes have a no args constructor and make the getInstance method look like this:

    public static <T extends Singleton> T getInstance(Class<T> clazz) {
        return (T) instances.computeIfAbsent(clazz, (Function<? super Class<? extends Singleton>, ? extends Singleton>) clazz1 -> {
            try {
                return clazz1.getConstructor().newInstance();
            } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
                throw new RuntimeException(e);
            }
        });
    }

Then it doesn't require you to manually create every instance once. A better solution would be to define a functional interface to create an instance of your Singleton subclasses though

I still think that this is not a good idea btw

quaint mantle
#

i feel like this is all really overkill ^

ornate patio
quaint mantle
#

what

tender shard
ornate patio
#

i just wish event listeners could be static

quaint mantle
#

they can

tender shard
#

they can

#

F

quaint mantle
#

also

ornate patio
#

. . .

quaint mantle
#

theres no reason for them to be

#

why the fuck are you doing this

crisp steeple
quaint mantle
#

you're overcomplicating everything

tender shard
#

yeah you need an instance of the listener anyway, to register it

quaint mantle
ornate patio
#

so its not possible

tender shard
#

well the actual listener method can be static

ornate patio
ionic rampart
#

anyone know any good server development servers? to collab/hire/help and get help

ornate patio
#

im more of a perfectionist

tender shard
#

it just doesn't add anything useful

quaint mantle
#

its just useless

undone axleBOT
quaint mantle
#

its unnecessary

tender shard
quaint mantle
#

^ you end up creating one anyways

ornate patio
#

what would be an alternative to this then

#

im trying to keep each feature in its own class

sterile token
#

Imajin and mfalex he is looking like me when i dont understand something

quaint mantle
#

fricking

#

do it normally

ornate patio
#

i think i get overly obsessed over file structure lmfao

quaint mantle
#

whats so hard abouyt that

tender shard
#

you can still use different classes for different things

#

?

quaint mantle
#

this makes me really really angry

#

😠

ornate patio
quaint mantle
#

Who

#

they should be effectively singletons like 7msile7 said

tender shard
#

well you definitely shouldnt instantiate any of your listener classes more than once

quaint mantle
#

they do NOT have to be singleton patterns

#

they should have ONE instance to be REGISTERED

#

then discarded

#

thrown away

#

no longer needed

ornate patio
#

ok ok

#

i have a new idea

#

rate it

river oracle
#

You misinterpreted what I said I thought you meant your event methods were static and I just simply remarked that was useless

ornate patio
#

what if i put each feature in its own folder

#

and have a Listener, LoopingTask, and whatever else is needed in each folder

#

seperate files for each part

quaint mantle
#

show your project tree

ornate patio
#

well its still WIP its kinda messy rn

#

its kinda long

#

cant fit the whole thing in one ss

quaint mantle
#

doesnt look that bad

ornate patio
#

yeah

#

the hell right now is in superiorhorse/features

ornate patio
#

my brain hurts right now ill get back to this later

#

but lmk what yall think

tender shard
ornate patio
#

how do you-

#

wtf

tender shard
#

here's the full thing lol

quaint mantle
tender shard
quaint mantle
#

thats big

ornate patio
#

i use PDC everywhere

tender shard
#

I use PDC to store terabytes of backups of my server inside the player's mainhand item on another server

quaint mantle
#

super

river oracle
#

I use my pdc to store players credit card information they used on the store to their Player Object

#

I also store addresses and other information I might need to access there

tender shard
river oracle
tender shard
#

then you need another player

#

does anyone know when AdvancementInfo was added?

#

roughly

#

erm I mean AdvancedmentDisplay

unborn kiln
#

Is there a way to get the location of an armor stands head?

tender shard
#

there's getEyeLocation()

#

but not sure if that returns something useful if the head has a weird angle or sth

unborn kiln
#

let me test it rq

dull goblet
tender shard
quaint mantle
#

he is

unborn kiln
dull goblet
#

yes

tender shard
#

well a door is 2 blocks high. If you wanna get the data and you only have the upper block, simply get the data from the lower block?

#

If you have a door, you can get the blockstate and cast it to door. Then check if its the upper or lower half. if it's the upper, just get the data fro mthe lower one instead

dull goblet
#

okay i'll try that, thanks!

tender shard
#

np

tender shard
#

the method is in Bisected

#

and it's called getHalf

#

it returns Bisected.Half.TOP or Bisected.Half.BOTTOM

#

basically just sth like this. Always gets the block's data, unless it's the "upper version" of a 2 high block - then it get's the data of the lower half

    public static PersistentDataContainer getCustomData(Block block) {
        if(block.getState() instanceof Bisected) {
            Bisected.Half half = ((Bisected)block.getState()).getHalf();
            if(half == Bisected.Half.TOP) return new CustomBlockData(block.getRelative(BlockFace.DOWN), this);
        }
        return new CustomBlockData(block,this);
    }
ocean lion
#

whats the best way to make createItem / ItemBuilder methods

ivory sleet
#

I would create a factory acting as a command object which creates the stack, whilst surely builders might be convenient ItemStack, and ItemMeta are both mutable so there's actually no real need for a builder/creator

quaint mantle
#

Does anyone know how I can have text appear just above the hotbar?

ivory sleet
#

Player::spigot
Player.Spigot::sendMessage and pass the type ChatMessageType.ACTION_BAR

quaint mantle
#

Thanks I'll try that

ocean lion
ivory sleet
#
@FunctionalInterface interface ItemStackSupplier {
  ItemStack getItemStack();
}

class DirtItemStackSupplier implements ItemStackSupplier {
  @Override ItemStack getItemStack() {
    var stack = new ItemStack(DIRT);
    var meta = stack.getItemMeta();
    meta.setDisplayName("Epic DIRT");
    stack.setItemMeta(meta);
    return stack;
  } 
}

//or just altho less reusable 
private ItemStack createDirtStack() {
    var stack = new ItemStack(DIRT);
    var meta = stack.getItemMeta();
    meta.setDisplayName("Epic DIRT");
    stack.setItemMeta(meta);
    return stack;
}
#

its a factory

#

however, if one of your modules depend on itemstacks you could easily depend on the ItemStackSupplier as a command object

ocean lion
#

yeah I used to do something similar but it just takes up so much space in the class

#

thats why I though maybe createItem was better and if so..

ivory sleet
#

myeah, depends on what you define as better obviously

ocean lion
#

Of course but just a method which makes it simpler to create items change etc

ivory sleet
#

but if you want as little code as possible, having many utilities and helpers might be the solution then

ocean lion
#

maybe its just me

ivory sleet
#

yeah

#

well when you have an extracted method for the purpose of creating a stack you do at least make your code follow function abstraction hierarchy which is polite to the reader

winged anvil
#

?di

undone axleBOT
ocean lion
#

So I have this getStringList which makes the lore for the item and could be changed in config.. However I cant use ChatColor.translateblabla('&', "") or replaceAll("&", "§");

eternal oxide
#

you have to translate Each entry in the returned List

arctic moth
#

are chunks using the old getBlock system?

#

0-256 instead of -64-320

tender shard
tender shard
arctic moth
#

should work

tender shard
#

your world's build height is set to 0-256

arctic moth
#

shouldnt be lol

modest garnet
#

how do i get it to wait for the Result

tender shard
arctic moth
#

ive gone into spectator past -64

arctic moth
#

in the world

arctic moth
tender shard
#

if it says "must be between 0 and 256", then that's what the build height is set to for that world

arctic moth
#

helpful exception

tender shard
#

neither 0 nor 256 is hardcoded in CraftChunk

arctic moth
modest garnet
tender shard
arctic moth
#

deleting and regenerating the world didnt work, is it in server.properties or something

#

?

tender shard
undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

arctic moth
#

oh i can use world.getMaxHeight and world.getMinHeight

tender shard
#

yeah sure

modest garnet
lost matrix
modest garnet
#

will if work?

ocean lion
# tender shard I am not sure tbh lol

.getConfig().getStringList("items.teleportbow.lore").stream().map(line -> ChatColor.translateAlternateColorCodes('&,' line)).toList(); gives red under toList();

tender shard
ocean lion
#

Usage of API documented 16

tender shard
#

instead of toList(), use the generic list collector .collect(Collectors.toList())

#

toList() is java 16+

ocean lion
#

thank you that works very nice!

arctic moth
#

what is the best way of making all blocks of a specific type do something every tick (without searching the entire world for it)

tender shard
arctic moth
#

should i store the location?

arctic moth
#

does blockbreakevent trigger from decay?

tender shard
#

one second, I can show you a list of all events that can result in a block disappearing

tender shard
ocean lion
#

how would I make an item unbreakable?

#

itemMeta.setUnbreakable(true);

#

found it

worldly ingot
# arctic moth ew who didnt use import

In CB, we often don't have a choice. In this case, net.minecraft.server.world.level.Block is already imported so we can't import org.bukkit.block.Block

#

but yeah you're probably just running that code on a world that doesn't have a minimum coordinate of 0. That's why a method to get the minimum height was added (and you seem to now be using)

river oracle
#

How do you reasonably do reflection with nms?

arctic moth
#

did the authentication servers just go down?

#

i still have internet, just says its unreachable

#

or did i just get banned

#

lol

#

xD

#

thats a nasty spike that just appeared in downdetector

tender shard
arctic moth
#

wow i cant spell

humble tulip
#

Just turn on online mode

#

Off*

arctic moth
#

ik

tender shard
#

very philosophical and stuff

humble tulip
#

Hmmm

arctic moth
#

will /reload confirm reload chunks or keep them the sa,e

#

oh nope

tender shard
#

chunks stay loaded

arctic moth
#

very sus outage timing

#

ddos?

eternal oxide
#

probably a hosting or routing issue

tender shard
#

Core Backbone announced maintainence for exactly this time

#

so guess it was that

#

wait im stupid

#

it said 8 o clock UTC + 2:00

#

I read it as UTC 2:00

#

which would have been 10 minutes ago

#

?paste

undone axleBOT
tender shard
#

i'm currently trying to get rid of NMS code wherever possible. Does anyone know if there's meanwhile a solution get the namespacedkey for a biome without NMS? Currently doing it like this https://paste.md-5.net/ebigejodot.java

ornate patio
#

how can I force a horse into this pose

tender shard
#

that won't work for me

#

I need this to work with biome added by data pack

#

and the bukkit Biome is an enum

quaint mantle
tender shard
#

so no way that this will work for custom biomes

quaint mantle
#

thats terrifying

echo basalt
#

yeahh

ornate patio
quaint mantle
#

its terrible

#

the eyes

#

its scary

ornate patio
#

anyways how do i force the horse into the pose

echo basalt
worldly ingot
#

Sec. I'll peek at internal horse classes. I don't think that's something you can do with API atm

ornate patio
#

i've already set all that up

worldly ingot
#

You can do EntityAbstractHorse#makeMad(), but that will play the sound as well

ornate patio
#

thats fine

#

I'm already manually playing the sound

worldly ingot
#

There is #stand() which is without the sound but it's private

#

But yeah, that's the method you want probably

ornate patio
#

but yeah thanks

worldly ingot
#

Can request API for that on the JIRA if you'd like

#

?jira

undone axleBOT
ornate patio
#

sure that'd be nice

worldly ingot
#

There are probably some more API methods we can add in for horses

echo basalt
#

I might make a jira pull request to add navigation methods that just wrap NavigationAbstract

#

It's a common reason to use NMS

sterile token
#

What its Jira?

coral valve
#

Hey I'm trying to use the "libraries" setting in plugin.yml to add a dependency (stefvanschie's inventory framework) without shading it in.

plugin.yml:

libraries:
  - "com.github.stefvanschie.inventoryframework:IF:0.10.6"

build.gradle:

compileOnly 'com.github.stefvanschie.inventoryframework:IF:0.10.6'

However, at runtime I get the error:

java.lang.IllegalArgumentException: class com.github.stefvanschie.inventoryframework.gui.type.util.Gui is not provided by class org.bukkit.plugin.java.PluginClassLoader

I'm not shading in the dependency using shadowJar as it says online I don't need to do that. Any thoughts as I'm a bit unsure of how the libraries feature works as there's not much documentation on it.

eternal oxide
#

I have a feeling the library has to be in maven central.

tender shard
#

its on central

#

send the full stacktrace pls

sterile token
#

And what about maven trying to find a local dependency on a remote repo?

sterile token
#

Im really annoyed lmao

#

More than 1h trying to fix that shit

tender shard
#

you don't have it in your local repository if maven complains that it cannot find it remotely

sterile token
#

For some reason its looking for my library module on remote maven

tender shard
#

it's not in your local repository then. Or you fucked up your local repository path

eternal oxide
undone axleBOT
sterile token
tender shard
#

Run this:

 mvn dependency:get -Dartifact=com.jeff_media:MorePersistentDataTypes:2.3.1 -o
#

ofc replace the artifact string

#

if it says BUILD SUCCESS, its in your local repo

#

if not, it isnt

sterile token
#

ok

#

I have checked and the deploy was done on local repo

#

Im seeing all the files

sterile token
#

Shity maven shity life 😠

sterile token
#

Not even detecting mvn command on terminal

#

But if do it via interface it works!!!

ornate patio
#

restart IDE (if its integrated terminal) or restart terminal itself

#

if it didnt work just restart your pc it actually works for some reason

sterile token
#

I dont know what the fuck happen because its a multi-module but when im compiling the shit looks for the module on maven remote repo

#

😡

coral valve
sterile token
#

I will invalidate cache

ornate patio
#

Does anyone have the villager's AI when finding a workstation

#

it can navigate around obstacles pretty quickly

#

I need to copy paste that AI into my horse

#

and also be able to check if the block is reachable

eternal oxide
ornate patio
eternal oxide
#

Your error is being thrown here AutoTuneShopFormat.java:42

ivory sleet
#

first and foremost

#

use implementation for libraries that you shade (not compileOnly)

#

which +(you'll need shadowJar to shade and relocate)

#

so here, IF dependency should be implementation

coral valve
ivory sleet
#

Yes

#

because the class has to be included so that the jvm can load it during runtime

coral valve
ivory sleet
#

wut

coral valve
#

because the file size will be the same

ivory sleet
#

you need to use shadowJar as well

#

but implementation is for runtime+compile time dependencies

#

aka libraries

eternal oxide
#

he's using plugin.yml -libraries feature to download and load teh dependency on the server

coral valve
#

I'm not shading it in because I have this in my plugin.yml:

libraries:
  - "com.github.stefvanschie.inventoryframework:IF:0.10.6"
ivory sleet
#

yes but there's issues with that

#

if some other plugin also uses that dependency you might end up with linkage issues

#

hence, shading + relocating would be much safer

eternal oxide
#

I thought that was teh whole point of the libraries feature so plugins could have independant classloaders?

ivory sleet
#

yes, you can make it work by using a hacky workaround tho idk if spigot did that

#

(ik paper did it)

coral valve
#

yeah I thought you were supposed to use the library feature on shared librarys

ivory sleet
#

Idk

coral valve
#

let me test with spigot damn I thought I was using it im using paper let me check

eternal oxide
#

Thats what its design was for

ivory sleet
#

yeah

#

let me read the stash actually

#

?stash

undone axleBOT
eternal oxide
#

Definitely test on Spigot though.

ivory sleet
#

hmm the dependencies' classloader is actually a child of the plugin class loader if I read that correctly

#

thats odd

eternal oxide
#

Yes, from my understanding its plugin specific

ornate patio
#

what do you guys name your main file

#

Main.java or PluginName.java

eternal oxide
#

Main of course 😛

ivory sleet
#

ah nvm

ornate patio
#

im just built different then

quaint mantle
#

PluginNamePlugin

ivory sleet
eternal oxide
#

Honestly, its PluginName

ivory sleet
#

it doesnt prioritize

ornate patio
#

hold up

ornate patio
eternal oxide
#

lol yes

#

NEVER use Main

ivory sleet
#

Class<?> result = loader.getClassByName(name, resolve, description);
it should be
(name, resolve, description, this)

ornate patio
#

why

eternal oxide
#

Main is for applications. Plugins are extensions

ivory sleet
#

@coral valve in case you use spigot, that is where the issue origins from I believe ^

ivory sleet
#

tho I think on paper it might be fixed?

#

unsure

#

anyway shading + relocating is what I'd prefer regardless :3

ornate patio
#

what is relocating

#

shading is when you include the library in your in jar right

ivory sleet
#

yes

ornate patio
#

i'm assuming relocating is when you change the path of the library?

ivory sleet
#

relocating refers to when you change the package qualified name during compilation

ornate patio
#

oh

#

so compiler does that automatically

ivory sleet
#

for instance
com.conclure.www
to
org.spigot.shaded.conclure

ornate patio
#

got it

ivory sleet
#

where all classes from com.conclure.www will be relocacted to the latter

ornate patio
#

thanks

ivory sleet
#

and this also means all other classes that import classes from com.conclure.www will be updated with the correct qualified name for each class they depend on

ornate patio
#

yee

coral valve
ivory sleet
#

hmm

#

wait it happens on both?

#

what mc version do ya use btw

eternal oxide
#

I've had zero issues using libraries on Spigot

#

he's on 1.19

ivory sleet
#

okay

#

@coral valve

coral valve
#

yeah both spigot and paper

ivory sleet
#

can you do sth like

sout(com.github.stefvanschie.inventoryframework.gui.type.util.Gui.class)
#

just to see

coral valve
#

i used paper first and it broke

ivory sleet
#

onEnable

coral valve
#

alright

#

one sec

ivory sleet
#

oh also

#

sout the Class::getClassLoader as well

#

that will be interesting

coral valve
#

Alright I got this

@Override
  public void onEnable() {
    instance = this;      System.out.println(com.github.stefvanschie.inventoryframework.gui.type.util.Gui.class);
    System.out.println(AutoTune.class.getClassLoader());
...
}

I'll compile now and run

ivory sleet
#

try to sout the com.github.stefvanschie.inventoryframework.gui.type.util.Gui.class.getClassLoader() maybe?

coral valve
#

alright ill do that too

ivory sleet
#

cool

#

im curious

#

oh

#

@coral valve wait did u use getProvidingPlugin?

coral valve
#

no i didnt

#

ill also run on paper rn

ivory sleet
#

I see

#

then its IF's issue

#
    @NotNull
    public static JavaPlugin getProvidingPlugin(@NotNull Class<?> clazz) {
        Validate.notNull(clazz, "Null class cannot have a plugin");
        final ClassLoader cl = clazz.getClassLoader();
        if (!(cl instanceof PluginClassLoader)) {
            throw new IllegalArgumentException(clazz + " is not provided by " + PluginClassLoader.class);
        }
        JavaPlugin plugin = ((PluginClassLoader) cl).plugin;
        if (plugin == null) {
            throw new IllegalStateException("Cannot get plugin for " + clazz + " from a static initializer");
        }
        return plugin;
    }

they use this

#

** if (!(cl instanceof PluginClassLoader)) {**

#

might wanna create an issue on jira for this actually

coral valve
#

oh okay damn

Didnt convert the if classloader to string but

[14:47:58 INFO]: class com.github.stefvanschie.inventoryframework.gui.type.util.Gui
[14:47:58 INFO]: PluginClassLoader{plugin=Auto-Tune v0.13.2, pluginEnabled=true, url=plugins\Auto-Tune-0.13.1.jar}
[14:47:58 INFO]: java.net.URLClassLoader@6851978e

If you still want to see

ivory sleet
#

Okay it looks correct at least... good

#

this is a spigot bug

coral valve
#

thats on paper though

ivory sleet
#

yes but paper hasnt fixed it either

coral valve
#

oh okay

#

I might also create an issue on paper

eternal oxide
#

create it on Spigot and it will also go into paper

coral valve
#

okay

ivory sleet
#

yeah

coral valve
#

I have another question related to the libraries setting

I'm using mapDB as a dependency and its working really well. The only thing is the file size is like 12MB which is v big. If I try to use the libraries feature on spigot it loads mapDB's dependencies for every version like this:

https://paste.md-5.net/copiqedobe.md

I dont really need it because I'm just shading it in atm but not really sure why its doing that.

ivory sleet
#

Unprotesting if you want I can report the issue for you, or well if you wanna report yourself :3

coral valve
#

no you can I'm quite busy atm

ivory sleet
#

👍

coral valve
sterile token
#

What methods do you usually create when you are doing a menu api? And what methods for a paginated menu?

worldly ingot
#

get/setPage(), next/previousPage(), first/lastPage(), getPages()

sterile token
#

Because im overthinking a lot what mehotds to include

#

Idk why it take too much for just thinking what shit methods writing

#

doesnt happen to you?

worldly ingot
#

Well, use your API

#

If you're missing something, add it

sterile token
#

Also what's better comparing Inventory object or using holder?

#

Atm the im comparing full object

quaint mantle
#

you're asking Choco that

#

💀

sterile token
#

I dont know he is the one answering

#

😂

quaint mantle
sterile token
#

So in fact InventoryHolder is not use anymore

quaint mantle
#

inventoryholder should not be used because it is not intended for API usage

sterile token
#

Oh ok

#

So why is in the api?

river oracle
#

Wtf is an InventoryHolder never touched it

quaint mantle
sterile token
#

Oh ok

#

I just catch they are not designed for using them with GUIS

humble tulip
#

like a chest

river oracle
#

I figured lmao I just realized how stupid my concept was

humble tulip
#

or furnace

worldly ingot
#

^ You can instanceof check a BlockState to see if it's any type of InventoryHolder if you want

sterile token
#

But a chest isnt an inventory?

worldly ingot
#

No but it holds one

#

Hence, InventoryHolder

quaint mantle
#

why the fuck you type so fast

humble tulip
#

lul

#

ikr

sterile token
#

me?

quaint mantle
#

choco

humble tulip
#

no choco

worldly ingot
#

Why you type so slow

#

nerd

quaint mantle
#

wow

#

ok

worldly ingot
humble tulip
#

he even did this thing

river oracle
#

choco types like a mad man

quaint mantle
#

a very mad one

sterile token
#

yeah

worldly ingot
sterile token
#

If i find choco on street i dont think it and i start running

worldly ingot
#

Oh

#

Wrong keyboard

quaint mantle
#
 * @param instance         the instance to inject into
 * @param configuration    the class to retrieve the values from
 * @param translateStrings if true, all strings will be color translated
 * @param copyDefaults     if a field is missing, the field's current value will be copied
 * @param <T>              the type of the instance
 * @throws IllegalAccessException   if an unauthorized access is attempted
 * @throws IllegalArgumentException if the config is not compatible with the given instance
 * @see ChatUtil#translate(String)
 * @see KebabCaseConverter#fromCamelCase(String)
 */
@Unsafe(
    {
        "Uses reflection.",
        "If a SecurityManager is in effect, this is likely to error."
    }
)
public static <T extends ReflectiveConfig> void getAndInject(
    @NotNull T instance, @NotNull ConfigurationSection configuration,
    boolean translateStrings, boolean copyDefaults
) throws IllegalAccessException {
#

my docs >

worldly ingot
#

would be cooler if you put some whitespace between your @'s >:/

humble tulip
#

what is a securitymanager?

quaint mantle
#

stops reflection

#

and unwanted memory access

worldly ingot
#

I mean, yeah. It's purpose is to better enforce encapsulation, but yeah

sterile token
#

Lmao im going to start coding again my menu api

river oracle
#

me redoing my menu api for the fifth time until I stop going mad

quaint mantle
#

simply bad coders

river oracle
#

true

sterile token
#

true

quaint mantle
river oracle
#

I'm a beginner

quaint mantle
#

you're high intermediate

river oracle
#

how

quaint mantle
#

your codes pretty nice

river oracle
#

lmao okay

sterile token
#

imajin

quaint mantle
#

What

sterile token
#

Do you have any open source?

#

lib or something?

river oracle
#

nah I do though

#

my old menu api is pub but I'm redoing it atm

worldly ingot
quaint mantle
humble tulip
#

i mean if you really wanted to cant you just disable the security manager?

quaint mantle
quaint mantle
sterile token
#

Oh shity rust

quaint mantle
#

here

#

ill put my lib on github real quick

#

you're shitty

river oracle
sterile token
#

goated?

quaint mantle
#

mejor que todo

sterile token
#

Oh

river oracle
quaint mantle
humble tulip
quaint mantle
#

better than all

river oracle
humble tulip
#

that makes sense

river oracle
#

explain

quaint mantle
#

contract

#

you give me null, i give you null

#

you put in good word i make worth while, understand?

river oracle
#
    @Contract("_ -> this")

vs
@Contract("-> this")

quaint mantle
#

_ means any parameter

river oracle
#

ah k

quaint mantle
#

so whatever you pass, you will receive this

sterile token
#

Oh hly sh** InventoryDraEvent doesnt have an slot getter :mad:

river oracle
quaint mantle
#

yeah

river oracle
#

ahh k

humble tulip
#
    public void runLater(Runnable runnable, long delay) {
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                runnable.run();
            }
        }, delay);
    }
#

should i use a timer or the scheduler here?

#

it's to run an async task later

#

acc i think i'll stick with the timer since i want it to be independent of bungee/spigot

quaint mantle
#

not as shit as when i told you blocks could be null

river oracle
#

Imajin do you know much about reflection with nms

quaint mantle
#

nope

#

i dont mess with nms

river oracle
#

😭 pain my pain continues

sterile token
#

What diff between NMS and Packets?

humble tulip
river oracle
# humble tulip what u need

I need to know how to reflect with remapped or if there is an easy way to get access to the method names I need when they are re-obfuscated

humble tulip
river oracle
#

NMS contains packets

sterile token
#

I know what are packets i just didnt understand what was NMS

quaint mantle
humble tulip
#

^^ that site has the remapped and obfuscated names

quaint mantle
sterile token
#

Because spigot works calling obfuscated methods from minecraft-server right?

humble tulip
#

u need to use it when doing reflection since the methods are dynamically loaded

humble tulip
#

?stash

undone axleBOT
sterile token
#

stash?

#

Hmns sound sus

river oracle
#

its super useful

#

you can see how things are implemented into bukkit

sterile token
#

Oh ok

river oracle
#

it also contains all the api

#

and spigot patches etc

#

generally its just a stash of the code 👀

sterile token
#

what means "stash"?

humble tulip
#

how should ips be logged in a database?

sterile token
#

It doesnt get translated

humble tulip
#

oh

#

uhh it's like a pile?

#

kinda

#

basically a bunch of stuff

sterile token
#

I save ips as List<String> on mongo

humble tulip
#

what abt sql

river oracle
humble tulip
#

mongo is easy cuz i can store it as a list

sterile token
humble tulip
sterile token
#

you ill have to do smth like this:

ips-table:

  • id => AUTO_INCREMENT
  • userId
  • ip
#

When i saw that for doing simply things in SQL i need to do so much shit

#

I changed to mongo

humble tulip
#

thx

humble tulip
sterile token
#

Wait 1 sec

#

Im doing a diagram

humble tulip
#

i was thinking a users table
ID | UUID | NAME
and then ips table
ID| IP

sterile token
#

so you will endupt with this:

Users table

| userID | uuid | name |
| 1 | uuid | name |
| 2 | uuid | name |

IPS

| id | userID | ip |
| 1 | 1 | ip |
| 2 | 1 | ip |
| 3 | 2 | ip |
| 4 | 2 | ip |

humble tulip
#

but why does ips need an id column?

sterile token
#

Oh yeah id is optional

#

You can take out

eternal oxide
#

No need for an ID at all. I see no rason for two tables

sterile token
#

because you can:

ips => "SELECT * FROM ips WHERE id=SELECT * FROM users WHERE uuid=user uuid"

eternal oxide
#

UUID is already a Unique key

sterile token
eternal oxide
#

good point

#

then just index on UUID

#

both tables

sterile token
#

Its simply

#

UUID primary key

eternal oxide
#

oh I see, you could have multiple IP's from teh same UUID

sterile token
eternal oxide
#

you just have teh IP table use a key pair

#

UUID/IP

sterile token
#

So like this:

Users table:

  • uuid (Primary key)
  • id (Foreign key)

Ips table:

  • id
  • ip
#

Im not sure if called foreign key

#

I never learned tables links at all

humble tulip
#

hate maps that look like those

eternal oxide
#

naming conventions go brrr

sterile token
#

Yeja

#

Minion that for the ips?

mighty pier
#
                Bukkit.broadcastMessage("" + uuid);
                Player player = Bukkit.getPlayer(uuid);
                Bukkit.broadcastMessage("playername: " + player.getName());```why it do that tho?
sterile token
#

why the heck split ":"?

mighty pier
#

i have leaderboard

#

i got the value

#

like

#

uuid:value

#

and i split

sterile token
#

HMN

mighty pier
#

hmn

sterile token
#

Send full error

#

Because you are not even sending the error

#

😂

mighty pier
humble tulip
#

what is line 62

mighty pier
#

Bukkit.broadcastMessage("playername: " + player.getName());

humble tulip
#

player is null

mighty pier
#

yes

#

why

#

bukkit.getplayer doesnt work?

sterile token
#

Send full command

humble tulip
#

cuz they're not online OR the uuid is wrong

eternal oxide
#

only if it is a valid ONLINE player

humble tulip
#

dont send the command

#

send the create method

mighty pier
#

or maybe

#

other person

sterile token
#

If you are getting a uuid not connected you must use OfflinePlayer

mighty pier
#

ok

#

thank

sterile token
#

And for online players just use Player

#

Do:

OfflinePlayer target = Bukkit.getOfflinePlayer(UUID.fromString("string of uuid"));

#

@humble tulip could fix what you need?

sterile token
#

The relation

humble tulip
#

oh i'll figure it out

sterile token
#

Oh how?

#

Im curious

humble tulip
#

i remember learning about relations in ms access

sterile token
humble tulip
quaint mantle
#

everytime i try to rebuild my plugin artifact and load it up in cmd prompt it says there arent any plugins

undone axleBOT
quaint mantle
chrome beacon
#

And is your jar in the plugins folder

quaint mantle
#

Eh now it won't even run. Whatever, it's late, gn