#help-development
1 messages ยท Page 1059 of 1
yes
EntityShootBowEvent#getProjectile
That should be the entity/projectile that is fired
I mean if I know correctly motion should really be the velocity
and before you say use velocity, bukkit limits the velocity
How did you do it?
i used an nbt library
Oh easy enough kek
ok so nothing happened
im sure theres probably something wrong with my code but i cant see what
ill send it
nms?
@EventHandler
public static void onShoot(EntityShootBowEvent event) {
Player player = (Player) event.getEntity();
if (event.getConsumable() == ItemManager.rArrow) {
player.setPassenger(event.getProjectile());
}
}
}```
Is event.getConsumable the arrow entity? Or is event.getProjectile
kekw
getconsumable i though was the item
you need to implement the spigot Listener not the Websocket one
That too
This was a genuine question tho
^
Ok yes you are correct it is the item
This is your fix tho
Yeah you need to do that too
also from your code i can tell you're using one class for multiple events that aren't related to each other, you should have a listeners package or something
so if you have an exception you know exactly where it is
and to avoid really long classes
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
Verify that a human entity shot the bow
but i have a special arrow which is what it's checking for
Iirc you still have to verify that it's a player or human entity or wtv before casting the player object
how do i make a specific player not load chunks
lol vengeance
and it doesnt tell me who loaded it
PacketType.Play.Server.UNLOAD_CHUNK
send unload chunk packets to the player
i dont want the chunk to be loaded in the first place
i'm doing a tutorial for players, which involves them teleporting (smoothly) across the world, which loads alot of chunks and lags the server
You could define a region around the location the player teleported to and unload those maybe?
so something like
[insert previous code here]
}```?
i just got another idea, ima just add a ticket to all the chunks that the player would go through
render distance = 0
๐ฟ
I'd do inverse, guard clauses:
if(!(event.getEntity instanceof Player)) {
return;
}
[insert previous code here]
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
try to do .isSimilar(yourArrow) or wtv the correct way to do that is
unrelated, is there any faster way to reload plugins aside from rebuilding the jar, then restarting the server
ok i did that and it works perfectly now
thanks so much
yeah no worries I shoulda known the comparison was wrong haha
i also had to change == to instanceof
nevermind
misremembering
one small issue, the arrow isn't showing up in the creative menu
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
yeah it has a command
Did you do anything to add it to the creative menu?
This maybe?
Sounds like reflection and unfreezing of registry to me
You could do like a drop chance on skeletons
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
it exists as an item when you spawn it in via command (currently)
Do you have a command written?
i have a custom command /givearrow
right so that's what you use
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
final answer then lol
ok
Idk if this is the way but I assume so?
hey is anyone familiar with towny?
ill look into it
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
declaration: package: org.bukkit.event.player, class: PlayerCommandSendEvent
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
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
ohh is that was the args[] is for
Makes handling different things in the same command easier for sure
how do i get all the intersceting chunks of a bounding box
Also keep in mind that you should verify the length of the args[] to ensure correct usage of the command
so keep it below 1
If you only want there to be one possible argument
yes
i just want /givearrow (player)
If that's what you want then yes
Bukkit.getServer.broadcastMessage() or something
ok thanks so much
no worries!
the creative menu is clientside
wack
Ah ok then you need to delve into nms I think if you wanted to do that
is args [0] the initial command or the first argument
first arg
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; } }
cmd.getName().equalsIgnoreCase("getarrow") isn' tneeded
and did u register the command in plugin.yml and your main class
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.```
it's givearrow not getarrow
wait so how is this not needed
how else would it know which command im excecuting
getCommand("givearrow").setExecutor(new FirstCommands());
onCommand is only triggered when that specific command is sent
not any command
oh cool
Can i storage player data in .yml files? And how if yes
Yes
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);
}
Thanks bro
It will looks like
players:
NICK1
current_hp:
20
Nick2
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")
}
Is a bungeecord server started with ROOT permissions?
IT this the same as this ?
players:
Hxncus:
current_hp: 20
max_hp: 20
Lokha:
current_hp: 1
max_hp: 100
Unless you start it as sudo or admin, no
Same with any other application
That's i looking for thanks bro
This code get your data from file
Mm I see
This code store data to config
np
is there a way to check which method was added in what version in spigotmc docs?
No not as of now
I think someone was gonna pr a annotation for it but not yet
yeah that's probably a good idea
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
I wanted to but was told it'd probably get rejected
Go through the commit history or something
true
But you could create an automated program to scan through all commits and check when what was added
Yeah, this is what I was hoping for tbh
Too much of a pain to do manually and big chance to mess up
if you wanted granular you can do it this way
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
true
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
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)
Would date really matter?
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
How u can add lore to it? Like i know how to make a lore list but to display it in yml file is yea.. i am creating Items and Item have lore you know. Sr for my english
How do i make it be only the cloring rank and not the name ?
as geol said, so in otherwords no it isn't really crucial since most are just looking for which major version or minor version it appeared
just set the prefix and not the color of the team
Add a reset color code at the end
I understand
oh yeah that could work &r at the end after player
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
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);
You can store whole item in config
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.
Yeah you have to create it if you dont have a block to reference
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?
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
hello i need help with worldguard and combatlogx
i want to make a are you cant enter if you are tagged
ask in #help-server or the SirBlobman discord
ok thanks
ok thank you I'll look into it
Like how can you show me because i quite dong understand how it will work
Just use specific methods YamlConfiguration#set(String path, Object obj)
And YamlConfiguration#getItemStack(String path)
has it always used affine?
Yes
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.
The code is no longer obfuscated
Whos being offended
mojang has decided to stop obfuscating you mean?
mojang obfuscates their code but ships mappings to deobfuscate it
I think it's because of proguard minimization, to save space, but Idrk
ah okay
Do you know what they changed in models between 1.8 and 1.9
1.9 is ancient
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
is there a way to access the values of mob exp drops through reflection/nms?
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
isn't there a range for a specific mob?
No it's not a range :p
wait what I thought https://minecraft.fandom.com/wiki/Experience says it is
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
Are you still part of that team that has comms with mojang devs?
Those are just experience orbs which have a maximum value of a short, but when dropping from an entity it's not a range. It's just some value that gets modified based on the circumstances of the entity's death
Are there opportunities to ask for feature requests or is it more just technical stuff
Thanks bro
oh yeah, i didn't
but i can do it now i guess, you just have to send the right packets
99% of people there were like
restarted
yeah I'm still wondering
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?
you could make a server actually
it'd need to be a spigot server
cuz via doesn't support other engines
and I need a limbo server
fake limbo server
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
minestom
search it up, i think it's what you're looking for
someone showed it to me some time ago
I'm thinking of starting it from within the plugin itself
BUT
2 things
- The scratch version which I like better doesn't have a single fucking working build
- It only supports 1 minecraft version
look up how via version supports multiple
hmm
since it's open source you could impl the basic in minestom
so you're saying I should use the ViaLoader?
I mean really it's lots of packet fakery that could 100% be done with minestom
yeah I know
Just lie to the client ๐ฏ
I mean most plugins do that already
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
Hello ! is it possible to send a ressource pack proxy side using bungeecord ?
okok ty
but pretty sure there is a function that calculates it
anyways what is the most efficient way to get head of all mobs
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)
?nms
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
guys how do i use the permission attribute for commands in the yaml file
i want a command to be op only
thats interact event
I think its like default: op or smth
default isnt a command attribute though i dont think
can someone help me
https://prnt.sc/2SINpzpYn2_W
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
It is mostly obfuscated, fields and methods are, but classes aren't
Yep
Yes is that find
Someone can do a dayz texturepack? With 3d guns for my dayz server
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
guys how do i use selectors in my command ๐ฅบ
but can i use that for @p?
yes
if you read what the docs say
you should be able to use @p for the selector string
the only issue im seeing is i can't access the returned entities' inventories
How so
If they have inventories, you can access them
like the entity class doesn't have the getInventory() method
Because not all Entities have inventories
yes
I think they need to be upcasted to atleast living entity
but if its gonna be players, might as well use that
If you specifically want their inventories, simply check if they are an instance of InventoryHolder
even if i check that how would i actually turn them into something i can edit the inventory of?
Or if you just want players, check if they are an instance of Player
By... casting them
this is a basic java issue I guess
well casting is a pretty basic concept you should know about before trying all kinds of tricks with plugins xD
List<Entity> entities = ...;
for(Entity entity : entities) {
if(!(entity instanceof Player)) {
continue;
}
Player player = (Player) entity;
}
*Always check before casting
thanks
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
Lets let him discorver instanceof pattern matching. Its an implicit cast which can be confusing for ppl.
thanks guys ๐
java 17 i think
or 11
yeah
im using java 22
you should be on java 21 by now
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
commands:
givearrow:
permission: *
aliases:
- givearw
what does permission: * do?
what should i put instead?
just some permission required for your command to work
but i can't just put permission: op right?
im not sure what you mean
how can I reset them to appear at all 0?
i figured it out
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
Are you using the API method to set the title?
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
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
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();
}
Ope ofc smile has the code :3
ah sorry I forgot to tell you i am not on nms
I am using packetevents to send packets
Then just translate this to packetevents ๐
I know that you can do this with Plib
The method above simply constructs a packet and sends it to the player
oh wait you are just using the player to get the id
All you need is the menu type, title, and current window ID
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
Hey you're pink again
yo
i swear there was a way to make Text Displays only visible to one player without using packets?
Does the API method still work?
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
Weird considering that's all that , that method does is send the open packet
hmm
Are you sure you have the ID correct?
You might wanna temporarily add nms and double check
rn im printing the id when I catch it and it doesnt change
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
Are you updating the inventory
After you change the title with the api updateInv method
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
Weird
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 ๐
?
Sounds like #help-server question
how do you get the minecraft font
like for bossbar
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
what do you mean by minecraft font exactly?
well there is a few factors, what the server has set for view range and entity range and client view range. Then there is just some render limits depending what it is and may require a mod to view things further away
the green is the one I want and the wither is the default thing
wait what, how is that default, are you using a resource pack?
the green text is a subset of the default minecraft font, like you can get here https://small-caps-font-generator.pages.dev/
and then you paste it into some string or into chat
but idk why your font is looking all smooth
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?
read the docs of replace
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
yea its working now thanks
hey i just watched that yesterday
1/3
shes called potato girl cus her brain is also similar to that of a potato
I only posted it as a joke to the one named full potatoe
lol
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?
Yeah good luck through season 4
this rules are redudant?
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?
normalize().multiply(scale)
oh so i can just normalize and then multiply by t?
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
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
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
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
i cloned it first
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);
}
}```
use PlayerInteractAtEntityEvent
interact events cover left & right click
Depends on how you want to fill it. If you want to fill it as lines, you will need to know both coordinates, for which the second point (the point on the other side of the circle) is simply the subtraction of 180 in the context of your code
where am i subtracting 180
this might be a dumb question but this will global all the permissions that are like " example.use.2 , example.use.3 " etc?
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
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?
ok, ty
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? ๐
Dude why are my TextDisplays only visible from one side
i just want them to work like an invisible armor stand
How to make plugin use "&" color codes instead of ยง in config file
Well im pretty sure it would be possible cuz servers such as hypixel have it dont they?
Use the ChatColor#translateAlternateColorCodes method on the strings of your config.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/ChatColor.html#translateAlternateColorCodes(char,java.lang.String)
declaration: package: org.bukkit, enum: ChatColor
hypixel wings rotate with the head. I checked, as I have some on there
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?
No clue hahaha sorry
thanks anyways ๐
No problem!
Change entity type while keeping its data?
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
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
Hey! How to send a custom minecraft:brand?
what?
you mean send your own minecraft:
like yourpluginname:
mhm
client
You have to fork spigot and change it
umm
There might be a packet for it
Hello
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();
}```
changes the server brand but doesn't change it to what I need
prob ask on their github
omg
i am in the wrong dc
smh
Avoid using System.out.println() try using Bukkit#getLogger#info
that was for a debug I wont use that in production after all
still for debuging I suggest using Bukkit.getLogger().info()
or Bukkit.getLogger().warn()
https://mclo.gs/CYoM2Sd help?
your quickshop is not original
reinstall the plugin
Huh?
QuickShop v5.1.2.5
Don't understand...
"The QuickShop jar has been modified"
Different version?
That plugin is premioum?
umm
Or smth
it is a quckshop thing
Idkkk nothing
they didn't update it for 1.21
Oh...
Okay, so i need to wait for new version?
ye
They didn't say when it will come out?
ye
Okay, Thank You!
np
โค๏ธ
Tho in the log you sent first there were many different issues
other people have it too
ยฏ_(ใ)_/ยฏ
Yes, that was long tjme ago log, sent incorrect one, because it was copied
Ohh ok
The plugin just isn't updated for paper
The warrior guy seems competent enough
You'd have to compile it yourself, but aternos does not allow you to just run custom stuff does it?
Uhh I guess not...
nope it doesnt
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?
Yes, ViaVersion
Idk how it really workd,
umm
Oh, so you need all 3 of them?
ye
no u r not
Thanks.
alr
Wait, so Via Version, Via Rewind, and.. .. ?
Via Backwards?
Ok..
ye
:>
viabackwards
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?
Solution: buy the game
It's 30โฌ for possibly lifetime of entertainment
I'd say that's cheap
So i think it could be the Via
Parents wouldnt let me
my account got scammed and now microsoft doesn't seem to care
i had open 6 tickets in 1 month
:>
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.
I have this resource that might possible help, not sure tho, thankfully I never had to use it
set online mode to false
when is the kick happening?
They have that
here
then what version?
1.21
it can be various things
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
I'm playing 1.21 as the server,
How?
is there any event fired when a crafter block crafts something
or can it be derived from a CraftItemEvent
no
Why is orange not a ChatColor ?
You can use any hex color now
Not sure why you couldn't do that
Stop using the archaic legacy chat
hex colors
how do I use them
Use components or the hex format
can you give me an example of it in a string?
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()
this is what the legacy chat colour people want us to believe is the future
reject chat colours, embrace components
Components are too verbose this is why we extension function a string :3
well yeah ig, i sometimes ext-fun strings for making components
but legacy chat doesn't even allow you to use fonts
MiniMessage ๐ช
mm my beloved
๐
It's not equivalent 100% but it's close enough
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
private fun why are you keeping all the fun to yourself
@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
appends a negative space
and does -40 mean it append 40 negative space or minus negative = positive space
-40
so why is it called negative space and not just space
suspend fun
because uhhhh
why not
smh
because its backwards
fix it
fun TextBuilder.appendNegSpace(space: Int) {
append(buildText {
append(negativeSpaces.getChar(space).toString())
font(negativeSpaces.fontKey.toString())
})
}
eh
fr fr
its pretty easy to borrow some elses font though
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
}
}
But then you don't have to use a resource pack!
most servers nowadays use one anyway
thats sure one way to make code that looks like a dead animal
yea it works tho
tf
just use &6
doofus
That's gold not orange
Not to mention legacy chat is stupid anyways
components suck ๐
love components
False
Use adventure and youโll say otherwise
Or try and do anything more complex then colouring text and youll see
If you just want text then yes Components are overkill. If you want interactions/popups then components are essential
I don't want to build a component every time I want to send a colored message or use a colored text
i use them so much
I still remember when they deprecated strings and i ended up with 40 lines of code replacing 2 previous ones.
Try a clickable text with an alternate font
wait until the legacy chat people tell me to use the default font with some special unicodes for shit
.
well this is a hud overlay
Yeah itโs overkill for regular text
one line ^ 2
Use Minimessage
just means that you had one line that was 500 chars long
And build a regularized message system
what does that even mean
Msg.sendInfo(player, "You have bought {}x {} for {} {}!", amount, itemName, price, Eco.currencyName());
rust format!() โค๏ธ
? and how does that affect color
String interpolation when
&c&lYou are &6not &apermitted &bto &4&ldo this
kotlin users:
what if I want fruity text, diff color for each letter
this is so incredibly shit how can people call this good
Surely lombok could add it
minimessage <rainbow> moment
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;
}
}
there's a reason it's called legacy
Yeah, thats utter garbage compared to MiniMessage
that is just not
that is not it
there is no single InfoFormat
each message has its own colors
i would have 1000 classes if I did that
well yeah
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
something like this could work
sendMessage(ORANGE + "Well " + RED + "you " + GREEN + "tried.")
still messy
mfw linear components
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.
they're literally that
imagine if you could just sendMessage("<orange>Well <red>you <green>tried")
Damn but that's too long or something
typing &a is faster, also I prefer the legacy colors
linear(LIGHT_PURPLE, text("โ ษชัสแดษดแด
แดสแดแดแดษชแดแด"), GRAY, text(" - "), RED, text("แดสแดสแด"))
Itโs also an arbitrary code
wtf is this shit
I think A is green right?
linear components
i think a is light blue or smth idk
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";
I stg it's lime I think
someone will code up a quick lib or Regex pattern to re-add it
There we go md we can remove legacy text now
why dont they add & support also
Someone will make a library
"typing is faster"


Faster typing >>>>> far superior and more powerful text system with sensible naming
What would be the benefit to that? (Btw you can create your own tags in MiniMessage if you want to add support for that)
breaking all previous existing plugins
spigot moment
honestly
unless someone adds a plugin to mixin/re-add the sendMessage(String) method
the commodore could would not be that hard
i'm just waiting until mojang removes section formatting rendering from the client altogether tbh

I can't imagine they will unless it ever gets in there way of adding something
i mean
I mean, at this point it is completely useless
and already breaks things if included in components
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
Speaking of components choco :3
Oh really
chocoooo
That's nice
a couple of years ago yeah
years ago lol
just use paper runs
purpur
same
lmao
Discord on the clock
(ยง.)([^ยง]*)
how do you expect me to use color in minecraft resource packs >:(
wtf is that filter
oh does js add whitespace
i think
was just a quick way to test it
theres prob no whitespace in java or python
yea
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
which method?
How can I get a decent time like "1 hour 12 minutes" string from seconds?
is there some Date api I can use?
a method that edit the scoreboard and sends it to players
@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);
}```
try this ^
you can of course edit it to display it in your own style
just update the teams
ok
mk
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();
}
You could've done this without the help of chat gpt
yea i could of
bruh just use a datetime formatter
DateTimeFormatter is the java way
ok
no one told me it existed
how do I use it with seconds
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
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
epoch second hmm
well there should be a static factory method to construct an instant from the unit seconds
is epoch any diff to normal
yea, it is
ugh wait Im confusing it with Duration.ofSeconds woops
and im guessing toString will give me what i want
wait you just wanna format a duration right? Not a timestamp/full date right?
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)
Someone to help me to configure some plugins of my dayz server?
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
so is it working?
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
why dont you fix it then
yeah it probably doesnt help taht you are using toHoursPart thrice in a row
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
It's not possible. Isn't hypixel faking the spectator mode?
ye
it is but when you click on the person it switches you to first person spectating
honestly would you mind if you would see that but disabled
how can I add a delay between line execution?
?scheduling
ty
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
so I think this one is not faked
why is EntityType.getName() deprecated
Read the deprecation note
it just says "Magic value"
Yeah it's a magic value. If you're trying to display it you're better off using a translatable component
if an item does not have customModelData, does that mean it is equal to 0?
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?
add SpawnReason.CUSTOM to add entity
how to turn off server coordinates for players? From F3
(loc.world as CraftWorld?)!!
dies cutely
You don't
I found
you cant even
/gamerule reducedDebugInfo true
???
thats new then I guess
it removes coordinates
