#help-development

1 messages · Page 1303 of 1

pure dagger
#

yeah, but actually the Exception should never be thrown, so is it like the best thing?

#

its just that the method shouldnt be executrd if its full, you should check

sly topaz
#

that sounds like the job for a checked exception, in which case I'd go towards a custom FullPageException like Emily suggested but a Result enum or whatever is also a valid choice

slender elbow
#

an exception being thrown in that case means the caller failed to ensure the fullness of the page, and you throwing it is a more extreme response communicating that

#

it's okay to throw exceptions, people don't like it because a) unchecked exceptions are overused for custom exceptions, so it's easy to miss if you don't rtfm, and b) it "makes the code ugly"

pure dagger
#

yeah but it should not be thrown

#

if i make code im trying to make code that will never trigger that exception

slender elbow
#

but it isn't your code that triggered the exception

#

it's the user's

#

this is a meaningful exception

pure dagger
#

so you mean, like someone uses my code?

#

ok

sly topaz
#

you were saying earlier if they don't check isFull then that'd trigger this hypothetical exception, this is somthing you can't control so you have to respond to the consumer of your method in some way

slender elbow
#

I just mean the user of the Page class

pure dagger
#

who is user

slender elbow
pure dagger
#

someone else coding

#

?

slender elbow
#

whoever uses the Page class

sly topaz
#

whoever uses this piece of code, be it you or someone else

slender elbow
#

you

pure dagger
#

im using it

slender elbow
#

then you are the user of the page class

pure dagger
#

okay

worthy yarrow
#

I mean internally you could just call isFull on any operations related to adding things to the page

sly topaz
#

yeah but then it'd fail silently when it is full, which isn't a good design

pure dagger
#

ill just throw the illegalstate thing

worthy yarrow
#

Is that the point you guys are trying to make?

sly topaz
#

yes

worthy yarrow
#

ah

pure dagger
#

ok im throwing this thing

sly topaz
#

it all comes down to unchecked vs checked exceptions imo, you should give a read to some java guide about that

pure dagger
#

okayy

#
public class Page {

    private final List<Article> content;

    public Page(List<Article> content) {
        this.content = content;
    }

    public boolean isFull() {
        return content.size() >= 27;
    }
    
    public boolean hasIndex(int index) {
        return index>=0 && index<content.size();
    }
    
    public void addArticle(Article article) {
        if (isFull()) {
            throw new IllegalStateException("The page is full");
        }
        content.add(article);
    }

    public void removeArticle(int index) {
        content.remove(index);
    }

    public void setArticle(int index, Article article) {
        if (!hasIndex(index)) {
            throw new IndexOutOfBoundsException("Index of " + index + " is out of bound");
        }
        content.set(index, article);
    }

}
``` what do you think
minor urchin
#

no

wraith delta
#

In the game when i do / to type a command for my plugin it shows up as plugin:command, even if i use alias because the alias is the same as the plugin name. what identifies that the plugin name is that? which i could change and it not affect the jar

wet breach
#

there is spot to put the name of the plugin. This is what is used and not what you physically name the jar

wraith delta
#

Thanks

thorn isle
#

i love physically naming and putting pottery jars on my server

echo basalt
#

@torn shuttle funny situation

#

Got a digi sms saying my address is now available for their service

#

2 mins later my meo internet died

#

Hasn't been back since

#

It's been 2 hours

torn shuttle
#

that's what you get

echo basalt
#

Fucking blackhole

torn shuttle
#

I haven't switched out of digi yet despite the 60h of outage I've had in 1 week

#

just because the other dudes all want 2 year contracts and I might move in january

floral cloak
#

@tepid coral check dms

short pilot
#

in context of happy ghast, how can you check if a player dismounting is the player that is "driving" the happy ghast? Does vehicle class have index slots for each possible seat or something?

fresh timber
#

can anyone help?

alpine citrus
#

hey guys, question, is it possible to play MC offline on a server, bypassing the auth server to develop offline?

fresh timber
alpine citrus
#

i just spent like 2 hours on 3rd party clients

#

booted right up

thorn isle
buoyant viper
#

minecraft is pay to play sadly..

#

offline mode is a lie spread by the global elites to give us peasants false guidance

alpine citrus
#

🙁

sullen marlin
#

Try and see?

placid rivet
#

can you set a repair cost after 1.21? i want my items to always cost 6 levels and setRepairCost is deprecated

placid rivet
#

what do you mean by note

#

'setRepairCost(int)' is deprecated since version 1.21 and marked for removal
that's the error i get, where can i find the note?

chrome beacon
placid rivet
#

oh, okay

#

ty

chrome beacon
#

and if you want the note in Intellij open the maven/gradle tab and click the download button

#

and download sources and documentation

chrome beacon
#

?jd-s

undone axleBOT
charred blaze
#

do TaskTimers last through a server restart?

hazy parrot
#

No

pure dagger
#

why cant i put "\n\n"

grand flint
#

bc its not a vanilla thing

pure dagger
#

why can i do 1 ?

#

how to do that

grand flint
#

oh idk i just made it up tbh

pure dagger
#

i can put 1 \n but not 2

#

more than 1 will be just the same as 1

slender elbow
#

put where?

pure dagger
#

as a string

#

i do

#

i mean

#

player.sendMessage("something**\n\n**something");

#

will just do 1

pseudo hazel
#

wait that works?

slender elbow
#

is that a question? because it should work fine and be two newlines

#

you can put as many newlines in any string as you want, whether the thing trying to render that text supports it nicely is a different question

pure dagger
#

;-;

#

maybe i missed something

pseudo hazel
#

I just send multiple messages haha I didnt know the chat window supported this format

pure dagger
#

what d oyou mean

brittle geyser
pseudo hazel
#

I meant I just do player.sendMessage("text"); player.sendMessage(""); etc

pure dagger
#

ok adding a reset

#

between

#

works

pliant topaz
#

weird

#

afaik the string blocks should work too, but i am not completely sure

#

tho that raises the question if it would, again, not account for thr second new line

trim depot
#

how to get channel using NMS with spigot mappings on 1.21.8?

sullen marlin
#

?xy

undone axleBOT
trim depot
#

Well i dont know how to make player injection anymore because i cant get channel normaly anymore

#

I tryed getting it using PlayerConnection but i just couldnt find it

young knoll
#

There are tools for this like packet events and protocollib

#

Otherwise I don’t remember how you access it now :)

#

The joys of NMS

solar slate
#

Dos anyone have ideas on what I can add to my permissions plugin? So far it includes all the base elements like groups, per-player permissions, group prefixes, negative permissions, and GUI's for group and player editing. Yes it does integrate with Vault as well. I'm mainly looking for the most commonly used features in permissions plugins, but any suggestions are appreciated!

young knoll
#

Web editor

solar slate
# young knoll Web editor

This is a good idea, but it definitely last on my list as it will most definitely be the MOST complicated compared to other additions

left jay
#

question, how would i go about detecting when a player puts down their shield? i already have this for a player putting their shield up

young knoll
#

What if it’s in their main hand

#

Or disabled because they got hit with an axe

left jay
#

well for my custom item system, that cant happen

#

for both cases

young knoll
#

I think the easiest way would just be a runnable that checks Player#isBlocking every tick

frail pilot
# trim depot how to get channel using NMS with spigot mappings on 1.21.8?

Did this for test purposes few month ago


    private void injectListener(Player player) {
        final CraftPlayer craftPlayer = (CraftPlayer) player;
        final ServerGamePacketListenerImpl packetListener = craftPlayer.getHandle().connection;
        logger.info("Retrieve the connection");
        final Connection connection;
        try {
            final Field connectionField = ServerCommonPacketListenerImpl.class.getDeclaredField("e"); //connection
            connectionField.setAccessible(true);
            connection = (Connection) connectionField.get(packetListener);
        } catch (ReflectiveOperationException e) {
            return;
        }
        logger.info("Extract the channel");
        final Channel channel;
        try {
            final Field channelField = Connection.class.getDeclaredField("n"); // channel
            channelField.setAccessible(true);
            channel = (Channel) channelField.get(connection);
        } catch (ReflectiveOperationException e) {
            return;
        }
        logger.info("Inject " + player.getName());
        channel.pipeline().addBefore("packet_handler", "custom_packet_reader", new CustomPacketReader(logger));
    }

    private static class CustomPacketReader extends ChannelDuplexHandler {
        // Implement it yourself
    }
young knoll
#

Ah right they made it private

frail pilot
#

Yeah

left jay
#

hey so im trying to force the player to stop putting up their shield when this method gets triggered, how can i do that?

public void guardBreak(Player player) {
        player.sendTitle("GUARD BREAK!", "", 10, 40, 20);

        ItemStack shield = player.getInventory().getItemInOffHand();
        if (ItemSystem.getItemTypeFromItemStack(shield) == ItemType.SHIELD) {
            player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));

            Bukkit.getScheduler().runTaskLater(nmlShields, () -> {
                player.getInventory().setItemInOffHand(shield);
            }, 1L);
        }

        player.setCooldown(Material.SHIELD, 40);
        damageCooldowns.put(player.getUniqueId(), damageCooldowns.get(player.getUniqueId()) + 40);
    }```
