#help-development

1 messages · Page 909 of 1

lost matrix
#

Thats what i do for abstract classes and interfaces. Simply add an @class property.
Nothing you can really do to prevent that

echo basalt
#

That way I have fine control over how serialization is made

#

Same reason I don't just yeet all my stuff into gson and toss it in redis

#

The byte arrays let me pack stuff in a format that suits it better

#

Sure it's extra work

dusty totem
#

Hey, is there a way to redirect player to another bungee server?

[22:56:41 WARN]: [Nerus87] No client connected for pending server!
echo basalt
#

Yeah just make fallbacks

cedar flint
#

With this code I am trying to check if the (custom) enchantment is compatible with the item, but it doesnt work and still lets uncompatible custom enchantments thru and blocks compatible vanilla enchantments. Why and how to fix?

private Set<Enchantment> getCompatibleEnchantments(ItemStack item, EnchantmentStorageMeta bookMeta) {
        Set<Enchantment> compatibleEnchantments = new HashSet<>();
        if (bookMeta != null) {
            for (Enchantment enchantment : bookMeta.getStoredEnchants().keySet()) {
                if (enchantment.canEnchantItem(item) && (customEnchantments.contains(enchantment))) {
                    compatibleEnchantments.add(enchantment);
                }
            }
        }
        return compatibleEnchantments;
    }
chrome beacon
#

You probably want an and check

#

instead of an or

cedar flint
#

Wait sorry I miscopied my code. Il edit it

#

So the problem is with the and

chrome beacon
#

you sure you're not running old code

cedar flint
#

I double checked. But still incompatible custom enchantments get put as compatible

tender shard
#

you never check if the enchantment is compatible or am I blind?

#

oh wait I am blind

cedar flint
#

xd

tender shard
#

how does your custom enchantment's canEnchantItem method look like?

cedar flint
#

I did some experimenting and with this code it does work sort of, but now vanilla enchants dont go thru:

private Set<Enchantment> getCompatibleEnchantments(ItemStack item, EnchantmentStorageMeta bookMeta) {
    Set<Enchantment> compatibleEnchantments = new HashSet<>();
    if (bookMeta != null) {
        for (Enchantment enchantment : bookMeta.getStoredEnchants().keySet()) {
            if (enchantment.canEnchantItem(item) && customEnchantments.contains(enchantment) &&
                enchantment.getItemTarget().includes(item.getType())) {
                compatibleEnchantments.add(enchantment);
            }
        }
    }
    return compatibleEnchantments;
}
cedar flint
# tender shard how does your custom enchantment's canEnchantItem method look like?

I use it for an anvil. Here is that code:

@EventHandler
    public void onAnvilPrepare(PrepareAnvilEvent event) {
        ItemStack[] contents = event.getInventory().getContents();
        if (contents.length < 2) return;

        ItemStack slot0 = contents[0];
        ItemStack slot1 = contents[1];

        if (slot0 != null && slot1 != null) {
            if (slot0.getType() == Material.ENCHANTED_BOOK && slot1.getType() == Material.ENCHANTED_BOOK) {
                //not important for my problem
                System.out.println("ENCHANTED BOOK");
                ItemStack result = enchantBook(slot0, slot1);
                event.setResult(result);
                event.getInventory().setRepairCost(1);
            } else if (slot1.getType() == Material.ENCHANTED_BOOK) {
                Set<Enchantment> compatibleEnchantments = getCompatibleEnchantments(slot0, (EnchantmentStorageMeta) slot1.getItemMeta());
                ItemStack result = applyEnchantments(slot0, compatibleEnchantments);
                event.setResult(result);
                event.getInventory().setRepairCost(1);
            }
        }
    }
rare rover
#

is there a way to make text displays look like the armorstands

#

without the big background

rough ibex
#

yeah

#
Minecraft Wiki

Display entities are entities useful for map or data pack creators to display various things. There are Block Displays, Item Displays and Text Displays, which are used to display blocks, items and texts respectively. They can be created only with the /summon or /execute summon command.

#

do as you need

tender shard
#

big background? o0

cedar flint
naive loom
#

I'm pretty sure there isn't but is there a way to disable full-bright for players? I want to have a gamemode with custom lighting where certain rooms will be brighter and etc. and the darkness of certain rooms will add to the asthetic.

echo basalt
#

p sure that's client-sided

chrome beacon
#

^^

naive loom
#

thank you

river oracle
#

Apply darkness effect 😈

young knoll
#

Apply blindness

tender shard
#

or a sus stew with drunk effect

river oracle
#

Blindness is for chumps

young knoll
#

Write core shaders to just make the entire screen black

tender shard
#

tell the player they'll get cute anime girlfriend if they dont use fullbright

river oracle
#

I've always wondered

tender shard
river oracle
young knoll
#

If you have force resource pack set to true they will be kicked if they don’t activate it

#

But after that there are ways to deactivate it

slender elbow
#

there are mods to bypass that flag anyway

#

the client can just tell the server it applied the resource pack when it didn't

rough ibex
#

I applied the resource pack.
Source: trust me bro

river oracle
frail willow
#

I know that the direction of Lily Pad is fixed, but how do I know the direction of Lily Pad at a certain coordinate?

worldly ingot
#

Unfortunately you can't. That's determined by the client

flint coyote
young knoll
#

Probably calculated client side

#

So you’d have to figure out the math the client does

worldly ingot
#

I believe it's a noise map on the client that determines it

young knoll
#

Damn that’s fancy for just lily pad direction

worldly ingot
#

Well it applies to all things that have directional textures. Grass, the stones, sand, etc.

young knoll
#

I would have just done some math with the x y z position

worldly ingot
#

It's all randomly rotated

worldly ingot
#

I mean it could just not be a noise function, given it doesn't really need granularity, but it's calculated on a per-coordinate basis somehow :p

#

Server just has no reason to know about it

young knoll
#

Well, true

#

I was thinking more just seed a random by combining the XYZ into a long

#

And then nextInt(4)

flint coyote
frail willow
#

Thanks❤️

young knoll
#

Aye I was maybe right

tender shard
flint coyote
#

Well no. You can confirm whether it has changed in the past 3 years uwu

tender shard
#

where is the decompiled stuff lmao

young knoll
#

Just use loom or something

#

Idk

tender shard
#

idk how that works

flint coyote
#

You already got a response

#

that was quick

tender shard
#

ah nice. Yeah well the files mentioned in that post don't exist (MathHelper) and I searched for the first number value and that also doesnt occur in the whole .jar (or recaf's search sucks)

#

probably its the Mth class, let's check that

#

seems to still be the same

flint coyote
#

So the search indeed sucks

tender shard
#

yes

flint coyote
#

I like how they just deprecated it but still use it

#

It's not like they are building a library and have to keep it - they could just replace it.
Instead they kept it and are still using it lol

young knoll
#

Yeah it’s interesting that they deprecate things

#

It’s like they care about us a little bit

flint coyote
#

not enough to give us serverside books though

#

or custom entity models

tender shard
#

not sure if any of these is related to the lilly pads but they definitely use the deprecated method in these classes

