#help-development

1 messages · Page 1337 of 1

thorn isle
#

i can write it in python and have it perform better if i optimize for performance

vagrant stratus
#

^ You'd have to rewrite the client's entity system to be ECS and compare that to pure vanilla to get a proper comparison and not two completely different implementations lol

fallow saffron
#

They do try to optimize for performance, the issue is there are AFAIK 2m+ lines of code in their engine, it's very difficult to refactor and optimize

thorn isle
#

they go for low hanging fruit here and there

#

do you remember the 1.15 "performance update"?

vagrant stratus
#

which is irrelevant to using ECS or not using ECS

thorn isle
#

they put a tick rate limit on villager ai -- that's their performance update

vagrant stratus
#

It'd be a fuck ton of LOC regardless lmao

fallow saffron
#

SoA ECS allows the CPU to use 1 cycle to compute multiple data (basically like SIMD)

thorn isle
#

don't need ecs for that

fallow saffron
#

OOP takes 50-80 cycles

thorn isle
#

not strictly true

#

i say this having rewritten the collision algorithm (yes, in oop) using simd

fallow saffron
#

With the latest version of java?

thorn isle
#

which btw is a much more noticeable performance issue than whatever memory locality of bubble columns

#

i think j16, i don't remember, it's been a while

fallow saffron
#

Java 16 doesn't have SIMD support I think?

thorn isle
#

it was a bit ass because the jit is so fragile, but you can get it to emit vectorized instructions

#

not explicit simd support, no

fallow saffron
#

you can't tell it to use AVX for example

thorn isle
#

but it's been in jit for a long time

vagrant stratus
#

Speaking of ECS. Debating of if i want to use the over bloated flecs or roll my own solution that isn't so feature bloated 🤔

fallow saffron
#

ENTT is good I hear

#

C++?

thorn isle
#

e.g. simple for-loops with predictable bounds have been vectorized since i think j11

fallow saffron
#

Yes but they must not have any branching

#

if the cpu has to throw the work it did

thorn isle
#

myes, not a problem for collisions however

fallow saffron
#

I suppose with AABB

#

but traditional is an issue

thorn isle
#

you can algorithm yourself out of almost any hole

vagrant stratus
#

entt is also bloat lol

fallow saffron
vagrant stratus
#

I'll just roll my own solution kekw

fallow saffron
#

Yeah most of the time you don't need most of it

thorn isle
#

i rolled my own ecs system for a custom block type system a while back

#

and being the type purist i am, i had the system/component/entity type declarations be declared through java generics

#

ecs is quite convenient in some cases

#

i didn't quite like it however, i eventually went back to rawdogging it with inheritance and a little bit of composition

#

only reason i tried ecs is that my blockproperty system lended itself to it quite nicely

vagrant stratus
#

Yea, a lot of my own stuff is just inheritance and comp lol

#

I simply don't need ECS for that stuff because i don't have any specific benefit from using it kekw

#

Looking at MC and what they're doing, they wouldn't really benefit from ECS either tbh

slender elbow
#

"i wrote code that mojang didn't and it ran better"

#

world news

vagrant stratus
#

Sniffer -> Animal -> AgeableMob -> PathfinderMob -> Mob -> LivingEntity -> Entity
This is more or less good enough for their needs tbh

vagrant stratus
thorn isle
#

ecs excels when you have to put together various properties and behaviors onto a bunch of different mobs that isn't neatly modelable as a type hierarchy

#

e.g. suppose you have an aging mob that doesn't do pathfinding

vagrant stratus
#

Which they don't really do afaik

thorn isle
#

i don't think so, all the ageable mobs are livestock

#

something that could benefit from ecs is stuff like monsters catching fire in sunlight

vagrant stratus
#

I believe that's just a boolean and literally only used for zombies lol

thorn isle
#

but that's a very negligible portion of the codebase and is already represented as an inherited boolean

vagrant stratus
#

Which makes ECS useless kekw

#

ECS would benefit plugin & mod devs, but that doesn't matter as much as keeping things more or less stable and just doing what works lol

thorn isle
#

if they did a rewrite, like they did in bedrock, i could see them going with ecs, but i could also see them sticking to inheritance and composition; there aren't really many benefits to be gained on the server side at least

vagrant stratus
#

a lot of stuff just doesn't really make sense as ECS either.
Why make it possible for other mobs to do bee specific mechanics. There really isn't one

thorn isle
#

most of the things that'd really benefit from ecs are already composed out of Entity itself into MovementController and Pathfinder and similar like Brain

#

beyond those two, mobs are mostly just state definition and one-off logic

vagrant stratus
#

pretty much, yea. not seeing anything major that would benefit more from ECS than the current impl

thorn isle
#

perhaps blocks, they are already sorta ecs-like with their block properties

#

which is why i tried ecs for my block system

vagrant stratus
#

AI goals do a good chunk of stuff, but those are already easy to deal with lol

thorn isle
#

i'm not too familiar with brain internals, i see them as very inefficient, perhaps ecs might help within them

vagrant stratus
#
    @Override
    protected void registerGoals() {
        this.friendsGoal = new SilverfishWakeUpFriendsGoal(this);
        this.goalSelector.addGoal(1, new FloatGoal(this));
        this.goalSelector.addGoal(1, new ClimbOnTopOfPowderSnowGoal(this, this.level()));
        this.goalSelector.addGoal(3, this.friendsGoal);
        this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0, false));
        this.goalSelector.addGoal(5, new SilverfishMergeWithStoneGoal(this));
        this.targetSelector.addGoal(1, new HurtByTargetGoal(this, (Class<?>[])new Class[0]).setAlertOthers((Class<?>[])new Class[0]));
        this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<Object>(this, Player.class, true));
    }

Silverfish, for example

#

Just clear goalSelector & targetSelector and add your own goal(s) to the specific mob

thorn isle
#

if you squint at it and turn your head sideways it's basically already ecs

vagrant stratus
#

Yea, but it works so it's not worth rewriting to be proper ECS lol

#

Maybe for a from-scratch game, but even then ehhh? It works and it's simple to use

#

extend Goal implement the relevant methods, add to goal selector

#

good enough, i'd say lol

subtle oriole
#

Is there a way to check if a player is online-mode in Bungeecord, without kicking that player?

vagrant stratus
#

I'd probably just do the same thing myself unless there's a better method that's actually objectively better lol

thorn isle
#

check if their client sends an uuidv4 (not a guarantee of online mode, tlauncher also sends a v4), then query the mojang api with the name or uuid and see if it matches what the client sent

#

it doesn't tell you whether it's actually that user and is not a login, but it's a very strong indicator that the connecting user is at least trying to log in as that mojang user

#

so at that point you should be safe to trigger the onlinemode auth process for them

vagrant stratus
#

maybe I'll use AI to come up with an AI impl, see what it comes up with kekw

subtle oriole
#

or would it be a random v4

thorn isle
#

no, it'll send some random ass mangled uuidv4 used in their skin system or something equivalently stupid

#

so checking it against the uuid you get from mojang is an almost surefire check

vagrant stratus
#

Either way means it's not a guarantee

subtle oriole
#

without even using the online-mode check?

thorn isle
#

myes, but you must also do the online mode check if you think it is an online mode user, i.e. if the name+uuid matches what you get from the mojang api

#

because nothing stops a client from sending that name+uuid

#

it's just that most launchers choose not to

vagrant stratus
#

well AI picked.... something for the AI impl

subtle oriole
vagrant stratus
#

it's certainly something

subtle oriole
#

I guess it can never match the fake v4 uuid with the mojang api

thorn isle
#

because any launcher could send the name+uuid, without really being that player

#

you still want to confirm it's the actual logged-in user

subtle oriole
#

but won't it be random v4?

thorn isle
#

it will if it wants to

#

but i can write a launcher that sends the real uuid

subtle oriole
#

oh

thorn isle
#

and if you don't double-check with the auth system, i will just forcelogin myself into your server

vagrant stratus
#

You have 0 guarantees on the legitimacy outside of praying the client plays nice and does what it's supposed to do lol

thorn isle
#

myes, the auth against mojang part is the only guarantee you get

#

all of this is just to avoid doing that if the player is in offline mode

subtle oriole
#

so in case it's v3 it will be %100 offline
if v4 check for online-mode

thorn isle
#

in other words, trust (name+uuid matches) but verify (auth against mojang)

#

if v4 AND matches the uuid you get from mojang

#

tlauncher sends a v4 uuid that doesn't match the mojang uuid

vagrant stratus
# vagrant stratus

Oh yea, thoughts on whatever tf AI came up with here for a game AI impl? @thorn isle

#

It works... i guess? Seems overkill though

thorn isle
#

looks basic but might work

#

i'd have to fiddle with it to know for sure

vagrant stratus
#
 Node attack = new Sequence()
                .add(new Condition(ctx -> ctx.get("enemyVisible")))
                .add(new Action(ctx -> {
                    System.out.println("Attacking enemy");
                    return Status.SUCCESS;
                }));

        Node heal = new Sequence()
                .add(new Condition(ctx -> ctx.get("health") < 50))
                .add(new Action(ctx -> {
                    System.out.println("Healing");
                    return Status.SUCCESS;
                }));

This is basically how it works lol

#
        AIAgent agent = new AIAgent(buildAI());

        agent.getContext().set("health", 30);
        agent.getContext().set("enemyVisible", true);

        agent.update();

buildAI() being the above code blocks

thorn isle
#

i would like typed properties for eg. enemyVisible however

#

magic strings is not nice

subtle oriole
vagrant stratus
#

lol one moment I'll see what the AI comes up with

subtle oriole
#

I hope there are no more such of manipulation issues from client side :0

thorn isle
#

pretty sure fastlogin already does all of this btw

subtle oriole
vagrant stratus
#

fuck i need to re-do this with a clear chatgpt instance.

either way it's certainly leaning towards data-driven AI lol

thorn isle
#

i think they do advertise some kind of auto detection, but i've never used it so i don't know for sure

thorn isle
#

what the fuck was it called again, i always forget

#

it's in javascript, but the "skill library" is a pretty good model of ai goals

#

but they use a llm to decide which goals to start/stop

#

and the goals themselves are written by the llm, so it can "learn" or invent new behaviors as needed

vagrant stratus
#

i don't hate myself enough to go through that lol

thorn isle
#

this is basically what i intend to do with your botcreator thing, except in java because javascript is for plebeians

vagrant stratus
#

