#development
1 messages · Page 108 of 1
Windows 11 😔
do you know how to open environment variables on windows 11?
yessir
do you know how to add stuff to path?
yes
k, I recommend making a gradle folder somewhere
preferably on c
in that folder, make another folder called 7.3.2
then extract this into it https://gradle.org/next-steps/?version=7.3.2&format=all
alright
directory structure should look like this
then add the gradle bin folder to ur path
e.g. C:\gradle\gradle-6.5\bin
alright, one sec
@wheat carbon Just curious, whats the differnce between the User Variables path, and the system variables path
presumably the user variables only affects the current user
I'd just put it on system
welcome to gradle 7.3.2
yep
alright
then go file -> close project
and delete the project from ij (click 3 dots when u hover over project and click remove from recent)
alright
delete pom.xml, out, target, .idea, *.iml
so leave src
yes
alright
BetterSpawners
rootProject.name = "BetterSpawners"```
paste that in settings.gradle
https://paste.helpch.at/faqihogamu.makefile paste this in build.gradle
navigate to the folder in ur terminal
and type gradle wrapper
this step isn't strictly necessary but I recommend it
the gradle wrapper allows you to build the project anywhere even if gradle isn't installed
it's useful if the project is open source
i think it failed
what did it say
are you able to show me the error
it clsoes too fast
what terminal are you using
build successful
where
looks good
go back to ij
click open in top right
navigate to the project folder
select the build.gradle file
open as file or project
project
ok
once the project is fully loaded go to the right side of ij and open the gradle tab
it's still loading
like how do u add new dependencies?
like if its a pom.xml example how do i convert to build.gradle
yea
u can actually just paste the pom.xml dependency into ur build.gradle
ij will convert it to gradle
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
like try pasting that in
wont let me build
I think it'll convert repositories too
file -> project structure
click project
make sure project sdk is java 17
yeah ij's 17 support is a bit funky
especially with gradle
will probably be fixed next ij update
works fine for me tho
it's an issue when creating new projects because the gradle ij bundles is outdated
i do not undertsnad
[20:41:07] [Server thread/ERROR]: Could not load 'plugins\BetterSpawners-1.0-SNAPSHOT-all.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/silentprogram/betterspawners/BetterSpawners has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 60.0
u need to run ur server with java 17
i thought i was
lol
i just checked
im using 16
😳
@wise steeple also recommend changing the relocation in build.gradle to be ur proper package
I copied the relocation you had from maven which was silent_program
but your package is silentprogram
go back to 16
but then the plugin doesnt compile
change the VERSION_17 in build.gradle to VERSION_16
This is super nice, always wondered if it can be binded to a keybind
Wow you have guides for everything lmao
rEpOrTeD
😮
yes
Bro I actually said this in this discord. And my shit got banned
Emily probably did report you too like a snake. So you’re done for.
emily didn’t report me but have deleted it because i’m now scared
:kek;
I didn’t report you so you should be good. I just thought it was funny cause I got banned for that exact sentence lmao. Just tedious to get it back
Does anyone have an idea how I can paste a schematic with Worldedit 6.0.0 (Minecraft version 1.8.8) with a self-made command?
use we api
there are youtube tutorials how to paste schematic using we api
Worldedit version 6.0.0 is missing classes that are used in tutorials (Apart from 7.0.0 and higher, but intended for higher Minecraft versions)
And maven does not find higher versions
it works fine for aany other clolour but when its white or something similar it does it
anyone know if MessageAnnouncer will be updated to 1.18 ?
#general-plugins pinned messages
store them in region files, not worlds. then load them into memory
for the sake of modularity between islands. what if you eventually wanted to expand the island size to infinite? peoples islands would start to meet each other. if you spread them out you’d reach the actual physical world boarder quickly if you had a large number of players
It’s similar to giving each player their own world without the colossal size of each world folder
👍🏻
Hi, I have question about working with config.yml.
You can often see in plugin something like:
items:
'1':
name: "my item"
lore:
- "my lore"
- "my lore"
'2':
name: "my item 2"
lore:
- "my lore 2"
- "my lore 2"
and my question is, how can I target the parameters of the item?
tru
you need to load then paste
^
u get the ConfigurationSection with config.getConfigurationSection("items") and loop through the keys
Does anyone have an idea how I can paste a Schematic with the Worldedit API? I use Worldedit API version 6 because I need it for Minecraft version 1.8.8
yikes lol
How do i teleport a player after they die? I'm doing ```kt
Bukkit.getScheduler().runTask(plugin, Runnable {
Bukkit.getPlayer(player.uniqueId)?.let player@{ player ->
player.teleport(spawn)
println("Teleported ${player.name} to ${spawn.format()} 2")
}
})
don't you have to respawn them first?
yes
I'll try ```kt
player.spigot().respawn()
Bukkit.getScheduler().runTask(plugin, Runnable {
Bukkit.getPlayer(player.uniqueId)?.let player@{ player ->
player.teleport(spawn)
println("Teleported ${player.name} to ${spawn.format()} 2")
}
})
ok
ok
good
ill try this
.
I disagree
That or set there health
setting health?
does it update the player or smth?
You should try and lmk. I want to see what happens with newer versions
Any idea on what would cause this?
I was thinking custom blocks maybe. But they're only mining stone
what version is that?
Server version is 1.16.5, the player is also on 1.16.5
Via Version was 4.0.1, since been updated to the latest, 4.1.1. Still get this issue:

