#help-development
1 messages · Page 579 of 1
okay. I hope someone else helps you.
but idk what to put in there
?paste
thank you
aa
show a screenshot of your whole project structure
It's okay. I helped unbearable people before.
probably not the best place to ask for, but noone seems to know. does anyone knows how to work with junit5 @CsvFileSource, i set the file path relative to the current class but it keeps telling me org.junit.platform.commons.PreconditionViolationException: Classpath resource [../../../../resources/input.csv] does not exist, would i have to put my src/test/resources/input.csv on the runtime classpath or smth?
it's supposed to look like this:
pom.xml in /
java code and packages in /src/main/java
plugin.yml in /src/main/resources
afaik it's relative to your src/test/resources directory
So no need for ../../../../resources/
looks good. how did you compile?
been doing that too, it just says Classpath resource [input.csv] does not exist
is your project on github?
no
if you upload it to github, I could check it out
wait
It do be like that sometimes
ty
nvm
i think the problem is with plugin.yml
at org.bukkit.craftbukkit.v1_19_R3.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:319) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:141) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.loadPlugins(CraftServer.java:430) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:975) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3763-Spigot-7d7b241-5a5e43e]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
Well, Doc PR'd that, but we worked together on a fix, yeah
md approved it already, just waiting on a merge
All of them
oh..........
Wouldn't make much sense to have a proprietary license on an open source platform now would it? ;p
At least by default that is
if you don't care in what people can do with it and just want to ensure they give you credit, then go with MIT
if you do care how they can use it, then select one of the other ones
yeahh!!
If I open source something, I just go with MIT
mainly because I can't be bothered to ensure the license is being followed XD
It's well known as the "Do whatever the hell you want" license
so i pushed to master instead of main now i have a branch called master...
how do I get rid of main on github
nvm found it
Since there is no PDC in 1.8, what else can I use to store player data?
How safe to use is NBT?
How safe is it to use NBT?*
Can I like duck something up by accident and break everything?
System.out.println("break everything");
But as Coll said it's as safe as everything else. Use it correctly, have a testserver and you'll be fine
it may not be possible to change the position of the axis for rotation from the quaternion and you should just use Translation 🥹
whow..
Wtf
u can actually change the position of a player's body part???
definition of "I lost my mind"
ima gine making like a zombie game where zombies lose their limbs
or players medival fighting
That's scary
that's so cool
Poor man lost his head
Is it a man tho?
🤔
Here I use Entity.Rotation but if I could do it with joml's Quaternionf it would help me a lot 🥹
DUDE that's sick
You can make the most beautiful cutscenes using that
player emotes without mods
Gotta love display entities
I wanna make this region based. One wrong step and your head is gone - move back and it's back lol
ConfigurationSection ranksSection = config.getConfigurationSection("Ranks");
for (String rank : ranksSection.getKeys(false)) {
String prefix = ranksSection.getString(rank + ".Prefix");
String suffix = ranksSection.getString(rank + ".Suffix");
// Do something with the prefix and suffix
}
No. "rank" is. "RankSection" is obviously the section
??? what name
The variable "rank" in the upper snippet is "Owner" etc.
Damn, what's that theme, I like it alot
Oh sry for the ping, forgot to turn it off
gruvbox material
how do I stop all sounds for a player in 1.8.8? There isn't even player.stopSound(...) or something like that
might seem like a smart move to load all my unit tests from csv files lol, currently executing 500 tests with 8 lines of code
csv format is only a little bit meh with the separators
I am 99% sure the client didn't support that in 1.8
._. what do I do now
Stop using 1.8 is usually my go to
well then deal with the limitation
Or make a modded server so the client supports it
not something I can do either
In that case you are out of options
I am
You want to create a new enchant?
I think vanishable covers everything
Check what the other enchant classes use
its what you want the enchantment to work on
IE EnchantmentTarget.ARMOR_TORSO
wait
None of them
Only ALL is deprecated
Like I said idk what the target is even used for when making a custom enchantment
So just set it as whatever
maybe Enchantment table?
will work for books though
yeah, but maybe internally it is in NMS
on any item?
specifically just flint?
Well why not just make sure that when someone puts the book and a flint in an anvil that your forcefully apply it
youll have to just set that to whatever, and then manually handle adding the enchantment to the item yourself (IE Anvils)
then use the ARMOR enum lol
just ARMOR unless you rly do only want it on heads (again, only works on anvils not enchantment tables)
thats fine too, but im sure your gonna want to add vanilla ways to get em eventually, so keep those in mind ^
ironically a lot of people who want this custom stuff is for their server. In other words a lot of people don't realize they could just edit their server to make it do what they want XD
not sure if that is their case or not
but if it is, they could just do that
yeah tbh I keep thinking whenever someone comes in here they're making a full implementation of the system they're making xD
what enchantment are they making anyways i didnt even look
oh shocking
wait
its a netherite helmet
but
can anyone give me a link for a trade plugins for version 1.20.1
bump.
You might be able to check if
PlayerItemConsumeEvent
Also says that Rightlicking armour consumes it
i'm sure it was the same before
what is args
arguments in a command class
args[stringID]
lol
No to that
for sure NETHERITE_HELMET is consumable
for what
cant be bothered to crop it
You can probably find it under InventoryAction event
The InventoryClickEvent
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
You can read more on it on the Javadocs
with this method that sets the damage:
private void setDamage(ItemStack item, double damage) {
ItemMeta meta = item.getItemMeta();
meta.addAttributeModifier(
Attribute.GENERIC_ATTACK_DAMAGE, new AttributeModifier(
"generic.attackDamage", damage, AttributeModifier.Operation.ADD_NUMBER
)
);
item.setItemMeta(meta);
}
in the attributes in the item description, it shows "When in Main Hand:" like it should, but also has "When on Feet", "When on Body", "When on Head" etc. I want to only keep "When in Main Hand", how can I do that
o thank you
I wish that Minecraft would recognize those types of items as "When Equipped" instead of having 6 different subcategories lol
But what if you equip boots in your helmet slot!11
Then it's still equipped!
I just mean that if it doesn't specify a slot or specifies all the slots
Zo true
Hi, I'd like to make it so that when I click on a dice that you click on something in a gui it opens a person's inventory but it doesn't work (only when the value in Dig.startDig(player, target); the system works but then doesn't work).
Her is my code
@EventHandler
public void onInventoryClick(InventoryClickEvent event, Player target){
Inventory inv = event.getInventory();
Player player = (Player) event.getWhoClicked();
ItemStack current = event.getCurrentItem();
if(current == null) return;
if(inv.getName().equalsIgnoreCase("§cDemande de fouille")){
event.setCancelled(true);
if(current.getType() == Material.GREEN_SHULKER_BOX){
player.closeInventory();
Fouille.startFouille(target, player);
}
}
}```
public static void startFouille(Player player, Player target){
player.openInventory(target.getInventory());
}
how i can get pos1 & 2 selection of a player's worldedit selection and make a region of that?
public static void createRegion(Player player, String regionName) {
com.sk89q.worldedit.entity.Player actor = BukkitAdapter.adapt(player);
SessionManager sessionManager = WorldEdit.getInstance().getSessionManager();
LocalSession localSession = sessionManager.get(actor);
Region region;
World world = localSession.getSelectionWorld();
try {
if (world == null) throw new IncompleteRegionException();
region = localSession.getSelection(world);
} catch (IncompleteRegionException exception) {
return;
}
ProtectedRegion protectedRegion = new ProtectedCuboidRegion(regionName, region.getMinimumPoint(), region.getMaximumPoint());
}
i've this code but i'm not sure if player has any selection or not
Ask on the WorldEdit APIS discord, they probably can help you more then us
so you wanna know if you have a selection?
if player have a selection, yes
and if he has, create a region of that
if (localSession.getSelection() == null) return;
hmm nice thanks
well this should do the job:
LocalSession session = WorldEdit.getInstance().getSessionManager().get(BukkitAdapter.adapt(player));
if (session == null) {
player.sendMessage(Utils.colorize("&cMake a selection first."));
return true;
}
Region region;
try {
region = session.getSelection(session.getSelectionWorld());
} catch (IncompleteRegionException e) {
throw new RuntimeException(e);
}
ProtectedRegion protectedRegion = new ProtectedCuboidRegion(args[1].toLowerCase(), region.getMinimumPoint(), region.getMaximumPoint());
Now to you @jolly forum
So you want tocheck if somebody clicks on a dice
then open a UI?
GUI**
Yes, but that doesn't solve my problem
Yes
then u open a UI?
As soon as I click on the shulker, it executes the startDig function.
how can I convert string to int?
cus right now ur only checking the name of an inventory, then cancelling the event then checking the type of the block that was clicked
Integer.fromString()
or smth like that
nor
Integer.parse
Integer#parseInt
and it will take into account the signs +, -, *?
no
an int
is a number
not a sign
it will throw an exception
if you try converting the entire string
and how can I then convert the formula in string form to working in numbers
can i use it?
what is better to get a variable through a getter? Or contact directly?
Getter
why?
Encapsulation
Hello, can I set two shape on the same ShapedRecipe ?
No
okay thanks
i haven't yet looked deep into CompletableFutures and what other ways of asynchronous calls there are in kotlin, but i was able to cook this, please tell me if this looks fine to you or if i have made a grave mistake
fun findDocuments(filter: Bson): List<Document> {
val future = CompletableFuture.supplyAsync {
return@supplyAsync collection.find(filter).toList()
}
future.exceptionally {
return@exceptionally emptyList()
}
return future.get()
}
Hi there,
How can I implement a restriction to prevent a specific item from being dragged into other inventories such as chests or shulkers?
@green prism
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryClickEvent.html
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
You can check if the moved item should be blacklisted
and check the recieving inventory
etc..
hmh
Sorry, I dont know much about Completable futures, but id say it looks ok
alrighty, when I'll get to testing I'll see
i heard there were coroutines in kotlin but i haven't got to studying those just yet
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if(event.getClickedInventory() == null) return;
if(event.getCurrentItem() == null) return;
if(!(event.getClickedInventory() instanceof PlayerInventory)) return;
if(CrownUtil.isCrown(event.getCurrentItem())) {
event.setCancelled(true);
}
}
Something like this?
gimme sec, ill write smth up for u
Thank you so much
you can simplify the last statement
event.setCancelled(CrownUtil.isCrown(event.getCurrentItem()))
pls no
why not
You're going to setCancelled(false) some other listener
?
oh wow, he's right
Other plugins can listen to events too so if they want to cancel it, if they're clicking something that isn't your crown, you're going to uncancel the event and cause that plugin to break
If im creating a LevelChunkSection how can I get an instance of a nms Level
this is correct
u just gotta find out which getInventory returns the inventory the player is placing the item into
cus i forgor which one it is
@green prism
@worldly ingot My class is lovely, you cant change my mind
so are you trying to create a new ServerJar?
you already asked in the paper discord bruh
xD
@quaint mantle You cannot hide packages
You could only make the functions blocked by using protected void function()
but that aint helpful
and why r u trying to hide it anyway?
Thank you for generously dedicating your time
Regarding the prevention of players dragging items to non-PlayerInventory, what do you think of the following code snippet:
if (!(event.getClickedInventory() instanceof PlayerInventory)) {
return;
}```
This code effectively ensures that players are unable to drag items to any inventory other than a PlayerInventory... _right_?
No
This would block you of dragging anything at all
You are asking if the clicked inventory is a playerinventory
so if you click on an item in player inventory
it wont move
If you want to prevent dragging to other inventories, you can use
if(event.getInventory() instanceof ShulkerInventory) event.setCancelled();
event.getClickedInventory();
Yeah, like this
Hello, how can I set the maximum durability of an item ?
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R1.block.impl.CraftIronBars cannot be cast to class org.bukkit.block.data.type.GlassPane (org.bukkit.craftbukkit.v1_20_R1.block.impl.CraftIronBars and org.bukkit.block.data.type.GlassPane are in unnamed module of loader java.net.URLClassLoader @18769467)
Does that make any sense to anyone?
you can't cast an Iron Bar to a GlassPane
It's not creating an iron bar anywhere
check if your BlockData is an instance of GlassPane before doing this
well, you have an Iron Bar
show the top
show stack
so, I can't help you sorry
I am going to print what material the block data is getting created with
Now it makes less sense xD
it prints GLASS_PANE, it crashes tho right at the carst
cast*
try checking stack.getMaterial, not getType to see
That's... not how you usually use futures
You're calling future.get which is a blocking method
Let me check
You should instead just return the future itself and use the futures in context
like
getDocument("Joe").thenAccept(doc -> {
...
});
There's not an stack getMaterial method. stack is an ItemStack
alright it's happening, my free minecraft models plugin is finally getting worked on
use data.getMaterial*
I just need to remember how I had this working in the first place
I am using that, it prints GLASS_PANE
for the check
maybe 
but if I can't see what is stack, I can't do something more
sure
set an api version on your plugin.yml
It's already set to api-version: '1.20'
Same error
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R1.block.impl.CraftIronBars cannot be cast to class org.bukkit.block.data.type.GlassPane (org.bukkit.craftbukkit.v1_20_R1.block.impl.CraftIronBars and org.bukkit.block.data.type.GlassPane are in unnamed module of loader java.net.URLClassLoader @18769467)
Oddly enough. GlassPane does not have BlockData of GlassPane
declaration: package: org.bukkit, enum: Material
you are having a class cast exception because GlassPane does not work with BlockData of type GlassPane rather you should be using BlockData of type Fence
🤣 Okay, let me try
I don't understand why org.bukkit.block.data.type.GlassPane is even a thing
declaration: package: org.bukkit, enum: Material
colored glass has type of GlassPane
GlassPane BlockData also has different methods
I have quite a problem. I have a bungeecord lobby server and for example a survival server. I am modifying the ServerSelectorX plugin and want to add permissions checking to it. On the bungee server I have luckpermsBungee and there I add all the permissions such as ssx.permission.survival for example and I stopped at checking those permissions. ChatGPT was not able to help either.
You are right, thanks 🙂
It fixed
Hello, how can I set the maximum durability of an item ?
ItemMeta has a Damageable cast you can do
?jd-s
I guess it's more like editing code not server configuration but okay i'll send it there
I want to set the maximum durability, not the durability
ahhh
I am creating a plug-in and I have this item and I want to use that item in a recipe. I have already tried creating a new recipe choice
RecipeChoice.ExactChoice
Material#getMaxDurability, returns a short of max durability
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html#getMaxDurability()
declaration: package: org.bukkit, enum: Material
I want to set the durability, I don't want to get it
you can't change the maximum durability
thanks
Hey I hardcoded some permissions for my commands in plugin.yml but that causes the console to not have permissions so use them. Is there any fix to this?
Now the first recipe is not working
Is there a wrapper method for sending the packet ClientboundLevelChunkWithLightPacket class
highly doubt it
Just check if the Console is executing the command or the Player
Whats ur issue?
Are you still having it?
you can't execute the command if you hardcode permissions
the command doesn't appear in tabcomplete
yeah
Why not just check the perm on execute?
it makes the command visible to players that don't have the permission to use it
Why is that so bad?
cause players can see what commands staff can use etc
but that's besides the point rly
In General hardcoding permissions is a no no
If you implement a Permission Manager at somepoint
Or if you plan on allowing this project
to be a "master" for others
It would be best to check for entire "groups" of permissions
I mean i cant really say much on the matter, i dont use the default command registery
I use AIKAR
(ACF)
okok
I sadly havent made any guides on that yet, but if your looking for a MongoGuide lemme know
Hello, how can I consume durability of a bow ? (like when someone is shooting with it), I want to consider that the bow may have unbreaking
How you can remove durability?
using setDamage or setDurability
Yea, you have the function what else do you need?
A random int function I suppose
He said he wants to consider unbreaking. And he never said he wants to do it inside the damage event
More like "right click -> damage" without actually firing
What does he want to do tho?
that
oh
that just cancle the event
and get the damage it would have done to the bow
by doing event.getDamage();
well if you just click it for a split second it won't be called since the bow will not take damage and not fire an arrow
Consider the bow a special activatable item. Like right clicking with a special dirt block
If he wants that he can use a playerInteract even
I suppose that's what he wants
yes
true
Got any recommendation on this?
https://paste.ofcode.org/WaBThgUWNryf9s89EChEiF
is there a problem with it or do you just want a code review?
Hello, why it doesn't apply damages to the bow ?```java
ItemMeta meta = e.getBow().getItemMeta();
if (meta instanceof Damageable) {
Damageable damageable = (Damageable) meta;
int currentDurability = damageable.getDamage();
int newDurability = (int) (currentDurability - 1);
if (newDurability < 0) {
newDurability = 0;
}
damageable.setDamage(newDurability);
e.getBow().setItemMeta(meta);
if(e.getEntity() instanceof Player) ((Player) e.getEntity()).updateInventory();
}```
damageable.setDurability()
Would .toString() on each of those not lead to the same result?
Where
on the end of getString or getDouble=
I'm using Jeffs CustomBlockData class and I'm encountering the following error: Unsupported class file major version 60
Anyone know anything about this?
== for enum right
Enum?
All of them. But ye numbers would then be strings, true
invalid java version
????
what’s your current version?
yes
latest I'm pretty sure
enum
yeah exactly, tf is that
don't remember how to change it but ima look it up
kk
You dont know what an enum is?
you don’t..
@hybrid spoke
who is that
never heard of them
Its a Java
Java?
dafuq is that
so a cup=
You can however just put it using #put(). I suppose org.json has a type matching internally already
I can try
Would it work with an Array tho?
i mean it takes a Object
so it should be fine
I suppose it would work with arrays, too
so i could just do
JSONObject toSave = new JSONObject();
for (String s : defaults.keySet()) {
Object o = defaults.get(s);
toSave.put(s, s);
if (o instanceof String) toSave.put(s, getString(s));
if (o instanceof Double) toSave.put(s, getDouble(s));
if (o instanceof Integer) toSave.put(s, getInteger(s));
if (o instanceof JSONObject) toSave.put(s, getObject(s));
if (o instanceof JSONArray) toSave.put(s, getArray(s));
}
//instead do
JSONObject toSave = new JSONObject();
for (String s : defaults.keySet()) {
Object o = defaults.get(s);
toSave.put(s, s);
}
no i couldnt
just saw it
uhm no and the code before is questionable aswell
id still have to use getString()

yes
ty 😄
//Instead of using this
public String getRawData(String key) {
if (!json.containsKey(key)) return "";
return String.valueOf(defaults.get(key));
}
// I can use this
public String getRawData(String key) {
return json.containsKey(key) ? String.valueOf(defaults.get(key)) : "";
}
yes that's the same
Hello, why my bow's durability isn't set to 1 ?java e.getBow().setDurability((short) 1); if(e.getEntity() instanceof Player) ((Player) e.getEntity()).updateInventory();
@flint coyote
Updated again, does it look better?
does .getMessage() on a command event return the comamnd with or without the slash and does it include args?
that's gonna take two minutes i can't afford to waste smh
Bruh
you took the time to write a message in discord, you couldve just tested it urself by now
?jd-s PlayerCommandPreprocessEvent
i know
but
it doesn't specify whether it includes args
declaration: package: org.bukkit.event.player, class: PlayerCommandPreprocessEvent
well it is weird that you create a treeMap from your JsonObject to then use Gson in order to write it. Why don't you just go with "toSave.toString()"?
"message the player is attempting to send"
which includes args
since its the message
the whole
and slash?
without the prefix
Use FileWriter with try-with-resources
TreeMap to format it
okay
everything stands there
thanks
In order to sort it or what's the point?
so everything excluding the / (i.e. "/help" = "help")
@fringe yew
I KNOW THAT
Yea to sort
JUST TELL ME YES OR NO
THEN YOU WOULD VE TESTING
just forget it
Okay
and?
Why do you require a sorted json?
Json is usually not meant to be used as userfriendly output.
If you really require sorting you are doing fine though
if you would have gave me a yes or no answer
it would have taken 3 seconds
rather than the 5-10 minutes i'd need to set up everything
I just want it to look nice 😄
Have you considered that we don’t know?
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
I'm using Jeffs CustomBlockData class and I'm getting a classnotfound error.
Caused by: java.lang.NoClassDefFoundError: com/jeff_media/customblockdata/CustomBlockData
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.initializeFirstLever(DungeonRoom1.java:31) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.<init>(DungeonRoom1.java:23) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.commands.generaldungeoncommands.StartDungeon.onCommand(StartDungeon.java:53) ~[stonedzonedmain-1.0-remapped.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
... 23 more
Caused by: java.lang.ClassNotFoundException: com.jeff_media.customblockdata.CustomBlockData
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:183) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.initializeFirstLever(DungeonRoom1.java:31) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.<init>(DungeonRoom1.java:23) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.commands.generaldungeoncommands.StartDungeon.onCommand(StartDungeon.java:53) ~[stonedzonedmain-1.0-remapped.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
?shouldiask
Did you shade it
Its not a command 😦
Yes
maven shading is weird
Want me to send my POM?
never works
it would probably bed a tad faster if you sorted the keys before your loop instead of doing it afterwards
I can also just remove it
if it's for machines only it doesn't matter anyway
If its used only for machines, it automatically binary
binary is smaller
and easier
Well you might want someone to be able to check if there's any issue. Idk what you are using it for
You should however use try with resources for your file writer. Saves you the close
Here's an example if you never heard of it
The file writer has to be inside the try, not the string
yes
I'm using Jeffs CustomBlockData class and I'm getting a classnotfound error. I have shaded already and here is my pom.xml: https://paste.md-5.net/lehukinaco.xml
Caused by: java.lang.NoClassDefFoundError: com/jeff_media/customblockdata/CustomBlockData
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.initializeFirstLever(DungeonRoom1.java:31) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.<init>(DungeonRoom1.java:23) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.commands.generaldungeoncommands.StartDungeon.onCommand(StartDungeon.java:53) ~[stonedzonedmain-1.0-remapped.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
... 23 more
Caused by: java.lang.ClassNotFoundException: com.jeff_media.customblockdata.CustomBlockData
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:183) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.initializeFirstLever(DungeonRoom1.java:31) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.<init>(DungeonRoom1.java:23) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.commands.generaldungeoncommands.StartDungeon.onCommand(StartDungeon.java:53) ~[stonedzonedmain-1.0-remapped.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
what's that theme?
gruvbox was nice, but a bit too desaturated for my taste
how would I create a recipe for my server that is sorta shapeless, sorta shaped... here's an example, the recipe for sticks in default minecraft. You are able to put the 2 planks ontop of eachother anywhere in the crafting table but they do have to be on top of eachother. How can I do this for 1 recipe orrrrr do I have to make like 6 different shaped recipes for all of them if I wanted to make the stick recipe?
Its from Material Theme, Darker Theme
are plugins that kick people for interacting with blocks as a joke allowed, if i specifically say they are a joke?
wdym
theres something called "material theme"?
Wait lemme screenshot
<3
anyone know?
Ie “X”,
“X”
No
Not allowed
:(
Your plugin has to state an actuall use case
to troll players
Well make it a "run command on block interact"
not to troll admins
You can always try, but it will probably get denied
then people can configure it to kick people
@zealous osprey
I saw, going through the themes, thanka <3
Hello, why can't I do this ?java Damageable damageable = (Damageable) e.getBow().getItemMeta(); damageable.setDamage(damageable.getDamage() - 5); e.getBow().setItemMeta(damageable);
Required type: ItemMeta
Provided: Damageable```I think if I cast Damageable to ItemMeta It'll don't set the durability
Did you import the right damageable
org.bukkit.inventory.meta ?
Should be, yes
why it's not working then...
I was in 1.16.5
I'm using Jeffs CustomBlockData class and I'm getting a classnotfound error. I have shaded already and here is my pom.xml: https://paste.md-5.net/lehukinaco.xml
Caused by: java.lang.NoClassDefFoundError: com/jeff_media/customblockdata/CustomBlockData
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.initializeFirstLever(DungeonRoom1.java:31) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.<init>(DungeonRoom1.java:23) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.commands.generaldungeoncommands.StartDungeon.onCommand(StartDungeon.java:53) ~[stonedzonedmain-1.0-remapped.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
... 23 more
Caused by: java.lang.ClassNotFoundException: com.jeff_media.customblockdata.CustomBlockData
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:183) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.initializeFirstLever(DungeonRoom1.java:31) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.manager.dungeon.DungeonRoom1.<init>(DungeonRoom1.java:23) ~[stonedzonedmain-1.0-remapped.jar:?]
at me.cosmic.stonedzonemain.commands.generaldungeoncommands.StartDungeon.onCommand(StartDungeon.java:53) ~[stonedzonedmain-1.0-remapped.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
you need to shade it
I did that
maybe relocation didn't work correctly
That's one of the things I always hated around Maven, it maybe works and it maybe doesn't with the exact same config
are you compiling with mvn package
Try to switch to Gradle, idk
^ no gradle doesn't work with NMS
yes
Oh really? I thought it basically did the same thing, just different syntax
there is no special source plugin for gradle
so the mappings can't be remapped
But can't you just use reflections? That shouldn't give an error, no?
you could use reflection, but that's so much more work
it also doesn't let you extend NMS classes
Is there another way to use PDC in blocks?
no, there's something up with your pom.xml
I'm looking at it rn
<source>8</source>
<target>8</target>
targeting java 8 with 1.17+ is a no go
Well, anything above that just gives invalid java version for jeffs lib
@tender shard
okay, thx
You should be fine using 8
maybe shade plugins out of date then?
its so unclear cuz it looks like configuration is correct
Idk I’m not much a maven guy :p
for(int index = t.indexOf("/%{2}COLOR_[A-Z]+%{2}/g"); index >= 0; index = t.indexOf("/%{2}COLOR_[A-Z]+%{2}/g", index + 1)) {
int lastIndex = t.lastIndexOf("%{2}COLOR_[A-Z]+%{2}", index);
String subString = t.substring(index, lastIndex);
System.out.println(subString);
}
sohuld this work
i have never used regex in my life
trying to get every instance of %%COLOR_WHATEVER%% in a string
Try it and
Use Pattern.compile and Pattern#matcher
Hello, how can I use an item with specific metadata in a ShapedRecipe ?
RecipeChoice.ExactChoice
okay thanks
You can always check with regex101
it's %%COLOR_ followed by uppercase letters and ended with %%
if it's what you want 
(I almost understand regex, but it's a little rough...)
yea thats what i want
it does work on there
but getting nothing here
Why not ^%%COLOR_[A-Z]+%%
Try remove /
and /gm
this works
k
but then how do i get all instances in a string of that
You can do while (matcher.find)
In fact there are a bunch of methods in matcher you can use
I suggest you look at the javadocs
Quick question, i want to make IronGolem with less and little bit modified pathfindergoals in 1.19.
- Do i have to use NMS?
- Do i have to do https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/ this
- Yes
- You don’t have to use remapped, but you should
I'm pretty sure you need NMS for pathfinding goals yeah but I think a better guide is alex's post tbh
?nms
but this doesnt???
Fuckkk. This moment when you made huge api for custom NPC's without remaping fucking with a, b, c and then you need to change everything for remapped
Honestly i have been coding plugins for many years but i heard about remapped few seconds ago
yall ever like have code that works then u change something, change it back and it doesnt work
Time to use the good ol FileHistory feature :P
ohhh i see the problem
Fuck this site, whenever i heard about remapped i will use remapped but first i have to know how to use this
sitting and crying about it normally fixes that for me
for some reason i cant have ANYTHING else in the string than the %%COLOR_WHATEVER%%
or just sitting there staring at my scren for 3 hours wondering "huh" in a very angred tone
its pretty easy to use
- click version number
- Type name of class in search bar
- Press enter look at corresponding remapped names
patterns are weird
if i have anything else except the %%COLOR%% thing, it just doesnt work
what's your regex
%%COLOR_[A-Z]+%%
patterns are cool
looks good to me
I have one more question about this remapped. If i am using obfuscated spigot and then i use remapped version in my pom.xml will it colide with each other?
yes
use mt.find() instead of matches
How do i avoid that
yea trying that rn
matches() will only say true if the full string matches
but... why?
Are you serrious? Can i just use remapped server jar?
Hey, new to plugin development (and JAVA in general). I was wondering if there are any good videos to get me started apart from WOK and Kody Simpson's playlist.
I also got a pressing issue. How exactly do I set the output/result of an anvil? I wanna mix two echanted books together (Fortune III + Silk Touch - just for testing purposes). I can't seem to find any AnvilInventory.setResult()
?nms
follow this guide
it shows you how to setup remapped
do not use separate dependencies
you only need 1
spigot-api is no longer needed after you add the spigot dependency
what are you even trying to make
for some reason trying to use %%COLOR_BLACK%% instead of using alternate string replacements and whatever
idk why
brother
use the adventure text api
then you can do magical stuff like this
dont
its a waste of time
it isnt good practice at all
Cope
unless youre doing it as a learning experience
am indeed coping 👍
They're saying good practice as a learning experience, not it being good practice
then i agree :)
I have done this guide
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
And now i can not use nms classes
you can just not the same ones
the class names change
refer to the site for all changes
how would i make it be able to have underscores in the second word
🤔
this seems to work ig
is this a good way to make a custom enchant system?
id?
have you figured out how youre gonna replace it yet?
yea
please tell me youre not using indexof
for skins right
thank god lol
?paste
works
very nice
prob not most efficient way but it works
public static String TranslateStringWithColor(String t) {
Pattern pt = Pattern.compile("%%COLOR_[_A-Z]+%%");
Matcher mt = pt.matcher(t);
while(mt.find()) {
String str = mt.group();
String color = str.replace("COLOR_", "");
color = color.replaceAll("%%", "");
t = t.replace(str, ColorCode() + Colors.valueOf(color).t);
}
return t;
}
Compile the pattern once
Keep it in a static constant
oh yea thats a thing
sec for this site it looks changed for some reason
try doing mt.group(1)
i think that should give you just the color name
What do you mean?
nah uh
@timid hedge Use this ID when setting the textures string
replace my createItemStack() method from the copy pasta with your own method/own ItemStack
still same as without the 0
should work on 1.17ish+ i know it was annoying as to figure out how to get those working on newer version
Alex has a guide for that
It’s basically the same
And yes I believe it was 1.18.2 or smth
all i use is this
and then this
?
what version u on

are u in luck i got smt for u
public static ItemStack createSkull(String texture) {
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta headMeta = (SkullMeta) head.getItemMeta();
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", texture));
try {
Field profileField = headMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(headMeta, profile);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}
head.setItemMeta(headMeta);
return head;
}
public static ItemStack playerSkull(Player player) {
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta headMeta = (SkullMeta) head.getItemMeta();
headMeta.setOwner(player.getName());
head.setItemMeta(headMeta);
return head;
}
use the value tho
not the minecraft url
i think mt.group(1) should work if you modify your regex to %%COLOR_([_A-Z]+)%%
That value is just base64 encoded json containing the link
You can easily convert between the two
oo it does
thanks
:)
lovely
xd
public static String TranslateStringWithColor(String t) {
Matcher mt = pattern.matcher(t);
while(mt.find()) {
String fullstring = mt.group();
String colorString = mt.group(1);
t = t.replace(fullstring, ColorCode() + Colors.valueOf(colorString).t);
}
return t;
}
thats better
I got problems with:
GameProfile getProperties Property profile
You need to import auth lib
now make it support hex colors :D
Do you know what the exact import is?
but like why
Google your question before asking it:
https://www.google.com/
hex colors are cool i think thats enough reason
cmon its a challenge
its already gonna be a challange to import nms with breaking everything
You know you could just use Adventure and MiniMessage
ill do that first
i already said that
hes doing it as a learning experience
be Pog, use Spigot Components :3
real
Honestly spigot and adventure components aren’t even that different
Aside from MiniMessage that is
i mean i use Spigot components for my code, i dont feel like im lacking anything with them
lemme check
all the imports i use:
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import java.lang.reflect.Field;
import java.util.UUID;
honestly just need MM for spig comps :v for hover and on click parsing stuff lol
adventure components have a bunch of cool stuff like you can serialize them into raw minecraft json out of the box
Make winnimessage
™️
Again you need to import auth lib
bro cannot resolve mojang thats not a good sign
you need to add the mojang authlib library to your dependencies
i support the idea of winnimessage
but yea get autlib
are you using maven or gradle
parsing text is NOT my specialty