fresh timber
#

I am using

player.getWorld().strikeLightning(player.getLocation());

(I have also tried World#strikeLightningEffect())

to, well, strike lightning. The only problem is absolutely nothing happens. No fire on the ground, no damage to the player when I use .strikeLightning, obviously no lightning visuals, no sound, etc. I have debugged to the moon and I'm absolutely sure that the code reaches this point.

~~The only possible culprit I can think of would be that I set players weather using things like

player.setPlayerWeather(WeatherType.DOWNFALL);
```~~
EDIT: Just tested after resetting players weather and this does not fix it.

Does anyone know how to fix this?
wraith delta
#

import org.bukkit.block.data.Attachable;hmm, why isnt it found in 1.21

sly topaz
sly topaz
#

try in a clean server just to be sure

#

if it works there then you at least know it is just one of the plugins messing with your logic

wraith delta
fresh timber
#

like luckperms, placeholder api, multiverse

sly topaz
sly topaz
#

make sure you don't have any transitive dependencies overriding your declared spigot version

wraith delta
#

hm, this import worked instead import org.bukkit.material.Attachable;

sly topaz
#

that is the wrong Attachable

#

just look at the dependency tree and see if any of your dependencies isn't accidentally pulling an older spigot version

echo karma
#

can someone help me , clearlag plugin always clear my minecart i want to disable it but idk how to

sly topaz
lapis hinge
#

Hello, I am a PHP Developer, I have developed numerous minecraft bedrock factions servers. I got bored and decided to learn how to make spigot plugins. For my java factions core, i want to know how to make custom enchants?

In bedrock, you can essentially just extend the Enchant class and make a new enchant? Anyone got any github repo or code that shows how I can make enchants, alot of the ones online are super complicated and hard to look at.

sly topaz
wraith delta
lapis hinge
fresh timber
lapis hinge
#
108 => new IronTouch("Iron Touch", Rarity::COMMON, ItemFlags::PICKAXE, 0x0, 5),

foreach($list as $id => $enchant) {
            EnchantmentIdMap::getInstance()->register($id, $enchant);
        }```
all u have to do on pocketmine
#

😭

fresh timber
lapis hinge
#
public function getSlotsFilled(Item $item) : int {
        $enchants = 0;
        foreach($item->getEnchantments() as $enchantment) {
            $enchantment = $enchantment->getType();
            if ($enchantment instanceof raveEnchant) {
                $enchants++;
            }
        }
        return $enchants;
    }```
#

only downside is that php is a trashy language so the optimization isnt as good as java.

lapis hinge
#

thats what im going to do

lapis hinge
#

maybe i cache nbt -> enchant class
and then foreach all the enchant nbts and then enchant->trigger ??

sly topaz
#

you don't really deal with NBT on the bukkit side of things

#

while doing the lore thing is easier, it often ends up more complex if you want to support anvil as well as just showing it inside an enchanting table

#

if you still want to do it this way, then you'll want to use PDC to track the enchantment on items

sly topaz
lapis hinge
#

You dont use NBTs??

sly topaz
#

the closest thing to dealing with NBT is PDC, which is an abstraction over it but only for custom values

lapis hinge
#

ye custom nbts

#

So essentially i check the items lore for enchants?

sly topaz
#

if that's the way you want to go about it, yes

lapis hinge
#

what is the performance penalties for doing this method?

sly topaz
#

there shouldn't be any performance penalties for something that simple

lapis hinge
#

is it igsinificant?

lapis hinge
#

50 players checking, 5 items each scanning for lore.

#

java is async on default tho right?

#

this feels so weird, i dont have to worry about making my code overly optimized

sly topaz
#

it is not asynchronous, no. But the way it works is quite different since you wouldn't have to constantly scan the lore or anything like that, you'd just add it to the lore when giving the item stack to the player and then check in the interact event whether they have the given enchant and apply your enchantment effect

lapis hinge
#

oh.

#

Also for color codes, does java use "&"?

#

Or do I have to use ChatColor

lapis hinge
sly topaz
#

you can make use of that if you parse it with ChatColor.translateAlternateColorCodes('&', message), you can make an utility function like:

public static String color(String message) {
  return ChatColor.translateAlternateColorCodes('&', message);
}
// Usage
somePlayer.sendMessage(color("&e&lThis is a bold yellow message"));
lapis hinge
#

like for example java private void handleLifesteal(Player attacker, Player victim, ItemStack weapon, double damage) { if (!CustomEnchantmentManager.hasEnchant(weapon, LifestealEnchant.class)) return;

sly topaz
lapis hinge
#

im asking if i should check if the item has the enchant before or after calling the enchant event

#

like uh

sly topaz
#

I mean, the item should already have the enchantment in the lore if that is what you mean

lapis hinge
#

eh its fine whatever

#

thx for the help preciate it

sly topaz
lapis hinge
#

wow its ok

sly topaz
lapis hinge
#

i got somewhat of a base now

sly topaz
#

the last example it made is pretty much what I was writing

lapis hinge
#
    public static ItemStack addEnchant(ItemStack item, String enchantName, int level) {
        CustomEnchant enchant = ENCHANT_REGISTRY.get(enchantName.toLowerCase());
        if (enchant == null || item == null) return item;

        level = Math.max(1, Math.min(enchant.getMaxLevel(), level));

        item = removeEnchant(item, enchantName);

        ItemMeta meta = item.getItemMeta();
        List<String> lore = meta.hasLore() ? new ArrayList<>(meta.getLore()) : new ArrayList<>();

        String colorCode = LEVEL_COLORS[Math.min(level - 1, LEVEL_COLORS.length - 1)];
        String enchantLore = ChatColor.translateAlternateColorCodes('&',
                colorCode + enchant.getName() + " " + toRoman(level));
        lore.add(enchantLore);

        meta.setLore(lore);
        item.setItemMeta(meta);
        return item;
    }

    public static ItemStack removeEnchant(ItemStack item, String enchantName) {
        if (item == null || !item.hasItemMeta() || !item.getItemMeta().hasLore()) {
            return item;
        }

        ItemMeta meta = item.getItemMeta();
        List<String> lore = new ArrayList<>(meta.getLore());

        lore.removeIf(line -> ChatColor.stripColor(line).trim().startsWith(enchantName));

        meta.setLore(lore);
        item.setItemMeta(meta);
        return item;
    }

    public static boolean hasEnchant(ItemStack item, String enchantName) {
        if (item == null || !item.hasItemMeta() || !item.getItemMeta().hasLore()) {
            return false;
        }

        for (String lore : item.getItemMeta().getLore()) {
            if (ChatColor.stripColor(lore).trim().startsWith(enchantName)) {
                return true;
            }
        }
        return false;
    }```

this is what i kind of made out? most of it is kinda copied from an old repo
#

im confused why using nbts wouldnt be better tho lol

sly topaz
#

though you don't get that either by using the lore but alas

lapis hinge
#

i see

#

@sly topaz last thing, when reducing players heart here? what is the best function to use?

#

i see there is a damage function

#

the software i used on bedrock i would just do setHealth(health - 2)

sly topaz
#

damage will deal actual damage, meaning it will respect any damage reduction modifier (that is, armor, enchantments, etc)

#

setHealth won't, but you can do that too

wet breach
tall dome
#

Hi!
I've noticed that org.bukkit.plugin.SimplePluginManager class is marked as @Deprecated(forRemoval = true) but PluginManager isn't. What will SimplePluginManager be replaced by?

chrome beacon
#

As for Paper you should ask them

tall dome
#

My bad, it's marked in Paper

wooden bay
#

ye

solid wave
#

anyone help me pls

#

my player data was lost when i join a sever by bungecoord

#

idk how to fix that

chrome beacon
solid wave
#

i did

chrome beacon
#

is online mode enabled on the Bungeecord

solid wave
#

i can join the sever

#

but the player data was lost

chrome beacon
#

you can do that with offline mode as well

#

anyways double check that bungeecord is set to true in the spigot.yml

#

and that you're connecting through the Bungeecord and not directly to the server

young knoll
#

What’s that other thing

#

IP forwarding?

wet breach
#

what you can do is find your offline mode UUID and then find the corresponding file and update the uuid of said file to be online ones

solid wave
#

how to find uuid

#

are the files in playerdata is uuid?

chrome beacon
#

The uuids should not change when the proxy is setup correctly (ip-forwarding enabled). Bungeecord can pass the ip and online mode data to the server

#

Which is why I was asking the questions about the setup earlier

solid wave
#

ik

#

and how can i fix

#

idk where to find offline mode uuid

chrome beacon
#

Was your server in offline mode before you added the Bungeecord

chrome beacon
#

So all of your save data is in offline mode form?

chrome beacon
#

Do you want to convert them to enable online mode

solid wave
#

my sever still offline mod

chrome beacon
#

yeah but the Bungeecord probably isn't

wet breach
solid wave
solid wave
#

and the sever that lost data is offline

chrome beacon
#

set bungeecord to offline mode

wet breach
#

ah ok so I see what happened

solid wave
#

oh

wet breach
#

you directly connected to the server then, which caused offline UUID to generate

solid wave
#

sao i just need to change bunge to offline mode?

chrome beacon
#

yes

wet breach
#

instead of connecting through proxy, and then when you connected through proxy it was online UUID. Either way, it is an easy fix to get your data back

solid wave
#

dang

#

many yt tutorial say i need to change to online mode

#

that why

wet breach
#

since the data was never deleted or removed that is

chrome beacon
solid wave
#

yes

#

it's work

#

thank yall

wet breach
solid wave
#

silly mistake lol

robust helm
#

Is there an event for an item changing its slot in an inventory with something like getOldSlot() and getNewSlot()?

pseudo hazel
#

its usually a combination of multiple events

brittle geyser
sly topaz
#

InventoryClickEvent should fire for 90% of the slot changes

#

or if you're not shy to internals, you can hook into the Slot object which will allow you to do things when it changes

pure dagger
#

How much memory does an empyty class instance take

brittle geyser
pure dagger
#

🤔

brittle geyser
# pure dagger How much memory does an empyty class instance take

In most languages, an “empty” class instance is not actually size-zero — there’s always some overhead for bookkeeping.
If we take Java as the example (since that’s your main language), here’s what happens under a 64-bit HotSpot JVM with compressed OOPs (ordinary object pointers) enabled:

  • Object header:

    • Mark word — 8 bytes (stores hash code, GC info, lock state)
    • Class pointer — 4 bytes (pointer to class metadata; 8 bytes without compressed OOPs)
  • Padding/alignment: JVM aligns objects to 8-byte boundaries.

  • No instance fields — so only the header + padding remain.

That means:

Mark word   :  8 bytes
Class ptr   :  4 bytes
Padding     :  4 bytes
-----------------------
Total       : 16 bytes

So an “empty” object in Java is usually 16 bytes.

On other platforms or with other settings:

  • Without compressed OOPs → usually 24 bytes.
  • 32-bit JVM → usually 8 or 12 bytes (depends on alignment).
  • C++/Rust/Go → an empty struct/class can be 0 bytes at the type level, but the language may still assign 1 byte or more when placed in memory, or add vtable pointers if polymorphism is involved.

If you want, I can show you how to actually measure this with Instrumentation.getObjectSize() in Java to see your exact JVM’s value.

pure dagger
#

Wow you typed that really fast

brittle geyser
#

xd

pseudo hazel
#

sure ,but is it correct?

grim hound
grim hound
solar slate
#

doesn't look like a different plugin throws it

grim hound
grim hound
# grim hound

SystemKamer depends on PoliceSystem, however, it does so with lazy loading, so no issue should ever occur

solar slate
#

Lazy loading?

brittle geyser
#

what is SystemKamer plugin?

grim hound
brittle geyser
#

what it does

grim hound
solar slate
#

that would make sense why it says it's already enabled

grim hound
#

both of these

brittle geyser
grim hound
#

ah like

#

it just instantiates classes depending on PoliceSystem

grim hound
#

does not reference it in the main class

brittle geyser
#

are you trying to create new plugin instance?

grim hound
#

no

#

so it shouldn't throw it

brittle geyser
#

show code

solar slate
#

Is it used as a dependency?

grim hound
solar slate
#

If it's used as a dependency why are you having to call the onEnable() method? Just having a hard time understanding the use case

brittle geyser
#

PoliceSystemPlugin:185

grim hound
brittle geyser
grim hound
solar slate
#

I assume the error at 185 is because you're already calling the onEnable() method from another plugin? (As long as im understanding this correctly)

grim hound
#

cuz for circular dependency

brittle geyser
grim hound
brittle geyser
#

maybe you forgot to replace new build

grim hound
#

a lot of field decl

grim hound
solar slate
torn shuttle
#

ai needs to stop doing this

wooden bay
#

what does bro think about 🤔

nova notch
#

obviously it has to think about all the flaws of your prompt so that it can tell you you're doing everything perfectly

torn shuttle
#

if it wasnt' for the fact I'm doing DOTS in unity right now I wouldn't even use ai

#

I'm just not familiar enough with this entire ecossystem

pure dagger
#

what does that mean

#

do players always have an inventory open ?

ivory sleet
#

I men the client always keeps tracks of its own items you know

pure dagger
#

What does that mean

torn shuttle
#

I do not like var in C#

#

it's a bad feature made for bad people

ivory sleet
#

whats bad about it, out of curiosity

torn shuttle
#

vs

        GameObject temp = Instantiate(prefab);
slender elbow
#

does the statement "it's bad in C#" imply "it's not bad in Java"?

torn shuttle
#

no, I don't even acknowledge it as a real feature in java

#

if I don't see it it doesn't exist

ivory sleet
torn shuttle
#

unless you've only ever vibecoded or are literally ai I can't imagine how not knowing what type a variable is wouldn't be a massive problem

#

if you don't know then you must look it up, you can do hardly anything without knowing what the types you're working with are

ivory sleet
#

yea, more meant, let's say you already know the type from a function parameter

#

then you're maybe invoking List#sublist(begin,end)

#

and store that in a variable

torn shuttle
#

sure, that can work if you are literaly writing the code right now

#

it's not going to fly when it's 3 years later and you were using two massive apis

proud basin
ivory sleet
#

i mean sure, id just say depending on context, it can be more fine to utilise var as a means to shutdown verbosity

ivory sleet
torn shuttle
#

var a = ab(c);

#

mmmh

#

look how few letters I had to use

#

very efficient

ivory sleet
#

Im sure you could use fewer

torn shuttle
#

so true

#

you could even use emojis

proud basin
torn shuttle
#

var 🚣‍♂️ = 🪵 ( 🏃‍➡️ );

#

are we reaching peak efficiency yet

ivory sleet
#

what if, no symbols at all are used

#

mind to mind telepathy

torn shuttle
#

=;

echo basalt
#

@lost matrix I need an opinion

torn shuttle
#

yw

echo basalt
torn shuttle
#

when'd you start making emojis out of selfies

remote swallow
echo basalt
young knoll
#

You could just

#

Not use var

echo basalt
#

var bad

slender elbow
#

but what is the type of bad?

#

i can't read it

torn shuttle
slender elbow
#

ai can suck my left nut

#

followed by the right one

young knoll
#

Tell the ai not to use it

torn shuttle
#

sounds like you'd have to pay for premium access for that type of treatmnet

young knoll
#

And if that doesn’t work idk, learn to write your own code

torn shuttle
#

the reason it annoys me is because I am rewriting it

#

I just didn't know the dots pipeline for unity so I had it generate one for me

#

if I wasn't going to touch it anyway it wouldn't bother me

#

also this pipeline is pretty neat

#

about 75k trees and shrubs and I'm cruising at 300 fps

#

nice

#

also much nicer than godot, unfortunately

young knoll
#

Skill issue

torn shuttle
#

I kinda wish

#

godot has some really nasty overhead for c# internally

#

there's like a whole thing about it

#

plus it only has extremely basic gpu instancing for meshes so you've basically invited to do everything from frustum culling to occlusion culling and lod

young knoll
#

Yeah but unity did that one bad PR move

torn shuttle
#

which to be clear is not why I stopped using godot, I was actually halfway thorugh writing my own systems for that

#

no, the reason I gave up on it is because you can't even get a decent profiler for it

#

I was having to profile through my ide

#

literally the godot wiki on their profilers

#

very funny

#

had a good laugh

echo basalt
#

🤔 How can I run a task for both active and inactive data, on a single worker node in a schedule, with fault tolerance

torn shuttle
#

sounds like unit testing

echo basalt
#

throwback to that one time I used weakreferences wrong at work and you'd just take damage (even on creative) every time GC hit

torn shuttle
#

weakreferences for weak people

#

seems about right

echo basalt
#

ah yes strong people have memory leaks

torn shuttle
#

means I had memory to leak

#

strong people rewrite projects from godot to unity to hit 400 fps

#

💪

plush rivet
#

If I have a Block in NMS, how do I go about changing the Hardness and Blast Resistance of the block?

mortal hare
#

bruh

#
    private void ignoreBranch(final JsonParser parser) throws IOException {
        JsonToken token = parser.nextToken();
        if (!token.isStructStart()) {
            return;
        }
        int depth = 1;
        while ((token = parser.nextToken()) != null) {
            if (token.isStructStart()) {
                depth++;
            } else if (token.isStructEnd()) {
                depth--;
            }

            if (depth == 0) {
                break;
            }
        }
    }

i've wrote this only to found out that parser.skipChildren() exists

torn shuttle
#

man

#

it's so hard to get into data oriented programming after a decade of oop

#

not impossible or anything but I just keep finding new ways of recycling structs that I'm just not used to

buoyant viper
#

just Code

torn shuttle
#

I've been programming for absolutely crazy amounts of time these past few days

weary folio
#
@EventHandler
    public void OnPlayerJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        new BukkitRunnable() {
            @Override
            public void run(){
                String path = "players." + player.getUniqueId() + ".gui";
                List<ItemStack> items = (List<ItemStack>) plugin.getConfig().get(path);
                List<String> types = new ArrayList<>();


                for(ItemStack item : items) {
                    if (item == null) { return; }
                    NBT.get(item, nbt -> {
                        String type =  nbt.getString("type");

                        types.add(type);

                        if(type.equalsIgnoreCase("speed")) {
                            player.setWalkSpeed(0.3f);
                        }
                    });
                }
                player.sendMessage("5");
                if(!types.contains("speed")) {
                    player.setWalkSpeed(0.1f);
                }

            }
        }.runTaskTimerAsynchronously(plugin, 20, 0);

    }

