#help-development
1 messages Β· Page 946 of 1
we have a bot that handles these on my server
pretty sure they can yes
@lost matrix
do yo thing
I always wondered whether those are people who's account have been hacked or just accounts created purely for this
do people put their credit card info into these discord servers that they keep promoting it?
some of them are just down bad
and get hacked
Wait i wanted to join 
I can still find that for ya
i have quiet a few in my automod channel if you want to lol @lost matrix
Always wanted to get scammed and put my credit card infos out there
porn bots?
seems like discord itself
well whatever
Write a letter
send a carrier pigeon
how can i get the statistics of an offline player?
By calling .getStatistic(Statistic) on the OfflinePlayer...?
ye
public static int getKills(OfflinePlayer p) {
return p.getPlayer().getStatistic(Statistic.PLAYER_KILLS);
}
and how can i do the getPlayer() on an offline one?
You dont
and how i can...
By calling .getStatistic(Statistic) on the OfflinePlayer
oh okay
how can i check if a item is a block?
declaration: package: org.bukkit, enum: Material
I bet those questions (of this kind) can be solved with a simple google search
anything can be solved by google search. it's just that people are lazy and need a quick solution. at the end of a day I still don't understand why this channel is for, if eeeeeeverythinggg can be resolved with a "simple google search". So the idea of it, is confusing, however, I prefer not to search much on Google, because people here almost always know what the problem is, how should it be resolved or what I have to change or whatever. but yeah I guess not always..
But you know, whenever you post your code, idiots will be idiots, most of the programmers can be egotistic fucks and immediately start judging your code as if it's a trophy for them to achieve or some toy or a ball they have to catch. It's important to respect newbies, not the ones that use AI and then copy&paste and spam the fuck out of everything, but everyone else, yea
It's for 'bigger' and more specific problems ig
eh i disagree
I mean google can help, but google can just be as confusing
yea I agree with that people can be confusing
i think being a good googler is a valuable skill, however there is a lot of outdated solutions on the web, it may just be as hard to filter out what you need yk
I think a good example for this is web development, specifically frontend. There's code snippets and solutions available, only a couple years old, but that are entirely outdated and replaced
"Ok guys, today i will teach you how to make guis in minecraft"
@EventHandler
public void onClick(InventoryClickEvent e) {
if(e.getInventory().getView().getTitle().equals("Kit GUI") {
switch (e.getSlot()) {
case 1: ...
case 5: ...
case 7: ...
}
}
}
i'm so ready for title exploits to popup again
Oh fuck no
they dont even use switch, they use if statements 
ive made some custom recipes on my server but non operator players cant craft or pick up those items for some reason? i have not set any permission restrictions for those is there any default ones?
Cant they craft them or cant they pick them up? Which one is it?
Nope
They are mutualy exclusive
If you didnt craft an item, then you wont be able to pick it out of your crafting UI because there is nothing to pickup
oh not like that if a op crafts them and then then throws them like that..
Then there is some plugin preventing this
Items arent restricted in any way on default.
How about other items. Did you try throwing them a stone block to see if they can pick it up?
Because im suspecting there is a plugin in play which prevents creative players from handing out goodies.
I will remove each plugin one by one and check if that's the issue
Hello, I have been trying to create a plugin with custom heads from Minecraft Heads in an Inventory, but the plugin throws me this error
java.net.MalformedURLException: no protocol: 3f6d3a28dd1d680fa7cc3bc4bd04cd0113bc720320a9caaa7b097e0046889645
I don't know what can i do. This is my code.
(I have created only one head, is for test the method createHead)
This doesnt look like an URL to me...
?paste
?paste
private static final String BASE_URL = "http://textures.minecraft.net/texture/";
private static URL createTextureURL(String key) {
String url = BASE_URL + key;
try {
return new URL(url);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
URL textureUrl = createTextureURL("ad8e4187921f223878af435d4554c32473e7437f59236618c80a0cd773b9606d");
You literally need to create an URL to the texture on mojangs server.
im gonna try
and if i want create more than one?
head
Then you call the method more than once...?
I dont understand the question.
Each texture has its own unique URL on mojangs servers.
So if you want different heads, then you need to create different URLs.
like that? (i modified the paste)
Send the modified paste
Why is this randomly in the middle of your class?
It was unintentional, Im gonna fix it
All you need to do is replace
public static ItemStack createHead(String toBeUrl){
URL url = null;
try {
url = new URL(toBeUrl);
} catch (MalformedURLException e) {
e.printStackTrace();
}
with
public static ItemStack createHead(String toBeUrl){
URL url = createTextureURL(toBeUrl);
sTaTic AbUsE
done
hi i need thelp with connecting plugin to database its connected but does not show player stats
no clue why people dont like spamming static lol
YOUR plugin?
yes
"YeAh BuT iT wOrKs" is their usual answer when you point it out
okay what language?
https://paste.md-5.net/hitahilevi.java @lost matrix
(Mysql, Mongo)
mysql
mhm okay show me the code that seems to be causing the problem and the methods used by kt
sure
?paste
put it in here
but its large project
i was just kidding, its okay to use static in utility methods like getting a player's head the way they're doing it
ok
I meant the menus with the if statements, but yeah I agree lol
they are right
99% of time
theres nothing wrong with static
how do i send the other classes
lmfao i thought you responded to my static joke
click safe on the website
then copy the link
and open ?paste again
I used to extremely abuse static (even in my main class) until I learned it wasn't the right way to do it
I was told it's the only basic thing I hadn't learned somehow
?paste
now I think I over-instantiate stuff lmao
can you see the first code
click save
i did
and copy the link
your main looks good
can i send you file of the project
ok
i cant really open that xd
does boundingbox#contains not include the actual border of the box?
?paste
it doesnt let me save
wdum it doesnt let you save lol
that sounds new
never heard of an issue like that
Guys im having trouble, my plugin listens when a player clicks a barrel, if he clicks it it gives it a key if he clicks it again it does not have that key anymore, why is that?
?paste
i know him, he copy pasted two plugins into one and i think he didn't unify the javaplugin classes
now doesnt open the inventory and doesnt throws any error
i fixed part of it
but the inventory doesnt open
now just the database part is not working
if it would let me save
what methods of the db are being used
uhh
if you want
send me screenshots in dΓΆs
dms
when i cancel the inventory click event if a certain item is clicked, it just duplicates the item in creative mode. How can i fix this?
.
what are you trying to do?
I think you need to save it the block's metadata
how
I'm not sure though, let me look at my hopper plugin to check how I saved persistent data onto a block
ok
it's simple, you're already doing it right but missing one thing
what am i missing?
after you've set your value in your PDC, simply call state.update()
that'll actually write the value you've edited in the block's metadata
so after the last line i should put state.update()
correct
tysm i have been trying everything i could think of in the last 30 minutes
can you show us how you're doing it?
I struggled a lot when I tried doing that too
?paste
just checking, are you counting the slots from 1 to 10 (example) or from 0 to 9?
alright
you aren't updating curtitle
you're getting it once and it gives you the name of the first menu, but when you change menus it doesn't update with it, you have to explicitly set it again
How can i get all online players in a class that not extends JavaPlugin?
Bukkit.getOnlinePlayers()
I have the idea in my head but I'm bad at explaining π
your second if statement is nested in another if statement
so it's never reached
oh sorry I can't read... lmao
nvm my english isn't good
and also i found what is wrong. thanks π
vanilla items don't have itemmeta
yeah
also you're checking twice if the item is AIR/null
item == null is the same as item.getType() == Material.AIR
it's fine, I saw you were korean
Judging others for trying is a bad thing
cool
do you know how can i get vanilla item's display name?
it can't be getting with using itemmeta
public static Object getValue(Map<?, ?> map, Object key) {
for(Map.Entry<?, ?> entry : map.entrySet()) {
if(entry.getKey().equals(key)) {
return entry.getValue();
}
}
return null;
}``` is this a good code to get a value from its key? :)
item.getType().name()
i think map.get(key) solves it
does ```java
Bukkit.unloadWorld("world_nether", true);
or only put it in like standby mode
that simulation is stopped
It unloads it
so?
because unloading worlds is not a vanilla concept
what does that mean in terms of memory management
i want to have n worlds, with only m worlds active at any time to prevent OOM errors
but i want to change which worlds are active at runtime
It removes the world from the server's world list
Whether that actually frees the memory depends on what else is holding refrence to the world
but by default in "vanilla spigot" nothing does and the refcount goes to 0?
If you're having OOM errors, I feel like unloading worlds probably isn't going to be the solution you should be exploring
Maybe investigate what's allocating so much memory and reduce its memory footprint. Search for memory leaks
im not having them i didnt even start the development process. im in the process of writing my flowchart and UML diagram xD
yeah if you have only your own plugin that doesnt do anything, then it should go to 0 yeah
Im often having oom problems when healing. Maybe he should get a different armor set that focuses more on regen.
hello, i created a head in a inventory with custom textures from minecraft heads, but the head doesnt have textures
why?
i didnt applied item meta
that is, if I put meta item but in a different way
Download more mana
now says profile name must not be null
Caused by: java.lang.NullPointerException: Profile name must not be null
What version of minecraft
Paper
for a person that's new in this, that's perfect. it's not like everyone should write code exactly as you would prefer. it doesn't matter if there's a space missing, or any of the visual characters that don't really affect the performance of the code. it doesn't matter if they use switch or the shittiest code possible. if they know what it does, and didn't just copy and paste it from somewhere, then that's fine. As long as they understand it. They'll get better, maybe better than you, me or the whole server. Also most of the people get judged for x problem when they were asking about y. It's like coming to a restaurant ordering a steak but receiving a beer.
what?
?whereami
oh mb
adventure-platform: exists
spigot:
does some AST parser library exist for java to parse mathematical terms?
adventure bukkit sucks tho
ok? it still exists and you can send messages
One of our fellow spigot devs wrote a really good one:
https://github.com/boxbeam/Crunch
tablist header/footer, bossbar, title, book
cheersπ
crubch
Once paper hard forks I can finally kill PineappleChat
what's that
My mini message clone that I built cuz I wanted to learn parsing
Was a worth while project I learned parsing π
good
looks good little bloat and does just what its supposed to do from what i can see
Can't wait to hard fork paper and create the pinnacle of server software
pinneapple
I'll call it Y2KisTheBest
lets fork the fork of the fork
I thought it was CabinetMC
That was simply a tool to make fun of CMarco
He's gone now tho so idrc anymore
I might do something this summer tho who knows
guys i have the player's item in hand how can i destroy it?
oh ty
Maybe material
Set held item to null
Yea, why can't they just return air, it's basically null, but doesn't throw 50 Exceptions
You can just use null
Null π
L
Hush this isn't kotlin
This constraint wouldnt make sense. Whats wrong with just extends Iterable<User>
Or if its a specific user set
public interface UserSet<T extends User> extends Iterable<T>
true
i think it makes sense, it breaks the contract sort of, but i wanted the classes that implements it to give more information than just this
Get the plugin and create a pdc key from it
Sometimes they have them laying around somewhere and can be grabbed.
Hey when using the Respawn packet I get the "loading terrain..." message for a long time, am I using it wrong?
val respawnPacket = ClientboundRespawnPacket(
CommonPlayerSpawnInfo(
nmsPlayer.level().dimensionTypeId(),
nmsPlayer.level().dimension(),
nmsPlayer.serverLevel().seed,
nmsPlayer.gameMode.gameModeForPlayer,
nmsPlayer.gameMode.gameModeForPlayer,
false,
false,
Optional.empty(),
0
),
0,
)
According to wiki.vg I should avoid setting it to the same dimension, but I've read many other resources that don't care about that. (Edit: Even when using two dimensions it gets stuck)
why are you using a packet?
for changing a skin
it is changing but it gets stuck there for about 10-15 seconds
how can I make a gradient for text? So that the user enters into the config (example: '<#AA0000>Admin</#cc0c0c>'), and I can create a gradient using kyori Component?
are you using paper? if so i can tell you how
do you know what minimessages are?
yes
so i should deserialize String?
just call </gradient> to stop the gradient
if i want to get message sender with JDA, should i use #getAuthor() or #getMember()
Typically you'd want to use #getMember() as it has more methods available to you.
ok thx
depends on what u want to do tbh
Member is a user in a specific server
and User is user in general
Hey, i got a question, how can i use arguments in Java?
cli arguments ?
when u have public static void main(String[] args), "args" are cli arguments passed after your jar name
hey, does anyone have an idea why I'm losing some items when serializing a player's items in a config?
actual inv:
what I'm getting
the same way I was told to by spigot LOL
it looks like the problem is the break;
ok yeah, for some reason I always believed break; only skipped the curent iteration but turns out that continue; does that
nevermind I solved my own problem
lol
i have my code and i want to turn it into .class files just btw maven isnt working and idk how to link my pom.xml file to my .java files
The pom is just a config for maven to run off
but i dont have maven it doesn't work for me idk why
In that case your pom is useless
o
Continue
BRO WTF IT JUST WORKED π
ive been trying for 2 days
and all the sudded boom it works i hate this bor
[WARNING] The POM for org.spigotmc:spigot-api:jar;1.20.1-R0.1-SNAPSHOT is missing, no dependency information available
what do i do about this
If it compiles, it compiles
You forgot to add the spigot repository
Wait i thought this was an exception, not a warning
Yep it's a warning so i'd assume it's fine
it said build failure
here ill send the entire thing
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< your.group.id:SpeedKillPlugin >--------------------
[INFO] Building SpeedKillPlugin 1.0.0
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.spigotmc:spigot-apiπ«1.20.1-R0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.320 s
[INFO] Finished at: 2024-03-30T09:16:55-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project SpeedKillPlugin: Could not resolve dependencies for project your.group.id:SpeedKillPluginπ«1.0.0: The following artifacts could not be resolved: org.spigotmc:spigot-apiπ«1.20.1-R0.1-SNAPSHOT (absent): Could not find artifact org.spigotmc:spigot-apiπ«1.20.1-R0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
ok
<!-- suppress MavenModelInspection -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>your.group.id</groupId>
<artifactId>SpeedKillPlugin</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
thats my pom
Please use ?paste for large code blocks in the future
And yes you do not have the repository
?codeblocks for not large ones too
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
1 sec
ok
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
do i paste that in my pom
You add the <repositories> block yes
ok
Does anyone know when Server#getVersion() gets initilized in the startup process?
Or through what means?
Well the implementation is https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/CraftServer.java#538
The values of serverVersion and console are initialized in the CraftServer constructor (https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/CraftServer.java#318)
Ty
my pom is working but now when i do "mvn clean install" in cmd prompt it gives me a jar file with my pom.xml manifest.mf and pom.properties but there's no trace of the actual plugin javascript
Javascript??
Also you build your plugin with package, not install
Java??????????
o
i think i meant class
What class
liek bytecode
yes
There is no javascript
mbmb
They are 2 completely different languages
im dumb
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingβgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! π
but it doesnt put the java file in the jar?
Holy
If you don't know Java you will struggle a lot while making plugins. It's like reading a book in Chinese except you don't know Chinese and you look up every word in the dictionary
it can put it in the jar
along with compiled .class
alr
if you choose it
Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions.
"Creating computer software is always a demanding and painstaking process -- an exercise in logic, clear expression, and almost fanatical attention to detail. It requires intelligence, dedication, and an enormous amount of hard work. But, a certain amount of unpredictable and often unrepeatable inspiration is what usually makes the difference between adequacy and excellence."
W Quote
I have another one:
"Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter." - Eric S. Raymond
where is bro getting these
The Intertubes
ik but i have errors because my pom file isnt there
Which does it for you
Or with proper build tool that does that under the hood
download intellij community from their website
set up a maven project and then import the java class
wdym package
package as in path
if you set up maven you'll have to click install from the maven's lifecycle
how would i go to that page?
is there any documentation regarding sending messages to console
ok
like is there a better and/or different way from sysout?
JavaPlugin#getLogger
btw do you mean maven archetype
or if you want to color your prints there's Bukkit.getConsoleSender()
#fine or #finest or the other ones dont output anything to my console for some reason
you can use the color code here
ok
it's archetype
gotcha
how does this output things with #sendMessage, does it just output the text plainly or does it get add the [PluginName] with it
I see, so I have to add the [PluginName] manually
thanks
do try to get the logger working
oh nice
btw Fr33styler in the lifcycle what is the thing i click is it package?
y
bc
why install if he wants just to compile
i assume he wants to have a jar?
yes
i dunno what you do with a class
wait wtf
you make a jar i think
well, clicking install makes the jar for you
i mean even if u want jar, you don't need to install
install will also put it into your local repo
oh
nothing wrong with that in most cases
sure there is nothing wrong, but no reason to
why i can't use it
you probably need to escape it
?
how can i remove a configuration node ? like
linking:
uuid: id```, i want to remove the **id** and the **uuid**
if i use set(uuid, null) it will just become empty (uuid: )
y, if u want to split by *
deleteconfigurationsection or remove
.
it doesn't appear in the methods tab
oh it's createSection("linking")
this will wipe everything under linking itself included
make sure to save the file
Setting it to null will remove it
pretty sure set null was buggy for someone but i haven't checked myself to confirm
new ShapedRecipe(new NamespacedKey(plugin, "emerald"), new ItemStack(Material.EMERALD))
.shape(" D ","DDD"," D ")
.setIngredient('D', new RecipeChoice.ExactChoice(
RegisterAllItems.registeredItems.get("emerald_fragment").getAsItem()
// ^^ this returns an item with custom tags (a tag for the id being "emerald_fragment" and others like a custom uuid to not stack with other items of the same kind)
))
any idea if there is any way for that to work?
if there was any way to get what item im placing in that slot it would be fixed but maybe there is a better way
Does .saveDefaultConfig(); make the config.yml file? A lot of resources say yes but my server says no. The embedded resource 'config.yml' cannot be found
make sure you have the file config.yml in your resources folder, should work then.
So this is wrong?
its not
saveDefaultConfig() will write the config.yml file from your plugin's jar file to the plugin's data folder. (If that folder doesn't exist it will be created) It will not overwrite an existing config file.
its not wrong
https://www.spigotmc.org/wiki/config-files/ source btw
everything inside resources folder will be packed inside of your final jar
so if you want to get config, it have to be inside of your resources folder
you have just to create a config.yml file inside your plugin resources folder
there resources and put it directly inside of it
I am only being informed about this now
I did not know about the existence of resources folder π€¦
Oh
Hahah, it exists
Its most likely always there when you create a new java project
oh wait
I know it exists, I didn't know that the function of it was that
Now you know π₯°
what do I put in there, if I make a config.yml file? the default values?
y
yea just write config.yml and leave it empty after starting your plugin it should be within the plugin folder of your plugin
so its just there just because?
man
because you put it within your resource folder, after calling the method the plugin will take the file from the resource folder and put it into your plugin folder
there should be a documentation for it as well if you click on the method saveDefaultConfig() just download the source
you're welcome lol
maybe a bit more understandable through this
Ohhh
it makes a lot of sense now
or just have a little method that copies over every file :3
Indeed
add more debug lines
do player.setItemOnCursor(null);
It should clear the cursor entirely of the player
if that does not work the Item is probably not similar to the other item
isn't event.getCurrentItem() == null same as == air?
no
can i disallow or somehow discourage the anonymous use of a certain class?
why whenever i add something to a custom yml file it sends
if i remove it it builds, but i need it
help pls :)
it shouldn't
spigot doesnt class that as a config section
it happens sometimes, and sometimes not
are we talking about this?
yea
i had to add it manullay because uhh #createSection(string) method didn't work
your trying to create it then by loading it delete it
creating an empty section does nothing
Hmmm, adding this update checking seems to be harder than I thought. lol
Need a way to get the server version string at early startup, but it's not generated until after the main server has already started. π¦
it worked!
not work
the code in block is executed
because event.setcurrentitem is being executed
um why this always returns false
public boolean isLinked(UUID uuid) {
return config.getConfigurationSection("linking").getKeys(false).contains(uuid);
}```
even if it contains the uuid
UUID and the keys are string
did you puist a String in and expect it to match a UUID?
use uuid.toString()
oh thx :)
it should be yellow too
it's impossible for the ide to infer this
it assumes you just put some random object
question regarding config.yml in resource folder
is it better to add the defaults by writing it directly onto the config.yml or is it better to do it code-wise
depends on how you're feeling
I wonder if there's a way to generate it ahead of time? π€
Or reconstruct it.
I'm interpreting this as "any will do"?
alright nice
how do i create annotations that underline the code yellow when something is wrogn?
like @Nullable
Any idea why this shouldn't work?
Event is registered; Same thing happens without the runnable
@EventHandler
public void onSpawnerSpawnEvent(SpawnerSpawnEvent event) {
CreatureSpawner spawner = event.getSpawner();
Bukkit.getScheduler().scheduleSyncDelayedTask(ClaimUpgrades.getInstance(), () -> {
spawner.setMinSpawnDelay(15);
spawner.setMaxSpawnDelay(25);
spawner.setDelay(20);
spawner.getBlock().getState().update(true);
}, 5L);
}
Damn it, I think I have to make a patch directly in MinecraftServer.
I don't know how to do that shiz. π«
step 1 is fork spigot or craftbukkit and modify the class in src/main/net/minecraft
You should use the spawner instance you have instead of the event location.
Code has been updated, still not working unfortunately
don't getstate.update
Then what?
this was bad because whenever i restart the server the section gets cleared
add what ever you need to and install cb then build spigot
and run patches
Ngl, haven't done this type of spigot development yet.
How do I build spigot itself?
With BuildTools? or one of the scripts included in cb?
uhhhh, do you know how buildtools works internally
basically doing buildtools manually
@river oracle can explain better than i can
spawner.update(true) instead of spawner.getBlock().getState().update(true)
Worked! Just noticed that's what ShadowMaster meant.
Thanks a lot π
can someone help me pls
What are you trying to store in there?
i want to store linked players' uuids with discord id's
but when i add linking: section it sends that error
What's your config structure supposed to look like?
i tried using #createSection() but it deletes the old section when it loads
Frick, that's a process.
And how are you currently creating those sections?
Just throw a Map<UUID, String> in there. Dont bother with sections.
for the linking: i create on load of the file, the uuid and id i create it when linking
but the how do i fix clearing the whole file on load of server
If you're creating it on load, then you're likely overwriting any existing data. You should check to see if the section already exists.
just create a new file over
i just added this
if(!config.contains("linking"))
config.createSection("linking");
```
whats your question
that fixed it!
How to create cb patches?
are you adding a new patch or modifying a current one
alr just run ./applyPathces /path/too/buildtools/work/decompile-latest
its a script in craftbukkit
Do I just need to make my changes directly in the net.minecraft classes or do I need to modify the patch files directly?
have you run applyPatches already and modified the .java file?
I've modified the .java file.
okay mb run ./makePatches /path/too/buildtools/work/decompile-latest
does make patches need the bt path?
Alright, patches made.
oh wait yes
yes it does I thought you meant it moved the patches to BT
smh
commit the patches
the two scripts do everything for you
(for testing either run package and test with cb or install and do the spigot stuff
Hey so i got a 1.20.4 server and i've found something. Unlike 1.16 my mobs get counted as dead if the chunks unload. Like if i go to the nether the mob.isDead() gets triggered. But once i return the mob is there. My problem is that i run some stuff that cancel on mob death. Don't have that issue in 1.16 but for some reason it pops up in 1.20. Is there anything that can be done?
I have been testing with cb via package.
No clue how to get a spigot jar though. (Not sure if it's really needed though)
realistically if you want the spigot jar just wait till your PR is up then you can use the Pr flags
doingw hat BT does yourself is annoying
Fair enough
guys how can i wait 1 second?
20 ticks
what method should i use?
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
what are you trying to do
Ok, just for funsies, how would I go about creating a new patch file?
i currently have this but it just stalls the game
one day the threads will unionize and get a 1 day a week thread sleep
alr go into the path/to/buildtools/work/decompile-latest/
find the java file you want to patch and move it into the right folder in CB
what is the scheduler
if the folder doesn't exist create it
Are we still in the BT decompile folder or in the cb project?
Let's say I want to mess with decopile-latest/net/minecraft/recipebook/AutoRecipe.java
At least for me, that file only exists in the bt work dir.
It doesn't exist in the cb project.
drag it to the correct path in the same place that you edited that other java class
i dont remember the exact package
I am doing this correctly right?
That was copied over from the decompiled work directory.
yeah
Interesting
all make patches does is compare t he two java files
and patch the dif
Ahhh
something in my plugin code dont work
Does it also handle the auto numbering or is that something that spigot does when it compiles?
Bukkit.getScheduler().runTaskAsynchronously(YourPlugin.getInstance(), () -> {
for (Player player : Bukkit.getOnlinePlayers()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "/" + args[0].replace(".", " ").replace("%player%", player.getName()));
}
});
i can use asynchronously to add item to a inventory player?
the patch files is a git thing. Git handles patching completely
not result in bug?
Why do you wanna do it async?
200 players. not is a operation cost?
kekw
Can I remove a patch?
yeah just delete it and run applyPatches
well usually you should be able to just spread out the operation across multiple ticks
Oh, lol.
or use async
you might have to delete the file in CB as well
async work to add item to player inv?
if you're worried about op cost for adding items go use C please
its not even worth it unless you have thousands of players
on the same server
plus Inventories don't even support Async operations afaik. You'd need some work distribution
Hmm, apply patches seems to have removed it on its own.
My concern is not adding items, but the dispatchcommand method
Time to start testing if things actually work now. lol
oh yeah that much heavier of an operation /j
You'd want some kind of concurrent list if you want async
Is getTitle a thing for inventories because i followed a tutorial and seemingly the code is 1 to 1 i have an error with getTitle they dont and the ide doesnt say anything about imports
Does anyone know how to enable both premium and cracked players, who may possess identical usernames, to join the server simultaneously.
For example: the user Intexor can join with cracked and premium at the same time.
if anyone knows a solution for this issue please let me know.
My discord is Intexor
no
don't use getTitle to determine inventories anyways
?gui
thanks
idk, I didn't see the method
Add a dot before the cracked guys name
Just a prefix?
if you are using a modern version its probably getView().getTitle(). but yea what y2k sayd ^
you don't need to do that async
Are you sure that is gonna work?
Or suffix
This is a properly stored Material map in YML correct?
that is delaying it by 1 tick
Yes, but you'll have to actually modify it, not just the display name, and you'll also need to handle premium players yourself, and it's also quite complicated
Do you have any idea of how to accomplish that?
I mean I can obviously set a prefix but idk the rest
No, I have never made a plugin of that kind
Alright thanks for trying to help
(its not async, its just delayed)
i have problem in my plugin clickevent not working also Vault not updating player balance
?nocode
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
how to show you code
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
?paste
if its alot
the openBuyMenu menthod is the problem
when clicked on green wool it doesnt do anything
async is not always faster
and especially not always possible w spigot api
this wwhole part has to go inside an inventory click event
but i would advize you to setup an actual proper menu framework
it would make all this alot easier
so do i need to create new class for this
?gui
i would read this
Hey so i got a 1.20.4 server and i've found something. Unlike 1.16 my mobs get counted as dead if the chunks unload. Like if i go to the nether the mob.isDead() gets triggered. But once i return the mob is there. My problem is that i run some stuff that cancel on mob death. Don't have that issue in 1.16 but for some reason it pops up in 1.20. Is there anything that can be done? Also it seems that EntityDeathEvent gets called aswell.
i do run mob.removeWhenFarAway(false)
How does one write a material to a YML file?
So a material map would just look like this?
or do i need quotes
Im trying to debug a thing that is giving me an anurism
xD
And for some reason it returned null unless i add the define.
And it is under "replace_interact"
I dont have that option :c
Plugins I didnt make :D
Im just using the same config to keep all item interactions within the same item file
is Map can starts with -
huh?
is holder the same as handler because handler doesnt exist as in InventoryHolder
i think i had a stroke
no InventoryHolder should never be implemented
then how do i use inventory handler
read the tutorial
Can you determine min and max location from list of locations to create a region for example?
yes? what's your actual question
Sorry, I'm trying to do that basically.
So right now I have a system that can paste a schematic in front of you and I want to show hollow cubes as a indicator where the schematic will be placed.
bet you've heard of a loop
I know but I want to create a hollow cubes instead.
find two opposite corners and create a cube from them?
Go over every point, get the overall min and max xyz
Now you have your two points
i'm trying to register a listener but its not working, not sure why
lack of image perms womp womp
A cube has 8 vertices -
sX sY sZ
bX sY sZ
sX bY sZ
sX sY bZ
bX sY bZ
bX bY sZ
sX bY bZ
bX bY bZ
s = small (min)
b = big (max)
Just interpolate between then and you have your hollow cube
Show code
?paste
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
only need 2 locations
Exactly
Thank you for the explanation.
if the schematic holds it as a list of x y z and block info take the biggest and smallest x y z and get the difference, then you have a vector of the cube (i think)
If you want a wireframe you just go over each point and render a line to every other point
If you want to skip the full wireframe then you only interpolate to the nearest neighbour
!verify
Usage: !verify <forums username>
Yes
!verify ChoaticPoly
Could not find your SpigotMC.org account!
???
did you spell it right
I can create the hollow cubes but I'm struggling to get the two locations, which is the min and max location.
https://www.spigotmc.org/members/chaoticpoly.1683914/
thats me so pretty sure i did?
"ChoaticPoly"
chaotic and choatic are two different things
womp wopm
Given a list of numbers how can you get the smallest of them all?
rate limited π
Using Math.min to get the first corner and Math.max to get the second corner?
You're skipping to conclusions too fast
fire
see if any x, y or z is smaller then or equals your stored one and at some point youll get the min loc
not sure why its red
Okay, to get the smallest of them all I'll compare them one by one
Great
Same process to get the biggest one right
Now, you need 6 values
minX, minY, minZ
maxX, maxY, maxZ
hover over it and read what it says
i'm new to java so no idea what it means
you arent implementing listener
Your listener class does not implement listener
noob
Alright, that explains everything then. I think I understand, thank you.
π£οΈ
big attitude for someone who's said womp womp a solid 9 times during the past 5 minutes
β€οΈβπ₯
also what do I use in place of getItemInHand, i found getItemInMainHand but it won't automatically import it for me and idk which . i stop at
getItemInMainHand is part of the PlayerInventory not the player
oh so i do like event.getPlayerInventory instead then?
getItemInHand exists and routes to the main hand exclusively for plugins made 8 years ago
You get it from the player, you can't expect an event to contain every method on the player class
π₯ I have a mild idea on what that means π£οΈ
?learnjava time
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingβgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! π
ohhh so i put player.getInventory.getIteminmainhand fire
why would I learn java βοΈ
i'll figure it our π₯
oop was an oops π£οΈ
On the long run πββοΈ
is there a way to reload plugins without restarting the server, i know /reload exists but i heard I shouldn't run it
idk why though π€
you shouldnt run if if you didnt implement it properly
What if we made a JavaPlugin#reload api method that by default just throws an error
And a /reload MyPlugin command
π€
π
So plugins that want to support reloading just override and do their own custom logic
i'm sure this is hella funny but idk what this means π₯
the whole reload is bad is a myth from shitty plugins
the actual concept of reload is fine
reload bad. Blowing up server good.
Sometimes we can't bother going over every existing player and loading their data knowing damn well that only should happen when a player joins
okay so i'm coming from skript so is there like a temporary variable equivalent in java or do i just make one and delete it later
There's no "delete a variable"
whar
There are just different visibility scopes
You have local variables, which are defined and only accessible within a code block
java isnt javascript
public void doWhatever() {
int value = 123;
// This only exists within this code block
}
And then there are fields
Which belong to the object
how do you make the shiny like that
public class MyObject {
private final int money = -1;
}
This is a field
Then there's static
Which "belongs to the type instead of the object"
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
ah
Poor explanation but basically these are accessible everywhere
public static final int money = 123;
And have very specific use-case scenarios and are often abused
They're also kept in memory forever because you never know when someone might reference to it
oh but local variables aren't
Compared to objects which if held no references to, are garbage collected
mee
No, local variables are only accessible to the code block that defines them
Whether it's a constructor, method or initializing block
alright, so use static when i need to reference it across everywhere, and local when i'm only using it for one thing
eh
Not really no
wopm womp
Anything that's static should be immutable
As in never changing and never being able to change
It's final, constant
And constants ARE_NAMED_LIKE_THIS
public class MyWhatever {
private static final int MONEY = 123;
}
Any field that's static should in best practice be final
Sweet!
Sweet!
nice
fire
Now, given it's static it's always present
But also it's only initialized once - When the class is loaded
And a class is loaded when it is referenced for the first time
Or if someone writes a funky classloader but that's advanced
Fields belong to the object
So if you have two objects
Each object's fields can point to different things
Think of this
public class Person {
private final String name;
private int money;
public Person(String name, int money) { // Constructor
this.name = name;
this.money = money;
}
}
You have a Person class and that class has 2 fields
One's named name of the type String
And the other's named money of the type int
You can create multiple objects:
Person illusion = new Person("Illusion", -1);
Person chaotic = new Person("ChaoticPoly", Integer.MAX_VALUE);
And now you have two objects but with different values assigned to each field
so its object specific variables, as opposed to static which is immutable and global?
Yeah
A field is just a "variable" that's not local
Static values are still fields
They're static fields
π€―
wait so what happens to local varaibles when the code block ends, it just gets garbage collected?
"what happens when a person variable dies"
An object gets garbage-collected when it no longer has any reference pointing to it
When it's held in a static field it's always referenced
So if you create an object inside a method and pass it around or store it in a list, it still holds a reference to it
Until it gets removed from the list or the methods you passed it to finish executing and don't store it anywhere else
Then, and just then, it's queued for garbage collection
There are phases to garbage collection and it's a complex topic but just assume it's "gone for good"
alright
Also a "memory leak" happens when an object's reference is kept beyond the object's expected lifetime
expected?
Think of storing an object in a list and not removing it when the object should be declared "dead" (as in storing a player and not removing it after they disconnect)
so then it cloggs up space
Forever
my hardrive π
ram
π
some pins put a hole in it
weak ass plastic what
why is it 0
is this how kids talk now
[insert some words]π£οΈ or [insert some more words] π₯
no just special kids

