#help-development
1 messages · Page 2016 of 1
The coin removal isn’t causing the crash
Show some code plz
I do suppose we should have asked which mc version they were using. Because if it is obsolete in newer versions then it would explain why they are getting the assert TRAP if that is case, because they are on an outdated version XD
That’s why I’m asking about N
ItemStack removeItem = item.clone();
removeItem.setAmount(1);
p.getInventory().removeItem(removeItem);
Wrong method
That’s still not why it’s crashing
declaration: package: org.bukkit.inventory, interface: Inventory
oh alr
Alex's curiosity intensifies
Imma look up what N is and not post it
@lost matrix now its taking an item 1 by one and after the last one, when there is no more items, crashes
Stack trace pls
ItemStack removeItem = item.clone();
removeItem.setAmount(1);
p.getInventory().removeItem(removeItem);
whats weirder is that its taking it from other stacks
That’s not weird
That’s what that method does
oh
ah
@quaint mantle follow the link I sent you and do it please
Specifically the “deobfuscating” section
Btw using the method like this is quite expensive.
sounds like you didn't properly set the condition for when the loop should exit XD
or, you are making use of updated methods thus a loop not necessary
Used FileUtils, but doesn't copy the world contents.
So it copied the directory without any children? Also FileUtils is part of appache commons which is not present in spigot anymore.
@brave sparrow Found it, N is actually a crash report value
It means that the item was attempted to be set to null basically
Thats all N stands for
And it seems to only happen under certain circumstances
@quaint mantle seems like you’re trying to set it to 0 somewhere still then
if i have 1 of an item
and i remove 1 of it
been changed since 1.17
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
it sets to 0
Show me
ItemStack removeItem = item.clone();
removeItem.setAmount(1);
p.getInventory().removeItem(removeItem);
if items amount is already one
and we remove 1 from 1
its gunna equal 0
Ok so that’s not the issue
Can you deobfuscate the entire crash report
And send it over
With the link I sent you it should tell you how
that confused me so i revese searched the error
and translated some chinese mc server site
and found info about the error
lmfao
using proguard
The problem here is that the ItemStack is used after the event fired. And if the ItemStack is then null even when
its expected that the clicked ItemStack is not null then we get this kind of error. So my suggestion is:
Either cancel the event or cancel it and remove the items one tick later.
?
obfuscation is not being used
the error being thrown is in obfuscated code of the server
@lost matrix WAIT I SEE WHY YOU HAVE TO CANCEL IT NOW
cause its trying to interact at the same time of using the item
Yes
SO if its removed at the exact same time
Ah JD finally got it 🙂
Lol
it crashes due to it not being able to process it correctly
fuck im an idiot
i stg
that took WAY to long to click in
Just saying if I had the damn crash report deobfuscated I could’ve told you that 20 minutes ago
😂
:(
well, to be fair I did state why assert TRAP gets thrown
First ive heard of it, must be a spigot addition since it’s nowhere in the original code that I could see
It is part of annotations
@NotNull
ItemStacks are not supposed to be null
You can cause them to be null for a final state, and that is where the assertion error is coming in
sorry for being an idiot lol
ItemStack doesn’t have @NotNull in the code I’m looking at
for me it does!
same thing with .remove and .removeItem
and similar functions related to ItemStack
which kinda makes sense
Not talking about spigot code lol
It is the spigot code throwing the error because of annotations
All I can look at from mobile is the Mojang repo which is why I wanted you to deobfuscate the crash report for me
Ah I see
That explains it
oh
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
why is it that this version works but no others do in pom.xml?
Did you run the buildtools for those versions?
^ You have to run buildtools for each version you plan to use
so to recap how assert TRAP gets thrown as it is an assertion error. It is from annotations where in the api something has @NotNull. Java doesn't care about objects being null, so as long as you are not trying act on the null object itself. As long as that isn't the case you don't get an NPE. However in the case above, the final state of the ItemStack was it being null. That is everything in the code acted on the ItemStack while it wasn't null, but the final product was that it is now Null. Because of @NotNull for the ItemStack, annotations throws an error as it violates what the API stated for it.
hope that makes sense, and now have learned what assert TRAP means 🙂
if I do it with buildtools it says no packages exist when I use NMS things
I have it set up the same way in 1.18.1 and that one works, but not for 1.17.1
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
read the post
it will tell you the appropriate way to do NMS things and what needs to be added to the pom. And other helpful related things
I should've clarified, I've gotten 1.18 to work fine, but I'm having issues with 1.17
these are red for some reason
there is a post that directs to 1.17 and its the same for it too
so, basically what you did for 1.18 you also do for 1.17
How would I prevent a custom item to be used in crafting recipes?
EX: a nether star
PrepareItemCraftEvent -> iterate through matrix -> set result to null
ty
I put my .jar file in my plugins folder, but when i run "/plugins" it says there are 0 plugins?
Then you did either not restart or there was an exception while starting
I did /reload
yeah. no. Read whats written when you do /reload. Its not a supported command and you should basically never use it.
@lost matrix How would I iterate through a matrix?
ok
Its just an ItemStack[]
so
Recipe list = event.getRecipe();
I restarted my server, still nothing.
Any exceptions in your console?
nope
@EventHandler
public void onCraft(PrepareItemCraftEvent event) {
for (ItemStack itemStack : event.getInventory().getMatrix()) {
if (isForbiddenCraftingIngredient(itemStack)) {
event.getInventory().setResult(null);
return;
}
}
}
private boolean isForbiddenCraftingIngredient(ItemStack itemStack) {
if (itemStack == null) {
return false;
}
// Do some checks here
return false;
}
shouldn't one of them be true?
On default nothing is forbidden. So i just returned false.
I think you would do some checks and then return true in the middle somewhere
ah ok, cause was going to say, if statement kind of pointless to have anything in the brackets if it always returns false XD
Like this would make all gold and diamond recipes useless:
private boolean isForbiddenCraftingIngredient(ItemStack itemStack) {
if (itemStack == null) {
return false;
}
if (itemStack.getType().name().contains("GOLD")) {
return true;
}
if (itemStack.getType().name().contains("DIAMOND")) {
return true;
}
return false;
}
Yeah XD
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
It's supposed to explode the player when you step on stone
and nothing happens when you stand on stone
You currently try to explode him when he is inside Stone
Also you should get the world from the player. Imagine if he steps on stone in the nether and somewhere in the overworld at that location
a block explodes
I did that, but i changed it back because i thought that might be the issue
You should use Block#getRelative(BlockFace) for that.
@EventHandler
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
Block standingOn = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
if (standingOn.getType() == Material.STONE) {
// Do stuff
}
}
Or if you want to be a bit more precise:
@EventHandler
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
Block standingOn = player.getLocation().subtract(0, 0.1, 0).getBlock();
if (standingOn.getType() == Material.STONE) {
// Do stuff
}
}
wow, thanks!
this would be fricking hilarious more so if another player just coincidentally happened to be close enough to it they died from the explosion XD
Would be super random
but still hilarious
in fact would make for interesting game mode based on this
doing something in one world, makes something happen in another
Two teams on different dimensions battling each other. Sounds like fun
spleef on 2 worlds lol
deprecated method -> Dont use it (in most cases)
ok
depends on the deprecation-cause/reason
Im trying to summon a falling block
don't correct yourself before i can flame on it
In most cases its marked for removal. Sometimes its for draft api and in rare cases its to prevent derpy people from using the method
because they dont understand the implications (looking at you Bukkit#getPlayer(String))
Alright, thanks!
Can I also get a little help on the falling block thing? I'm trying to make it so when you mine a block, a falling block disguised as whatever you mined spawns
this is my current code
How would i code a command, that spawns 25 falling chests near you, about 1000 blocks in the sky, with loot?
(Aka a loot drop event)
Give me an example or rundown
Dont spoonfeed me
🥄 🥕
g
not so sure about the 1000 blocks in the sky bit
since there is a height limit
overexaggeration
just high enough to where it cant be stuck
inside a mountain
xd
not sure but > height limit will prob. despawn
anyways, get the players location, set a box around them or better known as a bounding box, spawn falling blocks however high they are entities. When they hit the ground or a block, make them solid blocks unless they do this on their own don't remember, and then grab the block which should be the chest block now and set their contents.
since a chunk extends to the height limit, they shouldn't despawn
unless you spawning them in a chunk that isn't loaded, but since they want it around the player they should be loaded 🙂
probably best you don't drop a falling block onto the player
well I really don't know what happens, but if it damages/kills them doing that, probably not something you want to do when trying to give them free stuff XD
well its a terrible way to give them stuff anyways
it acts as fallingSand
so it does no damage
unless 2 are stacked on eachother
how do you even spawn a falling block?
World#spawnFallingBlock
I've looked it up, I cant seem to understand it.
FallingBlock fBlock;
fBlock = player.getWorld().spawnFallingBlock(block.getLocation(), block.getBlockData());
why isn't this working?
I got this working, there was a random setting in intellij that wasn't letting it be used, I changed it and now it works lol
yo can someone help me with summoning a falling block
I'm trying to make it so when you break a block, a falling block spawns in its place
not sure what you mean by move, but you would just either increase its size or if its for a different area, recreate it
not sure if there is method to reset the cords for it
by move, i mean set its central cordinates
where it actually is
if you need to move the box itself
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/util/BoundingBox.html#shift(org.bukkit.Location)
declaration: package: org.bukkit.util, class: BoundingBox
you would use the shift method
@wet breach so it shifts it to the location i desire?
well there is 3 different methods for what it accepts
using a location will automatically shift it to that location
but keep its original size
if you need a different size box, there is the resize method
why is there x1y1z1
and x2y2z2
whats the difference
you need opposing corner cords to form a bounding box
Oh, so one corner to another for sizing?
yeah, but the corners I refer to are diagonal up/down from each other
box.resize(60, 1, 60,60,1,60);
or across if just making a 2d boundingbox
so this would be a rectangle on the Y axis
its longest at Y
actually ill make Y 1
do you not know what opposing corners are?
ok, so a boundingbox is usually 3 dimensional
so the opposing corners is one corner from the top, and then if you were to go diagonal down to the opposite side on the bottom
the other corner
the only time this isn't true is if the boundingbox is 2dimensonal in that case it is just the corners diagonal from each other
so hold on
I'm trying to make it so when you break a block, a falling block spawns in its place. Nothing happens when I break a block.
lettme draw this rq
ok, take the 2d of what I said, but the other corner goes downwards for 3D
exactly what I was going to draw
and ask if thats correct
that is the opposing corners I am referring to 🙂
yep
👍
box.resize(30, 0.5, 30,30,0.5,30); @wet breach
so this equals 60 1 60 60 1 60
ty
lol
the way you are doing it is not correct though
oh
this might help, but you will need to pass the material type from a block break event
https://www.spigotmc.org/threads/spawn-a-falling-block.195623/
thanks!
so, lets say 30 on the x plane for example for a direction
the other number would need to be -30
because you have to specify in both directions
the bounding box is created around a center point
that should work, but you can also specify 2 locations too and the utility class will take care of it for you
so you don't have to work out the math
ah\
@wet breach so can shift move based on its current location?
ex: add 15 to the Y value
or smth
declaration: package: org.bukkit.util, class: BoundingBox
sure
just because it takes in 3 values
doesn't mean you can't do 0,15,0
that would shift it only on the y value 🙂
that would move it up by 15 on the y
I just got $20 for destroying a salty streamer on stream in pvp while he was literally cheating and using op weapons and armor and then I won a pvp competition during the stream after that
Oh wait this is help
Oops
o.O
@wet breach Any events that can detect if a player is attacked by another player?
And get both players?
(Making a clan system)
entitydamagebyentityevent
that gets entities however
do i jsut compair each to players
or
players are technically entities
as said above you can do instanceof checks
if(entity instanceOf Player)
if true then (Player) e.getEntity()
not a capital o tho
ahah true that
Can i detect if somebody right clicks a player?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerInteractEntityEvent.html could see if this works, not sure if this gets thrown if done on players lol
declaration: package: org.bukkit.event.player, class: PlayerInteractEntityEvent
this event is thrown when right clicking on entities
while player does extend that, it depends on the implementation
yeah true
it is quite possible that in the implementation of the event I linked it checks if the entity is a player and then decides to not throw said event. But they could test it 😛
I'm fairly confident that works for players
Read implementation as impeachment somehow and was confused for a bit lol
lol
is there a way to get what chunks the player is loading?
i know World#getLoadedChunks is a thing but i only want the chunks the player is loading
Hola, tienen imágenes de todos los Vehículos??
english only
Any reason why this wouldnt work?
new ArrayList<String>().toArray(playerData.get("players." + player.getUniqueId().toString() + ".treaties"))
Claims its an object when I made it an ArrayList
@earnest forum you able to help me with above lol
getConfig().set(pString + ".treaties", new ArrayList<String>());
what are you trying to do?
loop thru an array to see if a player is already in a treaty w/ the person they are attempting to be in a treaty with
so
for(int tD: treatyData){
Object obj = treatyData.get(tD);
}
you are trying to get the list from the config here, yes?
Yep, I have a custom PlayerData config
#getStringList(path)
@earnest forum Cannot resolve method 'toArray(java.util.List<java.lang.String>)'
Oh.
np
lol
for(String tD: treatyData){
for(String cD: treatyClickData){
if(tD.equals(clickedPlayer.getUniqueId().toString()) && cD.equals(player.getUniqueId().toString())){
matched = true;
}
}
}
funny finding system lol
if you know the view range set in the configs, then you can do some math based on the chunk the player is in, how many chunks around them should be loaded
and you would be able to check using some math to see if those chunks are indeed loaded
honestly im not too worried about the actual view range just the 3x3 chunks around the player
can u give me some pointers on how to do that?
Final question: How would I send a message with an embeded function?
EX: Click here to accept
Kinda button
player.getLocation.getChunk(); chunks are 16x16x256
*y limit varies
yea
that is what I meant to show in my example 😛
?
With an embedded function?
Guessing he means lambda
You mean text components that when clicked will run arbitrary code?
/ anonymous class with overridden method
I think so?
Oh
Ill show an example hold on.
You have to write a command that is executed
Don't even have to do that. Can be an unregistered command caught by PlayerCommandPreprocessEvent
[CLICK TO ACCEPT]
(player clicks message)
Accepted successfully!
random il example
In chat, yeah? Text components
yea
Yeah you'd need to handle that as a command
oh god really?
The way those work is by having the client send a command when the text is clicked
The server then receives the command and carries out the desired action
Come to think of it, it would be pretty nifty to have a library for using lambdas for that instead of needing to handle commands
But again,
Can be an unregistered command caught by PlayerCommandPreprocessEvent
Though if you take that approach, I'd advise that you make it some command name that otherwise wouldn't make much sense to execute
I would probably have it generate a UUID for each lambda
Then the command would be /clickhook:clicked [uuid]
Are there any tutorials I can watch to learn this?
(That anybody knows of)
Actually, honestly wonder if it be easier to make it an InventoryUI
It most likely would be
Sure, also, would you like to see my revamped InteractionEvent handler
my old one i hated how it looked
so i redid it
I guess
Lots of things going on here
Too much for one method
You should be using early return
You should be using constants rather than creating a new NamespacedKey every time you need one
Ideally you would have some helper methods to get known properties stored in persistent data containers
There's a fair bit of duplicated code, like redefining variables in different branches that have the same values (a player variable, for example)
Really, this method is just doing way too much
I couldnt think of a way to split it all up
You should split up the responsibilities into a lot of smaller methods that perform the individual tasks this method performs
Ah, so create subClasses storing the functionality of each part
For example, you could have a Crate class which represents a crate in the world
You could have a method to get a crate for a given block, returning a Crate or null if there is no crate at that location
When a player clicks, you check if the block is a Crate, and then you check if they item they are holding is the key for that crate
So basically: Split it all up, its WAY too messy in its current state, and jumbled for no reason
And fix some issues with repeating variables/constants
Yes
You shouldn't be doing new NamespacedKey inline
You should pretty much always be using constants for those
And ideally you should have a helper/utility class which can retrieve specific properties that are stored in PDC
Oh and of course early return
Ah, so create a new dataClass (which is what I called helper/utility classes btw lol), to store PDC's based on name and retrieve them, EG: I could retrieve a PDC called "crateKey" but doing PDC.get("crateKey")
or smth along the lines of that
Early return is a very simple pattern that makes your code much cleaner
If I may, what is early return?
OH WAIT
nvm I know what you mean
if (condition1) {
someLogic();
if (condition2) {
someMoreLogic();
if (condition3) {
...
}
}
}```
Forgot for a sec
vs
Yea that looks messy as hell
I can see what you mean
if (!condition1) {
return;
}
someLogic();
if (!condition2) {
return;
}
someMoreLogic();
if (!condition3) {
return;
}
...```
Makes it much more linear and easy to follow
Take this one step further:
but my staircases
if (!condition1) {return;}
someLogic();
if (!condition2) {return;}
someMoreLogic();
if (!condition3) {return;}
...
No
2 reasons
Firstly, there is already a special syntax for single-line code bodies for if statements and loops and such
if (!condition1) return;
someLogic();
if (!condition2) return;```
oh yea you can do that as well
Secondly, while this is more compact, it is not more readable
I prefer
More compact code is not always preferable
And the official google style guide for java recommends to always use braces around code bodies
I typically do it like
if (condition)
thing();
Because otherwise it can be unclear what the code flow is
I just always use braces
I use braces for everything but return
yeah it's personal preference with that type of thing
It barely takes up any more space and makes it much harder to misinterpret
Maybe It's Just me but I think braces make code much easier to follow
Yeah they do make it easier to follow
That's why a good number of modern languages are opting to not allow for that syntax of one-line code bodies
then there's python
We don't talk about python
Because indents
Many reasons
The main few are that it's incredibly slow, dynamically typed, and has a tendency to entrap beginners and make them not learn the skills they need
if ():
if ():
blocks are tab-based instead in curly braces, but the part I hate the most is how the package management thing breaks every single time I use it lol
but it just works in pycharm
Sometimes dynamic typing is nice
Almost never
It’s so easy sometimes
With good type inference and shadowing there's virtually no benefits to dynamic typing
Look at rust
You can just
Who cares if it’s a string and not an int, python will take it and love it
let x = 4;
let x = "hello";```
sometimes dynamic typing confuses me more lol
Static typing makes for better autocomplete in IDEs too
Dynamic typing is just objectively terrible
This is true
The only "advantage" it provides over a good type inference system is that you don't have to specify types of method parameters or return types
anyone know difference between runTaskTimer and runTaskTimerAsynchronously?
So you save a few characters
One is asynchronous
The other is synchronous
Seems pretty clear
async makes its own thread right?
No
But saving a few characters is not worth the huge number of pitfalls introduced by dynamic typing
It doesn't make its own thread, I believe there's just a dedicated worker thread it runs on
It’s a pool
ah
Idk how big the pool is tho
About 3 large
and take care of it 🙂
And you can’t use most of the API async
It's best to avoid async programming until you have a solid grasp of sync programming
Which does take quite a while
that is why you just go with threads 😉
so if im doing maths with particles to create a circle in a runnable do i use async or sync
parallel programming 😄
Rust simp
you can do the math async, and the actual particle spawning sync
That's not what I'm talking about
(Don’t mind them, they are a troll)
I'm saying the compiler guarantees that your code will be thread safe and memory safe
Or it won't compile
until you just make it compile XD
yea that person game yesterday night and was trolling
Oh no
You're certainly aggressive for no reason
My feelings
they swear alot and are generally toxic
do you use arch btw
I do
I knew it lmao
im not a troll you absolute braindead twat
im sorry whos braindead here me or you at this point
if you dont see how your being toxic i have more braincells then you
Don’t feed the trolls
sorry just had to lol
A story in three parts
You're not posting any constructive criticism, you're coming out guns blazing after misunderstanding something you read in chat
Bait
Ill leave this:
Constructive critic is what @waxen plinth gave me earlier, they are nice, and told me what was wrong, how to fix it, etc
What you did was the exact opposite, you made others feel bad because they did something wrong in some way.
Block and move on
never heard of skript
Nobody even did anything wrong though
I wonder what the overhead of just having it installed is though
They misread something in chat and then started cussing people out over it
yea lol
And now they're upset that people are upset at them over it lol
Now tell me if im wrong
but isnt minehut a server host
or are we talking about server hosts
Yes
I mean I guess
why even when i am cancelling EntityCombustEvent the entity is still starting to burn in daytime ?
fr
because fires are a thing
well, how can i make my zombies not burn at daytime (not just damage, but visually too)
?jd-s
really annoying how intellij's prediction thing is case sensitive
What do you mean
cant believe intellij isnt feeding my laziness 🙄
(any item counts as a helmet, even ones that won't display on their head)
(you can put a red mushroom and I think it won't even render since it'll be fully inside their head)
Just give fire resist without particles and you're fine.
- the fire resistance don't remove flame visually
- i don't want to give them helmets
Not 100% sure that will work
Fire resistant mobs can still be set on fire, they just won't take damage
bad idea for 2 reasons
- Making it so they never burn in any case would causes issues, like lava, fireballs, etc.
- Mobs to max health means they cant die, why?
The helmet is invisible
Then read the messages I sent literally right below that
You can set any item
yknow potions have an argument to make it so that the effect doesnt show visually
right?
Flame is not the potion effect
Yeah the potion effect
Fire resistance is
declaration: package: org.bukkit.entity, interface: Entity
But not fire
i cant even say your wrong touche
not potion effect, flame visually
oh
I forgot Mojang split fire up to visual and non visual
Why did they
i set it once for each entity right?
Good question
pretty sure
ok thanks then
Research time
to allow for more cool effects
Yeah multiple people suggested this and were ignored
like, lets say you want to simulate sunburns, wouldn't make sense to have a burn effect and also be on fire
The helmet works best because then they can burn with other effects without burning during the daylight
can i stop the velocity of a firework spark particle
I believe so, you just have to set the speed to 0
Particles are client side
im using Player#spawnParticle
@quaint mantle just because you remove your message, doesn't mean it doesn't get logged just fyi
which argument is that
I didn't even see the message
they made a rude comment
Naturally
time for javadoc
but not every good programmer tells people they suck
i dont see anything about speed
Except a joke is supposed to be funny
this is from player not world
And you're not
Double extra is speed
thanks

weird individual
from a spigot forum post:
EntityCombustEvent
Check Entity etc.
Check Entity#getHighestBlockAt (if i'm not wrong) and so check if it's null/air
Check time (day)
If #getHighestBlockAt returns null/AIR they're burning under a sun. Cancel the event
arach have you considered chilling out a bit
You're so boring kid get a life
Combust event should have a reason
and you say you are not a troll, so far you haven't been very convincing on that
More things for the PR list
well its already broken down into two other categories
Anybody able to test something with me?
True
there is entitycombustbyblock event and entitycombustbyentity event
It requires multiple players.
and then you have entitycombust event for everything else
It’s not a block or an entity
Use offline mode
do i fix this by changing the t increment?
@Override
public void run() {
t = t + Math.PI/8;
double x = r*cos(t);
double y = 0.5;
double z = r*sin(t);
loc.add(x,y,z);
p.spawnParticle(Particle.FIREWORKS_SPARK, loc, 1, 0, 0, 0, 0);
loc.subtract(x,y,z);
}
fix as in make it better
?
more particles
Use offline mode and then run a second client
Assuming your pc can handle that
Gottem
Yes
Because you're boring.
ah thanks
also
can i stop it from falling, or is that just a property of that particle?
Iirc just a property of that particle
and in regards to your combust reason, you forget there is damagecause
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent, enum: DamageCause
the particles just be like that, would be cool if they were customizable
That's for taking damage, not beginning to burn
burning causes damage o.O
Not immediately
and there is a damage cause for fire
only others can tell you how smart or not smart you are
idk if canceling damage would make the fire disappear
hey whats the difference between Double and Integer?
It won’t
I wonder how often that event is called.
But you can setFireTicks
is there a way to make it spawn instantly? its like slowly spinning around
the particles, i mean
do i just set the 2nd double in runtasktimer to 0?
Use a loop
I don't have a chromebook o.O
You can’t run a task with a period of 0 ticks
wait i have an idea
uh think you mean a long
store an arraylist of locations
No?
What
Long is a 64 bit integer
what do you think coll?
@quaint mantle The simplest answer is that Integer can only be whole numbers and Double can have a decimal point
Just use a loop
i only want 1 of each particle to spawn
Okay?
But it's worth noting that those are both wrapper classes for the primitive types, which are int and double respectively
Why would that be an issue
i mean
correct lol
are you using trig
also, how do I check if a block is a TileState?
i want the particles to only start spawning when the player gets close
to prevent errors w/ my code
Block.getState instanceof TileState
the bukkit runnable continues to spawn them
i believe so
I see
Then check if the player is close before spawning them
i took it from a video because im not up to that part of math yet
get nearby entities, check for players
i have the nearby stuff
its just the particles keep spawning
im gonna try out the loop
so how would i do that?
while technically true in java it is two integers
(No)
the only native 64bit primitive is the long
that's in 1.18 ig, i am using 1.13 api
No that’s just a bad troll
public static void spawnParticles(Block b, Player p) {
Location loc = b.getLocation().add(0.5, 0.5, 0.5);
double t = 0;
double r = 5;
for (int i = 0; i < 32; i++){
t = t + Math.PI/32;
double x = r*cos(t);
double y = 0.5;
double z = r*sin(t);
loc.add(x,y,z);
p.spawnParticle(Particle.FIREWORKS_SPARK, loc, 1, 0, 0, 0, 0);
loc.subtract(x,y,z);
}
}
while(!allowClose.get()){
wait(50);
}
p.closeInventory();
Is something wrong here?
It errors here for some reason.
you can stop with the rudeness now
i need to make this 360
why do you feel the need to say this
Because they are a troll
multiply it by a negative to get the inverse if I remember my math correctly
@ancient plank can we just end this now
multiply what exactly?
Yeah and you can also not piss people off for no reason
the t variable?
I can go and yell at people on the street for no reason, but I don't because I don't want to ruin people's days for no reason
@vagrant stratus
we have a troll that needs dealt with
at the very least a warning
XD
can someone help me with my issue
Be an asshat, seems pretty clear.
You're cussing people out and being extremely rude for no reason
do not use wait make a task that has a delay
They have entered defense mode
what are you worried about, you said you could do what you want?
It's your fault because you're choosing to be extremely rude
maybe try turning pi/32 to pi/16? I'm just eyeballing it, I could be wrong
What should i use to wait instead?
Sure you do
They entered phase 2 of trolling where they pretend to be innocent
"a mental condition"
@tacit drift Okay but how would I delay it til it needs to be ran.
so sorry to hear about your nondescript condition that's so rare they don't even have a name for it
i figured it out
hope you get better
run task later
bukkit runnable
show us the metical records
Hi optic
Oh hi optic
Lol
Thank god
Lol
lol


and there comes the ban hammer
🦀 ?
bened
optic can you please just get them out of here
scroll up in chat, they've been consistently rude since they got here
They were rude last night as well
adding literally nothing to the chat other than making everyone annoyed
Are you going to pretend you have tics and that you somehow manifest them in text?
why would you troll on a minecraft dev server 😂
Tourette’s doesn’t even fit
Okay that's not an excuse
Generally Tourette’s isn’t only cursing at people
Your response shouldn't be "I can do what I want and I've done nothing wrong"
It should be "sorry I'll work on that"
And then go work on it
when you create it
Rather than trying to use it as an excuse to just piss everyone off
I have chronic apathy toward your "condition"
do ```java
BukkitTask id = new BukkitRunnable() {}
you get the ID when you create the task
save the id in a list or something
for later
anyone whos good at maths help me make this vertical
BukkitTask.cancel() > Bukkit.getScheduler.cancelTask
Right see I'm not even insulting you, I'm saying that if you want to be here then you should show that you're at least trying to get your anger under control
public static void spawnParticles(Block b, Player p) {
Location loc = b.getLocation().add(0.5, 0.5, 0.5);
double t = 0;
double r = 5;
for (int i = 0; i < 64; i++){
t = t + Math.PI/32;
double x = r*cos(t);
double y = 0.5;
double z = r*sin(t);
loc.add(x,y,z);
p.spawnParticle(Particle.FIREWORKS_SPARK, loc, 1, 0, 0, 0, 0);
loc.subtract(x,y,z);
}
}
bruh
so you want it to go upwards?
yes
why do I bother
do you want it like a dome?
Learn to control your anger yourself
I think you use cotangent somewhere
im literally 14 and more mature than u
I did say you shouldn’t feed the trolls
Yeah at this point they should just be ignored lol
almost like that's how learning works
lmao
There's no point
not everyone is great at mathmatical functions
why are you talking? you clearly have no idea how to communicate with people lmao
and that is ok
im good at maths im just not up to that part in school yet
Okay and that sort of thing has to be learned
It's not like knowledge is static and unchanging
You learn by trying things out
I don't remember trig being in algebra
Is algebra the one where they started adding letters
you only need to know how to add and subtract at minimum. Multiplication is glorified addition and division is glorified subtraction
for (int i = 0; i < 64; i++){
t = t + Math.PI/32;
double x = r*cos(t);
double y = 0.5;
double z = r*sin(t);
loc.add(x,y,z);
p.spawnParticle(Particle.FIREWORKS_SPARK, loc, 1, 0, 0, 0, 0);
loc.subtract(x,y,z);
}
to make it vertical do i switch the x and y values?
Yes
That's not how this works
If the only person complaining is you then maybe they're not the problem hmmm?
thanks
Asking for help is fine as long as you're not being entitled about it
if i do all will it form some sort of a sphere?
Asking and then not listening is a form of being entitled if you ask me
Fair enough
int schedule = Bukkit.getScheduler().scheduleSyncRepeatingTask(EmeraldsPlugin.jp, () -> {
if(!allowClose.get() && !p.getOpenInventory().getTopInventory().equals(gui)) {
p.openInventory(gui);
}else if(allowClose.get()){
p.closeInventory();
Bukkit.getScheduler().cancelTask(schedule);
}
}, 0L, 0L);
this is what I was asking if you wanted
Those kinds of people just want to be spoonfed
Am I doing this correcctly?
That won't work
for (int i = 0; i < 64; i++){
t = t + Math.PI/32;
double x = 0.5;
double y = r*cos(t);
double z = r*sin(t);
loc.add(x,y,z);
p.spawnParticle(Particle.FIREWORKS_SPARK, loc, 1, 0, 0, 0, 0);
loc.subtract(x,y,z);
}
would i need to set x to r*tan(t)?
Use runTaskTimer
since you want a sphere give me a sec to create the math 😛
You can just cancel from within a timer with cancel()
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
This is the one you should use
Bukkit.getScheduler().runTaskTimer(plugin, t -> {
// do stuff
if (shouldCancel) {
t.cancel();
}
}, 1, 1);```
Yeah that's not a very good approach
double radius = diameter / 2;
for(double X = -radius; X < radius; X++ )
for(double Y = -radius; Y < radius; Y++ )
for(double Z = -radius; Z < radius; Z++ )
if(Math.sqrt((X * X) + (Y * Y) + (Z * Z)) <= radius)
SetInShere(X,Y,Z);
uhh
that's turning it from O(n^2) to O(n^3)
Ferris wheel
Yada, what are you trying to do again?
but it's a sphere tho
make a sphere
I assume you need n^3 for a sphere
Oooh
Easiest way is to project vectors outwards
Yada
i only want a circle on the x,y,z i dont want a solid sphere
Does it matter if the points on the surface of the sphere are equidistant?
english pls
What do you mean a circle on the x,y,z
yes
Ok that's super easy
No you don't need anything complicated at all
they should have specified this, as that is far easier then the sphere, and you are right that the code I showed wasn't the most optimal way
um....probably shouldn't say this in many places then
@vagrant stratus they're obviously trolling at this point.
Imagine trolling the Spigot server
t = t + Math.PI/32;
double x = r*cos(t);
double y = 0;
double z = r*sin(t);
loc.add(x,y,z);
p.spawnParticle(Particle.FIREWORKS_SPARK, loc, 1, 0, 0, 0, 0);
loc.subtract(x,y,z);
loc.add(y,x,z);
p.spawnParticle(Particle.FIREWORKS_SPARK, loc, 1, 0, 0, 0, 0);
loc.subtract(y,x,z);
loc.add(x,z,y);
p.spawnParticle(Particle.FIREWORKS_SPARK, loc, 1, 0, 0, 0, 0);
loc.subtract(x,z,y);
this will work no?
No
Why do you subtract xyz
it does
And then add it back right away
the x,y,z switch around
look at it carefully
Oh yeah
cuz the spigot fills the bukkit
I can read I swear
it works perfectly
@waxen plinth How do I cancel this properly?
BukkitTask task = new BukkitRunnable() {
public void run() {
if(!allowClose.get() && !p.getOpenInventory().getTopInventory().equals(gui)) {
p.openInventory(gui);
}else if(allowClose.get()){
p.closeInventory();
task.cancel();
}
}
}.runTaskTimer(EmeraldsPlugin.jp,0,0);
thanks all of you for helping
task.cancel()
did that and it grays out
Vector v = new Vector(5, 0, 0);
Location center; // assume this is populated
for (int angle = 0; angle < 360; angle += 10) {
v.rotateAroundY(Math.toRadians(angle));
Location loc = center.clone().add(v);
// spawn particle at loc
}```
and leaves a warning
Something like this should work
oh finally
he got beaned
I told you not to use BukkitRunnable
I gave an example above of how to use it
@young knoll better go star that repo
if ur doing it inside do this.cancel()
On it
XD
oh
only use task if your cancelling from outside of the runnable
This
Would of went faster but I'm on a phone and I don't know mobile layout lol
damn that was a huge shitshow
if it got too serious I could have pinged some others 😛
It can be made any color
redstone dust?

besides, MD should be around somewhere too don't think he went to bed yet
dustoptions right
good thing i had some popcorn
ive done this before
or should be getting up?
Getting up yeah
DST in 35 minutes
Wait
I tried setting a reminder for 2:30AM and it set it for 3:30AM instead
I guess that answers my question about how computers would treat it
It’s 5:25 pm in Melbourne?
MD busy hitting someone over the head for using NMS to set a player's health value
Ye
I guess it is
I thought it was like 5am there now
interesting
Woooo
Huh
I know a geology fact
Apparently I can’t timezone
geography more accurately
Canada
Australia is on the other side of the world
It's gotta be more than just a few hours off
its a bunch of other colors