i have this code here that works perfectly fine up until "player.sendMessage("5");"
where it does nothing after the for loop, what do you think i could be doing wrong to the point where no code inside of public void run() executes past the for loop?

mortal hare
#

what's the data type of NBT in this case?

#

have tried printing a debug message inside for loop? maybe all items are returned as null?

#

how does yaml file contents look like too

weary folio
weary folio
weary folio
weary folio
fresh timber
#

thing I put in a while ago so natural lightning strikes don't happen :)

#

ty lol

#

why does this crash the server?

                LightningStrike bolt = player.getWorld().strikeLightningEffect(player.getLocation());
                bolt.setVisibleByDefault(false);
                player.showEntity(getPlugin(), bolt);

It spams errors but I can't seem to find the newest error so here is the log (attached, very long error)

chrome beacon
#

Aka an infinite loop

torn shuttle
#

that moment when you unironically create a class called SystemManager

#

and nearly createa a SystemManagerFactory

weary folio
#

send the whole file

weary folio
torn shuttle
#

it's not a power the jedi would teach you about

tired elbow
#

Hi

#

I'm having a problem working with a node system

#

The problem is this. I'm creating a node that has to do with the advance done, but I've already created its constructor, and now when I try to create an object or node with it, I get an error.

weary folio
tired elbow
#