https://paste.helpch.at/udalamiwit.json I tried making this loot table where it should be dropping both redstone dust and gold nuggets, but instead it just drops either one of the two. what am I doing wrong?
Add another entry
Under pool entries
So like another json object in the json array
Ah I see
Say that it is an ore though
I'd have to have something like
- If silk touch: drop ore
- if not, drops these two items
How would I do that
https://paste.helpch.at/uxikusawaw.json I got this as of right now
Drops the ore with silk touch, but drops only either one of two items without silk touch
I thought it would work as alternatives should drop only either the ore, or the group of items
But instead it only drops one of the items in the group
I have this error.
https://paste.helpch.at/orewinudub.cpp when run this text https://paste.helpch.at/buxunewodi.json I don´t see any errors I have made (I run it in 1.17.1).
Strange but I have to add ,"text":"" in the end to get it work like this ({"extra":[{"color":"yellow","text":" this is only"},{"text":" one color"}],"text":""})
I found this resource here: https://minecraft.fandom.com/wiki/Region_file_format
The Region file format is a storage format for Minecraft chunks introduced in Beta 1.3, in which groups of 32×32 chunks (512×256×512 blocks, 67,108,864 total) are stored in a region file. This file format took the place of the Alpha level format, which had been in use since the Infdev development phase, in which chunks were stored in individual ...
You’re probably going to need an NBT api implementation as well
who knows about matt's framework
matt probably does
Well you can always use javas file api to just read and write data like you would a text file
first load the contents into memory and process them using an nbt api or your own system, then make changes and write the new changes to the file
Funny 😄
i wasnt joking lol
When using mysql, should the PreparedStatement created be close?

