#help-development

1 messages ยท Page 1059 of 1

worthy yarrow
#

Ah I knew it

#

You needed the entity

livid heron
#

yes

floral drum
#

EntityShootBowEvent#getProjectile

#

That should be the entity/projectile that is fired

worthy yarrow
#

Damnit purple

#

I just got the doc too

dawn flower
#

how do i change the "Motion" of an entity

#

"Motion" is in the nbt

floral drum
#

I mean if I know correctly motion should really be the velocity

dawn flower
#

and before you say use velocity, bukkit limits the velocity

floral drum
#

so maybe setVelocity

#

oh right yea

dawn flower
#

i need higher speeds

#

i figured it out

worthy yarrow
#

How did you do it?

dawn flower
#

i used an nbt library

worthy yarrow
#

Oh easy enough kek

livid heron
#

ok so nothing happened

#

im sure theres probably something wrong with my code but i cant see what

#

ill send it

echo basalt
#

nms?

livid heron
#

    @EventHandler
    public static void onShoot(EntityShootBowEvent event) {
        Player player = (Player) event.getEntity();
        if (event.getConsumable() == ItemManager.rArrow) {
            player.setPassenger(event.getProjectile());
        }
    }
}```
worthy yarrow
#

Is event.getConsumable the arrow entity? Or is event.getProjectile

livid heron
#

getconsumable i though was the item

dawn flower
#

you need to implement the spigot Listener not the Websocket one

worthy yarrow
#

That too

worthy yarrow
livid heron
worthy yarrow
#

Ok yes you are correct it is the item

worthy yarrow
livid heron
#

wack

#

also i dont think i put the event in the main class ๐Ÿ’€

worthy yarrow
dawn flower
#

so if you have an exception you know exactly where it is

#

and to avoid really long classes

livid heron
#

i have 1 event total

#

this is the sole purpose of the plugin

#

ok so i fixed the websocket thing and i put this in onEnable() getServer().getPluginManager().registerEvents(new EventManager(), this); but still nothing is happening

#

i put a sendmessage in the event but it didnt trigger

worthy yarrow
livid heron
#

but i have a special arrow which is what it's checking for

worthy yarrow
#

Iirc you still have to verify that it's a player or human entity or wtv before casting the player object

dawn flower
#

how do i make a specific player not load chunks

livid heron
#

lol vengeance

floral drum
#

ChunkLoadEvent it should be lol

#

ah no u cant cancel it

dawn flower
#

and it doesnt tell me who loaded it

worthy yarrow
#

PacketType.Play.Server.UNLOAD_CHUNK

send unload chunk packets to the player

dawn flower
#

i dont want the chunk to be loaded in the first place

worthy yarrow
#

Method in World perhaps?

#

pretty sure unloadchunk is a method in world

dawn flower
#

i'm doing a tutorial for players, which involves them teleporting (smoothly) across the world, which loads alot of chunks and lags the server

worthy yarrow
livid heron
dawn flower
#

i just got another idea, ima just add a ticket to all the chunks that the player would go through

livid heron
#

render distance = 0

dawn flower
worthy yarrow
livid heron
#

ok

#

so i did that and nothing changed

#

so i tried removing the condition that it had to be the special arrow and the arrow just stayed on top of my head

#

ohh the arrow was riding me

#

ok

#

oooh

#

ok it works really well

#

but it doesnt matter if i have the special arrow or not

#

so i just have to figure out if the arrow being fired is the special one or not

#

but the consumable thing didnt work for that for some reason

worthy yarrow
#

try to do .isSimilar(yourArrow) or wtv the correct way to do that is

livid heron
#

unrelated, is there any faster way to reload plugins aside from rebuilding the jar, then restarting the server

livid heron
#

thanks so much

worthy yarrow
#

yeah no worries I shoulda known the comparison was wrong haha

livid heron
#

i also had to change == to instanceof

#

nevermind

#

misremembering

#

one small issue, the arrow isn't showing up in the creative menu

worthy yarrow
#

You might have to add it to some registry? I'm not too sure on how the items are handled in the creative menu

#

I'd just make a command or gui to get the arrow

livid heron
#

yeah it has a command

worthy yarrow
#

Did you do anything to add it to the creative menu?

livid heron
#

nope lol

#

i was just wondering if there was a way

worthy yarrow
#

Sounds like reflection and unfreezing of registry to me

livid heron
#

probably

#

i just need to be able to give the arrow to individuals

worthy yarrow
#

You could do like a drop chance on skeletons

livid heron
#

i really just need it to actually exist as an item, which im not sure is currently the case

#

because i cant do /give and it's not in the creative menu

worthy yarrow
#

it exists as an item when you spawn it in via command (currently)

#

Do you have a command written?

livid heron
#

i have a custom command /givearrow

worthy yarrow
#

right so that's what you use

livid heron
#

but i want to be able to do something like /give rideable_arrow

#

like you would with any other item

#

unless i cant do that with plugins

#

but i dont see why not

worthy yarrow
livid heron
#

ok

worthy yarrow
#

Idk if this is the way but I assume so?

ashen remnant
#

hey is anyone familiar with towny?

livid heron
#

maybe theres another way

#

is it possible to specify who to run the command on?

#

in the code

#

like could i add an input for a player in the command

worthy yarrow
livid heron
#

i dont know if thats what im looking for

#

i meant something like /givearrow NuclearKat or /givearrow TheRingfinger

#

to give the arrow to a specified player

#

i need to make it excecutable from a command block

worthy yarrow
#

Bukkit.getPlayer() takes a string so you could do getPlayer(args[0])

#

I would make a player object from that method and verify that it's actually a player

#

handle exceptions accordingly

livid heron
#

ohh is that was the args[] is for

worthy yarrow
#

yeah

#

It's the arguments of the command

livid heron
#

radical

#

that should make it much easier

#

to grasp

worthy yarrow
#

Makes handling different things in the same command easier for sure

dawn flower
#

how do i get all the intersceting chunks of a bounding box

worthy yarrow
# livid heron to grasp

Also keep in mind that you should verify the length of the args[] to ensure correct usage of the command

livid heron
#

so keep it below 1

worthy yarrow
#

If you only want there to be one possible argument

livid heron
#

yes

worthy yarrow
#

It could be

#

/givearrow (player) (type) (amount)

livid heron
#

i just want /givearrow (player)

worthy yarrow
#

If that's what you want then yes

livid heron
#

cool

#

and is there a method to make the system say something in chat

worthy yarrow
#

Bukkit.getServer.broadcastMessage() or something

livid heron
#

ok thanks so much

worthy yarrow
#

no worries!

floral drum
livid heron
#

wack

worthy yarrow
#

Ah ok then you need to delve into nms I think if you wanted to do that

livid heron
#

is args [0] the initial command or the first argument

worthy yarrow
#

first arg

livid heron
#

cool

#

so this is what i wrote but it's not giving me anything public class FirstCommands implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player inPlayer = Bukkit.getPlayer(args[0]); if(cmd.getName().equalsIgnoreCase("getarrow")) { if(args.length != 0 && inPlayer != null) { Bukkit.getServer().broadcastMessage("Input a player!"); return false; } else { inPlayer.getInventory().addItem(ItemManager.rArrow); } } return true; } }

dawn flower
#

cmd.getName().equalsIgnoreCase("getarrow") isn' tneeded

#

and did u register the command in plugin.yml and your main class

livid heron
#

this is the main class ```@Override
public void onEnable() {
getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "[FirstPlugin] Plugin is enabled!");
ItemManager.init();
getCommand("givearrow").setExecutor(new FirstCommands());
getServer().getPluginManager().registerEvents(new EventManager(), this);
}

