#help-development
1 messages Β· Page 81 of 1
:)
I find these conversations pretty funny because some time ago I was just like this
someCoolVariable
camelCase for fields and methods, PascalCase for classes
thisMethodWillDestroyYourComputer
when in doubt just send them the java conventions page
and whoever names their generics lower case is doing war crimes
Quick question. Would the best way to make a sort of dash ability for a player be to use velocity? Also if I wanted that to do damage to entities in the pathway of the dash ability without also damaging the player what would the best method be?
yes
?naming
fail
don't we have something like that
Velocity is the only way to make it fluid client side
Don't most IDEs these days warn people about naming conventions?
And check PlayerMoveEvent to damage players
IJ does
even checks spelling
Yellow errors are nothing ;) π
Lol
?conventions
ij isnt saying anything
nice!
mhh
It doesn't allow my 'creative' naming π’
so i know we wanna shit on bad code design, any chance I can interrupt and ask if anyone knows of a way to move a player a few blocks without teleporting, like a push so it doesnt look as weird
I wouldn't be damaging the player I want to damage the entities in its path. Would that require setting up a listener for damage and setting up a method of determining whether they are using the dash ability at that time and then cancelling said event?
Velocity
Push him, as you said
vector math go brr
linear algebra boutta go off
There isn't any listener for that. Listen for player movements, compute it's velocity and check for nearby players
with velocity can you force the player in a direction though?
yea
If there is one thing I could take from C# and use in java, it would probably the ability to define custom operators on classes.
For sure
Its based on vectors so yes
yes, velocity has a direction
just apply some force and something moves
That and I would change strings to be interned.
No don't make String "primitive"
It would be optional.
lol
define custom operators
string @string;
^ is valid naming
name it charArray
cringe
for parameters at least
I usually just go with good ol' ```cs
string str;
what I would take from C++ to Java is removing OOB
does anyone know how to save file information
like I made a txt file that has all the info
but when the server resets
so does the txt file
that holds all the data
shouldn't you just make a class to store the data?
or something in code
why a txt
idk I thought that was the only way
?paste your code
The text file part
lets just use yaml
oh wait I know why
YAML is da best
Its cause I am dumb
at the very begigng of my code I do this
FileWriter myWriter = new FileWriter("areas.txt");
myWriter.close();
}
catch(Exception e){}```
clearing everything in the fi;e
file
lmao
ima try fixing that
you arent even writing
You just open and close :)
also use try with resources
oh I thought your question was how to do that πΆ
File has a method for checking that
I bet File has a method
new File(path).exists() or something like that
Gosh you're really too fast
I'm also fast in saying wrong answers so you are not useless xP
lolol
Raid 2 answers
ππ
Can someone tell me how they made this? A custom minecraft graphical user interface.
bruh
Do i come here for help lmao
Read again lmao
That's your choice :D read the channel descriptions to know where to ask
Oh π₯±
Hope so π so my mc server has aurelium skills my max health goes up but i dont regen anything what can i do
How can i create a book with multiple text lines in it?
#help-server wrong channel, here is the dev one
bruh I mistyped
Thank you!
Don't see a comment
bruh use // for comments wth this <
An interact event might not have an item.
You can get the Hand the player used, and set the item using the player inventory accordingly
is there some formula to create particle shapes?
yes
i suck at math
formula ;-;
How do I calculate a vector/how do I put the vector in the setVelocity piece? I'm setting the players velocity to move them forward a specific distance and I'm not totally sure how I calculate the velocity for the first value of setVelocity
What are you trying to achieve ?
I don't think there is a way to make a shape with particles in minecraft, you should just loop over positions and spawn particles to make a shape
How to get item on cursor in creative?
Player#getItemOnCursor always returns air
on cursor means the picked up item
Get a vector pointing to their forward direction and scale it by the force you want to use
not the item the player is hovering over
I know.
oh
I'm asking how I get that vector...
always air? what?
Yes, in creative it shows as air
Player#getDirection
normalize it and multiply to scale
Yes
realtalk what particle looks good
For what case ?
x)
this is the documentation, idk anything else why it would be Air
The crits are great
(below 1.19 btw)
I don't think the server knows what's on the cursor in creative mode
wait when was glow squid added
The client essentially tells the server what to put where
1.18
Oh that is true...
why is that not in the docs
creative mode inventory is client side
I created a txt file to hold all my data, but idk where it is created when I run the jar??? Can I just not acess it?
Cause mc protocol is funny, you have to experience it urself
lol
it's very janky so I just don't allow most of my stuff to work in creative mode
wait nvm I found it
yeah with custom items and all it's really annoying
i would sugget you creating on gamemode instead
using packets..
i think editing existing gmod is really limited
Ok I'm sorry for asking so many questions I know very little about vectors. I'm trying to get the vector and currently I am trying to use this to calculate the vector(Sorry I haven't done this before) Vector.normalize(Player#getDirection); but it tells me that I can't use that in a static environment when I try and place that inside my event.
better just make some guis remove health bars, and etc using packets..
Player#getDirection#normalize
Vector v = player.getDirection().normalize();
bruh Wolf
the docs about vectors are really clear
declaration: package: org.bukkit.util, class: Vector
I've been reading those they were not very clear
1.16.1 is 1.16 right?
no
they are
very clear
whats not clear here
tell me please
What? I'm just trying to help...?
which part you didnt understand?
nah bro its ok
that person cant understand docs
not sure what he will understand from the line you gived him
u sure?
That seems a bit rude to put it like that. Not everybody immediately understands something just by reading up a little on it. It's unfair to assume that.
but it'll work on 1.16 right
it means they didnt do their java homework before
or math homeworkk
vectors docs are very clear
maybe the person have no clue what are vectors as well in first place
;l
in vanilla 1.16.1 players cannot connect to 1.16 servers, the only version to do that is 1.16.5 to 1.16.4 servers iirc
but that's a #help-server question not a #help-development question
It's ok to start somewhere. I started programming on java at 11 yo didn't even knowing what a Vector is
_Royln its not about it...
In my opinion it's better to try and explain it more than to bash them for not understanding the docs?
its about person who googles how to
basically X Y...
he will ask how to do this when he doesnt know how to do the other thing in first place
I knew more or less what a vector was the problem was I have done little to nothing with vectors ever. I had asked previously and i'm quite new to java so I'm still learning a lot about how everything works.
Wolfy he should learn to understand stacktraces instead of posting posts about what causes the issue without provoiding a code
you understand
first time , like in math trial and error
to understand some concepts
If you know what is a Vector then the Bukkit's Vector will be easy to understand
its the same vector
spigot is bukkit fork
for god sake
Yeah
But the Vector comes from Bukkit didn't they ?
Too old
im confused bruh you should be familiar with bukkit then
That's why I use Bukkit dude
back then in 1.2.5 bukkit was the only thing out there
alright old man go back to bed
I still stand by my opinion to be nice and teach them, help them learn. They wont learn anything if you just say "Ah well you just can't understand the docs thats too bad..."
Learning takes time
you know how many idiots come here
like for real
XYProblem..
thats the issue
im here to support
link docs
he dont understand english
you were probably as dumb as 'these idiots' when you started
send him to english class
true
wait no
i actually learned java first
and then the api
When I put that in and look on the docs it says that is incorrect. From what I read I need to put a location for it to check. Would adding .getLocation to that(so p.getLocation().getDirection().normalize();) work still or do I need to keep looking
only
i dont think a person who cant understand docs learned java
the docs are written in the most clear way in the world
Alright, well you can have your opinion and stick to it i guess, I will still try to help when I can. lol
help no problem this person gonna ask every single thing
I learned by copy pasting from YouTube videos
you will code his plugin
what did you learn, copy pasting?
I was confused partly because I was misunderstanding what they wrote as well.
thanks for asking your question! A developer will be with you shortly!
Explain the best you can with the info you are given and tell them how they could be asking the question better, this is usually what I try to do. I don't code plugins for people without payment lol, all I did was write one line of code which summarizes the idea.
wolf i send the docs here
they answer on his questions
all you do is read it and explain it to him
in different way
he should understand the docs
or not use the function at all
im not here to unmotivate people and etc
i just try to put them on the right way
he cant take shortcuts...
Like I said, sometimes people need a little extra help understanding, it's not fair to just say "Oh well, you can't code I guess because you can't understand something that most people can."
I think this is a silly argument
Let people who are helping just help their way -_- even if it's the hard way
I agree with this
Do you have kids ? x)
nah
not yet
i might get later
i think like in 5-10 years
Can we please just end this argument? Also other question. What value do I need to put in as a velocity? Based on the docs the setVelocity requires two inputs, a vector and the velocity. I tried putting a int and double but neither are working and I don't see things in the docs explaining this.
when i get an house
Try begin more friendly, kids that are taught that way live a sad life
Or is it that its one value and I need to incorporate the speed in the vector?
if a kid will never eat chocolate he will never want
learn some psychology
what you say seems funny
I think he is just trolling at this point lol
im very friendly person either
look at the channel name and if you don't see #arguing just stop or leave
reply to Mc Lever
Copium?
who?
I think you just don't understand how to live in a community. I'm a mathematician, I like logical stuff, I like when things are true or false so your teaching method is the one I like. But there are others in that world. You're not the only one in that planet, not everybody thinks like you.
So stop imposing your mindset, it's maybe good for some, but not for others.
If you're not happy with how Wolf teach, just ignore
your brains are less devoloped
its pointless...
thats logic
a kid will be not sad
omg
he will be used to it
timar this is what you do when your parents argue?
thats the point of discord
useless talk
yup, I don't wanna be as miserable as you
I thought the point of discord was to discuss topics in the proper channels because those are the rules of the server
i put an commentary didnt tell him what to do either...
do message u a msg
since u dont accept strangers
lol
Arguing continuously against it is telling him what to do. I understand you may have a tuff life but try being cool with others
i wanted to say its pointless
the guy with vector issue still didnt get an answer
and each question leads to different question
@mighty aurora
do you mind to answer some simple questions to me?
ill write a simple code
and if people have the patience to get through them what tf are you still doing here
and tell me what it used for
private void init() {
hostname = plugin.getConfig().getString("hostname");
port = plugin.getConfig().getString("port");
database = plugin.getConfig().getString("database");
username = plugin.getConfig().getString("username");
password = plugin.getConfig().getString("password");
}
now why this method is private
and what does "void" means here
its really simple
you have 30 seconds.
no one dont answer please.
tf?
if he gives correct answer i will apologize..
It is not a school of Java here
so please stop and go out
no man you help man who didnt study java even
Private is so that you can't access it elsewhere as it contains data you only want accessed here. Sorry but right now I can't remember what void means.
drink some water, breath some fresh air
.
he dont remember what void means
for god sake
Void it what it retursn
if it was private String
it would return a string
now guys
go help him
its pointless
let him learn java first
11/10 teacher skills
My brain forgets things ok
Yes and that's normal because it takes time
no
took you way too much time
because I was typing...
man
Not everybody is gonna go to college to learn java to make minecraft plugins, lmao what?
How do you expect him to learn? If you are just basically making him look like a fool because he is new?
All you are doing is scaring him away? The learning space needs less of that energy.
typing this for 1 min
collage is not required
simple know eldge
its the basics
I had to rewrite a section because I messed up
Doesn't matter anyway people will believe what they want to believe.
lavaking i just suggest you to learn java first
you wont understand shit later
if u dont learn java first
u will write static jebbrish
you dont want it
Again, if people are willing to help, just let them
That's it, just say that, it's good, now stop
You don't need to understand the entirety of java, just learn it bit by bit like I did. For me it was easier that way.
who wants can help him
WOlf
he doesnt know why Void was here
are you serious
its like basics of basics
i literally said I forgot...
stop
you cant forget that
guys stop
...
Okay why the hell ghost-print vagdedes?
You can when your quite new to java...
That was like the REALLY wrong choice to do
Indeed
I have a problem with how it seems like you are publicly shaming him right now, he is learning, it takes time to learn to program. It's a complicated subject, the only thing you are doing is deterring him...
I can't believe I just caused this large of an argument
shhhh
over a question
break;
It was technically I guess me that started the argument by "giving you the answer" lol
wheres context
?jd-s
new ItemStack(material)
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#item I mean you can use refections
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
no, it's a new item stack with that material
But uh why would you do that?
He's trying to ask how to set an item stack to the current item, not a material
@quaint mantle just fetch the player inventory to set the itemstack, the event is not the instance to use
All I know is you are using PlayerInteractEvent, give more context
What value do I need to put in as a velocity? Based on the docs the setVelocity requires two inputs, a vector and the velocity. I tried putting a int and double but neither are working and I don't see things in the docs explaining this. Or is it that its one value and I need to incorporate the speed in the vector? This was asked earlier but lost in the argument.
you can get the material from an ItemStack using getType()
declaration: package: org.bukkit.entity, interface: Entity
From what it looks like to me, setVelocity only requires one param?
vector
Nah, he misinterpreted (Vector velocity) as being two args
ok thanks. now how do I determine the actual speed at which the player will be moving after having set the velocity?
Vector being one type and velocity being the other
Ah, Vector is the type. velocity is the name
Correct
vect: Vector moment
It's litteraly the velocity that tells the speed
The length of the vector is the speed. Which is why you normalize the vector (reduce it's length to 1) and scale it to the speed you want
You likely need to normalise the vector
And now you scale it
But uh I never did much of the vector buffoonery
meaning if I wanted it to be less than 1m/t 20m/s then I would need to scale it down?
declaration: package: org.bukkit.util, class: Vector
I would think that velocity would be per second, but I'm not sure
Just try it out I guess
in the setVelocity it specifies meters per tick
Then it probably is that
Where do you get that setVelocity method from ?
I'm working in 1.19
There is probably a function to get the tick speed of the server, take the speed per second you want and divide it by the tick speed
I mean from which class?
Yeah
I'd not scale with tps
this can be unreliable especially on laggy servers
And is more complicated either way
What would you suggest as an alternative?
I sincerely hope I didn't mess up anything I wrote. Also I was trying to use one of the tutorials to learn/make a cooldown system but it doesn't appear to work. Tutorial in specific is https://www.spigotmc.org/wiki/feature-command-cooldowns/ Does anyone know if this still works? If so would someone be willing to help me troubleshoot it?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Assuming that 20 ticks = 1 second
Don't scale
Why would it not work?
Ah, no I meant to get the target tick speed, servers can change the target speed I think so it would be safer to do that.
And if so, how does it not work?
Not the current tick speed my bad
Making a cooldown is basically remembering the last time the thing was used, and comparing with the current time (basic difference)
Yeah and you store that value in a hashmap usually right?
In that case, it would be safer to assume that 20 ticks is a second, yes.
Hence there will not be target tickspeed method
Depends on how you'd like to work
Can you explain?
rendering moment
No parchment mappings :c
tbh i have no idea what that is
Community made mappings for parameter names
Rendering the main reason I stay strictly on CLI & Serverside development
π π
It's just not my cup of tea
i wanted to do some rendering in rust but its so long ago that i did rust
Yeah I remember when I did rendering in my forge mod
I forgot to pop the matrix stack
Whole world rendering got messed up
oh god
How can i create multiple configs, like a config.yml and a playerdata.yml
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
Slow bot
Vectors are numbers right
Like if you were to print one it would show up as a number
does calling CompletableFuture.runAsync(() -> {}, Runnable::run) has the same effect as CompletableFuture.runAsync(() -> {}).join() by both blocking the thread it runs on?
not talking about whatever overhead
Is their a way to give players a sort of thorns ability without enchanting their armor or otherwise? As in they will deal damage to anything they touch. By the same way how do I cancel any damage reflected back at them
i found this precious chunk of code
public static List<Location> getSquare(Location corner1, Location corner2, double particleDistance) {
List<Location> result = new ArrayList<>();
World world = corner1.getWorld();
double minX = Math.min(corner1.getX(), corner2.getX());
double minY = Math.min(corner1.getY(), corner2.getY());
double minZ = Math.min(corner1.getZ(), corner2.getZ());
double maxX = Math.max(corner1.getX(), corner2.getX());
double maxY = Math.max(corner1.getY(), corner2.getY());
double maxZ = Math.max(corner1.getZ(), corner2.getZ());
for (double x = minX; x <= maxX; x+=particleDistance) {
for (double y = minY; y <= maxY; y+=particleDistance) {
for (double z = minZ; z <= maxZ; z+=particleDistance) {
int components = 0;
if (x == minX || x == maxX) components++;
if (y == minY || y == maxY) components++;
if (z == minZ || z == maxZ) components++;
if (components >= 2) {
result.add(new Location(world, x, y, z));
}
}
}
}
return result;
}
what do i do with the result?
i tried looping thru array items
for (Location loopLoc : getSquare(location.add(1, -1, 1), location, 1)) {
receiver.spawnParticle(Particle.valueOf(config.getString(configValue)), loopLoc, 5);
}
like this
What are you trying to do?
im tryna spawn particles in cube shape
error says java.lang.IllegalArgumentException: The provided key for the custom value was null
That would mean that its not giving a result
Where is the error?
What line?
Hi if im using Mongo pojo's do I need to make a codec serializer for the pojo class?
Depends on the serializer you are using. There are a couple of default codecs that can do quite a lot already.
I ask because when I save a pojo class mongo doesnt know how to save it
Idk if i need to explain this but...
That why I having data errores when sever get restart es
Color is from Java
Tomar do you have mongo docec experience?
what would u suggest to do
You can use mongojack for example. It uses Jackson as a mapper.
Nop sorry
π thanks
I personally use my own codec implementation which is simply backed by Gson
Yes it has
void loopBlocks(Location firstCorner, Location secondCorner, double particleDistance, Consumer<Location> locationConsumer) @onyx fjord
Smile, so you are just saving a Json string ob mongo right?
i remember the time someone was saving json in a mysql database
No i convert my json string to bson.
Its literally just
Document bson = Document.parse(jsonString);
tf is a consumer
Ohh ok
I will keep that answer
Thanks smile you are one of the ubiques that use mongo pojos
i want to change a nether star with a custom texure data's texture to another how can i do that in the resource pack side
google time
i did this
it basically allows you to pass in some kind of action
and the file is here
no
if anyone actually worked with custom models please reply
blockbench π©
do you have the file "minecraft.models.item.heart_item.json" aswell?
Example for an acacia boat.
\minecraft\models\item\acacia_boat.json:
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/acacia_boat"
},
"overrides": [
{
"model": "minecraft:item/acacia_boat/1",
"predicate": {
"custom_model_data": 1
}
}
]
}
\minecraft\models\item\acacia_boat\1.json
{
"parent": "item/generated",
"textures": {
"layer0": "acacia_boat/1",
"particles": "acacia_boat/1"
}
}
The image is located in
\minecraft\textures\acacia_boat\1.png
public void execute(CommandSender sender, String[] args) {
if(args[0].equalsIgnoreCase("antivpnreload") || args[0].equalsIgnoreCase("avpnreload")) {
if (sender.hasPermission("chat.reload")) {
data = new File(dir, "whitelist.yml");
saveC();
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&aWhitelist reloaded!"));
} else {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cYou dont have permission to execute that command!"));
}
}
}```
it says command not found
@SuppressWarnings("deprecation") is often a bad sign
Did you register your command on the plugin.yml and onEnable ?
plugin.yml yes
onEnable does it needs to?
ah
what if i need that command's code in my main class?
filename: nether_star.json
whats wrong
Yes you need to register commands in your onEnable. You need to apply the CommandExecutor to a command.
The only exception is if your JavaPlugin class overrides onCommand()
You need 2 additional files. A json file which defines a model and a png file which defines the texture.
Can anyone answer this question? (just dont want to have it lost)
yes i said i have it
and this png
Listen to events and do some programming. This should be really simple.
Thats not enough
ok what is wrong then!!!
You need 2 additional files. A json file which defines a model and a png file which defines the texture.
Take a look at my example. It has a total of 3 files.
how to make multiple extends?
You cant
so how can i make command listener in my main class then?
Your "main" class (which should never be named Main btw) should only extend JavaPlugin
extends JavaPlugin implement CommandExecutor
JavaPlugin is an instance of CommandExecutor.
But i would strongly advise you to make a separate class for every CommandExecutor.
Not needen. JavaPlugin already implements it
The JavaPlugin will be automatically registered as a CommandExecutor for every command defined in your plugin.yml
Which is just dirty
models\item\nether_crystal.json:
{
"parent": "item/generated",
"textures": {
"layer0": "item/nether_crystal"
},
"overrides": [
{
"model": "item/heart_item",
"predicate": {
"custom_model_data": 1563587
}
}
]
}
models\item\heart_item.json:
{
"parent": "item/generated",
"textures": {
"layer0": "is this guy my png name in assets ???",
}
}
@lost matrix
Yes that is the path to a texture you want to add. Usually you just have one layer called "layer0"
No they werent. They were missing a whole file. And inside this file he needs the layer.
You are missing a 't'
Doing custom models and textures makes me hurt internally
I just wrote a generator once and now all i have to do is throw images in a folder and write one line of code which defines how the model looks like
no
I used to make custom 3d models for people with block bench and put them into resource packs for them
Very long process very annoying
i just need ONE png
Quick question. If a player isn't moving is their velocity 0 or null?
This looks right. Set the custom model data to 1 and make sure you get yourself the right itemstack
Ah i see a problem. In your heart_item.json there is a colon after "...heart_item"
I have generated it using DALL E 2. I got in as a developer for open AI open source projects π
Congratulations (:
I'm not seeing how I can determine the entity/player that is damaged using EntityDamageByEntityEvent. Anyone know how?
resourcepack moment
just event.getEntity()?
Congratulations
Wouldn't that get both the entity that caused it and the entity that was damaged?
it returns 1 entity
It gets the Entities Invovled
It returns the damaged entity not the damaging entity right
correct
if you want the entity that did the damage, do as stated earlier, event.getDamager()
EntityDamageByEntityEvent can provide both the defender and attacker
anyone got any idea for the resource pack thing ?
I'm trying to use this to prevent a player from taking damage when they are doing something specific. Also by the same extension I want it to also damage entities that attempt to damage the player in this time. I can't seem to figure out how to set the damagee. Or do I need to do something else to damage the entity? It won't let me do entity.damage btw
getEntity()
hello does anyone know how to properly disable using number keys to move items inside inventories bc checking if getClick == ClickType.NUMBER_KEY doesn't work
That's on the docs of LivingEntity
Just started making plugins again and i have made a wand that shoots a particle in a line for 10 blocks i want to make it so if there is a entity within that 10block it takes damage.
How can i detect if there is a entity within the particle line
public class WandEvents implements Listener {
@EventHandler
public static void onRightClick(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
if (event.getItem() != null) {
if (event.getItem().getItemMeta().equals(ItemManager.wand.getItemMeta())) {
Player player = event.getPlayer();
Location origin = player.getEyeLocation();
Vector direction = origin.getDirection();
direction.multiply(10);
Location destination = origin.clone().add(direction);
for (int i = 0; i < 10 /* range */; i++) {
Location loc = origin.add(direction);
loc.getWorld().spawnParticle(Particle.SWEEP_ATTACK, destination, 1);
}
}
}
}
}
}```
Well you have a position for each point, no? loc?
yes i have the beginning and end point locs
Right but you have each point between those positions too
That's what your loc variable is
You can check if that location is inside of the bounding box of nearby entities https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Entity.html#getBoundingBox()
yes i guess within the for loop i do
Also relevant, you can probably get entities in a 3x3x3 or something, then check their bounding boxes
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getNearbyEntities(org.bukkit.Location,double,double,double)
Ignore the player if you want as well, else it will hit them too ;p
public static void getSquare(Location corner1, Location corner2, double particleDistance, Player player) {
World world = corner1.getWorld();
double minX = Math.min(corner1.getX(), corner2.getX());
double minY = Math.min(corner1.getY(), corner2.getY());
double minZ = Math.min(corner1.getZ(), corner2.getZ());
double maxX = Math.max(corner1.getX(), corner2.getX());
double maxY = Math.max(corner1.getY(), corner2.getY());
double maxZ = Math.max(corner1.getZ(), corner2.getZ());
for (double x = minX; x <= maxX; x += particleDistance) {
for (double y = minY; y <= maxY; y += particleDistance) {
for (double z = minZ; z <= maxZ; z += particleDistance) {
int components = 0;
if (x == minX || x == maxX) components++;
if (y == minY || y == maxY) components++;
if (z == minZ || z == maxZ) components++;
if (components >= 2) {
player.spawnParticle(
Particle.REDSTONE, new Location(world, x, y, z), 1);
}
}
}
}
}
i saw
any idea why this might break on low coordinate differences?
it ends up half undone
Particle distance too large maybe
How low you talking? Could very well be a specificity issue
e.g. if you're working with a distance of 1.5 on each axis, but your particleDistance is, say, 1, you're going to have a rough time
Event handlers can only have one parameter, the event
You get everything from the event
Right. instanceof check and cast
its set to 0.1
Yeah, I've a feeling this is just a matter of not being exactly ==
Well that's not what you want
if (x == minX || x == maxX) components++;
if (y == minY || y == maxY) components++;
if (z == minZ || z == maxZ) components++;```
oh
ye i found the code somewhere on forums
It's not great
i suck at math badly
Right, so going back to
e.g. if you're working with a distance of 1.5 on each axis, but your particleDistance is, say, 1, you're going to have a rough time
do you know any better code that can do what i want?
Get the corners of the region
Draw lines between all corners that share a coordinate
Because the current way you're doing it, you iterate over every block in the region
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
That still won't work
It's very inefficient
no you listen
the space of square is 1 block anyway
Not sure what you mean by that
i gave you a link to look at
@quaint mantle don't thumbs down that
Don't expect people to explain things to you that have been explained a thousand times
We're not here to coddle you
Read
It's part of life as a developer, you will need to read docs and guides
i think he wants to stop developing now
another one to add to the blocklist
cant you just work with ints instead of doubles
havent really been following so idk
how can i storage data in a file like userdata.yml where it saves like:
Players:
- Player, 200, hey1
who didnt know what public "void" < void means...
and i told him learn java first
and got muted for an hour
Read what was linked to you
it means the thing below End dimension
it means it returns nothing lol
i know bro im joking
bruh xd
but did i lie? no
but 1 hour mute fr
btw i asked what is private as well he manange to find an answer at google
we came to it afterwards he said he cant understand what docs are saying...
k why are END_ROD particles feaking out
for (int i = 0; i < 10 /* range */; i++) {
Location loc = origin.add(direction);
loc.getWorld().spawnParticle(Particle.SWEEP_ATTACK, destination, 1);
List<Entity> near = loc.getWorld().getEntities();
for(Entity e : near) {
if (e.getLocation().distance(loc) <= radius) {
e.damage(3);
}
}
was .damage deprecated?
No you were muted because you were being toxic
hold my beer
:/
You need to check if it's damagable first
Not all entities can be damaged
That would do what exactly? Check to see if the player does the damage and then set the players health to 0?
The hell
That code won't work
looking thro the code of supervanish
Player player = event.getplayer
I was reading that and was like "da frick"???
player.sethealth(0)
yeah
@onyx fjord i leave the chat 2digits citizens are back..
The whole goal was damage an entity. That code wouldn't damage an entity it would kill the player...
which entitys can you not damage ??
Nonliving ones
^^
π
Go damage an arrow
you better be kiddin me
Those count as living
Zombie implements LivingEntity
yh zombie is still "living entity"
and even after i check if its living entity it doesnt answer my question of how do i damage it
nvm
for(Entity e : near) {
if (e.getLocation().distance(loc) <= radius) {
if (e instanceof LivingEntity) {
((LivingEntity) e).damage(3);
}
}
}```
I don't think there is a damage method, I think you need to get it's health, subtract from it and set it back.
check instanceof before calculating disatance
Nvm I'm dumb I guess lol
same ig
Ik its bad practice but is there a way to just live reload my plugin with out constantly stopping my server
Yes, I already noticed but thanks
This is the problem I am having
For developing it's fine. Just be aware of the problems it might cause
Yes their is an article on spigotmc under plugin development called intelij plugin debugging
i got it working...
Why would live reloading be "bad practice"?
im creating a custom item
i want to set the texture to the heart texture for particles
what should i put
google it
thats resource packs...
google got nothing
Unless you are live reloading in a production environment, I don't think live reloading could be considered bad practice.
but then i will have to place 1 particle per meter right?
where?
no
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
get the customData vaule
i want to use this texture
refers to the textures/item folder iirc
its not coding fr
im not doing any java
im making a resource pack
ah
i copied that
this is what is changes to
it can change in to a gold ingot
but when i do particle/heart
not working
it works
no
but for the heart texture
attempted to register an invalid EventHandler method signature "public void us.newrealms.timebounditems.darkMist.damage(org.bukkit.event.player.PlayerMoveEvent,org.bukkit.event.entity.EntityDamageByEntityEvent)" in class us.newrealms.timebounditems.darkMist I just got this error. What exactly does it mean?
Why are you trying to take 2 events in one method
^
You need to point it to a model not a texture
ok how
what model should i point it to
!paste
Make one for your item
/paste
?paste
how
there is no tutorial for it
its all blockbench
for changing it to a big ass sword or whatever
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/iron_nugget"
}
}
for example
mine should be
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:heart"
}
}
?
Try minecraft:particle/heart
when i was trying to make my own cf like class
I'm creating a dash ability and its meant to detect when the player is dashing and also if the player takes damage. This is so that I can cancel damage done to the player. I also want to do damage to the entities the player collides with so because I don't know how to detect entity collision I am simply making it so anything that attacks the player takes damage. To do this I needed to listen to both events. Unless it would be better to instead have it listen for damage check the players velocity(to determine if they are dashing) and then if they pass the check to do all of what i said before(cancel damage and then deal damage back).
they should be in the same file
and like this ?
You can't do that
Take two events in one method, I mean
Would what I said work then of listening to just the entitydamage event and going off that?'
when the player is in a "dash," somehow track that
That's the best solution
I check that by checking their velocity
Keep a map or set
then when they try to take damage, see if they are on a list and cancel based on that
yay thanks
Track it properly
go to your special ModelData File
and put parent as it ModelData file name
Not in the Item Model Data
it should load your Model data from the file itself
(only if you want that else it will minecraft:item/generated vanilla)
The dash is supposed to last less than a second...
So basically I would be adding something(say a pdc) to the player wait 1 second and then remove it again
Wouldn't something like a dash be better off with a hashmap instead of PDC? PDC is for persistent data dashing is more temporary
Use a set or a scoreboard tag
hehe i once added pdc entries to a player and wiped the server world files to reset the world and then i wondered why the player data was gone π€
why not add them to some sort of list?
if it is temporary memory
A set is a list where the same item can't be added more than once.
It's also cleaner if you need to iterate over it
It guarantees that an item cannot be evaluated more than once in a foreach loop.
Quick other question if I use wait() in my code to have it wait before removing the player from the set would that stop anything else in the plugin or just that specific section of code? I think it would just stop that section of code but after reading the description on it(because intelij doesn't like my use of wait) it sounds like it would stop the whole plugin
do not use wait
^^
use the bukkit scheduler
OH a set
thanks for that information
me having a bunch of ifs
what happens if you do add same thing to set?
ignores it?
In c# the add method would return false, in java it might be the same or it throws an exception...
Yeah, so probably returns false if it was ignored
would it throw error?
no
it does return a boolean, that is neat to know
Any idea why Material#matchMaterial(String) works fine in my IDE but will return null on the server?
Are the strings uppercase?
yes but that shouldn't matter anyway
good! I will remember this for future use
My bad, I initially read that as getMaterial and not matchMaterial
What input are you providing it?
The first and most obvious reason could be that the material you are trying to reference doesn't exist on the server
How do I use the database: true in the plugin.yml
thats a thing?
ask choco
I have no idea how true this is but https://bukkit.fandom.com/wiki/Plugin_Databases
Do I ping choco or just wait for him to read
if you want him to read it, ping him. if you dont want to ping him, ask in paper. the devs of that intellij plugin are in there
I'll ping him hoping that he doesn't get mad
@worldly ingot ||sorry||
It was removed. Doesn't exist anymore
Plugins used to be able to use a NoSQL Ebeans database but we removed the dependency because practically nobody at all used it
Okay
that seems a really odd feature
Yeah, believe it or not, all CraftBukkit servers had a local database lol
Would've made life easier, however I got an idea for a work around:
Use local file unless db is specified
Yeah
It fails at gray_stained_glass_pane and the server is 1.19
π
Ah so a couple of years
does anyone know of good examples of plugins that manage a lot of messages in config
or have any ideas on how to manage hella messages
AttributeInstance armor = player.getAttribute(Attribute.GENERIC_ARMOR);
armor.setBaseValue(bonusToughness);
just making sure this is how I would add bonus armor to a player right. and wearing armor is additive to this value?
Found the commit. Removed in 1.12. I was close
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/eb2c1f23e6e5eb09d118be85c860832c528c78c4
Can I technically run my own Ebean server then
would that be a good thing or a bad thing
Should I? or should I just add a config for db
You would need to do both. Again, Ebean is an ORM. It's basically a way for Java to map an object to an SQL supported structure
Hence ORM, Object-Relational Mapping
You could use SQLite or something. Whether or not you prefer using Ebean is up to you. I personally hate ORMs. I find them clunky. But others swear by them
But Ebean on its own is nothing. It needs a database
Oh ok
If you Google for a bit of Ebean documentation you'll kind of get what I'm saying a bit more
Pro tip: Press Insert to enhance user experience on intellij
Insert has its uses. I'm just to stubborn to take advantage of it :))
I now have another question: How would I be able to start a lightweight db within my plugin? Could I just use a .db file and JDBC driver for it?
SQLite yeah
Alright, thank you! :D
SQLite is good for if you need to store data that's not cross-server
It's fast but only supports single thread access
Yeah, btw still haven't added brigadier support, sorry xD
Oh, nice
Scrapped it because I hate brigadier
Brigadier is nice
brigadier has optional args?
Trying to build abstractions on it is a nightmare
I remember it did
It only has nodes
Oh well yeah
You can create optional arguments
you can make it yourself
But the way you do it sucks
Here's the code I wrote for brig support if you want to try your hand
I'm probably not going to bother
The benefits aren't worth it
lol
Don't
Obfuscation is dumb seriously just don't
I promise your code isn't special and people aren't gonna steal it
^
I was also like that, however I realized my code is shit and has been done countless times
I much prefer to write it myself
Since them I am depressed, but at least I have no problems sending stuff
No reason to be depressed about it
It's a joke
Ok
lol
100% serious
My code be like: Random operators go brrrrr please get the right numbber
Most of my code is just on github
One day ur code will be mineπ
With MIT license
I basically encourage people to steal it
Credit is appreciated but not required
Today I just had no idea what do to, so I just put stuff at random and came up with x * maxY + y + (1 * (x + 1)), somehow it works perfectly
hmm, i always wondered how that whole gpl inheritance thing actually worked
It doesn't if it's not enforced lol
i usually go with MIT, but i think my MC plugins are sometimes GPL as well
If they really get annoyed that my library isn't GPL I will change it
But I like MIT a lot better
And nobody's gonna say shit about it lol
i mean yeah, its basically the bare minimum tbh
?buildtools
Yeah it does
Good luck