I don't know if I'm mixing methods and things that have nothing to do with each other since I'm a junior, but I learned basic things.

weary folio
fresh timber
weary folio
tired elbow
#

hi

#

look at this💀

#

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;

public class PlayerMoveNodo implements Listener {

public PlayerMoveNodo(PlayerMoveNodo event) {
    event.PlayerMoveNodo(new PlayerMoveEvent(null,null,null));
}

@EventHandler
public void PlayerMoveNodo(PlayerMoveEvent event){
    Player player = event.getPlayer();
    event.setCancelled(false);
    event.getPlayer();
    event.getFrom();
    event.getTo();
}

}

#

You understand the form of my code, because I don't

nova notch
#

...what in the hell

pliant topaz
#

also, if the event hasn't been cancelled yet, you do not have to set cancelled to false.
The last 3 lines in your method do not do anything, they return the player, the location from where the player moved and location of where they moved to, but the return value of these methods is ignored and not e.g. set to a variable

#

and one last thing (this is personal preference), in java the most used naming convention is classes: MyClassName
methods/variable: myMethodName

tired elbow
#

Thanks and I'm here to explain to you about the canceled event XD

#

When I create an object with that class it cannot access the events

#

So I put variables of the events

pliant topaz
#

You do not need to create an object of an Event Listener