#
version: 1.0
author: TheRingfinder
main: com.theringfinder.first.First
api-version: 1.21
commands:
  givearrow:
    description: Gives a player a rideable arrow.```
dawn flower
#

it's givearrow not getarrow

livid heron
#

yml ^

#

oh

#

wow

livid heron
#

how else would it know which command im excecuting

dawn flower
#

getCommand("givearrow").setExecutor(new FirstCommands());

#

onCommand is only triggered when that specific command is sent

#

not any command

livid heron
#

oh ok cool

#

thats nice

#

do i need any usage in the yml

dawn flower
#

no

#

u can literally just do givearrow:

#

and it would still work

livid heron
#

oh cool

mint nova
#

Can i storage player data in .yml files? And how if yes

brittle geyser
#
File file = new File(plugin.getDataFolder(), "data.yml")
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
String path = "players." + player.getName()
config.set(path + ".current_hp", player.getHealth())
config.set(path + ".max_hp", player.getMaxHealth())
try {
    config.save(file);
} catch (IOException e) {
    throw new RuntimeException(e);
}
mint nova
#

Thanks bro

mint nova
brittle geyser
#
Object obj = dataConfig.get("players." + player.getName());
if (obj instanceof Map<?, ?>) {
    Map<String, Object> stringObjectMap = (Map<String, Object>) obj;
    double current_hp = (int) stringObjectMap.get("current_hp")
    double max_hp = (int) stringObjectMap.get("max_hp")
}
grim hound
#

Is a bungeecord server started with ROOT permissions?

brittle geyser
#
players:
  Hxncus:
    current_hp: 20
    max_hp: 20
  Lokha:
    current_hp: 1
    max_hp: 100
drowsy helm
#

Same with any other application

mint nova
brittle geyser
grim hound
brittle geyser
mint nova
#

Oh thanks bro

#

Thank you so much

brittle geyser
#

np

valid basin
#

is there a way to check which method was added in what version in spigotmc docs?

drowsy helm
#

I think someone was gonna pr a annotation for it but not yet

valid basin
#

because I need it when I make a plugin that supports multiple versions and then I use reflection for older versions that don't have it available in spigot API

vocal cloud
#

I wanted to but was told it'd probably get rejected

shadow night
pseudo hazel
#

so no, not really

#

commit history is ass

shadow night
#

true

#

But you could create an automated program to scan through all commits and check when what was added

sullen marlin
drowsy helm
#

Too much of a pain to do manually and big chance to mess up

wet breach
#

if its strictly api methods, then all you have to do is just scan all the api jars

#

you can even do this via reflection if I recall and scanning class paths for the api being present

#

if not, you can just do something different based on that

shadow night
#

Reminds me of the matcher

#

Actually, this sounds like a very easy task

#

I have all api jars besides 1.17 on my laptop rn

quiet ice
#

Use the A-level & V-level metadata files to obtain absolutely all API jars

#

This would also enable one to obtain the date in which an API was altered (it's often the case that changes occur mid-version)

drowsy helm
#

Would date really matter?

quiet ice
#

If you use a very specific snapshot version yes

#

But the fewest pin their snapshot vers I guess

#

Hell, I never knew that was possible

mint nova
jaunty sonnet
#

How do i make it be only the cloring rank and not the name ?

wet breach
pseudo hazel
jaunty sonnet
#

how?

pseudo hazel
#

idk

#

idk what this menu is

young knoll
#

Add a reset color code at the end

jaunty sonnet
#

I understand

pseudo hazel
#

oh yeah that could work &r at the end after player

tardy flame
#

Hey, is the block display transformation (e.g: transformation:[0.5024f,0f,0f,-0.6875f,0f,0.2286f,0f,0f,0f,0f,0.5f,0.25f,0f,0f,0f,1f]) like this
[ 0 4 8 12 ]
[ 1 5 9 13 ]
[ 2 6 10 14 ]
[ 3 7 11 15 ]

and whether the translation are indices 12, 13 and 14 or minecraft has other type of matrix

#

because for me when I use this matrix the transformation values are always 0, 0, 0

lost matrix
#

Minecraft (like most other games) use an affine transformation representation.
The last row corresponds to the homogeneous coordinates.

#

Translation is done by changing tx, ty, tz (or the last index as its used to scale the column)

#

Honestly, i would probably not bother too much with understanding affine transformations if you just want simple transformations.
The joml lib already provides you with a plethora of methods for this:

    Display display = ...;
    
    Matrix4f transformationMatrix = new Matrix4f();
    
    transformationMatrix.scale(0.5f);
    transformationMatrix.translate(0.5f, 0.5f, 0.5f);
    transformationMatrix.rotateAffineXYZ(0, (float) Math.PI / 4, 0);
    
    display.setTransformationMatrix(transformationMatrix);
brittle geyser
tidal finch
#

hiya, is there some sort of method for opening furnace gui or do I have to create it from scratch using something like Bukkit.createInventory() method? I am trying to make custom furnace plugin using player head model.

drowsy helm
tidal finch
#

ah got it thanks. So I am guessing if I'll want to create something like furnace that is faster for example I'll have to recreate whole furnace logic?

drowsy helm
#

Yeah you will unfortunately

#

Itโ€™s not a massive job though

#

Wait actually im not sure if a fake inv will smelt , it might work

#

Just have to keep track of the items

quaint mantle
#

hello i need help with worldguard and combatlogx

#

i want to make a are you cant enter if you are tagged

chrome beacon
quaint mantle
#

ok thanks

tidal finch
mint nova
brittle geyser
drowsy helm
#

Yes

sterile breach
#

I am learning NMS, there's something I don't understand Mojang seems to want to obsfuse his code from what I understand.
But there are mappings (spigot and mojang) it's the nms code that's been "unoffusced", why would mojang unoffusc his code if he's made an effort to offend him? I don't understand.

lost matrix
#

The code is no longer obfuscated

drowsy helm
#

Whos being offended

sterile breach
shadow night
#

mojang obfuscates their code but ships mappings to deobfuscate it

sterile breach
#

why obfuscate it if its to give tools to unobfuscat?

#

I am note sur to understand

shadow night
#

I think it's because of proguard minimization, to save space, but Idrk

sterile breach
#

ah okay

obtuse hedge
pseudo hazel
#

1.9 is ancient

worldly ingot
#

Minimization purposes and because the game still isn't open for distribution. Keeping it obfuscated is a way for Mojang to say "Hey, we still want to protect our game, don't go distributing this freely please, thanks"

#

but give developers obfuscation mappings so we can mod more easily. Giving tools to those that know how to use them. The average Joe has no idea what an obfuscation mapping is or how to use it

astral pilot
#

is there a way to access the values of mob exp drops through reflection/nms?

worldly ingot
#

Mob experience drops aren't static. They're based on the player that killed it (if there was one) among other conditions

#

EntityDeathEvent has a getDroppedExp() method

astral pilot
worldly ingot
#

No it's not a range :p

astral pilot
humble lynx
#

I don't see it mentioned

#

Only this:
"Fishing, breeding, and trading drop a single orb with a random value in the appropriate range"

#

But I imagine the relevant events would have a getExp method

drowsy helm
worldly ingot
drowsy helm
#

Are there opportunities to ask for feature requests or is it more just technical stuff

obtuse hedge
#

I need to know

grim hound
#

hey @lilac dagger

#

you didn't ultimately get a response, right?

lilac dagger
#

oh yeah, i didn't

#

but i can do it now i guess, you just have to send the right packets

grim hound
#

restarted

grim hound
#

whether I should do that for every single version

#

cuz via doesn't support bungee

#

also, can I stop the bungeecord from kicking a player if it has no servers?

lilac dagger
#

you could make a server actually

grim hound
#

cuz via doesn't support other engines

#

and I need a limbo server

#

fake limbo server

lilac dagger
#

yeah i know

#

that's what i needed too if i remember

#

ultimately i dropped the idea/too much time to figure it out

#

but now i would just fork the minecraft server and remove as much of it as possible

#

leaving only a few things running

#

oh yeah wait

#

there's a fake server thingy

#

open source minecraft server

grim hound
#

minestom

lilac dagger
#

search it up, i think it's what you're looking for

#

someone showed it to me some time ago

grim hound
#

I'm thinking of starting it from within the plugin itself

#

BUT

#

2 things

#
  1. The scratch version which I like better doesn't have a single fucking working build
#
  1. It only supports 1 minecraft version
lilac dagger
#

look up how via version supports multiple

grim hound
lilac dagger
#

since it's open source you could impl the basic in minestom

grim hound
#

so you're saying I should use the ViaLoader?

river oracle
river oracle
#

Just lie to the client ๐Ÿ’ฏ

grim hound
#

but still

#

only 1 version and the scratch version doesn't have any builds

grim hound
#

I'll just be doing

#

more

#

I guess I will try

#

still hate that bungee doesn't have a proxy -> backend event and refuses to add it

raw epoch
#

Hello ! is it possible to send a ressource pack proxy side using bungeecord ?

chrome beacon
#

I don't think that's part of the api

#

but sending the packets yourself would work

raw epoch
#

okok ty

astral pilot
astral pilot
#

anyways what is the most efficient way to get head of all mobs

sterile breach
#

I am learning NMS. If we use a mapped version (mojang for example) to code a plugin and then we execute it in a server, how it can work? methods and variables names will not be same (because we coded it in mapped version and server is in "obfuscated" version)

eternal oxide
#

?nms

wispy junco
#

Hi guys i have a problem when the block break event is cancelled and trying to open the chest inside of it they can open instead of not opening it

livid heron
#

guys how do i use the permission attribute for commands in the yaml file

#

i want a command to be op only

pseudo hazel
livid heron
#

default isnt a command attribute though i dont think

quick sluice
shadow night
#

exactly, I am working on a remapper rn lol

#

But it doesn't re-obfuscate, spigot has its own mappings which server jars are in

shadow night
#

Yep

sterile breach
#

Yes is that find

silent ridge
#

Someone can do a dayz texturepack? With 3d guns for my dayz server

shadow night
#

Nowadays there isn't that much of a difference, the only unobfuscated things are classes, butnbefore mojmaps existed (or were used by spigot), fields and methods were also remapped by spigot

#

Well, that's before spigot was mojmapped

#

There was the time between 1.14-1.17 when mojmaps did exist but they weren't utilized by spigot

#

I was planning to write my own buildtools (I don't really like the current buildtools) so I might change that lol

#

Yep

#

There is this project #1243264378522959914 that we are working on to make it less stuff to implement, but it doesn't really give you the ability to directly use nms if you wanna use more than 2 or 3 versions

#

Nah, multi modules

#

It's basically that you have like 12 "seperate" projects that all implement the same interface and are shaded into your final plugin

#

no, not really

#

You just have 12 implementations of one class in your jar and you only load the one you need, so no class not found exceptions

#

np

livid heron
#

guys how do i use selectors in my command ๐Ÿฅบ

livid heron
#

but can i use that for @p?

pseudo hazel
#

yes

#

if you read what the docs say

#

you should be able to use @p for the selector string

livid heron
#

the only issue im seeing is i can't access the returned entities' inventories

lost matrix
#

If they have inventories, you can access them

livid heron
#

like the entity class doesn't have the getInventory() method

lost matrix
#

Because not all Entities have inventories

livid heron
#

yes

pseudo hazel
#

I think they need to be upcasted to atleast living entity

#

but if its gonna be players, might as well use that

lost matrix
#

If you specifically want their inventories, simply check if they are an instance of InventoryHolder

livid heron
#

even if i check that how would i actually turn them into something i can edit the inventory of?

lost matrix
#

Or if you just want players, check if they are an instance of Player

pseudo hazel
#

this is a basic java issue I guess

livid heron
#

i guess

#

i might be a little slow

pseudo hazel
#

well casting is a pretty basic concept you should know about before trying all kinds of tricks with plugins xD

livid heron
#

yeah i didnt recognize it by name

#

i do know what it is though

lost matrix
#
List<Entity> entities = ...;
for(Entity entity : entities) {
  if(!(entity instanceof Player)) {
    continue;
  }
  Player player = (Player) entity;
}

*Always check before casting

livid heron
#

thanks

pseudo hazel
#

a trick is to just create the player variable right inside the check

#

like if (entity instanceof Player player) allows you to use player inside that scope

#

but thats pretty much the basics

lost matrix
#

Lets let him discorver instanceof pattern matching. Its an implicit cast which can be confusing for ppl.

pseudo hazel
#

smile showed kinda the classic stuff

#

yeah I guess

#

pattern matching my beloved

livid heron
#

thanks guys ๐Ÿ‘

pseudo hazel
#

yeah

livid heron
#

im using java 22

pseudo hazel
#

you should be on java 21 by now

livid heron
#

it's me again, i looked online to try and make a command only avaliable to ops and this is what i came up with but it didn't work, i think something is wrong with the permissions attribute but idk what

#
  givearrow:
    description: Gives a player a rideable arrow.
permissions:
  rideablearrow.givearrow:
    default: op```
