#development
1 messages · Page 4 of 1
Yea, which means you could only display the leaderboard on the ssrver that actually has the stats
ah so that's what you meant
hello, is there a library I could use to evaluate math functions in a string, but replace the operation with the result and keep the rest of the string? something like this: "Hello 2+4*2" -> "Hello 10"
https://github.com/uklimaschewski/EvalEx but you can't do the hello part
hmm ok thanks
private final Set<Toml> config;
public config() {
config = Set.of(RandomThings.getPlugin().getTomlConfig());
}```
Two errors are popping up, one saying that variable config hasn't been initialized and another saying that a return type is needed for the public config portion. Do I do what it is suggesting and put void in between public and config?
nvm im big dumb
Did you figure it out?
Indeed but i ran into another issue
So the original code i had that was working is on here https://github.com/Williambriggs1/RandomThings
https://pastebin.com/ZPEGYRgN thats my new blockbreak file-
i also removed the [botany] in config file but
it is rough my local host keeps like not responding when i break blocks tbh my old code had no lag even when i spam broke grass in plains-
I was told that the original code was servr intesive so to try and put it into like a set or something when the event was called. but now it continues to throw thread dumps and the server cant keep up from breaking a singular block-
im not too familiar with all of the method calls your making but it looks like youre putting a lot of stress on your server for no reason
what is your end goal? like what do you want your code to do?
Okay so the original in GitHub works- give me a sec to write it out explaining it.
how new are you to writing code?
because a lot of stuff youre doing is unnecessary
Pretty new- what seems to be unnecessary in the GitHub one?
"_" + event.getBlock().getType().toString().toUpperCase()) the enum is already capital and the toString method is invoked since youre concatenating it with the "_" string
You don't need to create a reference to the config each time a block is broken. Just store it as a class variable instead of a method variable unless you do actually have to grab something new each time.
^ the reason i asked if you were new or not is because you arent really caching data, i would highly recommend watching like a 10-15min video explaining the concept of caching in java on youtube or something
Hi, Do you have any tips how I could code cosmetic armor? I already tried this but it only works sometimes : https://paste.helpch.at/icunifaboy.cs
Thank you for the advice I’ll check it out
Anyone with SQL experience know if its possible to select all columns as parameters when inserting?
I have a table with like 50+ columns and I'm trying to avoid typing out all of their names in the SQL statement
Sounds like a table design issue tbh
None that I‘m aware of
Alright thank you
Hi everyone, I just started java yesterday and I wrote a command to rename items and I want this command to automatically add lore with a player's nickname, like a signature, I used an example from github, but I didn't understand what I need to add in PlaceholderAPI.setPlaceholders(), it must be very simple question, but as I said, I just started doing this yesterday, I would greatly appreciate your help
ArrayList<String> lore = new ArrayList<String>(); String loretext = "Sign by %player_name%"; loretext = PlaceholderAPI.setPlaceholders(idk); lore.add(loretext); itemMeta.setLore(lore);
what is the problem
what should i put instead of idk in line 3?
the player and the text containing the placeholders
Hi
if you hover over a method in intellij
it will tell you what parameters it expects
ahh loretext?
also just hover over the method as aki said
it will tell you the data type you need to fill in
is world#unloadChunk async or sync?
thank you all so much you really helped!
You have to call it synchronously, but best is to not call it
thankyou for your info appreciate it
i think paper handles it async
i would check what thread it runs on on load / unload events
Hello, how would I go about making some classes invisible to other projects that use my project as a dependency? I want to create an API for my plugin, but I also want it to be the only accessible code
package private classes, but that will probably not help you a lot, and if you are using uh java 9+ (?) you can specify which modules are exposed
there are several ways on different levels, e.g. modularize it on the project level, use Java 9 modules, use non-public classes
oh alr thx a lot
appreciate it!
extremely stupid question, if i pass a list from class A into class B via constructor, and edit the list in class A, the list variable in class B doesnt get updated, does it?
just learn cpp and every copying concept will be understood
java does this by copying pointers (a variable that stores the location of variable)
ye
so yeah
i remember C++, was kinda fun and kinda pain
it probably is fun, i just dont use it on a daily basis
yeah its just hard to use tho
there isnt a lot of good cpp libraries out there
even qt i think its a bad library
but java libraries are all so clean for some reasons
like they are properly organized
because of the java packaging hirerachy and stuffs
and explicit oop
everything is made clear
yep
whatever, fuck cpp
lets write assembly rest api
im wondering
how many septillions of lines of code would be needed to to sql queries?
in assembly
you think so?
pretty sure x86 has an instruction for that
yeah
how server intensive would this be where it checks the getTomlConfig when it needs to query which returns config which is set in my RandomThings.java file.
https://pastebin.com/3EA6UHuE < - block break listener
https://pastebin.com/aZ2VqU7A < - RandomThings.java
arm has an instruction for lazy people (me) mov yo ass
Hey, I'm using React and I'm trying to figure out how to add children to a React.Component.
I'm trying this:
https://paste.developerden.net/ivubuxenum.javascript
But it says index.js:89 Uncaught TypeError: page.addChild is not a function
This is my first time using React, so if you have a better way of doing things I would love to hear it.
is theee any way i could pause a bukkitrunnable?
and resume it later, basically i want it to pause if a condition isn't true
not the runnable itself, no
you can have an if statement
if true, return
(or if false)
but if you are using the scheduler then you can cancel the task and requeue it later
that too
if (paused) return
well no cause the task should only run after 15min from starting it
I would just start a new task
I mean it doesn't really matter, but that's how I'd do it
¯_(ツ)_/¯
start a new task when resuming?
yea
like ```java
Bukkit.getScheduler().runTaskLater(plugin, () -> {}, 15 * 60 * 20);
yes but then if i start the task and after 5min i pause it, then after 1min resume it the other task would run after 15min
oh wait
nvm
functions have to start with function ...
but what are you doing with react? looking around or want to reach sum
theyre using a method, not a function
Something for school
I need a plugin made for $$. Dm me if u can help out
Don't worry it's already there. I asked a bit more for detail and they want a game out of it with a fully fletched out replay system. Pretty simple if you ask me... For as low as $30 if they can
I want a expert dev working well below minimum wage to make a plugin for me
If we're talking an hour, I'll consider it.
According to what HackersDontWin said. The replay system alone is probs a few days xD
That's fine
I mean I'm not going to do it but I wouldn't consider it for anything less than 30/hr minimum 20 hours if it's as "small" as they're saying.
i need 30/h unless its over like 5k
What would you guys consider to be better performance-wise: more code in a plugin jar or code split in multiple plugin jars?
that's not relevant for performance
in the end it all will be loaded by one instance of the jvm so it won't change there. it will just make your life harder, just do one jar
what
using file system makes your life harder, just put every single file to desktop
not quite relevant to performance as loading an extra plugin is not an overhead (unless your code massively changes and increases for second plugin)
only reason to split your jars is to share some libraries between them
so lets say you use hikariCP on both, you could have a separate jar just for that so you dont have to shade every time
imagine hikariCP as a plugin itself so you dont have to shade no more
like a dummy plugn for library
i mean since i use kotlin + coroutines + hikari on almost all my plugins
i usually use them as seperate library
shading the same thing on 3 4 plugins doesnt make sense either
i am kotlin noob so i have no idea what is that lol
but shading is honestly so annoying
yeah
wow
coroutines are too nice to skip so, kotlin it is when possible
i remember theres like a project where someone does the dependencies shading for you runtime i forgot what was that project called
thought that would be useful for all coding purposes
spigot already has it
in the form of libraries
but its kinda messy
it downloads on launch the "libraries" you put down in the plugin.yml
if i am not remembering wrong
oh thats lit i just found it in spigot wiki
does that store the libraries in cache or it actually saves after the server stops
Project Loom soon™️
pretty sure it saves
although dont quote me on it, have never used it myself
yes, it creates a libraries folder
Any ideas how I can avoid CORS issues while using an api that you don't "own"?
Trying to use the roblox api right now (yes, don't judge :-: or do, cause I should) in the frontend and I am getting issues with CORS
I mean that's like the point of CORS, if they don't want you using their stuff, they just set a deny CORS header and you can't use it
what are you even trying to get? like images or something? lol
details about a game, specifically players online.
The issue is I think it can't be done in the frontend, it needs to be done in the backend
otherwise it wouldn't make sense... why would they have a public api if no one can use it?
you are probably just not meant to use it from frontend
if it returns JSON, that shouldn't be affected by CORS lol
what specific endpoint are you using?
https://api.roblox.com/docs looks like json
hi, how can i create a cuboid of smoke particle like a smoke bomb?
d;world#spawnParticles
void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force)```
Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
particle - the particle to spawn
x - the position on the x axis to spawn at
y - the position on the y axis to spawn at
z - the position on the z axis to spawn at
count - the number of particles
offsetX - the maximum random offset on the X axis
offsetY - the maximum random offset on the Y axis
offsetZ - the maximum random offset on the Z axis
extra - the extra data for this particle, depends on the particle used (normally speed)
data - the data to use for the particle or null, the type of this depends on Particle.getDataType()
force - whether to send the particle to players within an extended range and encourage their client to render it regardless of settings
public static List<Location> generateSphere(Location loc, int r) {
List<Location> circleBlocks = new ArrayList<>();
double cx = loc.getX();
double cy = loc.getY();
double cz = loc.getZ();
for (double x = cx - r; x <= cx + r; x++) {
for (double y = cy - r; y <= cy + r; y++) {
for (double z = cz - r; z <= cz + r; z++) {
Location block = new Location(loc.getWorld(), x, y, z);
if (loc.distanceSquared(block) <= r * r) circleBlocks.add(block);
}
}
}
return circleBlocks;
}
I use this to get sphere locations
if you modify it a little you can get cuboid locations
and then create particles
can i ask there for reviewing my plugin code?
you can ask whatever you want, no promises it’ll happen
maybe a #1004004212880977991 or smth. this channel is mostly for answering specific questions. #dev-general might be better to ask for code review
Inventory inv = new CraftInventoryCustom(null,watcher.getInventory().getSize() ,seen);
for(int i = 0;i < inv.getSize()-1;i++){
NBTTagCompound compound = (NBTTagCompound) inventory.get(i);
ItemStack stack = CraftItemStack.asBukkitCopy(net.minecraft.server.v1_8_8.ItemStack.createStack(compound));//here
inv.setItem(i, stack);
}
watcher.openInventory(inv);
Hello, i've used this code in 1.8.8 but now im using this code for 1.18.2, at net.minecraft.server i cant find v1_18_2
Thank u :D
"How good is my code?" 
Code is goods
PlaceholderAPI.registerPlaceholderHook("balance", new PlaceholderHook() { is deprecated..
whats the new one?
use PlaceholderExpansion instead
i can try it xd
Placeholder Class:
Cannot resolve method 'getBalance' in 'Object'
getList().get(t.getUniqueId()).getBalance();
Main Class:
public static HashMap<UUID, EcoPlayer> list = new HashMap<>();
public static HashMap getList() {
return list;
}
EcoPlayer Class:
private double balance;
public double getBalance()
{
return this.balance;
}
why i get the error?
thats not really a lot to go off, but im going to say that u need to add generics to ur return type of getList
What do you mean?
u should have HashMap<UUID, EcoPlayer> as the return type
u have a raw HashMap type as the return type, which will default to HashMap<Object, Object>, which means that u wont be able to use any methods from EcoPlayer
yea its working a half
now its had a red line
i cant send images here
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
ah
that says what the issue is
ur returning a double, when u need to be returning a String
what you guys are using as a redis api/library for plugins
jedis
yeah idk i saw a plugin api DeltaRedis it just seems so easy
and plain jedis is painful
maybe i can wrap it up
how can i change that
it doesnt really get more simpler than this - String.valueOf(double)
Having a "moment" right now- why is args.length < 2 always false?
if (args.length < 1)
else if (args.length < 2)
okay get it, and how can i call it with the player?
public void joinPlayer(Player p)
because i want to register the placeholder under this
wait a second
Exactly. 😆
you are already using args[1] when checking if it is null
Just noticed haha, cheers.
lol got me
you don't need to use jedis in proxy right? only spigot servers
so actually you just messaging between servers and not with proxy
you need the redis client anywhere you want to communicate with redis
if the proxy plugin needs to use the redis server, then you need the redis client in the proxy plugin as well
if not then, well, then no
epic
there is also rabbitmq and lots of other concepts for this purpose i dont really know how to choose one between these options
i think im just gonna use redis
I'm guessing it's only viable via NMS, but is there a way in SpigotAPI to get a player's visible BossBars?
If you need save message not read you can use Rabbitmq but i prefers pulsar for that
okay Pulsar might actually be really cool
looking at it, it looks kinda nice, and if it's easier to setup than RabbitMQ, I might just be down
Anyone know how it could be possible that I'm getting a NPE here
Bukkit.broadcastMessage(upgrade.refName);
Yet it's still printing out the expected (non-null) result?
I'm really stumped about this
show the exception
the only way you could get an error is if upgrade is null. So that is most likely null. However sending the exception itself would help more
probably getting an error after that line
Oh you're using an old java version :((
Try printing out upgrade
and also just making sure - that line is in onOpen?
Yeah it is
This line of code returns the proper name in chat
Ill try recompiling with a basic sysout though
why are you working with the 1.8 api?
My server is running on 1.8, but that shouldn't be relevant to this situation
im assuming youre making a server for 1.8 but you could make a 1.19.x server and use viabackwards to support older versions. its not relevant but i was just curious
^ would give you more api features
seeing as the name is PitRemake I'm assuming it's a pvp server
Yes
so I'd recommend using 1.8
I hate how people who argue against using old versions completely ignore the question of server performance
although besides pvp stuff I'd go with 1.19 over performance
My plugin is super CPU and memory heavy, so I really can't run it 1.19 effectively
Anyways
Let me test this
alr
if you want you can make a bunch of prints to see where the exception occurs
if you don't want to nullcheck everything
print after the broadcast
I'm guessing, for some reason, java is messing up the line numbers
Yeah the method still runs
Completely
In-game everything works as it's supposed to
did you add a print at the bottom of the method?
i think optimizing your code should fix your problem there. its your call but you do you. newer versions arent my favorite for performance but have more features. anyways ill get back on topic
I'd say to use 1.8 for pvp, if it was only for performance I'd go with 1.19 and optimize
Most of it can't be optimized
could i ask why?
well plugins can, especially if you're the developer
Most of the lag boils down to nms
I'm basically running a shit ton of fake players fighting at the same time
and the Attack Event calls
Are super heavy on CPU
well I don't think that's the cause of NMS
but anyways, back on topic
If you add a print to the bottom of the method, does the exception print after or before your print?
Let me try that
alr
I've also gtg rn
it still prints but throws the exception?
it is still saying that Bukkit.broadcast is causing the issue?
Yeah
if you comment it out does it error?
Thats what I did
It prints out just fine
Only thing I could think of is double loaded plugin
but thats not the case
something is making it null then, from the information youve given, it should work fine but it clearly isnt
Well the thing is
In game works completely fine
It changes ItemStack lore based on values of "upgrade"
That appear completely fine
But the NPE throws still
could you send the code?
Yeah sure
Line 13 in that
is where it errors
And line 15 errors if I remove the broadcasts
I don't think it's a small issue, but something larger with how the class is being loaded or something
Because this code used to work fine
Then how could the broadcast display upgrade.name?
put this above the broadcast statements
assert upgrade != null;
and that will throw an error at runtime if it is null
Same result
ok
my bad
assert did not do what i thought it would
but i still think upgrade is null
because thats what the exception is telling you
Yeah but it literally isn't
the broadcast prints out "Perk Upgrade: First Strike"
Or whatever other upgrade value I select
I know it's horrible coding, but I'm really struggling to not just catch and ignore it right now
id suggest only using a try catch if you know why the exception is thrown
Yeah I'm aware
i dont think i can help and further because i havent worked with the 1.8 api (it should work fine but there might be something happening that i just dont know about)
Well the issue is clearly within Java, not the 1.8 API
considering that any usage of "upgrade" will produce the same
idk what version of java 1.8 requires
are you restarting your server each time youre trying your plugin?
Yeah
Thanks
Okay update, there is another method that pulls the same "upgrade" object from the HashMap during the InventoryClickEvent for that inventory.
And that one preduces the same NPE, but "upgrade" is actually null this time
So I suspect maybe it's being removed from the Map it's being fetched from very quickly after it's fetched
Somehow causing an NPE and the code to still run?
Okay, yeah I found the issue
I was removing the upgrade object from the Map with the InventoryCloseEvent
Which for some reason is now being called when I switch from one inventory window to the other
Not sure why an issue like this would prop up all of a sudden
I guess the timing of it being removed and called at the same time somehow caused it to error and run the method at the same time, very strange.
Hi, i want to make a plugin that adds 100pts to a faction (gradually 25pts/15min) But if two conditions are not met it should stop and resume when those two conditions are met how can i do this with bukkit?
also one of those conditions is checking if a olayer is in a radius from a certain location
You can use location.getNearbyEntities(xRadius, yRadius, zRadius)
And then just check if the player is in the List that it returns
If you want a timer that can start and stop, I would recommend using a BukkitRunnable that increments an integer for each guild every second if the requirements are met
And then reward them and reset it once that integer reaches a target, (15 * 60) or something
I don't fully understand how it's supposed to work with pausing and resuming but you can simply calculate the distance from the player to that location
basically to add those points to the faction you have to wait 1h (add 25pts each 15min) BUT if the player is not near a certain location (this is not the problem) it should stop counting and wait until he's in that radius
what i'm struggling with is pausing and waiting for the player to be in the radius then resuming
I guess you don't need an incredibly high precision there, so you could just check every second and count one up
ok but is it efficient to make a runnable for each faction?
you can also have one task for all factions, but that won't make a noticeable difference most likely
I mean you probably won't have the amount of factions where it'd actually be noticeable
is there a way to disable the default italic in adventure api
i don't really wanna type decoration thing every time
that's in the client basically, there's no other way than explicitly setting italic to false
but you can just write a method for that, no need to duplicate code
is there a way to see if the player connecting (aka on join) is joining from another bungee server?
i guess i could listen to "bungeecord" plugin channel?
show code
getSever().dispatchCommand(getServer().getConsoleSender, "lp user %player_name% parent set vip");
@fiery pollen
where are you running this code?
it needs to be in a JavaPlugin instance
send full code please.
because your answer shows that you are new to java
Yes
you need a reference to your main plugin class
getServer is a method for JavaPlugin
its not available for commandExecutor
so?
^ this
you need to do dependency injection
or have a static instance on your main plugin class
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
here
You can also use Bukkit.getServer()
dependency injection could be a bit complicated
depending on what stage you're on atm
Does not work, i tried.
yeah but i feel like learning about oop is a must if you want to do any java work
Yeah, but don't work.
what error?
otherwise same issue will pop up and it wont have a static access point
.
i tried with import org.bukkit.getServer;
and import org.bukkit.Bukkit.getServer;
dont touch imports manually
It's same
No.
Cannot resolve symbol 'bukkit'
Bukkit
uppercase B
bukkit.getServer().dispatchCommand(bukkit.getServer().getConsoleSender,
not bukkit
It's wwork but
also note that Bukkit is a class (such as Player and String) which means it can hold variables and methods (such as getServer()), and they're always UppercaseLikeThis (like how Player and CommandSender are uppercase)
Cannot resolve symbol 'getConsoleSender'
I think it's just Bukkit.getConsoleSender()
Bukkit.getServer().dispatchCommand(Bukkit.getServer().Bukkit.getConsoleSender, "lp user %player_name% parent set vip");
So I make this.
and error:
Cannot resolve symbol 'Bukkit'
@dusky harness
Did you import Bukkit
if not ig manually put import org.bukkit.Bukkit; at the top
since it got pushed up, anyone know a way to listen to player send event? (aka from server to server through bungee)
i already have it
probably listen to packets?
show full class again
just so that i can see updated file
dispatchCommand(Bukkit.getServer().Bukkit.getConsoleSender,
the issue is here
it should be dispatchCommand(Bukkit.getConsoleSender(), etc
u should really learn java before trying to make plugins
Bukkit.getServer().dispatchCommand(Erbex.commands.Bukkit.getConsoleSender, ("lp user %player_name% parent set vip"));
lol bruh
i had it
thats not even what i wrote
uh
if your plugin is bungee, there's an event for it
There’s a luckperms api you know
no
I would not suggest this person to use the LP API lmao
lets not bother with LP api right now
my guess is that i can listen to pluginmessaging packets?
Oh my bad, didn’t see context
oh how did i not see that lol
Bungee plugin messaging is so aids
I used it for my skywars queuing system and I still hate it
Regret not just using the time to setup redis or something
You should learn java before coding bukkit plugins...
yeah, but the issue is its not my setup
and im running into some mysql race condition issues
when players are switching servers
Sounds fun
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender, ("lp user %player_name% parent set vip")); ?
Not sure why there’s parenthesis around the string, but that should work
getConsoleSender**()**
Ah
Online Courses:
Online courses are also great for learning java. Some websites that offer them are:
- Coursera - Free unless you want a certificate
- PluralSight - Great courses from what I've seen. Mostly Paid
- Udemy - Never used them myself but they seem to all or at least most be paid.
My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.
Oracle Docs:
Oracle docs can help a lot at learning and understanding java:
- Start with this,
- Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
- Hit this.
They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff
Other services:
Some other cool services that will help you learn java are:
As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!
@azure trench you might be interested in 
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender ("lp user %player_name% parent set vip"));
?
Add () after getConsoleSender
ok, ty. I will see.
Huh.
Also I don’t think that placeholder is going to work the way you want it to
I will check it.
If don't work, I will see error then I will fix it :)
So, that error I fix it.
Is that supposed to be a PlaceHolderAPI placeholder?
Yes
Those aren’t going to work in your code unless you’re using PlaceHolderAPI as a dependency
And use their API to register it
What IDE are you using?
Java
I don’t think that’s what you’re trying to do though
What software are you using
To compile code
Intelij Idea
You mean full code?
Yeah
1S
I need to change this, later. Because I don't think so it will work, Probably if I type /grandmod command will run only for that who type that command.
Oh so are you trying to have the player type in the username or who they want to change the rank of?
To change someone rank..
Yeah
Like /grandmod wiji
So you want to do that with parameters
Yeah
I mean arguments
So you see the args variable
That’s going to be a String array (essentially a list) of all the words the player types after the command
So if you fetch args[0]
That will be the second word the player types
I have that :)
Check pastebin
if (args.length > 1) { System.out.println(" You GrandModed " + args[0]); p.sendMessage(" You GrandModed " + args[0]);
So I need to replace %player_name% to args[0] ?
No
Because args[0] is just the name
Not the actual player object
To get the player object, you need to loop through all online players
arg[0] equals to player name ( that who I want to give to someone)
right?
And arg[1] queals to my name
Player p = (Player)sender; String name = p.getDisplayName(); { if (!p.hasPermission("can.build")) {
That what I have.
Put if!(player.getName.equalsIgnoreCase(args[0])) continue;
Let me get on a computer, hold on
Here
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
return false;
}
Player p = (Player) sender;
if (!p.hasPermission("can.build")) {
return false;
}
if(args.length < 1) {
return false;
}
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user " + args[0] + " parent set vip");
p.sendMessage(" You GrandModed " + args[0]);
return true;
}```
Np
But I really would suggest learning more about SpigotAPI and Java in general
I also started SpigotAPI with little to no java knoledge, which is something I regret
I know it may seem preachy, but I really think you can learn a lot faster if you actually understand what the code you're writing means on a code-base level
Yeah, You are right.
I need one more year, then I will start to learn programing in school
Ah
Then It will be more easy.
Java really isn't too hard if you know the basics
Once you understand it, you can gradually learn more of it as you need it in your projects
Don't worry, there really aren't many great sources for learning spigot API out there
I think it's a pretty good start for practicing Java
Ok, let me check about this.
Hello, i see many dev and the spigot classes where they use variable names like var0,var5 etc... does it mean smth for them ?
compiled code, not actual variable names
I would recommend using the luck perms api instead of commands
Yeah I would too
He clearly has no Spigot experience
So I was just helping him get something simple working
I know it's not you're issue but I saw your code snippet
Yeah
locks you place on sql gets released once you commit right?
as in connection.commit() when autocommit is set to false would release all the locks placed in that transaction?
what kind of lock are you talking about
a row read - write lock
using for update syntax
running into some race condition issues where data is not fully saved before its being read again
well, according to the docs the commit method releases the locks
yeah thats what i read as well, but a lot of stackoverflow threads popped up where people were saying that its still locked
so im kinda confused
if an implementation doesn't keep to the spec, that's a bug
It's work, Thank you again :)
Hey guys any help here would be very much appreciated
hi, how can i make a super accurate method to get the entity (specifically a player) that a player is looking at? i also need a way to get the exact coordinates (down to the decimal) a player is looking at, how can i do this (im using targetblock right now, but its not very accurate)?
for reference, im making a laser gun
and when hitting a target, i want the particles to hit the player where the attacker was looking, cause rn it just locks to the opponent's eye level (and then i subtract 0.5 from the y so it doesnt look stupid)
What I would do is draw a particle trail on the player.getLocation().getDirection()
Segment the vector into multiple pieces and loop through each segment
Draw a particle there and check if there is a player nearby to the location
World#rayTrace/rayTraceBlocks/rayTraceEntities
Please help, why does the LocalHost Server work perfectly and there are a lot of bugs on the hosting?
Did you make sure that the production is set up identical to the development environment and actually has the updated plugins?
rayTraceEntities is detecting the player that activates it
what kind of bugs?
no, just predicate (emily you)
there's one rayTraceEntities that takes a Predicate so you can filter which entities it'll hit (or not)
yeah the normal rayTrace
o wait
Ah well yeha that's the one :d
there r multiple rayTraceEntities
hard to remember them all lol
y didnt intellij tell me that there were multiple >:((
it hates you
declaration: package: org.bukkit, interface: World
this is probably what you want
ye
ray size is basically how much leeway the ray has to consider "hitting" something
so like the "thickness" of it?
just use the method that doesnt have that parameter
you can change it if you notice issues
o didnt know there was one without it
i literally sent it
i thought that was the same one, mb
xD dw ab it
will using lots of rays lag the server?
spigot gets confusing sometimes
like a bunch of players shooting laser gun
omg the ray tracing works (at least for blocks, gotta test players later), tysm guys 
if you have like 100.000 simultaneosly, yes
so it can handle a good amount?
id guess so
its not just gonna die if like 10 r fired
def not
alr that should be fine then
if the implementation is like normal raytracing internally
distance effects its performance
yea if i notice any lag ill reduce distance, i have it as 30 rn
i think mc default is somwhere with 12
also just figured out i can just use rayTrace instead of both rayTraceBlocks and rayTraceEntities lmao
if thats what you want
i wouldnt do any preemptive optimizations though
make it and test then go from there
yea i feel like i'd just break more than i'd fix
yea i was using both at first (so it casted 2 ray traces each time)
cause i started without knowing it returned RayTraceResult
@Override
public String onRequest(OfflinePlayer player, @NotNull String params) {
return String.valueOf(Bukkit.getOnlinePlayers().size());
}
@dusk crypt
pretty easy
I'm sorry, I just started doing it. so I don't have any idea yet how this works.
This is if you want to make it in your own plugin
If you dont want to make your own custom placeholders, you can use server expansion
hi, this is just a general question, how do i disable the /tell command? not from a developer pov, i wanna do it using permissions, but minecraft.command.tell doesnt tab complete in luckperms (which means it doesnt exist)
no, it doesn't mean it
I think the perm is minecraft.command.msg
and for tellraw it's minecraft.command.tellraw
I'm just going based off of https://bukkit.fandom.com/wiki/CraftBukkit_Commands 🤷
It does not mean that at all, suggestions are mere suggestions, as in LP will show what it knows so far, maybe some permission hasn't checked and since plugins can check for literally any permission in existence ever, LP can't know about all of that until they are checked, suggestions are not the final word of "this exists or not", you're gonna find this useful for debugging and finding permissions https://luckperms.net/wiki/Verbose
I think mc/bukkit permissions auto complete though
along with plugins with the perm in plugin.yml
but besides that I don't think it does
"yes"
not necessarily but for the most part yes
command permissions are checked when you log in, so they get added to the internal "known permissions" set as soon as someone joins
oh really?
yes
well yea ik that its not super accurate for stuff like plugin permissions
but i assumed that the vanilla mc cmds were all accurate
try this perm
or use lp verbose
ill try verbose
msg permission didnt work
tell is also an alias for msg as dkim pointed out :d and they share the same permission
u sent before i finished editing
wait what its an alias?
oh wait
are tell and tellraw completely different
yeah but ig not technically
yes
oh lol
tell = msg = whisper
I was thinking tell similar to tellraw
same
¯_(ツ)_/¯
tellraw is for sending json components lol
but if it's alias it would most likely have the same permission
ye but I thought tell was the non-json version of it
🤷
but without the "player whispered" part
It was just a guess
it doesnt for some reason
I always use /msg
yeah well, 2015 mojang decisions lol
yea
players cant do /msg but they can do /tell
did you try verbose
no not yet im about to
maybe some plugin is overriding the command and has a different permission?
also that reminds me
why does ESX make their own versions of mc commands
usually worse versions
it says minecraft.command.msg....
💀
Uh
try the permission check cmd
it changed so i dont remember what it is
i think its like /lp user dkim19375 permission check minecraft.command.msg
Did the verbose say that they had perm?
it should've been like red or green
lemme check with them
it says false
and that's the only permission shown?
Maybe try just doing /verbose on
that spammed a lot
only thing i can think of now
yep
it shows every perm check
hopefully this isn't on a public server
you can also upload the results to the web
it is, why?
well ig it doesn't matter since the web should be able to filter it out
spamming
ye but each player will have their own perm checks
o ye
nono
huh sounds like another plugin is forcing the command to run or sending the message on its own or something
ask them to upload the verbose results to the web
since maybe it cancels and runs it separately or something 🤷
which I don't see why but it's the only thing i can think of
either that or a plugin is somehow forcing it to run
which is what emily mentioned
yeah i mean it doesn't make any sense for /msg to work fine but not /tell since they literally redirect to the same command object
so it's not the permission
no
okay
imma just leave it as is cause we're about to install new chat plugin anyways
the thing is that it isn't checking any other permissions
it's checking whatever verbose is reporting
which is the vanilla's msg/tell/whisper permission
but something else is taking that, not giving a shit and doing the thing anyway
Hi, quick question.
If I need to return Map<Integer, InterfaceA> and return Map<Integer, ClassA> where ClassA implements InterfaceA, it won't compile.
Any stuff i need to do to make java realize that ClassA inherits from InterfaceA or am i doin something stupid?
this is an intentional thing for safety
Map is invariant because otherwise you could get bad errors
lets say you also have ClassB and call put, a Map<Integer, ClassA> would throw an exception but the type system would think it's safe
you should be able to do an unsafe cast i think, or you could change the type to Map<Integer, ? extends InterfaceA> on the basis that will probably break other things
you just need to make sure that you're very careful with the unsafe casts
because they are unsafe
this seems to at least compile
yeah it will probably change stuff in other places
you're explicitly making the parameter covariant, which means that get will be safe but put will not
big words
pedantic but is it actually ? extends InterfaceA or is it ? implements interfaceA
in the context of wildcards it's always ? extends T to mean "It produces instances of some subclass of T", and ? super T to mean "It takes instances of some superclass of T"
big words
i see, i think
tldr it's always extends even for interfaces
ye
? super T seems interesting though, i didnt realize that existed
seems like the uses for it would be very niche
Not really
List<? super File>
The list contains instances of some superclass of File, but you don't know what superclass exactly, it could contain Comparables, it could contain Serializables, it could contain Files themselves or even Objects; but you don't know which one exactly so you can't take/get any instance from it, all you can do is add File instances (instances of a subclass of File still count as an instance of File, so it isn't constrained to File.class specifically), because a File is (in this context) a superclass of File
List<? extends Number>
The list contains instances of some subclass of Number, but you don't know exactly what subclass exactly, it could contain Integers, it could contain Longs, it could contain both (List<Number>) or a BigDecimal; but you don't know what subclass exactly it has so you can't put/add any specific Number instance, all you can do is get Number instances from it
More generally speaking: PECS (Producer Extends; Consumer Super), the wildcard is bounded with extends when the parameterized type produces T's, and it's bounded with super when it consumes T's, as in Supplier<? extends T>, Consumer<? super T>, Function<? super T, ? extends R>
The top 2 answers in here are quite well https://stackoverflow.com/q/2723397
But personally I understood this explanation better https://stackoverflow.com/a/4343547
google: variance, covariance and contravariance
or whatever search engine of your liking :^)
Yahoo answers
ask jeeves
e621 😎
i think i understand now, this is much more handy than i initially gave credit for
Dokka isnt kotlin's javadoc thing?
And by default, packages in IJ look just like that
You have the flatten option enabled
yes
i want dokka to look like IJ, not the other way around
ok alr
and how exactly do i change the output?
tasks {
dokkaHtml {
moduleName.set("HMCWraps API")
outputDirectory.set(File("./docs"))
}
}``` when i do this
badum tss
How to spawn an item at a specific location in the Inventory?
For example,i give myself a diamond in 8 slot.
player.getInventory().setItem(slot,item);
it works very much the same as the inventory api
Thank you .
also to know which number corresponds to which slot check here
https://www.spigotmc.org/wiki/raw-slot-ids/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Thank you very much.
np man enjoy
I don't suppose anyone here as worked with GriefPrevention API?
It's absolutely terrible, and really limited- I'm looking to make a command for players to pay each other with claim blocks but I cannot find any accessible methods to both get and set claimblocks for a player.
that's because the developers behind grief prevention are literally some of the worst ive ever seen
because may i remind you all of this
I wanna die. 
it is quite literally the worst large scale plugin ive ever seen on code quality
Makes me want to make a developer friendly fork. 
makes you wanna make an entirely new plugin
Literally anything would be better
the plugin could quite literally use Thread#sleep and it'll still be better

if you ignore like 50 conventions broken
caching config info is fine no?
in an appropriate place, yes
he either hates java so much at the same time wanting to make a plugin or he genuinely doesnt even care about oop
i dont care about oop
then this will do it xdxdxd
I don't care about you
me neither
oof
Anyone know how to make a new playername.yml when a new player joins and load the config if its a player that already joined? then read the config from another class
Get the file, if it exists you'll have contents inside it from the previous join, otherwise write the new contents
How would I do that?
which bit are you unsure about?
- check if file exists
- if exists, read contents
- if not, write new contents
Well I want to make a credit system so you can earn credits by doing something then you can buy stuff with the credits. Just not sure how I would get the file stuff lol to work. Been trying for ages and searched online for help but no luck
Well what do you have so far
(it also sounds like a bad idea to do file IO on the main thread)
hey a quick question
so the word runTaskAsynchronously
It means that the task is asynchronous and on MULTIPLE threads OR
it is really just asynchronous on a single thread as its literal meaning
my educated guess is that it is only on a single thread but idk i dont wanna bother scrolling through nms codes or googling anymore after headaches
pls ping me if you are available for answers, thx. Just wanna verify my guess.
runTaskAsynchronously just runs it on a thread that isnt the main thread
if you have a task timer, im not sure if it will always be ran on the same thread every time
probably not
since the scheduler uses a thread pool for async tasks
ok thx a lot! that clears up stuffs!
if you want to make sure something is accessed from one thread only, dont use spigot methods
create your own thread and access only using that
like two threads of the same task can be accessing something using spigot methods?
two threads of the same task?
i am not sure honestly but i think it uses a pool internally
you would have to check, but i dont think there is a way to guarantee that spigot uses the same thread each time you call an async scheduler
you can guarantee the task inside of the scheduler (only on that instance) is run by one thread though
if thats what you are asking
oh so you are referring to the task not always running on same instance of thread every time from brister?
i understand now
i dont think which instance of thread that accesses or the overhead of spawning new threads would matter tho in my context for now
thx for the tips tho apprecaite it
nvm overhead does matter
thx a lot for the tips plan changed i will be managing the thread myself
if you need to access variables from another thread
you either limit the usage of those to one thread
or.. you use atomic type variables (aka thread safe)
second option might be easier if you didnt consider it
oh for that i have atomic reference for the lists and stuffs
idk if the performance will drop tho
it wont drop unless the variable is constantly used
so if you need to cache data from sql etc, atomic is completely fine
do you think a long async bukkit task gonna slow down the main thread?
no, its a separate thread
like relative to a one statement async task, a 1000 statements task will slow down main thread considerably
oh alr thx a lot appreciate it!
only time it can slow down is when you use all resources of your cpu
in which case you have more issues most likely
maybe the issue of the whole pc not the programming then haha
hello, does anyone know if it is possible to tell the maven shade plugin to output the shaded jar in multiple locations?
No
with all due respect your bio made me wonder if antibullying campaigns should be a thing
what?
Where's the due respect you offered
All I see is disrespect 
¯_(ツ)_/¯
If you're going to be a dick, just say that my guy
with all due respect, your code made me cringe
huh
ok
ok guys let's just stop with the very polite insults
aight sorry about it
I'll save frosty the embarrassment by not replying to his comment.
Oh no, whatever will I do now, hide in a hole and cry?
evidently yes
Lol what
they're just salty i'm happy with myself and wants to ruin the fun for no reason, idk, people are weird
I'm happy for you Emi and I hope you're having a great day 🤗
thank you! i am indeed
Yeah sad people tbh
Guys
How do you prevent github actions from running when the push is a merge from dependabot?
Pretty sure you can apply exclusions in the script
looks like you could add if: ${{ github.actor != 'dependabot[bot]' }} before steps
Went to sleep, mb. I got the listener for the PlayerJoinEvent, now I just need to create the file stuff lol then read/write to it in different classes
i lost my backup code discord , what i need to do change my setting for discord , always requed app backup code , help me enyone
What happened to ur actual 2FA 🤨
Better Call Saul
Did you know that you have rights? The constitution says, you do!
i sold those off for free video streaming
i will lost my mobile phone . how can i got new code or old code 
Some 2fa apps might sync online
I use authy which you can sync but it's off by default
i will use google 2fa
?not-discord
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
Idk about Google 2fa since I don't use it
U can google to see if it syncs tho
If it doesn't then uhh
That's why they had backup codes :/
But besides that until you find your phone u can't get the code
i will sync but only show google backups code not discord
Also if you lost it, ios and android allows you to track the device
Wdym
my accout was hacked past month , i will add 2fa for extra security
So u don't have any?
Also note that 2fa is unlikely to prevent you from getting hacked from discord scams
Since it uses token logging which bypasses 2fa
i have pc logging , but i will reset pc affter i never can logging discord without bacup code
Pc logging?
OK I'll assume u don't have the backup codes
but i need to use my new mobile this account
yes
I mean you can probably lock your phone remotely and see if someone finds your phone
Assuming it's not broken our out of battery
Or*
i will check it but not responce
Google/Android - find my phone/device
Samsung - either above or Samsung locate phone
Apple - idk
Apple does have one but I think it requires a mac
i hve anroid , i will check find my device but i am late
Ok
Lock it and make it show a contact phone number
Trying to find it probably will not help depending on the location
i will contact my sim coustomer service bt they tell me last location nothing foud enything
i think it now reset or remove parts
eny other option to get new backup code ?
No
lose
Then why would it reset
Or remove parts
I mean sure it could've died but Google shows the last location (if location services were on)
i think robbers don't have mind
Oh u think a robber took it
yes it robe
yes
It says phone offline?
yes
Unfortunately if Google doesn't sync 2fa then I don't think you can fix this
And if you do use 2fa in the future remember to write down backup codes
They will most likely give one or more
this account i need because this accout old 3 years , and nitro use , my all bussnes i do with this account
did you know how to sync 100% working code re sync auth app , eny vedio tuturial or eny way
I do not use Google auth

If you login from a device and discord does not show, ig that means it's not synced
Maybe there is a setting for it
Authy had it disabled by default for example
Alr
i cant scan my discord qr need my password , my password is froget , i can't change my password without 2fa
i think my time is not good
Do you have anything special linked to ur acc?
If I were you I'd try moving to a new acc asap
So that once u get logged out for whatever reason it's not sudden
my nitro and my servers 
Can u rejoin? And maybe try getting the stuff transfered while you still have access to this account
That's prob the best thing h can do now
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
What it's saying is that this is not official support
not responce
Is there a sort of timing safe equals to compare passwords in Java?
timing safe?
sorry, more so the algorithm you'd use to hash passwords ideally should be tuneable in terms of how much time it takes
just use bcrypt
if you forgot your password and dont have your backup codes, i think you will have some trouble getting back
I have a list of important discord tags / server invite links just to be sure if the above methods wont work
java gc is good enough to clear circular references right?