flint coyote
#

I'm sure lily pads are in BedBlock. I love sleeping on lily pads

young knoll
#

Custom entities models aren’t that hard

flint coyote
#

Yet still we don't get support for it

young knoll
#

Pfft who needs official support

flint coyote
#

We have it for items. Why not for entities?

flint coyote
#

so are those armor stands with specific items equipped that you set a different texture for?

young knoll
#

It’s a bunch of display entities

#

The armor stand is just some visual trickery for the client

flint coyote
#

Oh so you even modelled the small up and down of their claws?

#

Like they are moving in itself. Not just walking

young knoll
#

I didn’t make the model but yeah

flint coyote
#

Oh I thought that was you

young knoll
#

It fully supports blockbench models

#

The code is me, the model isn’t :p

flint coyote
#

I see. That's cool though!

#

Never heard of BlockBench but there are some really cool models lol

#

Imagine casually mining and when you turn around this guy is behind you lmao

tender shard
#

Video Doesnt load for me 😦

flint coyote
#
https://cdn.discordapp.com/attachments/849481473496580116/1205615381348229230/2024-02-09_15-43-23.mp4?ex=65eb78d2&is=65d903d2&hm=7852a1040d67d9c16aa3579d179aacf8ebba88fc7e6f6e1e74e88371997f3f17&

Does this work for you?

young knoll
#

Blockbench is great

#

It supports all kinds of models too

tender shard
#

damn what kind of creatures are those lol

young knoll
#

Crabs

flint coyote
#

Yeah the unvoted crab

young knoll
#

I also have the penguin model

#

Well, a penguin model

#

Since the official one was never made

flint coyote
#

Do you have to animate those models yourself or do they contain animations? No clue how all of that works

young knoll
#

They contain them

flint coyote
#

The screenshot above does have a 3 second video in the website but it does not move at all for me

#

but maybe this model just doesn't have animations

young knoll
#

The crab has walk and idle animations

#

Death is also supported, still gotta support attack and other ones

flint coyote
#

Eh we haven't had attack animations on zombies for years

#

that's fine

young knoll
#

?

#

They have attack animations

flint coyote
#

and the current animation is kinda ehh too

#

yeah now

#

but for years they just ran into you

#

and "rammed" you to death

young knoll
#

Ah

#

Yeah new mobs have much fancier animations now

#

I wonder if Mojang will ever update the older ones

worldly ingot
#

I feel like I remember them saying they want to revisit some older mobs

young knoll
#

The OG animals and spookies could use some love

heavy zephyr
remote swallow
#

?staff

undone axleBOT
#

Don't ping staff for development/server help, if you have a question just ask it and someone in the discord will respond when they are capable of helping.

echo basalt
#