#

i believe it's something to do with the path

#

i dont know where that should point

brittle geyser
#

commands:
givearrow:
permission: *
aliases:
- givearw

livid heron
#

what does permission: * do?

chrome beacon
#

bad idea

#

* is generally used as a wildcard

#

You shouldn't use it like that

livid heron
#

what should i put instead?

hybrid spoke
#

just some permission required for your command to work

livid heron
#

but i can't just put permission: op right?

young knoll
#

If you want that you use default: OP

#

But you should still add a permission

livid heron
#

im not sure what you mean

jaunty sonnet
#

how can I reset them to appear at all 0?

livid heron
pseudo hazel
#

are there any openScreen packet wizards here? I wanna change my title, but it only seems to work if I am doing it as a result of a click or drag event, not when I am updating it on a timer or after opening or smth

lost matrix
pseudo hazel
#

well i tried but ideally I want to use components

#

and for the api I need to keep track of the view which im not doing rn xD

river oracle
#

I think ik a decent amount about that topic tbh. But it's always possible mojang patched or damaged the quirk that allows that to work well

#

I can't exactly go about testing that till I get off work

lost matrix
# pseudo hazel well i tried but ideally I want to use components
  public static void sendInventoryTitleChange(@NotNull InventoryView view, @NotNull Component title) {
    Preconditions.checkArgument(view.getPlayer() instanceof Player, "NPCs are not currently supported for this function");
    Preconditions.checkArgument(view.getTopInventory().getType().isCreatable(), "Only creatable inventories can have their title changed");

    final ServerPlayer entityPlayer = (ServerPlayer) ((CraftHumanEntity) view.getPlayer()).getHandle();
    final int containerId = entityPlayer.containerMenu.containerId;
    final MenuType<?> windowType = CraftContainer.getNotchInventoryType(view.getTopInventory());
    entityPlayer.connection.send(new ClientboundOpenScreenPacket(containerId, windowType, PaperAdventure.asVanilla(title)));
    ((Player) view.getPlayer()).updateInventory();
  }
