#help-development
1 messages ยท Page 347 of 1
the direction multiplied by 5 as a base-value and then adding a part of the "size" of my multiblock
I thought you were to create a new instance of your javaplugin
multiblock? and why we care about that size?
sorry if I don't understand
what do i do?
Nothing.
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
The person complaining about your api design is likely stupid.
mean me?
when the multiblock is 500 blocks wide, the player won't be able to see where to place it well
XD
and what's stopping your from accessing the method names
just pass instance and use it
I've seen so many people doing absolutely horrendous API that I can trust none but myself when it comes to that matter
so can i get back static keyword for methods?
they had static everywhere for everything, I suggested they remove static from everything as that could be a potential of where problem is deriving. Seems they don't know how to access methods outside of a class without statics lol
If you already changed it there is no point going back.
how do i?
ctrl + z
.
there is a link above for you
Still.
If you were indeed using static for everything chances are your new system is indeed better
I am not against statics, just against using statics for non-appropriate reasons lol
but i needed it
a multiblock is basicly a thing like for example a house
If it is not appropriate you shouldn't be using it
It's best to learn to not use static overly often.
that being said you shouldn't develop around the concept of never using static (or any other keyword), which is the point I made initially
you only needed it because you didn't learn how to properly access classes from other classes. So to you, yes you believe you need it, but reality is no you didn't need it and shouldn't have been using it.
And as geol said I am not advocating in never using statics
just advocating you should be using statics properly. The way you were using them is not proper usage for them
and causes more problems then they solve
In the long run you cannot use static for everything, even if you wanted to.
doesn't stop people from trying
oh so like schematic placing then?
yes
i wanted to code this small project in kotlin but instinctively started in java and have pretty much finished the project already... goddammit
continue using java
@orchid gazelle It doesn't seem all that inacurate to me. https://paste.md-5.net/bubatijuvu.java
kotlin for minecraft is a trash idea imo
eh, that is a useless skill imo
yeah then try to aim a bit under the block and you will see that it still gets the block above
Sure, it's good to know the basics but not much beyond
don't feel discouraged about getting help here, and while although you didn't receive the kind of help you were expecting. Learning appropriate OOP usage is important, in other words we sometimes have to correct people on learning the basics. Otherwise all our help we give would only be futile, and this way when you do come back after learning that, we can help you a lot better and on the actual problems you have ๐
?jd-s you probably are using the wrong method for the direction
i mean i wanna build a career someday ๐ if i have a portfolio of multiple languages i will probably look a bit better
Not really. It got the proper block.
i love coding for spigot but i will have to go further someday
especially with my wide knowledge of java
why need kotlin then?
Kotlin is nice.
if i have a portfolio of multiple languages i will probably look a bit better
and kotlin is nice yeah
ehh im a Kotlin hater
i'll keep coding in java but i wanna get very good at kotlin too
Cause you are ignorant.
neh I just hate its Syntax
its not important on the number of languages you know, rather how proficient you are at using the languages you do know. If all you know is 3 languages but are super proficient at those, you will be a much better candidate for something that you might not really know then someone who does know it but sucks at it. Because you being very proficient means you understand concepts and basics as well as if they were to teach you, you will probably get the hang of it pretty quickly. Thus much better.
you can see the issue here @kind hatch
kotlin is only useful if you also use it with the kotlin JVM
if that isn't the case, it really doesn't make a difference of which
(other than having less support :d)
Huh?
I mean sure for spigot, but kotlin has a cool native and js thing too.
yep, that's why i wanna go for kotlin
i know java really well so why not learn kotlin now
Ah i see the context now.
I mean, why not learn an actually different language then?
bro i got it you are a kotlin hater
just learn C++
Kotlin is great, offers an easy way to do functional programming too.
kotlin won't bring you much in your job when you already know java
yeah i especially love the extensions to classes
Least factual statement in a while
read the context plz. Its a comparison to other languages
please don't argue about language preferences
Yes I read the context
come on yall know it's personal to each other
no need to have this convo that only makes the mood worse when you know your opinion won't change much
compared to learning another language (For example C++, yes), Kotlin will bring a lot less advantages in future job (applications for example)
learn assembly
I am talking about business here, not about preferences
and write it in binary when you're bored
programming in assembly makes me feel like a gigachad tho
what do you mean?
scriptmanager?
wait u code in assembly? XD
how can I check if a block is a block entity?
I have written a few compilers in assembly for esoteric languages
learn bytecode if assembly is too difficult ๐
alr thanks
just hit the processor timely for it to have some transistors at 1 and some at 0
many people do and this is very broad. There is different types of assembly. For example, Java assembly is just working with the bytecodes where as Assembly for CPU instructions is significantly different
JVM bytecode is incredibly easy
no need for languages and that stuff
yes sure but assembly is def. making you feel like a gigachad xD
it just feels so rewarding
thats just like how I feel when I do something really hacky with nms lmao
agree
I need to find a new bug in MC to make popular
Eh, doing something hacky with the sun Unsafe is even more rewarding
that's a whole different feeling
I wanna contribute to spigot, give me an easy bug that I can PR so I can finally flex in my classroom
Like transforming bytecode of other plugins by using the sun Unsafe to set the bukkit Unsafe
just turn them into features
lmao
Did you sign the cla XD
that is how holograms started ๐
damn I cannot sign clas xD
there's a typo in one of the docs, can't remember where but u can pr that :d
Holograms originally came from the horse age bug. The bug with the horses age was if you set it to a negative value, the horse became invisible but not its name tag
bruh
begins to read all the docs
hm?
And thus HoloAPI and HolographicDisplays was born
I don't remember
it's nvm already i think
no longer of relevance [meant for mfnalex]
obfuscators and stuff
sth with obfuscation
but I havent seen the exact question
Don't have to be so mean about HoloAPI being defunct ๐
also it was about proguard, I use the paid version of allatori ๐ฅฒ
i basically said that you used obfuscation and maybe you could help
it was what obf you were using
but yeah then i remembered you used allatori
are you sure? I only read about proguard and sth else, but nothing about allatori. maybe I didnt scroll up far enough
Hello, is there any way to check when a entity collides with a block or another entity? (I'm trying to make a custom weapon like hypixel skyblock, where it summons something where the player is looking at, and when it hits a block or a entity something happens, like the entity summoned explodes, but I can't quite figure out the collide part)
yes
it wasn;t i don't think
fairly sure @tender shard
i just brought alex up because he could be relevant
yep it was this
they only mention skidfuscator and proguard
yo alex
u know whats wrong here that its so inaccurate? XD
no, I havent seen your code. looks like you don't take into account that a block position is basically off by 0.5, 0, 0.5 from the "center" position
Location distBlock = player.getEyeLocation().add(player.getEyeLocation().getDirection().multiply(5 + (selection.depth + selection.width)/4D));
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Entity.html#getBoundingBox()
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Block.html#getCollisionShape()
declaration: package: org.bukkit.block, interface: Block
declaration: package: org.bukkit.entity, interface: Entity
I still don't get the point of that extra math. If you want to get a block X blocks away, just multiply by X. Then use that block position for the basis for whatever extra blocks you are trying to create.
The code I was using earlier created this result. The only time I had inconsistencies was because of me being slightly off of the block.
ChatColor#translateAlternateColorCodes()
it is hella inaccurate when you get a bit off the block
and this is insanely annoying in my build-mode
Center your starting position?
wdym?
Yea, was going to say. You'd have to compensate for the positioning then.
well, the extra maths is irrelevant here. It is the same issue when just multiplying by 5
how?
I do not get the idea of compensating that atm
blocks are only 1x1
if you wanted to detect the edge, you only need to have values from 0-1
You could probably also do what lynx mentioned. You'd just need to get a centered location first, then work off of that.
so, if the blocks x is 1, that means on the x axis, the edges are 1.0-1.9
but you are only working with 0-1 values, so centering isn't all that hard to do nor is detecting if they are at the edge
if they reach .9 or .1 they are at the edge ๐
well if I add 0.5 0.5 0.5 to center it it will be wrong
you need to normalize
Add .5 to your result as well.
open the noor
If you are working with a centered location, then you'll have to add .5 to your result to compensate. Otherwise, you wouldn't have to and just work with normalized vectors.
so just normalize the vector
0 is i believe bottom left side of a block
adding .5 to the x and z location would make it so you standing right in the middle
when normalizing, the same issue occurs
how can i make an NBT like (for instance) a furnace's slots with PersistentDataContainer ? Furnace's nbt for reference:
Items: [{Slot: 0b, id:"minecraft:raw_iron, Count:12b}, {Slot: 1b, id:"minecraft:coal", Count:1b}, {Slot: 2b, id:"minecraft:iron_ingot", Count:1b}]
im quite stuck really
still haven't found a solution
basically i am trying to set a block's nbt data and i am trying to create furnace-like block where i need to store the ingredients and the result; a way i thought was to create an nbt (array) that stores item data that is the count, slot and id (just like a furnaces "Items" nbt data)
can you show what you currently have
or how you are attempting to do things now
How do i add commands that have args in my plugin.yml file?
still the same but with the normalization
Location distBlock = player.getEyeLocation().add(player.getEyeLocation().getDirection().normalize().multiply(5 + (selection.depth + selection.width)/4D));
new BukkitRunnable(){
public void run(){
// blah blah blah
}
}.runTaskLater(Core.getInstance(), 20L);
u dont need to specify args in plugin.yml
use the scheduler instead of instantiating bukkitrunnables pls
ok, ill keep that in mind
not sure if the API method normalize would normalize like you need it to be
let me just go look
ok
what are you trying to do here?
placing a Block xy blocks in front of the player direction
FourteenBrush says that you shouldn't instantiate bukkitrunnables apparently
you can do
BukkitRunnable is fine
It doesn't matter which one you do.
But it looks a bit cleaner with the BukkitScheduler tho
well use that ig, apparently it doesn't matter
what?
one second im typing the code
ah ok
?scheduling goes over some substantial differences
p.getEyeLocation().add(p.getEyeLocation().getDirection().multiply(amt_of_blocks))
iirc I wrote about bytecode differences also
dude this is literally what im doing lol
yeah I see
so whats the error then
that it is insanely inaccurate
I use it to get 1.5 block infront of player and it works fine (?)
by ~half a block
you can simply do #add(0.5, 0, 0.5);
nice, good job
lol
thx ๐
this does not seem accurate
I see no mentions of bytecode on that page.
line 45?
now its inaccurate by a full block
lmao then do -0.5
you do realize pictures don't demonstrate your problem
at least not what you are trying to make
I've sent a video of it
ok your issue is you are trying to do it all in one line
.
whats wrong with this?
inaccuracy
wait why are you still creating a runnable and not using a scheduler
i dont see any
but ok
As someone who doesn't do bytecode. This went over my head. ๐
the same. inaccurate by a full block
hm
then that means 0 is accurate? i dont get it
you shouldn't do that btw, if you are just gonna get location to place block
when I actually get the block I am aiming at, it is accurate
its not detecting when they pass the edge of a air block to move the block. They want it to happen like almost as soon as that happens
^
so, in order to do that we need some math and normalizations
well it blocks the server 20 ticks every loop
youre using the scheduler but still waiting sync on the result
your issue, is that you are using the wrong location for normalizing on.
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("maps")) {
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Please specify a subcommand: create, addspawn, or reset");
return false;
}
String subCommand = args[0];
if (subCommand.equalsIgnoreCase("create")) {
if (args.length != 2) {
sender.sendMessage(ChatColor.RED + "Usage: /maps create <map name>");
return false;
}
String mapName = args[1];
mapSpawnLocations.put(mapName, new ArrayList<>());
sender.sendMessage(ChatColor.GREEN + "Map " + mapName + " created");
return true;```
Plugin.yml
```commands:
maps:
description: Your description
usage: /maps
permission: moul.op```
Eh then when when i do /maps or /maps create it sends this:
I mean probably need to normalize the direction
Check argument length first. Then compare contents.
too
whats the right location then? I am using the EyeLocation, which should represent the crosshair
logs?
right, but what we need to know if they passed the edge
is the location of where the block is at
the Direction is normalized
oh the plugin is disabled huh
so you need the vector of the direction normalized, and then you need the block location normalized, and betwen those two things you should be able to detect if near or passed the edge
how? Locations are not normalized
location has a vector method
or to vector
yes
Vector has normalize
yes but
what does normalize mean?
only Location I put in is the eyeLocation
it makes the vectors length of 1
unit vector for length=1
not sure why that is relevant
i havent learnt vectors in school yet and dont know a lot about them xd
I can give you an example
lets say you have x,z for a vector
and that vector was for an arrow
arrow as in direction
Well that doesn't tell you how long the arrow is
or its length
which is also known as magnitude
well in order to get that magnitude we need to normalize
Alf can you give me an example of how I can do this edge thing?
what's the maven-shade-plugin version for java 8? i'm trying to use bstats and it gives me Unsupported class file major version 60
w h a t
Check your project settings first.
3.4.1
never use outdated stuff
Unless you want to use Java 6 that is
there is a wiki page for that and u link so
much nicer
yeah that was wrong, I am tired
I probably shouldn't help any longer XD
You should always try to keep the maven-compiler-plugin and the maven-shade-plugin to the latest version
Gigachad's tired at 3pm
https://mvnrepository.com/ is a nice site to find the newest version
I believe they are american
Ok
alright I don't see an event for getting the crosshair location, so I assume you have a task for this right?
explain in fortnite terms
That's just Player#getEyeLocation()
I do not have anything about crosshairs
yeah
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
well yes I mean to detect the target location changed
?img
Not verified? Upload screenshots here: https://prnt.sc/
How do i do it then?
Crosshair direction should be player.getEyeLocation().getDirection()
that wasn't what I was asking
Does anyone know about this error?
Whenever I create new world, this error occured
how do you know they looked somewhere else
Thats literally the issue
I need the target location
shouldn't the eye direction be the crosshair direction?
out of memory
your server crashed
Correct me if I'm wrong, but isn't that what you are getting with the vector multiplication?
Your origin is the eye location and the target is the eyelocation * X.
Well then I'd need an example of how
Yes, but I was asking if they had a method to update or detect when they have looked somewhere else
It is
Infinite loop of infinite allocations?
How can I solve that?
It worked well few munites ago ๐ฆ
A-la player move event?
Well im using PlayerMoveEvent and a cooldown to update my temp-placement
playermove event is used even if the head moves?
Yes
Yes
dedicate more ram
interesting, good to know
yea
You can filter out the head movement though. If you want anyways
if not you can always use packets
I need this lol
if you can run a profiler and see what allocates all the stuff, then we can look deeper
well don't need to, just trying to help DaFeist here and just needed to know what was being used to update...
umm what is spark?
alright going to go smoke to think for a moment as my brain is trying to process and then I will be back in a few minutes lmao
Aight
creating worlds take a lot of ram thats why ur server crashed, most probably
for world creator?
yeah, try allocating more ram to the server and try again
okay let me try
how much ram did you allocate anyways / what are you launch args?
I allocate 1GB
yeah especially on world creation
no profiler is needed there
Not allocating enough ram is a ticking time bomb
i did it for multi verse and it worked but maybe something taking more ram for u
Im allocating 4GB now
You don't know when it explodes - but it will explode
Yeah, 4 GB is far more than enough
But Intelij + server + minecraft make my computer like dynamite lol
i use 1gb on server, 2g on intelliJ and 2g on mc and it works fine
preloading chunks ftw
eclipse is sad
ive played with over 6 people on my server and it worked lag free
sad vibes
is it possible to create "private" scoreboards, visible only to the players we have determined?
yeah
thats how scoreboards work, dont they?
How do i select a random key out of a hashmap veriable every minute?
p#setScoreboard(scoreboard)
why hashmap in that case, use a list
Always include it in versions 1.13+. If you don't include it, legacy material support will kick in. Otherwise, set it to the lowest version your plugin supports.
Are you using any 1.19 specific materials?
me crying in the corner with 8gb
my pc commits self termination when i have to launch two minecraft instances
Are you trying to support 1.18 as well? Cause if not, you can just leave it at that and keep it at 1.19.
mine too lol
why firefox and brave at the same time lol
@orchid gazelle can you show me what you are using ? the math that is
why cant you just one instead
nvm I will just scroll up to find it
I use firefox's fork, Librewolf
Well, then set it to 1.18 and start fixing the issues so it works on both versions. xD Only thing you really can do.
no telemetry, clean browser
yeah
i'm using firefox for its ui, is librewolf good in terms of that?
Still the same
nice
it uses latest firefox
yeah but it's a fork?
it doesnt even have auto update by default
i might consider getting it then haha
you need to install separate extension
i'm just tired of switching browsers
i used to use chrome before it crashed on me and deleted all the fucking data
bookmarks, history, tabs, stuff
so i yeeted it and went to firefox
and what is the code you have to move the block?
lol. Do want you want/need to, but general rule of thumb is to set the api-version to the lowest version you support.
use google account, it saves the data if you sync it
I do not move blocks. I just send a block change whenever I calculate this block
i switched from chromium just because of the upcoming extension api which would break adblockers soon
I just need that exact block, nothing around it
and i already used firefox on mobile since it allows to use extensions on the mobile
yeah
history in chrome is annoying, only goes back 3mo
ublock origin
Depends on how you have it setup. If it's a multi-module project, then it handles itself. Otherwise, the version needs to be the lowest version you support.
on mobile is such a breeze
oh so as they move their mouse around it just adds blocks as they are moving?
i've been thinking of purchasing a PiHole
And remove the old blocks
I'm talking about the spigot-api version.
i've been using it for a couple months i think and it's cool
Just gotta get the right block at the player crosshair
nextdns also good option
yea, but you see, you can use those blockers for devices which do not support browsers well enough
like samsung tvs
or consoles
its better than nothing
My parents ๐
eh its an old model
2014
and its youtube app is laggy as hell
but it gets the job done
working with people is painful
eh depends on who you're working with
It also depends on the size of the project
true, if im working with a clone of myself its fine
lmao
For larger plugins working together is nice, for smaller it is basically stupid
yeah
i can make smaller plugins in a day or so
oh rip
lol
in my (discord) server, there is only 2 admins. me and my friend. i gave him admin after like a few months of knowing him. can't trust people these days
damn
is that a lot?
in java its like double im guessing
1k lines are relatively okay
So, got any idea?
When someone contributes anything to one of my repos I generally verify that those contributions are not malicious. Does a treat of avoiding issues in the future
check for player move event, there is a func to get blocks in raycast, also a limit, get the last block and send packet or however you are doing it
@last temple Hi! I canโt DM you!
bundled libraries?
yeah creating code
That being said, contributors are very hard to come by
I do not have an existing block I can raytrace for
p#getLineOfSight
is that a giant switchmap or what?
Nasa rocket launch software in Skript
lmfao
nah, that's more like yandere dev stuff
they made rocket in worse software than old nokia phones tbh
its probably possible
yeah
Still, 200 - 300 chars per line. Not even my largest classes come anything close to that
its not oop
@halcyon hemlockfor getLineOfSight, what do I add for transparent?
use intellij minecraft plugin
I want it to not care about other blocks
skript is procedural scripting language
i think its null
my largest class is 343.6 KB large
Did you also run buildtools?
shouldn't matter too much at the end of the day
What's your pom look like?
declaration: package: org.bukkit.entity, interface: LivingEntity
List<Block> all = player.getLineOfSight(null, 5 + (selection.depth + selection.width)/4);
distBlock = all.get(all.size() - 1).getLocation();
``` like that?
there's also #getTargetBlockExact
does not work too
Player player = ...
Location playerLoc = player.getLocation();
double yaw = Math.toRadians(playerLoc.getYaw() + 90);
double pitch = Math.toRadians(-playerLoc.getPitch());
double x = playerLoc.getX() + 5 * Math.cos(yaw) * Math.cos(pitch);
double y = playerLoc.getY() + 5 * Math.sin(pitch);
double z = playerLoc.getZ() + 5 * Math.sin(yaw) * Math.cos(pitch);
Location blockLoc = new Location(playerLoc.getWorld(), x, y, z);
Player player = ...
Location playerLoc = player.getLocation();
Vector facing = playerLoc.getDirection().normalize().multiply(5);
Location blockLoc = playerLoc.clone().add(facing);
exact thing im doing already
yea obv it looks better in skript if you don't even try to write clean java code
?jd-s in b4 raytracing does this as well
Player player = ...
Location playerLoc = player.getLocation();
List<Block> blocks = player.getLineOfSight(null, 5);
Block targetBlock = blocks.get(blocks.size() - 1);
complexity isn't always bad
yeah, sadly raytrace will return null if it doesn't hit anything
plz don't use skript if you can code lol
Player player = ...
Location playerLoc = player.getLocation();
Vector direction = playerLoc.getDirection();
RayTraceResult result = playerLoc.getWorld().rayTraceBlocks(playerLoc, direction, 5);
Location blockLoc = result.getHitPosition().toLocation(playerLoc.getWorld());
only disadvantages besides less lazyness requierd
nope
how do you test so fast
I know that raytracing is no option
could u give your full code
raytracing raytraces BLOCKS, which is the exact thing I want to avoid
good
im literally gonna throw some bricks against the window rn
what are you trying to achieve? since you don't want to use raycast
:( already explained 3 times
so just placing blocks 5 blocks infront of player?
I hope the window throws bricks back at you
yes
yes, in the direction of the player
but this garbage does not let me do that
Sounds like you want to use the rayTrace method
do u want me to open my server and test it for you?
tr4gfrwegwegerger
raytracing is notan option
no raytracing
raytracing is literally EXACTLY doing the opposite thing of what I am trying to do
How so?
no
How about you build the blocks yourself instead of being lazy and wanting code to do it for you?
Smh this humans nowadays...
fr ๐ฟ
automation overrated
do the work for your players,
raytracing finds the next block that the direction hits
then use vectors / sin cos angles to do so
omg
I still stand by the solution of you building the blocks yourself
The world is getting too much automated, we need some human control back
why don't you do it?
i need help
try debugging
911
lol
it gives error saying org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
give me your location ill call police
send plugin.yml
That's cause invalid plugin.yml
in which world would I be able to use triangles if I have one length
@orchid gazelle It's about time you go in-game and start making and visualizing test cases
i provided you with the function already man
have done that 100x
double yaw = Math.toRadians(playerLoc.getYaw() + 90);
double pitch = Math.toRadians(-playerLoc.getPitch());
double x = playerLoc.getX() + 5 * Math.cos(yaw) * Math.cos(pitch);
double y = playerLoc.getY() + 5 * Math.sin(pitch);
double z = playerLoc.getZ() + 5 * Math.sin(yaw) * Math.cos(pitch);
Location blockLoc = new Location(playerLoc.getWorld(), x, y, z);```
able to show me an in-game visual example?
Your plugin.yml probably isn't included in the jar. Since you appear to be using artifacts to build it you need to manually specify the file as included
Why do you have a dot in the author?
plugun :)
or draw something up in paint?
True plugun.yml
lol :>
ah yeah
So it's not a problem in the plugin.yml after all
do you have a way
use intellij minecraft plugin to create projects
@halcyon hemlock yeah that code does a very good job going even further away from the target
Imagine setting up the files yourself in 2023
I actually misspelled it too.
"Minor spelling mistake"
https://discord.com/gifts/Udzwm3hrQECQBnEEFFCEwdSq
Ask chatgpt to create the plugin.yml for you
use vectors, best option
its easy
i use them all the time, and they work fine for me
did you even read what the problem is?
maybe your way of explaining hte problem is odd
Pfff imagine having an ide that doesn't lint plugin.ymls
that the vector multiplication is inaccurate as hell on earth
please debug locations and adjust them instead of changing the way the location is calculated
I'm trying to get a full understanding of the problem
Thank you very much everyone
Vector multiplication works perfectly fine, maybe your own math that uses vector multiplication is flawed
why u use white background
I spelled the plugin wrong lol
dont your eyes hurt?
yeah
what is the extra variables you put?
Now you're officially a programmer
Congrats on your first plugin

yes, good
the player's line of sight is circular
Yea no he has a long fucking way to go.
thx u bro
He uses light mode
๐
Of course it hurts lol
the player's line of sight is circular
thats some haram level shit
change it
Join the cult of darkness
yeah
how to change
but blocks are not circular
oh no
how is .multiply(5) wrong maths?
pls use nogui
Just use command line
what is the extra variables you use?
thx u
getDirection returns decimals and all
also please send full code
does not matter, its the same issue when removing it
this is the full code needed
multiplying those decimals ends up giving you a decimal result
-nogui
send again
Location distBlock = player.getEyeLocation().add(player.getEyeLocation().getDirection().normalize().multiply(5 + (selection.depth + selection.width)/4D));
thxxx
java -XmxYOUR_RAM -XmsYOUR_RAM -jar server.jar nogui
change what? o0
They want dark mode
close the eyes
Dafeist's thread because chat is spammy
Ah yes, "Dafeist's thread", what a very useful title
do better
Vector shit
i dont know what its about
neither do I
Can i put a class inside of a class?
Ye
Can't be public though
I'd generally avoid that behavior though unless the class is only used internally in the class your putting it in
oh sure it can
Yes, even in java
You just can't have two public non-inner classes within the same file
But a public class within a public class is very much possible
File have to named same as public class
Lemme find an example, shouldn't be too hard to figure out
.
Huh ig you can
Idk why I thought you couldn't
I wonder where I got that from ๐ค
Wow, I rarely use non-interface inner classes that aren't static and private
Probably from anonymous or local classes
How do i select a random key out of a hash map and save it in a veriable every 1 minute?
Google your question before asking it:
https://www.google.com/
I use inner classes rather frequently
There is says, 2 top level
top level classes, yes.
having a public class in a class means it's not a top level class
and what is public class X as not toplevel?
It's an inner class
or nested
It's not same
but
public class X {
public class Y {
}
}
is valid
that is an inner class
That is nested class, not inner
Same difference
I have learned the JLS, I know this
There are no such nested classes
There are only local, anonymous and inner classes
And top-level classes if you count that, but I don't remember them being mentioned in the JLS spec
Well, oracle docs are wrong then
local classes are classes within methods
average java coder
And anonymous classes are classes without a name
Oh God look what I started and I was wrong too
Inner classes are classes within a class
The JLS is a sun document
If you are saying that the JLS is wrong then go back to C world
What's jls stand for
java language specification
Exactly
enum constructors
Well, I was wrong, inner == nested class, however I wasn't referring to nested classes
anyone know why im getting IllegalArgumentException: Symbol does not appear in the shape: [] while trying to set an ingredient?
?paste
This beginner Java tutorial describes fundamentals of programming in the Java programming language
not exactly, inner classes are a type of nested classes, not synonyms
im trying to turn a java List into a crafting recipe
but it gives me an IllegalArgumentException
Non static nested classes are called inner per oracle docs I just sent
So yeah, ig not every nested is inner
does anyone know why?
wdym
8.1.3 Inner Classes and Enclosing Instances
An inner class is a nested class that is not explicitly or implicitly static.
An inner class is one of the following:
โข a member class that is not explicitly or implicitly static (ยง8.5)
โข a local class that is not implicitly static (ยง14.3)
โข an anonymous class (ยง15.9.5)
The following nested classes are implicitly static, so are not inner classes:
โข a member enum class (ยง8.9)
โข a local enum class (ยง14.3)
โข a member record class (ยง8.10)
โข a local record class (ยง14.3)
โข a member class of an interface (ยง9.5)
Seems like we were both kinda wrong
(Excerpt from JLS 19)
Yap
That being said I was accidentally correct since I wasn't talking about static
I was for some reason reffering top level class as inner
the part where you cast to a char seems dangerous
its a single digit number which im casting to a char
yeah but casting it to a char
Recipe: [000, 000, 000]
Ingredients: {ItemStack{STICK x 1}=0}```
doesn't do what you think it does
the console gives out this before shitting itself
it returns <horizontal tab>
OH
because it returns what's on the ascii table
ordinal
do Character.forDigit(number, 10)
so i should be using the Char class?
yeah
the 10 makes sure it doesnt go above 10?
Got a question, when I compile using maven, the compiled jar exists in the folder and another called smth like "originaljar". How could I stop this "original" jar from generating?
don't use the shade plugin
What should I use as an alternative?
there are no alternatives
So I gotta live with that extra jar being generated?
mostly
Shouldn't be that much of an issue anyways unless you have very severe OCD
At that point you can just add a script to remove any jars ending with -original.jar that is executed after each compilation
It does
Ye, that's what I'm looking for
There is maven clean plugin or smth like that
You mean this, right?
No, plugin for maven
I used it here
You can use regex there ig
and that also runs when you don't explicitly invoke the clean goal?
What's the filset config in there?
plus clean should run before shade, so it wouldn't make much sense if you need to explicitly invoke clean
the list of files to remove
I use it to remove old jar from plugins folder
So don't know, you can probably try and see @zealous osprey
kk
why are the sometimes shivering and sometimes not?
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
Player p = (Player) sender;
Entity strider = Bukkit.getWorld("testw").spawnEntity(p.getLocation(), EntityType.STRIDER);
org.bukkit.entity.Strider strider1 = (org.bukkit.entity.Strider) strider;
strider1.setSaddle(true);
strider1.setAI(false);
strider1.setInvulnerable(true);
return true;
}
man got a cold
If I'm adding things to a list using a normal bukkit runnable task, but then running through that list with an asynchronous task and doing things with elements of that list (like using them to do complex math), will there ever be a case where the element grabbed by the asynchronous task is malformed?
depends on the list
Like say its a list of string arrays, and it is trying to grab the string array at the fourth index of that list, it would never grab {"a", "b", "c"} when it is actually supposed to be {"a", "b", "c", "d"}
ArrayList would throw a proper ConcurrentModificationException if you are trying to add an element to the list while your async task is iterating
hrm
how might i add things to that list WITHOUT getting that error thrown? I'd really like to be able to generate a list of stuff in the thread and then use an asynchronous task to grab elements from that list and use them to fo a bunch of vector math and then send a bunch of packets and delete that element
a rather normal synchronization issue
either use javas sync blocks
or something like a semaphore
cant you use a blocking queue so the async task blocks till an new element is detected?
or that yea
Ok, fixed it in a far easier way. I got a bat file that starts the server, now I just added del plugins\original-*.jar to it before it restarts the server.
alright ill google all those things
there are a few data structures out there with inbuilt multi threaded safety
thanks
(also im trying to rotate a tile entity)
yeah well cant cast block state to directional..
oh data?
sorry data*
but i may have mistyped it lemme try rq
Eclipse error
yeah seems to be it thanks
uhm guys, is there a PlayerMoveEvent for minimal camera movements?
isnt one fired anyways?
if you only move your crosshair a tiny bit, the event is not getting called
anybody got plugin ideas? im bored asf and have 9 hours to burn
:o
thats bad, when I do not move my crosshair a decent amount it does not get called
so, I gotta waste literal tons of performance to run it always, no matter on the event
what do you mean "don't move"?
If it includes no movements of the crosshair, it's false
If I take my hands out of the mice and keyboard and am not standing in water or simiar, the event will not fire
the event does not fire when moving the crosshair a bit
only when I move it by a big amount
?google what means Entity#setAI() ??
Google your question before asking it:
https://www.google.com/
I used to do an analysis on this topic and usually PME will fire around every 1.5 - 1.8 ticks
(over many players and many servers)
this is also the reason why players can move their mouse when getting "freezed" and only getting ported back when moving a lot
Now, is there a way to detect small movements?
I want to make a server game and some play room
I can make server game myself
but how to generate play room?
use multi-world plugin?
I don't think so
Fusion is that related to my question?
How can I import nms for custom npcs please ?
If yes, yeah now thats insane amounts of performance getting drained from me now
Correct, I'm not sure there's a way. If there was it would be the PlayerMoveEvent
Import nms?
Now, does the server detect it and just don't fire the event or does it not get sent?
What lines do i add to my pom.xml (PS: I'm quite new to bukkit ๐ ) ?
It's possible that it just doesn't get sent, the server would detect any movement packet
Ah so you are using maven. I am personally using paper mappings, but yeah idk about spigot
Paper in spigot comm hahahaa - Sorry i have to said it
Well but what if it just not fires the event when it thinks that the movement is too small
Still not much you can do
Im not even using paper-only functions there lol. Just did not get spigot maps to work back in the days and found that this is 100x easier xD
PR spigot lmao
hello! im a new developer and i need some help
PlayerCameraMoveEvent xD
Well, you'd have to see if anything is even sent to the server first
Hey^^ tell us your question please
so i triewd to create a plugin in IntelliJ
but when i try to use it it tells is it up to date
should i send u he code?
the plugin is up to date?
im trying to make it
Uhm, I am not understanding your issue rn
whats up to date
How to import nms
can i send u smth dm so i can give u more details
Ah, how bad is a async repeating scheduler with one boolean check for performance?
?
please guys i need a help i think it will not take mutch
take a screenshot of whats not up to date
Should I use a DI framework(such as Guice) in order to avoid constructors that consist of 5+ services - using Field Injection?
It's hell to maintain at this point
Server thread/[ERROR] Error occurred while enabling MPATSARIA v1.0-SNAPSHOT (Is it up to date?)
this is my plugin
?paste the full error
We need the full error
service hell in a nutshell
is it that bad
We're not mind readers
no this is it
Show the full log of the issue
@remote swallow im using IntelliJ and i installed plugin minecraft developers
there will be more of that
I have so many constructors with repetitive dependencies, it's hell to read and especially configure at onEnable()
๐
then you might have done an architectural error
am i the only one who doesnt understand why plugin classes are being loaded by custom PluginClassLoader?
Can you make stuff static in a way that makes sense? If so, you can do it
Isnt urlclassloader sufficient enough
//push
Another good way to reduce classes is to just merge classes with simiar - if not identical - use
little to none
@remote swallow i made it
Actually, didn't we have that exact same discussion not so long ago?
the question is if your boolean variable is atomic or not
we still need the full error log to help
your commands arent in plugin.yml
if the boolean variable changes during async runtime, it could lead to problems
if its the field volatile keyword should prob be enough
should i also send u the code so u can see what am i doing wrong
but i suggest using atomic classes from java
Oh wait it actually takes more
Imagine a /ban command, you now need:
BanServiceto do the banning.MessageServiceto load and send the"You banned X"message from the messages config.ProfileServiceto load the player's profile and increase the bans amount.
etc
no need, the error is talking about the command not being in plugin.yml
Its getting all Online Players and compares them to an ArrayList
what i should do
let me guess, you are abstracting away the bukkit library?
before doing async operations think if those operations are thread safe or not
im not sure how to build it btw i just right click the target and copying the plugin :PPPPPPP
commands::
yourcommand1:
permission: cool.permission.1
yourcommand2:
permission: cool.permission.2
im rll rll new
anybody got some plugin ideas? I have nothing to do and 9 hours to burn
I don't have that command, it's just an example. but in an ideal world that would be hidden behind a BanService or PunishmentService
If you are not abstracting bukkit, there is no excuse for this bullshit
can u help me about how to build the plugin
Service hell is a hell you should be afraid of, not create willy-nilly
on the right do you see a maven or gradle tab
anyone?
does anyone have an answer?
Why cant you just use URLClassLoader
i forgor how do i get my ConfigFile From my Plugin.jar
click arrow
open that drop down
JavaPlugin.getConfig()
lifecycle > package
#saveResources of #getResourceAsStream
i wanna save it to my folder
(although perhaps #saveResources doesn't work - eh, I'd reinvent the wheel anyways and use getResourceAsStream within the plugin's classloader)
@remote swallow what to do
meh
that stuff can atleast produce proper english
The javadocs will be far too vague
/**
* Retrieves an integer value from the specified index and verifies that it falls within a specified range.
*
* @param index the index from which the integer value is retrieved
* @param min the minimum value that the integer is expected to be
* @param max the maximum value that the integer is expected to be
* @return the retrieved integer value
* @throws IllegalArgumentException if the retrieved integer value is less than the minimum or greater than the maximum
*/```
that does the job ig
can someomne help me howt o build my plugin
open lifecycle
what's up with converting an int to an int
and then
mvn install
package
then
your done
what
you built your plugin
its in target
the one without original or shaded on it
I thought you converted index to an int, but that is not the case lol
bad
src/main/resources
can u check dm 1 sec epic
Mojang's itemstack serialisation library (also does more, but that is of little relevance)
i think im a bit annoying here
whats the best way to encrypt a string, say I am storing passwords of players?
yeah that
String#hashCode kekw
i need help in smth in my code
bcs i get gis error Server thread/[ERROR] Could not pass event PlayerInteractEvent to BaronSMPM v1.0-SNAPSHOT
?paste the error
There should be error under that
hmm String#hashcode should never produce the same result for a string with different contents right?
And the error?
block probably null