tired elbow
#

That is, use PlayerMoveNodo event1 = new PlayerMoveNodo();

#

Ok but I want to create nodes with OOP

#

POO**

mortal vortex
#

BAHAHAH POO

#

bahahaha

pliant topaz
#

That is not what you are supposed to do with an event listener, a listener listens to a specific event on the server and executes your logic, there should only exist one instance of a listener. You register it in your onEnable:
Bukkit.getPluginManager().registerEvents(new YourListenerClass(), this)
(this referring to the actual plugin instance)

tired elbow
#

Thanks, but how will I make my node system?

#

I want to do something similar to Visual Bukkit

#

I will find a solution on my own.

pliant topaz
#

I would not recommend creating something like visual bukkit for learning. In my case i created many small plugins to get into on how to use the api which helped a lot

pliant topaz
tired elbow
#

You know, little blocks of code that run from top to bottom.

#

How to scratt

#

Scratch

pliant topaz
#

Do you mean inheritence?

tired elbow
#

Yeah

#

POO

#

I know him as POO

pliant topaz
#

interesting name haha, but why would you need multiple instances of a listener? i dont really get your whole intention in what you are trying to achieve, sorry

nova notch
tired elbow
#

First of all POO means

pliant topaz
#

wait, i think theres a resource for thath

tired elbow
#

Programación orientada a objetos

pliant topaz
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

tired elbow
pliant topaz
#

Theres a few useful sources you can check out :)

tired elbow
#

And I've been learning on sololearn

#

Well, what about the nodes

#

I want to make a basic API to understand and more than understanding with nodes

pliant topaz
#

I dont know if an api for starting is not a little much for the beginning, but you can give it a try

tired elbow
#

It was that or a minigame.

pliant topaz
#

I think a minigame will be easier

tired elbow
#

I also have other projects like a mod

pliant topaz
#

Or even just a simple spawn protection plugin

tired elbow
#

Programación
Orientada a
Objetos
POO

nova notch
#

we heard you the first 5 times

tired elbow
#

XD

#

In case it's not clear

pliant topaz
tired elbow
#

Sure bro, I based my code on that thanks

pliant topaz
#

For learning java in general the same applies, small, but different applications make a good learning foundation. Bigger projects right at the start can be a bit much when you do not have too much experience with java and the api itself

tired elbow
#

Oh sure, the furthest I got was when I added a mob with Geckolib just by looking at the wiki because no tutorial was updated to my version 🥶🥶🥶

#

What's more, I have the entity and it flies and shoots air balls.

wet breach
#

But then again that is your average free plugin for you lol

pliant topaz
#

lmao

tender shard
pliant topaz
#

We had to control a atomic cleanup robot with greenfoot. There was much swearing against it from my side...

#

It hung up, hat no auto-import and was stuck on java 8 😭

lost matrix
young knoll
#

Reminds me of what was basically my first programming experience back when I was like 11

#

Moving a little robot using what was basically scratch but even more basic

grave plover
pliant topaz
#

I dont really get why Wirtschaftsinformatik is its own field tbh

pure dagger
#

what is this description...

#

how do i learn something from these docs... am i dumb

slender elbow
#

dokumention :stonks:

pure dagger
#

-_- what

#

what the hell is that class for

robust helm
#

i think its used to represent a registered storage provider

#

not sure though

pure dagger
#

service

#

bro

#

u ruined

#

that

solid wave
#

my geyser stop working after i put my sever in bunge

#

anyone know why?

chrome beacon
#

Did you setup Geyser on the Bungeecord

#

if not you need to do so since all players should be connecting through that and not directly to the server

solid wave
#

but it still wont work

chrome beacon
#

and what happens when you try to connect

solid wave
#

idk

#

i use/plugins

#

and see the geyser red

chrome beacon
#

/plugins shows plugins on the server

#

not Bungeecord

solid wave
#

oh

chrome beacon
#

also a red plugin indicates somethings wrong, check the log for errors during startup

#

You do not need Geyser on the server ^

solid wave
#

which sever

#

u mean only the bunge and the lobby sever need it?

chrome beacon
#

No

#

Only Bungee

solid wave
#

oh ok

chrome beacon
#

Refer to the setup guide I linked

solid wave
#

it's work

#

tysm

lean pumice
#

@lost matrix srry for the ping, I remember you made a guide on the logic of how to create a well-made minigame plugin, but I can't find the post anymore.

worthy yarrow
#

That may have been illusion

robust helm
worthy yarrow
#

I swore it did

#

@lean pumice

#

(sorry if I double pinged kek)

robust helm
#

i swore afaik it didnt

worthy yarrow
#

I feel like I've been pinged from them before

#

who knows, discord will be discord

young knoll
#

Let’s find out!

#

@worthy yarrow is smelly

worthy yarrow
#

No it does not

worthy yarrow
#

It'd be cool if you could edit a reply ping

lean pumice
fickle spindle
#

can i make like that on Tab without a command it doesn't give you all the players name but it give you some words i type an argument in a command?

thorn isle
#

yes

fickle spindle
thorn isle
#

implement TabCompleter

fickle spindle
young knoll
#

What

fickle spindle
#

Like to make chat commands

fickle spindle
young knoll
#

Don’t think so

fickle spindle
#

Okay thanks anyways

shadow vale
#

?nms

fickle spindle
#

The site isn't loading maybe because I'm to scared for nms

eternal oxide
#

@tender shard fix your site!

thorn isle
#

command completions are only sent for commands now

#

you used to be able to eavesdrop on exact keypresses in the chatbox since the client would send a tabcomplete request for every keypress in chat, command or not, before

clear elm
#

how can i make a plugin which uses vault a standalone economy plugin

thorn isle
#

what now

cobalt drift
#

Hi, whats the best and easiest way to get the Base64 representation of an itemstack?

thorn isle
#

serialize to bytes and then encode the bytes into base64

#

what do you need a base64 representation specifically for, though? if you're storing it in a database as a string, the snbt string is probably better; the bytes can also be stored as a blob

#

if you're storing it in a config, json/snbt is much better than base64

#

if it's just on disk in a file, raw bytes are fine

lilac dagger
#

i just put the json directly in my sqlite/mysql database

#

and it works just fine

grand flint
#

it does and its so shit

lilac dagger
#

i have a settings map and i convert it to json and store it

