#help-development
1 messages · Page 998 of 1
Oh strange,Do you know how would I give it the permission?
I debuged and all messages after if (pushedInAirPlayers.contains(player.getUniqueId())) { don't sends
private Set<UUID> pushedInAirPlayers = new HashSet<>();
pushedInAirPlayers.add(p.getUniqueId());
Where and when is that called
?paste
Class / classes please
chmod +x gradlew
He didn’t mean remove the if
He meant to put the .remove method instead of contains
Before continuing, i also want you to check the damage type before the set.
Let me know when that is done and i’ll tell you what is likely your issue
if (pushedInAirPlayers.remove(player.getUniqueID()))?
Huh strange it says
test@Laptop:~$ chmod +x gradlew
chmod: cannot access 'gradlew': No such file or directory
test@Laptop:~$
or what
Yes
Now add a damage type check before that
gradlew would be the path to the gradlew file
looks like it's not in the directory you're currently in
hmm, is that bad lol
?
whats a nub
intentional typo of "noob"
I plead the fifth
Did u add the damage type check
why when I cancel KnockBackevent, shield is not working (not blocking)
if (e.getCause() == EntityDamageEvent.DamageCause.FALL) {
so like that?
Good enough
Show me the two lines in which you register the command and the listener
getServer().getPluginManager().registerEvents(new PushInAir(), this);
getCommand("push").setExecutor(new PushInAir());
Now
Above that make a local variable for the class
PushInAir pushInAir = new PushInAir()
Pass pushInAir in the places where it says new PushInAir so u only write new PushInAir once in your whole main class
private PushInAir pushInAir = new PushInAir();
So like that in Plugin Class?
Sure, that’s not very local. But doesn’t matter
Can someone give me an heads up? will this work or do i need to make that long list call to get the data too?
//setting data
pdc.set(plugin.getKey(), PersistentDataType.LIST.listTypeFrom(PersistentDataType.INTEGER), List.of(values));
//getting data
int[] data = pdc.get(plugin.getKey(), PersistentDataType.INTEGER_ARRAY);
and what now
PersistentDataType.INTEGER_ARRAY doesn't work on set, not sure about why
that just means you are not passing in an array of integers
A set isnt an array
Now it works
just use int array altogether
don't 🥹
Imma need paste of plugin and the listener as of now i guess
Should work fine if ya did as i told ya
U didn’t do it
.
public void onEnable() {
pushInAir = new PushInAir();
so?
I don't understand a little bit
No
It should not say new PushInAir
Anyplace in these two
He needs a lesson on instances
Yes I am not giving him one though
lol
If only cafebabe had commands for where to learn java concepts
yeah i heard that
i'll check later and change all
It's ok man we all forget stuff
still don't understand where i need to put and what
I've read a java bible twice and not retained much
getServer().getPluginManager().registerEvents(pushInAir, this);
getCommand("push").setExecutor(pushInAir);
oh
🥄
it is an array of integers
Integer[] values = data.getData().values().toArray(new Integer[0]);
yeah
thanks
now all works
thanks i'll check
Integer[] != int[]
cant cast an Integer[] to int[] so guess that will have to do
i mean i can make a for loop to unwrap it but fuck it
you can just turn it into an int[] by doing a new int[0] instead of new Integer[0]
just mapToInt
is there a good documentary for how to support multiple versions?
int ain't a class
it is a primitive
^ this first
int[] values = Arrays.stream(data.getData().values().toArray(new Integer[0])).mapToInt(Integer::intValue).toArray(); this looks so ugly
wtf
fixed it a bit
data.getData().values().stream().mapToInt(Integer::intValue).toArray()
👍
you could just use PersistentDataType.LIST.ints()
but that takes up a bit more space I guess
i already had to lower my honor by doing a javascript kid move, no need to search some other fancy method lmao
i hate those oneliners

who
You
,-,
Hello, How do I make a command argument in Turkish? args[0].equalsIgnoreCase("gönder") this isn't work, args[0].equalsIgnoreCase("give") this is work
i don't even know who you are my man
doesnt minecraft like turkish?
Set ur formatting in whatever ide u use to utf-8
it already is
it's working... sorta
@EventHandler
public void onPlayerMove(PlayerMoveEvent event){
Player player = event.getPlayer();
Biome currentBiome = player.getWorld().getBiome(player.getLocation());
if (playerBiomeCache.get(player.getUniqueId()) == null){
playerBiomeCache.put(player.getUniqueId(), player.getWorld().getBiome(player.getLocation()));
Bukkit.getPluginManager().callEvent(new PlayerTemperatureChangeEvent(player, calculatePlayerTemperature(playerBiomeCache.get(player.getUniqueId()), seasonsManager.getCurrentSeason(), player)));
return;
}
if (currentBiome != playerBiomeCache.get(player.getUniqueId())){
playerBiomeCache.put(player.getUniqueId(), player.getWorld().getBiome(player.getLocation()));
}
Bukkit.getPluginManager().callEvent(new PlayerTemperatureChangeEvent(player, calculatePlayerTemperature(playerBiomeCache.get(player.getUniqueId()), seasonsManager.getCurrentSeason(), player)));
}```
In my mind this is a valid use for playerMoveEvent, the calculations will only ever occur when they enter a new biome... anyone refute or think it's fine?
Could you not just compare the biome at getFrom and the biome at getTo
Well the actual functionality is less what I'm concerned about, I'll make it better in a while. I just wanted to know if this was bad use of playerMoveEvent
Good question, answer is: I'm just cooked
Uh probably yeah, I literally have never used player move event until now so I didn't know those were even methods
Too heavy. No need to cache, just read from event to/from
Yeah gonna change to that lol
if (event.getFrom().getBlock().getBiome() != event.getTo().getBlock().getBiome())...
before getting biome, early return if Blocks are the same
if (event.getFrom().getBlock() == event.getTo().getBlock()){
return;
}
Like this?
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
if (event.getFrom().getBlock() == event.getTo().getBlock()){
return;
}
if (event.getFrom().getBlock().getBiome() != event.getTo().getBlock().getBiome()){
Bukkit.getPluginManager().callEvent(new PlayerTemperatureChangeEvent(event.getPlayer(), temperatureSystem.getDefaultTemperature(seasonsManager.getCurrentSeason())));
}
}```
It sure looks a lot simpler
Block from = event.getFrom().getBlock();
Block to = event.getTo().getBlock();
if (to == from) return;
...```
gotcha
Also I've seemed to mess up the player movement speed... while back when making the temperature rules / effect thresholds, I changed the players speed to 0.2, making me incredibly speedy, but not even on playerJoin will player.setWalkSpeed revert back to 1.0 so now I'm just super fast
That's what I thought...
I remember looking something up that said 1.0 is the default player speed so
Idk what the hell I did
I removed all instances of setting the player speed to anything but 1.0
Apparently 0.2 is the default
Alrighty then
Gotta go fast
You make me laugh
Exactly how Sonic looks
insanic
Coll so good at drawing 🙂
Yep I drew that
Idk whether I should keep the event based temp updates or go back to a runnable that recalcs every so often... I just want the action bar display to be smooth and consistent...
You shoudl fire your event the next tick, IF the move is not cancelled
Well it's my own event, I'm just trying to describe scenarios when the temperature would change which is putting a toll on me, that's really where the contemplation of switching back comes from
yep but your event shoudl not fire if the event is cancelled, and teh player will not be in the To location during the move event.
hmm
actually you can ignore if its cancelled, as default your onMove will not be called if its cancelled
so just check at monitor for a biome change
then fire your event next tick
Mmm
So do exactly as you are, just make your event priority MONITOR then runTask for your event.
So rather any time a player would move the event should fire
runTask is so it actually fires your event the next tick
Right
Ok gotcha
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerMove(PlayerMoveEvent event) {
Block blockFrom = event.getFrom().getBlock();
Block blockTo = event.getTo().getBlock();
if (blockFrom == blockTo){
return;
}
if (blockFrom.getBiome() != blockTo.getBiome()) {
new BukkitRunnable() {
@Override
public void run() {
Bukkit.getPluginManager().callEvent(new PlayerTemperatureChangeEvent(event.getPlayer(), temperatureSystem.getDefaultTemperature(seasonsManager.getCurrentSeason())));
}
}.runTask(seasons);
}
}```
Like so?
Do I have to explicitly tell it to run a tick later?
no
Cool
So then when I do runTaskLater with a delay of 1, that means it'll fire after 2 ticks?
runTask by default runs a tick later? Given this, runTaskLater just lets you dictate how long the delay is
yes
Gotcha thanks! Gotta keep the knowledge up man
https://paste.md-5.net/iheyevuhug.java
If anyone has got notes, suggestions, optimizations, please let me know!
should you not adjust the walk speed based upon a Base + modifier
to allow for enchantments
Yeah I would use an attribute modifier
because I'm afrait of spiders and always get half a heart attack when they're jumping at me. That's why. I mean of course I could check if the spider is in the air but how do I prevent it then from jumping? Isn't it already too late then? And when and where should I check if the spider is in the air?
Also that's just there to fix my speed tbf since I had messed it up. I did write that down though and will be sure to change it.
i am making a plugin that works on 1.16.# -> 1.20.#
the plugin is very simple and it will just make a gui and read data from a file and show it and do things.
is there any big changes that spigot had in-between those versions that i have to put in mind? like how forge changed their mapping and some packets stuff
lots. Too many to mention
damn
making a gui would not require nms though
just build against teh lowest version you are going to support
alright 👍
why didnt i knew this before
that pressing END button will move multiline cursors to the end of the lines
k so im trying to fix the world horizon so that the sky doesnt turn black - id like to do this to already existing worlds if possible
from what i understand there has to be a world variable for this somewhere because superflat worlds dont have a horizon like this
what are my options here? because id also like to avoid nms like the plague but if it comes down to it, id rather use it than protocollib
?paste
hello, i am trying to create a plugin that allows pacific mobs to be hostile, it works fine, but with some mobs like pigs, striders, sheep, it does not work, i think i have a reason but not a solution, the reason (if i am not wrong) is that those mobs do not have the attack damage attribute, which makes that when they try to hit me, they disappear and throws an error in the console.
Correct
You need to inject an attack damage attribute into them
Or just disguise another mob
By injecting you mean the code I sent in the first image?, because I'm honestly not sure how you could do that.
I believe there is a map in the object that stores it
You’ll have to modify it reflectively
MMh, anyway, it occurs to me to make it not attack, but to simulate it, but I guess your idea (if the map stores it) is more viable, but I'll try it, thank you very much!
I got another question, is there a way to make a shield that is not blocking any damage or knockback? The players still need to block with them but just visually and not physically if you know what I mean
how do you get the person who killed the entity in this event?
getLastDamageCause() returns EntityDamageEvent not a player
in the event you have getDamageSource() which has getCausingEntity()
maybe
Entity killer = e.getEntity().getKiller();
if (killer != null) {
}
only if wanna the Player Killer
e.getEntity().getKiller();
Hi, is there a form to obtain when a piglin is angry?
you can't
why not
bnecause there is no "list" other than in files
so I'm gonna have to use nms?
requesting a chunk will generate it if it's not already done
why do you want all chunks?
so I would have to go in a radius?
val component = TextComponent(getTextKey(player.uniqueId.toString(), "joinItem.profile") +" (")
val keyBind = KeybindComponent("key.use")
component.addExtra(keyBind)
component.addExtra(")")
player.sendMessage(component.toLegacyText())
What is wrong? The Keybind is not working. The Final Message is Profile (key.use)
because legacy text sucks
legacy text (chatcolor) is a lossy text format. It cannot represent everything that components can
i think it's player.spigot().sendMessage(Component)
Minimessage go brr
I’m waiting for Megamessage
why when I cancel KnockBackevent, shield is not working (not blocking)
Instead of canceling it use setFinalKnockback(new Vector())
can i somehow slowly rotate ItemDisplay?
Yes, set the Transformation and an interpolationDuration
where is item's rotation center?
in the center of the item?
like for example skull
its the best way to represent rotations in a 3d space
There are a few examples if you search
Not many as its all new
because that can;t represent a rotation
well it can kinda, but you can;t properly rotate using just that
which rotates first? Do they all go at the same time, same speed, or proportional?
how does single w value represent all that
it is if you don;t set a duration
so if you dont set the duration value you dont need w value?
W is the fourth dimension
XY is two dimension
XYZ is third dimension
XYZW is fourth dimension
Good luck understanding quaternions
they are far from easy
how even do you get multiple cursors in ij? ive been using too much vim to know that
it's a hotkey
which one \👀
Did you watch the videos?
something something cursor something something
thought about using ctrl+j but that does smth wild lol
wow lol
damager.knockback(3.0, player.getLocation().getDirection().getX(), player.getLocation().getDirection().getZ());
I've got 2 players and tried knocking one of them, this knocks them in opposite direction
i mean it is pretty much
i do have like 7 jetbrains ides
used to have 4
vs and nvim for anything else
well vs is only for the things that rider cant do
so many open reports about missing features like for asp.net support
nice development discussion, about how much ides you have 😃
try putting a - somewhere?
i use the new clion nova for c stuff
thats what comes up in my monkey brain
knockback is a vector, just get teh vector between the two and apply
nova 🤔
Intellij ultimate
honestly there are like too much jetbrains ides with overlapping features
anyone using fleet?
player1Location.toVector().subtract(player2Location.toVector()).normalize
it's genuinely bad
anyone using zed?
might try compiling it on linux again
why i has error You do not have permission to view this page or perform this action when try view KitBattle Advanced plugin
it looks promising
i had a pretty terrible experience with it on linux lol
font changing doesnt even seem to work
im watching them
console is full of eof errors
rn
console also full of lsp errors
I have understood some of the sentences
and use Player#setVelocity?
The last video on the page explains why left and right
If you can play with them and understand whats going on you are set
x,y,z (Vector) and angle of rotation
Not complicated at all 😄
Meth
1.0 on y to rotate around y
sounds like what a professional would say
Why Damagable#damage() does not ignore Armor?
the duration doesnt work
the item spawns already rotated
Wait a tick
actually you want 1.0z to rotate around y
Before applying transformations
why
Don't ask
ok
didi you also set teh duration?
wait with scheduler?
Ye
then why does it spawn rotated
oh yeah I see it
yep that works, thanks
what does delay do?
delay of what
Waits before adjusting
it needs to spawn first
Of you actions
oh so i no longer need to do this?
your
no rotation at all?
give it a longer duration
anyone? tried doing it like that but that does not work... because I want damage animation
player.damage(0);
player.setHealth(player.getHealth() - 5));
ok ill set it to 1000
looks translated to me
isnt it supposed to slowly rotate?
yes
when you set the Transformation did you do left and right?
left is before, right is after
why i not have perm for view this plugin ?? https://www.spigotmc.org/resources/kitbattle-advanced.2872/
wth
with spigot
not logged in
paid resource ig
i logged
I can see it fine. Its a paid resource
but post should be free
I have 2fa enabled. No idea if thats why
SpigotMC - High Performance Minecraft - Error
The requested page could not be found.
oh wait
not thi
SpigotMC - High Performance Minecraft - Error
You do not have permission to view this page or perform this action.
this demm error
i logged
It hates you
clear cache?
You probably need a certain post count to be able to view premium
I have 0 posts and still can view this
You can see this guy is clearly logged in
.
Hello, how do I send messages to a players hotbar?
player.spigot().sendMessage
not sure get.set operates on the actual quaternion
possibly does
however you don;t set right
i think it isnt rotating at all. i think its rotating based on my location
do i need to set both?
I believe so
to the same thing right?
no
to zeroes?
try setting to the negative angle
?
try it and see
// Setup transformation
final Vector translation = player.getEyeLocation().getDirection().clone().setY(0).normalize().multiply(3.0f);
final Transformation transformation = displayItem.getTransformation();
displayItem.setTransformation(transformation);
final int interpolationDuration = 60;
displayItem.setInterpolationDuration(interpolationDuration);
// Setup this as you want, the default one seems to be large enough
//displayItem.setViewRange(viewRange);
// You can delay the animation
// Note that you should set this value otherwise the interpolation does not work
displayItem.setInterpolationDelay(0);
// Send the animation to the client
Bukkit.getScheduler().runTaskLater(this, () -> {
transformation.getTranslation().set(translation.getX(), translation.getY(), translation.getZ());
displayItem.setTransformation(transformation);
}, 2L);
// It has to be at least two ticks after the entity is spawned.
// Two works fine for me on a local server but it might not work on other server.
// If the transformation is directly applied, you need to increase the delay.
If tou want it to use the interpolation
You need to get the right transformation
press CTRL twice and use up and down arrows
to place them
By the way, the site did not talk about any email confirmation, but strangely enough there is no link to the confirmation
ctrl twice opens the run anything menu lol
I can still see all the plugins except this one
oeh that does it, thank you
pressing shift twice will open search anywhere menu
CTRL + SHIFT + R will let you search and replace within all project files
ye
how is the class ClientboundMoveEntityPacket.Rot called in spigot mappings?
somehow when im increasing y value the size of the item increases
and why does it increase item size?
I'd have to pull out my IDE and take a look
If it's not unit it will scale the display
how does that work
Math
For example if you want to scale it x2, you can multiply by the matrix :
2 0 0 0
0 2 0 0
0 0 2 0
0 0 0 1
in easy terms when you put these values in the method it will increase size?
If you put this matrix in setTransformationMatrix
Yeah
Basicaly
Each transformation can be represented by a matrix
And let say you have a function f that represent your transformation
and why is it working in the Rotation thing?
You take the matrix that represent f
let say M
Doing M * x
Is the same as f(x)
With that in mind, you can represent a rotation with a matrix
what is M?
The Matrix of the function f
is M number or something?
A matrix
so you multiply new vector by matrix and it rotates?
Behind the Transformation class there is just one matrix
But for what you are doing, you don't need it
As the multiplication is made client side
You just give it the matrix you want
so how do i rotate it
(I'm looking)
Is there a quick and easy way to get the related open/close sound for an Openable (e.g. gates)
thank you very much
Okay, basically quaternions saves your life
So
Following what we talked about earlier
You need to get the right matrix
so what does left matrix stands for
And
Don't know, we will see later x)
Hmm
To have 2 different rotation, i guess
You should have a Constructor for quaternions that takes 4 parameters
One is for the angle
The three other the coords of the unit vector
So new Quaternion4f(0.4, 1, 0, 0)
Should do a rotation around the x axys by an angle of 0.4
so like this?
Yep
Try that
But that will be applied instantly
If you want to see it rotate you need to delay the entity.setTransformation call by two ticks with the bukkit scheduler
private final ArrayList<Item> droppedItems = new ArrayList<>();
@EventHandler
public void onCraftItem(CraftItemEvent e) {
...
droppedItems.add(droppedItem);
System.out.println(droppedItems); // returns item in list
new BukkitRunnable() {
@Override
public void run() {
droppedItems.remove(droppedItem);
}
}.runTaskTimer(this, 0, 20L * getConfig().getInt("durationInSeconds"));
System.out.println(droppedItems);
}
@EventHandler()
private void onInventoryPickupItem(InventoryPickupItemEvent e) {
System.out.println(droppedItems); // returns []
}
Am I doing something wrong or am I just not thinking right?
What are you trying to do ?
Basically create an ArrayList, store an Item in the array list in the CraftItemEvent, then in the InventoryPickupItemEvent, check if the inventory holder is a hopper and the item going into the hopper is in the arraylist.
Then I assume you want to create some sort of "item blacklist" for hoppers for a specific duration
?
If so, you need to use .runTaskLater instead of .runTaskTimer
Does anyone know of a performant block pdc API that I can use? We're talkin checking if blocks inside a 500x500 block area have a certain key or not with minimal amounts of lag. I have tried using the CustomBlockData resource by mfnalex, but it just keeps crashing the server. Thanks
Just split the 500x500 check on multiple ticks ?
If your are checking block by block, you won't find any lib that does it quick enough for a 500x500 area in one tick
np :D
Guys, is there a way to make a shield that is not blocking any damage or knockback? The players still need to block with them but just visually and not physically if you know what I mean
If you can't do it by cancelling some event, you can still replicate the normal behavior by appliying some damage and knockback to the targeted player
That's a good idea, thanks
Is there an event that gets triggered when a player is blocking damage?
Probably
it worked
thanks
yw :D
Is it a block display or an item display ?
item
And Quaternion4f(angle, 0, 1, 0)
Okay so the code above should do the work
I guess
so the 1 above is Y?
I guess
I swear Block and Item Displays were the best thing they could add
Should be (angle, x, y, z)
is MC a bitch and sets angle as first?
teh Quaternionf shows w as last
it says that one is z
Hmmm
Between 0-360 or 0-2pi
Maybe shifted by 50%
Just try some values, you will quickly see
thats the left quaternion
sec I'll test here
final Quaternion4f rotation = new Quaternion4f(x, y, z, angle);
transformation.getLeftRotation().set(rotation);
transformation.getRightRotation().set(rotation.inverse());
Did not test it
x)
Try messing with parameters
Maybe it's angle, x, y, z
Instead of x, y, z, angle
As it is in the general definition of a quaternion
Is this a good way to remove something from a collection while iterating over the collection? Or is it bad to create a copy of the collection every tick?
new BukkitRunnable() {
@Override
public void run() {
for (Player player : new HashSet<>(set)) {
//remove player while iterating
}
}
}.runTaskTimer(plugin, 0, 1);```
would be odd to transpose though
second arg makes it rotate around y
(0, 1, 0, angle) you mean ?
The hell x)
however scaling is really odd. it depends on both left and right
Well, Zelda will wait I definitly need to see that
rotates around y but also scales up
I would just use the various methods to handle it
? thats what we are trying to do
Such as #rotateY(radians)
Yes?
rotateY on what?
The quaternion
The base value is 0 0 0 1 for both left and right rotation
what is left quat for?
it scales up as it rotates
Should this not keep it the same size?```java
new Transformation(
new Vector3f(), // base translation
new Quaternionf(0,0,0,1.0f), // left rotation
new Vector3f(1,1,1), // scale
new Quaternionf(0,0,0,1.0f).rotateY((float) Math.toRadians(180)))) // right rotation
this code scales it up as it rotates
yeah it works if I do it right
I had the right quat wrong
:p
no quaternion4f
i only have quaternionf
should i use it instead?
yes
ok
are you tryign to have the item spin constantly?
well this one has no .inverse
When I set the brightness of BlockDisplay above 15 what happens then?
I currently have it rotating 180
And even more important what does the skyLight do?
You can't set it above 15 iirc
does Quaternion4f exist?
why dont i have that class
why? you don;t need any of that
And what does the skyLight do?
hu guys i was wondering if there is a method to prevent normal injection
like i do add a to player permission with a string that the user puts in
but like if the user puts soomething like /command tes" + <some code to exploit>
is something that minecraft already does or i do have to prevent it manually
the quartenionf doesnt have .inverse method
Does the Bukkit.getEntity(UUID) throw a NullPointerException when it doesn't find a uuid or does it just return null?
how do i save persistent data with blocks?
Read the docs… highly unlikely to throw an npe
Thanks!
is metadata persistent? lmao
depends on the block type
then no pdc
which meta?
block.getMetaData();
yes
soo that will work fine
how do i even get Meta of a block
yeah ignore me I'm not really focusing.
No there is no persistent storage on normal blocks
there are libraries to allow it
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
that one ^
now its getting big and then gets back to normal size
oh shit
I have it spawning and rotating but it changes direction
would probably have to rotate it in quarters
does your code look like this
no
whats wrong then
Ok
one sec and I'll give you code
transformation.getLeftRotation().set(new Quaternionf(new AxisAngle4f(2.0f, new Vector3f(0f, 1f, 0f))));
Seems way easier to use the code joml give us
ok I got it rotating constantly
howw
ill test wait
Math stuff
Which makes way more sense considering that with the first approach we never used trigonometry
one last test and code is done
are you spoonfeeding me or making it for yourself?
ItemDisplay entity = player.getWorld().spawn(player.getLocation().add(player.getEyeLocation().getDirection().multiply(3)), ItemDisplay.class);
final int speed = 100;
Quaternionf quat = new Quaternionf(0,0,0,1.0f);
entity.setItemStack(new ItemStack(Material.ACACIA_BOAT));
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
entity.setInterpolationDelay(0);
entity.setInterpolationDuration(speed);
entity.setTransformation(new Transformation(
new Vector3f(), // base translation
quat, // left rotation
new Vector3f(1,1,1), // scale
quat.rotateY((float) Math.toRadians(181)))); // right rotation
},2, speed);```
thats a constantly rotating ItemDisplay
is it ij github theme?
yea
player.getLocation().add(player.getEyeLocation().getDirection().multiply(3))
why
how do i use smallfont?
aham
entity.setInterpolationDelay(0);
entity.setInterpolationDuration(speed);
do we need this inside scheduler?
How do i use the font on the right? and also how do i send unicode characters?
Might need indeed
I didn;t test it outside. I assumed the duration would count down
I put it inside but never tried it out
It might reset after one iteration
^
we gave you some answers in #general :)
because you have to go 1 radian past 180 degrees else it will reverse course for the next iteration
why 1 radian
1 degree
Yeah
why does it need 3 values
Scale for x, y and z
oh i can stretch it or something?
Yeah
Yeah
ohh now i get why it was breaking
x)
If you want to use a custom axis instead of rotating around Y axis
new Quaternionf(new AxisAngle4f(angle, new Vector3f(x, y, z).normalize()))
how do i disable an item from being stored in a chest does anyone have a plugin that does this i can look at
im new to this
listen to InventoryInteractEvent and if it is the item, cancel the move
then also hoppers, drop event etc
no i need it on y axis
Yeah but maybe in the future
how do you get the item
Wdym
Quaternionf quat = new Quaternionf(0,0,0,1.0f); is this angle x y z?
or x y z angle?
None of those
How to give player infinity potion effect?
Is there something like syncing player's inventory?
-1 duration
PotionEffect.INFINITE_DURATION
that's only for newer versions iirc
So? Latest is what we always recommend.
Tbh, that's their problem.
true ig
That only works in new versions
Does anyone have information/documentation about itemstack serializing and deserializing?
Any idea on if it's possible to do the following ((CraftCreature)this.entity).getHandle().getNavigation().a(location.getX(), location.getY() + 1.0, location.getZ(), (double)speed); on modern versions w/ the spigot api directly? It's a moveTo w/ location & speed as the arguments
If I'll do something like this
``` It'll be ok?
Should be
Ok thanks
If not, someone ping Choco to have it impl'd KEKW
Navegation API?
The above code uses NMS just to naturally move entities. I'd rather not use NMS or a library to use this functionality if possible
Unless you're talking about something within spigot already 🤷♂️
Yeah I don't think we have that
iirc the problem is the mob will override it if they have pathfinder goals
Why player don't remove from ArrayList here? After debug I found out that player add's but he don't remove on end
@Override
public void run() {
checkPlayers.add(p.getUniqueId());
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Integer.MAX_VALUE, 1));
long remainingTime = durationMillis - (System.currentTimeMillis() - startTime);
if (remainingTime <= 0) {
checkPlayers.remove(p.getUniqueId());
p.removePotionEffect(PotionEffectType.BLINDNESS);
p.sendMessage("Бан");
cancel();
} else {
String formattedTime = TimeUtil.duration(remainingTime, true);
p.sendTitle("Вы были вызваны на проверку", "Напиши ваш дискор в течении " + formattedTime, 1, 18, 1);
}
}
}.runTaskTimer(Plugin.instance, 0, 20L);
Spigot doesn’t have that. But paper do
It doesn’t really replace the path need to run custom nav each tick
Is the "Бан" message being sent to the player?
yep
all completes except removing player
Nope, if the message is being sent, then the players UUID is removed from that list.
Unless an exception is being thrown.
I made debug and it always sends true
[16:42:42 INFO]: true
[16:42:43 INFO]: true
[16:42:44 INFO]: true
[16:42:45 INFO]: true
[16:42:45 INFO]: true
If the player was already in the list, then it remains in the list
As you are adding it every tick
You might have multiple time the same player in your list
oh so i'm adding him several time every tick again in list
Oh you are adding it inside the run method. Yeah thats a problem.
Use HashSet at this point
Move it outside the run() implementation and also dont use a List.
what is better to use?
Set. It doesnt allow duplicate entries and is generally faster with remove() and contains() operations.
ok thanks
hmm. Surely it wouldn't be hard to force them to complete the move first, no?
like idk, ignoring the pathfinding goals or something like that
I have 2 projects in a single folder that is a git repo. I wanted to merge my changes into main, so I went to main and merged the changes, everything on git looks fine, but now one of the projects does not get opened correctly and I cant see any files besides the pom.xml
has anyone ever run into a similar issue?
1 project is a plugin and the broken one is just a java project that I depend on in the plugin with maven
it has worked before when I was on the development branch
Only way it goes is up
yeah I mean I think the fundamental issue is that I split it into 2 projects
definitely gonna loose a lot of things
but I thought that wouldnt be such a problem since I already had the first one in a separate folder
so essentially all I did was create a second folder in the main repo root and then moved files over there
and then added a dep in my plugin project, which works
but now the second project just doesnt wanna open
Does that plugin depend on second working plugin or viseversa?
well yeah, but right now its a mevn dependency so there is no issue with the actual plugin
the project that got borked is not a plugin
but just a java maven project
Try remove .idea or any ide folder
I think its something in intellij that refuses to see it as a proper project
omg that worked
I feel stupid now
thanks
should make it a maven module
then you don't need two git repos
just one
and both can coexist together without issues
Does anyone know how to add 3d armor to the plugin? Like backpack and all that stuff
Only spawn armor stand in the player and put on it's head item with 3d model?
Hi, I am making a plugin and I use a resourcepack for custom items, is there a way to force the resource pack or make it the server resource pack? Or how can I publish it and make the user put the resourcepack for the customn items??
what
i guess you want a server resourcepack
and yes that can be forced
to some extent
maybe ur putting the player every tick and removing every tick too
Yeah i know is like that but that can be forced with code in your plugin?
yes
How?
To force, you can use PlayerResourcePackStatusEvent, and if It's decline or something like that, you can kick player
add a captcha that the user has to enter that is only visible if you're using the resource pack 🧠
I think you can use just server.properties
there's an option to force it
the bool here
the downside to the force boolean is the client disconnects itself with an unfriendly message
🤷
:0
Thanks allot!
For me the best way to use server properties to add resource pack to player, and kick with message on rp status event
i just send it on join 🤷
Both ways are good
the thing with the method is that you can always calculate the pack hash
so i don't change anything when i update the pack
i think i am going to make a enter event and ask for the resourcepack and just use the bool variable u guys where saying to kick them if not accepted
It's ok, if you use boolean, it automatically kicks, I think
yep
So.. Do you know any good ways to create custom mobs besides mythic mobs?
wdym
There is a plugin Mythic Mobs to add custom mobs
ig you could remodel existing mobs
I heard about model engine too
What do I put in hash??
you need to get the sha-1 hash of the file
so you download it and hash it
is that a thing in plugins
Oookay am going to try it
Yeah. Plugin Model Engine & Mythic Mobs allow to create custom mobs
They are working on armor stands
ah so it just spams armour stands
Something like that
wouldn't display entities work too
Display entity?
block displays, item displays
@EventHandler
public void playerEntered(PlayerJoinEvent event){
Player player = event.getPlayer();
String texturePack = "https:url.com";
player.setResourcePack(texturePack, texturePack.getBytes(StandardCharsets.UTF_8), "You will need this resource pack for Legendary Swords, please download and use it!", true);
}```
will this work?
no
Is it a level of complex i will probably not understand?
you need to use a valid url string, actually download the pack and hash it
look it up
"java sha1 file"
Yeah. But these plugins are old. Aaand, I still can't understand how to rotate display item
rip
yeah ik the url i am just testing
so i download my own texture pack and how can i "hash" it
Model engine uses ItemDisplayEntities now btw
Oh, yeah? Its cool
Could you help me with understanding how transforming display entity is working?
What specifically?
What r u talking about? 😭, I didn't do any hash when was working with player.setResourcepack
I was trying to rotate it
Like 90 degrees for each side
then it won't update or error
Too complex for my level of code, i dont want to just copy and paste
look at my post earlier today on rotating ItemDisplays
why would you not want to
also do it on load
downloading a file on join is bad
it seems if i just do ```java
@EventHandler
public void playerEntered(PlayerJoinEvent event){
Player player = event.getPlayer();
String texturePack = "https:url.com";
player.setResourcePack(texturePack);
}``` it will work it will just not force it
But when I added to right rotation any float, it was like transforming in scale, rotation in every axios
Oh okay
it will also not update
What means update?
look at my post earlier on rotating displays
Cause i like to understand so then if i want to do changes or smth
whats the event for player load_
?
Oh 1 second
The problem is that you have a dual-quaternion transformation. You cant just rotate one of them.
if you change the pack contents, the hash changes. and the server doesn't provide one so the client doesn't care about changes and doesn't load it
in your plugin onEnable
thats a constantly rotating display
Yeah but how are the players going to download it if they didnt enter?
Wth is quaternion???
but very easy to understand
by sending it to the player
on join
Ohhh, it makes sense
you just hash the pack on server load
a subset of complex numbers with 3 instead of 1 imaginary component
Ohhh I understand it yeah thanks
and if the hash on client doesn't match the hash of the actual pack, it will just error
Mainly used to define rotations in 3D space. Might look like this:
[1.0, 2.3, 0.0, 0.3]
I need a forum post to understand, I'm too stupid in Math
Post with all explanation
Quaternions (interactive vids) https://eater.net/quaternions
Last time I heard about sha-1 is when I was searching about dehashing
Thanks
damn ok
I dont think you can work with quaternions without understanding the math behind it. I personally
prefer applying the transformations on the transformation matrices directly, because thats what i learned in my
visual computation course.
imo the easiest way is to sketch it out in a singleplayer world using axiom's display entity editor
and then copy the numbers
Well, I don't really mind to study a bit Math while coding) So I would like any video/forums to read about it If you could recommend something like this
its in one repo
I just have my repo folder with .git stuff and that has 2 folders, each containing a project and one being the plugin
I guess that is what you mean by maven module
well maven module just combines the two projects into a single project
but when its comes to modules in maven, you can open them as separate projects
oh right
so I can package or install both of them in the same project?
in intellij I mean
Can I use it also on Item Display Name?
?jd-s always check here first 🙂
paper, yes
in paper everything is components
we don't provide support for paper here tho :p
How can I use Keybind in Item Display Name in Spigot?
So not even with JSON text?
yeah
fuck it we're renaming adventure
You can either shade adventure or use paper which bundles it
what's the difference between setOwningPlayer and setOwner in SkullMeta?
which one changes the skin
both
ah
yeah, just look how spigot does it. Spigot has a parent project AKA parent pom
and both spigot and spigot api are modules
spigot relies on spigot api
you don't have to build both per-say, but you do have to build spigot api at least once for spigot to compile
ah that would be exactly what I wanna do
thanks for the tip, ill take a look at how spigot does this
if I have questions ill be back >:)
@blazing ocean
i foudn this website https://sha1online.net/
Generate the SHA1 hash of any string.
Do i put my texturepack download link?
no
you're just hashing the url then
you need to download the zip file, save it to disk, hash it and then delete it again
So what software do i use to hash the texture pack?
i have sent you a stackoverflow link
Oh yeah i thought i could hash it mannualy and just put the value
True
and that is for strings; a binary blob is not a string
As i have no idea how to hash and i not seem to understand the forum
copy & paste my beloved
it would be easier to check if accepted using PlayerResourcePackStatusEven and then kick?
Dont understand the code
Yes cause i copy and paste and it doesnt work
show your code
@EventHandler
public void playerEntered(PlayerJoinEvent event){
Player player = event.getPlayer();
String texturePack = "https://download941.mediafire.com/f2so2j65ptsgsYFEIdTO107vpJwCRiuK5v9yXmX9FdEWh496dz6OdX2RC8whhpCsJfX_f4jeXJ736-Sfw1E2eE4rImmsHBBuj913wJmZYUkSB4wuXg2m2MnKdYtMloQFJl5YSIoIMawphQ7om8qZfrEE4li-E4VNXmYxhyQU2xomEp8/jg7hsjc86ed3p6u/Legendary+Swords.zip";
player.setResourcePack(texturePack);
}```
right now is this
but you still need the hash
Its 100% needed??
the method without the hash is deprecated afaik
Thats sad
Okay so let me try the has
hash
so u told me i have to hash it on load
Yes
so i put this code public byte[] createSha1(File file) throws Exception { MessageDigest digest = MessageDigest.getInstance("SHA-1"); InputStream fis = new FileInputStream(file); int n = 0; byte[] buffer = new byte[8192]; while (n != -1) { n = fis.read(buffer); if (n > 0) { digest.update(buffer, 0, n); } } return digest.digest(); }
mediafire does not work for resourcepacks
?
wait why not
To long of a link maybe?
no
visit the link yourself
what website could i use
it's not a direct url
Oh yeah i thought it was
