#help-development
1 messages Β· Page 727 of 1
yes
Hello, how can I get Registry.BIOME_REGISTRY in nms 1.19.4 ?
oh it's Registries.BIOME
private final ItemStack stack;
private final int amount;
public ItemStack getStack() {
ItemStack clone = stack.clone();
clone.setAmount(amount);
return clone;
}
ItemStack item = getStack();
...
addToInventory(player, item);
private void addToInventory(Player player, ItemStack item) {
PlayerInventory inventory = player.getInventory();
switch (type) {
case HELMET -> inventory.setHelmet(item);
case CHESTPLATE -> inventory.setChestplate(item);
case LEGGINGS -> inventory.setLeggings(item);
case BOOTS -> inventory.setBoots(item);
default -> inventory.addItem(item);
}
}
the amount is 10
but sometimes for some reason
it gives not 10
6
2
8
You need to use ansi codes for spigot
can i change flying speed on creative? bcs if I use
player.setFlySpeed it only speeds my fly using player allow flight but not the default fly speed in creative
Yo, can somone here help me out quickly?
Im trying to code some stuff that restores a section of the world to its origional state.
Lets say I got a method like this, where I take in a block, how would I get the block's material type from the chunk generator, is this possible?
public void restoreBlockToOrigionalState(Block block){
ChunkGenerator chunkGenerator = block.getWorld().getGenerator();
// Do something here?
Material material = Material.AIR;
block.setType(material);
}
I just need to get the material type from the chunk generator, using the block's coords. so I can restore a section of the world to its default state. Is this possible?
(I made a thread here: https://www.spigotmc.org/threads/restoring-blocks-to-default-state.620541/ if anyone has any suggestions, thanks)
This seems like an tremendously expensive way to restore blocks to default.
You basically have to call these generation methods one, after another, in this order.
generateNoise(WorldInfo, Random, int, int, ChunkData)
generateSurface(WorldInfo, Random, int, int, ChunkData)
generateBedrock(WorldInfo, Random, int, int, ChunkData)
generateCaves(WorldInfo, Random, int, int, ChunkData)
The deprecated way was:
generateChunkData(World world, Random random, int x, int z, ChunkGenerator.BiomeGrid biome)
->
ChunkGenerator.ChunkData#getBlockData(int x, int y, int z)
Which returns the BlockData on this position
ChunkGenerator.ChunkData#getBlockData(int x, int y, int z) that would be what I want.
Do you know why this was deprecated?
It creates a bunch of connections and gives you one if you need it.
Just make sure to never keep the connection. Get it, use it, and forget about it.
Dont store them anywhere.
yeah okay thanks, do you think a small pool amount with a short idle timout is the smart way to go about it?
okay cool thanks, ill remove the changes
Hello, I've got this class who returns a Bukkit Player, but when I build my project I get this error:
cannot access net.minecraft.server.level.EntityPlayer```
Code who does this error```java
public static @Nullable Player createHerobrine(JavaPlugin plugin, Location loc) {
Player herobrine = switch (LibVersion.getVersion(VersionMethod.SERVER).toString()) {
case "1.20.2" -> Herobrine_1_20_2 /* ERROR HERE */.createHerobrine(plugin, loc);
case "1.20.1", "1.20.0" -> Herobrine_1_20_1.createHerobrine(plugin, loc);
case "1.19.4", "1.19.3" -> Herobrine_1_19_4.createHerobrine(plugin, loc);
case "1.18.2" -> Herobrine_1_18_2.createHerobrine(plugin, loc);
case "1.17.1" -> Herobrine_1_17_1.createHerobrine(plugin, loc);
default -> null;
};
return herobrine;
}```Here is the structure of Herobrine\_x\_xx\_x:```java
public class Herobrine_x_xx_x extends ServerPlayer {```The error appends on every `Herobrine_x_xx_x#createHerobrine`
If i had player profiles saving to my MariaDB, would my best option be to just store the profile object in a list and just save it on leave/every 30 or so minutes? I havent used Hikari before so I really dont know what the best way of saving to sql would be. The profiles get updated fairly regularly so i dont think saving straight away would be the best option
On quit and every few minutes. 15-30
and should i be doing anything after each query? Im already closing the result sets and statements but do I need to do anything to the connection?
Full stack trace pls
Nope. Just close and forget
btw, the connection you get from hikaricp is not an actual connection.
Its a ProxyConnection which implements the Connection interface. You cant really do much wrong
with it as hikari handles a lot in the background and doesnt let
you touch its actual connections
Yeah just close it
First of all: Disable parallel execution
Which returns it to the pool
Then see if this solves the issue
I'm trying without parallel execution
same error @lost matrix
ok lets see
Update your specialsources plugin version next. Its kinda old
specialsources ?
net.md-5:specialsource-maven-plugin:1.2.2 the remapper from spigot
How do I cancel the player from wearing a diamond set with Jeff Media's ArmorEquipEvent API?
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onArmorEquip(ArmorEquipEvent e) {
if (e.getNewArmorPiece() != null && e.getNewArmorPiece().equals(Material.DIAMOND_HELMET) || e.getNewArmorPiece().equals(Material.DIAMOND_CHESTPLATE) || e.getNewArmorPiece().equals(Material.DIAMOND_LEGGINGS) || e.getNewArmorPiece().equals(Material.DIAMOND_BOOTS)) {
e.setCancelled(true);
}```
pom.xml
the main ?
what type is getNewArmorPiece
I would guess an ItemStack, so you can't compare it to a material
every place you have special source
Whichever uses the plugin currently π
okay
how can I know if I have special source ?
An ItemStack is never equal to a Material
its probably in ur nms projects
well, do you mean java if(e.getNewArmorPiece().isSimilar(new ItemStack(Material.DIAMOND_HELMET)))like this
no
okay I'll try
Your pom.xml contains the plugin under <build><plugins>
okay
call getType and then toString().contains("DIAMOND_")
e.getNewArmorPiece().getType().toString().contains("DIAMOND_")

I mean thats the naive approch...
oh
it will work, could be better
I've found
Ahh i see. Also had one more question, currently one of the other things im saving to the database is causing issues, due to the fact that when I set it up it I made it save straight away when updated, rather than on leave/on a schedule. Currently when you spam changes, the hikiari database overloads, is that just because of the way im saving it (do i need to redo it) or can it be fixed with the config settings
The better approch would be to cache a set at startup with the diamond armor pieces you want
also wouldnt saving a ton of profiles at the same time also cause connection issues?
I wasn't using the build for nms remapped mojang in the module nmsgate
There are very few things that need to be immediately saved to a DB
thanks
What type of database is it
MariaDB
Should be fine handling a ton of operations per second
That's whay they are designed for
The type safe way would be
private static final Set<Material> DIAMOND_ARMOR_MATERIALS = Set.of(
Material.DIAMOND_HELMET,
Material.DIAMOND_CHESTPLATE,
Material.DIAMOND_LEGGINGS,
Material.DIAMOND_BOOTS
);
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onArmorEquip(ArmorEquipEvent event) {
Material targetMaterial = event.getNewArmorPiece().getType();
if(DIAMOND_ARMOR_MATERIALS.contains(targetMaterial)) {
event.setCancelled(true);
}
}
@lost matrix here is my nmsgate's pom.xml:
https://paste.md-5.net/ererolaxux.xml
You are using the specialsource plugin twice now...
oh
hum
Has anyone experienced missing chunks when loading a world?
Anyways, cant help more than that. Im a bit ill and should lay down...
okay
It will works this time
π
and it's not working!
perfect...
if anyone know...
https://paste.md-5.net/xorehacoka.md
don't die
Does the class loader matter? I've tried finding an answer online but I can't find one. I'm wondering if a specific class's classloader will be different because I can get a class loader from any class
Yes, one class' classloader can differ from another
In fact, each plugin has its own class loader
What do you even do with a class loader?
any idea why a server .jar files launches with all this commands but now with double click?
JDK & JRE | 17 & 8
I'll give you one guess π
Please, god, no
Fixed it all up now, thank you for all the help!
But wouldn't it also infer that every class has a different loader or does every application have one, if not specified differently?
What neat things can you do with the loader?
No because a class loader can be reused
You can load classes
can i take a guess
Yeah this isn't a super complex topic. A class loader lets you load .class files lol
So you'd create a class loader, for example, if you want too use code from a different jar file?
ah, ok, then it really wasn't hard too understand XD
Is each plugin loader just on top of the base classloader
Or is there another one in between
yes
you're using Java 8 in the IDE's project structure of the nmsgate module which makes it not access java 17 jars
Couldn't you use reflection then too change the behaviour of how plugins are loaded?
You can use reflection for almost anything if you're brave enough
I'm stupid, not brave.
I'll keep my hands away from doing that... for now
Just load up ASM and start hacking apart the bytecode of the server
Why not!
paper isn't a plugin
I'm using java 17
did you check the module structure?
IDEA is sometimes very unpredictable
What has this chat become?
Who knows
yes
well can you show your pom
I can't decide on whether or not I want to buy a new office chair
this one is starting to get really scuffed
public static @Nullable Player createHerobrine(JavaPlugin plugin, Location loc) {
Player herobrine = switch (LibVersion.getVersion(VersionMethod.SERVER).toString()) {
case "1.20.2" -> Herobrine_1_20_2 /* ERROR HERE */.createHerobrine(plugin, loc);
case "1.20.1", "1.20.0" -> Herobrine_1_20_1.createHerobrine(plugin, loc);
case "1.19.4", "1.19.3" -> Herobrine_1_19_4.createHerobrine(plugin, loc);
case "1.18.2" -> Herobrine_1_18_2.createHerobrine(plugin, loc);
case "1.17.1" -> Herobrine_1_17_1.createHerobrine(plugin, loc);
default -> null;
};
return herobrine;
}```
it's like $400 and I'm moving out in a couple of years and won't be taking it with me
zulu 17
What MC version are you running on?
There is an import of a 1.20.2 nms, right?
Because it could be that the compiler calls the class and notices that the import isn't allowed
Nvm, that error does not have a reference to a nms version
yes
Mojang mappings for 1.20 is not EntityPlayer it's ServerPlayer
I know
plexus ?
you have a proper multimodule setup?
dont you think it could be an issue that happened when building 1.20.2
yes
probably the "--remapped" flag was fprgotten
no, it happens with other too
if his jar is erroring looking for EntityPlayer when using 1.20 his build system is set wrong
no I did it perfectly
I try re packaging
paste your pom for your 1.20 module
you can check out ModernDisguise poms and see what could have gone wrong for you
i can't see it atm tbh
?
I think it's better if you see on the github page
https://github.com/Paulem79/ALOT
@quaint mantle @topaz cape @eternal oxide
@zealous osprey
bro got a typo in his readme
What could be the reason why loading a world using
creator.createWorld();```
will result in missing chunks/chunks not loading?
Adding the world before starting the server works just fine
How can I cancel the player from using totem
what
thanks
bruh
Nah I mean a classloader from a class in your project
In the same module
shut
I wonder if I still have my notes
i didn't mean it in a rude way
@cinder abyss reading your class
there is no reason for you to use nms in that module
you can just use the normal spigot api since nms is unused
I wasn't kidding
it's got more views than Martin Garrix - Animals
p sure
it also works like shit
Β―_(γ)_/Β―
but you know what it is
bro
That's... a really weird point
i cant find whats wrong with expansion
Expantion
"Too many people have seen this ad and therefor the ad is bad"
not exactrly
more like
"this ad shows up 19 times in an hour in Portugal but the product only works in the US"
"Stop advertising this shit to me I already know it exists"
omg i used a T
it only works with english
BRUH
you want good autocorrection?
toss it in a google doc
and let it underline half your shit
where ?
nmsgate
I get an error when not using spigot with nms
??
the same error when building but directly in the ide
π

how long do you think I've been around for
I keep getting leak detections with hikari, any ideas as to why? (Specifically when getConnection is called) https://hastebin.com/share/eyinilezid.typescript
Do you close the connection
Main.getInstance().getConfig().getString
also that ternary on your constructor is useless
yeah thats a structure issue
bro has no clue what oop is
so, what do I need to do ?
(String) MainHypixelSkyblockPluginSkyBlockPluginPlugin.getThisPlugin().getConfg().get
After each query? No, i was told that hikari already managed the connections
that's your problem
it does manage the connection, you still need to close them
Well yeah that is the best way
try with resources
I swear every day there's at least one kid trying to replicate hypixel skyblock
1- stop using too much static code
2- Make the Herbrine class different from its static creator
Can I be the one for today
let's pretend like it doesn't take a lot of work
plisssssssssssssssssssss
Pfft it's easy
that's not the hard part
from its static creator... ?
the hard part is making sure the codebase isn't shit
and works for more than 1 instance
give each island 4 worlds
Pfft
and each world has 1 chunk
Just put it all on one server
Herobrine_version#create
I mean this people are gonna get like 10 players
So they can just shove it all on one server tbh
true but they'll also make sure to keep every single chunk loaded in memory for performance
and every single entity and block ticking
make sure to delete all player data if theres an error to avoid corruption
shove it all in 1 class too
same for methods
means you're straining the classloader more
static everything so that ram speed doesn't matter 
everything needs to be static and everything that can be in 1 method
and when someone mentions code quality just say you're doing it for fun
and that "it's temporary and I'll clean up later"
why did you ping me
he cant access the class because he cant access all ServerPlayer classes of all versions
ree outdated
why work when you can procrastinate in #help-development
exactly
Meanwhile old versions had extremely frequent updates
mm got some work for today
So you only want change when it conforms to your definition of good, got it
who sean
roblox man
need to do a trial thing for his business partners but I have a full-time job lined up at 25/h
roblox has a system to make money but if you make money in mc its almost always illegal
Hi everyone
some annoying BBB member
you*
habibi you're the only one that's not vibing here
im vibin just not when jasmine is around
the other jasmine is nicer tbh
yes lmao
so far I picture a 16yo trtying to buy plugins for $4 an hour
lmfao
hey dudes, im searching for an solution how i can modify entities.
they should not get an ai, but be pushable cause of water, etc.
any ideas?
currently i get this only to work with disabled ai - but not pushable, or enabled ai, but pushable
setAware(false)
i will look after it
I'm sure you will
<dependency>
<groupId>org.util</groupId>
<artifactId>UUIDManager</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/UUIDManager - Kopie.jar</systemPath>
</dependency>
Guys, I made a little local library. Why does the consol throw me a NoClassDefFoundError?
I'm not sure if it's fine to have spaces in the systemPath. It's most likely not the problem but pls try renaming the file just to rule this possibility out
Hi, im trying to create a plugin api/base for all my player related data. This plugin main purpose is to serve as a service plugin that gets and sets player data.
Im having trouble importing the jar file into my new Plugin, through intelliJ. Can someone please provide some documentation or help?
Are you using maven or gradle
maven
What do you mean? How?
With the mvn install command
It'll appear in your local repo after you run the command
And you won't have to carry that jar file everywhere
Run the mvn install command in your api project then in your plugin project add it as a dependency using the information specified in the api projects pom
This is what I thought, but what is the syntax?
just mvn install
No arguments, just this?
yeah
Okay i'll try :)
I ran it in the terminal, it throws me an error.
No such command: mvn
do you use intellij
Yes
use the install lifecycle
Okay
I did put it into my plugins folder. It is throwing the same error.
change the dependency info, reload maven and clean package
The pom file seems to be fine now, however i am not able to access my Main Class from the API
Dependency info? What do you mean by that?
remove the scope and path
To add the Jar file i did -> Project structure -> Dependencies and added the jar file scoped to compile
you said you use maven, you should only use maven to add it
That's not what I told you to do ._.
this
And leave it like that or what?
Got it. But how does the pom.xml know where my jarfile is then?
delete the 2 lines
its on your maven local
maven scans there by default
The mvn install command add it to the local maven repo
Maven will first look there and then try and find it online
cannot find symbol
cannot find symbol````
Gives me the following error when trying to import it
```java
package org.meyer.afterlifetestdeleteme;
import org.bukkit.plugin.java.JavaPlugin;
public final class AfterlifeTestDeleteMe extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
AfterlifePlayerAPI playerAPI = AfterlifePlayerBase.getPlayerAPI();
getLogger().severe(playerAPI.getNumber() + "FΓΈrste gang!");
getLogger().severe(playerAPI.getNumber() + "Anden gang!");
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
So did you do what I told you to
org.util:UUIDManagerπ«1.0 was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced
This is what I got I dont understand this
I suppose not
is that the correct package
Sounds like you forgot to run the mvn install command in the UUIDManager project
or you put the wrong dependency info
I didn't, I'll do it and then see the results
either the mvn install command or install lifecycle in uuid manager
Im new to Java and minecraft development, so I might not understand every thing :P
Here is my pom.xml from my new plugin:
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.meyer</groupId>
<artifactId>AfterlifePlayerBase</artifactId>
<version>1.0</version>
</dependency>
</dependencies>```
Here is my pom information i used from my api:
``` <groupId>org.meyer</groupId>
<artifactId>AfterlifePlayerBase</artifactId>
<version>1.0</version>```
That's correct
After you run mvn install in the api project don't forget to reload maven
I just dont get how my Main plugin knows about my api just by referencing the package, without any repo to get it from
DONT CARE IT WORKS NOW!!!
π
The repo is a local one
It's on your pc
Maven creates a local repo on my pc?
Yes
Okay
Made it work by referncing the full path c:/xxx/xxx/.jar
is that best practice if the plugin were to be on a remote minecraft server?
Can we perhaps join a voice chat @chrome beacon ?
Hi, if i execute my command in the plugin it doesnt execute the part of the plugin.
Here is my code: https://pastebin.com/VasVxkST
make sure your plugin.yml defines the command
If i ban my alt account (geysermc) bedrock account it doesnt ban him and instead only executes the debugging message (executed oncommand event)
its executing the command just not part of the code
idk why
Which part of the code is not being executed?
the part banning the player, so i have 2 problems.
I can ban players for template resons like this: /ban PLAYER 1
or for custom reasons and durations (needs extra perms)
/ban PLAYER DURATION REASON
But if i ban the player using a template the teamplate code doesnt eget executed and the player doesnt get banned and if i ban them for a custom reason like this: /ban PLAYER 2h test
it says its not a valid duration
I assume you mean remote maven repo
If so it doesn't really matter. It's up to you
If you want others to use your lib then it might be good to have
If you put it in a buildable state on to github you can use jitpack as a repo
Would you mind joining the voice chat, i can't figure this out?
<dependency>
<groupId>org.meyer</groupId>
<artifactId>AfterlifePlayerBase</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}\AfterlifePlayerBase-1.0.jar</systemPath>
</dependency>
this isnt reliable, cause the path of the minecraft server could possibly change
Also by trying to use this dynamic path it doesnt work
Yeah systemPath dependencies are deprecated and shouldn't be used
Okay
any ideas why it wouldnt execute the part, i got over it again and it should switch using args[1] which would be the arg after the player... dont understand why this wouldnt go
?paste
yea sorry
Yes the playerAPI seems to be null
But I belive it's because the dependency isnt setup correctly
is the player api a plugin
Yes
add it to ur plugin.yml depend then
How
get the plugin name from player api plugin.yml then add ```yml
depend:
- name
Thanks
?paste
It gives me the same error
ping if answer, not 100 active so ping would be better
?paste both plugin.ymls
depend:
- AfterlifePlayerBase
make sure you clean build after changes to plugin.yml
Okay got a new error now i suppose. The server just shutsdown
check the latest.log
?paste
That can happen if you kill the server process
or if you run the same server twice (on different ports)
Show us where you're setting playerAPI
And then getting it:
AfterlifePlayerAPI playerAPI = AfterlifePlayerBase.getPlayerAPI();
and where is that code
wdym code. Want to see my interface or where im using it?
In my main plugin im trying to use
getLogger().severe(playerAPI.getNumber() + "FΓΈrste gang!");
getLogger().severe(playerAPI.getNumber() + "Anden gang!");```
im gonna recon the plugin hasnt ran onEnable by the time you call getPlayerApi
Yeah
Oh so it'd just call it outside my onenable
move the setting to onLoad
can i just move it like this?
public static AfterlifePlayerAPI getPlayerAPI() {
if(playerAPI == null) {
playerAPI = new PlayerSetting();
}
return playerAPI;
}```
That would work too
yeah
And where is that code
In the "main plugin"/afterlifetestdeleteme
Now that i made changes to my api should i do the nvm install again?
ye
Usually only needed when adding/removing methods
or if you plan on shading
Cheers guys it works
Now when moving both my plugins to another computer/server, would it still work?
the jars yes, the project no
Beautiful thansk for helping me outπ Really appriciate it!
Hi guys. I have another problem. I tried to compile spigot -api from buildtools and also added a class file. Whenever I add something to it, it throws me this error: There are test failures
How?
normally dont like spamming in, but otherwises u wont get help i guess
Failed tests: testAll(org.bukkit.AnnotationTest): There 1 are missing annotation(s)
Tests run: 1296, Failures: 1, Errors: 0, Skipped: 3
I looked more deeper and found this
I don't want to spam it. And I won't. I'll just reply once.
thats a nice reply but it wont help me if no one sees it for gods sake
lmao. chill dude
I think it's mvn -DskipTests <goal>
Goal might be before -DskipTests, idk
I found it in the lifecycle. But it doesn't contain my class.
hmm?
I created a new class inside.
iirc tiktok doesnt have an api so you would need to find a 3rd party one and then hope it has docs
But I can only see the standard API classes
Wait I added the missing annotation
One sec ill test it
No still the same
How is this possible? I add changes to the code but then everything remains the same as it was before
Well
Is your local repo getting updated properly
Is your project depending on the right thing
Did you try refreshinf project dependencies
What?
What is this and how?
Idk, what IDE do you use
IntelliJ
Uhh
Why is e.getClickedBlock just not functioning in any possible way I use it? I even tried doing if e.getClickedBlock != null, but yea idk
Right click the pom and try maven -> reload
I did it, it won't work i think
Yes it didnt
Okay then check the dependency in the pom
Make sure it matches what is in maven local
Every method gets recognised except for the ones I added to it
if you check which action it was, you can ignore the warning
This is what it looks like when I have it opened in the spigot-api project:
x is the class I added
Did you remove the spigot nexus repo
Yes
What warning? The thing doesn't work man
the yellow over getType
We can't tell you why it doesn't work with just that line
We need your entire listener
?paste
It doesn't contain the file
Okay so it isn't getting put in your maven local properly
Ah wait you are depending on spigot-api
On compilation, everything gets ignored that I add
But if you build a change in bukkit it's going to be under bukkit
What do you mean? What should I change?
any reason ur adding this to spigot
You should depend on bukkit if that's what you are editing
iirc the group is org.bukkit and the artifact is bukkit
version should be the same
Hmm
Didnt work, Im editing spigot-api
I see
Im doing something wrong at the compilation
Classes and methods I newly add to it are getting marked. Does this mean something except for that I newly added them?
π¦
well. i know tiktok doesn't have an api. i tried finding one but not a single one is usable... either very expensive or not documented.
that's why I asked here :)
Can anyone help?
and i mean. not documented at all...
[17:19:34 WARN]: java.nio.file.NoSuchFileException: Dungeons/Fairy_c.schematic``
Boom thats the error well I already have the folder generated "DungeonSchem/Dungeons/Schematicdlncinsdicosdnoic
but in the error where is it trying to get the file from the container directory or?

read
just what I said was correct or incorrect
It does though
https://developers.tiktok.com/doc/tiktok-api-v2-video-query/
I need
These are not the same
Granted the official API requires a bunch of setup
But it seems to just be a rest api beyond that
all errors of everyone fixed now?
cause my problems isnt that deep im just too dump in java
what even is ur issue
exactly my argument, you cant even see it cause its that far up top
i scrolled up
.
yeah whats the issue, i dont the issue ur having
Maybe u just saved my life lmao. Thanks
part of my code doesnt get executed
?paste all relevent parts then
look at the oastebin, i explained it in messages
Just repaste them. It's easier than hunting down messages in discord.
this code is scremaing learnjava a bit
and i am screaming, doing projects helps u learn
tutorial hell is not the way to go
Sure but this isn't a java project
the stuff that is saying learn java is something you should really know before starting projects
This is a spigotapi project
?basics
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Why is just right clicking a chest is null? How has that happened then
i dont need a teacher, i need a solution
You should still learn the basics first
Lmao, who added that command?
Before you decide to tackle a third party api
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
Show code
So this will make sure to detect what's the main hand is using? And it won't null it?
It won't detect what the hand is using, but what hand was used.
Seems like you are clicking a chest with nothing in your hand
check its the main hand and check action type
How exactly do you even see what hand was used? What's the differecne
You have two hands in 1.9+
One is the left hand one is the right hand?
ooookayyy
technically anything
you can also swap ur main hand
Most things can be used in the offhand, yeah
PlayerSwapHandItemEvent be like
no i mean make ur left hand main hand
HAND and OFF_HAND
Doesn't matter which you set as main
HAND is always your main hand, even if you change it
Here's the thing right, I am trying to detect on right click of a chest, and it doesn't make sense why its nulling. This is my code AFTER the whole hand thing. The server is on 1.20 and the player is on 1.8.9
@EventHandler
public void CrateClick(PlayerInteractEvent e) {
System.out.println("Print something 1");
Player player = e.getPlayer();
if (e.getHand() != EquipmentSlot.HAND) { return; }
if (e.getItem().getType() != Material.CHEST) { return; }
System.out.println(e.getAction());
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
System.out.println("Print something 2");
...
getItem will be the item in players hand
if (e.getItem().getType() != Material.CHEST) { return; }
getItem may be null, which will make this line error
#getItem() is the item the player interacted with
#getClickedBlock() is the block they interacted with
apologies, just because getClickedBlock was just not working whatsoever
I'll try it again
I want to make a very simple plugin but I don't know how to do it or where to start : I just want to make a plugin that can close the vanilla (original) fishing loot table
close it?
Original loot table? AFAIK, spigot doesn't interfere with them.
It does not
Yes, because the original fish comes with a special loot table that I added with itemsadder
Yes
hello
you can make 2 server on the same machine with paper?
Sorry, my English is bad. I'm translating.
Why does the error java.lang.ClassNotFoundException appear when the class is from it's own plugin?
is it because of too many data on the plugin or smth like that? the plugin contains a minigame and lots of variables with information about the players online. Can this be the issue? like the plugin has some limit before it starts to break?
Firstly, this is Spigot.
Secondly, yes, you can with any minecraft server jar. You just need to change the port in the server.properties so it will actually start up.
I don't understand how exactly
I saw Evenmorefish and customfish plugin but
ok my bad i just fail this thx
Is this the same thing as getItemMeta? I want to get meta and then persistent data container, or do I just get world and use the first option? Because I can't seem to get the specific data from the first one
Something like this
ClassNotFoundException means that the Java class that is being called upon isn't found within your jar file.
Did you shade everything correctly?
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
yes, it worked all the 200 restarts before
and then my friend was testing the minigame and the error came up when i tried opening the menu.
and then i restarted server and it was working again after.
Did you reload or something
super weird, if this error will appear out of nowhere, it will be very annoying cause he finished the minigame and it didnt save any data cause another class(saving data) wasn't found either
I always restart
let me try to find it again, j've restarted a fe wtimes
it's a paste link π
very dangerous, be careful
btw the server is in paper but the plugin is in spigot, idk where to ask this, it seems more like a java problem than anything else
π€
i also have the spigot remapped version on it, but it's on the end where it says "Caused by class not found" the problem
That's usually caused by the files not being included in your jar file. OR you are relying on an API that doesn't have those files either.
it's my own plugin files tho
and it was working at the start
and then mid-way through, it gave the error.
not only that one, but another class also was not found(the menu class i said earlier) when i tried to open a menu.
this also has happened to me few months ago, restarting fixed it again but it's kinda annoying if midway, the plugin has classes "that disappear", speacially when it's the classes for saving Data on the database....
my feeling is that the plugin has so many objects/variables that it "turned off" every other class that hasn't used up to that point(Or something like that), is that even possible?
No
then idk why that happened
Classes don't just dissapear. Not unless they were removed and unloaded from the JVM
coll stop modifing classes when you compile them
Make it a game. See how long your program can last.
another friend of mine will test the minigame, let's see if this will happen again
no
I will modify classes when I please
lmao
just restart again, you proably restarted too soion
restarted too soon?
sometimes when building to the plugins folder it doesnt update quick so you get a no class def ex when it does exist just didnt load
hm
i always join the server after a restart, so i never end up restarting too early. and when updating i wait for the windows notification saying that the file was uploaded to the server before i restart it.
will see now if it happens again, hella weird
π€
I have an InventoryClickEvent and the player is defined as so:
Player player = (Player) event.getWhoClicked();
I am having an issue where the code doesn't get past this point:
int amount = 0;
for (ItemStack i : player.getInventory()) {
if (!i.getType().equals(Material.WHEAT_SEEDS)) continue;
amount += i.getAmount();
}
player.sendMessage("yes");
The for loop works properly but then the .sendMessage after it doesn't fire.
well there must be an error then
Nope, which is why I'm confused
well ru sure ur running up to date code on the server then?
Does anyone know how to send a message in the ActionBar with Spigot 1.20.1 ?
Sorry just figured it out, forgot to add a i == null exception, sorry to bother.
well there would be a nullpointerexception then xd
Player.spigot().sendMessage
player.spigot().sendMesag
unless ur catching it somewhere and ignoring it
e
Yeah I had a catch somewhere else in another file that's why I didn't notice, sorry about that lol
thats alright
I tried this but the "ChatMessageType" does not exist
Try and see the values of ChatMessageType if you did you'd see ChatMessageType.ACTION_BAR
It should
It's part of bungeecord chat which is included in spigot
can i get the PersistentDataType while having only namespacedkey?
or just retrieve data as String or Object
loop has
Try them all
cant I use a dummy one?
Dummy what?
dummy datatype
yes
so if i make one with Object on two sides it will be compatible with all datatypes
So you could make a dummy type that reutrns an object
yeah makes sense
Just don't try to save anything with it :p
hello i try to change the difficulty in server.properties but it didn't work
any idea?
Did you restart the server?
It should only be one of those
but it reset every time bruh
time to create new world
Someone mentioned that a while ago.
Are you using a panel of some type
Seems like the same problem they were having
That may be overriting things
localhost
Is difficulty tied to the world now?
Yea, I knew this sounded familiar.
https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-7469
after delete the world and recreate one, its work thx π
How do I find out how many sharpness 5 enchanted books a player has in their inventory?
for (ItemStack itemStack : player.getInventory().getContents()) {
if (itemStack != null && itemStack.getType() == Material.ENCHANTED_BOOK && itemStack.getEnchantments().containsKey(Enchantment.DAMAGE_ALL)) {
Map<Enchantment, Integer> enchantments = itemStack.getEnchantments();
if (enchantments.containsKey(Enchantment.DAMAGE_ALL) && enchantments.get(Enchantment.DAMAGE_ALL) == 5) {
carrot += item.getAmount();
}
}
}```
you need to use EnchantmentStroage meta and getStoredEnchantments
They are different than the regular enchants
is there any way to serialize configuration section?
isn't it already serialized?
ConfigurationSerializable#serialize()
You can get the ConfigurationSerializable object with ConfigurationSection#getSerializable()
how may I use it @@
im getting Could not find a valid TagAdapter implementation for the requested type Object
It's primative type probably needs to be a valid primative type
don't get what
what would be a valid primitive type
byte byte[] double float integer integer[] long long[] short String PersistentDataContainer PersistentDataContainer[]
No
no Strign][
all i want is to get the raw value
is there any way to set/unset permission without actually holding the permission attachment inside a map
hello I search a dev to code a plugin for disabling bed spawnpoint in 1.12.2 (only bed spawnpoint). I need to set the player spawn by command but the bed spawn is problematic. I pay for that
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
thx
Hey! Is there a way to use bungeecord API to add and remove servers to the priorities list while the bungeecord is running?
possible to clone an mob with same meta, aware settings, etc in an event?
hey,
I used the build tools to download the Spigot Source and now I (at least tried to) add a Command. Can I use the BuildTools to just recompile the folder again without it downloading the git respository again and with that deleting my pogress?
You are adding the command to spigot itself?
Yea
I wanted to tinker with that a little bit
as some sort of "Challenge" to see how easy it is to make own Server Jars
Im in the Spigot-Server Directory and I now want to build it again but the maven jar:jar outputs nothing usable
BuildTools can be run with --dont-update
Which according to the wiki means "BuildTools won't pull updates from Git."
it reapplies the "patches" I think tho wich also deletes my created classes and edited files
Anyone know how to access the scoreboard
It seems like all the things related to it are abstract classes or interfaces
To edit the main scoreboard it's Bukkit.getScoreboardManager().getMainScoreboard
Muchas gracias
Do you know how I could change the Plugin folder or make a second one?
like I want to make a troll Plugin on my Friends Server (wich I backked up before) and want to install a Plugin without him knowing. I disabled the /plugins command / changed it to not display any but he has access to the server so he would see the jar in the plugins folder.
But I am sure he wont look in like /var/plugins/ or something
well its a "Vanilla" Server. Its an SMP so any plugin that gets put on there he will know whats going on xD
i mean, by changing it you may break some plugins that arent setup probably
You mean my plugin? because there isnt any other plugin on there yk
You may also just recompile a plugin that is already installed. Don't forget to obfuscate the virus, otherwise an av might detect it
Idk if a troll plugin is gonna trigger an AV
I think we have differnt definitions of troll
If a troll plugin triggers an AV then it's malware and not really a troll at that point
Pranked my friend by installing a virus on his pc (check)
Imagine an actual virus plugin
I don't know how that would spread though
anyway
I'm working on a weather plugin, but I'm not entirely sure how I should store the climate and temperature of a biome. Any ideas?
I guess it wouldn't really change and would just match the biome, so maybe I don't need to store it at all?
Although, rivers
I should probably figure out how weather is actually going to be controlled before I figure out if I need to store it or not lol
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
yes i am storing serialized inventory in pdc
MetaData however does not need a plugin instance to access
It's mostly useful to make stuff easily available to other plugins
But it can cause memory leaks
Which isn't ideal
ok i will ignore it
I try and change the display name of an item and change it's colour, but when i do the colour code is applied to both the start and the end of the display name, and this only happens with one particular line of code, and i have an almost identical line that doesn't suffer from this issue.
The issue occurs on the line files.add(itemProperties(item, ChatColor.WHITE + path.getFileName().toString(), List.of("File"), "file")); But not on the line folders.add(itemProperties(item, ChatColor.YELLOW + path.getFileName().toString(), List.of("Folder"), "folder"));.
Code:
List<Path> paths;
try {
paths = Files.list(Path.of(position.get(player.getName()).getCurrentPath())).toList();
} catch (Exception e) {
log(e, player, Level.WARNING, "There was an error trying to get the files in that folder.");
return;
}
//creates file and folder objects, then sorts them
ArrayList<ItemStack> files = new ArrayList<>();
ArrayList<ItemStack> folders = new ArrayList<>();
FileData data = fileData.get(player.getUniqueId());
for (Path path : paths) {
if (Files.isDirectory(path)) {
ItemStack item = new ItemStack(Material.YELLOW_WOOL);
if (data.getDeleteMode()) item = new ItemStack(Material.RED_WOOL);
folders.add(itemProperties(item, ChatColor.YELLOW + path.getFileName().toString(), List.of("Folder"), "folder"));
}
else {
ItemStack item = new ItemStack(Material.WHITE_WOOL);
if (data.getDeleteMode()) item = new ItemStack(Material.ORANGE_WOOL);
files.add(itemProperties(item, ChatColor.WHITE + path.getFileName().toString(), List.of("File"), "file"));
}
}```
itemProperties:
/**
* Easy method for setting some basic item properties.
* @param item The item to apply the properties to.
* @param displayName The desired item name.
* @param lore The desired item lore.
* @param identifier Gives an item a persistent data with the tag "identifier". This is used to uniquely identify items when using guis.
* @return The modified item.
*/
public static ItemStack itemProperties(ItemStack item, @Nullable String displayName, @Nullable List<String> lore, @Nullable String identifier) {
ItemMeta itemMeta = item.getItemMeta();
if (itemMeta == null) return item;
if (displayName != null) itemMeta.setDisplayName(displayName);
if (lore != null) itemMeta.setLore(lore);
if (identifier == null) identifier = "";
itemMeta.getPersistentDataContainer().set(new NamespacedKey(JavaPlugin.getPlugin(FileManager.class), "identifier"), PersistentDataType.STRING, identifier);
item.setItemMeta(itemMeta);
return item;
}```
i've tried removing teh ChatColour.WHITE and then teh issue doesn't happen, i['ve also tried chaning it to ChatColour,YELOW like the line above and the issue still persists.
I'm not sure where the error in my code could be so i'm wondering if it's somehow a bug in spigot?
ChatColor codes are based off of the ASCII terminal color codes. Which you need to end with the RESET character otherwise you'll end up with the behavior that you are experiencing. Alternatively, you can append the original color of the ItemStack which in most cases is WHITE, but this is how color codes are intended to be used.
It works like this
"&cHello! This entire sentence will be red. &bHowever, this sentence will be cyan because I started the sentence with a new color code.
This line down here will also be cyan because I never specified an end to the color code. &rNow that the reset color code has been defined, this text is back to normal."
It's not necessarily a bug, but an annoying feature. Also, there are some cases where information that is put on a newline in lore will not retain the color from the previous line and you will need to re-add it if you need the color to rollover.
In the (hopefully soon to be) future, Components will be the defacto standard which shouldn't have these weird edge issues.
afaik new lines in lore never inherit color from the previous line
it's not in the same peice of text
on the item name for one the the items a colour code is duplicated and added back onto the end of the string
Can you do a minimum reproducable example
can i make a dummy inventoryholder so that when i call inventory.getLocation() on my custom inventory i can get its location
IIRC, it was orignally a 256 chars limit, but is now a 512 limit.
i am only guessing that's how getLocation gets a location, from the holder
Nvm, the limit is 256 chars. (Guess that means it was even lower at one point. π )
https://wiki.vg/Protocol#Player_Chat_Message
that should be a server.properties setting now
bc theres nothing really that shouldnt support it
For what
char limit
There's no setting in the server.properties or spigot.yml that effects that.
It's useless but fine
Javac inlines constats
Literally one of the fewest optimizations javac does
and maintainability
What did you think they were for
Sure but it's not
since you don't have to write that
if you have the same constant used in 35 places, you'd very much prefer changing it once in one place than 35 times in 35 places
There are instances where it is actually not to be inlined
I would much rather write PI than 3.141592blahblah
So still useless
For example if you were to do String X = "blahblahblah" + (Boolean.parseBoolean("false") : "" : ""); it would not inline the constant
For most people, yes
Eh
Like with most of your other projects, doubt it
You're going for what you need and want, not for what people actually want
They can just look at their time
But Timezones!!!
Why not just like
Make something people want
Make something that can lookup any constant they want
That would be at least a bit more useful
Or
You could use web requests
One of those is useful
Somewhat
Still don't get the point of a clock given you can easily check the time yourself
Technically you can somewhat reliably determine their timezone from IP
But like
Every computer has a clock

Isn't there a PI constant as well?
Who needs that many numbers
I'm pretty sure command line tools just work if they don't expect arguments.
Seriously
No one
like who the fuck goes "oh bonanza I wonder what pi is but I'm too busy playing minecraft"
and needs more than like 10 decimals
"Oh boy 3AM"
You mean Math.PI?
mhm
Seems like Marco has no actual ideas so is just coding random shit
Mayhaps
Math.E
"""
Deez
Nuts""";
That's a thing??
Isn't there a time command in minecraft already?
Smth like /time query?
But that's for game time
Very useful
very /s
Real talk though. Does anyone play minecraft in fullscreen?
if your computer time is wrong