(I'm not staff)

#

Probably not the case but the usual cause of classloading issues are mostly:

  • Replacing the jar while the server is running (classes are only loaded when they need to be loaded, so changing the .jar will cause weird class loading issues)
  • Corrupted jar (Probably by uploading before the build finished, just re-build, stop, re-upload and restart)
#

On a further note, rename your command and listener classes to be a bit more explicit

heavy zephyr
#

I tried the 2nd one but didn't work.

echo basalt
#

Gamemode -> GamemodeCommand type deal

heavy zephyr
#

Could changing the plugin name affect that?

heavy zephyr
echo basalt
#

Your plugin.yml and "main class" name look fine

#

I'd still suffix it with Plugin (as in SpartanPlugin)

heavy zephyr
#

wdym?

#

I started Bukkit like 2 months ago, i don't understand a bunch of stuff

echo basalt
#

Also another cause for weird issues is shading certian libraries (looking at you, protocollib)

#

When naming variables, use descriptive, intuitive names

#

This concept also applies for classes

heavy zephyr
#

Like add a dependency & repository? or add the plugin?

echo basalt
#

ProtocolLib likes to throw class loading issues when you shade it

heavy zephyr
#

I don't have ProtocolLib though..

echo basalt
#

Yeah just sayin

#

Just clean package, re-upload and that should fix it

heavy zephyr
#

how do I clean package

echo basalt
#

mvn clean package

heavy zephyr
#

in terminal?

echo basalt
#

or just click the clean and package buttons on your maven tab

heavy zephyr
#

where

echo basalt
heavy zephyr
#

AWIT

#

@echo basalt

#

it worked

#

I LOVE U SO KMUCHJ

#

I've spent like all day coding this plguin

#

or most of it

echo basalt
#

spent like 3 hours making a /party system for "my" minigame network

heavy zephyr
#

well

#

thats different

#

u have 8+ years

#

experience

#

I have 2 months

echo basalt
#

where the hell did you find that o_o

heavy zephyr
echo basalt
#

ah

heavy zephyr
#

in here

echo basalt
#

yeah there's been a lot of progress on that network woeisme

heavy zephyr
#

it's been like a week no?

echo basalt
#

minigames

heavy zephyr
echo basalt
#

not really

heavy zephyr
#

true

echo basalt
#

Network released like monday

heavy zephyr
#

yeah like

#

5 days ago

rough ibex
echo basalt
#

I've pushed like 2 content updates, cosmetic shop, party system, a whole new game and I'm releasing friends and a new game tomorrow

rough ibex
#

what is that reaction supposed to mean...

echo basalt
#

gl

#

It's whitelisted this weekend so I can actually test stuff without having 100 people nagging on my ear

young knoll
#

That’s a weird ip

echo basalt
#

and also because we're having streamers on monday showcasing the server

heavy zephyr
#

nice

young knoll
#

Omg is it gonna be dream

echo basalt
#

and I think monday night I'm gonna have a meeting to develop a new event

rough ibex
#

mrbreast

echo basalt
#

woeisme I'm starting to feel sick from all the overworking stress and the like 30 minutes of sleep every other day

young knoll
#

I’m sure that hasn’t affected code quality at all

echo basalt
#

code's surprisingly clean

#

other than the occasional ugly

rough ibex
#

sounds like a fan screaming outside jimmy's window

young knoll
#

Shame the poor guy is drowning in the ocean

rough ibex
#

"For the next challenge, we put Frank in a car. But here's the twist: that car is going to be dropped by a crane into this lake."

river oracle
rough ibex
#

He kind of did with Squid Game

#

but yeah

young knoll
#

Squnger games

rough ibex
#

squnge

quaint mantle
teal venture
#

So for my plugin I want to have a Interface where when players are creating their empire (team), it displays a minecraft sign that says 'Enter Empire Name:' is there support for anything like that in spigot?

young knoll
#

There’s a method to open the sign gui

#

But I believe it requires an actual sign placed somewhere

river oracle
#

yeah actually there is a sign placed there and if its asks you just tell it yeah there is a sign there trust me bro

rough ibex
#

or you could do an anvil gui

#

or a book

#

a lot of possibilities

young knoll
#

Can’t open an editable book from the server

#

Anvil gui works well, you need NMS tho

rough ibex
#

Oh well.

rare rover
#

Okay so, I've done some research on my PDC problem and it seems like it's actually coming from itemMeta, here's the post: https://www.spigotmc.org/threads/why-items-with-lots-of-metadata-actually-cause-lag-an-inventoryholder-psa.607711/. So I'm making a prison server and currently getting the itemMeta with its PDC every block, which obviously is a no no. Could I just store the ItemMeta in memory instead then update it every x amount of blocks? What's your thoughts, any opinions on what I should do?

#

Sorry for the long message 😅

eternal oxide
#

what are you storing in teh PDC that needs to update every block?

rare rover
eternal oxide
#

What are you tracking?

rare rover
steel shard
#

Hey all! Just joined and I am new to the world of plugins and overall minecraft development / commands. I was wondering if there was a plugin that would allow block drops to be 100%. Like if I mine stone with my fist, it will drop the stone etc... If anyone could point me in the right direction that would help me a lot! Thanks

rough ibex
#

Welcome

#

" Note: Plugins wanting to simulate a traditional block drop should set the block to air and utilize their own methods for determining what the default drop for the block being broken is and what to do about it, if anything. "

rough ibex
#

Play around with it

quaint mantle
#

I have an idea

#

Cache it, but update the cache everytime the player swaps or puts on new gear

steel shard
odd turtle
#

Yo
How do you guys handle customizable messages via a config file (e.g. warning message to the player) to allow customizable RGB colors?

#

in the past I've used a new yml key for each phrase, with a string value consiting of (r, g, b) and then parse it

#

but that just seems so error prone

rough ibex
#

You can use §x

#

for legacy text

#

#RRGGBB is §x§R§R§G§G§B§B

#

but this is incredibly cumbersome

odd turtle
#

right so maybe the seperate key isnt such a bad idea

#

seperate key only allows one color though then again

rough ibex
#

You may want to look into Adventure's serialization

#

and simply store your translation values as those

sterile flicker
#

what to do if the event is triggered twice, which leads to an error java public static void injectNetty(final Player player, NPCManager manager) { try { Channel channel = (Channel) channelField .get(((CraftPlayer) player).getHandle().playerConnection.networkManager); if (channel != null) { channel.pipeline().addAfter("decoder", "npc_interact", new MessageToMessageDecoder<Packet>() { @Override protected void decode(ChannelHandlerContext chc, Packet packet, List<Object> out) throws Exception { if (packet instanceof PacketPlayInUseEntity) { PacketPlayInUseEntity usePacket = (PacketPlayInUseEntity) packet; if (usePacket.a() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT) { int entityId = (int) idField.get(usePacket); if (manager.getNpc(entityId) != null) { Bukkit.getPluginManager() .callEvent(new PlayerInteractNPCEvent(player)); } } } out.add(packet); } }); } } catch (Exception e) { e.printStackTrace(); } }

#

PacketPlayInUseEntity trigerred twice

rough ibex
#

that is a lot of indentation

#

can you maybe use guard clauses

#

and make this not so illegible thanks

minor junco
rough ibex
#

you must have a lisp

minor junco
#

.<<.+>>>>>.<<<

rough ibex
#

terminally ill

minor junco
#

And you my friend, are brain fucked

rough ibex
#

same thing

#

well, one implies the other.

twin venture
#

hi how does the distanceSquared work?

#

if i want to check if there are armorstands in the specfic space

#

for example 20 block distance

#

i tried but it does not work ?

rare rover
#

iirc

twin venture
#

so 400?

rare rover
#

yep

rough ibex
#

distance squared is literally distance squared

#

if you have 2 points (S) you can easily check if P(x,y,z) \in S

frail willow
quaint mantle
#

Hi , is there any event for when player fully connected and joined on the server ?

rough ibex
#

it tells you the formula

#

It is your job to implement and integrate it

frail willow
# rough ibex How so

Maybe I wrote the program wrong...but I got different results, I'll check again...I'm currently working on the bamboo offset, will come back later

frail willow
# frail willow Maybe I wrote the program wrong...but I got different results, I'll check again....

my code

    public static long hashCode(int x, int y, int z) {
        long l = (long)(x * 3129871) ^ (long)z * 116129781L ^ (long)y;
        l = l * l * 42317861L + l * 11L;
        return l >> 16;
    }

    public static void LilypadFilter(Location location) {
        Random random = new Random(hashCode((int) location.getX(), (int) location.getY(), (int) location.getZ()));
        Log.info("Type of LilyPad: " + Math.abs(random.nextLong() % 4));
    }
#

I think the last number output should represent its direction, but I found that the output in the same direction outputs different numbers.

lost matrix
#

What are you trying to do?

quaint mantle
lost matrix
quaint mantle
lost matrix
quaint mantle
teal venture
#

When dealing with NMS would there be any differences in using 1.20 vs 1.20.4??

teal venture
# lost matrix Yes

I don’t understand why though can you help me understand? It seems like there would be no significant change? Is it because when it compiles it compiles the ENTIRE thing?

quaint mantle
lost matrix
#

Do you want to know if nms written for 1.20 is compatible with 1.20.4 ?

teal venture
#

Yes! And further, if I want to use Nms code is there anyway I can make it compatible for future use?

lost matrix
quaint mantle
quaint mantle
#

oh , i sloved

#

xD , i forgot +

lost matrix
# teal venture Yes! And further, if I want to use Nms code is there anyway I can make it compat...

I see. The package structure for nms changed quite a bit and got a lot more consistent. This means that there is a very decent chance that your
1.20 code will run for all versions through 1.20.4

Writing future proof code requires a consistent api layer. This is the main reason why spigot was created -> To write future proof code that will
run for later versions of the game.

There is no way to guarantee nms compatability for future versions because mojang constantly changes their structure and code.

teal venture
dry hazel
#

spigot doesn't have mappings for methods (or all class members really) at all anymore, use mojang's

lost matrix
teal venture
#

Why did spigot stop?

lost matrix
#

Because mojang released their mappings

teal venture
#

Ahhh sweet so it’s easier now?

lost matrix
#

Yes you now have the original names for classes, methods etc
Reading NMS is quite nice now.

#

?nms

teal venture
#

Thanks bro 😎

#

Now that that’s established I need to go learn what the word ‘static’ means in Java! (I have no clue what I’m doing)

lost matrix
#

lul

lost matrix
teal venture
rare rover
#

No need to use NMS, especially if you don't know java

lost matrix
#

I dont know which level you are talking about, but its technically a lower level (when speaking about the abstraction layers)

inner mulch
#

alternative to playerchattabcompleteevent?

lost matrix
inner mulch
#

no i want it in chat

lost matrix
#

Ah

vivid nimbus
#

hey,

How do i add a trim to my armor on craft?

                ItemMeta itemMeta = item.getItemMeta();
                NamespacedKey key = new NamespacedKey("emeraldtools", "trim");
                itemMeta.getPersistentDataContainer().set(
                        key,                                     // Use the created NamespacedKey
                        PersistentDataType.STRING,
                        "{\"material\":\"minecraft:emerald\",\"pattern\":\"minecraft:eye\"}"
                );
                item.setItemMeta(itemMeta);

this just sets the NBT but doesnt actually add the trim to the armor

#

google doesnt tell me that much about this tbh

lost matrix
vivid nimbus
#
               ItemMeta itemMeta = item.getItemMeta();
                ArmorTrim ArmorMeta = (ArmorTrim) item.getItemMeta();
                ArmorTrim ArmorTrim = new ArmorTrim(TrimMaterial.EMERALD, TrimPattern.EYE);

                item.setItemMeta(itemMeta);
#

but when doing ArmorMeta.setTrim (does not exist)

lost matrix
inner mulch
vivid nimbus
#

1.20.4

lost matrix
# vivid nimbus 1.20.4

Naming convention pls:

    ItemMeta itemMeta = item.getItemMeta();
    ArmorMeta armorMeta = (ArmorMeta) item.getItemMeta();
    ArmorTrim armorTrim = new ArmorTrim(TrimMaterial.EMERALD, TrimPattern.EYE);
    
    armorMeta.setTrim(armorTrim);
  
    item.setItemMeta(itemMeta);
#

*You are casting the ItemMeta to ArmorTrim and not ArmorMeta

vivid nimbus
#

ooohhh

#

my bad

#

yeah that worked 🙂

inner mulch
vivid nimbus
#

Works

#

thanks @lost matrix !

lost matrix
inner mulch
#

it was possible with the event previously :(

lost matrix
#

in 1.12 iirc

#

And also only sometimes

candid inlet
inner mulch
#

tabcompletion is something else than the tab list

lost matrix
#

The client auto completes with names from the player list. I think that what he is referring to.

inner mulch
#

im still sad that they changed the cool stuff

#

chat completions are useful :(

frail willow
# frail willow I know that the direction of Lily Pad is fixed, but how do I know the direction ...

Still need help, the solution above doesn't seem right

    public static long hashCode(int x, int y, int z) {
        long l = (long)(x * 3129871) ^ (long)z * 116129781L ^ (long)y;
        l = l * l * 42317861L + l * 11L;
        return l >> 16;
    }

    public static void LilypadFilter(Location location) {
        Random random = new Random(hashCode((int) location.getX(), (int) location.getY(), (int) location.getZ()));
        Log.info("Type of LilyPad: " + Math.abs(random.nextLong() % 4));
    }
candid inlet
inner mulch
lost matrix
frail willow
#

Got results that I can't interpret

#

The number obtained does not match the direction

lost matrix
#

In that case you need to dig through the client code and check how they render the lily pads

#

The rotation might also be completely different for some clients

inner mulch
#

why does stringbuilder always tell me that i can use string instead of the builder, isnt using + on strings bad practice as its much slower than the stringbuilder?

lost matrix
#

Only if you are constantly allocating new Strings by appending values.
In a loop for example. If you are just building the String directly, then there is no real diff in performance.

inner mulch
#

im using + 5x, isnt that appending it a lot? or do i misunderstnad what happens internally?

inner mulch
lost matrix
#

^

inner mulch
#

okay thanks

wet breach
#

`

candid inlet
inner mulch
#

okay

upper hazel
#

what to do with the situation when an implementation accepts the interface of another implementation but not the implementation itself, this is a hindrance

#

the interfaces themselves are only needed in the manager class

dry hazel
#

what

upper hazel
#

For example craftBukkit objects work with each other but not with their api and therefore it does not affect the api in any way.

#

A more precise question is what to do with the situation when an implementation with an interface accepts another interface of another implementation, but not the implementation of this interface itself, it interferes with it
interfaces themselves are needed only in the manager class

#

void addMenuItem(MenuItem menuItem); -
I need to translate this interface into an implementation.

candid inlet
upper hazel
#

yes

tender shard
#

use generics

wet breach
#

+++++++++++++++++++++++++++

potent pecan
#

I'm using RaidTriggerEvent, RaidFinishEvent and RaidSpawnWaveEvent to track for raids but in all of them, it seems like event.getRaid().getBadOmenLevel() always returns 0 while it shouldn't, is it normal?

frail willow
neat wolf
#

Hi i'm using spigot 1.17.1 and to kill a entity i use entity,setHealth(0) how can i set a killer to the entity ? because EntityDeathEvent.getEntity().getKiller() is null

#

without using entity.damage(...) pls

shadow night
neat wolf
shadow night
tender shard
eternal oxide
#

give a valid reason not to use it

neat wolf
tender shard
shadow night
#

Then we don't need to help

eternal oxide
#

Then we don;'t waste our time

tender shard
lost matrix
neat wolf
#

just answer my question lol

#

is it possble to use reflection?

shadow night
molten hearth
#

bro says just answer my question after refusing to answer our question

lost matrix
# neat wolf i don't need a reason

A reason is actually of high importance because it lets us prevent you from shooting yourself in the knee as we can infer xy problems from your reasoning.

neat wolf
#

you always need to know why we do this to judge us, I'm not going to explain everything to you about how my plugin works anyway

shadow night
neat wolf
#

I had a simple question no need to go further

shadow night
#

We can't help you do something if we don't know what you are doing and how you are doing it

lost matrix
shadow night
neat wolf
#

because i'm not using the minecraft health system for my mob

tender shard
#

no need for reflection. getkiller() returns the NMS entity's lastHurtByPlayer field, which is public and can be easily changed to any EntityHuman

tender shard
#

?xy

undone axleBOT
lost matrix
# neat wolf ok thank

Alternatively you can always start tracking the last damage source by adding the damager and a timestamp to the entities PDC.
This only works if you dont rely on other plugins receiving the damager.

neat wolf
#

Would it work to do this before setting health to 0?

shadow night
#

Did you know you can try it and see

tender shard
#

setLastDamager? where is that supposed to be from?

#

or are those obfuscated/spigot mappings/ancient version?

neat wolf
#

nms entity

#

spigot 1.17

tender shard
#

ah

#

1.20.4 doesnt have such a method

#

there's only lastHurtByPlayer and lastHurtByMob

neat wolf
#

ah I've never tried the new versions yet

quaint mantle
#

Hi , how to write api-version that every version will be support ?

chrome beacon
#

1.13

rough drift
#

I don't remember when

lost matrix
#

But feel free to bombard the client with this.

rough drift
#

I meant more like the client used to send the chat string to the server

dusty totem
#

I'm so confused right now, I will be able to force a client to connect to another bungeecord server by using my plugin with ServerConnectEvent?
The fallback server is like a lobby server or it can be a bungeecord?

lost matrix
dusty totem
#

force user to use another BC

lost matrix
# dusty totem force user to use another BC

Thats not possible. What you can do is cascade bungeecord servers, where one bc server connects to N other bc servers which in their turn connect to M minecraft servers each.

But this structure is almost never viable.

dusty totem
#

I guess from the BC source code it is possible but needs some implementation on net layer.
So I can only request for this feature.

slender elbow
#

transfer packet in 1.20.5 uwu

dusty totem
slender elbow
#

I mean that's exactly what you want?

acoustic pendant
#

guys, how do you edit a spigot resource? i don't find the option 💀

valid burrow
#

bottom of the page

#

or do you mean an update?

acoustic pendant
valid burrow
#

then bottom of the page

acoustic pendant
valid burrow
dusty totem
# slender elbow I mean that's exactly what you want?

nope, my BC#1 is used with TCPShield so client is using tunnel to reach my server.
I'm using it to register clients IPs on my router - whitelist with some timeout (prevent from DDoS attacks and port scanners).
Then client have open port for direct connection, so client needs to be redirected (close current connection and open) to another IP address (DNS name).

acoustic pendant
valid burrow
#

are you logged in?

acoustic pendant
#

yea

valid burrow
#

uhhh

#

send me the link to your resource

acoustic pendant
valid burrow
#

that is indeed weird

acoustic pendant
#

lol

valid burrow
#

you should move your question to #general

acoustic pendant
#

oh, okay thanks

#

i'll ask there

slender elbow
sullen canyon
#

is there a way to catch the time when player gets knockback from a hit? I mean there is an entitydamagebyentity but it calls every time players gets attacked, however he is taking kb less times than being attacked, so it's not really accurate

young knoll
#

There’s EntityKnockbackEvent on latest

sullen canyon
#

dont blame me plz 🙏 is there anything similar for 1.8?

young knoll
#

Nope

dusty totem
young knoll
#

I don’t think you can without transfer packets

#

You can’t tell the client what to connect to

slender elbow
#

that is quite literally what the transfer packet does lol

young knoll
#

Yeah

dusty totem
#

but still, the connection will be the same, what do I mean by packages going through BC1 to BC2 to the Spigot server or do I miss the concept?

#

or it will be just migrate packages, close connection on BC1 and open BC2

eternal night
#

Transfer packet is literally "client, close your current server connection and open a new one to this IP/domain"

slender elbow
#

yeah the connection won't be the same

#

it's a brand new one

dusty totem
#

so client will be connected from tifferen IP seen by my router

#

not from tunnel IP but from raw IP

slender elbow
#

well, the client's IP won't really change, the port will

#

the client will connect to a different IP

#

if that changes the final address seen from your router then sure I guess?

dusty totem
#

to clarify I'm using TCPShield for BC1 so every connection visible on this port is the same for me (all of the clients have the same IP address but different client ports so it's fine), for BC2 you will need to connect to another/different public IP (it will be not from TCPShield endpoint) so In this case I will see real client IP (on router side).

mortal hare
#

is there any website to see mojang mappings for clientside classes?

young knoll
#

I think the normal mappings site has them

#

?mappings

undone axleBOT
river oracle
#

No just server

young knoll
#

Ah no it’s only server side

#

Lame

river oracle
#

No nmc

river oracle
#

Coll ghosting me truly sad

slender elbow
#

world formatting?

river oracle
#

Overworld neather

#

End etc

slender elbow
#

plugin compatibility? :^)

dusty totem
# slender elbow makes sense

great thanks guys @slender elbow @lost matrix @young knoll for fats feedback, waiting for new feature, currently clients need to connect manually to the server.

quaint mantle
#

Hi , how to edit my resource on spigot ? i uploaded i want change the direct link

young knoll
orchid trout
river oracle
#

If you do press the edit button it's by the report button

hybrid mulch
#

hello

surreal hornet
#

hello
there is any "source code analyzer" that you guys use or suggest ?

river oracle
#

Why would you need a source code analyzer

#

What would such a tool entail

surreal hornet
#

to Improve software quality, maintainability, security, and compliance by identifying issues early in development
Static analysis that checks source code detecting bugs, vulnerabilities, complexity, duplication and most importantly unnecessary abstraction, etc

i have SonarQube in my mind but i dont know how it work for spigot and thats why i asked to see what everyone use

river oracle
#

Nah that shit is stupid IMHO. If you wanna use it at all just use SonarQube

surreal hornet
#

i mean why not ? maybe analyzer can see something that i can't see, but yeh i probably just gonna use SonarQube

river oracle
stoic atlas
#

so im new to plugin development, currently trying to make a simple plugin that removes 2 max hp from a player when they die until they're left with only 2. i seem to be able to build this and the plugin starts normally in the server but the playerdeathevent is never called, am i doing something wrong?

    public void onPlayerDeath(PlayerDeathEvent playerDied){

        Player player = playerDied.getEntity();

        AttributeInstance maxHPAttr = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);

        if (maxHPAttr != null){

            double maxHP = maxHPAttr.getBaseValue();

            System.out.println(maxHP + " HP");

            if(maxHP > 2){

                double newMaxHP = maxHP - 2;

                System.out.println(newMaxHP + " HP");

                maxHPAttr.setBaseValue(newMaxHP);

                if (player.getHealth() > newMaxHP) {

                    player.setHealth(newMaxHP);
                }
            }
        }
    }```
stoic atlas
#

what does registering an event means in this context

sinful kiln
#

That you registered the Listener that contains the EventHandler method

tall dragon
#

getServer().getPluginManager().registerEvents(new Listener(), this);

#

this bassically

stoic atlas
#

    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Dark Rejuvenation Started!");
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
        System.out.println("Dark Rejuvenation Stopped!");
    }

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent playerDied){

        Player player = playerDied.getEntity();

        AttributeInstance maxHPAttr = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);

        if (maxHPAttr != null){

            double maxHP = maxHPAttr.getBaseValue();

            System.out.println(maxHP + " HP");

            if(maxHP > 2){

                double newMaxHP = maxHP - 2;

                System.out.println(newMaxHP + " HP");

                maxHPAttr.setBaseValue(newMaxHP);

                if (player.getHealth() > newMaxHP) {

                    player.setHealth(newMaxHP);
                }
            }
        }
    }
}```
So implementing the listener like this is not enough?
tall dragon
#

i thought main class was automatically registered as listener but i guess not

stoic atlas
tall dragon
#

thats just an example

#

in your case the listener is this

tender shard
tall dragon
stoic atlas
#

alright, ill try it out and see if it works now

#

it works, thanks @tall dragon 👍

sinful kiln
#

Does someone know which Event is used in order to detect if a player hit a Minecart / Boat?

#

Well yeah you left clicked it

#

I don't really mind if it is breaking it as long as I can cancel it x)

#

Ah thank you :)

hallow cedar
#

and then maybe you can get if the hit entity is instanceof boat/minecart and the damage dealer is a player

sinful kiln
#

Thanks but it seems the event that CMarco mentioned is the correct one as Boats and Minecarts seem to be implementing Vehicle

hallow cedar
#

yeah I found it too now nevermind

hallow cedar
sinful kiln
#

Yeah I didn't know about that either up until now x)

quaint mantle
#

Hi , anyone can write a code that add a string in list (array) of config.yml ?

quaint mantle
#

i used list.add but didn't work for me

#

will my command work but didn't add anything on my list

tacit arrow
#

Hey, would it make sense to e.g make my own like format for it so I can basically do:
{
Name: apple
Lore: healthy and tasty
}
Instead of relying on other such

Sorry if I said it bad my English is not the best

#

I can explain more in detail if needed

fervent pulsar
#

W pfp

lost matrix
#

Looks like a Location with extra steps and sadly not usable as well

bleak eagle
#

to be honest, don't really like that guy. if he's real, he's omnipotently watching my every single move and that's enough to make me very uncomfortable >:(

hybrid mulch
#

hello i was trying to make a custom mob, but i get the error "Class 'Bob' must either be declared abstract or implement abstract method 'isBaby()' in 'Zombie'"

public class Bob extends Zombie {

}```