i love installing buildtools
answer my question then i can help lol
doesnt take ages at all
.
pretty soon it's gonna have a gui!
that does help!
i mean atleast ill be able to watch a progress bar instead of 99999 lines of text
unless u want to be cool and support my unofficial one :3 https://www.spigotmc.org/resources/buildtools-gui.110095/
shameless self promo
woooo i got scheduled in for one more half hour of work next week
Banned
thats improvement
It’s way faster after the first install


<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.17.30</version>
<scope>provided</scope>
</dependency>
Since it only has to pull changes
add that to your dependencies
And not download portable git
yeah and somehow way more broken when i try
Skill issue idk
i mean this is only a Windows skill issue
do u use git bash
No
hmm
I use powershell XD
Neither was I when I still used windows.
I got away with normal command prompt. :p
can i use both paper and nms or does that like not work
Paperweight userdev is what u might need to use idk
or.. i dont use paper
since to use NMS u need to import org.spigotmc:spigot
which also imports spigot-api
ill just not use paper easy fix
do you know how to add a repository?
Now this
that is a good idea

reject Fork, embrace tradition
only Bukkit
<repository>
<id>lumine</id>
<url>https://mvn.lumine.io/repository/maven-public/</url>
</repository>
try adding this one
i (think) it should be hosting authlib
Just use the official repo??
if my plugin still works after just putting in random stuff (nms) and removing other stuff id be suprised cus thats a first
there is one?
thats the one thats listed on mvnrepository
Yeah the one that the game downloads it from
Yes
you mean the libraries.minecraft.net one?
oh my god i can use strings instead of components
i cant understand you
Yeah
ok
theres no placeblock event right? just right click on block
But still dosent work
I cant still use GameProfile and the others
BlockPlaceEvent
yo what authlib version do you use
i swear that doesnt exist in paper
It 103% does
none x-x
3% margin of error?
do you use nms or something
yea
💀 what even is that craftbukkit import
Paper removes BlockPlaceEvent sounds like something for https://drama.mdcfe.dev
i dont know i dont use that project anymore
i love this kinda stuff, less effort
ignore that
change https://mvn.lumine.io/repository/maven-public/ to https://libraries.minecraft.net/
and change 3.17.30 to 2.1.28
and see if that works
what do u mean fodler
whyyyy do you capitalise your function names
whyyyyyyyyyy
^
also ClassesFromFodler
now imma change them all back
Wtf is this C#
lmfao
REAL
get un-used to it
in the dependency
not the repositories
i usually capitalise my voids and not the ones that return something
is that fine?
Void is a wrapper for void iirc
okay fine
so its basically the same but adds a little overhead for unboxing
thats not what i meant
from what you posted your repositories are fine
If you capitalize any function you will be sent to hell
Sorry I don’t make the rules
java conventions do
i changed it its fine dw
the same thing you had before but with the version changed to what i told you to change it to
M$ is going to hell for creating C# then
why do all spigot devs use maven
Because spigot uses maven
imma make some people trip with this
I haven't had a single useful error message when writing my gradle files
and use this
but with the different version
you need to learn to read gradle errors just like how you learn to read stack traces
i need to buy an alt to test things but i just bought smt for 1200 bucks so im broke
ive been using for like a year now prob and most of the time i instantly know every error that pops up
Just use offline mode to test things
^
Don’t worry Jeb_ will understand and not eviscerate you
Probably
alternatively he can always just update to modern mc 
Fuk u dood 1.8 is best
You probably didn't reload your pom
what do i do to join with another player
Use a launcher like Prism
i use gdlauncher does that work
google "spigot how to add authlib dependency to maven" i need to go to sleep
Well does it allow you to add offline accounts
lemme check
or ask someone else how to import nms using buildtools or whatever idk i dont use maven