#help-development
1 messages ยท Page 1724 of 1
i think so
for example, where the life and mana in hypixel skyblock is
yes
or are you talking about the "Grass Block" thing?
because that's something different
That's the action bar
k, ty
na i was just asking, i want to do a thing there in the future
kk
finally i finished the crafting thing
should work identically to a ctable
after 7 nested for loops
get topinventoryview slots
and check if the clicked slot is higher or equal of top lowest inventory view slot
at least that's how i did this
that way the GUI inventory is cancelled while players inventory isnt
but it requires more work than that
Code:
List<String> lorePieces = Arrays.asList(lore.split(" "));
List<String> lines = new ArrayList<>();
String currentLine = "";
int resultLength = 0;
for(String lorePiece : lorePieces)
{
resultLength += lorePiece.length()+1;
currentLine += lorePiece + " ";
if(resultLength >= 20)
{
lines.add(currentLine);
resultLength = 0;
currentLine = "";
}
}```
How it looks like.
But in the next line, there should stay ,der .
[Werde, zu, einem, starken, Krieger,, der]
Because of that list. Why does it not work?
Please ping if anyone has an answer
Yeah.
compare slot to rawSlot. If they are different it tells you which inventory was clicked
How can i do to spawn a entity with delay?
I have this:
Bukkit.getScheduler().runTaskLater(Holograms.getInstance(), player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND, ));
But in the last , it says randomizeData instead of "Delay"
it requires a Task, not a line of code
oh?
?scheduling
ok thank you
@eternal oxide Can you help me pleeeeeeeeeeeeeeeeeease? ๐ฅบ
No it will always be a dual inventory. The Player inventory is always show.
I meant that. Sorry
You are trying to split text on a line length of 20?
I'm trying to check after a length of 20 the next " " and then split it.
I will try.
any help please
You are going too fast
its skipping positions because you are simply trying to make it go too fast and it never gets to render evenly
I am regretting this discord to trello bridge project
its like trying to make it fly in a circle but due to the speed you are trying to make it move you only have 3 points on the circle for it to move to.
with animations you are limited by bandwidth and the division of 20 ticks per second
You arn't limited by ticks if you use packets
if you try to make it move two positions in a single tick it will skip the middle one.
He's using tick timing
as such he is limited to 20 ticks
Simply put (using ticks), the faster you try to go the lower the resolution of the circle. Less points and less positions to move to.
You are still limited by ticks as each packet is processed as its received, but updates are done per tick.
you can send more packets using async but its not going to be smoother
More likely you are going to back up the queue and be restricted by bandwidth
Nope I run animations on armor stands as fast as 10ms
I stand corrected then
try making bigger gaps between keyframes of your animations
Could go faster but breaking 100k blocks every 1ms probs not a good idea lol
its probably due to the way your server cant keep up with all of your packet data
if you're sending many of them
it can cause issues
You would be limited by FPS then
He's doing his calculations by ticks which is why his resolution is dropping.
its not as if server is constant 20 tps
it is when he's calculating the next position based upon a speed variable which calculates the next position by multiplying ticks
he is literally reducing a circles resolution
Yes.... 2k fps very limiting ;)
so he's getting the tps of the server and multiplying the same value repeatedly
i don't understand since i havent seen the code
no he's not using teh TPS at all
Basically this, but using packets... https://gist.github.com/hugmanrique/1bd273e3b20b419f625c437db61b7ff9
he's increasing the rad per sec which is basically skipping positions on the circle
if he wants more granular movement he needs to increase the speed of his loop
wouldnt this be fixed if it was running on a seperate thread pool?
yes
and run faster
to maintain resolution as his movement speed increases he needs to increase the speed of the loop.
Hey there,
i want to create an economy-system working with vault in my own plugin. I tried to register it into vault like in the documentation but other plugins like Towny or Shopchest are saying "Could not find any Vault economy dependency".
Someone here with a good Tutorial / example repository how to create an own economy plugin working with vault and other plugins?
ah yeah good old trigonometry here
good that im having course on trigonometry this year
Idk what was actually being talked about. I was just letting it be known armor stand movement was not limited by tick rate.
The more points of a circle the armor stand has to move to in a circle the smoother the animation. (If I understood your last message correctly)
Vault has a tutorial, else you can find iConomy on Githb
How can i add properties to an entitie and spawn it later
Swan Lake (Ballet Suite), Op. 20: I. Scene (Swan Theme)
London Philharmonic Orchestra / Yuri Simonov
unless you fake it using NMS/packets
lies and deception
You would need to write a wrapper for your entity
tho you won't be able to create such a virtual entity, afaik spigot introduced the structure API and is now exposing entities that are not spawned in a world
a Class to store all your information and that can be used to spawn the Entity later
???
to go along with your animation
Ah
man I have no clue of what I am doing with these get and post requests
and with nodejs in general
You would need to write a wrapper for your entity
@eternal oxide so if i add delay to the spawn of an entitie it will have the properties?
we must go deeper
Do you mean you want to apply things to the entity before it appears?
how are you rotating them btw
Math
if so use the World#spawn method that takes a Consumer
When it spawns it's not invisible
precached or are you running a fresh calc every time
For loop with the division of 360 and pi
yes as I just said, use the world spawn method
Eh?
Both kinda
if you're going to have it run forever you might as well precache it for good
The player.getWorld ?
will let you go up to 500+ entities without hitting your tps
Can do that anyways lol
I mean youcan it's just not a good idea
I can go steal candy from a baby but that doesn't mean that I should do it
Having that many entities in 1 area doing anything in the first place is a bad idea xD
Break it ;)
then add one more armor stand per second
how does hypixel make a mob this small? https://i.badlion.net/XSqrfAPfPGmZc7Cd2WABpJ.png
So in the above I have 26 carts with 26 seats rotating at 3 blocks per tick I think. During testing my only limiting factor was fps xD I had like 2k armor stands spawned there.
Probably baby armor stand
but what about the fact that it's a wither?
Baby wither
Possibly packets?
baby wither is the one in miniwalls but defo not here
Wither.setAdult(false)
you said it to me?
If it's in skyblock it's more than likely a texture.
You can also just fake a withers particles/boss bar can't you
^
precached you would sooner run into issues with having armor stands than with the code that moves them
but how?
are the mini wither even used in the game
I dont have a pack on that would make it like that
what's the purpose of baby withers lol
it's an effect of necron armor
no im talking about vanilla
Just make a texture for a custom entity ID? Idk honestly.
Hypixel SkyBlock has a resource pack.
no?
yes?
not built in
maybe!
Yes lol how do you think it shows the custom swords?
it doesn't?
i would rather compile the location calculations into some kind of AnimationController class and play them, rather than using trigonometry functions every tick which are expensive to do sometimes
dovidas
?
you seem to know armor stamds animation
yes, there are mod or packs for it but this is vanilla, I'm not using any of those pack mods
Sounds like gecko lib lol
wtf is gecko lib
that's just my idea in my head
Well if it doesn't then there has to be a way to set the size of the entity.
I suppose yeah
oh
could you help me with this?
I guess you havn;t been reading. We discussed your issue for over half an hour
i'm sorry i really can't, Coll knows about it much better than me
are you now using packets to animate yoru stands?
yes
then you need to stop using ticks to calculate your stand locationsd
๐
move off the scheduler and instead run a Thread which can run faster
i think it is based in the radPerSec
so if i change it
it would be a new location
you can't obtain the speed you want using a resolution of ticks
actually it is not about speed
it is about the armor stands teleporting after i change the speed
Yes, thats exactly what I'm telling you
As you increase the movement speed the resolution of your calculations decrease
ok
you need to run your loop faster to be able to increase the accuracy
which means moving off the scheduler and onto Threads
you need to be able to run faster than 1 tick loops
ok, what about the tick in the math there?
yes you move away from ticks
what i do with that?
you will be running a Thread on milliseconds
yes
so you can control the granularity of your movements teh same way, but you use the ms instead of ticks
@crude charm btw the wither size is relative to the invulnerable ticks left
afaik around 1k is the smalltest possible ?
or 900
tho those are barely visible withers
that size might be closer to 750 ticks left
somewhere around 1k it should switch, rendering the wither upside down btw
lol
my code is killing the server
ok
but i want to change it while the animation is happening
IDK your code. But with mine I just have to adjust the speed values.
you can change speed all you want, but your loop has to run fast enough to maintain teh fastest speed
?paste
Show a video and explain whats wrong for me.
You need filler positions the faster your cricle spins
Gotta do the math based on your circle speed
how could i do this
So lets say you do 10 positions in that circle for a speed of 2 ticks or what ever. You need to add more positions to smooth it out at higher speeds so like 15 per 1 tick or such.
otherwise its snaps to a position thats far and doesn't look as smooth as at lower speeds.
i did not understand
imagine a circle with 12 points around it. Locations your stands can move to at speed 1.
If you double the movement speed of a stand to 2 it skips every other position. It now only has 6 positions it can move to.
Increase to speed 3 and you now only have 3 locations around the circle this stand can be in.
large brain
Is there a way to detect when a player comes into another player's render distance?
Is that what you want?
addPlayer packet?
Surely that's just when a player joins?
ok
This packet is sent by the server when a player comes into visible range, not when a player joins.```
catch this packet and you're good to go
if I accidentally close git bash again instead of closing the screen I'm going to bed
:(
it depends if you're using netty channels or protocollib
NMS
use auto complete you should find it, idk
I don't want my plugin to have many dependencies
Ok
pop the champagne
Ty
its a server packet, the server sends it not the client
yeah
but if server sends it i think there's a better way to do this
Seems like only PacketPlayOutEntitySpawn
EntitySpawn is different packet
what version of your protocol are you using
well idk then
time to get googlin
im looking at 1.17's protocol info
ok
I think this might be the 1.8 protocol wiki page, not sure, it's up to you to figure it out. https://wiki.vg/index.php?title=Protocol&oldid=7368#Spawn_Player xd
bro could you give me your code? im spending a lot of time on this
Ty
@eternal oxideHey, you told me before about "spawn" could you help me with it?
at net.minecraft.server.v1_12_R1.Chunk.a(Chunk.java:833) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.World.getEntities(World.java:2439) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.World.getEntities(World.java:2426) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.World.getCubes(World.java:1241) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.Entity.move(Entity.java:658) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.EntityLiving.a(EntityLiving.java:1813) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.EntityHuman.a(EntityHuman.java:1416) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.EntityLiving.n(EntityLiving.java:2124) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.EntityHuman.n(EntityHuman.java:348) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.EntityLiving.B_(EntityLiving.java:1946) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.EntityHuman.B_(EntityHuman.java:145) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.EntityPlayer.playerTick(EntityPlayer.java:313) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
o,o
Eg java loc.getWorld().spawn(loc, TNTPrimed.class, (tnt) -> { tnt.setSource(player); tnt.setVelocity(new Vector()); });
Yes, but this seems to be happening at completely the mercy of god.
Also forgot bout that
I get that for what ever reason it cant find entity1
ArmorStand hologram = (ArmorStand) player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND);
Yeah we cannot help without code
i have something like that
not the same, use teh method I said.
it has spawnEntity but i can see the armor stand for some miliseconds
ok
ArmorStand hologram = (ArmorStand) loc.getWorld().spawn(loc, ArmorStand.class, (ArmorStand) -> {
ArmorStand.setSource(player);
ArmorStand.setVelocity(new Vector());
});
like that?
except ArmorStand not TnTPrimed
Ah yeah. Try using Java 8 or 11. The java version you're using did not exist at that time
like that now?
I am using Java 8?
Oh wait
wait
I know what this is
The server has java 16
fuck me... ._.
Close. inside teh lamda you need to set invisible instead of setSource adn Velocity
iterating players is thread safe right? since its unmodifiable list
the only thing i need to look after is reference change of list
?
right?
well, i get some errors
lowerCamelCase variable names
wdym
You shoudl not be using setSource nor setVelocity
but still
you replace those with your setInvisible
getting errors with "loc"
Elgar
thats teh location you are spawning the stand at
not really
but its an unmodifiable list
yes
He also has a ArmorStand variable named ArmorStand
Which is what I was refering to
and iterate it
but the data backing could be stale
what are you trying to do?
i changed souce and vector and this happens:
send packet to all of the players
then yes do it but catch any exception
what?
post yoru code not a screenshot so I can edit
what would happen if i create variable reference to the unmodifiable list
i would still get stale data
but it should be more recent right?
technically
inside the async task
ik you wouldnt loop iterate the list without creating the list reference since the reference could change and you would get messy data
Hello, can someone help figuring out an algorythm to find a random spot on an angled line?
I have a probability, a double that defines how far the block is from the middle
it seems like setVisible isn't valid
the rest do
setInvisible
nope
yep
oh sorry
well but still setInvisible(false); is sending the error
just think of it as an arc on a circle, get a random angle and get the x and z positions from that
that code is perfect. I just pasted it into my IDE
has anyone here done discord bot work before
I have it all down I just don't get how to reference inline replies
yes but look this:
Hi, i am gonna develop a plugin that makes you being able to connect your boat to another boat with a lead. Anyone got any idea on how i should do this?
I thought it was msg#reference but it seems to say it's null
Yes i thought of the same thing, but i dont know how to implement it
ArmorStand hologram = (ArmorStand) player.getWorld().spawn(player.getLocation(), ArmorStand.class, (armorStand) -> {
armorStand.setInvisible(true);
armorStand.setCustomNameVisible(true);
armorStand.setCustomName(ChatColor.RED + "Hologram");
armorStand.setGravity(false);
armorStand.setInvulnerable(true);
});``` Works perfectly
so i don't understand why is sending an error
show your imports
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
imports are fine
Hi again, so i was thinking about attaching a boat to an invisible animal. So you can use leads on it. How would i do that?
the IDE is intelijj
unlucky
yes, but it sends the same error
try ArmorStand hologram = (ArmorStand) player.getWorld().spawn(player.getLocation(), ArmorStand.class, (ArmorStand armorStand) -> {
ArmorStand armorStand?
L, Works perfectly
What? So on the z axis i have to you cos?
what API version did you use in your pom.xml?
let me see
yes, x is horizontal and z is vertical in this case (i'm assuming this is laid flat in-game)
modelVersion ?
setVisible and setInvisible both compile for me.
is the consumer method new? i never knew there was one
Not terribly. Not as far as I know
java version maybe?
API
i had never seen it before but maube i'm just blind but cool
<dependencies>
<dependency>
<groupId>some.group.id</groupId>
<artifactId>artifact-id</artifactId>
<version>VERSION</version>
<scope>provided</scope>
</dependency>
</dependencies>
it already exists at least since 1.13 I think
Okay, its btw for an JumpAndRun. I think i dont need anything horizontal
i don't know what jumpandrun is you definitely need 2 axis for this
This is a jump and run
And i wanna get a point, a block of the angled line
if it was a straight line then you only need 1 axis, but the x and z co-ordinates vary when you move along the line
then setVisible should work fine
Then i only need one axis
it doesn't
try to use it anyway and let it compile
it does for everyone else
no..? explain
ok
invalidate your caches and restart
File menu
what's the error?
invalidate cache and restart
wdym
are you using IntelliJ to compile, or maven?
maven i think
but you must know that
maven
Yes, because i dont wanna go up on the y-axis. Or did you mean that i need a x and a z axis for the point? I use 2D dimensions not 3D
what are you clicking to compile @acoustic pendant ?
yes, x and z is what i've been saying all this time, 2-dimensional = 2 axis
go to the right of intelliJ, click Maven, then Lifecycle, then double click package
Ah i understand you now.
But the same question, how do i implement it?
it couldn't as well
I dont have any ideas how i could implement it
@tender sharddo i send you the whole code maybe?
well i modelled it as an arc on a circle, which is probably the easiest way to implement it since its like 3 lines of code
So?
those functions accept an angle as radians
Well could someone do an example because i dont really understand it rn
?
would recommend just learning some basic trigonometry
uuugh people using math again
is the conversion to radians
I didn't let my dreams be memes, I just finished making this
there's also a function to convert it to radians
bow down to the greatness of my discord->trello bridge
nice! Make it work with wekan too and publish it ๐
tbh you were right, there's hardly anything to it
I spent 4 hours trying to figure out the best way to do post requests with nodejs and 10 minutes writing the code
yikes...
what
not a fan of injecting things into the command map directly
its deeper than that trust me ๐
you need to create unregister method for specific command object too
since bukkit doesnt have it
also you need to sync brigadier manually
its not disabling the command
its removing it completely
you can for example remove specific commands that you dont need from the server which you cannot unless you edit the jar
its removing the command from command map and brigadier command dispatcher
technically yes
unless the plugin doesnt have the reference to the plugincommand object its gone
neither nms neither spigot doesnt know about the command
after that
except if you have a reference to that and reregister it
if you dont have the reference, the garbage collection will delete the instance completely from memory
i created this to wonder if I can remove some internal bukkit and spigot commands which i don't need
but i decided to implement this to my command node system too
for example lets say you have an Essentials plugin installed and you somewhat useless command /jail (useless for me, idk), and here's the options for me to do that:
โข Use commands.yml file. but the thing is it doesn't disable the command completely, it only deletes the command label value from command map, thus you need to add all the aliases of the command too to that list.
โข Use command disabler. Usually these command disablers only hide commands, not deregister them, thus it still exists in the server and administrators can access it and that's not what i need.
โข Decompile the plugin. What if plugin is obfuscated? This is not suited for everyone, also you can get your plugin access voided, because some plugins have anti piracy boobytraps Not gonna even talk about the hussle to fix all the decompilation errors.
All of these methods have cons so i've tried to think how to get away past those.
almost all command frameworks do it that way nowadays
Im trying to make players not get exp whenever they hit without a sword in their hand,
if(((Player) event.getDamager()).getInventory().getItemInHand() != null){
((Player) event.getDamager()).giveExp(1);
}```
this is my current code
its not working atm
?
i can see the armorstand for a few miliseconds
and the when i hit where the armorstand is
it souns
how can i do that?
seek google for protocollib
or if you're primitive ooga booga who likes NMS
use netty channel injection
protocollib is easier
its a plugin for spigot
which you drop
and include as library inside your plugin
and you can send packets easily
there's plenty of tutorials online how to use protocollib
even on youtube
see
getItemInHand will NEVER be null
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/PlayerInventory.html#getItemInHand()
declaration: package: org.bukkit.inventory, interface: PlayerInventory
there's couple thing which cant be fixed even with packets
IntelliJ will also mark the line in yellow to tell you this @subtle folio
for example you cannot hit anyone via hologram (detection is done clientside and sent to the server)
yeah like my back hurting problems
you can fix this but it would require you to do ray tracing of normal player's range value
and seeing if it hits something
if it does simulate player damage with its current tool
but it requires more classes than its worth it to do
Also why are you using getItemInHand? Are you still on 1.8?
i somehow fixed my back, and i dont know how
i've got so many sleep problems because of it
let me know when you found out how lol
i managed to restore my back to its place naturally somehow
buy an office chair
it would help alot
gaming chair are trashiest thing i've got
at least it was free
that fucking chair scratched my floor
Shrimp
my back was so bad at that time that i was sleepin while in pain
and i couldnt lift something heavy off the floor
thank god its over now
i ate so much shrimp i became allergic
that was their revenge
Anyone know of a good anti-cheat that works with CMI?
Can be premium, i dont mind
Verus is a great packet level anticheat but its 200$ and only sold for networks
NCP forks are great too
it could kill killauras like flies
NCP updated with a good config is perfect
Anyway as for the CMI part uh they like to do a lot of bad things
Why on earth is spigot registering events annotated with @Subscribe?
@EventHandler ?
Itโs really not using Guavaa event bus framework
isnt there a consumer which allows you to set properties of the entity before it is actually spawned?
There is
oh ok
hm
but checking if its air doesnt work either
ยฏ_(ใ)_/ยฏ
then add some debug statements and see what exactly is happening
oh wait what are you even doing
you are never cancelling getting XP
all you do is giving the damager one additional XP when they have an item in their hand
ive come up with a fixed
if(((Player) event.getDamager()).getInventory().getItemInHand().getType().equals(Material.WOOD_SWORD) ||
((Player) event.getDamager()).getInventory().getItemInHand().getType().equals(Material.STONE_SWORD) ||
((Player) event.getDamager()).getInventory().getItemInHand().getType().equals(Material.IRON_SWORD) ||
((Player) event.getDamager()).getInventory().getItemInHand().getType().equals(Material.GOLD_SWORD) ||
((Player) event.getDamager()).getInventory().getItemInHand().getType().equals(Material.DIAMOND_SWORD)){
((Player) event.getDamager()).giveExp(1);```
uuugh damn that's an ugly piece of code
how get playername with UUID offline mode without use offline player?
[15:36:57 ERROR]: Could not load 'plugins/BuildBattleControl.jar' in folder 'plugins': uses the space-character (0x20) in its name
um? what? please help what is this even lol
don't use a space character in your plugins name
Hey guys, i need some help with my Packets.
I want if a player click on any Recipe in my Custom Furnace Inventory, that the Recipe cant be used.
I dont know why but if i try it with fakeblock clicks etc. it works but on this recipe packet, it dont work.
https://hastebin.com/ejipitosac.php
okay, how do i fix this?
name: MyPlugin
and not
name: My Plugin
in your plugin.yml
if(!(event.getDamager() instanceof Player)) return;
Player killer = event.getDamager();
if(killer.getInventory().getItemInHand().getType().name().endsWith("_SWORD")) {
killer.giveExp(1);
}
can't find plugin.yml
found xml tho
and fixed it to
<name>TCW-BuildBattleControl</name>
also reloaded maven
and same error?
nvm
found the yaml
thanks fgor help
still that wouldnt solve the sound issues, and you would need to cancel all armorstand related events
packets should be preffered because its mostly static
I use this method to get UUID from String
UUID.nameUUIDFromBytes((String).getBytes(Charsets.UTF_8))```Is there an reverse option? (to get a String from UUID)
no
yes
this man gets uuid from string by using bytes instead of using #parseString()
you see something new every day
how I use this method java System.out.println(UUID.nameUUIDFromBytes(("OfflinePlayer:" + "Raymano").getBytes(Charsets.UTF_8)));I got the result 5d336a96-7a2a-315d-a543-bb6a5aa9b4e7 (my UUID in offline mode)
there is no way?
nope
well, they could be
but by design they are not reversible
have you... tried it?
I'd like to get player names from world/stats
well it wont be in dark red, it will be in bold, and that is incorrect use of translateAlternateColorCodes
the only problem is that I deleted all files from the playerdata folder ๐
use bukkits getOfflinePlayer or just store a uuid-name map yourself
if its a one-off thing then you could just write a python script or something to request each username from mojang/namemc/whatever and store a uuid-name map there
and I can't use getOfflinePlayer java OfflinePlayer#getNamereturn null
I have players saved from offline mode so namemc/mojang don't work
what kind of script are you talking about?
well, you're kinda fucked
eh, there's way to do it efficiently
what is the problem exactly
realy?
raymano what's the problem
if i understand correctly you have lots of offline UUID's which need to be converted to names right?
iirc converting offline UUIDs to names is a bit difficult
yea
If so, there's an usercache.json file inside server files, which stores json structure of uuids mapped to usernames, it is specifically designed for offline players to make plugins compatible both with offline players and online players, otherwise plugin would need to implement different storing techniques for player data
read the structure from the file and use a for loop to check if key UUID is a match if so, map the player name to your needs
my usercache.json:
[{"name":"Dovias","uuid":"bf35cc01-5df1-355c-aaa6-44ed8a1bbbd7","expiresOn":"2021-11-09 17:20:37 +0200"},{"name":"Doviasas","uuid":"4560dddf-cdbf-3989-83a9-a610749ac9ba","expiresOn":"2021-11-01 19:10:31 +0200"}]
what is this
1 = $5
10 = $5 * 10
its literally simple math
????????
price * 10
its that simple
bUt sIr!
i think your string formatting method is broken
thanks, but I have only 1000 users here ;/
and that's literally 1000
in need for this pls
yo everyone
how awesome are YAML anchors
I only about them since a few weeks
why did noone tell me about them earlier
๐
it's so awesome!
a hwat
autoinvsorting-disabled:
displayname:
base64: *base64-disabled
lore:
- *lore-disabled
- *autoinvsorting-lore-1
- *autoinvsorting-lore-2
autoinvsorting-nopermission:
<<: *nopermission
display-name: *autoinvsorting-name
let's you easily reuse existing yaml sections, even overriding only certain things
autoinvsorting-enabled:
display-name: &autoinvsorting-name "<#2e86c1>&lAutomatic Inventory Sorting<#/85c1e9>"
material: PLAYER_HEAD
base64: *base64-enabled
You can also inline the definition of anchors like display-name above
glad I could show something new ๐
does snakeyaml support this?
sure
nice!
I discovered it by accident a month ago or sth
however you cannot concat strings
still that's awesome
yeah and its also easier for admins
Hey guys i need to know:
I did check the protocol wiki but sth is still not clear:
Are SetSlot packets ONLY for player inventory?
Or can I send SetSlot packets on stuff like chest inventory, furnace, anvils, ench table inventories etc? (my goal is to show the player a fake item if it has a certain tag ofc)
I've been tinkering with packet level inventories before and i can guarantee that setslot works with all of container slots
it uses inventoryview slots
wait
yes
if you want to set lots of items instantly there's packet for that too
SetSlot is used for manual dragging, while another one is used to resync the client and server and to open containers
but its at most one or two items usually, and i treat them independently
then use setslot
ok perfect, so if someone opens a container, and i start sending a sendslot packet to a specific slot which ain't necessarily related to what he has/had in hand, it will fakely update right?
yes
ok that's what i want perfect
i mean
if you have it in your hand
the item will change in your fist
but it will just override everything that slot has
but what if the item is not in hand at all
but if you click it, the server will resync and it will be gone
then it would just override previous item
or add one
i won't have any issue with that cuz it constantly updates as its animated item
in the slot as someone put something in the chest while you have chest opened
packet level GUI's are great
i've got Proof Of Concept
with inventory click protection etc
but i never finished it sadly due to the way it requires lots of work to mimic the vanilla behaviour
since server doesnt know about the inventory nothing at all
and you need to implement your own mini server on top to handle the GUI packets
yeah i know the madness i once tried to do sth similar too, i discontinued the project
i will revisit that soon probs
because if its done correctly it would make your GUI's undupable even if the bug existed in the plugin's code
i actually came with a much easier solution:
on inventory click, let process the event = wait one tick (because we know that in one tick all the click actions will have triggered, views&inventories&slots updated), and at this point grab the inv and operate on it
it sounds really dumb
but it works so good
basically, in onInventoryClick event listener, create a BukkitTask that will run in ONE tick, not more not less, and inside that task it will grab the inventory again, and operate on it
that works if the container itself is synced but items aren't (packet level items)
i've made fully packet level GUI
with containers too
but inventory container synced one is much easier to do
since inventory container provides events what the slot is clicked if its registered
i think that's what i'm gonna do for now in the future
good luck with that!
maybe in the future i'll make fully packet level one
also i gotta ask, do you watch snooker or sth?
no
ah okay, i was just wondering about ur "147"
that's a different story
i've played snooker in 2008
via some client
on windows xp
ahhhh
and that's where my name was born ๐
makes sense xd
i don't remember how to play it anymore, i was kid back then
all i remember is the same color balls like in pool
haha yeah, it's 15 reds, 1 yellow, 1 green, 1 brown, 1 blue, 1 pink and one black
you pot alternatevily a red and then another color, reds give 1 point, other colors give more point, highest break is 147
anyway thanks for your help!
Hi guys! So if you've played the Hypixel Skyblock, you noticed that there's a 'system' that when you walk or jump into a block, it'll get you to the other mine island - taking this as an example - So I was wondering how would I do that in java using the spigot api. Sorry for my broken English...
well i haven't played hypixel skyblock but i imagine you walk on a block and it teleports you to another location, right?
i think it makes you connect to another server
I don't wanna do this
I just want to make that 'animation'
sorry, can't help I have no idea what kind of animation you want to achieve
I'll send you a link of a video
It just launches the player
velocity?
Yep
It doesn't just 'teleport' the player to the location, it launches you there.
I believe itโs just velocity
Might mount you on an invisible entity, donโt remember
why tf does intellij suggest you using enhanced for loop instead of numeric one
Yeah, it does that
Easier to understand for the reader
it decompiles very ugly
with iterator
and while loops
wtf is Pointer<V> function interface
in java 16
oh its
paperspigot function interface ๐
i really thought this is some new java shit ;D
you can disable that suggestion if you want
I think enhanced for is way better because the performance doesn't matter unless you loop over 100k things and it's more readable imho
im a C/C++ style guy
for (int i = 0; i < list.size(); i++) {
Element e = list.get(i);
}
for (Element e : list) {
}
i prefer to cache list.size() into variable too
i do
for (int i = 0, k = list.size(); i < k; i++) {
Element e = list.get(i);
}
but some don't like it how i write it
since its "unreadable" for them
i abuse for loops with their conditions
its just seems more clear to me
what it does
for example if i just to for loop without any order in mind, or loop it backwards i do
iterator ๐
for (int i = list.size(); --i > -1;) {
// Code
}
that's evil though
but micro optimization
i saw this loop somewhere in stackoverflow
but stopped using it because it makes people confused
its apparently one of the fastest for loops you can write from arraylists and primitive arrays
i saw somewhere in benchmarks on stackoverflow
if you need that kind of optimization, you probably have way bigger issues in the code though lol
ListIterator<E> iterator = list.listIterator();
while (iterator.hasNext())
iterator.next();
while (iterator.hasPrevious()) {
E element = iterator.previous();
}``` ๐
list.forEach(e -> { ... });
its not as if i have any problem
its that my mindset is built like that
its a bad habit
try {
String str = list[0];
// ...
} catch (ArrayIndexOutOfBoundsException ignored) { }
try {
String str = list[1];
// ...
} catch (ArrayIndexOutOfBoundsException ignored) { }
try {
String str = list[2];
// ...
} catch (ArrayIndexOutOfBoundsException ignored) { }
// ...
public int getSize(List<?> list) {
return getSize0(list, 0);
}
private int getSize0(List<?> list, int current) {
try {
list.get(current);
return getSize0(list, current + 1);
} catch (IndexOutOfBoundsException e) {
return current;
}
}```
how can i get needed items for a recipe?
collect it ingame
guys you should switch to top taskbar on windows
so comfortable
one swipe with mouse to top vs two to the bottom
What type of recipe
Interface Recipe
There is no way then
You need to identify what type of recipe it is and then call the right methods for that type
Recipe#getChoiceMap
The only thing it contains is getResult
declaration: package: org.bukkit.inventory, interface: Recipe
yeah i see
check whether the RecipeChoice is a MaterialChoice, then cast it
or whether it's an ExactChoice, and cast it to that then
does any of you have ideas why BukkitCommandWrapper of brigadier node implements run() method which dispatches the command but its never used anywhere since bukkit has its own command API
it adds the implementation to the command dispatcher
but its never used
since the command works even without brigadier
Can you give me an example?
Recipes
Recipes aren't choices
check the thread I opened
Oof sorry for ping
you shouldnt ever have to use iterator unless you are removing items
but then again, Stream filter does the same job most of the time
Iterators can be useful to check whether another element exists
e.g.
StringBuilder sb = new StringBuilder();
Iterator<String> myStrings = stringlist.iterator();
while(iterator.hasNext()) {
sb.append(iterator.getNext());
if(iterator.hasNext()) sb.append(", ")
}
well, streams can do that too lmfao
might be, I didnt say it's required, just that they can be useful
String.join(", ", list.toArray(new String[]{}))
there's always 10 different ways. Everyone should just what they like
yeah but what if you don't have a string list but sth else?
then it gets more complicated
stream.map
as said there's always a thousand possibilities
I use SQL to join my arrays
Why would you want to ever use an iterator over a loop for checking items inside an array tho XD
thats so much work
I pass my objects via ProcessBuilder to a bash script
my IDE does the imports for me
I send my objects to a foreign datacenter for processing
the best way
JSaaS
Joining Strings as a Service
Nah use unsafe
What is this, Yandere dev
we could make so much money
๐
ikr?
just do the compatibility yourself
C - switch statement, A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is chec
now implement for every OS
ez
I have another idea
why even code something when we can just employ people who do the data processing
Does it involve fire
Get 20 people and 20 abacuses
lets write code in the paper
but how do I count how many people I already have when I already gave them all my abacuses?
What are you, my college
I had to write code on paper in high school
but they didn't care about a forgotton semicolon or stuff like that
basically pseudo code was enough most of the time
;-;
but I didnt study it or something, it was just normal school
our IT classes be like: Do some word, excel then do whatever you wantโข
for getting the damage that an entity has done to a player, how do i define the
Player player = ... ?
In the EntityDamageByEntityEvent getEntity will be the player
well, i want to see the damage that a player deal to a entity
so "getDamager" should fine?
well
no
getDamager is for EntityDamageByEntityEvent
Which is what you need
to see how much damage you did in one hit
You need EntityDamageByEntityEvent
is the player considered an entity?
event.getDamage() returns the damage.
event.getEntity() returns the entity that was damaged
event.getDamager() returns the entity that damaged the victim
?jd
of course, what else would it be lol
great question
ok, i'm silly ๐
Entity -> Damageable -> LivingEntity -> HumanEntity -> Player ^^
but?
@EventHandler
public void onDamage(EntityDamageByEntityEvent event) {
Entity victim = event.getEntity();
double damageDealt = event.getDamage();
Entity attacker = event.getDamager();
Bukkit.broadcastMessage(attacker.getName() + " dealt " + damageDealt + " damage to " + victim);
}
Good afternoon, wanted to ask if anyone has any code that makes hostile creatures hit the player :cpep:
something like that
you can force a mob to damage another entity using NMS with doHurtTarget(Entity)
following requires changing the pathfinder I think
Or
declaration: package: org.bukkit.entity, interface: Mob
You can do .damage(entity)
That as well
i can never seem to remember which slots getRawSlot and getSlot represent
getRawSlot is slot numbers for the InventoryView IIRC
but where do you start
while getSlot represents the slot in the inventory itself
getSlot = relative to inventory itself
top or bottom?
getRawSlot = index based from both inventories
starting on which inventory
I'd just test it and then write it down for further checking ๐
Yeah
getRawSlot starts on the top inv
like in a furnace, the coal is slot 0 I THINK
either the coal or the thng you are burning
it varies too
Is there any javadoc to get the entity that is damaged?
one of those is 0
in what event?
bruh I sent you a complete example code for your event
^^
oh didn't see sorry
np
but the javadocs explain it perfectly, it's the first result on google when you google the event name
declaration: package: org.bukkit.event.entity, class: EntityDamageByEntityEvent
it only lists one method (getDamager) because the other methods are part of the super class (EntityDamageEvent)
EntityEvent#getEntity is the damaged entity
EntityDamageEvent#getDamage is the amount of damage
EntityDamageByEntityEvent#getDamager is the attacker