grand flint
#

bo point kf ever using sql

lilac dagger
#

it's so nice that it work

grand flint
#

if ur storing full json

#

some plugins do that

lilac dagger
#

wait

grand flint
#

i just never use them

#

stupid fucking plugins

lilac dagger
#

i have stats as well 😄

#

it's just nice having the options inside the same database

grand flint
#

yeah

#

mongodb ;D

lilac dagger
#

well

#

there are options

#

but for my need this is great

#

default options doesn't show

grand flint
#

u cant even edit the value properly with phpmyadmin

slender elbow
#

phpmyadmin ☠️

quaint mantle
#

phpmyadmin in big 25 🥀

grand flint
#

balright

#

what else would i use

lilac dagger
#

well

slender elbow
#

making a good application frontend

lilac dagger
#

you just don't edit the options

plush sluice
grand flint
#

for plugins?

slender elbow
#

sure

grand flint
#

60~ plugins??

#

dont be a dumbass

#

most of them have web ui that suppoets it

#

im not making a frontend for 60 plugins

grand flint
#

anything important has a page

slender elbow
#

I'm talking about when making your own product

#

not navigating someone else's database

#

that's yuck

quaint mantle
slender elbow
#

they should offer a good frontend

grand flint
#

well yeah obv??

slender elbow
#

then?

grand flint
#

we r in spigot btw

#

🙏

slender elbow
#

and?

grand flint
#

im obv talking about plugins emily

slender elbow
#

me too

#

a plugin is an end user application in the end

grand flint
#

idek when i got here tbh

#

i was in general

grand flint
#

so then everyone come and ask support about how to set it up and use it

slender elbow
#

by frontend I don't mean a web ui or some panel

#

i just mean general editing frontend wherever

#

presentable

#

inventory GUI, dialogs, commands even

#

rather than having the user go to the database directly

grand flint
#

that ob exists for most plugins

#

bro what r u on about emily

#

did u think i go to my database to edit my plugin configs 😭

slender elbow
#

why else would you use phpmyadmin lpl

grand flint
#

well a lot of sfuff

#

for example my guild plugin decided to delete my entire guilds table

#

so i had to use phpmyadmin to restore it and resetup some database only values

#

there is tons of things

slender elbow
#

bad plugin

#

keep backups

grand flint
#

yeah i do thats why i restored it

#

it decided to delete 300~ guilds bc it couldnt find the table w a name

short pilot
#

is there a good way to find out the earliest version your plugin will be compatible with? I'd like to reach as many as possible and am currently using 1.18.2 spigot

thorn isle
#

string nbt basically

cobalt drift
#

Ah ok, I want to save in database but blob is too long in my opinion. How do I serialize the itemstack to bytes?

thorn isle
#

the shit you enter in the /give command

#

it's a paper specific feature, ItemStack::serializeToBytes

#

this gives you a byte[]

cobalt drift
thorn isle
#

glhf

plush rivet
#

eh?
if you dare

thorn isle
#

bukkit object stream or some shit

cobalt drift
#

Ah that one …

thorn isle
#

you shouldn't use bukkit object stream apparently

#

i don't remember why but i remember someone here getting mad every time it's brought up

#

but i also don't remember the proper way to serialize items on spigot

cobalt drift
#

Ok maybe someone will say me how to do it better. Maybe I will just send my solution in here and hope that someone gets mad haha

#

But thank you so far

sly topaz
#

paper people get mad at it because it has the same issues as ConfigurationSerializable ItemStack serialization

plush rivet
#

With a block in NMS, how would I go about changing the hardness and blast resistance?
I think I need to get the BlockData from a registry? to then change the values and then re-apply it to the block? I'm not sure
Any help is appreciated

young knoll
#

You need to replace the entire registry object

#

Also changing the hardness will cause clients to behave weirdly

buoyant viper
#

u can gradually lower it too if ur not using features for the latest version

short pilot
#

is there a way to tell the minimum lowest version supported (assuming every later version is thus supported)

#

or do i have to plug and check

#

the feature part makes sense too, like if you're taking an entire mob that hasnt been released yet

short pilot
#

oki

mortal vortex
#

Is it possible to get the death message string as the translation keys, like death.attack.fall?

worthy yarrow
#

I don’t think so, I’ve been making a debugger and ran into this issue so I just basically mapped damage causes to strings

mortal vortex
#

Oof okay

#

You made a lib out of it?

worthy yarrow
#

No, sorry

#

Working on the actual relayed debug info and making it easier for end users to read

#

Maybe might do that eventually, haven’t decided but kinda niche

halcyon osprey
#

Hello, I have a question about CommandExecutors, is there any built-in way to validate user input?

#

Otherwise, is there a popular library to faciliate this?

mortal vortex
#

No it has 620 stars for no reason.

halcyon osprey
#

Haha, of course stars mean everything, you can't bot them, and they definitely 100% correlate with usage on Minecraft servers. Silly me, a beginner asking for feedback, trying to verify with users in the community!

mortal vortex
#

i've never heard of people botting stars on GitHub for a minecraft projectttt...?

#

with a commit history that goes back years?

halcyon osprey
#

Irrelevant, stars don't mean everything nor do they answer all questions. So maybe next time don't make such a sarcastic comment and instead be open to the idea that some users don't have much experience 🙂

#

Otherwise you could choose not to reply, thanks!

mortal vortex
#

they definitely 100% correlate with usage...
mfw then they show usage stats on the readme

halcyon osprey
#

So from your perspective anything with 600 stars is trustworthy and widely used. Noted, I think I'll wait for a more informed reply, but I appreciate your sarcasm and your condescending replies to a beginner. Indeed very helpful.

mortal vortex
#

THEY SHOW SPIGOT, AND MODRINTH DOWNLOADS BRUH IM NOT TALKING ABOUT STARS ANYMORE

#

but alr bro

#

if u think spigot and modrinth has a botting problem, then sure, every plugin may as well be botted?

#

Can you survey how many plugins or servers run an API? no?

#

You can only take the word of users, and those stars and downloads are users.

halcyon osprey
#

Okay, I don't care from some statistics showing downloads or stars. Please let's not turn this into an argument. You can think downloads correlate to trustworthiness, I will choose to be more cautious. If you don't have any good feedback then you're not obligated to reply, thanks!

mortal vortex
#

Then how else do you want to gauge trust worthiness? From word of mouth? Sure. You trust Google as a company because you know that practically everyone is using it, you wouldn't trust it if just one person said "yeah i trust it". But in this situation, what are you expecting? Every person to say, "yeah I trust it". If anything you're going to get one person respond and say "Yeah its trustworhy".

halcyon osprey
#

Not interesting in arguing, I'm here to ask a question and you seem to be keen to debate it. I get it, 602 stars tells the whole story for you. I'm not interested in that, so let's end it here and perhaps someone else will reply.

mortal vortex
#

we have already deduced that:
a) its impossible to get a metric of who's using it
b) the only metric would be word of mouth
c) word of mouth is not possible to ascertain from a small pool.

#

but alright, continue being dense.

nova notch
#

you probably should consider more "do i need this for my project" and go from there

#

i think the answer to whether its trustworthy is clear

#

you can also determine "widely used" by looking at the downloads

mortal vortex
mortal vortex
halcyon osprey
#

Abb3v, must you be so condescending?

#

Perhaps not reply, I would appreciate it