river oracle
#

Ope ofc smile has the code :3

pseudo hazel
#

ah sorry I forgot to tell you i am not on nms

#

I am using packetevents to send packets

lost matrix
#

Then just translate this to packetevents ๐Ÿ™‚

pseudo hazel
#

wait you can do this with packetevents?

#

i thought that was just for packets

lost matrix
#

I know that you can do this with Plib

#

The method above simply constructs a packet and sends it to the player

pseudo hazel
#

oh wait you are just using the player to get the id

river oracle
#

All you need is the menu type, title, and current window ID

pseudo hazel
#

yes I did that

#

so I tried that method but it didnt work

#

it only worked if I send it in a click event

#

but if I send it like in a few ticks after opening or after some time it fails to update

#

util I click somewhere

worthy yarrow
eager turtle
#

yo

#

i swear there was a way to make Text Displays only visible to one player without using packets?

river oracle
pseudo hazel
#

yes

#

which is why I am confused

#

but its not the one I wanna use ideally

#

since I need to use a string and it needs to be set using the view

river oracle
#

Weird considering that's all that , that method does is send the open packet

pseudo hazel
#

hmm

river oracle
#

Are you sure you have the ID correct?

pseudo hazel
#

pretty sure

#

I dont have a solid way to check

river oracle
#

You might wanna temporarily add nms and double check

pseudo hazel
#

rn im printing the id when I catch it and it doesnt change

river oracle
#

Oh

#

Well tbf idfk then.

pseudo hazel
#

like I said when I just click in the ionventory it suddenly thinks it has items (which it shouldve had from the start)

#

hmm

#

ill test some more with the api method ig

river oracle
#

Are you updating the inventory

#

After you change the title with the api updateInv method

pseudo hazel
#

I am using player.updateInventory right after the setTitle, which does appear to work but it flickers

#

but its not the end of the world

#

since it only updates the title on certain item changes

river oracle
#

Weird

pseudo hazel
#

but now I dont remember if the API one also flickered

#

hmm that one seems fine..

#

I could still have a tick delay somewhere though, but I think ill know what to do from here, thanks for the help both of you ๐Ÿ˜„

jaunty sonnet
worthy yarrow
peak depot
#

like for bossbar

zealous scroll
#

Is there a way to increase the view range for a display entity further than a couple chunks? I'm trying to have a big block display falling down from the sky but its range is very short even after settings its view range up to 64

pseudo hazel
wet breach
peak depot
tardy delta
#

want buy use command

pseudo hazel
#

and then you paste it into some string or into chat

#

but idk why your font is looking all smooth

mint nova
#
welcome_message: "&fWitaj na naszym serwerze &a%player%&f !"
        String msg = plugin.getConfig().getString("welcome_message");
        assert msg != null;
        Player player = event.getPlayer();
        msg.replace("%player%", player.getDisplayName());

        Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', msg));

Why its not replacing?

tardy delta
#

read the docs of replace

mint nova
#

like this?

#

oh wait

#

i just do msg = and it didnt work but now i just look and I dont upload the new plugin build

#

by english bad bro

#

i need to upload it wait

mint nova
#

yea its working now thanks

nova notch
#

hey i just watched that yesterday

young knoll
#

Not to judge

#

But thatโ€™s not really half

quaint mantle
#

1/3

nova notch
#

shes called potato girl cus her brain is also similar to that of a potato

wet breach
#

lol

worthy yarrow
#
public Vector determinePlotOffset(UUID playerId) {
        if (plotOffsets.containsKey(playerId)) {
            return plotOffsets.get(playerId);
        }

        int plotSize = 100;
        int plotIndex = plotOffsets.size();
        int x = (plotIndex % 10) * plotSize;
        int z = (plotIndex / 10) * plotSize;

        return new Vector(x, 64, z);
    }```

Do we think like 100 blocks of spacing is enough for plots?
hazy parrot
sleek estuary
#

this rules are redudant?

analog lantern
#

how do i change the length of a vector?

#

im doing lerping, so i have a vector from one point to another and i was just gonna set the length of that vector to my t value and then get the point where the vector ends

#

and ez pz

#

but i cant find the method to control vector length

#

is it just subtract and add?

worldly ingot
#

normalize().multiply(scale)

analog lantern
#

oh so i can just normalize and then multiply by t?

worldly ingot
#

normalize() will make it a unit vector (change its length to 1), then multiply() is a multiplication and 1 times anything is just the other term

analog lantern
#

wait i dont even have to normalize i just realized t is a float between 0 and 1

#

i can just multiply

#

to get that % on a line

worldly ingot
#

Yeah but if you have x = 1, y = 1, and z = 1, then that's not a unit vector because its length is longer than 1

analog lantern
#

its a vector between a location and another and t is just trying to get the point at t on that line

#

so like picture t * 100 if t = 0.5 im trying to find the 50% point on the line

#

or...half the vector's length

#

so i think i can just multiply the vector by t

worldly ingot
#

Yes

#

Just be aware that multiply() will mutate the vector's components

analog lantern
#

i cloned it first

worldly ingot
#

So you might want to clone() then multiply()

#

Ye

sleek estuary
#

this being called on rightclick

#

how i make to call leftclick too

#

thx

prime tartan
#

hi guys, i was wondering if anyone could help me. i'm trying to replicate a disc like shape (with a small hole in the middle) but i can't figure out how to fill the disc in and put a small hole in it. currently i have this right now with the following code, anyone have an idea?

    private void spawnDisc() {
        for (int angle = 0; angle < 360; angle += 5) {
            double radian = Math.toRadians(angle);
            double x = Math.cos(radian);
            double z = Math.sin(radian);
            Location eclipse = origin.clone().add(x * 0.17, 0, z * 0.17);
            BlockDisplay blockDisplay = (BlockDisplay) player.getWorld().spawnEntity(eclipse, EntityType.BLOCK_DISPLAY);
            blockDisplay.setBlock(material.createBlockData());
            blockDisplay.setGravity(false);
            blockDisplay.setInvulnerable(true);
            Transformation transformation = new Transformation(
                    //translation
                    new Vector3f(),
                    //rotation
                    new Quaternionf(),
                    //scale
                    new Vector3f(.1f, .05f, .1f),
                    //another extra rotation at the end i think
                    new Quaternionf()
            );
            blockDisplay.setTransformation(transformation);

            display.add(blockDisplay);
        }
    }```