if i implement the methods i get the error: "No interface expected here"
has anyone made custom mobs in 1.20 and know how to fix this?
hybrid mulch
#

no others show up

lost matrix
#

You would need to use NMS for that.

hybrid mulch
#

oh

lost matrix
hybrid mulch
lost matrix
hybrid mulch
#

i know i could create a zombie then set its health

#

and displayname

#

would be cooler with a class thing

lost matrix
#

What

#

I would recommend to use the spigot api and gather some more experience with plugin development.
Custom nms implementations are rarely useful.

hybrid mulch
sterile flicker
#

https://pastes.dev/GF1PgS53aK please help me, for a long time I can't figure out how to return the main scoreboard after it was replaced by another one, after the disappearance of the "other" scoreboard, for example, when I entered the mini-game with other scoreboard and quit

#
            return;
        }``` in setupScoreboard does not work as expected
eternal oxide
#

That is never going to be true

worthy yarrow
eternal oxide
#

A NEW scoreboard is New

#

store a reference to your game scoreboard

sterile flicker
worthy yarrow
# eternal oxide A NEW scoreboard is New

^, I think you'd have to get the scoreboard created for that minigame, which should already exist by definition of a minigame server, so you should just be able to grab the exisiting one and modify no?

eternal oxide
#

When you create it. That reference

#

ScoreBoard gameScoreBoard = ...

worthy yarrow
#

^

#

That will get you the proper scoreboard reference

eternal oxide
#

When a player rejoins your logic then should be something like. Player.setScoreboard(game.getScoreboard())

worthy yarrow
eternal oxide
#

or, as each game has its own scoreboard, just have the game.add method set the players scoreboard

sterile flicker
worthy yarrow
sterile flicker
#

in setupScoreboard, I just need to create an instance?

worthy yarrow
#

well it doesn't have to be new either

#

It could already be exisiting as well

eternal oxide
sterile flicker
#

I'd also better create a hashmap of scoreboards for each player?

eternal oxide
#

why would a player have multiple?

worthy yarrow
#

Yeah that sounds like you'll run into issues removing/adding scoreboards... plus only one should be assigned when a minigame starts right?

eternal oxide
#

The scoreboard belongs to teh Game, not the player

sterile flicker
#

well, the scoreboards are different, for example, they have a different position, balance and biome for each player

worthy yarrow
#

The scoreboard should relate information based on the minigame, not the player... though I'm sure you can implement some cool stuff with player locations / biomes or wtv

eternal oxide
#

if you are creating a personal scoreboard for each player in teh game, then store them in a Map in teh Game object <UUID, Scoreboard>

sterile flicker
eternal oxide
#

what?

#

Main has nothign to do with the Game

#

and main is always accessible through getMainScoreboard()

worthy yarrow
worthy yarrow
sterile flicker
eternal oxide
#

no, it gets teh Main Scoreboard. The default one

lost matrix
worthy yarrow
#

"Scoreboard" is not a player defined object. It's a piece of of the server host if you will, when it comes down to custom scoreboards, you'll have to create a new one or use the default one that comes with the "minigame" server, there's no reason to be creating a new scoreboard then basically masking the default one when you could have just saved time modifying the default one.

sterile flicker
river oracle
#

Is there any way to recreate the flinch effect when a player is damaged?

remote swallow
#

typing Y2K_ is typing...

river oracle
#

I'm cancelling the damage event, but I still want the flinch effect to occur

eternal oxide
#

The Main scoreboard will be empty, if you have not put anything in it

worthy yarrow
#

Beyond that, I have no clue lol

sterile flicker
eternal oxide
#

There is ONE Main scoreboard.

#

There is only ever ONE Main scoreboard

#

You can create other scoreboards, but they are never the Main

worthy yarrow
#

As we keep saying, the scoreboard is not a player defined object

#

The main scoreboard is what automically gets inplemented for you when you start your server up. If you want to create a new scoreboard then you can though it's unwise when you can just modify the "main" scoreboard and save extra work

#

For each scoreboard you have, should relate the amount of minigames you have. ie: 5 games : 5 default scoreboards (which you can modify accordingly)

mortal hare
#

is there any good for debugging plugins

#

which would print me client branding of the joined client

mortal hare
#

clientdetector, hackedserver doesnt seem to work at all with fabric at least

worthy yarrow
young knoll
#

I don't think fabric sends the client brand

remote swallow
#

it sends fabric iirc but thats it

#

maybe

stoic atlas
#

is it possible to have for example a custom item with the material of a dragon egg but the behavior of a potion you can consume? or are these 2 always linked no matter what

lost matrix
#

The client decides if the item is suitable for consumption. So you would need a resourcepack for that.

quaint mantle
#

i think i did the sane in 1.8

worthy yarrow
#

breh

#

Like literally one packet? lol

charred blaze
#

is EntityDamageEvent called on every death?

#

like fall

worthy yarrow
charred blaze
#

yeah but is it considered damage when player dies?

#

does it work on ANY cause?

worthy yarrow
#

Any cause, any entity

#

The fact of the matter is that, the entity has to be "damaged"

charred blaze
#

yea but when player dies of any cause like fall it is considered damage right?

#

like potion effect cause

worthy yarrow
#

Yeah

#

I answered that question 3 times now lol

charred blaze
#

just to be clear xd

worthy yarrow
charred blaze
#

k thanks

river oracle
#

EntityDamageEvent triggers even if the resulting health would be less than 0

charred blaze
#

k

sterile flicker
astral scroll
#

hello

#

how can i do like an infinite chest?

#

Like lets say i open a chest, take some items and close it

#

and when i open it again, the items i took are there but also in my inv?

#

do i make myself clear?

torn shuttle
#

then use pdc or some other identifier to check if people are opening that chest

astral scroll
#

hmm

#

like, yeah its possible

#

but i mean, where does minecraft store this chest info?

#

like, ItemStack and its name and stuff are in ItemMeta

#

like, Chest interface has smth?

#

it doesnt

proud badge
#

What would be the event for when an entity in a chunk loads

rotund ravine
#

?jd-s

undone axleBOT
rotund ravine
#

Look for it

#

Hint

#

It ends in LoadEvent

proud badge
#

Ok its
EntitiesLoadEvent

#

I didnt find it earlier cause I searched with Entity

#

and not Entities

#

Also is there a specific event for nametagging a mob or is it just PlayerInteractEvent

sterile flicker
torn shuttle
river oracle
charred blaze
#

how do i get showplayer method working on offline players

#

or can i still use it on playerquitevent?

chrome beacon
#

?

#

Why do you need to call showPlayer on a player who's quitting

mortal hare
#

this might seem a dumb question

#

but how does gradle

#

keep the daemon process running

#

after finishing a task?

#

doesnt the program exit afterwards since you can input anything after it?

#

if it creates new process with a daemon then how does it keep track when to quit the daemon process running

charred blaze
chrome beacon
#

??

#

If you want to spawn a fake player use something like Citizens

charred blaze
#

no i dont want to spawn a fake player

#

im doing something like

#

/spectate playerwhoisinduel

#

and im hiding the command executor from playerwhoisinduel

#

but in case playerwhoisinduel quits the server

#

i need to unhide the player

torn shuttle
#

have you tested to see if the hidden players stay hidden even when they log back in because I somehow doubt that's how the api did it

charred blaze
#

no

#

i didnt test it

charred blaze
mortal hare
#

smallest spruce forest i've ever seen

chrome beacon
#

but that will take longer than just testing it

charred blaze
chrome beacon
#

?stash

undone axleBOT
tender shard
#

CraftPlayer

charred blaze
#

nvm ill just test it lol

mortal hare
#

wtf mojang

#

SharedConstants.class (Yarn mappings)

#

1.20.4

tardy delta
#

looks about right

ivory sleet
#

mojmaps + parchments = schnitzel

mortal hare
#

that point to the same boolean value

#

in that case just use a goddamn false

ivory sleet
#

to avoid magic values?

#

idk, like constants are constants

mortal hare
#

what magic values, how is having 100 lines of the same false boolean variable is worse than one false

ivory sleet
#

no like lets say these constants are passed around

mortal hare
#

i get it

#

but still

#

its a constant

#

its not a variable

#

that you can change

ivory sleet
#

if the value of a constant x is changed, obv u want it changed everywhere, where x is used

mortal hare
#

its final

#

"but reflections"

#

ik

#

but still its seems like too much

ivory sleet
#

not rly

#

reflections and reflection wouldnt work prob

#

since it gets inlined

ionic haven
#

so im running this in PlayerJoinEvent but it keeps giving me a normal world. any ideas?

Bukkit.createWorld(new WorldCreator("mine-" + uuid.toString()).generator(new VoidGenerator())

...

public class VoidGenerator extends ChunkGenerator {

    @Override
    public Location getFixedSpawnLocation(World world, Random random) {
        return new Location(world, 0, 100, 0);
    }
}
ivory sleet
#
/**
 * Shared global constants.
 * 
 * <p><strong>Note:</strong> The majority of the fields within this class are {@code public static final} with constant expressions (constants), and are inlined by the Java compiler at all places which reference these constant fields. Therefore, changing the value of these constant fields will have no effect on already compiled code.</p>
 * 
 * <p>In addition, it is presumed that a large portion of these constant fields (such as those prefixed with {@code DEBUG_} are used as 'flags', for manually toggling code meant for use by Mojang developers in debugging. Therefore, optimizing compilers (which include the Java compiler) may omit the code hidden behind disabled flags, and will result in these flags having no apparent use in the code (when in reality, the optimizing compiler has removed the code which uses them).</p>
 * 
 * @see <a href="https://docs.oracle.com/javase/specs/jls/se16/html/jls-15.html#jls-15.29">The Java&reg; Language Specification, Java SE 16 Edition, &sect; 15.29. "Constant Expressions"</a>
 * @see <a href="https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-14.22">The Java&reg; Language Specification, Java SE 16 Edition, &sect; 14.22. "Unreachable Statements"</a>
 */
public class SharedConstants {
#

@mortal hare ^

mortal hare
#

so these are basically debug mode switches

ivory sleet
#

some are

#

or well

#

most of them yes

#

there is also some readability ones

#

like

#

TICKS_PER_SECOND

#

which I assume they use instead of the magic value (20)

celest notch
#

I'm creating a server using resource packs and animated java to replicate things you would usually need mods for, how would i handle things like custom fluids and possibly gases like in Mekanism on the server side, for example i need a block to have an amount of fluid value associated with it

inner mulch
#

does somebody know how i can create callbacks with redis?

ivory sleet
#

callbacks?

#

as in?

inner mulch
#

yes when i pub sub something and then i wait for it to pub sub back

#

and then use the data

ivory sleet
#

ah

#

u use redisson right?

inner mulch
#

yes

ivory sleet
#

in that case...

#

@lost matrix

inner mulch
#

i alr have a system that kinda does the same it's really ugly tho

ivory sleet
#

i can give u the general idea tho

#

for a server

#

u want to spin up a read thread

#

that just polls data

#

and then a write thread probably

#

that sends the data

#

and then define a protocol over it

#

mainly like, server to proxy, proxy to server, server to server etc

inner mulch
#

i currently have packets, i can send them as whole classes, my current approach needs anonymous classes tho, but kryo doesnt understand how to serialize them

#

do you know if i can change something so kryo can serialize them properly?

ivory sleet
#

I mean I doubt ud wna send over an entire serialized class through redis

inner mulch
lost matrix
#

redisson squirtle

inner mulch
#

anonymous classes dont handle well tho

lost matrix
ivory sleet
#

this approach sounds extremely ugly

inner mulch
ivory sleet
#

cant u do it like minecraft

inner mulch
lost matrix
#

Redisson has remote procedure calls (RPCs) btw. Let me get you the link.

ivory sleet
#

have u ever worked w mc packets?

inner mulch
#

not really

#

just spawned a few fake entities and that was it

ivory sleet
#

i see

#

look what smile got for u

#

maybe thats a better alternative

inner mulch
#

why isnt having the packets as a class cool tho

lost matrix
inner mulch
#

if both sides know the code in there

ivory sleet
#

but if both sides know the code in there, there is no need to serialize the entire class and send it over lol

inner mulch
#

it does its thing i suppose

celest notch
ivory sleet
#

but well

inner mulch
#

?paste

undone axleBOT
inner mulch
lost matrix
inner mulch
ivory sleet
#

can u just like

#

not use anonymous classes maybe

#

¯_(ツ)_/¯

celest notch
#

i can do visuals with resource pack but what im asking is whats the best way to store additional data in blocks

inner mulch
ivory sleet
#

i mean there got to be other ways u can solve the problem without anonymous classes

lost matrix
#

?blockpdc

undone axleBOT
ivory sleet
#

cuz anonymous classes, admittedly, are a big issue in serialization

inner mulch
#

it works without anonymous classes, but its just not clean

ivory sleet
#

anonymous classes are not clean

charred blaze
#

i have this weird bug

inner mulch
charred blaze
charred blaze
#

the teleport code gets executed before duels.spectators.put

ivory sleet
#

cuz then u're giving it a name

charred blaze
#

why?

ivory sleet
#

and it has a type

inner mulch
ivory sleet
#

let me show u minecrafts packets

inner mulch
#

in vc?

ivory sleet
#

na

#

all of those

#

could be anonymous classes

#

but they arent

lost matrix
ivory sleet
#

they are their own types and have names

#

its much cleaner

inner mulch
ivory sleet
#

for one u get to be able to pass that class to a generic type parameter

charred blaze
#

look

ivory sleet
#

and second that class now becomes mockable

charred blaze
#

the uuids are same

ivory sleet
#

and a visual, explicit component to ur system

#

moreover, that anonymous class isnt saving u any extra space, its still gonna be its own file at the end of the day pretty much

#

like once compiled

lost matrix
# charred blaze

Looks perfectly fine to me. The code does exactly what i expect it to do.

charred blaze
mortal hare
#

man im so fucking dumb

#

i was trying to figure out why my mixin didnt work

#

only to realize that i forgot to register it in fabricmod.mixins.json

ivory sleet
#

u dont have the qol plugin?

#

it yells at u when ur mixin is missing from the mixins.json

mortal hare
#

is there such in vscode

ivory sleet
#

oh

#

nope

#

rip

#

dont think so at least

mortal hare
#

im using vscodium instead of intellij

#

just to force myself to use CLI tu build things

#

with gradle

ivory sleet
#

lol

#

well my bad then

surreal hornet
#

Is there a way to execute actions on an entity when it is being loaded? I want to remove any ArmorStands with specific scoreboard tags when they are loaded. I know I can simply create an infinite loop to check for each ArmorStand in every loaded world, but that would have a impact on performance

dawn flower
echo basalt
#

EntitiesLoadEvent

#

maybe

surreal hornet
dawn flower
surreal hornet
#

alr thank you, i have another question

#

How can I check if the server has crashed? For example, when enabling a plugin, how can I determine if the last server shutdown was due to a crash or not?

surreal hornet
surreal hornet
#

i cant ?

dawn flower
#

you cant check if a shutdown was a crash or not

surreal hornet
#

if server crash onDisable method will be called ?

dawn flower
#

yeah

rough ibex
#

You may be able to check if worlds were closed correctly

cedar flint
#

How do you check if there is a block above the player? This is my current code, but it doesnt work:

public boolean isBlockAbove(Player player) {
        Location playerLocation = player.getLocation();
        Location blockAboveLocation = playerLocation.clone().add(0, 0.2, 0);
        Block blockAbove = blockAboveLocation.getBlock();
        if (blockAbove.getType().name().endsWith("AIR"))
            return false;
        return true;
    }
surreal hornet
# dawn flower yeah

what ? are you sure what if power goes down or you just shotdown the computer that server is running on

dawn flower
dawn flower
#

but u cant check if that shutdown was a crash

#

a crash meaning server gets too overloaded that it cant handle it anymore and just crashes, if u mean crashes like just shutdown then then you can check the latest log's date in logs

#

also some crashes have a message at the end of the logs but i dont remember the message, u can check that as well

surreal hornet
#

so there is no scenario where the onDisable method is not called

rough ibex
#

Well unless something else kills it

slender elbow
#

I mean if the jvm crashes entirely

rough ibex
#

Yeah

#

kill -9

dawn flower
#

it only happens when you do it manually

slender elbow
#

not necessarily ? 🤔

dawn flower
surreal hornet
# rough ibex Well unless something else kills it

yeh and thats exactly why im askin what if power goes down what if vm crash what if that server is running inside docker and that docker instance crash there is infinite possibilities i dont know how you are there is no cenario

dawn flower
#

oh

#

its ran on a local pc

#

then yeah there r some scenarios where it doesnt call onDisable

rough ibex
#

Again, check if the worlds closed right

#

There should be some lock

surreal hornet
#

alright thank you guys, i probably just gonna make a logger for onEnable and onDisable

rough ibex
#

But how will it know its a crash

dawn flower
rough ibex
#

/stop calls ondisable

dawn flower
#

and when the server starts make it check if the latest log contains that specific log

#

if it doesnt then it crashed

surreal hornet
rough ibex
#

sure.

cedar flint
dawn flower
#

oh wait

cedar flint
#

?

#

(The system log keeps saying false. Even with block above head. That was my check)

dawn flower
#
                    System.out.println("Block Above Player: " + isBlockAbove(player));```
