#help-development

1 messages · Page 36 of 1

drowsy helm
#

BlockDamageEvent

#

BlockDamageAbortEvent for if they cancel

drowsy helm
#

oops

#

yeah that one

ornate patio
#

well

#

it turns out you can only have names up to 16 characters

#

which is a huge bummer

#

that wont work for me

lost matrix
ornate patio
#

The mounted armor stand is too low

#

where the name tag is inside the head of the player

lost matrix
#

Thats what happens if you make it a marker

ornate patio
#

but if it's not a marker it will interfere with hitboxes

lost matrix
#

Let it be a small as and set collidable to false

ornate patio
#

will that completely stop any interferences?

lost matrix
#

Yes. No collision and no arrows.

#

But this will only work if you are on a newer version

desert frigate
#

Stupid question but how do I use nms?

lethal coral
#

why is that a stupid question

desert frigate
#

idk

#

cause this is like my first week of java lol

lost matrix
lost matrix
desert frigate
desert frigate
lethal coral
#

buildtools

lost matrix
#

^

desert frigate
#

java -jar BuildTools.jar --rev 1.18?

lost matrix
desert frigate
#

what did i do

ornate patio
#

And the custom name won’t show for the player it’s mounted on right

lost matrix
ornate patio
#

with ClientBoundDestroyEntities or whatever it’s called?

lost matrix
potent atlas
#

Hello, is this the right place to get help coding a plugin?

potent atlas
#

It's about the PlayerCommandSendEvent. I am trying to get the list of commands that gets sent to the user with e.getCommands() and it's telling me that it has a missing type "Collection" even though I've done all my imports

#

Does anyone have any ideas? I've been googling all day lol

glad prawn
lost matrix
glad prawn
lost matrix
glad prawn
lost matrix
wet vault
#

Guys I am currently learning plugin development and I have made a really basic plugin so can anyone help me test it out?

lost matrix
wet vault
#

Yeah the thing is My laptop cannot handle that

ornate patio
#

How does one do that

#

I’ve always had two Minecraft accounts

#

for reasons other than plugin development

wet vault
#

You host the server from your PC or Laptop

ornate patio
wet vault
ornate patio
#

but it contacts mojangs auth servers though

river oracle
#

yes you do

wet vault
#

After that join from minecraft the server which you hosted

wet vault
river oracle
wet vault
#

DM me if anyone wants to help

ornate patio
glad prawn
lost matrix
wet vault
ornate patio
lost matrix
lethal coral
#

Ok so I'm trying to create a project with multiple modules in order to support different nms versions. What I'm wondering is if it'll still remap correctly with SpecialSource

potent atlas
#

Would it be helpful if I post the whole listener class for the PlayerCommandSend event that's not working?

lost matrix
lethal coral
#

I'm gonna get lost so quick 😭

#

I haven't done a module project before

lost matrix
potent atlas
#

No idea what that means

ornate patio
potent atlas
#

I'll do some more googling. Thanks

ornate patio
#

Is there an event for when packets are sent?

lost matrix
ornate patio
#

Like when I call the World#spawn method

#

How would I just stop the packet for one player

ornate patio
#

Ive never used that before

lethal coral
lethal coral
#

😩

chrome beacon
# lethal coral do you know of a good spigot module plugin that I can use as an example
GitHub

A modular Spigot plugin that prevents players from logging out during combat and has many expansions for extra features. - GitHub - SirBlobman/CombatLogX: A modular Spigot plugin that prevents play...

GitHub

An API made for SirBlobman's plugins that can also be used by other developers. - GitHub - SirBlobman/SirBlobmanAPI: An API made for SirBlobman's plugins that can also be used by ot...

potent atlas
#

I fixed the error but it still doesn't work. Gonna do some debug statements... and then idk lol

chrome beacon
#

If you can't figure it out you can always send the code

#

?paste

undone axleBOT
potent atlas
#

Alright I confirmed that it's triggering the event and running the code, but it's not doing what I want 😛

near kite
#

@vestal moat

#

Ask here

vestal moat
#

No

#

I don't get support from spigot

#

Stfu

potent atlas
#

I'm trying to remove commands from the list that the players see

#

subcommands

#

that get run from clickable text

#

problem is I've heard of 3 different events to listen to. this one made the most sense

#

(the commands are still showing) EDIT: nvm! works now!

ornate patio
#

Does anyone know how to cancel an entity spawn packet with nms? Or maybe even ProtocolLib?

#

I want to spawn an entity in the world, but have it not exist for one player

lethal coral
#

how does it not have access?

visual tide
#

restart your ide

potent atlas
#

Thank you @lost matrix

hybrid spoke
# ornate patio bump

so either try to listen to it via protolib or destroy the entity immediately afterwards for the player

ornate patio
#

how would you listen to it with protocollib?

hasty obsidian
#
    public static void onDrop(PlayerDropItemEvent e){
        if (e.getPlayer().getInventory().getItemInMainHand() != null){
            if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().equals(ItemManager.crown)){
                e.setCancelled(true);
            }
        }
    }``` anyone know why this not working?
lethal coral
#

ok so I'm making a multi module project and I'm trying to compile the whole thing into one jar file
the problem I'm running into right now is that each jar file is being completed individually

hybrid spoke
#

thats probably how you do it

ornate patio
#

i mean

#

i feel like it should be possible to just send the spawn packet to specific players

hybrid spoke
ornate patio
#

rather than sending spawn packets to every player and then another delete packet to one player

ornate patio
hybrid spoke
#

THAT sounds inefficient

#

just destroy it for the player who shouldnt see it

ornate patio
ornate patio
#

I need every player except one to see an entity

ornate patio
hybrid spoke
ornate patio
#

thats not what i meant

ornate patio
#

i just mean, "send the packet to all players but one", rather than "send the packet to all players and then send another delete packet to one"

lethal coral
#

I'm not so good at xml so 😂

hybrid spoke
#

which holds the ones you want to build as dependencies

hasty obsidian
#
    public static void onDrop(PlayerDropItemEvent e){
        if (e.getPlayer().getInventory().getItemInMainHand() != null){
            if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().equals(ItemManager.crown)){
                e.setCancelled(true);
            }
        }
    }```