analog lantern
#

interact events cover left & right click

warm mica
prime tartan
#

where am i subtracting 180

violet blade
#

this might be a dumb question but this will global all the permissions that are like " example.use.2 , example.use.3 " etc?

eternal oxide
#

Depends

#

vanilla Spigot no. Wildcards are not supported by Bukkit.

#

Luckperms modifies Bukkit to handle wildcards

#

Most other perms plugins with Vault support wildcards

#

same as the plugin

tepid turret
#
public class InvincibleBoats implements Listener {

    private Keys keys = new Keys();

    @EventHandler
    private void invincibleBoats(EntityDamageEvent event) {
        Entity boat =  event.getEntity();
        Bukkit.getLogger().info("Entity Damaged!");
        if (boat.getPersistentDataContainer().has(keys.getClaimed())) {
            Bukkit.getLogger().info("Entity Damaged is Claimed!");
            event.setCancelled(true);
        }
    }
}

Solved: VehicleDamageEvent for boats and minecarts etc. (VehicleDestroyEvent also exists)

#

this returns "Entity Damaged!" when player takes fall damage

#

but doesnt return "Entity Damaged!" or anything when a boat is hit

#

am i looking at the wrong event?

potent atlas
#

what's up guys! I'm working on a plugin that has particle wings. I'm trying to keep the rotation relevant to the player's -body- not the head. I've tried some math and vectors and rotations, I even tried packets. the body rotation is not handled by the server. is this possible or am I wasting my time? ๐Ÿ˜›

eager turtle
#

Dude why are my TextDisplays only visible from one side

#

i just want them to work like an invisible armor stand

eager turtle
#

display.setBillboard(Display.Billboard.CENTER);

#

nvm

wooden zodiac
#

How to make plugin use "&" color codes instead of ยง in config file

tepid turret
agile anvil
potent atlas
#

the idea is to wait for a player to move their head far enough to begin rotating the body and thus the wings. I tried the math with angles and yaw and such for this method but I couldn't quite get it right. any help?

potent atlas
#

thanks anyways ๐Ÿ˜›

tepid turret
#

No problem!

tepid turret
#

Change entity type while keeping its data?

smoky anchor
hushed spindle
#

is there a crafter craft event

#

or can it be derived from an ItemCraftEvent

tepid turret
# smoky anchor Do elaborate

as in like i have a boat with PDC data saved to it etc, and i want to convert it to a chestboat while a players riding it without kicking the player off

smoky anchor
#

I do not believe something like this is possible.
To "change an entity type" is to despawn entity of type A and spawn new entity of type B

slate surge
#

Hey! How to send a custom minecraft:brand?

tepid turret
#

you mean send your own minecraft:

#

like yourpluginname:

slate surge
#

nope

#

I want to send a custom server brand

tepid turret
#

what do you mean?

#

custom server brand?

#

and send it to what?

slate surge
#

mhm

slate surge
drowsy helm
#

You have to fork spigot and change it

slate surge
drowsy helm
#

There might be a packet for it

molten needle
#

Hello

slate surge
#

Atm I have this but it doesnt seem to work quite well