mortal vortex
halcyon osprey
mortal vortex
#

I wonder, when buying things at a supermarket, do you hold each item, wait for a dozen people to walk by and ask what they think?

#

👏 free spirited individual

halcyon osprey
#

Abb3v, I understand you're angry that I'm not taking your "602 stars means everything" comment seriously. We can agree to disagree. Please feel free to stop derailing.

mortal vortex
#

626*

glossy laurel
mortal vortex
#

😭

halcyon osprey
#

Perhaps I should have known all this from the fact that the project has 626 stars

mortal vortex
#

Went off at me for being sarcastic but look whos the smartass now?

nova notch
#

🍿

halcyon osprey
#

You could be nicer and less condescending to a beginner asking for help.

nova notch
#

thats kinda just how a lot of mc dev communities are tbh

glossy laurel
halcyon osprey
mortal vortex
#

im not being condescending, you asked if it was trustworthy, not if it can do everything you asked of it? So yes, Stars are a metric of that.

glossy laurel
#

^

halcyon osprey
#

"You idiot look at the stars"

mortal vortex
#

never said that

#

did i call you an idiot?

halcyon osprey
#

Ah, alright, that was definitely not the implication. Glad to see we're being honest!

mortal vortex
#

ok.

halcyon osprey
#

But I appreciate the openness and helpful replies @nova notch @glossy laurel

mortal vortex
#

"you're not in the list abb3v, go fuck yourself"
(ahem, like you said, an implication)

mortal vortex
#

LOL ur funny now

halcyon osprey
#

That was 100% my intention

jagged thicket
#

🎊

mortal vortex
jagged thicket
mortal vortex
#

love from bjp

swift lichen
#

I need help.

I have already coded myself a rank system using permissions, but now I am stuck here:

I want to sort all people on the tab board by their name, meaning this order as an example:

OWNER
DEV
ADMIN
MOD
PLAYER

I have no clue how to do so...I would appreciate any help

young knoll
#

I believe you need to use colour characters to do it

#

Since tab is alphabetical

glossy laurel
sullen canyon
young knoll
#

I think there might also be a packet for tab priority now

#

But I don’t know if we have api for it

sly topaz
mighty marsh
#

0000 comes first

#

then 0001 etc.

#

However many roles you need

young knoll
#

Ah we do have api for it

#

Player#setPlayerListOrder

swift lichen
swift lichen
#

I mean in intelli it just says red, and you cant use a "#" for anyhting

chrome beacon
#

Yeah you don't actually put #

swift lichen
#

oh yes, I just saw, it just means someting like a method in a class

chrome beacon
#

yeah

swift lichen
#

is this a good code for that?