anyone know why my code isnt working?
#

it doesnt give an error

#

it just doesnt work

lost matrix
hasty obsidian
#

ok

lost matrix
#

?pdc

lethal coral
#

also a problem I have is that I'm using a maven plugin to remap and obfuscate the mojang mappings, and that's compiling into its own jar file just like the others

#

actually

#

nevermind!

#

it just outputs weird to this file name

ornate patio
#

I'm running into some strange desync issue

#

so I'm constantly teleporting an invisible armor stand on top of a player (mounting still didn't work- the name tag was either too high or too low)

#

and it works fine when both accounts are on the server when the plugin is reloaded

#

but when this "Jacob" accounts logs off and back on, this happens on my main account:

#

even though on the Jacob account, it still looks normal:

#

I have no idea what could be causing this. here's the code that's run when a player joins the server

private void updateArmorStand(Player player, String name) {
    ArmorStand armorStand = playerArmorStands.get(player.getUniqueId());
    if (armorStand == null || !armorStand.isValid()) {
        armorStand = player.getWorld().spawn(player.getLocation().add(0, ARMOR_STAND_Y_OFFSET, 0), ArmorStand.class);
        armorStand.setCustomNameVisible(true);
        armorStand.setGravity(false);
        armorStand.setVisible(false);
        armorStand.setInvulnerable(true);
        armorStand.setMarker(true);

        playerArmorStands.put(player.getUniqueId(), armorStand);
    }

    armorStand.setCustomName(name);
}
small current
chrome beacon
ornate patio
#

the armor stand is deleted when the jacob accounts logs off

ornate patio
chrome beacon
#

That's not removing it from the world though

#

nvm

#

I'm blind

#

Have you tried delaying the armor stand spawn by a tick

ornate patio
#

by 0, 1, and 10 ticks

hybrid spoke
# ornate patio

i've had the same problem but didn't looked further into it. what if you "reload" the entity for the player?

quaint berry
#

Can I check for if a chunk has been generated?

hybrid spoke
#

also when doing custom titles you want to use packets for the armorstands

ornate patio
#

havent gotten to there yet

#

I'm gonna use packets to hide the armor stand from the player

hybrid spoke
crisp steeple
#

tfw hypixel just decides to completely disable playerinteractevent

ornate patio
#

I want the title to be visible to everyone except for the player it's on top of

hybrid spoke
ornate patio
ornate patio
hybrid spoke
#

fake entity = sent by packets

#

no real entity

#

its not there other for the client

ornate patio
#

so you're saying instead I should just send fake armor stands to every player

hybrid spoke
#

yes

ornate patio
#

how do I teleport those armor stands on top of their respective players

hybrid spoke
#

you can keep track of them

#

otherwise mount packet

ornate patio
#

i have no experience with fake entities

#

how do i even start

hybrid spoke
#

well, first you need the entity

#

second you need to handle it (mount it, keep track of it, what happens if a player "unloads"(the entity will be gone as well, so resend the packet))

#

third what happens when you try to hit a player with a fake entity on him (you need to redirect the hit)

ornate patio
#

i mean

#

marker armor stands don't have hitboxes

#

so i dont think that'll be an issue

ornate patio
#

I'm so lost

quaint berry
#

Thank yoooouuuu

chrome beacon
#

That will load it

quaint berry
#

Oh

#

What would I use?

chrome beacon
#

To see if it's loaded?

quaint berry
#

If it's ever been generated

quaint berry
#

I had a look but I don't understand

#

Ohhhh

#

I'm an idiot

ornate patio
#

Because each player has their own set of fake armor stands (which are on top of other players)

lethal coral
#

how come whenever I do an entity spawn packet the entity isn't looking in the right location and the velocity vector does nothing pretty much

eternal oxide
ornate patio
eternal oxide
#

my guess is your client thinks you are colliding with the stand so it pushes it

hybrid spoke
lethal coral
ornate patio
eternal oxide
lethal coral
#

the xrot and yrot arguments in the packet constructor are regarding the entity's spawn location that you're spawning in

eternal oxide
lethal coral
#

dude what

eternal oxide
#

There is a seperate packet for setting teh lookat

lethal coral
#

the entity being spawned via that packet is not looking in the correct direction and the velocity vector does nothing

lethal coral
ornate patio
#

The issue is that the stand becomes visible and the custom names becomes invisible for some clients

eternal oxide
#

ClientboundRotateHeadPacket

lethal coral
eternal oxide
#

which packet?

lethal coral
#

the one I mentioned earlier

#

packetplayoutentityspawn

#

aka clientboundaddentitypacket

eternal oxide
#

there is a ClientboundAddEntityPacket which just takes a LivingEntity, unless you are trying to custom set its facing

lethal coral
#

you can create a client entity via that packet

#

this is one of the higher level constructors

ornate patio
eternal oxide
lethal coral
#

sir

eternal oxide
#

I'm looking at it now

#

LivingEntity var0

lethal coral
#

if you looked at the code, you would see that it's Entity, which is a super class of livingentity

#

and there are multiple other lower level constructors that allow you to do more

eternal oxide
#