@Subscribe
    public void onServerConnectedEvent(ServerConnectedEvent event)
    {
        this.proxy.getScheduler().buildTask(this.plugin, () -> {
            ByteArrayDataOutput out = ByteStreams.newDataOutput();
            out.writeUTF("CoreVelocity");
            event.getPlayer().sendPluginMessage(this.IDENTIFIER, out.toByteArray());
            System.out.println("Sending Core Velocity message to player");
        }).delay(5L, TimeUnit.SECONDS).schedule();
    }```
molten needle
#

I can't use QuicShop because server crashes.

#

Why so?

slate surge
#

changes the server brand but doesn't change it to what I need

slate surge
#

omg

#

i am in the wrong dc

#

smh

tepid turret
slate surge
tepid turret
tepid turret
#

or Bukkit.getLogger().warn()

molten needle
slate surge
#

reinstall the plugin

molten needle
#

Huh?

slate surge
#

QuickShop v5.1.2.5

molten needle
#

Don't understand...

slate surge
#

"The QuickShop jar has been modified"

molten needle
#

Different version?

slate surge
#

nono

#

just reinstall the plugin

molten needle
#

I did 4 times

#

Previously

slate surge
#

umm

#

did u get any plugin on your server from a user over discord or unauth site?

molten needle
#

Uhh no

#

Only from Aternos

slate surge
#

ahh

#

"Remapping plugin 'plugins/QuickShop-5.1.2.5.jar'"

molten needle
#

That plugin is premioum?

slate surge
#

umm

molten needle
#

Or smth

slate surge
#

it is a quckshop thing

molten needle
#

Idkkk nothing

slate surge
#

they didn't update it for 1.21

molten needle
#

Oh...

slate surge
#

and spigot is doing it

#

and so the sign is changed

molten needle
#

Okay, so i need to wait for new version?

slate surge
#

ye

molten needle
#

They didn't say when it will come out?

slate surge
#

the last update was over a year ago

#

no wonder it doesn't work

molten needle
#

Ohh..

#

๐Ÿ˜ฆ

#

So I will delete it so my server don't crash

slate surge
#

ye

molten needle
#

Okay, Thank You!

slate surge
#

np

molten needle
#

โค๏ธ

smoky anchor
#

Tho in the log you sent first there were many different issues

slate surge
#

other people have it too

slate surge
molten needle
molten needle
eternal night
#

The plugin just isn't updated for paper

molten needle
#

Ok!

#

Thanks

eternal night
#

The warrior guy seems competent enough

molten needle
#

Oh ok

#

How do I install it?

#

Idk, sorry:(

eternal night
#

oh, you are on aternos right?

#

yea then I guess you can't

molten needle
#

Yes:>

#

Oh.

#

๐Ÿ˜ฆ

eternal night
#

You'd have to compile it yourself, but aternos does not allow you to just run custom stuff does it?

molten needle
#

Uhh I guess not...

slate surge
#

nope it doesnt

molten needle
#

Oh well... ๐Ÿ˜ฆ

#

I will wait then

#

And Do You guys have any idea, why does networkErrorprotocol show up when mob deals damage, and everybody gets kicked who doesnt have premium acc?

#

Thats because Cracked isn't supported by Mojang?

#

Or different cause?

slate surge
#

does your server have via plugins?

#

viaversion etc

molten needle
#

Yes, ViaVersion

slate surge
#

umm

#

update it

#

and

#

add

#

viabackwards forward etc

molten needle
#

Idk how it really workd,

slate surge
#

umm

molten needle
#

Oh, so you need all 3 of them?

slate surge
molten needle
#

I thought im free to go with 1...

#

Okay, I will try.

slate surge
#

no u r not

molten needle
#

Thanks.

slate surge
#

alr

molten needle
#

Wait, so Via Version, Via Rewind, and.. .. ?

slate surge
#

via backwards

#

um

#

no wait

molten needle
#

Via Backwards?

slate surge
#

um m

#

wait wait

molten needle
#

Ok..

slate surge
#

ye

molten needle
#

:>

slate surge
#

viabackwards

molten needle
#

Okay!

#

๐Ÿ˜„

slate surge
#

revind

#

and version

molten needle
#

Great! And it will fix the problem?

#

Yes, i have all 3 now

#

Btw, Aternos staff said that its because Cracked isn't supported by Mojang and i m using Cracked, my friends are not using Cracked and they dont get kicked but i do

#

Because of some plugins that are encountering with Cracked

#

Smth like that

#

ChatGPT said that it could be via version

#

Understand?

smoky anchor
#

Solution: buy the game

molten needle
#

30โ‚ฌ no ty:(

#

But other servers with plugins i dont get kicked

smoky anchor
#

It's 30โ‚ฌ for possibly lifetime of entertainment
I'd say that's cheap

molten needle
#

So i think it could be the Via

molten needle
slate surge
#

i had open 6 tickets in 1 month

#

:>

smoky anchor
#

I am sadly aware of this horrible situation where they do not give a single piece of shit even if you have all the evidence that you own the account.

slate surge
#

ye

#

same

#

they said I will get it back in 3 days

#

over a month now

smoky anchor
#

I have this resource that might possible help, not sure tho, thankfully I never had to use it

grim hound
#

when is the kick happening?

smoky anchor
grim hound
#

then what version?

slate surge
#

1.21

grim hound
#

like I sent experience packets a little bit too early during play phase

#

and the player also crashed with that message

#

try without any plugins

#

or join on the very same version as the server

molten needle
#

I'm playing 1.21 as the server,

molten needle
hushed spindle
#

is there any event fired when a crafter block crafts something

#

or can it be derived from a CraftItemEvent

slender elbow
#

no

gilded granite
#

Why is orange not a ChatColor ?

river oracle
#

You can use any hex color now

#

Not sure why you couldn't do that

#

Stop using the archaic legacy chat

gilded granite
#

what is the new then?

#

Color.ORANGE ?

iron cave
#

hex colors

gilded granite
#

how do I use them

river oracle
#

Use components or the hex format

gilded granite
#

can you give me an example of it in a string?

river oracle
#

I don't have the section character since I'm US so I'll give you the ampersand instead
&x&a&b&c&d&e&f

#

Or just use components kekw
new ComponentBuilder()

#

And send with CommandSender#spigot()

slender elbow
#

mfw orange

#

we have โœจ gold โœจ

blazing ocean
river oracle
blazing ocean
#

but legacy chat doesn't even allow you to use fonts

river oracle
blazing ocean
#

mm my beloved

river oracle
#

Well I have my own equivalent

#

But yeah

slender elbow
#

๐Ÿคฎ

#

plain strings ftw

blazing ocean
river oracle
river oracle
blazing ocean
# river oracle Honestly component builders are crazy verbose it's unrealistic
    private fun getContent(player: Player) = buildText {
        appendNegSpace(-4)
        append(RACE_BACKGROUND)
        appendNegSpace(-41)
        append(buildText {
            val currentLap = instance.gameData.laps[player.uniqueId] ?: 1
            append("LAP ")
            append(currentLap.toString())
            append("/")
            append(AceRaceInstance.MAX_LAP.toString())
            when (currentLap) {
                !in 1 .. 3 -> color("#58A7E6")
                1 -> color("#2B79E6")
                2 -> color("#5296F5")
                else -> color("#6FABFE")
            }
        })
        appendNegSpace(30)
        append(RACE_BACKGROUND)
        appendNegSpace(-40)
        append(buildText {
            appendNegSpace(-3)
            append(instance.getTime(player))
            gold()
        })
        font(Fonts.RACE_TIMER)
    }
``` whatever this is ftw
pseudo hazel
#

private fun why are you keeping all the fun to yourself

blazing ocean
#

should i rather do open fun?

#

or actual fun

tepid turret
#
@EventHandler
    private void onInventoryChanged(InventoryMoveItemEvent event){
        Bukkit.getLogger().info("real");
        if (!(event.getSource().getHolder() instanceof Player)) {
            Bukkit.getLogger().info("realest shiz ever bro!");
            return;
        }
        if (event.getItem().getItemMeta().getPersistentDataContainer().has(keys.getRegistered()) || event.getItem().getItemMeta().getPersistentDataContainer().has(keys.getPreviousEnchantLevel())) {
            Bukkit.getLogger().info("wat");
            if (event.getSource() != event.getDestination()) {
                Bukkit.getLogger().info("Shoulda cancelles!");
                event.setCancelled(true);
            }
        }
    }
#

when moving an item from the palyers inventory to chest

#

nothing happens

#

BUT

#
    @EventHandler
    private void onLeftBoat(VehicleExitEvent event) {
        Bukkit.getLogger().info("wat");
        if (!(event.getExited() instanceof Player)) {
            return;
        }
        if (!(event.getVehicle() instanceof Boat || event.getVehicle() instanceof ChestBoat)) {
            return;
        }
        Entity boat = event.getVehicle();
        Player player = (Player) event.getExited();
        if (!boat.getPersistentDataContainer().has(keys.getBoatUpgrades())) {
            return;
        }
        enchantRemover(boat, player.getInventory().getItemInMainHand());
    }

this in the same class outputs "wat" like expected

pseudo hazel
#

actual fun sounds good

#

what does appendnegspace do

blazing ocean
#

appends a negative space

pseudo hazel
#

and does -40 mean it append 40 negative space or minus negative = positive space

blazing ocean
#

-40

pseudo hazel
#

so why is it called negative space and not just space

slender elbow
#

suspend fun

blazing ocean
#

why not

young knoll
#

smh

pseudo hazel
#

because its backwards

young knoll
#

fix it

blazing ocean
#
    fun TextBuilder.appendNegSpace(space: Int) {
        append(buildText {
            append(negativeSpaces.getChar(space).toString())
            font(negativeSpaces.fontKey.toString())
        })
    }
young knoll
#

negative space is great

#

Mojang should add it as a built in font fr

blazing ocean
#

eh

pseudo hazel
#

fr fr

blazing ocean
#

it's so simple

#

not really any need to ngl

pseudo hazel
#

its pretty easy to borrow some elses font though

blazing ocean
#

this is so simple like lmfao, no need for them to imp

