#help-development
1 messages ยท Page 263 of 1
OH GOD
uhm lol
yeah maybe the X is offset to the wrong position
negate the offest and add some more
needs more pitch too
i love implementing Iterable<E> to not have to expose collections
so I just play around with Yaw/Pitch until I like how it looks? lol
play with yaw/pitch and the XYZ values on the offset vector
aight
any help xd?
thank you already anyways^^
thats a material and not an itemstack?
so i should change it to Material?
ig
yeb that did the trick !
uhm well I already had my method to calculate the hand Location, I just need the yaw. What about just using that and then only doing the Yaw thing?
when i run this:
System.out.println(getServer().getServicesManager().getKnownServices());
System.out.println(getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class));
System.out.println(getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class));
It puts out this:
[15:04:25] [Server thread/INFO]: [class net.milkbowl.vault.metrics.bukkit.Metrics, class net.milkbowl.vault.chat.Chat, interface net.milkbowl.vault.economy.Economy, class ru.tehkode.permissions.PermissionManager, class net.milkbowl.vault.permission.Permission]
[15:04:25] [Server thread/INFO]: null
[15:04:25] [Server thread/INFO]: null
yeah the suppliers haven't run yet.
how can i checking if player is holding down right click or what ever
right clicking item
i mean
hold down
keep hold down some item
bruh
and do u know how can i use NMS?
?buildtools
what do i need to do
i ran out of ideas
ok so I now got: ```java
float yawOffset = 3.18f;
float pitchOffset = 7.18f;
for(Player player : Bukkit.getOnlinePlayers()) {
double yawRightHandDirection = Math.toRadians(-1 * player.getEyeLocation().getYaw() - 45);
double x = 0.7 * Math.sin(yawRightHandDirection) + player.getLocation().getX();
double y = player.getLocation().getY() + 1;
double z = 0.7 * Math.cos(yawRightHandDirection) + player.getLocation().getZ();
Location handLocPure = new Location(player.getWorld(), x, y, z);
Location handLocation = handLocPure.clone();
handLocation.setYaw(handLocation.getYaw() - yawOffset);
handLocation.setPitch(handLocation.getPitch() - pitchOffset);
Well ok now I got it so it cares about my direction, but yeah I cannot explain this well but look at the screenshot:
that looks weird
yeah lol
new Code btw.:
float yawOffset = 4.82f;
float pitchOffset = 7.48f;
double yawRightHandDirection = Math.toRadians(-1 * player.getEyeLocation().getYaw() - 45);
double x = 0.6 * Math.sin(yawRightHandDirection) + player.getLocation().getX();
double y = player.getLocation().getY() + 1;
double z = 0.6 * Math.cos(yawRightHandDirection) + player.getLocation().getZ();
Location handLocPure = new Location(player.getWorld(), x, y, z);
Location handLocation = handLocPure.clone();
handLocation.setYaw(player.getEyeLocation().getYaw() - yawOffset); //handLocation.getYaw()
//handLocation.setYaw((float)yawRightHandDirection);
handLocation.setPitch(player.getEyeLocation().getPitch() - pitchOffset);
please
it is
@EventHandler
public void sonicboom(PlayerInteractEvent e)
{
Player p = e.getPlayer();
Action a = e.getAction();
Material iteminhand = p.getItemInHand().getType();
int charging = 0;
int cooltime = p.getCooldown(Material.ECHO_SHARD);
if(iteminhand == Material.ECHO_SHARD)
{
if(cooltime == 0)
{
if(a == Action.RIGHT_CLICK_AIR)
{
charging = charging + 1 ;
p.sendMessage(charging + "");
}
}
}
}
um
i test this
and charging is still 1
im literally gonna throw a brick against some windows right now, Iยดve been messing around with this for 3 days now
best thing to me is to use pdc, just store that int there and check it in that event and increase it
might wanna use some kind of map too but thats essentially the same thing
seems like the issue is that my yaw just continues kicking in, not at the crosshair
int charging = 0;
@EventHandler
public void sonicboom(PlayerInteractEvent e)
{
Player p = e.getPlayer();
Action a = e.getAction();
Material iteminhand = p.getItemInHand().getType();
int cooltime = p.getCooldown(Material.ECHO_SHARD);
if(iteminhand == Material.ECHO_SHARD)
{
if(cooltime == 0)
{
if(a == Action.RIGHT_CLICK_AIR)
{
charging = charging + 1 ;
p.sendMessage(charging + "");
}
}
}
}
ok i did this
i make variable to not local
ty โค๏ธ
uh whenever another player joins and triggers that event it will change too
uh
make it bound to a certain player
make a HashMap
with UUID and int
To make this plugin per player, you can add a charging variable for each player. One way to do this is to create a HashMap that maps players to their charging value. Here's an example of how you can modify the code to achieve this:
import java.util.HashMap;
import java.util.UUID;
// ...
// Declare a HashMap to store the charging value for each player
private final Map<UUID, Integer> charging = new HashMap<>();
@EventHandler
public void sonicboom(PlayerInteractEvent e) {
Player p = e.getPlayer();
Action a = e.getAction();
Material iteminhand = p.getItemInHand().getType();
int cooltime = p.getCooldown(Material.ECHO_SHARD);
if (iteminhand == Material.ECHO_SHARD) {
if (cooltime == 0) {
if (a == Action.RIGHT_CLICK_AIR) {
// Get the player's UUID
UUID playerId = p.getUniqueId();
// Get the player's charging value from the HashMap
int playerCharging = charging.getOrDefault(playerId, 0);
// Increment the player's charging value
playerCharging++;
// Update the player's charging value in the HashMap
charging.put(playerId, playerCharging);
p.sendMessage(playerCharging + "");
}
}
}
}
A UUID is a unique identifier that is assigned to each player when they join the server for the first time. It is a string representation of a 128-bit number, and it is guaranteed to be unique across all players, servers, and devices. Using UUID instead of Player in the HashMap has several benefits:
It allows you to store the charging value for a player even if they are not online. This can be useful if you want to keep track of the charging value for a player who has logged off, or if you want to store the charging value in a database or file.
It allows you to store the charging value for multiple players in the same HashMap, without worrying about conflicting names or duplicates.
I hope this helps! Let me know if you have any questions.
Jan GigaChad
bro ty
you might consider Map#merge
syntax is charging.merge(p.getUniqueId(), 1, Integer::sum) or smth
not really needed in this case.
Yes
Well he wanted to do something with it. So it won't replace it.
it returns the value
ok sadge now I ran out of ideas
wtf are these javadocs lol https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#merge-K-V-java.util.function.BiFunction-
what's wrong with it?
the bible
I understand it's difficult to understand, but I don't see anything wrong in it
huh?
Then just copy the contents of the repo, revert back to two commits before and commit back everything
ok so I have noticed this solution is not how I want it. The yaw/pitch needs to be dependent on the projection, since with an offset it will only be the right yaw/pitch for 1 exact location, not anywhere I shoot
the impl of HashMap#merge is even worse
I don't think the difficulty comes from it being long, but from all the generics and the fact that it's really hard to read and visualize in your head
it's fine haha
Yeah #merge is a beefy function
if you want something even worse, check Math.pow impl
Isnt's it just calling StrictMath#pow?
same
wtf
Ah okay:
@EventHandler
public void sonicboom(PlayerInteractEvent e) {
Player p = e.getPlayer();
Action a = e.getAction();
Material iteminhand = p.getItemInHand().getType();
int cooltime = p.getCooldown(Material.ECHO_SHARD);
if (iteminhand == Material.ECHO_SHARD) {
if (cooltime == 0) {
if (a == Action.RIGHT_CLICK_AIR) {
// Get the player's UUID
UUID playerId = p.getUniqueId();
// Update the player's charging value in the HashMap using the merge method
// Assign the return value of the merge method to a variable
int playerCharging = charging.merge(playerId, 1, Integer::sum);
p.sendMessage(playerCharging + "");
}
}
}
}
This code will increment the value for the key playerId by 1 each time the player right-clicks in the air while holding an ECHO_SHARD. If the key does not exist in the map, it will be added with a value of 1. If the key already exists in the map, its value will be updated by adding 1 to it. The updated player's charging value will then be retrieved using the return value of the merge method and sent as a message to the player.
Do note that Math#pow takes in doubles and thus it gets complicated
whers the &&
hmm ye
they should have
Math.ipow(int, int)
And you need to do it relatively efficently
isnt there a Math.pow(int, int)?
no
looks like first grade algebra to me
or double int atleast
no
or
Math.ipow(double, int)
``` at least
get ninjad
gl debugging it
only Math.pow(DD)D
gl debugging my parsing algorithm too
The implementation has most likely not changed in decades
whenever something works, dont touch it
This is a write-once, forget forever type of deal
There is no need for debugging
Especially given that this is the implementation that will never run
im malding
Math.pow is an intrinsic candidate, that is it's using an assembly or c-level implementation
and what with the java impl then?
it will never run lol
wow congrats I got the yaw/pitch for a specific coordinate, now nothing works
ahh \๐ณ
Unless you are using a nonstandard JVM (OpenJ9 for example)
I'm using the config api to interact with the config file.
But when there is an error in the config it clears itself.
Can I disable this?
ok, another Update: The target is right if I aim into the air, since then it can directly access the endpoint without hitting a block. If it hits a block, the direction is just like it would be without hitting the block
hi questions, to learn spigot, plugin devloppement do you need a good foundation in java?
yes
how can i detect clicking
you can only when a player is having something in their hand or aiming on a block/entitiy
i mean hold down
nah man now im getting a mental breakdown
How do I get a random color?
somebody get me out
oh nvm he means chatcolor
yeah thats what the stackoverflow said
?
new Color(System.identityhashcode(new Double(55496431498)));
lol
do you need a lot of knowledge?
Way faster than whatever stupid stuff you have in store
depends on what you want to do
whers the Double.valueOf 
i want make an advanced claiming plugin
Okay fine
with gui and options etc...
It's new Color(System.identityhashcode(new Object())); that is better
eh you need a kind of decent amount of knowledge
that's exactly what i want to know
looks at the RegionatedIntIntToObjectMap used in presence
The answer is yes, you might need a bit of experience
and I would suggest making easy(easier) plugins than instantly going for an advanced system
hmm
uhm can somebody explain me what exactly the method Location#getDirection() does?
?stash
yes, is my final but
learn the basics i need how many hours will it take me?
Depends on how good of a learner you are
Absolute basics are like 30 - 50 hours if you know how to program at a mid-tier beginner level
From the javadocs I'd say that it returns a unit-vector (i.e. a length of 1) that points in the same direction as the location's yaw, pitch and rotation would indicate
ah aight thats exactly what I wanted to know
so now I think something is wrong with my ```java
Location l = bulletStart;
Vector vector = bulletStart.getDirection().clone();
double length = 0;
while(length < distance) {
l.add(vector);
projectionLocations.add(l.clone());
length += 1.05;
}
After this, I never want to see any vector again in my life.
Oh you will
uni will be pain for you 
yes oh my god im loosing my shit so hard in a few seconds
this stupid garbage destroying me for 3 days now
depends on the vector 
What is not working with that ?
getDirection should be normalised
idk why you are adding 1.05
myeah, that is a very odd number
the euclidian norm of that vector should be 1
ok so, if im looking into the air, it works fine, the target is at my crosshair. If a block intersects it(THen the target Position is changed to that), it just has the wrong vector
what do you mean, wrong vector ๐
see:
I don't see
maths \๐
thats a nice gun you got there
yeah ty
is your target position the block location
like block.getLocation()
(it is)
is that location floored
RayTraceResult RTres = bulletStart.getWorld().rayTraceBlocks(bulletStart, direction, 1000);
if(RTres == null || RTres.getHitBlock() == null && RTres.getHitEntity() == null) {
distance = 1000;
} else {
distance = RTres.getHitPosition().distance(bulletStart.toVector());
}
``` this is the part where it calculates the distance, which is the target
(it is, yes that is what block.getLocation() does)
Yeah, how does it work from other angles?
in the wrong situation, the target is basicly RTres.getHitPosition()
please show me how the target is computed
I do not have any block.getLocation() in my code
?paste
gaps for air
Magic numbers??
magic?
(Their value being unexplainable by pure logic)
which ones?
the 0.6 is just to make it look better
the 1000 is the max range
1.05 is for the visuals of the particles
I still do not understand the 1.05
those are basicly the steps
Use constants in the future ๐๐ฝ
Also, as it still stands you still fail to account that the crosshair is for the EYES, not the hand
So naturally the crosshair will always be X blocks off
yes but the target should be exactly on the crosshair
Not with your code
thats my intent
your start your walk from the hand pos
and just walk x units into the direction the player is looking
how would the not in face location of the hand gun
ever meet the cross hair
what?
if you shoot a line
yes
with the same vector
one time from the camera location that is the player head
and one time from the location that is the hand
yes
how would those lines magically intercept
they don't
indeed
They do not.
Unless you make them not parallel
why would I care about them not being parallel?
i.e. trace with eye, then find the vector between hand and target, and use that
because parallel lines don't intersect
Because two parallel lines cannot intersect
well
I am exactly doing that?
indirectly
You trace with your hand right now
no
using the eyes direction, but hand nonetheless
I do
RayTraceResult RTres = bulletStart.getWorld().rayTraceBlocks(bulletStart, direction, 1000);
Bullet start being hand?
With trace with X I mean source pos
uhm
your trace there does nothing to the starting location
The direction as we both see is correct
only to the distance
yes
this hurts to explain
Time to fire up paint! (Or well, inkscape because I have nothing else at my disposal)
how does any distance value mean the lines would ever intersect
there is two
one is the line of sight
from the camera of the player to their crosshair and beyond
ah ok
e.g. what the player thinks to be their current crosshair target
the other from the gun to wherever
https://www.youtube.com/watch?v=EpkvNUoxlxM is a nice video on this
imma watch that
some indian dude explaining math
well I understand how its working, but like... code.... like... idk man
I know I have the direction
of the startlocation
in a vector
and then stepwise add this vector to the startloc
Difference = EndLocation - StartLocation
DifferencePerStep = Difference / stepCount
However for uniform distribution of points along the line you'd want to normalize the difference to a unit vector (length of 1)
weah well then I have the difference
...which I never use in my code
you are basicly saying I should screw ```java
Vector vector = bulletStart.getDirection().clone();
double length = 0;
while(length < distance) {
l.add(vector);
projectionLocations.add(l.clone());
length += 1.05;
}
and work with like a for loop iterating
I mean the issue is the following.
Either you already know what the bullet hits, then geol has the answer for you.
Or your don't at which point you are fucked
I always know what the bullet hits, since I am raytracing it
yea then go with the award winning and absolutely breathtaking art geol produced
the while loop is fine
you just need a different direction
yea
which would be the direction of the line you are sampling points from
descriptive variable names and all that
well isn't it already the line kind of
no
the vector is the vector of the line, while the while() loop reapplies the vector to the location
Your trace eye -> target but shoot hand -> target
yes
You do NOT trace hand -> target as otherwise it will always be X blocks away from the crosshair
As you see here, the shooting direction and tracing direction can be very very different
yes
well but I need to generate the particles from hand -> target
so I also need to trace them with the method
tracing what?
If you want to trace hand to target once more I'll go to your house to slap your in the face again
particles are spawned by tracing the bullet
s<mjsy,.mjklrรถkopkjoรถjkxm
saftaetzw367f6stzfguz43
pain
Hey guys!
Could somebody help me out ๐
Some friends of mine just wanna play a chill SMP with some plugins.
Now there is one plugin that has open source but not the jar file for the plugin.
Can anyone help me make the jar file for the plugin from the source? I have 0 experience in doing so or coding :/
- I get the distance between target location and hand
Maven: mvn package
Gradle: ./gradlew build
Eclipse JDT: Gl bro
IJ whatever: Same
that is maven, so mvn package
- While Loop: I apply a vector, add the location to spawn it, apply it again, add the next, ...
done
After installing maven that is
the vector
Shouldn't be too hard, somehow my Windows I from a few years ago figured out that too
https://github.com/mcMMO-Dev/mcMMO this is the source
the vector is the direction of hand -> target
it isn't
:(
it should be
Anyone has a method to check if a vector intersects with an AABB given the origin of the vector
but your code doesn't do it
meow
ok so you want to say that I am using a garbage vector
indeed
not the right vector
hi lynx
hi ign!
and the right vector is Hand -> Target/steps?
This is to check if a bullet intersects an entitiy
your current vector is just the vector that is the player direction
the right one would be yea, hand to target
ok so I change it to Hand->Target/steps?
I've seen pseudocode on Stackoverflow.com but no code to copy ๐
sure
so I subtract the Vector of the of the bulletStart from the Vector of the target
(Target-Hand)/steps to be verbose
and divide it by distance/length
nah, in that case you normalize it to have unit vectors
yes
uh
no /steps?
target.substract(origin).normalize().multiply(1/stepsPerUnit)
If you wanna have steps smaller than 1 block this isbthe way to go
or larger
If you want a certain strictly defiend and absolute number of steps, normalize is superflous
If you wannahave steps for the entire bullet, you can not nirmalize and just divide by steps
Vector vector = RTres.getHitPosition().subtract(bulletStart.toVector()).normalize().multiply(1/(distance/1.05));
no distance
1/distance/1.05?
Distance falls out thanks to normalization
Vector vector = RTres.getHitPosition().subtract(bulletStart.toVector()).normalize().multiply(1/1.05);
normalize basically already does that
Normalizing a vector is dividing by distance
Yeah
well, length
while(length < distance) {
l.add(vector);
projectionLocations.add(l.clone());
length += 1.05;
}
Vectors have no distance
the steps are 1.05
Sorry yes
so I multiply by 1/1.05?
Length
Ah if you want to have steps of 1.05 it'd need be .multiply(1.05)
Bro being like my physics teacher when i mkx velocity and speed
that good now?
imma try
Yeah
who was asking for the vector in AABB ?
lol
Meeeeeeee
I think Sam Symons might have something on it
Who tf is sam symons
some dude
ok I know why when I aim into the air it does nothing
ah only ray plane intersection
๐ญ
Hi, I'm Sam! I'm an iOS developer from New Zealand.
idk if a plane is enough for you
I presume it isn't
but 1. its still the same issue and 2. which vector to use when I shoot into the air?
when I shoot into the air you use your eye direction vector and miss X blocks but in the grand scheme of things X is nothing compared to infinity
I think the spigot API actually implements a AABB check for a ray btw
@humble tulip BoundingBox#rayTrace
???
Nice
why use eye direction
Gonna copy it
include licence then
Cuz i have to use 1.8 for my. Client
Because there is no better way to do it
You will be off by X blocks, but we can't do anything about it
but then I do not have the thingy with my hand
Well your source is still the hand
I think fps games as well shoot from the eye
But it is soooooooooooooo far away that you might as well not bother
Basically
ok wait
You'll use the same code you had previously
Vector vector = bulletStart.getDirection();?
ok now the one issue remains
it still did not change anything about the vector looking wrong lol
What is your current code now
?paste
?jd-s
lol
no idea what is wrong there
OKay no i am a fool
And I'm not going to say what the issue is because I've already said it a few hundred times
imma start tracing with my eyes

:doom:
whats wrong?
vector = RTres.getHitPosition().subtract(eyeLocation.toVector()).normalize().multiply(1.05);
my thirteenth reason why
this is the eye
RayTraceResult RTres = bulletStart.getWorld().rayTraceBlocks(bulletStart, direction, 1000); this thing is wrong - that's wrong
you know I get the direction from the EyeLocation right?
omg
imma jump
someone should ban you ๐
ok now I gotta write like z764532z762675627 lines of code for the rest of the logics
yeah get yourself some vacation
christmas is soon
Sadly that mavenresolver doesn't write itself
lol
uhm well it works, but also it doesn't
it does not care if it hits an entity
z is a number?!
yes
damn
z is 01111010
nerd
im pretty sure I'd rather kill myself than try one more time on ProtocolLib
ProtocolLib + maven wasn't the move
protocollib is fine
fuck anyone who wants to debug the solving of ```6.57.8^2.3 + (3.5^3+7/2)^3 -(54/(2-3))4 + 6.57.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4
- 6.57.8^2.3 + (3.5^3+7/2)^3 -(54/(2-3))4 + 6.57.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4```
google, chatgpt and my parser are giving three different results lol
do it in your head
Wolfram-alpha says 99735.958984375 or (3.5^3 + 7/2)^3
Yeah, probably bugged a bit - it doesn't make too much sense
now having to figure out where it goes wrong \๐ฅบ
Interesting, WA gives a different result in natural language than in the "math input" mode
this number is HALF of the actual number 
what ze fuck
okie
there are too many lol
lolll
uhm so here I am raytracing blocks, is there a simple way to raytrace both blocks and entities at the same time?
Or do I need to use the .rayTrace() method directly?
hmm yes
doggo
Oh gosh Fourteen you're still doing that? LOL
stopped doing it for a while
Ahh
it works already a lot better
Want me to check what mine says for that?
ok so
sure
what do I use as a raySize
google saying 200k and a bit
Mine says 201096.6593070298
?spigot-sd
good
well suddenly it started to work again lol
?jd-s
ty lol
inchresting that Google's is double mine
Well if Wolfram and Google are saying it's 400k something then it probably is and we're dumb
i have two algorithms and looks like we are both wrong
both algorithms seem to be wrong too
sorry, its been a while, but im already using negative mining fatigue for this and I dont use like this id thing i just use player.sendBlockDamage im super confused and I see u said to use the block location's hashcode but idk how to do that either like what would I do with this id or hashnode
ij got issues with my lines too
whenever i paste the expression i dont have to press enter but it immediately executes
too long expression ig
Yeah just remove the newline and it worked for me
ok. Why does:
RayTraceResult RTres = bulletStart.getWorld().rayTraceBlocks(eyeLocation, direction, 1000); work but
RayTraceResult RTres = bulletStart.getWorld().rayTrace(eyeLocation, direction, 1000, FluidCollisionMode.NEVER, false, 0.25, null);doesn't?
Why is that the expected?
copied that expression from some other lib and maybe it doesnt post the result for a reason smh
oh uh i have a file full of expressions and the expected result underneath
Define works and doesn't work
What does the 2nd one do that it's supposed to do
the second one gives me garbage results not making sense
what is "garbage"?
Well the expected in that image is what we're getting so
if(RTres == null || RTres.getHitBlock() == null && RTres.getHitEntity() == null) {
vector = bulletStart.getDirection().clone();
distance = 1000;
} else {
vector = RTres.getHitPosition().subtract(bulletStart.toVector()).normalize().multiply(1.05);
distance = RTres.getHitPosition().distance(bulletStart.toVector());
}
```the first RT is giving me correct results, the second one is just always setting the distance to around 0.5
precision loss of 1 lol
I am trying to make a custom block breaking system and in it I am using player.sendBlockDamage() again every time they damage the block but it is very flickery and hard to see... does anyone know how I can fix this?
here is a video showing it
you are testing entity and hitting yoruself (my guess)
ohhh that is a smart guess
anyways how can i build a maven project after i cloned it from git?
raytrace looks for blocks AND Entitues
so imma ignore the entity if it is the Player?
._. yoo pls help
good that raytrace already has a filter included
well, somehow my Predicate (e) -> e.getUniqueId() == this.shooter.getUniqueId() is not working
its still the same issue
hm some random parser i found on the internet has about the same precision loss
you want != so it excludes the shooter
Open it in intellij and build?
Or iv you have maven installed just open cmd in that dir and build
doing it i vsc now but it works
im wondering why im using a CharBuffer instead of writing a simple one myself lol
why does man calls StrictMath.pow and not just Math.pow
if you wanna do it good call FdLibm.Pow.compute
How can I disable a plugin?
I build an licensing system that checks a given license in the onEnable() method.
How can I disable my pluggin if the key is not valid(if statement is false)
I mean no matter what you do someone can disable your licensing system in a matter of minutes anyways. Not worth the effort.
declaration: package: org.bukkit.plugin, interface: PluginManager
I found a way to kinda protect it, the only thing I currently need help is disabeling the pluggin(and even decomiling a jar stop the most people cuz they don't have an understanding of java)
If your plugin is worth stealing it will be stolen
I rather not explain again but yeah there's nothing you can do against pirating
Focus on writing actual code over some DRM stuff that will take 1/100 of the time to break
This gives me this error: java.lang.NoClassDefFoundError
When I see drm all I want to do is break it ๐
Don't forget that even if you disable it someone can just reenable it
Disabling your plugin should only really be used on conflict/configuration error
What is the problem here? It it caused by Bukkit.getServer().getPluginManager().disablePlugin(this);
I've never seen it throw a noclassdef
Bukkit.getPluginManager().disablePlugin(this);
mismatched api and server version maybe?
same error, when I remove the line everything works
Server runns on 1.19.2 and api version is 1.19.2-R0.1-SNAPSHOT
hmm
show error log
?paste error
Hey, anyone know how do i set head's owner? SkullMeta::setOwner and Bukkit.getOfflinePlayer are both deprecated
For player name maybe
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Bukkit.html#getOfflinePlayer(java.lang.String)
Deprecated.
Persistent storage of users should be by UUID as names are no longer unique past a single session.
declaration: package: org.bukkit, class: Bukkit
Also did you look why they were deprecated
declaration: package: org.bukkit.inventory.meta, interface: SkullMeta
yeah it says something about persistent storage blah blah, but i need to set the owner of a skull by username
yeah but how do i get OfflinePlayer by username?
yes, but it's deprecated
Not because you can't do it
Then go ahead and try just suppress the warning
Depreciation is just a suggestion
there isn't a way to do this without using deprecated api?
No
๐ญ
Just use it it won't be removed likely
It isn't deprecated due to it not being a thing anymore
Just to encourage you to use the uuid
did you restart your server after throwing the updated jar in there?
Purpur what a world to live in
I know. I'm just saying
yes
/stop and then started it over the terminal
did you replace the jar after stopping or before
is there a way to create head with custom texture without depending on mojang's authlib? does depending on authlib break version compatibility?
before
try after
if you open your jar with 7zip or winrar does that classfile show?
Yes in .\de\thedannicraft\permissionitems
not in \commands?
.\de\thedannicraft\permissionitems\commands are 3 for the 2 commands and one tab completer I have.
When I remove the Bukkit.getPluginManager().disablePlugin(this); line from my code everything works and compiles fine but as soon as I add this I get the error
Inside the onEnable() function
None
can i use switch for itemstacks?
Probably not in the way you want to use it.
i don't like a long list of if elses, what should i do?
show code and i'll recommend an option
and what would you put inside it with "long ifs"
its a gui with a lot of clickable items
You should really be using the PDC and then compare those values. That way, you can still use a switch statement if you want.
Can anyone recommend a good data storage solution for a standalone server? I'm running a complex single instance survival server and need to rewrite the foundational plugins... Looking for a robust but simple database.
what is a PDC?
@turbid tartan a simple filebased system
Something like Yaml or even JSON?
is that for 1.14+?
Could it be a problem with other dependencys? I have net.luckperms and com.squareup.okhttp
It really depends on what you data are storing.
Both are robust and solid.
ok
You could probably use SQLite if you have a lot of data.
thanks
sqlite is also an option yeah.
Yes
i'm on an older version unfortunately, can you help for "you can still use a switch statement if you want."?
Well, that was dependent on PDC usage. Switch statements can only use primitive data types, with the exception of Strings, so you need piece of data on them that you can compare against. Otherwise you are left if-else chaining.
You could, and it would work, but it's not recommended due to potential exploits. Other plugins that let you rename things with color codes will create issues. That's why people started switching things over to the PDC since it adds unique NBT data to the itemstack.
Understandably for older versions, you'll need to find other ways around that problem, but I just wanted to make you aware.
yea its ok
Hello, friends i have a question :
make an enum with PLAY,WIN,KILL,BREAK,PICKUP , and in the loader method and i can use that to check if the quest is PLAY Quest or win quest [in the event part]
so what i tried is :
this class and some others like it extend AbstractQuestEvent
is this possible?
?learn
already know how to use enum , but i didn't understand how i can make that part
And what is your question
You put abstract question event as param for enum but you put empty parentasis(idk how to spell it) for win
Ofcourse it will be red
"Java eNum", myeah I don't know whether this is a reliable source @rotund ravine
But whoever spells enums like that and pretends that they are tied to java is very strange to me
idk how to explain what iam trying to do
iam stuck at Event part ..
in config there is :
quests:
quest-win:
name.... etc
and there is
event-type: PlayerWinEvent < this event extend AbstractQuestEvent
Ad you want to get instance of event-type?
yeb!
so when i run the Event
FOR EXAMPLE !
this event the one i point to in red
it extend AbstractQuestEvent
so i was thinking i can make a enum and link it to the value that in the config?
If I understood you right, you can use reflection to find that class, check if superclass is AbatractQuestEvent(just in case) and just do Class#newInstance
no not that ๐ฆ
so i am making a quest plugin , and i finished frotend code , gui , select , mysql etc
what iam stuck now is
events part
this is how the config.yml looks liks
so user can make unlimited quests
did you get a small idea of what iam trying to do xd?
Not really ahahaha
Someone will probably do better than me, sorry
no don't be , thank you..
Wait why you don't just make quest object serializable and load/read it from config?
explain a bit?
Hello, I hope you are well. I have a problem with redisson, it uses a newer version of netty than the one used by spigot so that causes problems. Do you have any idea what I can do to fix this problem? (Error : java.lang.NoSuchMethodError: 'boolean io.netty.util.internal.PlatformDependent.isOsx()')
What's your spigot version?
1.8.8, I know that's old
i still use it xd
Like many people ๐ซ
I just googled enum for dummies ahaha
Then your issue maybe comes from this. My best advise is to update your spigot
Yes I know the best issue but I can't update; I tried to put last netty version into my gradle dependencies but it doesn't work, I thinks spigot dependencies go over.
Hey everyone! I am trying to run some code in a while loop every x minutes (where x is a random number between 10 and 20 minutes).
this is my code:
while (running) {
randomTicks = Min + (int) (Math.random() * ((Max - Min) + 1));
Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> swapPlayers(), randomTicks);
}
i know this is as wrong as it could be because i put a bukkit scheduler inside a while but its just to show what i am doing. i'd appreciate any help! thanks
this will crash your server
I am very aware of that. I tried it. And thats also why I am here
MC/Bukkit is single threaded. Your while loop halts all other code running
don't use a while loop. start and stop on a schedule.
how do you stop a schedule? and how would i make the delay always be different?
You could make a scheduler that would run for example every second and subtract a timer variable, then each time it would be at 0 you would increment it again with a new value that would be between 600 and 1200
cuz you see the randomTicks value? it should generate something between 10 and 20 minutes
thats a big brain idea, ill try
start a new runTaskLater inside your runTaskLater if you need it to run again with a new random delay
if it ends you don;t start a new task
Do you have an idea why spigot dependencies pass over my gradle dependencies ?
they always will. they are loaded first by the classLoader
Yes of course, but gradle is supposed to default to the latest version if the lib is same.
gradle is not the class loader
Absolutely, but shouldn't it take over?
you are using authlib which is mojang so will never be overridden by your own depends
Yes, but do you have any idea for this ?
netty is also included in MC so will not be overridden unless you relocate
Yes I know, how I can relocate it ?
can't tell you for gradle, I use maven
Bukkitrunnable is superior
When yiu schedule them, you get a bukkit taks
Which you can store and cancel
scheduler better
Runnable and scheduler are basically not comparable since they don't do the same think
When you speak about one, you usually use both
i kill people that use new BukkitRunnable() {}.runTaskTimer(
Why?
throw away objects are pretty bleh
the scheduler method is way more cleaner, you just pass in a lambda and you can always call the Consumer<BukkitTask> one if you really need a bukkittask
Ah, thatโs what you meant. Sure it has its uses
Hmmm, I wanna wrap an object that contains two Integers and then a list of locations into a PDC, how to write the adapters for that 
?pdc
Yeah i see that I just wasn't sure what to boil it down to
alex has his pdc lib which makes you define custom datatypes or smth
Just create your own for the object you want https://paste.md-5.net/ematamuliv.cpp
didnt know that was possible

I am trying to make a custom block breaking system and in it I am using player.sendBlockDamage() again every time they damage the block but it is very flickery and hard to see... does anyone know how I can fix this?
here is a video showing it
you could do it 'recursively':
boolean cancelled = false;
void scheduleNext() {
// calculate delay until next action
int randomTicks = Min + (int) (Math.random() * ((Max - Min) + 1));
// schedule next action
Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> {
// check cancelled
if (cancelled)
return;
// do stuff
swapPlayers();
// schedule next task for next time
scheduleNext();
},
}
then just call scheduleNext() once at the start
and maybe have some kind of way to cancel it
Hi, i have a strange question. Is there a way I can somehow detect when a player starts the bow aim animation and when it ends so that i can make a sort of a widget like the photo uploaded based on the current state of aiming?
are there any alternatives to redstone particles i can use to prevent rotating these shields from looking laggy/delayed
redstone particles dont really sit well with movement
Not really. They're the only colourable particles aside from potion splashes
Does spigot have some sort replacement for a PlayerBanEvent? Or maybe an easy workaround?
what do you mean?
Well, I kind of expected a PlayerBanEvent to exist since join / quit / kick all exist but it doesn't
Maybe I got the naming wrong
Basically an event that fires when a player gets banned
but why do you need that?
when a player gets banned, they have to be kicked if they are currently on.
if they try to rejoin, they auto get kicked and you can get the reason from their that they are banned
Yes, but I need to know the moment they are banned, regardless of them being online or not
then listen for the command I suppose or make a custom plugin that handles bans
That still wouldn't fire if a player gets banned by a plugin via the API
It's not about a plugin. It's about all bans that happen via player / console command or other plugins
Well, afaik most plugins just kick player if they are on ban list
So there is no real "ban"
you have to kick when you ban anyways if the player is currently on
however, when a player tries to join, the server will kick and you can get the reason being for being banned
But the game itself does afaik
the game itself doesn't do anything when you ban a player, it just adds the player/uuid to the ban list
still have to kick them for them to actually leave
That would be my go-to workaround if I don't find anything else but I'd rather know the moment the ban happens
The player being online or offline while being banned doesn't matter
well not sure why you need a work around, just take over the ban commands to be part of your plugin
That won't cover getServer().getBanList(BanList.Type.NAME).addBan(...) i think
can't read a file?
it is a singular file, however most plugins developers who create a ban plugin typically opt to instead handle the tracking of bans though because depending on how large of a server you are, that singular file isn't enough lmao
declaration: package: org.bukkit, interface: Server
Plugins that are incompatible with the default ban-list can be ignored
Of course I could just read the ban-list manually every few ticks but that really dosn't seem like the best possible implementation
how can I check if a player has just a certain type of potion effect active on them?
oop just figured it out ๐
what is wrong with the api method I linked to?
you can read it manually if you want to
Player#getPotionEffect(PotionEffectType)
however there is an api method you could just invoke to get an updated list
I just used player.hasPotionEffect i just figured it out
I mean reading the list manually can't be the most efficient way to do this, right?
we don't know because we have no clue what it is you are making
you just asked a question and everyone providing solutions you have stated wouldn't work, so we don't know
either you are making a plugin in which case this is really should be a non-issue
or you are not making a plugin and instead trying to hook into another?
which wouldn't make sense
Ok a simple example of what I need is a Plugin that does something (e.g. print "XY has been banned") the moment someone gets banned. It doesn't matter if that player is online or not or whether the ban was caused by a command or by calling the mentioned API method.
That seems like something that usually can be handled by listening to an event but that event doesn't exist
I mean I could just check manually every tick but that seems unecessarily inefficient
You don't have many solutions since as everyone told ya before: there is no standard way of banning a player.
Solutions would include:
- listen to /ban commands
- listen to kicks and get the reason
- hook to the mostly used ban plugins
So there's no actual solution, just some hacks that probably work most of the time?
Yep sir
if you are using essentials
essentials already has a permission for people to see who was banned
most plugins that broadcast bans are the very same plugins that handle the bans to begin with, which is the most ideal solution here
Would probably be the best solution but I'm trying to keep this independent from other plugins
well doesn't make sense to do so
what you are trying to do would require you to implement every single ban plugin out there, I am assuming you are just trying to make a public plugin for broadcasting purposes?
or is this something specific for your server?
Basically, yes
That's why I hoped there would be an event for when the game logic handles a ban
hi, I would like to ask a question, how do you make a maven api?
Well there is, just you are wanting to broadcast the moment someone is banned, in this case your best bet is to capture the ban command
but even then that wouldn't really be reliable
there are some plugins that don't even touch the vanilla ban system
and instead have their own
in those cases it wouldn't even matter if there was an event or not
which is typically how most plugins handle it with the exception of something like essentials
but I think what you are finding out, is that there isn't really a need for a plugin like yours since most ban plugins already incorporate it as a feature anyways
Yep, I'm ignoring those cases deliberately because I can't make my stuff compatible to every plugin out there. So I'm sticking to what the game and API provides
Do you want to make a library that others can then import as a maven dependency?
Yes
well you don't make a maven api
like that of luckperms, worldguard etc ..
you design your plugin to have an API included
True, but not exactly like I need to - I'm basically trying to send a notification to a web socket when a player gets banned
Still, thank you kindly ^^
hmm i didn't understand well ._.
if you are making a public plugin for this, I would just handle the popular ones then at first and then make an API to allow others to hook into yours
Essentials has an API
and is the most common plugin most use even with banning lol
I had bought a guy's udemy course (which I think you know) to learn more about spigot plugins, and he was creating another project and stuff like that, so I should put the dependency tag in the pom file with the same artifacId, version and etc..
For the maven part, read this: https://maven.apache.org/repository/guide-central-repository-upload.html
Or use a YouTube Tutorial or something similar as a guide - This can get quite complicated if you've never done something like this.
ok...
I think I used this one when I first did it: https://www.youtube.com/watch?v=bxP9IuJbcDQ And I was / am really inexperienced
But tbh I don't know how to explain the plugin part of it (like how to structure your project)
Uploading stuff to maven central is rare here
how can I set the gamemode of someone while hes loading to another world
how would I go about checking when they finished teleporting
you would just wait a few ticks after they have teleported
there isn't really any way to actually check for that
lol
You could listen to PlayerChangedWorldEvent
Try not having an underscore in the identifier/Id of it
Iirc papi thinks _ is an argument separator
@peak depot
public class PlayerWorldListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onServerLoad(@NotNull PlayerChangedWorldEvent event) {
event.getPlayer().setGameMode(GameMode.SPECTATOR);
}
}```
ayyy thanks that worked
does the player#setFlying function also affect elytra gliding?
I'm tryna stop a player from using the elytra
?jd-s
declaration: package: org.bukkit.event.entity, class: EntityToggleGlideEvent
found player#setGliding, perhaps that will work
Is it possible to do a return statement for an ItemStack?
yea
It is possible, no reason to not be
I figured, been trying to find anything online to help figure out how, but I've been doing trial and error:
[to call]
ItemStack myPin = PinList.createRidePin(pinnum,ride);
[method]
public class PinList {
public static ItemStack createRidePin(int pinnum, String ride) {
String locate = Main.park;
if (pinnum == 3) {
ItemStack myPin = new ItemStack(338, 1);
ItemMeta im = myPin.getItemMeta();
im.setDisplayName(ride);
List<String> lore = new ArrayList<>();
String msg = String.valueOf(locate);
lore.add(ChatColor.BLUE + msg);
im.setLore(lore);
im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_ENCHANTS });
im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_ATTRIBUTES });
im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_UNBREAKABLE });
im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_DESTROYS });
im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_PLACED_ON });
im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS });
im.setUnbreakable(true);
myPin.setItemMeta(im);
return new ItemStack(myPin);
} else {
ItemStack myPin = new ItemStack(434, 1);
ItemMeta im = myPin.getItemMeta();
im.setDisplayName("Error Token");
myPin.setItemMeta(im);
return new ItemStack(myPin);
}
}
}
whats the issue
I get this error in console:
17.12 23:40:27 [Server] [INFO] Caused by: java.lang.Error: Unresolved compilation problems:
17.12 23:40:27 [Server] [INFO] myPin cannot be resolved to a variable
why are you declaring it twice
any tips on how to make a present plugin, just need it for a personal project plan i'm doing.
Why won't spigot load gifs on my resource page
could you be a little more specific?
i mean here you can have help on how to code a specific task but asking how to do a plugin is a bit generic
sorry for my lack of clarification, just a present item that generates a random item when a player left clicks. if there is a way to just to change the range of the item that would be helpful
ok so basically create a Listener class and add a PlayerInteractEvent void
then check if event.getAction() == Action.RIGHT_CLICK_AIR
The real issue is this! D:
im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_ENCHANTS }); im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_ATTRIBUTES }); im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_UNBREAKABLE }); im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_DESTROYS }); im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_PLACED_ON }); im.addItemFlags(new ItemFlag[] { ItemFlag.HIDE_POTION_EFFECTS });
Sir, im.addItemFlags(ItemFlag.values());
if it is then generate a random item, ofcourse giving bounds and not just a random type of item
to do that you could create a config that contains the items that the present could give
(I've set an imgur link, it loads on edit page but not in the resource page)
There's a couple mb limit
but
it is linked to an imgur page
spigot just has to load it, shouldn't matter the mb size, since it is hosted on imgur
Images are proxied
what's the mb limit? just to know how much i gotta cut out
It's like 5mb or something close to that im pretty sure
its a 20 second clip, it would be better as a gif wouldn'it it?
Video would be better.
should i like publish it on youtube or smth?
alright thanks
I think the limit on gifs is like 4mb
From personal experience. It's either that or 4.5mb. Don't know the exact #
Anyone having issues login into mongodb?
A server error occurred. Please try again in a minute.
Says this
I've had this for like a week now
MongoDB where
Right here right now
Helpful
Is there an event for when a player's food level changes?
PlayerItemConsumeEvent found it lol
time to make a plugin which gives random effects whenever a player eats something
the effect is worse the better food you eat
Im having an issue with the InventoryClickEvent. This code https://bin.audreyvps.net/gohorikono.csharp works properly when in creative mode, and removes the enchant and lore, but fails when in survival mode
EDIT: Fixed, was the get/setCursor methods not working right, getCurrentItem/setCurrentItem worked fine
When using FileConfiguration with something like config.get("key.value") is there a way to understand what type this is? Boolean, String, etc...
"Server resource pack couldn't be applied Any functionality that requires custom resources might not work as expected"
does anyone know fix pls i need help
declaration: package: org.bukkit.event.entity, class: FoodLevelChangeEvent
get is if you don't know what you are returning - There are more specific methods if you know it will be a bool, string int or whatever
I have an yaml updater script that carries over the comments but for some reason its saving some strings without "asdf" in the config. So when it tries to parse it, it doesn't understand what it's supposed to be a string and errors out.
So it reads
test: "#&!"
and somehow writes out
test: #&!
That's using the YAML parser. I'm not sure if there's another way to fix it