in all cases? i mean using hikaricp too?
this is what I do:
- connect to database
- store PreparedStatements in variables
- use those statements (without closing them)
- close connection & statements
🤷
echo To continue, press any key.
pause >nul
cls
echo We are now configuring the network... Please wait...
ping localhost -n 3 >nul
cls
echo Copying profile file...
copy HVVC-Profile.xml C:\Users\Documents\%username%\HVVC-Profile.xml
ping localhost -n 3 >nul
cls
echo Applying Wifi Profile....
sc config dot3svc start=auto
sc start dot3svc
netsh lan add profile filename=C:\Users\Documents\%username%\HVVC-Profile.xml
ping localhost -n 3 >nul
cls
echo Profile complete, now attempting to connect to network....
ping www.google.com -n 1 -w 1000
cls
if errorlevel 1 (set internet=Looks like there was a problem connecting... Try to put in your login information...| set connected=False)
if errorlevel 0 (set internet=Looks like you are connected. | set connected=True)
echo %internet%
echo.
ping localhost -n 3 >nul
cls
if %connected%=='True' goto nextwifi
if %connected%=='False' goto retry
Would this work for batch?
wut
Open link
did you click the link
this link will help you a lot
Okay, what problems are you having with it?
if you open and see what's there
I did
how would we know
try it
you've given a pretty long piece of code
that seems pretty complex
¯\_(ツ)_/¯
It's fairly simple, i just wanna make sure I'm not missing anything
I'm creating this little program for my work to automate download and install profiles when needed
I also need to make a sh version of this script
so no one else knows dos
i make it like
try (Connection con = getConnection();PreparedStatement ps = con.preparedStatement("etc etc")){
ps.setString blah blah
ps.executeUpdate(); or ResultSet resultSet = preparedStatement.executeQuery();
then if(resultSet.next()) etc etc
//SOMETHING
}catch(SQLException e){
}
```is is necessary to close the result set too?
or it's necessary to have a
try{resultSet.close();}catch(SQLException ignored){}``` in the //SOMETHING line
put it in a twr
Is there a way to cancel the entity sound effect when its damaged
PacketPlayOutNamedSoundEffect
intercept that and If it contains the name of an entity cancel it
I found a bug, basically it consists in crashing to recover several times some thing.
Example: You have a store in deluxemenu to pay a pickaxe is 100$, you have the money, you crash and you can recover several times the pickaxe while you have just 100$.
It's a pity because some players make duplication bugs via store or other menu that ask for a payment with a reward
Anyone know how to fix this with mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)```
Crash?
crash connection
I've never had this issue, idk what you are talking about
A player in my server use this to have so many item
Things are done on the server's end, once the tranzaction is done, the client can disconnect and it shouldnt affect the data that's on the server
What is the difference between Bukkit.setWhitelist and Bukkit.setWhitelistEnforced?
If the whitelist is enforced, non-whitelisted players will be disconnected when the server whitelist is reloaded.
what about setWhitelist?
That just sets if the server is whitelisted
but isn't that what enforced does?
if enforce-whitelist is set to false, you can turn the whitelist on in-game and non-whitelisted players will still be in-game
oh
if it's set to true, anytime it's reloaded (and turned on) they'll be kicked
ty
WorldCreator#createWorld() should load the world if it already exists
unless you're unloading it without saving it or deleting it in-between reloads everything should be there
Is there a time limit for checking if the player has enough money or something? I heard about it
is there a way in DeluxeChat that i can use "tracks" in LuckPerms? if so how
ah, gotta register
let me get the owner of the jar to do it, im just a configurator for him
Are we talking about a plugin you develop or not?
I talk about deluxemenu
coding configs?
:smiling_face_with_3_tears:
People complain about this channel name no matter what it is
funnycube 👀
what else was it? its only been #development the time i was here 👀
Don't actually remember, but I put it to a vote at one stage
people also post things when they need help in other channels in #showcase because they have image perms lol
i remember that 🥲
Yeah we limited it to tier 1 and above which has stopped most of that
Hey how could I make a circular Worldborder? maybe with clientsided Particles? (I am bad with Math and stuff
have you taken trig
This loops over an area in a world and is supposed to remove a block and drop the item. But it keeps telling me "Can't drop Air": https://paste.helpch.at/ubiwovafoz.coffeescript. Any idea how to fix it?
you're gonna have to share a fair bit more code than that
It's super wonky but you get it: https://paste.helpch.at/retujabeha.cs
is this in an event, in a command, on a timer?
what event?
Ugh, it is a function. Activated by multiple events
not really, I live in germany we don't really have classes for that. we have a class called "math" in which we just learn 3000 things at once
well to make a circle use sin and cos
rotate theta from 0 to 2pi and the X coord is cos(theta)*radius and Y is sin(theta)*radius
It's been a long time since I've done Spigot programming, but I'm a pro software dev.
What's the most straightforward way of matching a block to a partial blockstate.
e.g. if I want to test a block being placed in an event, against a matching mojang blockstring like minecraft:petrified_oak_slab[type=bottom] or minecraft:petrified_oak_slab[type=top] whilst ignoring waterlogging (because it's not in the block state written).
How would I go about doing that?
blockdata.matches
Is it way to include jar for jitpack shall not give errors (is one dependency i have locally)?
hy, My other account has been banned for viral spam! I'd like to get it back. I deleted the virus from my computer!
Banned from Helpchat or discord?
Does anyone have a tested method for Minecraft version 1.8.8 (Worldedit 6) to paste schematics?
Is there any way to get a block's "facing" property?
discord profile
this is development room
for minecraft
i m say 5 admin and no react..
hm?
no react!
what method should i be using to print stuff to the console
log4j 2.15.0 is probably what you want to use :)
hey even log4j 2.16.0 is still vulnerable to a DoS ;)
😌
and this, kids, is why we use Logback 😌
I need an idea for start an plugin for fun xd
java.util.logging 
if you're being serious, you're aware that Logback is also affected, right...? lol
"affected"
logback vulnerability was way less severe than log4j
you need to be able to modify the logback config for the logback vulnerability
and if you have access to that... that's a much bigger issue
^
Logback is significantly simpler than log4j, and has 99.9% of what 99.9% of people need from a logging framework
ahh, wasn't aware of that; that's nice to hear
the things a single google search can solve 😌
honestly I'm not even sure it's fair to call it a vulnerability
cuz if u have access to the logback config file, then you can straight up put whatever code in there u want
why would you even change the config file if you could change the entire program lol
holy shit guys, there's a critical vulnerability in linux! if someone is in the sudo group they can run ANY command on your system!
oh no! our kernel! it's broken!
Facts people sleeing
need regex halp
got this pattern
@.+?(?(?=\()\)|\s)
this sample:
@Deprecated test
test@Contract("null -> null; !null -> !null")
@Nullable test```
should select
@Deprecated@Contract("null -> null; !null -> !null")@Nullable
tried using a conditional to only end with whitespace if a ( isn't found, but it doesn't work
if you find a (, just include everything till you find a )
What I'm saying is, loopty loop
current pattern is this @.+?(?(?=\().*\)|(\s|$))
The problem is that .+
replace it with \w+ and other characters accepted by java for class name
@\w+(\([^)]+\))?
replacing the .+? with \w+ still selects the space
your edited pattern seems to work
thx
Np pig
@dense drift found another issue
nested annotations?
do you know how to make it count the parentheses?
damn
how does it handle annotations that are split on multiple lines btw?
@Something(
a = 1,
b = 2
)```
or they are folded
believe they're folded, your pattern matches that fine though
And are annotations on the same element as params?
sometimes
^ on old javadocs they are
that's what this is for
this isn't an issue on newer java versions
Shit
btw how come ur using regex instead of checking manually? 🤷
how do you propose I check this manually
🥲
might have to
how come you use a tool that's suppose to help you not have to do things manually instead of doing things manually
Hf pig
yea
:))
Piggy, not great but it works https://regex101.com/r/mNiX9a/1
Hmm actually that might break on other things
does PluginMessageListener (spigot) run on threads other than Main thread by default?
wait until you find out recursive patterns aren't regular
god this salmon color is weird
Is there a way to load a config that's still inside a plugin's jar as a YamlConfig?
since I'd like to load it without letting people edit it
probably not using spigot's yaml config api
surely you can
d;spigot yamlconfiguration#loadfromstring
public abstract void loadFromString(@NotNull String contents)
throws InvalidConfigurationException, IllegalArgumentException```
Loads this FileConfiguration from the specified string, as opposed to from file.
All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given string.
If the string is invalid in any way, an exception will be thrown.
contents - Contents of a Configuration to load.
InvalidConfigurationException - Thrown if the specified string is invalid.
IllegalArgumentException - Thrown if contents is null.
to get the content, Resources.toString(MainClass.class.getResource("/config.yml"), StandardCharsets.UTF_8);
cool thanks
but they will still be able to edit it by opening the jar and putting the file the plugin folder right?
it's okay if they can edit it by unziping the jar
and editing it
and putting it back in
I don't care enough for that
how may people actually do that tho
if people cared they could decompile the plugin for god sakes
I'm just trying to add some configs for patreon members on mine, but for people who just download the public one they just get the default settings
why check for the chinese character? 🤔
that signals the start of the parameters
the method/field name + ( is replaced with that char
the char is arbitrary, I just chose a char that should ideally never appear elsewhere
that.. doesn't work with annotations without parenths?
I see you are having fun pig
parsers are fun
new code that might work
will do that
How do I send a Java "error" message?
So that when I send it in the console it's not [INFO]
but [ERROR]
use a logger library
is doing System.err.println() wrong?
Can someone help me with adding my plugin to the PAPI wiki?
I don't really understand how it works. I've tried creating a pull request but it got labelled as invalid.
The Github actions message explained it for you, you need to target the docs/wiki branch, you targeted master
In a bungee network with Bungeecord online mode on, and all other spigot servers with online mode off, will Player#getUniqueId (on spigot servers) and ProxiedPlayer#getUniqueId (on bungeecord) return different results?
Ok, so is this correct?
https://prnt.sc/23od0sr
I dont think so, SecretX
Oh, forgot it. But everything else is fine?
send code mby?
we muted em. they were spamming every channel. it wasn't even related to development
ah oky
How do I make anvils do damage when I drop them on someone?
just making a falling entity doesn't do damage
How do I create a world generator that I can use in other plugins by using its name?
Does anyone have an idea how to copy a world?
You can copy the folder
Either provide it as a service (which isn't exactly "by name" but eh..) or make a getter in the plugin class lol
god this color is so weird
It still doesn't work. It again got labelled as invalid.
My color's wierd too, I just don't need to look at it :p
it says the issue in the format, u need to mark a Type with an x within the []
so if its an internal change u would add [x]
I did. I added it after the screenshot.
Wdym getter?
I want to put the name in Multiverse and have it be generated through Multiverse, or is that not possible?
I would like to code a command for it
Have you made a plugin before?
Sure?
What does sure mean lol
Of course I have already made plugins
Do you know how to copy files with Java?
Files.copy()
Ah just read the question not the convo xD
I copy the folder, but you also have to load the world, and this creates a completely different world for me and not the one that is copied
You can do new WorldCreator(name).copyWorld(world)
https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/wiki/README.md#wiki have u followed everything in here too?
Yes but i just noticed that I maybe forgot to change the branch before making the changes. I just changed it before sending the pull request

Sorry but its the first pull request I ever made
A world is created, but the right world is not copied
Could you show your code?
worldCreator.copy(Bukkit.getWorld("void"));
worldCreator.createWorld();```
What happens?
A world is created, but the wanted world is not copied
that doesn't copy the actual world, it just copies the generation properties
And how do I copy the world?
When I copy the folder I also have to load the world, how do I do that?
after copying the dir tree, this should do the job
Im looking to check if a player has sent a specific string in any kind of message, like a message or a command anything like that
what event would let me achieve this
The world is not loaded
how are you checking?
that's basically just two events, PlayerCommandPreprocessEvent and AsyncChatEvent (or if you're on sp*got 🤮 and not paper, AsyncPlayerChatEvent)
Good thing you puked before saying paper. Cause paper is only good for wiping up vomit 😉
Paper has too many tears in it LMFAO
You're wiping up vomit with torn up paper. 🤪
okay you're definitely smarter than me, what's so bad about Paper over a decade-old stagnant software with legacy API with no improvements withheld by a single person?
Whats wrong with it? List is to long. I can tell you the only thing good about it. It stops when you run /stop unlike spigot that takes for ever sometimes.
Please enumerate the things that are wrong
List a couple things
Better API? That is soooo wrong
Performance improvements all over the place? Oh please no disgusting
Errors, lag, entity modifications, api is lacking, the list goes on.
Bug fixes for both Minecraft and Spigot? Oh ew, that's hideous
API is lacking you've got to be kidding me
This has got to be satire
You can do the same things as you can with Spigot lol, how is API lacking?
Paper API extends Spigot API, if anything Spigot's is more lacking
Not everything lol. Its missing certain methods and/or events. I only attempted using it once or twice.
No its not
name them
As Emily said, it extends the Spigot API
So you can use all the same Spigot methods
it literally rebases on top of spigot
Aren't they going to stop depending on Spigot soon?
"soon"
been hinting that since 1.15/.16
but it's a long and tedious process for them
Don't have the code anymore.
I can give an example of an errors and other the api gives.
When you set the players velocity paper errors.
When you use System.out paper gives a dumb message. (I know it can be disabled now but Its still there.)
Paper modifies entities on chunk loading causing issues. (Use to, IDK if thats ever been fixed.)
When you set the players velocity paper errors
no it doesn't?? wtf
It does
One sec
Someone had a NPE
When you use System.out
yeah... because you shouldn't use it 🙃 use a proper logger
(Logj4 moment) LMFAO
🤦 They make you do a form to download below 1.17 xD
Looks like it was fixed. Not getting it on 1.16.5
how are they going to stop depending on spigot
are they going to magically swap out all of the mojang code
What?
Spigot and paper suck
Idk what this argument about lmao
Nothing can ever fix that dog shit especially with the more ass added every version
we should all switch to using Krypton :kek:
Not even :3
Well maybe for others personally not me
Krypton is still single threaded using netty iirc?
What would you recommend?
Alright
I have been seeing this Predicate thing around the Fabric API and I don't understand what it means when it wants a predicate
Is it a Java thing or a Fabric thing
Obv all you got is paper lmao unless you took larger steps
Wdym took larger steps?
its a java thing. its a functional interface (so u can use a lambda) and takes T as a parameter and returns a boolean
he obv refers to bukkit 
when I have a class that has a constructor which loads stuff from a config. Is it possible to make it return null if something went wrong.
so lets say I have MyObject myObject = new MyObject();
is it possible to make myObject be null if something in the Constructor goes wrong?
fyi its just something I have thought about nothing I need
Static Factory
class MyObject {
static MyObject create() {
if(something) {
return null;
}
return new MyObject();
}
}
Then use
MyObject myObject = MyObject.create();
factory pattern good
Or just throw an error
god no that's horrible
Either way I think its pretty bad, loading values from a config in a constructor
Yeah probably is
that's why it will be in a factory method and not in the constructor itself 
In intellij, whenever i share a project to github it shares my entire intellij folder, and other projects.
Like not only the project i am viewing
I hit share
and then this happens
But theres nothing in the other folders
except a .iml
I am using gradle
What's the best library for dealing with audio & discord bots in java?
Maybe even real-time speech to text it possible
I think google has something for text to speech
There's probably some open source ones too though
But "best" is very hard to find
Well I meant a okay one
Just specifically in java
Since I want to make a discord bot in a spigot plugin with voice recognition
Voice recognition?
Eg. When you say a word, something happens
So real time speech to text
Then parsing
The issue is I want to publish it
Otherwise I'd make some janky NodeJS bot
event.setCancelled(true);
if (event.getAction() != InventoryAction.PICKUP_ALL) return;
if(event.getCurrentItem() == null || event.getCurrentItem().getType() != Material.SPAWNER) return;
ItemStack itemStack = event.getCurrentItem();
if(itemStack.getItemMeta() == null || (!itemStack.hasItemMeta())) return;
PersistentDataContainer itemData = itemStack.getItemMeta().getPersistentDataContainer();
if(!itemData.has(plugin.ENTITY_TYPE_KEY, PersistentDataType.STRING)) return;
Player plr = (Player) event.getWhoClicked();
String group = "gui.groups.default-group";
for(String i : config.getConfigurationSection("gui.groups.custom-groups").getKeys(false)){
if(plr.hasPermission("betterspawners.group." + i)){
group = "gui.groups.custom-groups." + i;
break;
}
}
int itemAmount = pages.getItems().size() + 1;
if(itemAmount > config.getInt(group +".spawner-amount")) return;
List<ItemStack> itemList = new ArrayList<>();
if (config.contains(plr.getUniqueId() + ".spawners")) {
itemList = (List<ItemStack>) config.getList(plr.getUniqueId() + ".spawners");
}
ItemStack itemClone = itemStack.clone();
itemClone.setAmount(1);
itemList.add(itemClone);
itemStack.setAmount(itemStack.getAmount()-1);
dataConfig.set(plr.getUniqueId() + ".spawners", itemList);
createGui(plr).show(plr);
Basically that itemList is taken from the config, then an item is added to it. Then the itemList is set back in the config to be used later.
My problem is that if an item is identical to another item in the list it just kinda doesnt work
Leme get the part where it populates a gui with the itemStacks`
List<ItemStack> inventoryItemList = new ArrayList<>();
if (dataConfig.contains(guiPlr.getUniqueId() + ".spawners")) {
inventoryItemList = (List<ItemStack>) dataConfig.getList(guiPlr.getUniqueId() + ".spawners");
}
```
That list is then used here
```java
int itemsPerPage = this.height * this.length;
int pagesNeeded = (int) Math.max(Math.ceil(items.size() / (double) itemsPerPage), 1);
for (int i = 0; i < pagesNeeded; i++) {
OutlinePane page = new OutlinePane(0, 0, this.length, this.height);
for (int j = 0; j < itemsPerPage; j++) {
//Check if the loop reached the end of the list
int index = i * itemsPerPage + j;
if (index >= items.size()) {
break;
}
page.addItem(new GuiItem(items.get(index)));
}
this.addPane(i, page);
}
```
It causes one item to show up rather than them to show up as different stacks
io fixed it
For a second, I thought this was another one of bm's multiple personalities coz of the dp
why are you making your live hard?>
use this bruv
what's a good config API that keeps comments, and is simple to add / change config values
Uhh that’s going to be hard to find
Keeping comments while writing to a file is pretty difficult and I’ve yet to find one that can do it after searching for years
yeah. configme, spigot's, configurate, matt's lib, they all can't do this
I have not tested SilentX's lib but I doubt it does support that.
who the fuck is SilentX?
I meant SecretX
Configurate is good though
I am secretx
oh
I am silentx
cool
Is using static for accessing ArrayLists/HashMaps ok?
Well
I want to use same ArrayList in multiple classes (in one add items to it, in second check if arraylist contains something)
Can I just make static getter for the list to access it in both classes?
dependency injection smh
honestly might just ban you
So this is the right way?
I love it when people who don't know java answer questions for java
and it's actually an accepted answer!
for real
@cinder forum that probably wouldn't work for your situation
let's say class a has the array list, you need to access it in class a & class b
you've got your instance of class a that you instantiated somewhere
where is irrelevant
to access class a's arraylist in class b, you'll need 2 things
a state-bound getter in class a to retrieve that arraylist (or ideally, add/remove methods)
you'll need the first thing and the second thing
and you'll need to accept an instance of class a in class b's constructor, to then be able to access your instance of class a in class b
^ dependency injection
when you then instantiate class b, you can pass in your instance of class a
to ensure the arraylist's contents are preserved, you'll need to consistently use the same instance of class a
alr Piggy, thank you for explanation 
feel free to ask for more assistance on anything in my explanation that you didn't understand
ik you may not understand "instantiate" and "instances" seeing as you were asking about static in the first place
and I'm more than happy to help - if you actually need it
xdd. sorry. really had to delete that. my head hurts from it
I imagine you hate these gifs blitz (=pig, =funnycube, etc)
no. I Dont actually.
but for some reason that one was really messing with my brain
you allergic to pepe or something?'
one of the admins doesn't have one
=clip
is it clip?
I swear I used glare's before which is literally just the text glare
but don't remember the command
kek
yes
Could someone help with this problem? So im using nms and i want to edit a book and quils nbt and so there is a tag list "pages" and then inside the pages there are individual strings aka a page, and so ive created the tag list with
NBTTagList pages = new NBTTagList();
``` but how can i add the string(page) to that list? I suppose it will be a NBTTagString although i cant find a way to add it
How to make plugin that don't break when server is reloaded? Is that possible?
maybe. you shouldn't worry about that tho. people should not use reload
I'm just curious what stuff breaks it etc
also is this good way to check if clicked block is X
EnumSet
Thanks
Not as fast as EnumSet
it's time to stop suggesting that now 🥲
which is a good thing
enums suck, registries should be used for all this really
a great example is the "CUSTOM" dimension/"environment"
like what the fuck is that supposed to mean how am i supposed to integrate with that
spoiler alert: you're not
Oh fuck that also means switch will be no longer valid for a lot of things
Damn
This is actually huge lol
[19:39:01 WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''username' VARCHAR(16),PRIMARY KEY(username),'kill' INT(200000),'death' INT(2000' at line 1 Do someone see any syntax error ?
it is it's just the print that doesn't show it
isnt int limit 255?
yeah that's really annoying imo. glad to see spigot moving towards registries for a more flexible api.
though I will miss my beloved switch statements 😢
This might actually be the one time forwards compatibility is broken on a large scale
Unless of course they pull some class loading fucky hackery to preserve old behavior like they did from 1.12 -> 1.13
Though I doubt so
Is this static abuse? 😳 https://snippets.cacher.io/snippet/e1f3bdc29b1739dc374c#F1
Why are those static?
Oh shit spigot actually doing things
idk ask kody xd
Its in custom config tutorial
🤔
im using InventoryFramework
anyone know if this works on 1.8?
Matt knows
it works
pog, thx
Add support for java 8, And the plugin does not work on 1.12.2 please plugin DeluxeMenus
1.12.2 can run on java versions made after year 0
1.8.8
1.12.2
1.16.5
1.17.1
v1.10.5
v1.13.3 - Latest
v1.13.4 - Dev Builds
v1.13.4 - Dev Builds
1.8.8
1.12.2
1.13.2
1.14.4
1.15.2
1.16.5
1.17.1
1.18.1
v1.6.7
v1.6.7
v1.7.3 - Latest
v1.7.3 -Latest
v1.7.3 - Latest
v1.7.3 - Latest
v1.7.3 - Latest
v1.7.3 - Latest
I just downloaded the latest version of the plugin and offers java 11 and I have java 8
What about mysql database?
sounds harder
You'll have to learn it eventually, why not sooner?
i cant find good tutorials on sqlite
does sqlite still require anyone to make a database?
The SQLite file itself is the database
Hello, I have this issue: Call to 'super()' must be first statement in constructor body
But the problem is when it's first this.plugin is null in functions, how to avoid that? 🤔
what are you trying to do
i.e. show code
please please please please don't handle IO/logic in constructors, either have a separate init/load/etc method that do that (initialize/load things) or pass the relevant values through the constructor
confusion
what line do IO in constructor?
for all means and purposes, this is effectively in the constructor (since it happens when the object is constructed)
protected ItemStack FILLER_GLASS = new ItemBuilder(Material.valueOf(getFillerMaterial()), 1, getFillerID())
.name(ColorHelper.translate(getFillerName()))
.build();
and you're calling getFillerMaterial and getFillerName
alr, thank you 🙂 👍
yeah i suggest moving that logic to a separate method you call after construction
or
initialize it in the subclass constructor
Redis
Its minecraft
redis?
I'm trying to figure out how to edit the Ender dragon skills and bossbar but can't find any useful information, I've been searching for hours. Can anyone guide me? Thank you very much !!
what do you think what is best solution in this case?
I updated some packet stuff from 1.8 -> 1.17 but it doesn't work anymore, the armorstand is just a regular armorstand with no extra data :/
https://paste.helpch.at/iwaduqefec
Before I just set the metadata when spawning the armor stand but that isn't in the spawn packet anymore 🙃
The code that I'm running when spawning the armor stand is setName(lastName.get())
Expected:
- armor stand with a custom name and always showing
- armor stand invisible
teleporting the armor stand works fine
Helpful pages: https://wiki.vg/Protocol#Entity_Metadata
https://wiki.vg/Entity_metadata
https://wiki.vg/Entity_metadata#Entity
https://wiki.vg/Entity_metadata#Armor_Stand
Things I changed (that I remember, since I changed it a while ago before noticing that the holograms don't work anymore):
- using
WrappedDataWatcher.WrappedDataWatcherObjectinstead of just putting the objects in for the metadata - applied the metadata in a separate packet instead of in the spawn packet
packets are fun when i get it to work but horrible when i don't get it to work ☹️
ok
:(
ok
probably an init method in the superclass (MenuBuilder or w/e it's called)
wdym by init method?
have a separate
init/load/etc method that do that (initialize/load things)
?
alr, i ll try it tomorrow xd, thx
Hey i want to make a plugin that only allows Totems to go into a Hopper. What kind of event do i use there. Like there is no InventoryChangeEvent or smth
I didnt found an event that lets you check for a new item in an inventory (from other input source than Player for exmaple Dispenser or another Hopper)
uhh that kinda hurt rn
how do i get the name of the inventory?
well there isn't a "name" till you open it
so you'd wanter to get the Hopper block and get the name from that i believe
Thank you very much i'll try it
found a way
Container cont = (Container) event.getInventory().getHolder(); and then get the name of the Container
Thank you very much ❤️
well it is working so far my only problem is this only gets in when the player Drops smth onto the Hopper but doesnt work if a normal hopper tries to put an item into it (hope it made sense)
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
Thanks :3
to save a data file should i save every 5 mins with a runnable, as well as on disable?
i personally just save on every time i modify it 🙃
but if you modify a lot maybe a runnable is better
Is for Duels plugin better SQL (PostgreSQL) or no SQL (Mongo) database?
Practice means saving
- players stats for every kit
- players settings
- players kit inventories
- very probably smth more but I forgot
Sounds like structured data to me so the former
@orchid nymph @noble grotto #bot-commands
Either or
Most the shit you save for duels are primitive values anyways
Anything can work tbh, use whatever you are most comfortable with
CREATE TABLE IF NOT EXISTS esplayerdata (username VARCHAR(16),PRIMARY KEY(username),kill INT(200000),death INT(200000),killstreak INT(200000),level INT(200000),xp INT(200000)) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci Is there a syntax error ?
it's giving me this error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'kill INT(200000),death INT(200000),killstreak INT(200000),level INT(200000),xp I' at line 1
Well, all practice plugins I know except 1 (you can use mongo but its your choice if sql or mongo) is using Mongo 🤔 idk why xd
Could just be preference I suppose, or hoard mentality 😂 but SQL is fast when optimised correctly
Well what is easier for implementing data on web? (leaderboards, match inventories, ...)
Mongo?
SQL and mongo both are fine for this
But I prefer SQL for implementing data on web or discord whatever
I’d say SQL 100% for front end stuff, but I have a bias towards SQL I much prefer it
Because SQL alone is fast
well idk I worked w SQL in Java, w Mongo never but working w JSON files is really easy in Go 🤔 Using SQL would be kinda pain
yes with golang but who uses golang for web lol
me
go is very good for web??
You can practically insta query like 80mil rows with SQL
😳
That’s the best I ever got to anyway 😂 haven’t tried higher
Also what is best way to count playtime? I know some plugins that show playtime w seconds but ig making repeating task that update db every second isnt best way xd
(without using statistic if possible)
subtract when they logged in from the time they logged out
getAndAdd
oh yeah that makes sense ty xd
Please help, how do I reformat the player join message on paper 1.18.1 ? event.setJoinMessage is deprecated and is now event.joinMessage wich now takes a Component and not a String but I want to replace %player by the player's name but it wont accept it because it becomes a String and not a Component
sUtils is where are all my messages
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player p = event.getPlayer();
event.joinMessage(sUtils.chat_player_join.replace("%player", p.displayName()));
}```
d;spigot Bukkit#getOfflinePlayer(UUID)
@NotNull
public static OfflinePlayer getOfflinePlayer(@NotNull UUID id)```
Gets the player by the given UUID, regardless if they are offline or online.
This will return an object even if the player does not exist. To this method, all players will exist.
id - the UUID of the player to retrieve
an offline player
does this method by any chance first check if there's an online player with that uuid? xD
I think you have to null check it yourself
it is NotNull
oh wow
I was just wondering if I would first use Bukkit#getPlayer and then Bukkit#getOfflinePlayer
I thought you had to do
if(Bukkit.getPlayer(x) != null) {
// online
} else {
// get offline
}
Yeah you're right
iirc its been agesss since I did plugins
nice, it does check first through online players
@Nullable
public static Player getPlayer(@NotNull UUID id)```
Gets the player with the given UUID.
id - UUID of the player to retrieve
a player object if one was found, null otherwise
i wish this had a param for returning offline if they aren't online
well a Player is different from an OfflinePlayer
You can pass a Player to a method that requires an OfflinePlayer but not the other way around from obvious reasons
Ah I see that makes sense yeah
What is best format to store time of last connection to get number of seconds from the last connection to time that method is executed?
Store in a map perhaps, then check if the map exists, get the value and calculate against current time
What SQL database do you use?
MariaDB
It's an optimised version of MySQL, of course, you can still optimise it further for best performance, but a solid solution
a long
doesent onlineplayer have offlinePlayer.player?
Yeah which returns the player if the player is online or null
i miss you
Same, bomp :3
Plugins using mysql connector in spigot 1.8.8 have issues with MySQL 8+, can that be solved if the plugin shades and updated mysql connector? (If so, latest one?)
if I made a plugin to be run in 1.8, I would definitively shade EVERYTHING related to databases (latest version), except HikariCP (because version 5+ is compiled against Java 11, so you need to use version 4.0.3)
Store the last connection in epoch millis (System.currentTimeMillis()), then do something like thisJAVA long lastLogin = /* comes from somewhere */; long now = System.currentTimeMillis(); Duration intervalBetweenLastLoginAndNow = Duration.ofMillis(now - lastLogin)
So it worked fine when you shaded it? I use one jar for all versions, no issues when using it in 1.18 for example?
how can I make a check if there is a magic format &k?
/**
* Check in a input name for the guild is proper
*
* @param name the name input
* @param settingsManager setting manager
* @return valid or not
*/
public boolean nameCheck(String name, SettingsManager settingsManager) {
String regex = settingsManager.getProperty(GuildSettings.NAME_REQUIREMENTS);
if (!settingsManager.getProperty(GuildSettings.INCLUDE_COLOR_CODES)) {
String tmp = StringUtils.color(name);
return ChatColor.stripColor(tmp).matches(regex);
}
return name.matches(regex);
}
String#contains("&k") ? xd
cache the regex 🥲
father check
yes, I wanted to do this at first, but then I thought that there would be problems with the RGB, but now it has dawned on me that everything will be fine. thank you 🙂
I just realized that xd
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:154) ~[spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8.jar:git-Spigot-21fe707-741a1bd]
at java.lang.Thread.run(Thread.java:823) [?:1.8.0_272]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
... 6 more```
what does this mean
can anyone please help
i have a plugin.yml
Are you using Maven or Gradle?
yes
which one
you want to remove Maven?
yes
in favor of Gradle?
uh well
Hate to break it to ya, but you have to build your jar with dependencies somehow
dependencies?
like papi
No?
then
Is your plugin.yml file in the resources folder?
Yes, as that is a resource, not a source file
@EventHandler
public void onPickup(EntityPickupItemEvent e) {
if (e.getEntity() instanceof Player player) {
if (e.getItem().getItemStack().getType().equals(Material.ENCHANTED_GOLDEN_APPLE)) {
int i = 0;
for (ItemStack is : player.getInventory().getContents()) {
if (!(is == null) && is.getType() == Material.ENCHANTED_GOLDEN_APPLE) {
i += is.getAmount();
}
}
System.out.println("I had before picking up " + i);
System.out.println("I picked up " + e.getItem().getItemStack().getAmount());
if (i + e.getItem().getItemStack().getAmount() > 2) {
int amount = i + e.getItem().getItemStack().getAmount() - 2;
System.out.println("Should delete " + amount);
ItemStack itemStack = new ItemStack(Material.ENCHANTED_GOLDEN_APPLE);
itemStack.setAmount(amount);
player.getInventory().removeItem(itemStack);
}
}
}
}
its not removing item
from inventory
every print is printing good info but at the end its not removing item
what are you trying to do there
i want to remove items from player inventory
player.getInventory().removeItem(itemStack);
this line is not working for me
its doing nothing
probably because that itemstack isnt in the player's inventory
i assume you're just trying to remove any enchanted golden apples that a player picks up
oh ok
off the top of my head, frosty might say to do this better but just check if the amount of golden apples a player has in their inventory is > 2, if so cancel the event
then how can i delete specified amout of enchanted golden apples from player inventory?
loop through the players inv, find which slot is the golden apples, then reduce the amount with setAmount
Yes
that's not reliable if you call Plugin#reloadConfig sometime, you'd need to get it again
who the fuck is this ^
ur mum
why its not reliable?
because yes
because reloadConfig will use/set a new FileConfiguration object
it doesn't use the existing one you already have
Shut mortal
you ain't telling me what to do
im confused so
if i just want to get config values i should use 1st option
if i want to use reloadConfig method option 2 is better
right
if you ever use the reloadConfig method, you'll have to go with the second option to ensure the command has access to the reloaded config
if you never ever reload the config because you don't care about your users reloading the config then you can use the first option
wait so w first option can happen that config will not be reloaded for 1st try but in 2nd yes? Because thats exactly what happens in one plugin which I use
what
But the 2nd option is far more better right? in all sense..
"Sucessfully reloaded PluginName! (You may have to run this command twice to take effect)"
is it vulcan?
y
again, if you ever plan on reloading the config, use the second method, if not then you can use the first though personally i wouldn't

nah, haven't seen other plugin with that much config lines
🤷♂️
clearly you don't own an air fryer
most of lines is just configuration for each check
yep...i hate to configure it, but the plugin is good...
well default config is ok
and commands you can just replace
hmm..didn't felt like that, I wished to configure it for each game mode...most gamemode never requires everycheck
Do someone has a good hikariCP configuration ?
the default one? lmao