class NegativeSpaces(
    val fontKey: Key = Key("minecraft", "default"),
    val range: IntRange = -8192 .. 8192
) : PackedPlugin {
    val advances = buildMap {
        range.forEachIndexed { i, it ->
            put((START_UNICODE + i).toChar(), it.toDouble())
        }
    }.toMutableMap()

    override fun beforeSave(pack: ResourcePack) {
        pack.addFont {
            key = fontKey

            space {
                advances = this@NegativeSpaces.advances
            }
        }
    }

    fun getChar(space: Int) = advances.filterValues { it == space.toDouble() }.keys.first()

    companion object {
        var START_UNICODE = 0xCE000
    }
}
young knoll
#

But then you don't have to use a resource pack!

blazing ocean
tardy delta
#

thats sure one way to make code that looks like a dead animal

blazing ocean
#

yea it works tho

river oracle
#

Not to mention legacy chat is stupid anyways

blazing ocean
#

^

#

components >>>>

obtuse hedge
#

components suck ๐Ÿ‘Ž

quaint mantle
drowsy helm
#

Use adventure and youโ€™ll say otherwise

#

Or try and do anything more complex then colouring text and youll see

eternal oxide
#

If you just want text then yes Components are overkill. If you want interactions/popups then components are essential

obtuse hedge
#

I don't want to build a component every time I want to send a colored message or use a colored text

lost matrix
drowsy helm
#

Try a clickable text with an alternate font

blazing ocean
blazing ocean
#

well this is a hud overlay

obtuse hedge
#

also

#

one line becomes 100

drowsy helm
#

Yeah itโ€™s overkill for regular text

obtuse hedge
#

one line ^ 2

lost matrix
blazing ocean
#

just means that you had one line that was 500 chars long

lost matrix
#

And build a regularized message system

obtuse hedge
#

what does that even mean

lost matrix
#
Msg.sendInfo(player, "You have bought {}x {} for {} {}!", amount, itemName, price, Eco.currencyName());
blazing ocean
#

rust format!() โค๏ธ

obtuse hedge
drowsy helm
#

String interpolation when

obtuse hedge
#

&c&lYou are &6not &apermitted &bto &4&ldo this

blazing ocean
obtuse hedge
#

what if I want fruity text, diff color for each letter

blazing ocean
drowsy helm
#

Surely lombok could add it

blazing ocean
lost matrix
# obtuse hedge ? and how does that affect color

It depends on an interface

public interface MessageFormat {

  String format(String message);

  <T> String formatObject(T object);

}

Example implementation for infos:

public class InfoFormat implements MessageFormat {

  public static final String PREFIX = "<bold><green>\uD83D\uDEC8 <gray>ยป</bold>";
  public static final String OBJECT_COLOR = "<#fff16f>";
  public static final String BASE_COLOR = "<#e0e0e0>";

  @Override
  public String format(String message) {
    return PREFIX + " " + BASE_COLOR + message;
  }

  @Override
  public <T> String formatObject(T object) {
    return OBJECT_COLOR + object.toString() + BASE_COLOR;
  }
}
obtuse hedge
#

html vibes

#

also

blazing ocean
#

there's a reason it's called legacy

lost matrix
obtuse hedge
#

that is not it

#

there is no single InfoFormat

#

each message has its own colors

#

i would have 1000 classes if I did that

blazing ocean
#

well yeah

river oracle
#

I wish spigot would remove legacy I yearn for the complaining that people have when they have to use an actual sophisticated and far superior coloring text system

obtuse hedge
#

something like this could work

sendMessage(ORANGE + "Well " + RED + "you " + GREEN + "tried.")

#

still messy

blazing ocean
#

mfw linear components

lost matrix
# obtuse hedge that is just not

That sounds like an absolute mess. UX design tells you to create a standardized coloring system and not color
everything on the go to your liking.

Define one format, and use it throughout your project.
If you need to change colors, change the format.

blazing ocean
#

they're literally that

eternal night
river oracle
obtuse hedge
slender elbow
#

wtf even is &a

#

red is red, i know that much

#

a is... a?

blazing ocean
drowsy helm
river oracle
blazing ocean
slender elbow
#

i think a is light blue or smth idk

lost matrix
#

The tags are resolved by MiniMessage in the end:

sender.sendMessage(MiniMessage.miniMessage().deserialize(formatted));

"formatted" could be

String formatted = "<red>Error";
or
String formatted = "<bold><#fff16f>Info";
river oracle
obtuse hedge
river oracle
#

There we go md we can remove legacy text now

obtuse hedge
river oracle
#

Someone will make a library

eternal night
river oracle
#

Faster typing >>>>> far superior and more powerful text system with sensible naming

lost matrix
obtuse hedge
blazing ocean
#

spigot moment

eternal night
#

honestly

obtuse hedge
#

unless someone adds a plugin to mixin/re-add the sendMessage(String) method

eternal night
#

the commodore could would not be that hard

river oracle
#

Commodore khajiit

slender elbow
#

i'm just waiting until mojang removes section formatting rendering from the client altogether tbh

eternal night
river oracle
slender elbow
#

i mean

eternal night
#

I mean, at this point it is completely useless

#

and already breaks things if included in components

slender elbow
#

the only place where they were semi-useful was scoreboard

#

but now you have score display names

#

plus they have confirmed it will be removed

river oracle
#

Speaking of components choco :3

river oracle
eternal night
#

chocoooo

river oracle
#

That's nice

slender elbow
#

a couple of years ago yeah

obtuse hedge
#

years ago lol

blazing ocean
#

just use paper runs

obtuse hedge
#

purpur

river oracle
#

Lowk forgot I was at work

#

I'm supposed to be working rn

slender elbow
#

same

blazing ocean
#

lmao

river oracle
#

Discord on the clock

river oracle
#

I really don't want to sand this trim

#

It's so mind numbingly boring

obtuse hedge
#

(ยง.)([^ยง]*)

obtuse hedge
obtuse hedge
#

now you can map it

#

and make a component from it

blazing ocean
#

oh does js add whitespace

obtuse hedge
#

i think

#

was just a quick way to test it

#

theres prob no whitespace in java or python

blazing ocean
#

yea

obtuse hedge
hard socket
#

should I update a scoreboard through calling the method each time I need the scoreboard to change or sould I use a single runnable that handles it for each team

lilac dagger
#

which method?

obtuse hedge
#

How can I get a decent time like "1 hour 12 minutes" string from seconds?

#

is there some Date api I can use?