#
    int order;

    switch (playerDataManager.getPlayerRank(player.getUniqueId())) {
        case DEV:
            order = 0;
            break;
        case ADMIN:
            order = 1;
            break;
        case MOD:
            order = 2;
            break;
        case PLAYER:
        default:
            order = 3;
            break;
    }

    player.setPlayerListOrder(order);
}```
chrome beacon
#

Could consider making the ranks an object

#

containing their display name order etc

#

instead of hardcoding an enum

swift lichen
#

oh true

#

good idea

#

I will make this after I managed to do that stuff with the sorting, ty for the idea

mighty marsh
#

So if player B is in team 00_Owner and player A is in team 01_Admin then B will come before A

swift lichen
#

Oh

fresh timber
#

does Bukkit.getEntity(UUID) require the entity with that uuid to be in a loaded chunk to find them?

eternal night
#

Yes q

fresh timber
#

rip

fresh timber
# eternal night Yes q

I have per player text displays, is it safe to store these in a map that contains the entity object so I can unload them when the player leaves?

#

I was told it can cause memory leaks or something so I used uuids but then I can't unload them

eternal night
#

Mark them as non persistent

#

That way they will be auto despawened when their chunk is unloaded

fresh timber
chrome beacon
#

Then respawn them when the chunk is loaded again

fresh timber
#

seems like that would cause performance issues to constantly respawn them

chrome beacon
#

Not that bad

fresh timber
# chrome beacon Not that bad

will Chunk objects stay the same throughout server runtime so I can store chunks that have text displays for the player in a map

chrome beacon
#

I believe it should be fine looking at the implementation

#

Just be aware that it holds a reference to the world

#

so it could be problematic if the world is to be unloaded

fresh timber
#

that probably wont happen

#

thanks

slender elbow
#

like, quite literally, instead of the game spawning it, you spawn it

fresh timber
worthy yarrow
#

It’d be nice to ensure no displays accidentally stick around

fresh timber
#

oh yeah I guess it fixes the problem

#

cus if the chunk is loaded it can remove it on quit

worthy yarrow
#

There can certainly be some issues where they stick around after you’re done tracking them and then now you can’t remove them

#

I mean you can… but not without extra effort programmatically or the vanilla /kill command

fresh timber
#

I mean yeah I mark all these player displays with nbts so it shouldn't be too hard to remove them

worthy yarrow
#

Easiest to just mark them as non persistent, they’re display entities so in the sense of a traditional entity object, they’re a lot more performant

slender elbow
#

there is no reason not to mark it as non-persistent

worthy yarrow
#

^ realistically you’re not tracking them when you don’t need to anyway

#

Just makes cleanup easier and you can still do so manually while tracking

fresh timber
#

also if I save the text display object in a map and mark it as non persistent then it gets despawned because they unload the chunk, can I respawn it with just calling the object and spawning at its own location?

slender elbow
#

well, not the Entity reference itself

#

you could store the entitysnapshot

hardy garnet
#

Hey, I am having an issue of DisplayEntities randomly disappearing upon server restart. I am also having an issue where mobs marked as persistent are also disappearing on server restart. Does anyone have any idea what could be causing this issue?

chrome beacon
#

Any plugins installed?

hardy garnet
#

None besides the one im working on

#

which doesnt despawn entities like that

chrome beacon
#

What version are you on

hardy garnet
#

1.21.8

chrome beacon
#

output from /version

hardy garnet
#

latest

#

is what it says

#

wait

#

CraftBukkit version 4528-Spigot-7c52c66-37c783b (MC: 1.21.8) (Implementing API version 1.21.8-R0.1-SNAPSHOT)

chrome beacon
#

Is the despawning entirely random?

#

or is there any way to recreate it?

hardy garnet
#

Its seemingly random

#

some locations the entities are entirely gone

#

other locations the display entities are there, but the mob entities are not

#

the only consistent thing is they are all present before the server saves and shuts down

#

I know, because I went and checked them all. Unloaded and reloaded chunks. Relogged

#

I am in the middle of refactoring, so what I might end up doing is loading all those chunks and just removing the entities and respawning them

#

a little annoying, but thats life

young knoll
#

As long as you don’t do setPersistent(false) they should stay

#

Except for monsters that may despawn

hardy garnet
#

monsters despawn even if you setPersistent(true)?

young knoll
#

Yes

#

That’s only for them being saved in chunk unload

#

You want setRemoveWhenFarAway(false)

mortal vortex
#

When an item has not been modified, in vanilla it shows that "When in Main Hand" followed by some attributes like: 6 attack damage, 1.2 attack speed...

Are those values accessible from ItemMeta? I was trying to do :

meta.getAttributeModifiers(EquipmentSlot.HAND);

but I imagine thats only if the item has been modified? So is there not a way to get those values?

#

Otherwise should i define it all inside the plugin? like:

 public static Double getAttackDamage(Material material) {
        return switch (material) {
            case WOODEN_SWORD -> 4.0;
            case STONE_SWORD -> 5.0;
            case IRON_SWORD -> 6.0;
            case DIAMOND_SWORD -> 7.0;

and then only change it if a meta modifier was found?

young knoll
#

Material#getDefaultAttributeModifiers

mortal vortex
#

thanks hunk

mortal vortex
#

Do enchanted books store enchantments different to items?

slender elbow
#

yes

#

they are stored in the stored_enchantments component as opposed to the enchantments

young knoll
#

EnchantmentStorageMeta

#

Throwback to when they stored them the same way and silk touch books meant free grass blocks

mortal vortex
#

for fuck sakes bruh

#

now i gotta check if this bullshit is an enchanted book?

manic delta
#

This is for development

quaint mantle
versed ember
#

I'm trying to hide the attack damage / attack speed stats on an ItemStack, but everything I can find explaining it uses something deprecated, how can I hide them now?

#

in 1.21.1, specifically

buoyant viper
#

is it deprecated bc it's old or is it deprecated bc it's experimental

versed ember
#

bc it's old

buoyant viper
#

F

kind hatch
#

Take a look at the ItemFlag class

versed ember
#

oh awesome tysm

versed ember
# kind hatch Take a look at the ItemFlag class

I'm surely doing this wrong in many ways, but do you know why this doesn't work?

ItemStack set_attributes_hidden_item = ((Player) sender).getEquipment().getItemInMainHand();
ItemMeta set_attributes_hidden_meta = set_attributes_hidden_item.getItemMeta();
assert set_attributes_hidden_meta != null;
set_attributes_hidden_meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_ADDITIONAL_TOOLTIP);
set_attributes_hidden_item.setItemMeta(set_attributes_hidden_meta);

((Player) sender).getEquipment().setItemInMainHand(set_attributes_hidden_item);
kind hatch
#

You need to apply the ItemMeta to the ItemStack using ItemStack#setItemMeta(ItemMeta meta)

#

Then set the itemstack in the players inventory

#

Everything else looks good, minus the snake case naming convention, just gotta tie the meta to the item.

versed ember
#

you're right about the snake case, I'm used to GDScript where it's normal 😭😭

kind hatch
#

Yea, it’s not really a big deal, but I just wanted to point it out since Java conventions. :p

versed ember
#

fair enough!

versed ember
kind hatch
#

Oh, I guess I missed that

versed ember
#

ah lmao

kind hatch
#

I’m on my phone right now so it’s hard to read the code blocks

#

But no, that’s how you do it.

chrome beacon
#

Are you running Paper

versed ember
#

weird, it doesn't seem to do anything, it looks the same in-game

versed ember
kind hatch
#

Ohhhh, wait

chrome beacon
#

Yeah

kind hatch
#

The item flag you have isn’t correct

#

Hide additional tool tips doesn’t work on attributes anymore

#

There are specific flags for it

chrome beacon
#

You need add an attribute modifier to make the hide attributes flag work. This is not required on Spigot

versed ember
kind hatch
#

I think you want #HIDE_ATTRIBUTES

chrome beacon
#

Adding any attribute modifier will overwrite the default ones

#

On Spigot adding the flag will remove all attributes implicitly when the hide attributes flag is set. Paper on the other hand requires you to add an attribute so it's not using the defaults

#

Small differences like this is why you really should ask in the right discord for what you're programming/tasting against

#

Especially now with Papers hardfork causing more and more deviations in api

versed ember
#

ooooooooooh that's right, I forgot they did that, I still thought they'd work the same way

#

so I just need to add a new attribute to the item for it to hide them?

chrome beacon
#

A new attribute modifier, yes

versed ember
#

perfect, ty!

#

soooooo I may or may not have another issue...

#

that kinda brings me back to my initial question, AttributeModifier() is deprecated, so how do I add an attribute modifier to an item now?

versed ember
#

mmmm paper

wet breach
versed ember
#

I think I figured it out, it looks like it's just a certain use for it that's deprecated, so if I use args of a different type it works

versed ember
#

I assumed that I'd have to change the code to support newer stuff if I used a newer version, and since I started learning java today I wasn't gonna bother, but ig I thought wrong

buoyant viper
#

why is my intellij autoformatting like this shit ass way

wet breach
#

probably should check your formatting rules

buoyant viper
#

i have like never touched them so idk why its doing that

wet breach
#

well since intelliJ is a big fan of shortcuts for everything, maybe its possible it was activated with a short cut?

mortal vortex
#

Has anyone been told yet by intellij that their code is violent to minorities?

#

Because it happened to me

buoyant viper
#

well

#

what expression is it

mortal vortex
wet breach
#

not sure why IntelliJ cares but seems they do

mortal vortex
#

not to insinuate i tried

wet breach
#

Well it is because people have to report it

#

so its not like a premade filter thing

mortal vortex
#

youd think... theyd have a list already?

eternal night
#

Isn't that just spelling / grammar helper?

buoyant viper
#

hang on

#

so the formatting was stupid because i was stupid

#

i forgot int i

#

i just typed int =

wet breach
#

lol

buoyant viper
#

ah

#

so my intellij is just fucked as a whole

#

its not highlighting errors in my code

#

like at all

#

just wont pop up until i try to compile

pliant topaz
#

IJ at it's best uwu

mortal vortex
#

this a DEI-grammarly inside of a code editor?

eternal night
#

Dei?

mortal vortex
eternal night
#

Because I don't see how DEI, a program related to employer responsibilities is connected to writing neutral English

mortal vortex
#

and also wdym "neutral english"?

mortal vortex
#

"neutral" is a word to describe a style of writing, like formal or informal. OR relating to bias / stigmatism

#

if you genuinely believe that "target" is informal for that context then you severely misunderstand english

eternal night
#

No, in this context it's fine

#

But whatever spellchecker IJ uses does not get that

mortal vortex
#

which explains my joke

eternal night
#

Yea my bad it must have flown over my head

mortal vortex
#

really cant tell if ur being sarcastic?

mortal vortex
# eternal night Yea my bad it must have flown over my head

Neutral English in grammar generally applies to the half way point between formal language / informal language. "Neutral" English in this case is not that, it means "neutral communication", which is:

language that upholds inclusivity, and avoids words with otentially harmful, violent, or exclusionary connotations.
This is obviously the intended usage of it when they say "violent associations"... so its being political. DEI as an acronym means Diversity, Equity, and Inclusion. its not just for employer resonsibilities. its essentially like an initative for how to act

eternal night
#

Thanks for the explanation!

mortal vortex
#

okay asshole

#

wait, makes sense ur a person that agrees with rad.

eternal night
mortal vortex
eternal night
#

I did not previously consider neutral English to target inclusivity lol

#

In my head it was just avoiding strong or emotional words

#

Under your above definition the DEI joke makes more sense

mortal vortex
#

alr i apologies for my language then. i thought u were being a smug asshole

hardy garnet
#

Are mobs that are e.setInvulnerable(true);

only hittable when in creative mode? I am able to hit them in creative mode but not survival

mortal vortex
mortal vortex
hardy garnet
mortal vortex
hardy garnet
thorn isle
#

oh lord have mercy

hardy garnet
#

Is that supposed to be a joke or genuine criticism

mortal vortex
#

wym