Different person for that specifically kekw

thorn isle
#

who was that other guy

vagrant stratus
#

I'd probably just do what minecraft's doing though.
I don't need a goal system that's LLM friendly, but human friendly lol

thorn isle
#

myes

vagrant stratus
#

i took one look at the json file and noped out KEKW

thorn isle
#

if you un-escape it so it has newlines and shit it becomes much more legible

vagrant stratus
#

lot of effort just to see the code kekw

thorn isle
#
{"mineWoodLog": {"code": "async function mineWoodLog(bot) {
  const woodLogNames = ["oak_log", "birch_log", "spruce_log", "jungle_log", "acacia_log", "dark_oak_log", "mangrove_log"];

  // Find a wood log block
  const woodLogBlock = await exploreUntil(bot, new Vec3(1, 0, 1), 60, () => {
    return bot.findBlock({
      matching: block => woodLogNames.includes(block.name),
      maxDistance: 32
    });
  });
  if (!woodLogBlock) {
    bot.chat("Could not find a wood log.");
    return;
  }

  // Mine the wood log block
  await mineBlock(bot, woodLogBlock.name, 1);
  bot.chat("Wood log mined.");
}", "description": "async function mineWoodLog(bot) {
    // The function is about mining a single wood log block. It searches for a wood log block by exploring the environment until it finds one of the seven types of wood logs. If a wood log block is found, it is mined and a success message is sent. If no wood log block is found, a failure message is sent.
}"}
#

javascript nested in json, because yes

vagrant stratus
#

Ah yea. That's sane, but not exactly what I'd want or need lol

thorn isle
#

it's mostly to make it llm friendly

#

or well programmatic friendly

vagrant stratus
#

fuck the LLM

#

it just needs to get good

thorn isle
#

what i want to do is not use javascript but java, and hook into the bukkit api

#

so it can use the built in pathfinders and such

vagrant stratus
#

Attempt #2 and it gave more or less what MC is already doing lol

thorn isle
#

i also ended up modeling my ai goal system after the mc goals system for my npc plugin, but that was mostly because it was the only system i was familiar with

vagrant stratus
#

tbf i can't think of anything that's much better

#

It's basically ECS, so switching fully to ECS doesn't really change anything

vagrant stratus
#

if cleaned up anyways

#

but even then that's only somewhat better, but i think (?) would allow more complexity than MC?

thorn isle
#

sorta bootleg ecs yeah, you have your entity type which has components (magic strings in a hashmap 🤡 ) and "systems" in the conditions and actions working on each entity of that type

#

just without any of the benefits of ecs really

fallow saffron
#

i see what assumption you have about ecs, true ecs only uses primitives, not objects, and a singleton per component, where the component has pre-allocated arrays, this is why the cpu can do the work faster, it only needs 1-5 cycles because it is all contiguous and sitting in the l1 or l2 cache

vagrant stratus
#

Oh wait. I got another (maybe better) impl out of GPT

fallow saffron
#

You need to understand how the cpu works

vagrant stratus
#

relevant bit is only

GameWorld world = new GameWorld();

        Enemy goblin = new Enemy("Goblin", 0, 0);
        Enemy orc = new Enemy("Orc", 5, 5);

        // Behavior tree: flee if threat near, otherwise patrol
        SequenceNode fleeSequence = new SequenceNode();
        fleeSequence.addChild(new IsThreatNearNode(2));
        fleeSequence.addChild(new FleeFromNode(goblin));

        SelectorNode root = new SelectorNode();
        root.addChild(fleeSequence);
        root.addChild(new RepeatNode(new MoveToNode(5,5))); // patrol to (5,5) endlessly

        orc.setBehaviorTree(root);

        world.addEntity(goblin);
        world.addEntity(orc);

        for (int i = 0; i < 10; i++) {
            System.out.println("=== Tick " + i + " ===");
            world.update();
        }
thorn isle
#

it is completely irrelevant here whether anything is in arrays or hashmaps or a sql database here

vagrant stratus
#

The sequence & selector node thing is p nice imo

fallow saffron
#

i suppose thats why you had the idea that it doesn't provide significant performance improvements, if you use it like that its still just oop written a bit differently

thorn isle
#

not at all

#

we know what ecs is, trust me

#

i've written it in the "backed by contiguous arrays" approach before

fallow saffron
#

yes did you create a component class and then have an object as a fielx?

#

field*

thorn isle
#

but we're not talking about performance here

#

we're talking about how fluent it is in source code

vagrant stratus
fallow saffron
#

anyhow, you do you

thorn isle
#

i think mc just has them be stateful

thorn isle
vagrant stratus
thorn isle
#

trust me brother you're trying to teach your father how to fuck here lmao

buoyant viper
#

wild

vagrant stratus
#

Waiting on claude, but it's slow af

vagrant stratus
# vagrant stratus

This would nice impl though, if improved slightly w/ more node options.
Maybe a mix of this & the previous AI suggestion

thorn isle
#

i did something sort of similar for a quest plugin before

vagrant stratus
#

GPT's more or less defaulted to some form of MC-like GOAP AI so i guess it's just a matter of impl if that was what i'd go w/

#

Claude is uh.. more or less doing the same thing

 * AIAgent guard = AIAgent.builder("Guard")
 *     .withBehavior(BehaviorTree.sequence(
 *         Conditions.enemyInRange(8.0),
 *         Actions.chase(),
 *         Actions.attack()
 *     ))
 *     .build();
thorn isle
#

to be fair there's probably considerable bias towards minecraft source code in the java source sample set

vagrant stratus
#

Yea, I'll let this one finish up & try C++ lol

#

stupidly simple prompt too though, as i don't want to influence the AI massively

#

yea, even that's doing the same thing. so i guess it's either good enough in general, or GPT just likes it lmfao

#

just a matter of impl i guess lol

#

Claude's certainly running with the prompt lol

#

bruh fucking thing made tic-tac-toe

#

even went through all the free messages, the fuck

thorn isle
#

i just use openai with my own harness, i don't like any of the public harnesses like claude code

vagrant stratus
#

am broke lol

#

if I could I'd use a good local one, but i don't have the hardware

thorn isle
#

minimax m2.5 is pretty cheap and its numbers look pretty good

#

but it's chinese so expect the CCP to steal everything in your workspace

vagrant stratus
#

Yea, going through a few more attempts and I'd probably just do exactly what MC's doing lol

#
ai/
  core/
    AiContext.java
    NodeStatus.java
    TickResult.java
    Clock.java
  memory/
    Memory.java
    MemoryEntry.java
    InMemoryBlackboard.java
    MemoryKey.java
  events/
    AiEvent.java
    EventBus.java
    DamageTakenEvent.java
    TargetLostEvent.java
  sensing/
    Sensor.java
    SensorSuite.java
  actions/
    AiAction.java
    ActionRegistry.java
    ActionResult.java
    decorators/
      CooldownAction.java
      TimeoutAction.java
      RetryAction.java
      InterruptibleAction.java
  utility/
    Consideration.java
    UtilityCurve.java
    UtilityOption.java
    UtilityReasoner.java
    UtilityDebugSnapshot.java
  goap/
    WorldState.java
    Goal.java
    GoapAction.java
    GoapPlanner.java
    Plan.java
    GoapAgent.java
  brain/
    AiController.java
    Activity.java
    ActivityPolicy.java
    InterruptPolicy.java
    ReplanPolicy.java
game/
  NpcContext.java
  NpcSensors.java
  NpcActions.java
  NpcGoals.java
  DemoGameLoop.java

intervening got me this mess though

#

which is uh

#

yea

thorn isle
#

like they say about premature optimization, premature abstraction is also a risk

vagrant stratus
#

Yea, I have exactly 0 idea wtf it was thinking but we run with it lol

eager hawk
#

Does anyone know why this happens? I'm working on a Hide and Seek plugin, if I stand still for 3 seconds my disguise should go invisible and a real block should be placed. But 9 out of 10 times it like bugs out and no block is being placed: https://medal.tv/games/minecraft/clips/mnqCbR5V6dwP-i3M_?invite=cr-MSx4OHosMTk4OTMwNTE5

Watch bug hide and seek by xthry_ and millions of other Minecraft videos on Medal. #minecraft

▶ Play video
#

I'm sending my code 1s

thorn isle
#

what is "this"

eager hawk
#

I'm working on a Hide and Seek plugin, if I stand still for 3 seconds my disguise should go invisible and a real block should be placed

#

But 9 out of 10 times it like bugs out

#

And no block is being placed

#

These are the most important classes I think

#

Thanks for helping ! <3

thorn isle
#

we probably also need the BlockDisguise class since that's the one that has the impl for checkForStillness

#

i also don't see you calling the startTask method anywhere

eager hawk
eager hawk
# thorn isle i also don't see you calling the startTask method anywhere
package me.vuxaer.hideandseek;

import me.vuxaer.hideandseek.listener.DamageListener;
import me.vuxaer.hideandseek.listener.JoinListener;
import me.vuxaer.hideandseek.listener.MoveListener;
import me.vuxaer.hideandseek.listener.QuitListener;
import me.vuxaer.hideandseek.manager.DisguiseManager;
import me.vuxaer.hideandseek.manager.GameManager;
import me.vuxaer.hideandseek.manager.PlayerManager;
import org.bukkit.plugin.java.JavaPlugin;

public final class HideAndSeekPlugin extends JavaPlugin {

    private static HideAndSeekPlugin instance;
    private GameManager gameManager;
    private PlayerManager playerManager;
    private DisguiseManager disguiseManager;

    @Override
    public void onEnable() {
        instance = this;

        playerManager = new PlayerManager();
        gameManager = new GameManager(playerManager);
        disguiseManager = new DisguiseManager();

        getServer().getPluginManager().registerEvents(new JoinListener(), this);
        getServer().getPluginManager().registerEvents(new QuitListener(), this);
        getServer().getPluginManager().registerEvents(new MoveListener(), this);
        getServer().getPluginManager().registerEvents(new DamageListener(), this);

        disguiseManager.startTask();
    }

    public static HideAndSeekPlugin getInstance() {
        return instance;
    }

    public GameManager getGameManager() {
        return gameManager;
    }

    public PlayerManager getPlayerManager() {
        return playerManager;
    }

    public DisguiseManager getDisguiseManager() {
        return disguiseManager;
    }
}
#

The task is started in here

smoky anchor
#

how do you prevent the block moving the player ?

#

I don't think you do
you place block, the block moves the player, player moved and the block is then removed

eager hawk
#

Hmmm that might be the issue indeed!

thorn isle
#

it does look like the block is being set, and the camera moves

#

and then the block disappears

eager hawk
#

How could I prevent that from happening?

thorn isle
#

i suppose you could mount the player on an armor stand so they're immobile and have to press sneak to dismount

#

it'd also prevent you from accidentally undisguising by moving slightly

#

alternatively spectator mode so they don't collide with the block in the first place, but that can get hairy

eager hawk
#

Hmm yeah, ur right

#

I'll try to figure out a way

#

Thanks yall!

vagrant stratus
#
    private static boolean blocksMotion(Block block) {
        Material mat = block.getType();
        return mat.isSolid() && mat.isOccluding() && mat != Material.COBWEB && mat != Material.BAMBOO_SAPLING;
    }

Any idea if Spigot already has this exact thing? If not I'll just keep it lol
I'm bumping some NMS stuff up to a public api kekw

lilac dagger
#
    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <dependency>
        <groupId>com.github.fr33styler.botcreator</groupId>
        <artifactId>bot-creator-api</artifactId>
        <version>v2.0.0</version>
    </dependency>

I released it, I might adjust some things tho @orchid gazelle @thorn isle
https://github.com/Fr33styler/BotCreator

thorn isle
#

right you're the bot guy

#

very nice

lilac dagger
#

it's still very basic

vagrant stratus
lilac dagger
#

i might adjust some packages around

#

but functionality wise it works fine

thorn isle
#

something that'd be useful for my le embodied agent is maybe world storage, as in receiving chunk packets and storing the sections in memory

#

but since i'll package it into a plugin anyway, i'll probably just use bukkit for world access

lilac dagger
#

You can just read the chunks

#

It's an extra packet

young knoll
vagrant stratus
#

that's just collision shape. I'm not entirely sure that 1:1's the functionality

#

huh neither CraftBlockState or CraftBlock call the relevant method

#

Does anything in the API make BlockBehavior accessible 🤔

#

Acually it's BlockBehavior -> BlockStateBase

       @Deprecated
        public boolean blocksMotion() {
            final Block block = this.getBlock();
            return block != Blocks.COBWEB && block != Blocks.BAMBOO_SAPLING && this.isSolid();
        }
        
#

Just realized it's deprecated. TF is replacing it then?!

#

and why are enderman still using it?!

#
        final boolean flag = blockstate.blocksMotion();
        final boolean flag2 = blockstate.getFluidState().is(FluidTags.WATER);
        if (flag && !flag2) {
#

why does LivingEntity#randomTeleport take a PlayerTeleportEvent but isn't public API

#

wtf bruh

#

rioting

umbral ridge
thorn isle
#

lmao

thorn isle
lilac dagger
#

yeah i know

#

it depends what you want to do with those chunks

thorn isle
#

anything, basically

#

but like i mentioned i will probably end up just using the bukkit api for world state access, as the bot would be packaged in a plugin

#

it'll be a fit fucked if there are other plugins sending per-player blocks or entities, but for 90% of cases it'll be good enough

#

for integration testing specifically, however, we do want at least clientside inventory support

#

the most productive use case i see for this is bundling it into the test runtime of a plugin and running it with runPaper so predictable integration tests can run on what the client sees

#

step the server tick by tick, assert client state, send client actions, assert server state, rinse and repeat

#

mockbukkit is pathetic and useless for any realistic testing

lilac dagger
#

okay, let me minify netty

rough sonnet
#

just run a client on the same jvm

lilac dagger
#

12mb with it shaded

#

i managed to get it down to 1.5 mb

rough sonnet
#

why do you need to do that?

thorn isle
rough sonnet
#

can't use a different classloader?

quaint basin
#

https://imgur.com/a/9GA4n2z

I have an i5-13500 CPU with 6 efficient cores and 8 performance cores. I have 3 servers: proxy, SMP, and Box1. I'm thinking of doing something like taskset -c 0,2,4 java -jar ... for SMP; then 6, 8, 10 for Box1; then 1, 3, 5 for Velocity. And as I get more players, I'll create Box2, Box3, Box4, etc., which will occupy cores 7, 8, 10, then 11, 13, 15, and so on. From what I've seen, cores 0-11 are the performance cores, where the odd cores from 0 to 11 are hyperthreaded, meaning they are slower than the even cores from 0 to 11. That's why I only use them for Velocity and for the other Box servers as needed. Am I doing this right, or should I let Linux manage this for me and simply use java -jar ... for everything?

I'm even considering using efficient cores instead of performance cores for Velocity, Box2, Box3, etc., because it seems that if the P-Cores are heavily overloaded, their corresponding hyperthreads become worse than an E-Core, and I think that will be the normal case since it's a minecraft server running on a P-Core
I'm saying this based on artificial intelligence, so if anyone with knowledge in this area could give recommendations, I would be grateful

chrome beacon
#

Just let Linux manage it

solid heart
#

Why is the material for repeaters DIODE instead of REDSTONE_REPEATER?

#

hmmm idk how to do inline code

thorn isle
#

Use two backticks instead of 3

worldly ingot
vagrant stratus
#

kekw

solid heart
worldly ingot
#

That was what Bukkit developers decided to call it when it was added

wet breach
worldly ingot
#

That may also be the case

solid heart
worldly ingot
#

Some items were named differently. Reeds (sugar cane), watch (clock)

#

Spades instead of shovels I think too

wet breach
#

now what bukkit did do was had a habit of not updating names for stuff lol

#

and kept old names

chrome beacon
#

Yeah Mojang called it Diode for a while

lilac dagger
#

same with shovel and spade

wet breach
#

so bukkit would have classes or variables with old names and mapped them to new names except for the classes

solid heart
#

Is there any easy was of converting the Bukkit Material to the minecraft names in 1.8.8?

chrome beacon
#

XMaterial

solid heart
chrome beacon
#

Yeah

solid heart
#

hm ok thanks

chrome beacon
#

or do you mean to display the names?

vagrant stratus
#

Speaking of spellings

    
    public int getMoistnessLevel() {
        return this.entityData.<Integer>get(Dolphin.MOISTNESS_LEVEL);
    }
    
    public void setMoisntessLevel(final int level) {
        this.entityData.<Integer>set(Dolphin.MOISTNESS_LEVEL, level);
    }
    
#

ha

#

tsk tsk tsk

lilac dagger
#

moist

solid heart
lilac dagger
#

which ide do they use?

#

i just autocomplete these with intellij

vagrant stratus
lilac dagger
#

ah wait, it's not autocompletable

young knoll
#

Did 1.8.8 even have names in /give

#

I thought it was still numeric ids back then

thorn isle
#

hell if i remember

quaint basin
buoyant viper
#

it had both iirc

#

until like 1.13 or whenever <the flattening> occurred

chrome beacon
#

Yeah 1.13 ^

grave abyss
#

Hi from where can i get spigot engine source code

grave abyss
#

alr got it from buildtools

wet breach
wet breach
# young knoll I thought it was still numeric ids back then

Named ids were a thing up until 1.13 however not everything had a named id and sometimes when using magic numbers you had to use id. Also ID was popular even when named ids existed because of chat send length being more limited then what it is now and then command blocks as well.

#

Then mojang fixed those issues so id's are not strictly necessary but i still prefer id's

solid heart
grave abyss
wet breach
# solid heart Why is that? I feel like they're not good

Because in terms of efficiency/optimizing it is better to have an array of ints than it is strings. They should have made strings purely front side of server and user configurable in terms of mapping. Back end wise it should just be ints as they are easier to manipulate and handle. Thats my opinion anyways.

#

Also I am great at bitmasks and bitshifting

#

So with ints i can take advantage of that but not with pure strings

solid heart
#

If what you're doing requires that level of optimization then sure, but otherwise I personally feel like the Strings are better because the ids are kinda magic numbers

wet breach
#

Sure but not all magic numbers are bad

#

You can't even really eliminate that completely

solid heart
wet breach
#

Well enums are always loaded and never go away at least not without using some kind of hack, but i suppose for this they would always be loaded anyways.

solid heart
#

Loaded as in, they are in RAM?

wet breach
#

Is there another kind?

solid heart
#

Just wasn't clear to me

#

I don't know much about how JVM works at a very low level like that

wet breach
#

Your class is either loaded or its not. Enums are always loaded

#

If its a large enum you cant like unload even partial of it

#

Anyways magic numbers are only bad if you dont have them documented.

#

Your internet runs off magic numbers

#

In regards to mc they were only bad because mojang would occasionally change them up lol

#

Not really suppose to do that lol

solid heart
solid heart
wet breach
#

They can be changed, hence custom protocols existing. The difference is that they are well documented

#

You can have your internal network use something other than tcp or udp

#

All you have to do is just tell the systems what that protocol is aka drivers

#

For example in the internet protocol (IP) it is typically forbidden to have 2 systems with the same IP. But nothing says you can't do it anyways.

#

As long as both systems dont collide on what they are listening and sending to, you can hide systems this way

wet breach
#

Ip addresses

solid heart
#

Yes

wet breach
#

Port sharing is already a thing and has been for decades

solid heart
wet breach
#

Nope they can use same ports, just as long they are not listening for the same thing

solid heart
wet breach
#

As i said port sharing is already a thing on your system. You can have multiple applications on the same port

#

Key is what they are looking for packet wise is not the same

wet breach
solid heart
#

Cool

wet breach
#

Correct

solid heart
#

Is there any reason to run more than one application on the same port?

wet breach
#

You might have a logger that you want to be kept separate from the application receiving is an example. Or lets say you run game servers but dont want to configure multiple ports you can just run them all on the same port

#

In terms of firewall rules its far easier to manage rules for a few ports than many of them

#

Maybe your isp limits what ports can be open or how many is also another good one

#

But point is yes the protocols are indeed old but not unchangeable. Maybe for the general public at large but only as long as they dont have the driver to understand your protocol though this includes routers but you can totally have a custom protocol internally and many businesses do indeed run custom protocols

#

But its all magic numbers. Packet id's, header lengths, data lengths, packet sizes etc. They are not strings just a bunch of numbers and bitmasks and offsets lol

#

So in a way i agree magic numbers can be bad, but only if you dont document what those numbers are for or what they do lol. And in regards to unreadable code, you dont have to stick with the magic numbers you could just use the mapping or make one on the fly

#

If mappings were configurable to begin with where a user can name the ID's as they please then it solves that issue. And in regards to clients it would just be sent as a payload like the registries already

lilac dagger
#

Packet ids in Minecraft increase automatically in the addpacket method

#

Which is super nice

#

So the devs don't have to work with magic numbers

#

It's automatic

wet breach
#

Well tcp does that too

#

But that is nice as well

#

But yeah there are ways to have magic numbers and also not deal with them at the same time lol

rough sonnet
sullen marlin
#

I don't think it's global

young knoll
#

It’s not

#

There is a global mapping for int -> Blockstate but that’s only used for networking

thorn isle
#

The palette used by chunk sections depends on the number of different blockstates in the chunk

#

Linear palette is used for under 8, iirc, and a hashmap based palette until 256 or something fairly large

#

Larger than that and it will use the global palette

#

In practice however you probably will never see a section use the global palette since the threshold is so high, except perhaps in a debug world

young knoll
#

There’s also a single palette

#

For single blocks

#

An indirect palette is used for 2-256 different states

#

And the global palette is used past 256

thorn isle
#
public abstract class Strategy<T> {
    public static final Palette.Factory SINGLE_VALUE_PALETTE_FACTORY = SingleValuePalette::create; // Paper - Anti-Xray
    private static final Palette.Factory LINEAR_PALETTE_FACTORY = LinearPalette::create;
    private static final Palette.Factory HASHMAP_PALETTE_FACTORY = HashMapPalette::create;
    static final Configuration ZERO_BITS = new Configuration.Simple(SINGLE_VALUE_PALETTE_FACTORY, 0);
    static final Configuration ONE_BIT_LINEAR = new Configuration.Simple(LINEAR_PALETTE_FACTORY, 1);
    static final Configuration TWO_BITS_LINEAR = new Configuration.Simple(LINEAR_PALETTE_FACTORY, 2);
    static final Configuration THREE_BITS_LINEAR = new Configuration.Simple(LINEAR_PALETTE_FACTORY, 3);
    static final Configuration FOUR_BITS_LINEAR = new Configuration.Simple(LINEAR_PALETTE_FACTORY, 4);
    static final Configuration FIVE_BITS_HASHMAP = new Configuration.Simple(HASHMAP_PALETTE_FACTORY, 5);
    static final Configuration SIX_BITS_HASHMAP = new Configuration.Simple(HASHMAP_PALETTE_FACTORY, 6);
    static final Configuration SEVEN_BITS_HASHMAP = new Configuration.Simple(HASHMAP_PALETTE_FACTORY, 7);
    static final Configuration EIGHT_BITS_HASHMAP = new Configuration.Simple(HASHMAP_PALETTE_FACTORY, 8);
#

yeah looks like i got the linear palette threshold wrong, it's 16 and not 8

young knoll
#

I’m just going off the protocol on the wiki

#

It might be a bit different in memory

thorn isle
#

seems about right

#
                return (Configuration)(switch (bits) {
                    case 0 -> Strategy.ZERO_BITS;
                    case 1, 2, 3, 4 -> Strategy.FOUR_BITS_LINEAR;
                    case 5 -> Strategy.FIVE_BITS_HASHMAP;
                    case 6 -> Strategy.SIX_BITS_HASHMAP;
                    case 7 -> Strategy.SEVEN_BITS_HASHMAP;
                    case 8 -> Strategy.EIGHT_BITS_HASHMAP;
                    default -> new Configuration.Global(this.globalPaletteBitsInMemory, bits);
                });
young knoll
#

If you have more than 256 different block states in a single 16x16x16 area that’s pretty Wack

thorn isle
#

though it looks like it uses the 4-bit linear map for bits 1-4

young knoll
#

Yeah it doesn’t bother going below 4 bits

thorn isle
#

yeah i don't think that is going to happen unless someone really tries to make it happen

young knoll
#

Free optimization!!!!11

#

I’m going to make an unoptimized server fork that always uses the global palette when sending chunks >:D

thorn isle
#

you mean 1.8

#

or whenever palettes were even introduced

#

did 1.8 have palettes yet? for the longest time we just had 8 bits per block type and then an extra 8 bits of "damage value"

young knoll
#

No idea

#

That was back when dinosaurs still existed

thorn isle
#

i remember experimenting with per-bit-width implementations of the strategy

#

for them magic multiply division things

#

where instead of dividing by a number you multiply with a big magic number and then right shift

#

and since the bit width was a constant, jit was free to go ham with whatever magic number substitutions it could come up with

#

however there were no measurable performance gains

covert stump
#

These errors are coming up...

#

Ig mainly because my host is using python 3.13?

thorn isle
#

har har har python

worldly ingot
#

tf are you doing on a Minecraft server where Python is involved?

thorn isle
#

it's like skript but for "programmers"

buoyant viper
worldly ingot
#

Okay, unrelated. That makes more sense

covert stump
covert stump
#

switched to Python 3.12

hard turtle
#
CraftArmorStand craftSeat = (CraftArmorStand) seat;
                    EntityArmorStand nmsSeat = craftSeat.getHandle();
                    nmsSeat.setGravity(false);
                    nmsSeat.setPositionRotation(newLoc.getX(), newLoc.getY(), newLoc.getZ(), newLoc.getYaw(), newLoc.getPitch());
#

guys

#

why the setGravity(false) is not working??

#

help pls

#

the armorstand keeps falling

slender elbow
#

i dont know sorry

thorn isle
#

😔

wet breach
young knoll
#

They already fixed it

#

Apparently the NMS setGravity is misnamed and should be setNoGravity

wet breach
#

ah, didn't realize it was continued in general lol

onyx fjord
#

is inventory#getholder performance better than in the past?

thorn isle
#

on paper yes, if you pass false for snapshot

#

on spigot it still shits bricks

young knoll
#

There’s still no need for custom holders tho

rough sonnet
young knoll
#

Yes

#

But holders weren’t designed to be used for identifying custom inventories

young knoll
#

I mean if you are making paper plugins and can use their no snapshot method then I guess it’s fine

#

Otherwise you are just making bad plugins

eager hawk
#

Hi there, I'm working on a Hide and Seek plugin. Whenever a Hider is running around, I can hit them. But as soon as they turn into a BlockDisplay, I am not able to hit the block and register a hit. I have tried so many different solutions, but nothing is really making a difference (have been trying for hours straight haha).

Is there anyone that might know a fix for this?

Here are the most important classes, if you need any other classes, feel free to let me know.
DamageListener: https://pastebin.com/f8Bjv0ZQ
BlockHitListener: https://pastebin.com/kjRhU0wW
BlockDisguise: https://pastebin.com/nGqeEwxn

Thanks for your help in advance!

thorn isle
#

i haven't looked at anything, but block displays aren't interactable

#

if there's no physical block there, you need an Interaction entity for an interactable hitbox

eager hawk
#

By this, do you mean the BlockDisplay should be replaced by a real block or what do you think would work?

#

I am working with BlockDisplays indeed.

#

The player is also being teleported to the blockdisplay position, ive tried looking if the location of the player matches with the location the seeker is trying to hit, but that didn't seem to work

#

I'm not really a fan of AI, but because I'm pretty lost I have tried asking it anyway, it told me to detect left click in air and ray trace forward, but that did not have any effect either.

young knoll
#

BlockDisplays have no hitbox

thorn isle
#

i mean keep the block display but also spawn a matching Interaction

young knoll
#

Add an interaction entity as a passenger so they actually have a hitbox

thorn isle
eager hawk
#

Oh I have never worked with that, thank you very much I will have a look!

thorn isle
#

it's basically an invisible hitbox

#

specifically meant to make things that normally don't have hitboxes interactable

eager hawk
thorn isle
#

turn on hitboxes in the client debug and see if it matches the block display

eager hawk
#

Ah okay I can tell the hitbox does not match the block indeed! I'm gonna try to fix that right now

#

Thanks <3

#

Is there an easy way to match the hitbox with the blockdisplay ?

thorn isle
#

add a vertical translation to the transformation of the block display

#

and move the entity itself a bit lower

#

or ditch the passenger approach and teleport the interaction to the display every tick

#

that's generally something you want to avoid as it easily looks jittery, but since interaction entities are invisible, it doesn't matter

eager hawk
eager hawk
thorn isle
#

👌

smoky anchor
#

@eager hawk I'm not so sure if Block Displays are great for this
They don't have the same lighting as placed blocks, they have no AO
In some cases it may be rather easy to just see the hider

#

(I am using perf. mods, they may alter the way the game looks here, do test this yourself)

eager hawk
thorn isle
#

didn't you have it set up so that when the player stops moving, it turns into a regular block? or was that someone else

#

but yes, block displays are very easy to tell apart from regular blocks if you're looking for them

eager hawk
#

But I might be better off switching to regular blocks then

#

I don't know how yet, because rn the player stands inside of the blockdisplay, but ofc that's not possible with real blocks since they will push the player out of it

#

Spectator mode is what comes up in my mind but the player needs to be able to move and jump as well when leaving the solid block position

smoky anchor
#

just change the players size and teleport them right on top of the newly placed block

#

hahah

eager hawk
smoky anchor
#

you can disable collisions
with teams I think

thorn isle
quaint basin
thorn isle
#

yes* except maybe if the config has specifically a null value for that key, but i'm not sure if that's treated as absent

tender shard
#

TL;DR yeah if "def" is not-null, return value is guaranteed to be not-null

#

I hate java

thorn isle
#
    public boolean isSet(@NotNull String path) {
        Configuration root = this.getRoot();
        if (root == null) {
            return false;
        } else if (root.options().copyDefaults()) {
            return this.contains(path);
        } else {
            return this.get(path, (Object)null) != null;
        }
    }

yeah it looks like MemorySection treats nulls as not present

tender shard
#

that whole config api of bukkit is kinda weird

thorn isle
#

yaml in general is kind of ass and bukkit wrapping it into another poorly thought out abstraction layer didn't help

tender shard
#

yeah lol

#

although I think YAML in general is pretty nice

ivory sleet
#

yea the config format is nice itself in the right place

thorn isle
#

it's good in some aspects and okay in others, problematic in a few

slender elbow
#

people need to get introduced to object mapping early in life

lilac dagger
#

can you show an example?

#

sounds pretty straight forward to me

ivory sleet
#

thats an example of it

#

afaik object mapping is quite general where it means u have some isomorphism (one-to-one) mapping between two domains and that is to a large extent/completely structure preserving (might omit certain transient fields for example ^^)

slender elbow
#

yeah I more so mean automagic object mapping that gson jackson ktx.serial etc do

#

you know, that thing where you just tell gson "give me a list of this Person class"

ivory sleet
#

oooh yea

rancid stream
#

guys i need help

sullen marlin
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

hushed spindle
#

was Base64Coder removed in this latest release?

eager hawk
smoky anchor
# eager hawk Whenever the seeker tries to hit the top of a block (disguised player), it hits ...

mmm you can hide the hider from the seeker. Not sure if this method works for players.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#hideEntity(org.bukkit.plugin.Plugin,org.bukkit.entity.Entity)
that should make the hider intangible for the seeker and prevent some cheats that show invisible players (I assume that's how you do it now)

misty ingot
#

whats the best way to check for a specific custom structure near a specific block? (im assuming that hard coding every single coordinate for every required block relative to said block is not the best method)
context: players need to make a small structure and when they place a player's head on it, a piece of code will run and the structure will dissapear

tender shard
#

how large is that structure?

#

checking blocks in already loaded chunks is quick

slender elbow
#

1,000,000,000,000 blocks³

#

spread in a 1x1 line

tender shard
#

that seems like a structure bigger than oliver193's mom

#

in that case I'd use chunk snapshots

chrome beacon
#

💀

young knoll
#

I would compare it to an nbt structure loaded with the api

#

Makes it easy to change the structure

thorn isle
#

either that or a worldedit schematic

#

especially if the structure is user-defined

quaint basin
#

what's difference between EntitiesUnloadEvent and EntityRemoveFromWorldEvent ?

thorn isle
#

did we not spend like an hour talking about this just the other day

#

.

tender shard
#

RemoveFromWorld is when it "dies" - is gone forever

thorn isle
#

the other way around

#

RemoveFromWorld fires when the entity stops being in a world

tender shard
#

oh my bad

thorn isle
#

due to

  • being unloaded
  • dying
  • going to another world
tender shard
#

yeah anyway, javadocs explains it pretty well

thorn isle
#

unloaded means the chunk it is in was unloaded

tender shard
thorn isle
#

you said removefromworld means it's gone forever

#

in a certain sense unloadedevent is a subtype of removefromworldevent; unloading a mob causes it to stop being in the world

tender shard
#

RemovedFromWorld = gone
UnloadedEvent = chunk unloaded but might be back again when the chunk gets loaded again?

thorn isle
#

no

#

removefromworldevent also gets fired when it unloads

#

because it ceases to be in the world

tender shard
#

ah ok

thorn isle
#

once it loads it will appear again with an entityaddtoworldevent

tender shard
#

ok makes sense

thorn isle
#

the remove and add events are especially useful to maintain caches or lists of loaded entities that you might want to e.g. tick

#

since they by definition mark the start and end of a loaded entity's lifecycle

#

for example, i used them in villager lobotomizatornator to track lists of lobotomized and alive villagers to check periodically and to restock their trades

#

it's much cheaper than iterating over all entities in the world, especially when targeting mobs that are relatively rare, like villagers, or in his case "minions"

quaint basin
#

alr

#

thanks

thorn isle
#

this is exactly what i said last time btw

trail flicker
#

It's unfortunate that there's no way to actually save maps into map_#.dat files without them being blank. I think I would have to resort to listening EntitiesLoadEvent and then filter to ItemFrames with maps in them, then hooking up MapRenderer based on ID read from ItemFrame.
Unless there's some API library that does allow that?

quaint basin
thorn isle
#

what're you trying to do

#

if you're trying to do image maps, several plugins for that already exist

tender shard
trail flicker
#

I'm trying to save maps into map_#.dat files, so that they can persist across server restarts

thorn isle
#

i don't remember if it does persistence, but it does image manipulation and protocol nonsense to spawn per-player item frames with maps at least

#

if you really want to actually write to the file yourself, it's pretty simple as well; it's a 2d array of 128x128 bytes, each representing a palette color

slender elbow
#

i feel like i'm having deja vus twice a week or something

thorn isle
#

however i would recommend against doing this if you're trying to do "images on maps"

#

as all map.dat's are stored permanently in memory

#

and not very efficiently at that

trail flicker
#

Bukkit/Spigot already permanently stores them in memory, as 128x128 bitmap with all pixels being transparent. Generating new maps on every restart would waste more memory, not less

thorn isle
#

yes, so my recommendation is not going through bukkit for them at all

#

but rather using something like MapEngine to manage them on the protocol layer

#

i.e. the server is not aware of your custom maps at all, and a plugin sends their data to clients on demand instead

trail flicker
#

Basically there are two states: "idle" and "active". Active does animations and stuff, bukkit API already allows that. "idle" is just an item frame with a map picture existing in the world, until right-clicked. I don't want to write protocol stuff for all random itemframes with my maps in them, vanilla behaviour is enough.

thorn isle
#

eyeballing mapengine, it doesn't seem to offer persistence

#

you can take a look at husksync like mfnalex suggested, or you can write to the .dat manually; the format is simple and you can grab the palette bytes directly from the bukkit canvas

trail flicker
thorn isle
#

i'm not aware of any public api or library that'd do the persistence for you, someone else might; nms is also an option

desert rock
#
public class WoodCuttingListener implements Listener {

    private final Set<UUID> activeCutters = new HashSet<>();

    public WoodCuttingListener(JavaPlugin plugin) {
        Bukkit.getScheduler().runTaskTimer(plugin, () -> {
            for (UUID uuid : new HashSet<>(activeCutters)) {
                Player player = Bukkit.getPlayer(uuid);
                if (player == null || !player.isOnline()) {
                    activeCutters.remove(uuid);
                    continue;
                }
                Block target = player.getTargetBlockExact(5);
                if (target == null || !Tag.LOGS.isTagged(target.getType())) {
                    stopCutting(player);
                    continue;
                }
                player.damage(1.0);
            }
        }, 5L, 10L);
    }

    @EventHandler
    public void onBlockDamage(BlockDamageEvent event) {
        Player player = event.getPlayer();
        if (Tag.LOGS.isTagged(event.getBlock().getType()) && !isAxe(player.getInventory().getItemInMainHand().getType())) {
            activeCutters.add(player.getUniqueId());
            updateBreakSpeed(player, 0.0);
        }
    }

    @EventHandler
    public void onBlockDamageAbort(BlockDamageAbortEvent event) {
        stopCutting(event.getPlayer());
    }

    private void stopCutting(Player player) {
        if (activeCutters.remove(player.getUniqueId())) {
            updateBreakSpeed(player, 1.0);
        }
    }

    private void updateBreakSpeed(Player player, double value) {
        AttributeInstance attribute = player.getAttribute(Attribute.BLOCK_BREAK_SPEED);
        if (attribute != null) attribute.setBaseValue(value);
    }

    private boolean isAxe(Material material) {
        return material.name().endsWith("_AXE");
    }
}``` If you hold down the LMB on the block and look at the air, then back at the block, you can break it with anything. How to fix?
thorn isle
#

does it fire the events in the order you expect?

desert rock
#

When I look away from the block onBlockDamageAbort is triggered, but when I look back at the block onBlockDamage is not triggered

thorn isle
#

i wonder if that might be an api bug

#

you'd assume that if BlockDamageAbort fires when looking away, BlockDamage would fire again when looking back

#

i suppose you could not use the bukkit api and instead listen to whatever packet gets sent when a player starts mining a block

#

that's what people used to do before these events

thorn isle
desert rock
chrome beacon
#

?services

undone axleBOT
torpid halo
spring tartan
#

cam anyone help me make a simple minecraft server

solid heart
wraith spade
#

hey, can anyone help me with two things? firstly, I want it so it detects any player within 15 blocks, gets their loc and then puts lightning on then, and it also deals five hearts. I also want to make it so when hitting with a specific sword, it will have a 10% or so chance to give the person 3 hearts of tick damage and the person who hits them 3 hearts of "tick damage" back, if possible can you explain how/what the code means since i feel pretty bad if i just copied code especially since im asking for a lot, very new btw, thank you in advance.

solid heart
#

also, what do you mean by "tick damage"

wraith spade
#

particularily i want it to be a trident when you left click it does 15 blocks around the player who left clicked it and when you right click 15 blocks wherever the trident lands

#

and tick damage like when you jump in the void

#

but ofc less damage but idk if thats possible

solid heart
wraith spade
#

sorry if i worded that confusing

solid heart
# wraith spade hey, can anyone help me with two things? firstly, I want it so it detects any pl...

So, for detecting when a player left clicks, you're going to want to listen to PlayerInteractEvent. Then, check if the player is holding a trident, and the action was a left click. You can use getNearbyEntities and then filter for players to get a list of nearby players. To check when a trident lands, you can use ProjectileHitEvent. To strike lightning that deals an amount of damage that you choose, use getWorld.strikeLightningEffect(), and then call damage() on the right players

#

For the sword, you'll want to listen for EntityDamageByEntityEvent. To get a random number you can use Math.random(). To do damage over time, you can use a runnable.

wraith spade
#

thank you so much 🙏

solid heart
wraith spade
#

yep, i will def try that and if i need help with a part ill ask, thank you

fallow saffron
#

It's better to check if it isnt a trident or a right click etc and return early

wraith spade
#

@EventHandler()
public void OnClick(PlayerInteractEvent event) {
if(event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.TRIDENT))
if (event.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().contains("Lightning")) {
Player player = (Player) event.getPlayer();

            // Right Click
            if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
                if (!list.contains(player.getName()))
                    list.add(player.getName());
                return;
            }
            // Left click
            if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
                // 15  block stuff
                Location tridentleft = player.getLocation();
                for (Entity playersnear : tridentleft.getWorld().getNearbyEntities(tridentleft, 15, 15, 15)) {
                    if (playersnear instanceof Player) {
                        if (!tridentlist.contains(player.getName()))
                        tridentlist.add(player.getName());
                        if (tridentlist.contains(player.getName())) {
                            Location tridentlightning = player.getLocation();
                            tridentlightning.getWorld().strikeLightning(tridentlightning);
                            player.damage(10.0);
                        }
                    }
                }
            }

        }

}
#

@EventHandler
public void onLand(ProjectileHitEvent event) {
if (event.getEntityType() == EntityType.TRIDENT) {
if (event.getEntity().getShooter() instanceof Player) {
Player player = (Player) event.getEntity().getShooter();
if (list.contains(player.getName())) {
// 15 blocks around it
Location tridentthrow = event.getEntity().getLocation();
for (Entity playersnear : tridentthrow.getWorld().getNearbyEntities(tridentthrow, 15, 15, 15)) {
if (playersnear instanceof Player) {
if (!tridentlistthrow.contains(player.getName()))
tridentlistthrow.add(player.getName());
if (tridentlistthrow.contains(player.getName())) {
Location tridentlightning = player.getLocation();
tridentlightning.getWorld().strikeLightning(tridentlightning);
player.damage(10.0);
}
}
}
}
}
}
}

}

#

this doesnt work, ik there are prolly multipel thigns wrong but nothing obvious bcuz intellj idea hasnt picked up anything

#

i tried with a friend it didnt do lightning or any damage, so its probably related to the list and picking up them on it to run the lightning, if i had to guess

#

if there are any obvious mistakes its prolly from me copying it from idea

#

like really obvious ones

fallow saffron
#

What are you trying to achieve?

wraith spade
#

so bascially when you left click, it picks up on all players within 15 blocks, and strikes them with lightning and does 5 hearts. and when you right click it does the same but on where the trident ladns

#

lands*

fallow saffron
#

First of all you should do null checks, like if (playersnear instanceof Player) playersnear may be null, so do if (playersnear == null) continue before checking instanceof

#

otherwise you would flood the console with NPE's

wraith spade
#

oh yeah i should check console

fallow saffron
#

Also why do you have a list?

wraith spade
#

in console nothing c omes up

#

good point

fallow saffron
#

Are you using it elsewhere?

#

the list

wraith spade
#

not really but there could be multiple players within 15 blocks

#

but it probably doesnt matter

fallow saffron
#

you don't need a list, since you are looping through all nearby entities

#

and then checking if they are instanceof Player

#

it will apply it to all of them

#

Can I DM you? better than here

wraith spade
#

alright

quaint basin
#

crateId = new NamespacedKey("ExcellentCrates", "crate.id");
keyId = new NamespacedKey("ExcellentCrates", "crate_key.id")

#

how can I solve this?

mortal vortex
#

a-z not a-zA-Z

quaint basin
#

oh yea thanks

mortal vortex
#

welc gng

#

keep thugging big ligma

tender shard
#

TLDR; left part of NamespacedKey must be lowercase

#

probably because of Windows support, which is the only current OS in use today that can't deal with both FOLDERNAME and foldername being at the same space

quaint basin
#

I read it, but I'm stupid

quaint basin
#

what's the replacement for PlayerLoginEvent?

umbral ridge
#

Doesnt it say in description?

#

?whereami

quaint basin
umbral ridge
quaint basin
#

Why do I need Cloudflare WARP to join Minecraft servers in the newer versions?

chrome beacon
#

You don't

#

unless you have something on your network or isp blocking it

quaint basin
chrome beacon
#

Somethings filtering packets ig

#

and doesn't like the newer version

quaint basin
#

Well, I'm not the only one reporting this problem

chrome beacon
#

And everyone just happens to be running warp/vpn to fix the issue?

buoyant viper
quaint basin
#

maybe tlauncher issue. i'll see the original launcher

desert rock
#

Why doesn't setSprinting(false) work?
How can I cancel a sprint for a player?

buoyant viper
#

kill them

chrome beacon
#

but doesn't prevent them from sprinting again

quaint basin
#

how can I disable the redstone on spigot configs?

#

or paper configs idk

desert rock
chrome beacon
#

cancel the event?

desert rock
chrome beacon
#

You probably want to set the hunger to stop spriting

#

or is there an attribute for that now?

#

Anyways since there will be latency between the event and the player actually starting to sprint

desert rock
toxic goblet
#

Hello guys i have created a plugin and im trying to make a custom texture pack for it but i dont understand how to do it i have created a file with all of the textures and models but i cant get it to work

chrome beacon
#

and what have you tried

toxic goblet
#

i have tried putting some override thing i dont really understand in in some .json files and custom id data or smth then put on the recource pack but nothing happened

chrome beacon
#

You're going to have to be a lot more specific than that

smoky anchor
toxic goblet
# smoky anchor What version are you making the resourcepack for. That is important You say you'...

im using 1.21.11 i have created custom swords with custom abilitys and i want custom models for them so far i have created a folder with
assets - minecraft - models - item. then the custom items name.json
pack.mcmeta textures - item. then png of the custom textures
pack.png
thats the stuff i have in the folder i dont know what more i need to explain this is my very first plugin and recource pack

smoky anchor
# toxic goblet im using 1.21.11 i have created custom swords with custom abilitys and i want cu...

Ok, so you only need simple custom model, great!
I'd recommend just opening up the vanilla resourcepack (or use this github link) and copying stuff from there
Per each custom model you will need the following files
namespace/items - Eg
namespace/models/item Eg
namespace/textures/item Eg
I'd recommend not using the minecraft namespace and instead using your own
then on the plugin side, when creating your custom items you call setItemModel the key is created from the bolded parts: minecraft/items/acacia_boat.json (here you'd use your namespace and your item model definition file name)

smoky anchor
#

eh

#

I don't think I could write a decent guide

buoyant viper
#

one of the pages is literally just a list of particle names from 1.8

#

ur good

smoky anchor
#

lol

buoyant viper
#

someone else could always come by and improve it later

smoky crow
#

Hi, I'm new to plugin development, where should I start?

chrome beacon
#

Do you have any programming experience?

thorn isle
#

giving me money is always a good way of starting anything

solid heart
misty ingot
#

im trying to make a system where when a player dies, their head is placed nearby at a safe spot
but im facing an issue with if the player dies to the end void and theres no blocks nearby to put the head on, or if they die by drowning in a large ocean where theres no "safe" blocks nearby

have you guys run into this problem before? whats the best compromise for this?

misty ingot
#

woops

#

?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! 🎉

misty ingot
#

there we go

young knoll
#

You could put it on top of the ocean

#

Or just track where they last touched solid ground

still bear
#

Hey, I'm looking for an experienced Java developer specialized in high-performance backend systems. Must be proficient with NMS, packet handling, and asynchronous data management (Redis/SQL). If you're interested in building a scalable, custom engine from the ground up, please DM me for a brief technical discussion.

young knoll
#

?services

undone axleBOT
still bear
slender elbow
mortal hare
#

is it possible to somehow for intellij to download javadocs of std lib?

thorn isle
#

it does that for me when i click the "download sources" button, or do you mean the html javadocs specifically?

chrome beacon
#

Download sources and documentation

thorn isle
#

also works for any external libraries that have published sources

lilac dagger
#

it wasn't automatic for me

#

only the docs were

mortal hare
#

yea

#

just realised that arch packages docs externally

lilac dagger
#

then yeah use package manager to dl sources for your jdk version

#

it was something openjdk-version-sources

#

then here just add it

#

/usr/lib/jvm/openjdk-25

#

for me it's here

#

probably for you as well

mortal hare
#

ofc arch puts docs somewhere else

#

because why wouldnt you

#

we love fragmentation

lilac dagger
#

you can use the docs like this

mortal hare
#

does community edition has branch coverage ui available in intellij?

#

i remember on ultimate edition there was this feature where you can visually see which test reaches what branch

#

not sure if this is paid feature or not

lilac dagger
#

I have not tried this yet

thorn isle
#

this shit again

slender elbow
#

choke on a blender

thorn isle
#

it's unreal how i get locked out of my account any time i DM someone first, but these spambots continue to be a problem year after year with seemingly no checks or balances on them

lilac dagger
#

never have i been banned by discord, and i hope to keep it this way

#

altho twitter removed my tweet i think because it looked like ai

#

it was something on the line: "curse boldly with a hint of red"

#

for a html/css hack

mortal hare
#

i fucking hate how java doesnt support generics on exception types

lilac dagger
#

meh, you get used to it

#

it has cool stuff like multiple catches or multiple cases with Exception1 | Exception2

thorn isle
#

still better than manually checking raised error flags

lilac dagger
#

awesome 😄

thorn isle
#

🤡

#

again

#

it's been like an hour

lilac dagger
#

damn

#

you're unlucky as hell

barren peak
#

trying to teleport a block display chest inside of a slime (constantly every tick) but its inconsistent sometimes it works and sometimes its just off by like a block (as shown)

tried all of these and they do about the same; don't work
display.teleport(slime.getLocation().clone().add(-0.5, 0, -0.5));
display.teleport(slime.getLocation().clone().add(0.5, 0, 0.5));
display.teleport(slime.getLocation());

(first image is what it should always look like, but often it looks like second image instead)

vagrant stratus
#

yea, might be easier to wait until sulfur cubes release and check how they do it lol

mortal vortex
mortal vortex
vagrant stratus
mortal vortex
#

@barren peak try Transformation btw

#

attach the display via a passenger and use Transformation to offset it.

mortal vortex
#

liek:

Location muhammad = slime.getLocation();
Bukkit.getScheduler().runTask(plugin, () -> {
    display.teleport(muhammad.clone().subtract(0.5, 0, 0.5));
});
thorn isle
#

Muhammad the slime

orchid gazelle
fickle spindle
#

what should i use to make a new plugin? i was using Minecraft Development but idk it isn't working rn

orchid gazelle
#

if you just wanna get it running

#

but we can also help you with fixing your current environment if we get more info

fickle spindle
#

okay ty and i should create the folders and files by myself right?

orchid gazelle
#

if you are using IJ, creating with maven does everything for you pretty much

#

you just define the plugin yml in your resources folder

fickle spindle
orchid gazelle
#

create a package as root

#

and you are gooid

fickle spindle
#

brb

naive minnow
#

is there any reason to use protocollib > nms? I just spent 2+ hours trying to solve a protocollib problem and when I switched to nms I solved it in like 30 seconds

lilac dagger
#

I don't use protocollib because when i had my server it was using too much ram and it was crashing my server which made me stay away from it as a developer

#

And yeah doing it in nms is usually faster which is nice too

#

But i'm pretty sure it's just because you're not familiar with the wrapper nature of protocollib

naive minnow
#

I couldn't figure out how to make it stop wrapping everything in a {"name": "value"} structure without remaking some of the stuff

#

for nbt

lilac dagger
#

I see

fickle spindle
# fickle spindle brb

i figured out how to do it thanks, but how can i support each time of color like &5 and hex too?

lilac dagger
#

The java version or regex version

fickle spindle
#

and how should i detect them like how can i detect when i have to use one and when i know i have to use the other?

lilac dagger
#

Just replace the string once when's possible and that's that.

#

If you get it from config replace & to color char and from #aabbcc to the supported hex format

thorn isle
#

punctuation

lilac dagger
#

One moment

#

And then back again if you want to save configs and keep it nice

thorn isle
#

i mean the other guy

#

i can barely read what he's saying

slender elbow
#

maybe it's because we aren't meant to

young knoll
#

?paste

undone axleBOT
kind hatch
#

Would patching a vanilla bug be something that spigot would allow? Or does it depend on what the bug is?

sullen marlin
#

Depends on the bug and the patch, but probably

kind hatch
#

One of which specifically targets the enderman, and the other that handles all mobs effected by this

sullen marlin
#

I think all mobs would be ok but you need to be careful it doesn't affect targeting/anger across worlds if that's a thing

mortal hare
#

vavr seems to be such a nice lib to work with

thorn isle
#

did spigot do anything with the world format in 26

#

i see paper tearing their asses apart over it trying to do some new world dir structure of their worn

sullen marlin
#

Spigot uses the same world structure it has since multi world was introduced ~15 years ago. The only difference with 26.1 is the folder names have changed from DIM# to dimension/name

#

(same change as Vanilla)

thorn isle
#

makes sense

eager hawk
#

What's up guys, I'm almost finished with my Hide and Seek plugin, but I'm just struggling on one last issue.
My BlockDisguise class looks like this: https://pastebin.com/WFKfzmTt
As you can see in the clip (, even though the player is invisble, I can still hit their body. https://medal.tv/nl/games/minecraft/clips/mpyj624hllXd1MkdM?invite=cr-MSxQUjQsMTk4OTMwNTE5&v=8
Is there a way to disable this and only be able to hit the block on the armorstand, without the player body being there for the seekers?

I tried stuff like p.setCollidable(false) and others but that didn't seem to work out.

Thanks in advance!

Bekijk player hit bug van xthry_ en miljoenen andere Minecraft video's op Medal. #minecraft

▶ Play video
thorn isle
#

this won't be effective against hacked clients or people with hitboxes enabled in the debug, but you could scale the player down to be near 0 blocks in size, and make sure they and the armorstand are contained in the hitbox of the interaction entity/block display

#

to be effective against hacked clients, you'd want to actually remove the player entity or make them appear to be somewhere else

#

this is easy with the paper player visibility api, but will cause the player to also disappear from the tab player list

chrome beacon
#

Spigot also has visibility api smh

lilac dagger
#

Player#hidePlayer

#

and player.spigot().setcollidable false

#

for arrows

#

i really disliked how paper handled the arrow colliding with armor stand

#

you can't hit armor stands, they just bounce off them

#

i should probably try with a size 0 hitbox

eager hawk
#

Since I assume it's best to keep alive players in the tablist, but yeah then I have this issue like you can see on my clip, I'm trynna find a way around that works fine, looks good and is effective but I can't seem to find something

young knoll
#

What version are you in

eager hawk
young knoll
#

Ah, rip

#

Can’t use the scale attribute

eager hawk
#

Ah shit :') I'm working on it for a specific server which is 1.20.1 so unfortunately I can't upgrade

#

Do you have an idea how I could work around this?

young knoll
#

Hmm

#

You could put the player into spectator and then have them spectate a tiny entity

#

But then they won’t be able to move without pressing shift first

eager hawk
#

Yeahh I thought about that too, but like you say they can't really move then which is not so effective :(

young knoll
#

You could disable the damage event and then manually raytrace to check for players hitting the hiders

eager hawk
#

Yeah that could be an idea, I just feel like, even though the Damage Event is disabled, the players body is like in the way of the armorstand (if you get what I mean)

#

Like even when I'm trying to hit the Astand im still hitting the body first

#

bcs its in the way

young knoll
#

Hence the manual raytrace

#

You can have it ignore certain entities

eager hawk
#

Oh okay that sounds good, will I still hear the sound of hitting a "body" when the event is disabled?

#

Like not damaging but the hit sound

eager hawk
#

I will check it out thanks a lot!

#

If anyone else has more suggestions let me know, I will look into everything in the meantime :)

wraith spade
#

yo, how do i check a players main hand then check if it has a specific lore? im using an onclick event rn bit i need to check if the item they are clicking with has a certain lore (a custom weapon), thanks

buoyant viper
#

?jd-s

undone axleBOT
buoyant viper
#

and then u can do getLore on that items metadata

#

u should probably be using a PDC instead of lore for custom item tracking though, imo

#

?pdc

sharp swan
#

hi, may I send a picture here?
I would like to present my idea

mortal vortex
sharp swan
#

Hey, some time ago I started working on a survival plugin where the main idea was to have a 3D interactive UI inside the Minecraft world, something similar to the floating interfaces you see in movies or anime.

The reason I started this was because commands can sometimes be hard to use for players, especially when there are a lot of them or when they require explanation. So I thought about replacing commands with a visual screen that players can interact with directly.

The project eventually turned into an API.

It’s still in development, but it’s close to being finished. The main things left are adding scrolling for long content and providing more ready-to-use components so developers can build and customize their own interfaces more easily.

The system allows you to create multiple screens per player, each with its own independent content. For example, you could have a notification screen, an inventory-like screen, or anything else you want.

In short, the idea is to let developers build any kind of system and connect it to a visual UI inside the world.

I’m mainly curious about one thing:
Would anyone actually be interested in using something like this?

mortal vortex
sharp swan
mortal vortex
#

DAYUMMMM thats cooler

#

put this on github dude, send a linkkkkk

mortal vortex
sharp swan
naive minnow
#

I don’t get it

#

I think anything they could do could be done with display entities as well

mortal vortex
#

i think hes mentioning the thing hes replying to

sharp swan
naive minnow
#

😭

wraith spade
#

yo so i need to find the itemmeta for a projectile (trident) to find the pdc of it, is there a way to get the item's meta still? thanks

mortal vortex
#

idk what you mean "projectile", once they are thrown, they transition from an ItemStack to a Trident entity... it is no longer an "item", so im not sure what you mean "item's meta". accessing an entity's PDC does not require accessing any other data

#
(... instanceof Trident trident) PersistentDataContainer pdc = trident.getPersistentDataContainer();
wraith spade
#

oh, I didnt know that mb im pretty new to this, thank you this is what i meant

mortal vortex
#

Nah all good mate, best of luck

smoky anchor
#

I doubt the items pdc will transfer to the projectile entity
You can use trident.getItem and then get the items pdc from there
just saying this in case the guy wants something else

wraith spade
#

just tried and it doesnt

mortal vortex
#

aww shmucks

#

my apolocheese

wraith spade
#

because for this it returns null:
NamespacedKey key = new NamespacedKey(JavaPlugin.getPlugin(Main.class), "tridentkey");
PersistentDataContainer pdc = trident.getPersistentDataContainer();
String value = pdc.getOrDefault(key, PersistentDataType.STRING, "<null>");
player.sendPlainMessage(value);

#

nah all good

mortal vortex
#

well yeah then

ItemStack item = trident.getItemStack();
ItemMeta meta = item.getItemMeta();

wraith spade
#

item meta doesnt work for projectiles though right?

smoky anchor
mortal vortex
wraith spade
#

thank you it worked (i think atleast so far)!

weak wasp
#

That Main post is BS, dude just doesn't like naming it Main.
All other projects need a main class as an entry point, so does your plugin specified in plugin.yml.

I don't see anything wrong with using Main, and that post does nothing to change my mind.

thorn isle
#

yes, but it's not the Main class or entry point of the application

#

you can call it MyPluginMain, but Main alone is unspecific and not ideal

#

suppose for example you depend on 3 different plugins and have to interact with their main classes

#

now you have 3 ambiguous Main's that you have to reference via fully qualified name

lilac dagger
#

^

lilac dagger
#

All my plugins are named SomethingPlugin

slender elbow
#

blue checkmark xitter account levels of engagement bait

buoyant viper
#

ion even name my standalone programs Main fr

#

that shit named Entrypoint

lost matrix
#

lol, ill name my next listener class just 'Listener' as well.
And my next manager just 'Manager'.

I like this. Keeps things simple.

whole mist
#

As of right now I am working on a Java plugin for geofenci g. Anyone have better idea than maxmind considering maxmind only does country? I am trying to restrict a regional for compliance

import com.maxmind.geoip2.DatabaseReader;
import com.maxmind.geoip2.model.CityResponse;
import com.maxmind.geoip2.record.Subdivision;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;

import java.io.File;
import java.io.IOException;
import java.net.InetAddress;

public class JurisdictionalGuard implements Listener {

    private DatabaseReader reader;

    public JurisdictionalGuard(File databaseFile) {
        try {
            this.reader = new DatabaseReader.Builder(databaseFile).build();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @EventHandler
    public void onPreLogin(AsyncPlayerPreLoginEvent event) {
        InetAddress ip = event.getAddress();
        try {
            CityResponse response = reader.city(ip);
            Subdivision subdivision = response.getMostSpecificSubdivision();
            
            if (subdivision.getIsoCode() != null && subdivision.getIsoCode().equalsIgnoreCase("CA")) {
                String kickMessage = "§c[SECURITY NOTICE]\n" +
                                     "§fAccess from your jurisdiction is restricted.\n" +
                                     "§7Reason: §fCompliance with CA AB 1043 / AADC.\n" +
                                     "§7Infrastructure: §ePrivate / Non-Commercial\n" +
                                     "§cUnauthorized access is a violation of 18 U.S.C. § 1030.";
                
                event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, kickMessage);
            }
        } catch (Exception e) {
            // Log or ignore lookup failures
        }
    }
}
thorn isle
#

what do you need? state?

whole mist
#

Yes.

#

After some more research I realized the issue was using the MaxMind Country DB, which doesn't contain subdivision data. Swapping to the GeoLite2-City database allows the getMostSpecificSubdivision() call to correctly return ISO codes like 'CA'.
​I am now implementing a "Double-Check" redundancy logic using IP2Location as a secondary provider. If either database flags the IP as a restricted jurisdiction, the connection is dropped. Here is the updated null-safe logic for those implementing this:

@EventHandler
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
    InetAddress ip = event.getAddress();
    try {
        CityResponse response = reader.city(ip);
        
        // Ensure subdivision data exists before checking ISO code
        if (response.getMostSpecificSubdivision() != null) {
            String isoCode = response.getMostSpecificSubdivision().getIsoCode();
            
            if (isoCode != null && isoCode.equalsIgnoreCase("CA")) {
                String kickMessage = "§c[SECURITY NOTICE]\n" +
                                     "§fAccess from your jurisdiction is restricted.\n" +
                                     "§7Reason: §fJurisdictional Compliance (AADC).\n" +
                                     "§7Infrastructure: §ePrivate / Non-Commercial\n" +
                                     "§cUnauthorized access is a violation of 18 U.S.C. § 1030.";
                
                event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, kickMessage);
            }
        }
    } catch (Exception e) {
    }
}

Sorry to have bothered you all.

solid heart
desert rock
#

Is it possible to get information about right-clicking on air/water without an item in hands?

sly topaz
#

you can workaround the fact that interact event isn't called in that scenario by placing an interaction entity at the player's line of sight at all times

echo basalt
#

or fill all the empty slots with invisible items or something

buoyant viper
wraith spade
#

so basically I have a custom bow setup which uses a PDC to check if its that custom bow, what I am doing rn is checking if the bow is in their mainhand, i do a get inventory then item in mainhand then getitemmeta AFTER the arrow has landed, the problem is they can switch before the arrow lands which makes it not work, I wanna make it so it basically goes through their entire inventory till they find the bow, and if it does it works but if it doesnt it returns. thanks in advance

quasi gulch
wraith spade
#

no, im just asking if anyone has a doc or like idea of how to do it

vagrant stratus
#

Honestly, 26.1 is completly unobfuscated just check both the server and client until you see how vanilla handles bow & crossbow enchantments and rewrite it for your situation @wraith spade

smoky anchor
heady inlet
#

Hey everyone,

I am facing a very strange issue on Purpur 1.21.11 (Java 21) regarding programmatic chest manipulation.

The Goal:
I am spawning a chest block via code (after a falling block animation lands). I then want to fill this chest with items inside a runTaskLater task.

The Problem:
The chest is placed correctly, but the inventory modifications do not persist.

  • addItem() returns an empty map (indicating success).
  • setContents() executes without errors.
  • chest.update(true, false) returns true.
  • BUT: Immediately checking inv.getContents() shows the items are gone (Air/Null).
  • The client sees an empty chest (both Java and Bedrock via Geyser).

It feels like I am modifying a detached snapshot, even though I fetch the Chest state fresh inside the delayed task.

What I tried:

  1. Increased delay (tried 1 tick up to 20 ticks/1 second).
  2. Used addItem(), setItem(), and setContents().
  3. Called chest.update(true, false) and b.getState().update(true, false).
  4. Ensured chunk is loaded (chunk.isLoaded() check).

Environment:

  • Server: Purpur 1.21.11
  • Java: OpenJDK 21
  • Minimal plugins: Geyser, Floodgate, LuckPerms (no inventory protection plugins active).

Code Snippet:

// Inside runTaskLater (20 ticks delay)
Block b = loc.getBlock(); // Block is Material.CHEST

if (!(b.getState() instanceof Chest chest)) return;

Inventory inv = chest.getBlockInventory();

// DEBUG: Items exist
plugin.getLogger().info("Items to add: " + items.size()); // Output: 5

// Attempt
HashMap<Integer, ItemStack> failed = inv.addItem(items.toArray(new ItemStack[0]));
plugin.getLogger().info("Failed items: " + failed.size()); // Output: 0

// Update
boolean success = chest.update(true, false);
plugin.getLogger().info("Update success: " + success); // Output: true
#

// IMMEDIATE CHECK
int check = 0;
for (ItemStack i : inv.getContents()) {
if (i != null) check += i.getAmount();
}
plugin.getLogger().info("Items in inventory: " + check); // Output: 0 (!!!)

Debug Logs:

[INFO] Items to add: 5
[INFO] Failed items: 0
[INFO] Update success: true
[INFO] Items in inventory: 0

Has anyone experienced this on 1.21+? Is there a new mechanism for TileEntity updates that I am missing, or is this a potential server bug? Any help is appreciated!

thorn isle
#

try getState(false)

#

iirc the default even on paper is to get a snapshot of the state

#

i don't 100% remember how that works with inventories, but presumably the state snapshot would also have a snapshot of the inventory, which, being separate, would remain empty even after you put items in it

#

it's generally better to avoid the whole state::update nonsense altogether and just directly modify the live state rather than a snapshot

slender elbow
#

i'm 99% sure that getState(false) really only works for read-only ops, and it gets weird on write ops, vaguely remember you'd still need to call getState(true) and BlockState#update

heady inlet
#

Hey @thorn isle,

Thank you very much for the suggestion! I tried using getState(false) to access the live state directly, but unfortunately, the issue persists. The inventory still reports as empty immediately after adding items.

It seems like there might be a deeper issue with how the TileEntity is handled in this specific build.

I have opened a GitHub Issue with the full details and code examples.

I really appreciate your help!

#

Thanks @slender elbow ! I actually started with that approach. I used getState(true) (snapshot) and called update(), but it had the exact same result: addItem succeeds, but checking getContents() immediately shows 0 items. It seems both the snapshot and the live state are broken for inventory modification in this build.

slender elbow
#

add more emojis to your responses and use a more enthusiastic tone

heady inlet
#

Hey @slender elbow, I'm sorry, I'm from Germany and I'm trying my best to translate it so that it isn't completely misunderstood.

thorn isle
#

development aside, i encourage you to learn english

robust helm
#

🦅🦅🦅

heady inlet
#

You are absolutely right! 😅🙌 Thank you for the honest advice!

It is definitely on my to-do list! 📚✍️ I know using a translator isn't a long-term solution, but I'm trying my best to improve every day! 💪🧠

Thanks for your patience with my messages! You guys are the best! 🚀✨

robust helm
#

WHAT THE FUCK

sullen canyon
robust helm
#

ich übersetze: du schmutzige gehende tasche von mikrochips

sullen canyon
#

IIoiiieJl Haxyu uHblMu CjloBaMu

ancient plank
#

that's how my pvp plugin manages projectiles

wary harness
#

How do you get custom craft recepies show in crafting book?

worldly ingot
#

The client has to be aware of them, so you'll have to discover them

#

(you can also pass a Collection of keys, so use that if you want to discover multiple)

wintry parrot
#

can anyone help me find a working unstable map

chrome beacon
#

??

#

unstable map

wintry parrot
#

unstable smp map

#

the hardcore server the whole map with the builds

chrome beacon
#

this is the help development channel ;/

outer ember
#

hi
from iran

wintry parrot
chrome beacon
#

making plugins etc

inner mulch
#

this is supposed to be a cube, the coordinates of the edges are all correct for a cube, the offset is due to the scaling of the individual blockdisplay, with which math function do i translate all edges accordingly?

slim wigeon
#

Hey there. I trying to add IRC to my server for the chat bridge and admin management, could you help me with what library to use?

#

I tried to use: <dependency> <groupId>org.pircbotx</groupId> <artifactId>pircbotx</artifactId> <version>2.3</version> </dependency>But it does not exist

green mauve
#

how can i change entity drops?

sullen marlin
#

Latest on maven is 2.1

slim wigeon
#
hile executing task 10
java.lang.NoClassDefFoundError: org/pircbotx/Configuration$Builder
        at com.mrnategeek.irc.Bot.startBot(Bot.java:11) ~[?:?]
        at com.mrnategeek.irc.Main.lambda$0(Main.java:12) ~[?:?]
        at org.bukkit.craftbukkit.v1_21_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.21.
1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at org.bukkit.craftbukkit.v1_21_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[sp
igot-1.21.1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
 ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
 ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1575) [?:?]
Caused by: java.lang.ClassNotFoundException: org.pircbotx.Configuration$Builder```
slim wigeon
#

I tried and it does not work

mortal vortex
#

what "doesnt work"

#

idk what to tell you, Configuration$Builder exists, you're just building wrong

slim wigeon
# mortal vortex are you shading

Maybe I not doing it right because I add the proper shading code, it does not add what you call the libraries needed like in this case pircbotx. It just has my code "org.mrnategeek.irc"

mortal vortex
#

my brother in christ,

#

can I see the "code"

#

your pom?

slim wigeon
#

Where do I post it?

mortal vortex
#

preferably in this server?

slim wigeon
mortal vortex
#

where is the shading

#

you just said you add the proper shading code, I dont see the shading code

slim wigeon
#

I added it some point but let me add it again and send it to you

#

With the pom.xml like that, this is the error:

hile executing task 10
java.lang.NoClassDefFoundError: org/pircbotx/Configuration$Builder
        at com.mrnategeek.irc.Bot.startBot(Bot.java:11) ~[?:?]
        at com.mrnategeek.irc.Main.lambda$0(Main.java:12) ~[?:?]
        at org.bukkit.craftbukkit.v1_21_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.21.
1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at org.bukkit.craftbukkit.v1_21_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[sp
igot-1.21.1-R0.1-SNAPSHOT.jar:4344-Spigot-a759b62-19bf846]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
 ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
 ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1575) [?:?]
Caused by: java.lang.ClassNotFoundException: org.pircbotx.Configuration$Builder
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:160) ~[spigot-
api-1.21.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:112) ~[spigot-a
pi-1.21.1-R0.1-SNAPSHOT.jar:?]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:528) ~[?:?]
        ... 7 more```
thorn isle
#

i remember you

#

you're the guy who thought using git meant making your code public

mortal vortex
#

LOL OMG THIS GUY

mortal vortex
mortal vortex
#
<groupId>com.github.pircbotx</groupId>
<artifactId>pircbotx</artifactId>
<version>2.2</version>
slim wigeon
#

Which one should I use. Remember the Ellipse Platform? That is what I using. No mvn

mortal vortex
#

Also im confused homeboy

mortal vortex
mortal vortex
#

are you sending the wrong code or something

thorn isle
mortal vortex
#

if he's building it through eclipse why does he have a pom file

thorn isle
#

maybe he's running maven through eclipse, god knows

mortal vortex
#

oh right yeah

slim wigeon
thorn isle
#

riiight

mortal vortex
#

Eclipse in the big 26? you arent my 60 year old Systems Programming teacher right?

#

is that you Phil?

thorn isle
#

i blame uh