hard socket
lilac dagger
#
@NotNull
    public static String secondsTo24HClock(int seconds) {
        int hours = seconds / 3600;
        int minutes = (seconds % 3600) / 60;
        seconds %= 60;

        char[] buffer = new char[] { '0', '0', ':', '0', '0', ':', '0', '0' };

        fillBuffer(buffer, 3, minutes);
        fillBuffer(buffer, 6, seconds);

        if (hours > 0) {
            fillBuffer(buffer, 0, hours % 24);
            return new String(buffer, 0, 8);
        }
        return new String(buffer, 3, 5);
    }```
lilac dagger
#

you can of course edit it to display it in your own style

lilac dagger
hard socket
obtuse hedge
#

that doesnt look like what I want

#

i want a human representation of

#

"1 hour 45 minutes and 15 seconds"

#

I changed it to this with help of GPT

#
public static String getHumanReadableTime(int seconds) {
    int hours = seconds / 3600;
    int minutes = (seconds % 3600) / 60;
    seconds %= 60;
    
    StringBuilder result = new StringBuilder();
    
    if (hours > 0) {
        result.append(hours).append(" hour" + (hours > 1 ? "s" : ""));
    }
    
    if (minutes > 0) {
        if (hours > 0) result.append(" and ");
        result.append(minutes).append(" minute" + (minutes > 1 ? "s" : ""));
    }
    
    if (seconds > 0 || result.length() == 0) {
        if (hours > 0 || minutes > 0) result.append(" and ");
        result.append(seconds).append(" second"  + (seconds > 1 ? "s" : ""));
    }
    
    return result.toString().trim();
}
lilac dagger
obtuse hedge
#

yea i could of

tardy delta
#

bruh just use a datetime formatter

ivory sleet
obtuse hedge
#

no one told me it existed

#

how do I use it with seconds

ivory sleet
#

I mean java has packages just for time related stuff, so in the future itโ€™s a good place to start looking for things

#

Instant.ofSeconds() iirc

low marlin
#

I need help with pathfinding, I want to have a wither skeleton mob where there will be 4 skeletons following him and whenever they see a player they all start attacking him
I tried

this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[] {magmaMinions.class, magmaCaptain.class})).setAlertOthers(new Class[0]));
        this.targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, Chicken.class, true));
        
        this.goalSelector.addGoal(3, new FollowMobGoal(this, 1, 3f, 10f));

But they just follow the leader until the leader dies and then they attack me

obtuse hedge
#

epoch second hmm

ivory sleet
#

well there should be a static factory method to construct an instant from the unit seconds

obtuse hedge
#

is epoch any diff to normal

ivory sleet
#

yea, it is

obtuse hedge
#

oh

#

there is no just ofSeconds

ivory sleet
#

ugh wait Im confusing it with Duration.ofSeconds woops

obtuse hedge
#

and im guessing toString will give me what i want

ivory sleet
#

wait you just wanna format a duration right? Not a timestamp/full date right?

obtuse hedge
#

ye

#

"h hours m minutes and s seconds" if it has seconds or minutes or whatever

ivory sleet
#

In that case you could use a duration, and call toSecondsPart(), toMinutesPart(), toHoursPart(), toDays() and format it with String::format

#

the part methods gives u the canonical remainder of given unit

#

toHours() gives 25 whereas toHoursPart() would give 1 since 25=1(mod 24)

silent ridge
#

Someone to help me to configure some plugins of my dayz server?

obtuse hedge
#
public static String getHumanReadableTime(int seconds) {
    Duration duration = Duration.ofSeconds(seconds);
    int hoursPart = duration.toHoursPart();
    int minutesPart = duration.toHoursPart();
    int secondsPart = duration.toHoursPart();
    
    StringBuilder builder = new StringBuilder();
    
    if (hoursPart > 0) {
        builder.append(hoursPart + " hour" + (hoursPart > 1 ? "s" : ""));
    }
    
    if (minutesPart > 0) {
        if (hoursPart > 0) builder.append(" ");
        builder.append(minutesPart + " minute" + (minutesPart > 1 ? "s" : ""));
    }
    
    if (secondsPart > 0) {
        if (hoursPart > 0 || minutesPart > 0) builder.append(" and ");
        builder.append(secondsPart + " second" + (secondsPart > 1 ? "s" : ""));
    }
    
    return builder.toString();
}```
#

so back to the same code

#

lmao

tardy delta
#

so is it working?

obtuse hedge
#

idk yet

#

waiting for server to start

#

it didnt work

#

it resulted in 1 hour 1 minute and 1 second

#

when I was supposed to get

#

1 hour 20 minutes and 24 seconds

tardy delta
#

why dont you fix it then

obtuse hedge
#

wait

#

i see my bug

pseudo hazel
#

yeah it probably doesnt help taht you are using toHoursPart thrice in a row

obtuse hedge
#

lol

#

it works

mellow edge
#

does anyone know how to hide spectator bar that shows up if you type numbers in spectator mode? it is possible to cancel it, because it doesn't work on hypixel

agile anvil
obtuse hedge
#

ye

mellow edge
#

it is but when you click on the person it switches you to first person spectating

obtuse hedge
#

they all custom code that

#

it isnt using the vanilla functionality

mellow edge
#

honestly would you mind if you would see that but disabled

gilded granite
#

how can I add a delay between line execution?

chrome beacon
#

?scheduling

undone axleBOT
gilded granite
#

ty

mellow edge
#

I have custom code for specetator that is actually survival, like they, but when you actually enter the player's body they if it wasn't spectator then they would need to hide their hunger bar, hearts, and your items in your hotbar

mellow edge
astral pilot
#

why is EntityType.getName() deprecated

chrome beacon
#

Read the deprecation note

astral pilot
chrome beacon
#

Yeah it's a magic value. If you're trying to display it you're better off using a translatable component

ocean hollow
#

if an item does not have customModelData, does that mean it is equal to 0?

chrome beacon
#

No

sterile flicker
#
package com.sumeru.mobwars.entities

import com.sumeru.mobwars.MobWars
import com.sumeru.mobwars.ai.DefaultPathfinderGoal
import net.minecraft.server.v1_16_R3.EntityTypes
import net.minecraft.server.v1_16_R3.EntityZombie
import net.minecraft.server.v1_16_R3.EntityZombieHusk
import org.bukkit.Location
import org.bukkit.NamespacedKey
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer
import org.bukkit.entity.Player
import org.bukkit.persistence.PersistentDataType

class Husk(loc: Location, player: Player) : EntityZombieHusk (
    EntityTypes.HUSK,
    (loc.world as CraftWorld?)!!.handle
) {
    var player: Player

    init {
        this.setPosition(loc.x, loc.y, loc.z)
        this.isBaby = false
        this.player = player
        this.goalTarget = (player as CraftPlayer).handle
        this.bukkitEntity.persistentDataContainer.set(NamespacedKey(MobWars.instance, "custom"), PersistentDataType.BYTE, 1.toByte())
    }

    public override fun initPathfinder() {
        goalSelector.a(0, DefaultPathfinderGoal(this, 1.0, player.location.distance(bukkitEntity.location).toFloat()))
    }
}                           val husk = Husk(positions.blueMobSpawn, p)
                            val worldServer = (map as CraftWorld).handle
                            worldServer.addEntity(husk)
``` pls help, why my entity may not spawn, I checked and made sure that even entityspawnevent is not called at all?
lilac dagger
#

add SpawnReason.CUSTOM to add entity

tardy delta
#

ahh some more cursed kotlin

#

i understand 7smile7 now

kindred sentinel
#

how to turn off server coordinates for players? From F3

blazing ocean
kindred sentinel
pseudo hazel
#

you cant even

kindred sentinel
#

/gamerule reducedDebugInfo true

vast ledge
#

???

pseudo hazel
#

thats new then I guess

kindred sentinel
#

it removes coordinates

blazing ocean
#

that is

#

no

#

tf

kindred sentinel
pseudo hazel
#

wtf

#

try it out

kindred sentinel
#

It works

#

I did