Yes, which is why I specifically asked you if you were just trying to spawn with a facing or you were trying to customize it

lethal coral
#

you never asked me that but ok

#

my question still hasn't been answered

#

why are both of the values in that packet if they don't do anything

eternal oxide
lethal coral
#

there is more to the packet

#

😂

eternal oxide
#

ok be rude, ask someone else.

lethal coral
#

how am I being rude you're literally going on about one of the higher level constructors

#

when I have said I'm not using that one multiple times

eternal oxide
#

and I asked you why not, twice

lethal coral
#

public ClientboundAddEntityPacket(int var0, UUID var1, double var2, double var4, double var6, float var8, float var9, EntityType<?> var10, int var11, Vec3 var12)
this is the one I'm referriing to

eternal oxide
#

yes I know which constructor you are using, I'm asking why

lethal coral
#

because I'm allowing for options

#

full control of the packet

chrome beacon
#

So what's the problem? What actually do you need help with

lethal coral
#

let's start over

#

so

#

I have everything filled in and the zombie spawns

#

however

#

a) his velocity is static and doesn't seem to change (what is the last value for if that doesn't edit velocity)
b) var8 and var9 (xRot and yRot) seemingly have no impact as well

obsidian drift
#

Does anyone know how to create NMS entities in 1.19.1?

chrome beacon
#

What part do you need help with

obsidian drift
#

The creation of the entity

chrome beacon
#

Use Level#addFreshEntity to spawn the entity in the world

obsidian drift
#

I mean like starting off from here

class Test extends EntitySkeleton {
                
}
lethal coral
#

look at the entityskeleton class

obsidian drift
#

Why does it have to take multiple EntityTypes?