#

you're printing isBlockAbove(player) in a !isBlockAbove(player)

#

so it'll always be false

#

put the printing outside

cedar flint
#

Nope. I now made it like this:

System.out.println("Block Above Player: " + isBlockAbove(player));
if (!isBlockAbove(player) || !isOnVineOrLadder(player)) {
#

And still false

rough ibex
#

How about you test and print the block instead of a boolean

#

false false false means nothing

cedar flint
#

ok

dawn flower
#

try return !block.isEmpty() && block.getType() != Material.AIR && block.isSold();

#

this will work

warm mica
#

The first two checks are already included within isSolid(), and your first and second check are basically the same thing

cedar flint
warm mica
cedar flint
#

api-version: '1.20'
I use the Minecraft Coding Plugin for intellij so it does it automaticly

warm mica
#

Try to add 2 blocks at the y axis instead of 1

cedar flint
#

YES

#

works now

warm mica
#

Nice

rough ibex
#

Oh right, because the players position is from their feet

#

Not head

#

lol

earnest lark
#

how do i make the plugin build into a specific file

cedar flint
#

Found another bug. If i stand on the edge it wil be false, but still bump my head :/

rough ibex
#

if either edge hits something, player has smth above them.

warm mica
cedar flint
dawn flower
#

im dumb

rough ibex
#

Like, to a JAR?

earnest lark
#

i want to not have to change the jar every time and just build it then reload the server

cedar flint
earnest lark
#

i know there is a way i just forget how to do it

cedar flint
#

In this episode of the Spigot series, I show you how to create a new plugin without having to use the Minecraft Development IntelliJ plugin. #minecraft #plugins #tutorial

An easier way: https://www.youtube.com/watch?v=dem7dujCDvg
SpigotAPI Download: https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/

Join th...

▶ Play video
#

And then the building and compiling part

earnest lark
#

it worked

#

i had it going to the wrong fine

#

file

cedar flint
#

Nice xd

#

Here is my code. There is a bug that when you jump and right when you are about to hit the ground press double space(double jump) then you get put into fly mode. And i cant figure out why

austere lion
#

Hey how do i turn off the built-in reload command. i need to get rid of it so i can use protocoLIB

young knoll
#

Just don’t use it?

#

Remove the perm from everyone

austere lion
#

how do i do that

#

lol im new to all this

rough ibex
#

reload breaks Plib?

young knoll
#

Not the last I checked

austere lion
#

so what do i do

young knoll
#

I believe that’s the perm

austere lion
#

ty letme try

austere lion
rough ibex
#

Also why is reload breaking your Plib?

#

XY problem

young knoll
#

/lp editor is the easiest way

timid berry
#

what would be the command to compile this?

#

maven

surreal hornet
river oracle
#

1.7 paper cryblood

timid berry
surreal hornet
#

how you know its 1.7 paper ?

#

thats probably a pvp plugin

river oracle
#

I can confirm it is not a pvp plugin xD

surreal hornet
#

oh no, thats not good lol

young knoll
#

All the best PvP plugins have a MinecraftServer folder

quaint mantle
#

Would you guys recommend a finite state machine approach for minigames

river oracle
#

Dude you're a nerd just code the minigame

quaint mantle
#

Like the phases thing

river oracle
quaint mantle
#

yeah idk how

wet breach
quaint mantle
#

like