#development
1 messages ยท Page 32 of 1
ah kk
i also noticed that if i break a torch thats below another torch they both break
gotta add a check to see if the block broken is attachables
@EventHandler
public void AttachedBlocks(BlockBreakEvent e) {
Player p = e.getPlayer();
if (!p.getGamemode().equals(GameMode.CREATIVE)) {
return;
}
Block b = e.getBlock();
for (BlockFace f : faces) {
Block relative = b.getRelative(f);
if (!attachables.contains(relative.getType())) {
continue;
}
e.setCancelled(true);
relative.setType(Material.AIR);
}
b.setType(Material.AIR);
}
๐
turns out to be a bug of bungeecord chat, where can i report this issue?
issue: translatablecomponent does not work as a child component of textcomponent
if (attachables.contains(relative.getType())) {
continue;
}
```Would skip attachables
forgor !
Spigot I would assume.
๐
I hate when I do that xD
@EventHandler
public void AttachedBlocks(BlockBreakEvent e) {
Block b = e.getBlock();
List<Block> attachedBlocks = Stream.of(faces) // Creates a stream of BlockFaces
.filter(face -> attachables.contains(b.getRelative(face).getType())) // Tests the relative block if its type is attachable
.map(face -> b.getRelative(face)) // Maps the block to be collected
.collect(Collectors.toList()); // Collects all blocks.
if(!attachedBlocks.isEmpty()) {
e.setCancelled(true); // Cancels the event (So physics are not applied)
attachedBlocks.forEach(attached -> attached.setType(Material.AIR)); // Removes all attached blocks
b.setType(Material.AIR); // Removes originally broken block
}
}
```Somewhat cleaner. Does double loop but with the "variablizing" of the attached blocks list.
i need a moment to understand this
I'm surprised Attachable doesn't include blocks that attach xD
You either have to make your own list or use multiple object types (Ex; Directional) to test whether a block can attach to another.
Added some comments to make it understandable.
cool
i was just adding a check to see if player was in creative and if the block broken contains attachables
๐
Unlikely argument type for equals(): List<Material> seems to be unrelated to Material
uh
do i have to worry about this or no
Trying to add a check to see if:
player is in Creative
if a player broke an attachable
if (gm == GameMode.CREATIVE && b.getType().equals(attachables)) {
p.sendMessage("Tried breaking, didnt work");
return;
}
I have tried this
and it gave me the "info" above
Well, use atachables.contains b.getType
wait what
You're comparing object list to an object
ohhhhhhhh
ok makes sense now
thanks
well the item frames dont seem to be working
I think its because item frames are an entity
and trying to set it to air wouldnt do anything
well, you're probably not even 'setting it to air', because the method probably doesn't find them in the first place.
yes because they are an entity
when they are attached to a block
idk how to get an entity attached to a block
is it possible to create placeholders without an identifier, so instead of %identifier_param% its just %param% ?
from a single expansion?
you can not, papi checks for %identifier_ first, and considers anything else as parameters, until the first %
damn I guess I gotta use an empty string then and have %_<param>%
you can not
why
^
empty string works fine
but why do you want that?
I was asked to make configurable placeholders via a config
its either that or Ill have a "identifier" variable in config
if you dont use an identifier, where's the "customization"? ๐
true ig
also, customization is pretty vague, are you sure you don't want it for the result of the placeholders?
why would ypu want your placeholder's id to be customizable
like normally its never seen so it doesnt mske sense for it to be customizable
I dont know, I was just asked to do this
would make sense if they want the output to be customizable rather then the actual placeholder id to be
How can I write in a specific/custom config file?
https://bukkit.fandom.com/wiki/Configuration_API_Reference this should be helpful
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
thank u
does anyone know how you would take on renaming the vanilla enchants so instead of ya know it being like Efficiency X or Efficiency enchant.level.100 and instead its Efficiency 10 or Efficiency 100
you modify the items lore and manually add the enchantments to said lore
I'm trying to execute commands in gradle, for example cd, and whenever I try to cd into a directory, I always get the error that the directory can't be found.
Does anyone know how to execute command line commands from gradle?
I am getting a NPE with no error message when publishing my artifact
Execution failed for task ':publishMavenPublicationToMavenRepository'.
> Failed to publish publication 'maven' to repository 'maven'
> java.lang.NullPointerException (no error message)
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
repositories {
maven(url = "https://repo.lightdream.dev/") {
credentials(HttpHeaderCredentials::class){
name = project.findProperty("gitlab.header.name") as String
value = project.findProperty("gitlab.header.value") as String
}
}
}
}
pls help me its not working: diamond_block.json```{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "minecraft:blocks/diamond_block"
},
"overrides": [
{ "predicate": {"custom_model_data": 123456}, "model": "block/ruby_block"}
]
}```
ruby_block.json: ```{
"credit": "Made with Blockbench",
"textures": {
"0": "blocks/ruby_block",
"particle": "blocks/ruby_block"
},
"elements": [
{
"from": [0, 0, 0],
"to": [15, 16, 16],
"faces": {
"north": {"uv": [0, 0, 15, 16], "texture": "#0"},
"east": {"uv": [0, 0, 16, 16], "texture": "#0"},
"south": {"uv": [0, 0, 15, 16], "texture": "#0"},
"west": {"uv": [0, 0, 16, 16], "texture": "#0"},
"up": {"uv": [0, 0, 15, 16], "texture": "#0"},
"down": {"uv": [0, 0, 15, 16], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"translation": [0, 0, -1.5],
"scale": [0.35, 0.35, 0.35]
},
"thirdperson_lefthand": {
"translation": [0, 0, -1.5],
"scale": [0.35, 0.35, 0.35]
},
"firstperson_righthand": {
"translation": [1.5, -1, 0]
},
"firstperson_lefthand": {
"translation": [1.75, -1.25, 0]
},
"gui": {
"rotation": [36.5, -33.5, 0],
"scale": [0.7, 0.7, 0.7]
}
}
}
if i give me diamondblock with custom daa 123456 its still normal dia block
Custom blocks are a really fun and useful feature that can be created with data packs. In this video, I go over two similar methods for creating custom blocks depending on the transparency of the base block you need.
Some other ideas that this method can be used for are custom machines, crafters, hidden doors, mob boss summoning altars, or eve...
you cant actually add custom blocks, this is just a work around
lmao
i am half joking
I actually did load up a project and attempt to work on it but failed because i couldn't get netbeans to work with gradle ๐ฅฒ
does anybody know the ratelimit of api.mojang.com?
specifically for one username -> one uuid
hm, so if i made a plugin that just constantly calls Bukkit.getPlayer(name).getUniqueIdentifier(), would this be stopped by the ratelimit?
it's never really been a concern for me
1 every second?
well i guess it's only a problem for jumbo servers, since they would all be spread out
Paper (spigot?) caches the uuids
guess what im not making a plugin xD
Cache the uuids as well
and then it just regularly updates itself?
Idk
The cache probably expires after some hours and then it is requested from the api again
I think thats what cached-players.json is for
oh you mean each server has its own cache
i thought you meant spigot had one massive
Ah yes, each server
so we can hit the rate limit by generating random names xD
i mean
the server you create the requests on is the only one that's gonna be affected
i don't think mojang servers will particularly flinch
only retrieving those once in a lifetime of the plugin
yeah i know it wont affect anything
Could try to use proxies if you need a lot of requests I guess @spiral prairie
mojang flinching when i delete the cache after each request ๐
proxies?
i could just store in plain text so
the reason im calling the api is to verify the uuid name pairs
im currently trying a ratelimit bucket
In computer networking, a proxy server is a server application that acts as an intermediary between a client requesting a resource and the server providing that resource.Instead of connecting directly to a server that can fulfill a request for a resource, such as a file or web page, the client directs the request to the proxy server, which evalu...
Yeah but I guess the rate limits are for an ip as well?
yea
they cant really check anything else except for ips
I thought the endpoint has an auth, nvm
Bukkit.getPlayer(String) doesnt use the mojang api tho?
its only getOfflinePlayer(string) that does
ah
its why its deprecated
how can i get an item in inventory and delete it (a certain amount) ? MC Version: 1.16.5 Paper (paper-794)
you can iterate through each slot, and if the slot contains that item, delete however many you want
maybe like this
public void deleteItems(Player player, Material material, int numDelete)
{
PlayerInventory inv = player.getInventory();
for(int i=0; i<inv.getSize(); i++)
{
ItemStack itemStack = inv.getItem(i);
if(itemStack.getType() == material)
{
int numStack = itemStack.getAmount();
if (numStack <= numDelete)
{
inv.setItem(i, null);
numDelete -= numStack;
}
else
{
itemStack.setAmount(numStack - numDelete);
inv.setItem(i, itemStack);
}
}
}
}
Thais
Hello, could anyone tell me how to listen for incoming packets to server through netty?
Anyone here that has experience with LunarClient-API on the topic of teamviewer?
yes, but i have a error in console
add a null check before accessing item.getType
there is no info abou this i want
how do I add a null check to org.bukkit.inventory.ItemStack.getType() and if the player has an item, then it was picked up when player clicking on the menu icon
how i can do it?
let's go to private messages, I'll explain
no need to
i'm answering your question
how do I add a null check
itemstack == null
ok, i made it, how i can if the player has an item, and clicked on icon menu this item retired?
i didnt understand your question honestly
How do I detect when player finishes editing the sign?
Change
hey, uh, this is my structure for the project
<form action="http://localhost:3000/test" method="POST">
<input type="text" name="example">
<br>
<button type="submit">Send to backend</button>
</form>
hello.js
const http = require('http');
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const app = express();
app.use(express.json());
app.use(express.static("express"));
app.use(bodyParser.urlencoded({ extended: true }));
app.use('/', function (req, res)
{
res.sendFile(path.join(__dirname + '/express/index.html'));
});
app.post('/hello', (req, res) =>
{
console.log("Hello " + req.body.name);
});
const server = http.createServer(app);
const port = 3000;
server.listen(port);
console.debug('Server listening on port ' + port);
but when I submit, I don't get a log in POST /hello
any idea?
You have localhost:3000/test in there, not /hello
random thought I just had, but should you always use the Bukkit scheduler for async tasks or is it fine to use your own thread system? Doesn't the scheduler always run the tasks on the next tick even if it has a delay of 0?
it's fine to use your own executors so long as you do the necessary cleanup on disable, bukkit automatically cancels and waits for your existing tasks to finish when disabling a plugin
and yes the scheduler does that delay thing, most of the time it probably doesn't matter tho
- it would be really nice in the deluxetag plugin to add in the config an option that if you activate it, it allows to put a space automatically after each tag, because those who don't have a tag end up with a space in front of their nickname
- and add deluxetags.tag.all ?
Wrong channel dont you think? @raven oar
i don't know :/
#real-developers
#coding-and-gaming
#ultimate-developers
inside of your custom placeholder, is it possible to return an already existing placeholder?
would i do return "%some_placeholder%"; or would I have to do something else to parse it?
you mean
#developer-chat ๐
hello, if i can do CreatureSpawnEvent.getHandlerList(), why cant i do CreatureSpawnEvent.class.getHandlerList()?
anti-xy: i have a Class<? extends Event> event and i need to get the handler list of it to unregister that event from a listener
because .class returns a Class which does not have a method getHandlerList()
use getMethod
thats the only way?
yes - because getHandlerList() is a method
I'd recommend caching it
I haven't ran any benchmarks on how fast it is/if it is cached but iirc you're supposed to cache it
(caching the Method)
i dont think its possible to cache it in my scenario
_ _
actually
here ill give an example
nvm yea i think it is
The same key works on my Windows machine... what's going on? https://media.discordapp.net/attachments/706186227493109860/1060758278918905896/image.png
https://media.discordapp.net/attachments/706186227493109860/1060758279233474730/image.png
actually it might not
im not sure
ยฏ_(ใ)_/ยฏ
it should be... right?
i dont remember how static reflection works
and if you can use it for different impls
i don't think you can
i wont just in case
it doesnt need to be cached anyways i dont expect it to be used a lot
just make sure you don't run it on the main thread while the server is running ig
so that it doesn't lag the server
basically (simply):
threads let you run multiple things at the same time
so
main thread = most of the stuff handled by the server
yeye i understand what threads "are"
ah ok
but i just never know when its good/bad to use
like wth is async
does async just mean its on its own thread?
in spigot programming, typically it's just when it's not on the main thread
public interface BukkitScheduler```
BukkitScheduler has 17 methods.
huh
๐
d;methods bukkitrunnable
org.bukkit.scheduler.BukkitRunnable#cancel
org.bukkit.scheduler.BukkitRunnable#runTaskLaterAsynchronously
org.bukkit.scheduler.BukkitRunnable#runTaskTimer
org.bukkit.scheduler.BukkitRunnable#runTask
org.bukkit.scheduler.BukkitRunnable#runTaskLater
org.bukkit.scheduler.BukkitRunnable#BukkitRunnable
org.bukkit.scheduler.BukkitRunnable#runTaskTimerAsynchronously
org.bukkit.scheduler.BukkitRunnable#getTaskId
org.bukkit.scheduler.BukkitRunnable#isCancelled
org.bukkit.scheduler.BukkitRunnable#runTaskAsynchronously```
lmao
so would it be be better to always use async?
i remember seeing something that said to not use api stuff on async things
wellllllll
not always
also the bukkit scheduler should only be used when running on tick-based stuff
iirc anything that interacts with the world
ah
so blocks, entities, etc etc etc
yeye
and maybe some bukkit api but idk
but an issue with async is that every time you go async, when you want to go back to the main thread, it's delayed by a tick (theres also issue with concurrency but im not gonna go in depth in it rn)
since runTask/runTaskLater runs in at min 1 tick later
oh
does this look all right? is there a better way to do it?
/**
* Unregisters a specific event from the {@link #getPlugin()}
*
* @param event the {@link Event} to unregister
*/
default void unregister(@NotNull Class<? extends Event> event) {
try {
final HandlerList handlerList = (HandlerList) event.getMethod("getHandlerList").invoke(event);
handlerList.getClass().getMethod("unregister", Listener.class).invoke(handlerList, this);
} catch (final NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}```
o right
no main thread
well
the code won't work because you're making the instance a Class
Class does not have a method named getHandlerList
so do invoke(null)
oh?
then you don't need to do reflection again on handlerList because it's already a HandlerList
wait what
ah i c
Is there a reason not to cache it?
its gonna be rarely used
That's not really a reason
and dkim said it might not work
no thats not what i meant
i was just saying general downsides in response to your comment of why people say not to use async for everything
Also dkim are you sure event stuff can be run off the main thread?
yes
no
likely yes
1% chance of concurrency issue since i doubt it uses thread safe map
oh hwat
.
Wait what are you trying to do
unregister a specific Event from a listener
i was talking about different kind
anti-xy: i have a Class<? extends Event> event and i need to get the handler list of it to unregister that event from a listener
Is this your class, or a class from somewhere else?
wdym "my class"?
this is probably overkill but I'd have a cache map and if the server is not starting/stopping (is running), and is running async, throw an exception
lol
u dont have to do this
or you shouldn't even unregister anyways
I'm confused what your point is
an example input would be CreatureSpawnEvent.class
why are you unregistering listeners
The real question is why are you unregistering listeners like this
true
Is this a listener that you are registering yourself then unregistering?
yes
but its not unregistering the listener
its unregistering an event from a listener
So you want to unregister a single event from the listener?
yea
Why not just have it be it's own class then?
This seems a bit unnecessary
That too, although it depends if they just don't want their listener called anymore at all
this is just easier instead of making the single event have its own class imo ยฏ_(ใ)_/ยฏ
But if you're registering and unregistering the same listener repeatedly, I'd use a boolean like Dkim said
Apparently not
well before i had it take in an Event event, but i just realized that means it can only be unregistered from the event
What took in an Event event
bam
if you really want to unregister
ye imma do that
the unregister method
You're making your own unregister method?
is there already one?
Make what require a HandlerList
param
/**
* Unregisters a specific event from the {@link AnnoyingListener} using it's {@link HandlerList}
* <p>Use the event's {@code #getHandlerList()} to get the {@link HandlerList}
*
* @param handlerList the {@link HandlerList} of the {@link Event} to unregister
*/
default void unregister(@NotNull HandlerList handlerList) {
handlerList.unregister(this);
}```
or at that point u could prob just do it manually
whats the fun in that
declaration: package: org.bukkit.event, class: HandlerList
that unregisters all events from a listener
easier to do ig
Because if I was someone who wanted to use your plugin and I looked at the source to try to figure out why one specific listener wasn't being called, I would be confused
this is for my api btw (but doesnt change ur point ik)
true
i didn't think of that
This is something I do for listeners
https://github.com/Fisher2911/FisherLib/blob/master/src/main/java/io/github/fisher2911/fisherlib/listener/GlobalListener.java
Where you explicitly can register individual methods, like this:
https://github.com/Fisher2911/Kingdoms/blob/efd59077d7f75e8366a7b19ec874679c16377b8e/src/main/java/io/github/fisher2911/kingdoms/listener/ChatListener.java#L44
I didn't add unregistering methods, but all you would have to do for that is remove it from the list in the RegisteredListener class
what list?
how is that different from what im doing tho?
Because you're using reflection and it's not clear that some listeners will be registered / unregistered
im not using reflection?
?
i changed to this
wait like a boolean variable that will indicate whether its registered or not?
ok yeah i see what ur saying now about not knowing which will be registered / unregistered
ok i removed method i wont unregister singular events now
ill make separate classes
wait since its an api should i deprecate the method instead of completely removing it?
i had this before:
/**
* Unregisters a specific event from the {@link #getPlugin()}
*
* @param event the {@link Event} to unregister
*/
default void unregister(@NotNull Event event) {
event.getHandlers().unregister(this);
}```
You can deprecate it and mark it for removal
Or if you're API isn't released / in beta I would just remove it
java 8 doesnt have mark for removal 
Unless you've said that it will be backwards compatible
isn't it part of annotation libs
Yeah
Why are you using java 8?
You can use Jetbrains annotations
1.11+
full compat with servers that use java 8
yea
Oh yeah that is
the tags exist in later java versions
Can't 1.11 run on later Java versions?
but its up to you
yes
yes but not required
but many servers use java 8
^
You could also just make it a javadoc comment
There isn't really a reason too though
imma just remove cause im 100% sure im the only developer using the api ๐ค
some logs (I haven't looked into it since i have started a 1.8 server in like months) have an extra blank line after it
but thats about it afaik
omg omg not an extra line!!!!! ๐ญ
also who even starts 1.8 servers
the only ones that exist today r old ones
Yeah I only stop them
lets make a pack (agreement) to make all of our plugins not work on servers below 1.13
oldcombatmechanics
hypixel will just make their own thats better
if i wanna check if a string is most likely an uuid or a username
would it be better to check String#length() >= 20 (for example)
or simply check if contains a dash
all uuids will have 32 chars
and no usernames will have that many, so it's not most likely, it will be 100% accurate
(im assuming it must be either a username or a uuid, ignoring the possibility it's neither)
Could just do try catch on UUID.fromString()
no need to actually know if its a real one or not
i just want to differentiate if its most likely to be a uuid
or a username
i gues length is faster than contains dash
... Don't know what you mean by this
Like if its a mojang UUID?
admin provides a string in a command which can be uuid or username
i just want to filter which could be uuids and which names so ic an search it and delete it
Yeah so just try catch on UUID.fromString
doesnt mind if its a valid user, or valid one
but i dont need the uuid as UUID object
just want to know if it as long as a uuid so i can search in uuids
or a name so i can search in names
xdd
Ok...
public boolean isUUID(String input) {
try {
UUID.fromString(input);
return true;
} catch(IllegalArgumentException e) {
return false;
}
}
been using that for years xd
public boolean isUUUD(String string) {
return System.OS.answerQuestion(โIs this a UUID?โ, string);
}
All operating systems come built in with an AI now
Make sure to update to the latest version
makes a chatgpt api request ๐
isUUUD
usersUniquelyUltimateData
Well I had to name it something else because Yapperyapps stole the method name
Definitely not because Iโm on mobile
isUserID would've made more sense.
UUID's aren't limited to "users"
True. isUniqueID Then ๐
Both are viable. Its up to who's using it really.
public boolean isUUID(String string) {
return string instanceof UUID;
}
Does that work?
Just making sure lol
String#toUUID is much easier
just cast the string to UUID ๐
Luckily not because Java doesn't support mixin-based inheritance
question for sql experts 'round here
SELECT
YEAR(FROM_UNIXTIME(ROUND(`join_time`/1000))) AS YEAR,
MONTH(FROM_UNIXTIME(ROUND(`join_time`/1000))) AS MONTH,
DAY(FROM_UNIXTIME(ROUND(`join_time`/1000))) AS DAY,
SUM(`leave_play_ticks` - `join_play_ticks`) AS PLAY_TICKS
FROM sessions
WHERE name = 'M0dii' AND ROUND(`join_time`/1000) > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 day))
GROUP BY YEAR, MONTH, DAY
ORDER BY `YEAR` DESC, `MONTH` ASC, DAY DESC
yields me the result shown in the picture.
is there a way to count in the missing values?
missing values would be
2023 | 1 | 8 | 0 (sunday)
and
2023 | 1 | 7 | 0 (saturday)
what I want are the results of the current week
so let's say if it's thursday, I would get all the days below (wednesday, tuesday, monday) and above friday, saturday sunday (which would return 0 for play_ticks)
If you count the amount of rows, you can do a SELECT COUNT(*) FROM .. (or something similar)
or
int size =0;
if (rs != null)
{
rs.last(); // moves cursor to the last row
size = rs.getRow(); // get row id
}```
I mean it would probably be easier to modify the data I need in the backend
I might as well select day-of-week and do the do in the backend
also, is there a way for me not to repeat the same
FROM_UNIXTIME(ROUND('join_time'/1000))?
I tried selecting is as something and reuse it, but it doesn't work like that I suppose
Hi guys, just wondering, is there an API to integrate deluxe menu with my plugins?
wdym by "integrate deluxe menu with your plugins"?
I would like to let the users define the GUI through deluxe menu and then uses some event provided by deluxe menu to populate a gui and intercept some clicks
i have a code for having an item in inventory, and if there is then boolean a = true, but for some reason it always evaluates to true, how can i fix this?
When would the amount of items in a stack be 0
public boolean checkItems(Player player, Material material, int numItems, boolean a) {
PlayerInventory inv = player.getInventory();
for (int i = 0; i < inv.getSize(); i++) {
ItemStack itemStack = inv.getItem(i);
if (itemStack == null) {
return true;
}
if (itemStack.getType() == material) {
int numStack = itemStack.getAmount();
if (numStack >= 1) {
return a = true;
}
if (numStack == 0)
return a = false; // numStack == 0
}
}
return false;
}
i have a checking amount of items == 0, but i's not working
I saw that, but when would the amount be 0
What conditions in-game happen for a stack to have 0 items
If you have a cobblestone block in your inventory and you drop it, you no longer have cobblestone.
Your code checks if there's a stack of 0, which doesn't make sense.
If there's a stack of 0, there is no item so the itemstack should return null, which is already an early return in your current code.
I canโt return null through ==, since we get it through int
I assume that there isn't any API for deluxeMenu
Kenuna is RUS if anyone knows how to better assist them/has more time
item amount should never equal 0 even ghost items I think set the amount to max int.
Also you should use inventory contents instead of getting the item per slot.
And if you're wanting to check for an item/amount Inventory has contains(Material) and containsAtleast(Material, int)
Hey, so I've made a function which registers every command automatically, gets the name, aliases, description, etc.. but when I add the plugin to my plugins folder, i get this message: ```
[16:41:03 ERROR]: Could not load 'plugins\coffin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
But I do have a plugin.yml
Is it packed in the jar?
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.
Well it's apart of the project, but is it in the jar when you build it
yes
the only time it occurs is when the inventory slot is set to air
I wasn't asking for me, but thanks I guess
Hello, I premise that I am new to java programming and just learning to program. I am trying to make a placeholder for my first plugin, the placeholder works and if I replace it in the joinmessage it works. But if I try to place it in the leaderboard or try to launch it with the command /papi bcparse I don't get the result. Could you please help me?
I mean
"the list implementation returns -1 for size"
That's all anyone can say with just that information
well, getPlayersInsideRegion returns
Map<K, List<V>>
and I don't have any custom implementation of it, if that's what you mean
it's an ArrayList
Itโs probably got something to do with the region object then
print the class names of the lists in the map
How can I find out if a player doesn't have an item?
public boolean checkItems(Player player, Material material, boolean a) {
PlayerInventory inv = player.getInventory();
for (int i = 0; i < inv.getSize(); i++) {
ItemStack itemStack = inv.getItem(i);
if (itemStack == null) {
return true;
} else {
if (itemStack.getType() == material) {
int numStack = itemStack.getAmount();
if (!inv.containsAtLeast(itemStack, 1)) {
return a = true;
}
if (p.getInventory().getType() == PLAYER && !inv.contains(material)) {
return a = false;
}
}
}
}
return a;
}
``` Doesn't work
it's returned true
what is this monstrocity of a code
public boolean hasItemType(Player player, Material material) {
return Arrays.stream(player.getInventory().getContents()).anyMatch(i -> material.equals(i.getType());
}
use noneMatch - to check if does not have.
Beautiful
filter(Objects::nonNull)
true
is PlaceholderAPI.setPlaceholders(player, string); threadsafe? (can i do it from an async bukkit runnable?)
wait... nvm most of this code is broken
if (!inv.containsAtLeast(itemStack, 1)) {
``` if this is a real function, isnt that what you're looking to implement?
actually maybe not, this probably returns true only for a very specific stack of the item
@Contract
boolean containsAtLeast(@Nullable ItemStack item, int amount)```
Checks if the inventory contains ItemStacks matching the given ItemStack whose amounts sum to at least the minimum amount specified.
false if item is null, true if amount less than 1, true if enough ItemStacks were found to add to the given amount
item - the ItemStack to match against
amount - the minimum amount
I think it should work for his purposes, assuming all items have the same meta
otherwise heโll have to do just material matching
any idea why this isnt working ingame
package me.notdew.com.roboref;
import me.notdew.com.roboref.Commands.TimerCommand;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
public class ChallengeBlockListener implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.RED_CONCRETE) {
Bukkit.broadcastMessage(event.getPlayer().getName() + " HAS CALLED FOR A CHALLENGE ON THE PREVIOUS PLAY!");
TimerCommand.pauseTimer();
}
}
}
what exactly isnt working?
when i right click on red concrete nothing happens
are you clicking on a block placed in the world or is there red concrete in your hand?
red concrete in my hand
thats why
how do i make it in my hand
getClickedBlock() returns the block clicked in the world
player.getInventory().getItemInMainHand()
so
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.player.getInventory().getItemInMainHand()) == Material.RED_CONCRETE) {
like that?
if (event.getAction() == Action.RIGHT_CLICK && event.getPlayer().getInventory().getItemInMainHand() == Material.RED_CONCRETE) { so like this?
like that?
looks right
but it should be RIGHT_CLICK and not BLOCK
if (event.getAction() == Action.RIGHT_CLICK && event.getPlayer().getInventory().getItemInMainHand() == Material.RED_CONCRETE) { does this look good?
hang on
playerinteractevent uses Action which has RIGHT_CLICK_BLOCK and RIGHT_CLICK_AIR
RIGHT_CLICK isnt an option
in intellj its saying it cant deal with the ==
its saying that with Action.RIGHT_CLICK right
no with right click air
paste the if statement
if (event.getAction() == Action.RIGHT_CLICK_AIR && event.getPlayer().getInventory().getItemInMainHand() == Material.RED_CONCRETE) {
it starts erroring after the &&
its got a red line
its saying the operator cant handle
ah i see
your trying to compare an itemstack and material
after getiteminmainhand put .getType()
ah ok, then he might want to OR it with RIGHT_CLICK_BLOCK too, depending on how he wants to use it
i just want air
ok
if (event.getAction() == Action.RIGHT_CLICK_AIR && event.getPlayer().getInventory().getItemInMainHand().getType() == Material.RED_CONCRETE) {
Bukkit.broadcastMessage(ChatColor.BLUE + "" + ChatColor.BOLD + "" + getPlayer().getName() + " Has Called For A Challenge On The Previous Play!");
It works fine its just it says paper could u help me
like if i does it it says paper has called for a challenge
@proud pebble could u help me with dis
what doesnt work
instead of saying the persons name it says paper
what is that getPlayer even ๐ฟ
how would i make a dependecy to venture chat
becuase i dont want it to broadcast to everyone
just in the local channel
@signal grove
but like how would i make the dependenacy for it like what link do ic ite
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i dont think it's complete actually
is there a way to just regularly only say it in a certain radius?
yeah, you could just use this. im honestly just guessing at half these parameters
Location location = player.getLocation();
float rad = 100; // radius
List<Entity> entities = location.getWorld().getNearbyEntities(location, rad, rad, rad);
for(Entity entity : entities)
entity.sendMessage("hi"); // I don't know if entity has sendMessage, but if not just check instanceof player and cast it.
how would i fit that into public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_AIR && event.getPlayer().getInventory().getItemInMainHand().getType() == Material.FLINT) {
Bukkit.broadcastMessage(ChatColor.RED + "" + ChatColor.BOLD + "" + "REFS HAVE CALLED FOR A DEAD PLAY!");
you could highlight the Bukkit line and paste
how do i get my chat colors back in
add them?
the same way they were before, you need more practice with this i think
Do you have a basic understanding of Java / OOP?
shit im sped
static oriented programming >>>
java.lang.NullPointerException: null
at me.notdew.com.roboref.DeadPlayListener.onPlayerInteract(DeadPlayListener.java:29) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor4.execute(Unknown Source) ~[?:?]
help
not responding to pings
sorry
wait for somebody to answer when they have time
k
java.lang.NullPointerException: null
at me.notdew.com.roboref.DeadPlayListener.onPlayerInteract(DeadPlayListener.java:29) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor4.execute(Unknown Source) ~[?:?]
you didnt use event.getPlayer()
use ChatColor.translate whatever its called
still do what i said
okay but thats not causing the error
yeah ik
i wanna fix the error then ill do it
whats on line 29 then
i think i edited it since so imma relaunch and make sure its still 29
you might aswell still say what was on line 29
k
lemme grab it
yeah its 28 now
Location location = player.getLocation();
thats what i have
uh no
the color is not my concern rn
yeah, keep it like that
and we just need the whole error
and code?
yeah what the fuck is that
do you know Java and OOP?
Have you learned it before going to Spigot
no im being forced do somthing for an unban
and am having to error my way around
its not fun
jeez
im just trying to get it over with
what is the thing you gotta do for an unban?
i said to use that cus having to type of ChatColor.<color> and adding extra empty string space is just pointless and repetative when you can just use the translatecolorcpde method
bad practice
just finish this plugin and this is pretty much it
after this im gonna learn
what does it do?
its for minecraft football as stupid as that sounds
its not s bad practise to use translate color code
its not on config strings, but in hardcoded it is
having ยงc is bad practice and anything related
or &
Its much better to have a clear divider between text and color changing
howd u get that red bar
ShareX
isnt having to write out the enum and empty quotes more of s bad practise since thats just stsntly repeating yourself
i am a clear hater against sponfeeding but this is a loose loose situation
I just want it to do the same general thing just with it not erroring lol
so every time your write public class or public or () is bad practice?
i just wanna have it say in a radius
Repeated code is
yeah what?
unban for what exactly
make them a plugin
probably a dev application
nope
they want it and told everyone banned that whoever makes it gets unbanned
im not asking what you have to do to get unbanned, im asking what you were banned from
minecraft football im a clown
you make this, they arent unbanning you
Just put a base message in that i can edit i just want it to work
why?
what radios do you want?
they just want free plugin dev
i cant spell
idk do like 300
alright
i have a way to make sure that dont happen
they are 2 seperate things, those are keywords and syntax that is apart of the language, the other is referencing an enum constantly that just makes it longer and much more likely to be unreadable
this seems like a very contriversial topic lol
i dont have radius as a dependancy
and?
which radius do i want
HELLO, if i want to detect if a player is standing on a block thats green (grass), would i have to make my own list of green blocks?
what
cannot resolve symbol radius
dont apologize your helping me lol
i love that paste service im going to steal it
ChatColor.RED is much more defined than &c and thus improves readability by great lengths
lmao, do it xD
your gonna kill me but it cant resolve method to list
yeah i thought so
can you remove that to List and switch out List<Enitiy> to Collection<Entity>
i have no idea if that will work
getNearbyEntities returns a list?
d;World#getNearbyEntity
@NotNull
Collection<Entity> getNearbyEntities(@NotNull Location location, double x, double y, double z, @Nullable Predicate filter)```
Returns a list of entities within a bounding box centered around a Location.
This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.
the collection of entities near location. This will always be a non-null collection.
location - The center of the bounding box
x - 1/2 the size of the box along x axis
y - 1/2 the size of the box along y axis
z - 1/2 the size of the box along z axis
filter - only entities that fulfill this predicate are considered, or null to consider all entities
yes
tysm man
can i paypal u like 5$
also if your wanting to send a message to all players ina certain radius, wouldnt it make more sense to for loop over all players and not entities
no point sending s message to a non player
yes it would
Quick question, which types ItemStacks cannot be serialised without being converted into a hashmap? Is there a list anywhere?
okay what do i edit
gime a sec
do you know what java version youre on?
all itemstacks can be serialized?
like jde or game
jde
Only some of them can be serialised on the fly, others need you to call a specific method to have them serialised, which specific items require that method to be run before serialisation?
um idk i can check in a bit but i know the game version is 1.16.5
i assumed all itemstacks were converted into maps
still not tested so
Looking at the docs I think I see what I did wrong
k tysm so in the future if i want color what would i do
you replace the thing in the braces
Certain itemstacks are not serialisable without running the .serialise method on them first, but this method is not exclusive to itemstacks that need to have that method run before being serialised, meaning I can run it on all itemstacks rather than just specific ones
and place that with a space after send message right
quick bit of advice is to attempt to google the wuestion and find the answer on your own first before trying to get help by asking someplave like here
^
since your being spoonfed the answers and you wont learn anything
This 100%
ty both could i paypal both of u like 5$?
same
well then have fun ig?
Wait... they are trying to get themselves unbanned by making a plugin for a minecraft server?
its that or 400$
and you want to be UNBANNED???
jesus just leave the server and
touch grass lmao
no!
Look, this is going to be super blunt, and probably a sound a bit mean, but I am saying this in the nicest way possible, its absolutely awesome that you are trying to learn to code, and make minecraft plugins, but if this server is of any scale they will not want you making a minecraft plugin for them, You asked everyone here how to make text a different colour, if its a public server, they want people who have experience programming, otherwise security issues and various other problems begin to wreak havoc, you would need to have some 5+ years of experience if you wanted to make a plugin good enough that a large server will want to take it
im trying to finish this and then learn
@calm loom Why do you care about this server this much anyway?
idk
whats the name anyways?
once you give them the plugin they could and probably will take the plugin and run, giving no unban
plugin and run, new us felony
This, these people sound incredibly shady
thats what all p2w servers are
im stupid i changed it to jde 16 how do i change it back
im gonna shut up after this
google it
if you truely want to learn, you need to find this information on your own
i was on 8 before right
i dont have magical powers, sorry
you need to be on jdk 17 for most plugin systems nowerdays
does this mean java 8?
no that doesnt mean anything
figure it out
its not that hard to change the version
I still dont understand why they care so much about being unbanned
its something else pretty sure
Likely, there must be more than we are being told
im not withholding anything
For what reason do you want to be unbanned so bad?
good luck then
Why did you even get banned?
Please either stick to the topic or move over to #off-topic
Made me so curious
BEan Gal thinking Barry is sentient
I dont! An admin triggered it, but it deleted their command message, so I replied to that to acknowledge
imagine thinking Barry is sentient
Crazy huh?
Oh, the dev has a console for it, cool!
hey barry, you barry allen?
Barry wyd?
HELLO, i have string with lets say ChatColor.RED + "super epic string " + ChatColor.GOLD + " wow " + ??? + " rest of string"
would what i replace ??? with to get the formatting the string had before ChatColor.GOLD was applied (so before wow)
ChatColor.RED?
figured this out, ChatColor#getLastColors
im assuming it does what i want
edit: it does!
Wrong channel or are you looking to make your own?
no sorry
Hey, does anyone know how to make it so when you die you spawn with a kit?
thereโs an on player respawn event I think
So maybe you could have a config that stores a list of commands to run on respawn
And the respawn event just executes them
if i make my command it dont get executet
are you doing the same thing as him?
no
what context is physically possible to gather, to answer your question then ๐
wait i send surce
de file```package Drache;
import commands.BankCommand;
import listtener.BankListener;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
//import listener.Inventory.DeathRespawnListener;
// import listener.Inventory.Navigator;
//import listener.Inventory.Rucksack;
//import listener.FireStick;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
public final class de extends JavaPlugin {
public static de INSTANCE;
public de() {
INSTANCE = this;
}
public void getMoney(Player player){
String money = String.valueOf(getConfig().getInt(String.valueOf(player.getUniqueId())));
BankListener.INSTANCE.moneyinlisener(money);
}
public void Join(Player player){
if (getConfig().isSet(String.valueOf(player.getUniqueId()))){
} else {
getConfig().set(String.valueOf(player.getUniqueId()), "3");
}
}
@Override
public void onEnable() {
// This sets the name of the item.
// Our custom variable which we will be changing around.
}
@Override
public void onDisable() {
}
public void log(String text) {
Bukkit.getConsoleSender().sendMessage(text);
}
private void register() {
//listener
PluginManager pluginManager = Bukkit.getPluginManager();
pluginManager.registerEvents(new BankListener(3), this);
//commands
Bukkit.getPluginCommand("bank").setExecutor(new BankCommand());
}
}
Bank Listener```package listtener;
import Drache.de;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.Arrays;
public class BankListener implements Listener {
public static BankListener INSTANCE;
public BankListener() {
INSTANCE = this;
}
public static Inventory BankGui;
public void moneyinlisener(String money){
BankGui.setItem(15, createGuiItem(Material.CHEST, "Current Balance: &6" + money));
}
public BankListener(int rows) {
BankGui = Bukkit.createInventory(null, rows * 9, " ยงdBank");
BankGui.setItem(3, createGuiItem(Material.SUNFLOWER, "&6Deposit 1"));
BankGui.setItem(5, createGuiItem(Material.SUNFLOWER, "&6Deposit 64"));
BankGui.setItem(7, createGuiItem(Material.SUNFLOWER, "ยง6Deposit all"));
BankGui.setItem(20, createGuiItem(Material.SUNFLOWER, "&6Withdraw 1"));
BankGui.setItem(22, createGuiItem(Material.SUNFLOWER, "&6Withdraw 64"));
BankGui.setItem(24, createGuiItem(Material.SUNFLOWER, "&6Withdraw all"));
for (int i = 0; i < 30; i++) {
if (BankGui.getItem(i) == null) {
BankGui.setItem(i, createGuiItem(Material.GRAY_STAINED_GLASS, ""));
}
}
}
protected static ItemStack createGuiItem(final Material material, final String name, final String... lore) {
final ItemStack item = new ItemStack(material, 1);
final ItemMeta meta = item.getItemMeta();
// Set the name of the item
meta.displayName(Component.text(name));
// Set the lore of the item
meta.setLore(Arrays.asList(lore));
item.setItemMeta(meta);
return item;
}
@EventHandler
public void onInventoryClick(final InventoryClickEvent e) {
if (!e.getInventory().equals(BankGui)) return;
e.setCancelled(true);
final ItemStack clickedItem = e.getCurrentItem();
// verify current item is not null
if (clickedItem == null || clickedItem.getType().isAir()) return;
final Player player = (Player) e.getWhoClicked();
//Gets the slot of the clicked item
if (e.getSlot() == 0) {
player.performCommand("warp Spawn");
//player.sendMessage("You clicked at slot " + e.getRawSlot());
}
if (e.getSlot() == 1) {
player.performCommand("warp Vanilla");
//player.sendMessage("You clicked at slot " + e.getRawSlot());
}
if (e.getSlot() == 2) {
player.performCommand("warp Box");
}
}
@EventHandler
public void PlayerJoin(PlayerJoinEvent event){
Player player = event.getPlayer();
de.INSTANCE.Join(player);
}
}```
Bank Command```
package commands;
import listtener.BankListener;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class BankCommand implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
Player player = (Player) sender;
if (!(sender instanceof Player)) {
return true;
}
if (player.hasPermission("bank.open")){
player.sendMessage("[ยง4Bankยงr] ยงlยง7you have opened The Bank");
player.openInventory(BankListener.BankGui);
}
return true;
}
}
you never call register() on onEnable
my name is lost
what do you mean
im always so lost
ah, did that fix your problem though
to you can solve most problems like this by going through the chain of calls. For example,
-> does the command open the gui? (no)
-> does the command method even get called (no)
-> is the command method even registered (no - this is the problem)
and just keep going back until you find what goes wrong
Use https://paste.helpch.at/ for errors, logs and configs. So we don't spam the discord.
now this shows up https://paste.helpch.at/vixadibupe.php
there is an out of bounds exception
-> what is the size of the array
-> where it it going outside of that size
(hint: it's your inventory slots)
inv dont have that much slots for (int i = 0; i < 30; i++) {
if (BankGui.getItem(i) == null) {
BankGui.setItem(i, createGuiItem(Material.GRAY_STAINED_GLASS, ""));
}
}
i must be 26
yes
but a good practice is to use inv.length() instead of hardcoding the value (it would be 27 actually)
ok
it take not all and only first slot in the inventar ``` for (int i = 0; i < 36; i++) {
if (player.getInventory().getItem(i).getType() == Material.SUNFLOWER && player.getInventory().getItem(i).getLore().contains("Used to buy items from shop")) {
ItemStack coin = player.getInventory().getItem(i);
for (int j = 0; j < coin.getAmount(); j++) {
coin.setAmount(coin.getAmount() - 1);
int money = de.INSTANCE.getConfig().getInt(String.valueOf(player.getUniqueId()));
de.INSTANCE.getConfig().set(String.valueOf(player.getUniqueId()), money + 1);
de.INSTANCE.saveConfig();
}
} else if (i == 35) {
player.sendMessage("[ยง4Bankยงr]ยงlยง7 You don't have enough Coins");
}
Player.getInventory().containsAtleast()
Whats the other problem? I only read that message.
it takes only stuff out of first slot and not all stuff from first slot
and it dont sends the error massge
ItemStack coin = null;
public ItemStack getCoin() {
if(coin != null)
return coin;
coin = new ItemStack(Material.SUNFLOWER);
ItemMeta coinMeta = coin.getItemMeta();
coinMeta.setLore(Arrays.asList("Used to buy items from shop."))
coin.setItemMeta(coinMeta);
return coin;
}
// where you want to withdraw
ItemStack coinClone = getCoin().clone();
coinClone.setAmount(5); // Set amount you want to take
PlayerInventory playerInv = Player.getInventory();
if(playerInv.containsAtleast(coindClone, coinClone.getAmount())) {
playerInv.removeItem(coinClone);
de.INSTANCE.getConfig().set(String.valueOf(player.getUniqueId()), money + coinClone.getAmount());
}else {
Player.sendMessage("Not enough funds.")
}
thanks
how i take all
what should this for? ItemStack coin = (Coin item);
what is Coin Item (Coin item)
it only takes items from first slot: ``` if (player.getInventory().containsAtLeast(coin, 1)){
int left = 1;
for (int i = 0; i < 36; i++) {
if (player.getInventory().getItem(i) == null) return;
if (player.getInventory().getItem(i).getType() == Material.SUNFLOWER){
if (player.getInventory().getItem(i).getLore().contains("Used to buy items from shop")){
player.getInventory().getItem(i).setAmount(player.getInventory().getItem(i).getAmount() - 1);
left = left - 1;
if (left == 0){
int money = de.INSTANCE.getConfig().getInt(String.valueOf(player.getUniqueId()));
de.INSTANCE.getConfig().set(String.valueOf(player.getUniqueId()), money + 1);
return;
}
}
}
}
} else {
player.sendMessage("[ยง4Bankยงr] Not enough Coins");
}
I think there is a method to get all items in the inventory in the api instead of incrementally getting it one by one. Not 100% sure what it's called so maybe look at the docs for that but I'm pretty confident it exists
im sure its Inventory#getContents()
which returns an itemstack[]
tho they shouldnt set the amount by one, they should just do the full stack or partial stack
ok
i dont really know if this is the right place to ask but how do i start with server side mods for fabric? I only find guides on how to create client side mods. Or can client side mods also be installed as server mods?
The ways to create a mod is the exact same, the only difference is that you don't use stuff that is annotated with @Environment(EnvType.CLIENT) because that is not present in the server
Then there are events, you will find stuff like ServerLifecycleEvents vs ClientLifecycleEvents, obvs you don't want to use the client related events
I heckin love minecraft modding!!
[20:14:14] [Render thread/ERROR]: Error executing task on Client
java.lang.NullPointerException: Cannot invoke "net.minecraft.class_638.method_2935()" because "this.field_3699" is null
java.lang.NullPointerException: Cannot invoke "net.minecraft.class_1937.method_8469(int)" because "$$0" is null
these stacktraces are so helpful!!
Nothing worse than trying to update a mod from one version to another
nothing works anymore
and crashes in 3 seconds of running the client
a) skill issue
b) there was a site that would translate stack traces to yarn mappings from intermediary though I don't remember what it was, there's also a bot in the fabric discord that tells you the yarn name from an intermediary named class/method/field, there's also that site that shows different class names for different mappings, though it's server things only I think
well, considering how (usually) easy it is to update a plugin, this is legit cancer
I mean they aren't really comparable
yes
yes as in agree
ah
alright thanks!
I have a hard time trying to connect my plugin, which has it's own currency to placeholder. Anyone know how I can do this?
do you mean hooking into papi?
Yes I think that should be it
Have you read the docs? It should have a full tutorial/docs for how to do so.
Yes, but I don't quite understand it because my plugin is not hooked to an economy plugin. My plugin has it's own currency that's not linked to Vault or anything.
You shouldn't need a economy plugin as a dependancy for papi. What does your expansion class look like?
I'm new to plugin development so I'm pretty bad at it so everything is in the same class lol... but right now I think only to JavaPlugin. I haven't created a new class.
I would create a class for organization purposes, along with overall ease of access and easy debugging, but you can do what you are comfortable with. Your class needs to extend PlaceholderExpansion. Your IDE should give you the required methods and such for registering it. You can see a full example here, although it is a separate class, rather than on the plugin class. https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/PlaceholderExpansion#without-a-plugin
Thank you. But can I create a new class, and add that in there?
yep
Great, but then how do I make it so for example %balance% is something that takes my balance from my plugin and if I'd like it to be in my scoreboard it works?
btw i recommend learning java first
This too lol.
cause you'll be here for the next issue too
On the example, the method onRequest(OfflinePlayer player, String params) is where it listens to the placeholder requests. You can use a switch statement or ifs to check for what the placeholder is. params is the placeholder. Depending on its value, you give a different value, which would be handled in the switch/if statement.
Haha I am trying right now ๐ Sorry for the stupid question
Ahh okay now I got it thank you!
Its all good, everyone starts somewhere. I would recommend taking a course before hand though, places like JetBrains have really good courses.
^
your placeholder wouldnt be %balance%
Cause Spigot isn't Java
And if you know Java principles, you'll move much faster with Spigot
it would be more like %<pluginname>_balance%
Ahh okay, yeah I'll definitely do that!
or whatever you put as the identifier
more like %identifier_balance%
Ahh okay
I made the mistake of learning Spigot before Java. It took me a year to learn basic Java fundamentals. I am still learning new stuff. It would have been far easier just to learn Java first.
Thank you guys a lot for the help, appreciate you all! I'll probably try and learn a little bit more Java basics now lol ๐
but im still plagued by bad practices built into bukkit
I took a class in my highschool, which was a introduction to CS, structured around Java. Even though it was a whole year long, we never covered Maps, we only covered ArrayLists, no other kind. We did 0 sorting, we didn't learn dependency management or build tools, we also learned nothing about performant/efficient code or how to test for it. I was better off watching a YouTube tutorial.
i have expanded into other things like rest apis and discord bots
but rust is just better 
ngl spigot was the only reason i actually learned java
same here lol
I know how to make discord bots, its just that I have never had a use for one.
i have made a pretty simple paste uploader but everything else already exists lmao
Is rust great? I've heard a lot about it
supposedly it is like C but without all the headaches
yes
Maybe I should learn that instead lol
What is it used for in a real world application? Is it server/backend related?
huh?
like, what would a company use Rust for?
Oh, interesting.
I forgot that since it is related to C it is related to C++.
its more like c++ tbh
ah. I tried to learn C++, I can make a basic console game with it, but it is too complicated for me to learn atm. The learning curve ridiculous. It takes a ton of knowledge to make the simplest of applications (in my experience).
I tried to learn through Code.org, but it was too slow for me.
It was structured for people with no experience with programming.
i dont recommend websites for learing those languages except jetbrains
books are pretty good for that
I just dont have money right now for courses.
From what I remember, the JetBrains ones were paid.
Although, I do have the GitHub Student Developer Pack, which includes all JetBrains IDEs, I bet it probably includes their courses as well.
i dont think so, no
oh, you'd think of all things in a student developer pack there would be programming courses
nvm looks like it contains them
From the looks of it they dont have a Rust course
yeah sadly
you dont have to pay for a course to learn to code
yeah, I know. I learned through trial and error. Its just that in my opinion a course would have set me on a better track (at least to start). The free ones I have tried haven't been that good.
The python course mentions how it is extremely popular for backend applications. From my experiences, python is a sloth compared to other programming languages (specifically C++). Wouldn't something faster be better for backend work?
Thanks, I will take a look ๐
Its very easy to develop little things
I can see that, since it isnt object oriented.
Many people use it for data science, although I never understood its haype
Its so ugly
yeah, I never liked it.
:norust:

jesus whats up with yall
youre like the boomers that are the hackers in 90s movies
i LiKe To UsE vIsUaL bAsIc
why tf would you use C/C++/Rust for a REST API ๐
im doing a not free one right now
why not
๐
why didn't it show on the main page
>:(
at least for me it didn't
found this via google
There are much better languages and tools oriented for that kind of systems
i have no idea if it will start billing me hundreds of dollars but i dont have any payment info given
how long has it been?
oh
same
go to https://hyperskill.org/subscription what does ur status time say @spiral prairie
oh
is there a better one-liner than doing new HashSet<>(Set.of(something))?
๐ค
yes just Set.of
but then i have to create a new set every time
๐ฅฑ
with guava tho
also if u can't use guava, new HashSet<>(Arrays.asList(...)) is slightly faster