public EntitySkeleton(EntityTypes<? extends EntitySkeleton> entitytypes, World world) {
lethal coral
#

it doesn't

chrome beacon
#

It takes the Skeleton Entity type

obsidian drift
#
'x()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type
chrome beacon
#

Use Mojmaps

eternal oxide
chrome beacon
lethal coral
obsidian drift
lethal coral
#

mojang mappings

eternal oxide
#

PacketPlayOutSpawnEntity(int i, UUID uuid, double d0, double d1, double d2, float f, float f1, EntityTypes<?> entitytypes, int j, Vec3D vec3d, double d3)

obsidian drift
eternal oxide
#

1.19.1

lethal coral
#

I'm on 1.18.2, I do not have that value

eternal oxide
#

ah

lethal coral
#

I mean this is just an example I'm doing to make sure everything works. I just want to make sure there's nothing wrong on my end with my code for why the xrot, yrot, and vector have seemingly no impact

#

so I can better understand what's going on

chrome beacon
#

ElgarLs constructor is the same as your one

lethal coral
#

no

chrome beacon
#

It's just unmapped vs mojmaps

#

?

lethal coral
#

I do not have the last value

chrome beacon
#

ah'

lethal coral
#

I think I know the problem

#

and @eternal oxide tried to point it out earlier

#

just not perfectly since he didn't know my full context which is fine

#

I'm using the packet for minecarts and other nonliving entities (as stated by wiki.vg)

#

so those things probably don't have a major effect or not the one I expected

#

I'll give the other packet a go

eternal oxide
#

Thanks. Sorry I'm in and out as cooking wifes breakfast

obsidian drift
buoyant viper
#

Level nmsLevel = ((CraftWorld) bukkitWorld).getHandle(); probably

chrome beacon
#

Yeah

#

It's that

obsidian drift
#

Ty

buoyant viper
#

might be ServerLevel idk

obsidian drift
#

Yeah but it still works

#

ServerLevel extends Level

buoyant viper
#

oh i just genuinely didnt remember the mappings

obsidian drift
#
java.lang.NoClassDefFoundError: net/minecraft/world/level/Level
chrome beacon
#

How did you make your jar?

#

Make sure you used maven to build it

obsidian drift
#

Ah ok

chrome beacon
#

Maven tab on the right side > package
If you're using Intellij

obsidian drift
#

Yeah that works thanks

lethal coral
#

is there a way to get an entity object in spigot without spawning it

chrome beacon
#

NMS entity?

#

If so yeah just create an instance

#

They don't spawn automatically

lethal coral
#

😔

#

in regular spigot

chrome beacon
#

Then no

#

Not that I'm aware of

lethal coral
chrome beacon
#

You're already using NMS for packets

lethal coral
#

yes I am

#

me/the people using my plugin will not

chrome beacon
#

?

lethal coral
#

why the question mark

chrome beacon
#

wdym

#

the people using my plugin will not

lethal coral
#

I'm making something for future me to use without nms

#

or others

chrome beacon
#

Make some abstraction or use reflection

lethal coral
#

I am

obsidian drift
#

Would this be correct?

private class Test extends Skeleton {

                public Test(net.minecraft.world.entity.EntityType<? extends Skeleton> entitytypes, Level world) {
                        super(entitytypes, world);
                }
        }
Level level = ((CraftWorld) Bukkit.getWorld("world")).getHandle();
Test test = new Test(net.minecraft.world.entity.EntityType.SKELETON, level);
test.teleportTo(-3, 70, 6);
chrome beacon
#

Yes. You can call setPos in the constructor though if that's easier for you

#

Looks like it can't find a plugin

#

Specify the exact maven plugin dependency

winter scarab
#
        if(configSec == null) return;
        if(configSec.getList("list") == null) return;
        configSec.getList("list").remove(piece);```
according to my ide, how can .remove() possibly be NullPointerException if ive accounted for literally every variable to be null?
quaint berry
#

A plugin called lint

chrome beacon
#

^^

quaint berry
#

Quick question, How do I make a plugin pause for 2 seconds?

chrome beacon
undone axleBOT
winter scarab
#

if it checks everytime beforehand?

quaint berry
#

It can't find itself

#

'lint' in the current project

chrome beacon
winter scarab
chrome beacon
#

Yes

winter scarab
#

any other ways? i will have to do this with quite a lot and rather not

chrome beacon
#

You can just ignore that warning

winter scarab
#

what about the assert statement?

quaint berry
#

I wouldn't know since I'm not the best but I get the same error when I don't reference the plugin instance

#

Neither

chrome beacon
#

Did you add the maven repo for that plugin

#

and did you follow the installation instructions

winter scarab
chrome beacon
#

If you know your IDE is wrong you can ignore it

obsidian drift
chrome beacon
#

Call setPos

#

in the constructor

obsidian drift
#

I have this

private class Test extends Skeleton {

                public Test(net.minecraft.world.entity.EntityType<? extends Skeleton> entitytypes, Level world) {
                        super(entitytypes, world);
                        this.setPos(4.0, 72.0, 12.0);
                }
        }
chrome beacon
#

also did you actually spawn it with level.addFreshEntity

obsidian drift
tawdry python
#

Does anyone know how I can create a world with only plaints biome and only bedrock on layer 1? a normal world

obsidian drift
quaint berry
#

Is there an equivalent to Thread.sleep(5) but for spigot?

tawdry python
# quaint berry Your mean this?

Yes, but then I can't make a normal world with only bedrock on layer 1, not from 1 to 5, I think it's only programmable that I can do that

quaint berry
#

Since everything else is some weird indent

quaint berry
chrome beacon
quaint berry
#

I had a look but I'm special

obsidian drift
chrome beacon
#

You can take a look at the existing goals

supple elk
#

Does anyone know how to stop a player moving in a boat?

#

I've tried something like this

main dew
#

World#notifyAndUpdatePhysics anyone know how work flag in this method? 😅

quaint berry
chrome beacon
#

Well that's what you need to do

supple elk
#

but it kinda just teleports the player on to the top of the boat

#

rather than putting them in it

quaint berry
glossy venture
supple elk
#

I'm using VehicleMoveEvent

#

which is not cancellable

glossy venture
#

bruh

chrome beacon
#

If so there should be a class with constants you can use

main dew
chrome beacon
#

Don't remember the old name

eternal oxide
#

?stack

#

?stash

undone axleBOT
quaint berry
glossy venture
#

how

#

show your code

chrome beacon
#

Sounds like you still have thread sleep somewhere

quaint berry
#
Bukkit.getScheduler().scheduleSyncDelayedTask(myPluginInstance, () -> {
                ((Player) sender).teleport(finalLocation);
                Location finalLocationAbove = ((Player) sender).getWorld().getBlockAt(blockX, blockY + 10, blockZ).getLocation();
                ((Player) sender).getWorld().spawnParticle(Particle.EXPLOSION_HUGE, finalLocationAbove, 1);
                sender.sendMessage(ChatColor.GREEN + "Teleporting...");
            }, 10L);
main dew
chrome beacon
#

?paste

undone axleBOT
glossy venture
#

because that will not stop a server

quaint berry
#

:D

main dew
quaint berry
#

1.19

chrome beacon
#

isChunkGenerated uses chunk coords

#

Not regular ones

#

Also getBlockAt will load the chunk

glossy venture
quaint berry
#

But

#

The server stops for 10 second E.i. The time I specify

glossy venture
#

because youre loading a chunk every position check i think

#

getBlockAt(...)

chrome beacon
#

^^

glossy venture
#

do the isChunkGenerated check first

#

with the correct chunk coords

glossy venture
main dew
glossy venture
#

1 second == 20 ticks

#

10 seconds = 200 ticks

#

thats what you want in the value

#

for scheduleSyncDelayedTask

opal juniper
#

generics are kinda cool

glossy venture
#

yeah

chrome beacon
#

Try looking at the DFU and you'll never want to see Generics again

opal juniper
#

i do not want to see that kekwhyper

#

i err - yeah

chrome beacon
opal juniper
#

im sure its very good at its job cause my worlds havent corrupted yet

chrome beacon
#

It's over engineered

opal juniper
#
public <A, B, C, D> App2<FunctionType.Mu, Pair<A, C>, Pair<B, D>> par(final App2<FunctionType.Mu, A, B> first, final Supplier<App2<FunctionType.Mu, C, D>> second)
#

where can i vomit

#

but whatever

#

i can see why paper hates working with it :)

glossy venture
#

bang

alpine urchin
#

more like mojunk

spare prism
#

Hello. I want to display info below player's name. Why doesn't my code work?

    public static void setUserLivesScoreboard(User user) {
        ScoreboardManager manager = Bukkit.getScoreboardManager();
        Scoreboard scoreboard = manager.getNewScoreboard();
        Objective objective = scoreboard.registerNewObjective("name", "dummy", "lives");
        objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
        objective.setRenderType(RenderType.INTEGER);
        objective.getScore("lives_team").setScore(user.getLives());
        Team team = scoreboard.registerNewTeam("lives_team");
        team.addEntry(user.getPlayer().getName());
    }
chrome beacon
spare prism
chrome beacon
#

?

#

ah yeah

shadow zinc
#

how do I check how many items are in players inventory?

spare prism
chrome beacon
#

Either create a team for each player or set the players scoreboard

#

You probably want a team for each player

sharp flare
spare prism
# chrome beacon Either create a team for each player or set the players scoreboard

Can you show an example, pls? Or is this one correct?

    public static void setUserLivesScoreboard(User user) {
        ScoreboardManager manager = Bukkit.getScoreboardManager();
        Scoreboard scoreboard = manager.getMainScoreboard();
        Objective objective = scoreboard.registerNewObjective("name", "dummy", "lives");
        objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
        objective.setRenderType(RenderType.INTEGER);
        objective.getScore("lives_team").setScore(user.getLives());

        Player player = user.getPlayer();

        Team team = scoreboard.registerNewTeam("lives_team_" + player.getName());
        team.addEntry(player.getName());
    }
shadow zinc
chrome beacon
#

Yeah that's fine

#

You might run in to errors if the team already exists though

sharp flare
chrome beacon
#

also make sure to remove teams when they aren't needed

shadow zinc
spare prism
shadow zinc
#

and .length doesnt work

sharp flare
#

well there are stackables

shadow zinc
#

just how many slots are taken up

sharp flare
#

thats why you get the contents first

chrome beacon
sharp flare
#

oh

shadow zinc
#

of 54 slots assuming

#

shovel a dirt block and food should be three

spare prism
chrome beacon
#

No need for teams then

#

Scoreboard is enough

spare prism
shadow zinc
#

its to check if there is room in the inventory to add another item for auto pagination

chrome beacon
sharp flare
spare prism
#

I'm not too familiar with scoreboards 😦

shadow zinc
#

k

#

ill do that

spare prism
chrome beacon
#

or not

#

Yeah

#

The problem is a player can only be in one team at a time

#

You might cause conflicts with other plugins if you're not careful

spare prism
chrome beacon
#

Example:
plugin a; Creates a team for name colors
Your plugin adds lives count; Name colors no longer work

#

Actually again we don't need a team for this. Just create an dummy objective for each player and set the lives of that

spare prism
# chrome beacon Actually again we don't need a team for this. Just create an dummy objective for...

like that?

    public static void setUserLivesScoreboard(User user) {
        ScoreboardManager manager = Bukkit.getScoreboardManager();
        Scoreboard scoreboard = manager.getMainScoreboard();
        Objective objective = scoreboard.registerNewObjective("name", "dummy", "lives");
        objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
        objective.setRenderType(RenderType.INTEGER);

        Player player = user.getPlayer();

        objective.getScore("lives_" + player.getName()).setScore(user.getLives());
    }
hidden kestrel
#

Hey guys
Why does
e.getAdvancement().getDisplay()
Throw a
java.lang.NoSuchMethodError: 'org.bukkit.advancement.AdvancementDisplay org.bukkit.advancement.Advancement.getDisplay()' error??????

chrome beacon
#

ugh I hate working with scoreboards

spare prism
chrome beacon
#

That's probably not going to work either. Just use an existing plugin like TAB and add your own PlaceholderAPI

chrome beacon
spare prism
chrome beacon
#

TAB is open-source go take a look at how it works I guess

hidden kestrel
noble lantern
#

What version is your plugin developed on? If it compiles but doesnt run on the sever then you got something mismatching somewhere

quaint berry
#

Does anyone have any ideas for making a cooldown for a command?

#

Like methods for doing it

hidden kestrel
#
      <dependency>
          <groupId>org.spigotmc</groupId>
          <artifactId>spigot-api</artifactId>
          <version>1.19-R0.1-SNAPSHOT</version>
          <scope>provided</scope>
      </dependency>
#

Oh 1.19

#

but still

noble lantern
# quaint berry Does anyone have any ideas for making a cooldown for a command?

Store a HashMap of UUID/Long

Where long is the Epoch milli of the time they ran the command, look into the Instant class its really helpful for this

And where UUID is the players uuid

From there, just compare times and if time is == 30 seconds + the stored time then you know 30 seconds has passed, you can remove them from the hashmap and process the command right there

eternal oxide
#

Your server isn't 1.19 or its not Spigot

noble lantern
#

you know what it makes sense alex was talking about some issues with advancments on paper a few days back

noble lantern
#

also those 2 minor versions could of had a method rename too, may be good to check javadocs or just fully upgrade both sides

eternal oxide
noble lantern
#

yeah likely on paper then

eternal night
#

heh @tender shard we found your breaking change 😅 ^

slate delta
#

How can show this screen with code ?

echo basalt
#

uh

#

setFreezeTicks

slate delta
#

thanks

noble lantern
#

well

#

it will freeze the player i think no?

#

and give damage?

echo basalt
#

uhhhhhhhhhhhhh

noble lantern
#

or is it just a packet for freeze

echo basalt
#

entity metadata packets then

noble lantern
#

yee

#

or you can just cancel damage from snow frost

#

that works too

hybrid spoke
echo basalt
#

might have unintended consequences

noble lantern
echo basalt
#

or 1.16

#

somewhere like that

noble lantern
#

1.16 i think

#

i can check in a sec on 1.16

echo basalt
#

I feel like it's 1.17

hybrid spoke
#

tf

echo basalt
#

because entity metadata packet

noble lantern
#

i think so too

hybrid spoke
#

i never experienced this

noble lantern
#

its annoying

hybrid spoke
#

what does it do

echo basalt
#

had to shift all bit fields by 1

noble lantern
#

when you fall in it you can see shit

echo basalt
#

because we added a new field to all entity metadata

noble lantern
#

and it just freezes you and constantly damages you

hybrid spoke
#

ah

noble lantern
#

you find them in snowy biomes

hybrid spoke
#

but it looks cool

noble lantern
#

and you can randomly fall in them

#

yeah the hud for it is cool

hybrid spoke
#

could be some mmorpg thing

noble lantern
#

they need a fire one

echo basalt
#

you can do funky shit

hybrid spoke
#

back to the minecraft mmorpg server idea

echo basalt
#

with resource pack

#

one for barrier warnign, other for snow tick

real blaze
#

quick question, for the InventoryClickEvent, does setCurrentItem() set the itemstack before or after an item is moved to the cursor?

noble lantern
#

iirc doesnt that set the item currently clicked

echo basalt
#

setCurrentItem sets the item at the target gui

noble lantern
#

or last clicked

echo basalt
#

currentItem = gui item

#

cursor = cursor item (doesnt belong to any gui)

noble lantern
#

ignore me

echo basalt
#

and those are the values before the inventory changes

#

because the event can cancel

#

issa pain

noble lantern
#

inv api is a mess

eternal ember
slate delta
real blaze
#

well thats bad for my use case since I wanted to set item lore once a player cursor picks up an item, and setcursor is deprecated

noble lantern
#

wouldnt it still slow them tud?

eternal ember
#

it does

noble lantern
#

Yeah it may likely be unwanted

echo basalt
#

entity metadata packets it is

#

do you want protocollib or nms?

real blaze
echo basalt
#

it returns the whole inventory view

#

top and bottom inv, whos the viewer

#

whats the cursor etc

noble lantern
#

its not on 1.16

#

back to building my reactor

real blaze
hybrid spoke
echo basalt
#

WalmartPathfinder

noble lantern
#

nah its my mekanism reactor

#

i got tired of staring at a ide for 14 hours

#

fucking with packets

hybrid spoke
#

do you still have the walking strategy?

echo basalt
#

I might need to code A* into minecraft

noble lantern
#

ofc

real blaze
#

I assume that HumanEntity can be casted to Player with no issue?

echo basalt
#

burch help me with that shit

#

zombies keep trying to walk through walls

noble lantern
noble lantern
#

well they wont target through walls sadly

#

the path strat will give up if no path found

echo basalt
#

does it support trapdoors

chrome beacon
noble lantern
#

thats all on you

echo basalt
#

no

noble lantern
#

but yeah it does

echo basalt
#

I mean

#

map is full of trapdoors

#

it trips AI up as wel

noble lantern
#

uhhh

#

cipher question

#

or ollie

hybrid spoke
#

well, i've never tested trapdoors or any kind of that

noble lantern
#

i never tested that

hybrid spoke
#

but i guess if its open 🤔

noble lantern
#

LOL

#

let me get the path strat code

#

do note

hybrid spoke
#

@opal juniper ever tested trapdoors?

noble lantern
#

its before you added instance based rules

opal juniper
#

nope

hybrid spoke
#

yeah i would've to adjust it anyways

echo basalt
#

I wonder how it would act here

hybrid spoke
#

since we started to implement rulesets

opal juniper
#

in what way doe? like walking over or thru

noble lantern
hybrid spoke
opal juniper
#

i think they would be OTHER

noble lantern
#

by default tho it may do something whacky

hybrid spoke
#

as what does bukkit state trapdoors etc

#

solid?

opal juniper
#

oh yeah i made quite a big diff the other day

#

so gl merging burchard ahahaha

echo basalt
noble lantern
#

hmmmmmmm

hybrid spoke
#

you could test it

noble lantern
#

no

#

not mine

#

should be fine

#

default should be too

echo basalt
#

I mean

#

default tries to do stupid shit

noble lantern
#

?paste

undone axleBOT
noble lantern
#

https://paste.md-5.net/hamujimife.java

This tries to avoid falling off cliffs and will try to avoid lakes whenever possible by an offset of 2 blocks

May not be best for performance but its async shrug

echo basalt
#

zombies pathfind up here and then get stuck because they can't yeet through barriers

#

instead of going around

#

like how tf

noble lantern
#

ollies should be fine with barriers

hybrid spoke
#

yeah it is, but if its the default it will also try to find holes in the barriers

#

or try to go above it if there is a hole

noble lantern
#

oh shit

#

speaking of that cipher

noble lantern
#

then its perfect 👌

#

thats easy to add tho

echo basalt
#

there are literally no holes

hybrid spoke
#

so probably a "can stand here"

echo basalt
#

they spawn in a corner

#

and pathfind there

#

to just look at the player

hybrid spoke
#

thats fine

echo basalt
#

and taunt it

#

this is a damn zombies map

noble lantern
#

only issue with my strat

#

it wont walk on 1x1 spaces

#

its scared to

#

like in the air

#

wait no

#

i fixed that

#

nvm

#

the blocks dont nail to the floor

#

so with packet based npcs they fly lol if your not handling physics

echo basalt
#

these stupid mfs

#

have a tracking range of 200 blocks

#

and still just decide to die

noble lantern
#

200??????

echo basalt
#

yeah

noble lantern
#

thats HUGE

#

i barely do over 40

#

if its over 40

echo basalt
#

they also respawn if the target is further than 70 blocks

#

but what if there's no spawn point available

noble lantern
#

take entity -> teleport it to random location offset by 5-15 blocks

echo basalt
#

🤔

noble lantern
#

nvm

echo basalt
#

I've been working on this damn zombies project for 2 months

#

we had a meeting last week

#

guy died, fell through the floor and crashed the server

#

so we had another one 2 days ago fixing stuff

#

and the map would close doors you opened

#

if you got too far

#

👍

noble lantern
#

honestly you might want a custom strat for something like that

#

even different than mine

echo basalt
#

I mean

#

I just have somewhat modified pathfinders

noble lantern
#

sorry

echo basalt
#

more like the block checker itself

#

I'd rather do like 3 hours of NMS reworking to get this to work

#

than to write a pathfinding algo

median trench
#

Is there a way to set a passenger entity leashed to a player? When I leash an entity and set it riding another entity, it removes the leash (with nms)

noble lantern
#

you dont need to write an algo

echo basalt
#

or tune an algo

noble lantern
#

did you even see the pathfinder paremeter i sent lol

#

i already did that for you

echo basalt
#

I mean

#

I don't care about cliffs

noble lantern
#

yeah so just remove the if

#

//

echo basalt
#

also I'd need to change the snapshot manager

#

because clientside block

noble lantern
#

oh

#

jesus fuck smh

#

100x more complicated now

echo basalt
#

and also do some pathfinding because trapdoors

#

and their fancy aabbs

noble lantern
#

@opal juniper make it work on client side blocks 😄 (joking btw)

noble lantern
echo basalt
#

some trapdoors are closed

#

some are open

#

I use some as walls

#

others as decoration

echo basalt
noble lantern
#

try and see

#

youll never know without trying but

#

you have client side blocks

#

so it makes it way more complex

opal juniper
#

you dont know what blocks they have

noble lantern
#

it is if they make theyre own isValid handler

#

and store the blocks each player has but

#

jesus so much work

opal juniper
#

mfw you send API requests to the client :))

echo basalt
#

you can make an interface

echo basalt
#

I do track what players see what

#

You can make an interface which is like

opal juniper
#

but that is reliant on your plugin being the only one faking blocks as well

noble lantern
#

well in most cases it is

#

tbf

echo basalt
#

public Material getTargetType(LivingEntity target, Location location) { return location.getBlock().getType(); ]

noble lantern
#

no Locations

#

async

echo basalt
#

fuck

noble lantern
#

PathLocation

echo basalt
#

I mean

noble lantern
#

BukkitMapper.toPathlocation(location)

echo basalt
#

you gotta pathfind through something

#

so you'd be checking blocktypes regardless

noble lantern
#

ChunkSnapshots

echo basalt
#

just add method to override that getter

#

or inject through

echo basalt
#

my api is thread-safe afaik

hybrid spoke
#

or pass in your own PathBlocks

noble lantern
#

^

#

it takes x y z doubles

#

so as long as you have the location ur fine

echo basalt
#

why doubles

noble lantern
#

ints whatever the fuck

#

idk

#

i didnt write i just used tf out of it

noble lantern
#

abused the poor thing so hard

hybrid spoke
#

and location takes doubles

noble lantern
#

okay i am making a suggestion

echo basalt
#

ehhh okay I'll try

noble lantern
#

new PathBlock(1, 1, 1, PathBlockType.SOLID)

hybrid spoke
#

world goes brr

noble lantern
#

wait

#

why does it need world

hybrid spoke
#

where else would the location be

noble lantern
#

it already has it no? for the pathfinder?

echo basalt
#

okay now

#

how the fuck do I make a zombie follow that path

#

without setting velocities every tick

noble lantern
hybrid spoke
#

pathblocks holds a pathlocation which holds 3 doubles and a pathworld

noble lantern
#

its 1 block movements

#

so uh

#

huh

#

uhhhh

opal juniper
#

thats a point actually

#

hmm

#

i think they are used in WorldDomains

#

but i forget

echo basalt
#

top tier pathfinder api

#

but you can't apply pathfinders to mobs

noble lantern
echo basalt
noble lantern
hybrid spoke
noble lantern
#

that was most of my time spend using it

noble lantern
hybrid spoke
#

i already thought about making the pathfinder instance based as well

#

and passing in 2 locations

echo basalt
#

worst part is like

#

the target is an entity

#

so you'd need to recalc path every tick or something

noble lantern
#

I like the PathFinder#pathfind(to fromt) imo

echo basalt
#

but nms also does that

hybrid spoke
echo basalt
#

and all the concurrency stuff to make it sync <-> async

#

will give some delay

noble lantern
noble lantern
noble lantern
#

that way you dont need to re-initialized

echo basalt
#

I can't recalc every 10 seconds here

#

too confined

noble lantern
#

10 ticks*

noble lantern
#

that could esily be put in pathfinder tbf

#

your never gonna switch world like pathfinding like that lol

#

unless you add support for portals

hybrid spoke
opal juniper
#

yes he did

noble lantern
#

yeah that part is done

opal juniper
#

my code isnt working somewhere here lol

#

(not pathetic)

hybrid spoke
#

you are pathetic

hybrid spoke
opal juniper
#

it sysouts, but then failes before the second

opal juniper
#

no error tho, just silent

#

so apparently sender is null causing an NPE

#

who would have known

#

not me cause java stupid and errored silently

noble lantern
#

{{ }} ??

#

tf

opal juniper
#

ye its how the initialisers work

noble lantern
#

oh so you can initalize it like that without needing to override

#

didnt know that

#

everytime i tried it it just gave me options to override

echo basalt
#

don't

#

it's a hacky ass method

opal juniper
#

yes and i like it

echo basalt
#

makes a whole anonymous class

opal juniper
#

yes and i like it

#

:)

echo basalt
dense pine
#

why cant i paste pictures here

echo basalt
#

you're not verified

gray merlin
#

Is there a way to create an Entity or CraftEntity object or something of the sorts? I have some NBT i'd like to add to an entity before it is placed in the world, so it spawns with everything included.

opal juniper
#

wait wudaheq

opal juniper
#

its not sending some data eventhough i set it to

gray merlin
#

Thank you.

chrome beacon
#

^^

eternal oxide
#

do yoru changes in the Consumer

echo basalt
#

not really that safe conestly

chrome beacon
#

It should be

echo basalt
#

I mean

#

the new entity

#

stuff

#

consumer is cool

gray merlin
#

Oh, I see. We can just pass in the NBT at spawn-time.

#

Thank you, that also works!

dense pine
#

For some reason this exception crashes my plugin

#

ive got pom.xml and jar libraries so idk why it cant find it

#

this class exists in the jar

eternal oxide
echo basalt
#

do you see a system path elgar

#

they look fine

#

but are the deps shaded

dense pine
#

i tried maven, jars, both at the same time

echo basalt
#

🤔

#

I'm still mad this exists

eternal oxide
#

if You manually add jars Maven will not see them.

#

allow Maven to do what its supposed to do

#

add scopes to your dependencies

dense pine
#

removed jars and replaced with maven only

eternal oxide
#

good

#

anything which is already on yoru server you can set as <scope>provided</scope>

real blaze
#
public void diamondDropListener(ItemSpawnEvent e){
        ItemStack item = e.getEntity().getItemStack();
        if(item.getType().equals(Material.DIAMOND)){
            removeIfOwned(item);
            item.getItemMeta().setLore(null);
        }
    }

So this code block attempts to remove lore from items upon becoming an item entity

#

doesnt seem to work?

dense pine
echo basalt
#

did you @eventhandler

dim bronze
azure island
#

Can someone help? Im not experienced in plugins, idk how to check if player is right clicking with my created item

real blaze
eternal oxide
#

did you build using Artifacts or teh maven package menu?

echo basalt
#

meta is a copy

#

you gotta setMeta as well

tardy delta
#

for (short s = ...) 💀

azure island
#

that's bad?

echo basalt
#

micro optimizng ram

tardy delta
#

not really useful

echo basalt
#

like

#

man's micro optimizing while having bigger issues

#

like nesting

real blaze
echo basalt
#

and lack of item utilities

tardy delta
real blaze
#

or well i called a getter

dim bronze
#

@dense pine If you're developing for 1.16 or higher you can add com.fasterxml.jackson.core:jackson-core:2.13.3 to the libraries section in the plugin.yml or you can shade the dependency using the maven shade plugin

real blaze
#

alright so here's a new problem which im not sure how best to be done:

calculating how many of x item was used in a craft that a player did

Checking CraftItemEvent, the getRecipe() method returns a recipe that has getResult(), which isn't what I'm looking for

eternal oxide
#

another loop reducing the radius

real blaze
dim bronze
#

What are you actually trying to achieve

real blaze
#

essentially im just trying to keep a scoreboard of diamonds that have a lore tag with the player name on them

#

and i want players to lose score if that diamond is crafted with

#

so i need to detect 2 things:

  • when a player crafts, did they use a diamond in the recipe?
  • if so, how many diamonds to reduce from the scoreboard?
eternal oxide
#

you only have to watch for your specific diamond

real blaze
#

it isn't a specific diamond though, its any arbitrary diamond

eternal oxide
#

I thought you just said, if they craft using a diamond with a specific lore with their name on it?

real blaze
#

ah right, i guess i should explain that any diamond that a player picks up / picked up with a cursor gets tagged

#

essentially every possible way you gain a diamond in the player inventory will tag it and contribute to score

dim bronze
#

I think the easiest way would be what ElgarL suggested, check the top inventory, cast it to a CraftingInventory and then check its matrix for your diamond

#

one thing you would have to be careful of is checking whether the player has clicked normally to craft one or shift clicked to craft multiple

eternal oxide
#

Yeah, shift clicking is a pain

dim bronze
#

realised my definition wasn't really correct*

dense pine
tardy delta
#

in your plugin.yml

dense pine
#

ah

real blaze
#

perhaps one easy solution would be to simply remove the score if a player places diamonds in the crafting grid

dense pine
#

im blind sorry xDF

dim bronze
#

That's the new way of adding dependencies however it's been buggy for me sometimes

dim bronze
#

leaving the game, inventory close, removing the items from the grid etc.

real blaze
eternal oxide
eternal oxide
#

in that case, why not update teh score every 60 seconds. Count how many diamonds in each players inventory

#

no messing about with totals and crafting then

real blaze
#

well that wouldnt count diamonds in chests no?

eternal oxide
#

it would not

dim bronze
#

the player doesn't need to keep them in their inventory

eternal oxide
#

Sorry I mis read and thought they had to carry them

real blaze
#

this would be a lot easier if it was just carrying lol, could've been the job for a datapack

dense pine
#

ok the libraries worked but how do i shade dependencies so ill know if ever need to

#

thanks btw

dim bronze
#

The link I sent in the reply sort of shows you

cunning canopy
#

Wth is nms?

dim bronze
#

how are you currently building your jar? @dense pine

eternal oxide
dense pine
cunning canopy
eternal oxide
dim bronze
#

yes but are you using the command line / maven panel in intellij or are you using intellij build artifacts?

tardy delta
#

does anyone knows if you put a plugin in the plugins/update folder and you reload the server instead of restarting, the plugin also enables?

dense pine
#

inteliij

real blaze
#

one solution would be:

  • get crafting result
  • get a case statement for each recipe that uses diamonds and assign a value of diamonds used
  • remove quantityUsed * itemstack.getamount() of score

However, its impossible to know if a player crafted a Firework that used a diamond

tardy delta
dim bronze
#

there's probably a way to do it through intellij but I can't check at the moment. If you wanted to shade the dependencies into the JAR in the future you would need to run mvn package either through intellij maven panel or command line

#

The link I sent also shows relocating the dependencies which is good practise so you aren't using a dependency in someone elses plugin

eternal oxide
# dense pine

Right side of your screen, maven window -> lifecycles -> package

dense pine
#

i think i got it

dim bronze
#

that looks like it's done it

#

jar is then inside target folder