#help-development
1 messages · Page 699 of 1
do you recommend that or just callback inject the write and load method that takes an nbt compound
i recommend create an interface which has method that returns reference to the data field in dimension class and then you implement it to a dimension class using simple @Override
so you have for example this
interface IDimensionData {
NbtCompound getData();
static IDimensionData get(DimensionThingy dimension) {
return (IDimensionData)(Object)dimension;
}
}```
(example)
then you have
abstract class MixinDimensionThingy implements IDimensionData {
@Override
public NbtCompound getData() {return data;}
}```
(it is all example and it will probably not compile)
what is the event for interacting with an item? i forgot
PlayerInteractEvent
they're talking about mods
i think it does exist for plugins
how can i detect if an item is type of shulker box? there are a bunch of shulker box colors
is it possible to make the player's displayed hearts capped at 10?
mixins is way to access and modify classes,methods,fields on runtime
the default heart count is 10
but if you count half hearts its 20
do you want to make the half hearts 10?
im talking abt hearts not health (not half)
@quaint mantle I also found this https://fabricmc.net/wiki/tutorial:persistent_states do you reckong this is still valid?
you want to have like 50 hearts but display them at 10? and then show the health amount somewhere else?
exactly
yeah it is also valid, i just like giving nbt lol
fair enough
you can use packets to send the player only 10 hearts but make it so it counts in the others
eg: 90/100 -> 9/10 | 5/20 - > 2.5 / 10
or you can calculate all the regeneration and damage and other stuff yourself
this packet? https://wiki.vg/Protocol#Set_Health
i think the easiest way is to use protocollib for packets
idk
Google your question before asking it:
https://www.google.com/
cast the shulkerbox' ItemMeta to BlockStatemeta, get the BlockState, cast it to Container or ShulkerBox
and then i have to cast ShulkerBox to Inventory? or i can just show it to the player?
How to change vanilla /me?
i think you just have to take the vanilla /me command permission from the player and create your own command. or use /PLUGINNAME:me
Fast Chunk Pregenerator.... I have made a minecraft server and loaded 12000 and it took forever.... if I do it again and say 15000 or 20000... will it start from 12000 and continue or do I need to start all over from scratch? Thanks
try and see?
I assume it will start from 12000, or at least be substantially quicker
also this is a dev channel
I just did not want if it started all over... because then i need to wait a week again 🙂
Oh sorry
no. SHulkerBox extends Container
it is not an inventory
i need to open the shulkerbox when the player right clicks the air
i did all the interact logic
As I said, ShulkerBox extends Container which extends InventoryHolder
so you can easily get the inventory from any of that
can anyone tell me wtf is going on and how to fix this?
escape
you're in multi-line-selection mode
which is enabled through middle-click + drag
yeah but how to disable multi line selection mode. it doesnt disable it
But i know that there is a way to change minecraft:me
then why did u ask
just mixin into place where is Me command and disable it
you can also unregister it
by mixining into registry
(Minecraft registry ofc)

also wouldn't there be event in bukkit everytime when command is registered
what's the purpose in changing minecraft-namespaced commands? Have you ever seen a player actually entering /minecraft:me and then expected to use a plugin command instead
the CommandMap has a Map<String.Command> if you really wanna mess with that
you can get it from the SimplePluginManager using reflection
Real question is why do you have volume mixer pinned on your task bar
to change audio settings
and the more real question is why tf did you check his task bar?!
Gotta micro analyse everything
idk every other day
how to open an inventory for a player?
do you sometimes also check the javadocs before you ask here
Personal inventory
Player#openInventory(Inventory)
Or
Player.openInventory(Inventory)
the javadocs doesnt have dark theme so i will check spigot forums and then ask here from now on.
xD
there is a lot of space down there
ikr
did you try windows 11 for 1 day and then immediately change back to windows 10?
or have you not switched yet
md_5 hates me
no? I'm using windows 11
is there a way to set a shulkerbox's Inventory?
or will it change when i open it's inventory for the player?
lemme just
?paste
You have to set back the changed BlockState to the BlockstateMeta and set that back to the ItemStack when the inventory is closed or changed
https://paste.md-5.net/kenurosexu.java
this is my code for opening the shulker box on player right click
You should also be using Tag.SHULKER_BOXES to check the material
https://paste.md-5.net/akaxokajix.java
idk why but i feel like this has a bunch of dupe glitches
if (!Tag.SHULKER_BOXES.isTagged(player.getInventory().getItemInMainHand().getType())) return;```
loadConfiguration does not return a ConfigurationSection
oh
ahhah
wait
he return Yaml
Config
no it returns
FileConfiguration?
i think YamlConfiguraton this abstract
use teh javadoc and suggestions. Your IDE shoudl tell you what it returns https://hub.spigotmc.org/javadocs/spigot/org/bukkit/configuration/file/YamlConfiguration.html#loadConfiguration(java.io.File)
private final Plugin plugin;
public NukeTNTCommand(Plugin plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Bu komut sadece oyuncular tarafından kullanılabilir.");
return true;
}
if (args.length < 3) {
sender.sendMessage("Kullanım: /nuketnt <x> <y> <z>");
return true;
}
try {
double x = Double.parseDouble(args[0]);
double y = Double.parseDouble(args[1]);
double z = Double.parseDouble(args[2]);
Location centerLocation = new Location(((Player) sender).getWorld(), x, y, z);
new BukkitRunnable() {
int tick = 0;
int maxRadius = 3;
int maxY = centerLocation.getBlockY();
boolean shouldExplode = false;
@Override
public void run() {
if (tick <= maxRadius && !shouldExplode) {
for (int dx = -maxRadius; dx <= maxRadius; dx++) {
for (int dz = -maxRadius; dz <= maxRadius; dz++) {
for (int dy = -maxRadius; dy <= maxRadius; dy++) {
double distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
if (distance <= maxRadius) {
Block block = centerLocation.clone().add(dx, -tick + dy, dz).getBlock();
if (distance < maxRadius - 0.5) {
block.setType(Material.TNT);
} else if (distance < maxRadius) {
block.setType(Material.RED_STAINED_GLASS);
}
}
}
}
}
tick++;
} else {
if (tick > maxRadius + 20) {
shouldExplode = true;
}
if (shouldExplode) {
for (int dx = -maxRadius; dx <= maxRadius; dx++) {
for (int dz = -maxRadius; dz <= maxRadius; dz++) {
for (int dy = -maxRadius; dy <= maxRadius; dy++) {
double distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
if (distance <= maxRadius) {
Block block = centerLocation.clone().add(dx, -tick + dy, dz).getBlock();
block.setType(Material.AIR);
if (distance <= maxRadius - 1) {
block.getWorld().createExplosion(block.getLocation(), 4.0f, true);
}
}
}
}
}
this.cancel();
}
}
}
}.runTaskTimer(plugin, 0L, 1L);
} catch (NumberFormatException e) {
sender.sendMessage("Geçersiz koordinatlar. Kullanım: /nuketnt <x> <y> <z>");
}
return true;
}
}```I have a code like this
This code doesn't give error
It does not move downwards. Normally it should move down and when it touches a block it should prime the tnts and erase the red glass blocks
Hello guys, i am very new to plugin development and have a strange issue. When i add anything to the config.yml building just spits an error saying "newPosition < 0: (-1 < 0)
". I don't understand it. Can anyone help? I will provide any code snippets you need.
if you reply please tag me
?paste
Show us how you added the config
deletionDelay: 15
hello, im trying to read uuid's from a config file to assign prizes to them when they rejoin. im having issues with this iseligibleforofflineprize method. im unsure as to why its not working
customFile.set("offline-prizes." + playerUUID.toString(), true);
save();
}
public static boolean isEligibleForOfflinePrize(UUID playerUUID) {
return customFile.getBoolean("offline-prizes." + playerUUID.toString(), false);
}```
```@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
UUID playerUUID = player.getUniqueId();
// Check if the player is eligible for an offline prize
if (CustomConfig.isEligibleForOfflinePrize(playerUUID)) {
player.sendMessage("you're eligible for an offline prize!");
awardPrizes(player);
CustomConfig.removeEligibilityForOfflinePrize(playerUUID);
}
}```
im not getting the message "you are eligible for an offline prize!"
did u register the listener?
I smell a nice filet steak with sauce bernaise
Its much better than static aboooose
Pro tip: next time you want to abuse static, eat a steak instead
Why is CustomConfig static
basically this
any1 knows how i can add fakeplayers in tab with nms?
and how is it easier than passing your config to the listener?
now your config class is not reusable anymore
is there any ways i can use both spigot and mojangs mappings?
Under what logic do you think that makes sense?
Like at that point you'd need to make yet another mappings set
what is the packet that add player to the tab?
why would you?
hey
ServerBound?
i wonder why the compiler likes this
no, it's obviously Clientbound because it's a packet sent from the server TO the client
then does a foreach(player)
You mean decompiler, right?
send packet will work.?
i like to think decompilers mostly just does read what was written
But this has to do with the fact that while (true) is the easiest way to represent a goto without resorting to actually using goto (which is only a reserved keyword in java)
no but i mean send packet foreach player online.
And most loops at their base are just a bunch of GOTOs.
Are you trying to achieve the same thing as essentials?
While/do-while loops are pretty much the only exception as they can only consist of IFNE or IFEQ or other similar opcodes
I can't understand it but you can take it that way
look at essentials code
What do you mean by essentials code
Can any1 help this isnt adding player to the tab https://paste.md-5.net/ecewodegaw.cpp
hmm, isnt the menu clientsided?
and what's the issue with that? isn't that exactly how it's supposed to be?
good luck
any1?
but clicking in hotbar prints "quickbar" and clicking in the inventory prints "contain", how is that the same thing
yes,. that is true. you cannot detect that
clients can also create any NBT'ed items when in creative
❤️ duplicated lores when using packets
How can i detect if the player clicked on an item from their hotbar using InventoryClickEvent and then cancel it?
I know the cancelling
by checking if the SlotType is QUICKBAR
@EventHandler
public void onInventoryClose(InventoryCloseEvent e){
if(e.getPlayer().getInventory().getItemInMainHand().getType() == Material.SHULKER_BOX){
BlockStateMeta temp = (BlockStateMeta) e.getPlayer().getInventory().getItemInMainHand().getItemMeta();
assert temp != null;
temp.setBlockState((BlockState) e.getInventory());
}
}```
and this is giving an error for not being able to cast InventoryHolder to BlockState
Is there anyways i can spawn ServerSide npcs?
Yes but its difficult IIRC you need to use CraftBucket stuff
Assuming you want Player NPCS
Or should i modify the server code itself?
any way of modifying a shulker box item's container?
so what can i do. this is serious
i want to set it
what the hell is that even supposed to do
i want to make it so players can right click the air to open the shulker box and when they close it it stores the contents of that in the shulker box
?paste let me paste it
I already told you how to do that
Block block;
if (block.getState() instanceof ShulkerBox box) {
box.getInventory();
}
``` I believe this is how, atleast from a block
you have to set the updated blockstate back to the BlockStateMeta and then set that meta back to the itemstack
There already exists a plugin that does this
I personally would go for that.
If you don't really know what you're doing there will most likely be errors and possibly dupe glitches.
it opens when right clicking air but doesnt store the contents
i want to put level requirments
becasue you are not setting back the updated blockstate to the blockstatemeta and then setting that back to the itemstack, for the third time now
...is there a channel to help with minecraft client glitches?
Block block;
if (block.getState() instanceof ShulkerBox box) {
var inventory = box.getInventory();
inventory.addItem(new ItemStack(Material.ICE));
block.setBlockData(box.getBlockData());
}
``` Perhaps this should work
an inventory is not a blockstate
an inventory is an inventory and nothing else
you cannot just randomly cast stuff to whatever you like
Have anyone ever encountered error saying "newPosition < 0: (-1 < 0)"? I am very new to the plugin dev, and got this is I add anything in the config.yml.
Config.yml:
deletionDelay: 15
All times I call something connected with the config
getConfig().options().copyDefaults();
saveDefaultConfig();
long deletionDelay = getConfig().getLong("deletionDelay", 600L); // Default: 600 seconds (10 minutes)
long ticks = deletionDelay * 20L; // Convert seconds to ticks (20 ticks per second)
show the full stacktrace
me or @cunning sundial
What is the best way to provide effects to the player when they are holding some item in their offhand?
?paste your pom.xml
https://paste.md-5.net/filafifawe.xml like this?
@tender shard can you Please give the code on how to do this?
Hm looks fine. No clue
try updating the maven-resources-plugin to 3.3.1 in your pom
oh my, i've tried everything. Even deleting every config-connected lines of code, it just denies all my attempts to create a config file
// Get ShulkerBox Item and add item
ItemStack stack = new ItemStack(Material.SHULKER_BOX);
if (stack.getItemMeta() instanceof BlockStateMeta meta) {
if (meta.getBlockState() instanceof ShulkerBox box) {
var inventory = box.getInventory();
inventory.addItem(new ItemStack(Material.ICE));
player.sendMessage(Component.text("WORKED"));
box.update();
meta.setBlockState(box);
stack.setItemMeta(meta);
}
}
This is how you get/Add stuff to an ShulkerBox Item. Tested it too
might be a stupid question, but how? I mean i don't have anything remotely similar to that
show all your .yml files in the resources folder, something's wrong with the filtering
Plugin.yml
name: WayPlayPlugin
version: '${project.version}'
main: org.wayplay.wayplay.WayPlayPlugin
api-version: '1.20'
commands:
startevent:
description: Starts the new event
usage: /startevent <X> <Y> <Z>
Config.yml
deletionDelay: 15
Directory called Schematics
alr thanks
can the director ybe the problem?
Yw
very weird. idk why it's happening, but disabling resource filtering should fix it. try removing this from your pom:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
and then set the version in plugin.yml manually
also you should definitely remove this:
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
it gives no advantage and only causes problems
Many people who are using the maven-shade-plugin commonly set to false for reasons beyond my grasp. This is generally a bad idea, as it can lead to problems if you’re writing a library, and has absolutely no advantages. Here’s a rule of thumbs: If your project shades dependencies, it should create a dependency-reduced-pom.xml. The...
yes
if disabling resource filtering fixes it, the problem is your schematic files
i mean, without filtering it built successfully
ok then the schematics are the issue. we can fix this by donig this:
@EventHandler
public void onInventoryClose(InventoryCloseEvent e){
if(e.getPlayer().getInventory().getItemInMainHand().getType() == Material.SHULKER_BOX){
BlockStateMeta temp = (BlockStateMeta) e.getPlayer().getInventory().getItemInMainHand().getItemMeta();
ShulkerBox temp2 = (ShulkerBox) temp.getBlockState();
temp2.getInventory().setContents(e.getInventory().getContents());
}
}```
i hope it works...
- create a new resources directory, called resources-unfiltered
- Use this resources config:
<resource>
<filtering>false</filtering>
<directory>src/main/resources-unfiltered</directory>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
- move your schematics directory into resources-unfiltered
I have no in the project, those are supposed to be placed by admin in the folder the plugin generates. After installation
show a screenshot of your project structure pls
basically the whole contents of your resources folder
sth must be wrong with that
won't let me
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
huh that is very weird
try adding back the resource filtering and then run mvn clean package
i haven't even run the command and it works by adding it back
it was probably a caching issue
black magic, 100%
probably mvn cleanwould have fixed it
Anyway, thanks for helping
will try nex time
lets hope there is no next time lol
true
can you do a switch instead of an else if chain if you want to be like 'Math random, if below 0.15 do this, if betweeen 0.15 and 0.75 do this, else do this'?
switch ((0 <= num && num <= 0.15 ) ? 0 :
(0.15 <= num && num <= 0.75) ? 1 : 2) {
case 0:
// 0 - 0.15
break;
case 1:
// 0.15 - 0.75
break;
case 2:
// > 0.75
break;
}
why not just use if
this is probability stuff, thorns etc
i end up with at least 8 cases
i presented a reduced example
but why would you want to use switch/case instead of if/else
cuz... its generally faster?
getting a random number is 10 thousand times slower than the if/else
That being said what I do only works because the shaded jar is not the main artifact
on that topic, is it faster to generate multiple random numbers by using a Random instance, or is it neglilible and i can just do Math.random() each time?
Math#random is single-threaded iirc
so is minecraft
So for huge amounts Math#random is bound to be slower than comparable Random implementations
nah i need like 4 numbers
Then the overhead of allocating a random (which in turn also requires a random starting seed) is probably not worth it
ah ok
Yes as I wrote, it only matters if its used as dependency
Though to be honest for that project the limits of Maven become quite apparent
It be great if maven had as many scopes are gradle has.
And even then I'm not sure if it suffices
private ArrayList<Enchantment> enchantments = new ArrayList<>();
is this the right way of storing enchantments for later use?
What use
adding them to an item
Are you gonna use the index of the arraylist or you are going to loop
im gonna use a foreach loop and then add the enchants from there and add a lore listing the enchants
you forgot the ()
Set<Enchantment> dadash_irani_hasti_questionmark = new HashSet<>(); @small current
I am not sure if HashSet is worth it here
It is
You'll at most store 4 items into it
Yes
A plain old array should suffice
Why
doesn't exist
No one is using threads
You meant ConcurrentHashMap.newKeySet()
Well it is still useful as you can do stuff like
for (Object o : set) {
set.remove(o);
}
virtual threads
Why is there no CampFireSmeltEvent? >_<
Well if there is no need for them
We dont use it
i see
For all cooks there is an event
Well being able to use your collections as you wish without a ConcurrentModificationException is still useful
That
And there is also https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/CampfireStartEvent.html but that is probably the opposite of what you want
nope, you cant change campfire cook result
there is only campfire start event
but no campfire smelt event
oh
setResult
in campfire start there is no setResult method, but i didn't test BlockCookEvent
Let him cook
Np
hey guys what event can i use to check when item was moved from slot to slot?
onInventoryClickEvent
Describe moving from slot to slot
With the hotkey it's a direct InventoryClickEvent
Otherwise if you talk about picking an item an droping it somewhere else, then two InventoryClickEvent are fired
im looking for something which occurs when item is equiped to main or offhand or is equiped to armor slot
Basically everything is mapped to InventoryClickEvent
and drag
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
Yup
declaration: package: org.bukkit.event.inventory, class: InventoryDragEvent
You can check the slot and the click type
i will do a project anyone want to code with me (im not good) but can help
u meant u want to help any project or want to get help for a project?
can do both
?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/
Is there a tool that approximates a song in minecraft notes? I know people have been building roller coasters with the paraphrased songs on them usingn noteblocks, but I want a way to convert a .mp3 into a list of minecraft sounds with pitch and volume and play it back using code
Whats the best way to prevent a specific water block from not spreading water?
Noteblock Studio does this afaik
An open source continuation of Minecraft Note Block Studio with exciting new features.
thanks
cancel block from to event
Has anyone ever tried to change mobs spawning conditions?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Why does it send 2? when im looking at a chest? and i ave the permission vagtvault.set
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
if(label.equalsIgnoreCase("vagtvault")){
if(player.hasPermission("vagtvault.set")){
Material chest = Material.CHEST;
Block targetBlock = player.getTargetBlock(Collections.singleton(Material.CHEST), 1);
if(targetBlock.getType() == chest) {
System.out.println(1);
} else{
System.out.println(2);
}
}
}
}
return false;
}
}
Caused by: java.lang.IllegalAccessError: class com.wolfyxon.itemlimiter.ConfigMgr (in unnamed module @0xab24119) cannot access class com.sun.tools.javac.util.List (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0xab24119
at com.wolfyxon.itemlimiter.ConfigMgr.<clinit>(ConfigMgr.java:11) ~[?:?]
at com.wolfyxon.itemlimiter.ItemLimiter.<init>(ItemLimiter.java:11) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
at java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128) ~[?:?]
at jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347) ~[?:?]
at java.lang.Class.newInstance(Class.java:645) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:79) ~[spigot-api-1.19
.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
... 15 more
I get this when the plugin starts
wrong List import
whats the right one?
java.util.List
um
If i set i as 1 is 1 the block in front of you or are 0 that?
Okay thanks
but i use 17
worked, thanks
i cant help but imagine you like this cuz I've heard that damn speech way too often
I'm on the train
but you got the language level set to 8
thats weird
I was using an older version of java recently so I made my own List.of(...) method lol
modern problems require modern solutions
is there any packets to update scoreboard?
Yo guys, any Brigadier-like command library ?
The best I found is CommandAPI, but I don't like the way it does execution
just a lambda with Player and Object[]
Or just use Brigadier
yeah brigadier is probably the closest you can get to be using brigadier lol
Well no you just need Brigadier as a library
.
Just use the api
Would annyone be able to link me to a solid scoreboard api?
the scoreboard api is so messy though. would be nice if there'd just be a method that takes a list of strings and shows that as scoreboard
without having to deal with creating dummy objectives and shit
basically a billboard
thank you
i've made a simple wrapper myself
NameTag is mostly to not clash with Team
it supports per player sidebar within the same scoreboard
Don't think so ?
Minecraft does not allow NBT keys with no value so I would assume PDC doesn't either
Just store a boolean or smth
Any way to do this without the warning ?
yes, check the cast
don't think I can do that
wdym
🤔 Does that return a collection? or is that a stream
a collection
That does look like a stream to me
e -> e.getBukkitEntity()
You can get rid of the anon method
Entity::getBukkitEntity 
There's a difference ?
I thought it was just syntax sugar.
Create method a to run method b
or just run method b directly
oh cool, never knew that
use collector?
toList 
yo, im loading in a json file for text translations and stuff but it seems gson doesn't support special characters. any way i can make it allow them anyway? disableHtmlEscaping on my gsonbuilder doesnt work. the json file itself has utf8 encoding
Why not use yaml
same thing, its there just so you dont have to write .collector(Collectors.toList)
its a big translation file and its a nightmare for my translators to work with
I'm aware
JSON would probably be worse
why would it be worse
not the same it seems
Map it or ignore it
json is easier to debug and harder to make mistakes in imo
eh not really
if you say so
In json you miss a comma or quote or bracket and file is broken
also yaml has variables
Yeah anchors are great
same with yml if you miss a closing quote or one space too many in indentation
and this is just text anyway i dont need variables
Yaml was made for mighty pirates
Valid json is valid yaml
Yes but thats easily spottable and most things dont require quotes
in any case thats not the issue, i dont have a problem with yml and still use it, its just easier to manipulate in my use case
i just wanna know how i can allow special characters like stars in said json files
They should work just fine as long as it's a string
like i said the encoding is being finicky, this (img1) is being translated to this (img2)
your file is not saved as utf8
i mean i think it is, let me double check
nop, set it to utf8 and its still the same
Send the file
its 4k lines are you sure
your file is not saved as utf8 or you are not reading as utf8
maven or gradle? you also have to set that to utf-8 maybe
likely your IDE encoding is wrong
maven encoding was utf8 also but for some reason global encoding was set to some windows shit despite default encoding being utf8
gonna try again
still the same
throw your jar in here and someone will check your encoding
in the generated json file itself it displays properly, seems to be a gson loading issue
are you specifying the enbcoding when reading?
there's such a method for gson?
how are you reading it? BufferedReader, ... ?
you are using teh builder?
or as alex says a reader, if so set teh StandardCharsets.UTF_8
is it possible to have tabcompleter with nicknames in chat without command?
Yes
how?
declaration: package: org.bukkit.entity, interface: Player
can i make appear this tab only after some symbol?
yup that ended up fixing it, thank you olivo and alex
so real
and elgarl
no clue why UTF8 still isn't the default D:
Backwards compat 🤷♂️
😔
would it be safe to assert that itemmeta isnt null here?
i do validation for material higher
Why dosent net.minecraft imports work for me?
Did you run BuildTools with the --remapped flag?
have you ran buildtools and updated theimport?
Sorry i havent used buildtools before, so i have found this java -jar BuildTools.jar --rev 1.8.8 and where should i paste that in?
If you haven't used buildtools before, how have you hosted your servers?...
I havent used it before in a plugin
Prolly some site that hosts 3rd party downloads. Which you shouldn't use btw.
I have a localhost
That shit is illegal, isn't it?
For me everything is homebuilt, every jar I use was made by java -jar BuildTools.jar
It's a grey area, but it's bad primarily for the fact that you don't know what the hosters could have put in the jar file. There's not an easy way to confirm authenticity.
So where should i paste in?
Shouldn't buildtools install the stuff on the local maven automatically? Also, is your maven dependency spigot-api or just spigot?
It does
vault support 1.20.1?
Yes
but spigotMc doesn't say so
yeah idk what's upwith that project
hasn't been updated since 1.17.1 afaik, but regardless it works
ok
If it works, why bother
I mean at the bare minimum just update the number on spigot 🤷♂️
Can someone please help me with buildtools?
I'd recommend using the GUI: #1117702470139904020 message
You can build whatever version you need without the command line.
what do you need nms for?
And make sure you have spigot instead of spigot-api in your pom!
^
Titles in 1.8
and also help why section == null
Wait, does 1.8 not have player.spigot().sendMessage(...) or whatever it was?
components didn't exist in api until 1.13 afaik
Titles aren't that bad though. I had to use them all the way back in 1.9 and it wasn't horrible.
WUW
could've been slightly earlier
We need an open-source nms thingy doing lib
did mojang even use components in 1.8?
Your section is null if it doesn't exist. Check your path.
So should i just download the version there or what?
If you want an easier time running BuildTools, then yes.
Otherwise you'll have to use the command line.
That one server admin with his windows 95 pc waiting 7 and a half decades for buildtools to finish:
file exitst but why null(
Sadly can't do anything about people's internet connection speed. :p
i just load section
The section you are trying to grab probably doesn't exist in the file you have loaded.
Most likely reason for it being null
I'm thinking about buying a pc, because I only have a laptop rn, but I'm not rich and I'm unsure. There is a good thing (I can build spigot jars blazingly fast if I have a pc) and a bad thing (big box ahhh)
but how? file not null so section should to be not null
Mini PCs are pretty decent now if you want something small form factor. Although if you want to play games, you'd want an actual desktop build though.
That's not how that works.
I want a beefy, killer pc that can build jars in nanoseconds and launch modded minecraft in less than a whole evenig
Pay attention here.
The file may not be null, which is good.
The section in the file that you are looking for may not exist resulting it the section being null.
lol
then how i can get file manager for getting data
section != fileManager?
i mean his path
just (for comparison) it seemed to me FileConfiguration end file is like location end locaton.getWorld
Wdym? You can get whatever value you want using ConfigurationSection#getXYZ()
which inventory is for camel?
You can use spigot ConfigurationSerializable api to serialize any object you want and store it in a
FileConfiguration
File file = new File("config.yml");
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
config.getInt("path.to.int");
config.getDouble("path.to.double");
``` Doesn't get much simpler than that. ¯\_(ツ)_/¯
I do this but for some reason I get null
YamlConfiguration.loadConfiguration(file); - this is null
Dont they just have a simple UI to add a saddle?
are you forgettign about teh getDataFolder()
What does your file object look like?
i need to get saddle inside the camel
no this derectory
Oh
Well there's your issue
You can't load a directory into a ConfigurationSection
You need an actual YML file
Camel#getInventory() returns an AbstractHorseInventory which has a getSaddle() method
1146519473663262720
if you want to load a directory you’ll need to list all files in the directory (google) and run loadConfiguration on each
oh wait
ty
i get derictory
end load files
in this derictory
if this not exists i create derictory
definitely not null, just empty maybe
end what this mean
what are these called in snakeyaml?
The empty part is normal
really
Lists of a configuration section
but idk how to do that in snake yaml, I’ve tried a few times
how would i iterate over these / set them?
you mean section exists?
yes because it’s saying that there’s no key. That’s normal because you’re at the root. Notice how the next sections have entries for that
yes bro section exists
map list in spigot
so check impl ig
So whhen i have been downloading buildtools will it automaticaly be in my project from now on or do i need to add it as a depency or something?
bruh🥶
?nms
read
BuildTools will automatically install all spigot api related stuff into your local .m2 directory. Basically yes.
?nms
so if section.getPath = ' ' - this shold be normal? this not give me file path??
File path and section path are two different things.
You have to load the file using the file path first, then find the data you want in that file using the section path.
oh
So everytime i am creating a project i am going to the project stuctor and adding spigot should i just remove that now or what=
This process is simple.
-
Run BuildTools with the version you want to make your plugin for.
-
Create your project
-
Done
-
Create another project if you want.
You only have to run BuildTools if you don't have a specific version installed or need an updated version of the spigot jar.
But my question is when i am creating a new projekt should i do it with the "minecraft plugin" on intellij or should i just create a projekt as normal and add the spigot shaded.jar or what it is called
You can do it however you want. The MCDev plugin is just a convenience tool that does some setup for you. Although people say the plugin has memory issues. (I haven't ran into any though, but mileage may vary)
If you are using the minecraft dev plugin then you never add any jars to your project. You use maven.
(or gradle)
You can do it however you like. Just dont mix up manually adding jars and building artifacts with something like maven or gradle.
Yes but my question is from now on do i need to make the plugin with the minecraft plugin
you can make the plugin with mcdev and then update it
Becuase i have downloaded buildtools now but the nms imports dosent still work
you need to change the dependency
The plugin is just a tool that does some of the normal setup that you would do anyways automatically.
Downloading and running are two different things. Did you actually run BuildTools?
I did the thing in the git app where it loaded many things and downloaded it or what its called
once you've ran buildtools for 1.8 you need to change ur spigot depdency from xml <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot-api</artifactId> <version>1.8.8-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency> to ```xml
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8.R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
They are using 1.8
oh
Ik
Well then scrap everything. Just look up a random tutorial from half a decade ago, throw everything together and hope for the best.
PACK ER UP BOYS
But just a question, when you mean run do you mean double clicking on the buildtools.jar? becuase i did that with a fault
More or less. Having BuildTools compile the version you need is what I mean by running.
Did you press the Compile button in the GUI for the version you selected?
I didnt download the buildtools gui i downloaded everything from the start
So you ran it from the command line then?
Using java -jar BuildTools.jar --rev 1.8.8?
Yes
As long as you got the Success message at the end, then you'll be able to use NMS
So the nms imports are working exept for one, the import net.minecraft.server.v1_8_R3.ChatSerializer; isnt working
Yeah i did
IIRC, ChatSerializer is a subclass of IChatBaseComponent
yeah
https://mappings.cephx.dev/1.8.8/net/minecraft/server/v1_8_R3/IChatBaseComponent$ChatSerializer.html
version: 1.8.8, hash: 10a28f86e8
So i should import IChatBaseComponent?
how to save yml config after adding there value?
FileConfiguration#save(File file)
Or JavaPlugin#saveConfig() if you are using the default one.
ty
How can check in plugin if player join using 'premium' account
online-mode: true
By using online mode, then listen to PlayerJoinEvent
Whenever I set it to false. Save and restart server it auto changes back to true
Does anyone also have a crate plug-in for 1.20.1?
excellent crates
Didn’t work
That would only ever happen if you used the -o flag in your startup script. (Which I believe was removed a long time ago)
did you install nex engine too
it comes in the zip you download
I uploaded it and the zip didn’t create a folder on server restart.
I’m putting the zip straight into the server files
that is wrong
^
do what i just said to do
I only have 1 zip for it?
It's a bit late, but the problem was that Minecraft changed how the data is stored - individual values are no longer cut in two if they don't fit into the remainder of the current long. Figured that out a while after that comment after reading trough the relevant article on wiki.vg again. Strangely the new 3D biome data does seem to be packed ...
But it is an option to set up as a zip
who knew extracting from a zip file could be so hard
Not me
?paste i wanna use it
downlopad it, double click it, select the 2 jars, press control+v go back to teh downloads folder, press control+v then upload the jars to the server
2 clicks is apparently too hard for some
or just right click and extract
Is this a good time to say I’m on a iPad 💀
https://paste.md-5.net/orafamariq.rb
What is this error
is there any repo that i should implement for bstats?
that explains it
Could u dm me the right file?
What is nex engine sorry?
the api the plugin requires to work
The core lib needed to run that plugin
Oh okay thanks
Thanks guys so much I’m trying it now
Also idk if this counts as help-dev
But you know how like most mc server websites have the same ish template for there website
How do u get the templates?
tebex most likely
I’ll look into what that is 🤔
When does BlockExplodeEvent get called? I tried it with creeper but it didn't work
beds in the nether
Then how can I handle fireball or creeper explosions?
EntityExplodeEvent?
EntityExplodeEvent
Thanks
Why when i'm trying to get something from config file after reloading of the server it returns instead of data memory section?
when a block explodes
And how to get data from Memory Section
by using one of the thousand getSomething(...) methods?
?
Could you try to rephrase that? I have honestly no idea what you are asking...
How do I track player specific kill? I was thinking of Arrays to help me but I never really knew how
Like if PlayerA kills PlayerB, I want it to make a score to SPECIFICALLY count PlayerA's kills towards PlayerB
With PlayerA to PlayerC or PlayerA to PlayerD having their own seperate scores
So... After adding field in config file, and restarting server, config.get("field") returns instead of data, memory section and idk how to work with it
get should return an object
cast it to what you want or use the getX method
eg for string
(String) config.get("path") or config.getString("path")
The overlying structure would be a Map<UUID, Map<UUID, Integer>>
But the actual implementation should be something like:
PlayerKillCounter -> contains a Map<UUID, PlayerKillStat> which maps a players UUID to a PlayerKillStat object.
PlayerKillStat -> contains a Map<UUID, Integer> which counts the kills for each player.
Make sure you take a look at maps.
all this time ive been running gradle with 64mb of ram and having 1 min nms builds
I run System.gc() every tick to clear every useless object in memory and it works but I have 17 TPS, what should I do??
with 1gb its a solid 11s
Ah. Just use getInt(String) or some of the other methods which return serialized data
stop being a troll
?
I should probably mention that I'm completely new to Java and Plugin development, so I have no idea what you just said there, you're gonna have to explain a bit more easier for me, even if its on dms
is in getObject second argument class of object?
What are you trying to get?
HashMap
Of which type
Run BuildTools for that version on your device
smh
Thats what I did
Map<String, Map<String, String>
Do I open it from here?
yeah i think it's better
This will be stored abstractly as a ConfigurationSection
i hate you
I opened it up CraftBukkit folder in Intelji
that makes 2 of us
why would you ever make double map???
So, how to get this?
getObject("field", ConfigurationSection)?
this is literally n² amount of memory used
Bukkit, Spigot and Craftbukkit are each projects you can open.
Ok
yeah
Is it advised to be running 6 servers on 1 pc. All 6 being only 100x100 blocks, bc someone told me no but there only small servers being like a 100x100 block server.
i read the whole source code
So I got that err when opening CB
Is it gonna corse a problem or is it fine keeping all 6 on 1 pc?
If you have 6 cores then this shouldnt be a problem at all
CPU core threads
thread isnt core
Correct
core can have multiple threads
Yes but i included hyperthreading. 3 cores 6 threads should be fine as well
so, the best would be, to have 24 cores
Which is included by saying core threads
lol
getConfigurationSection("path")
tldr depends on the CPU
path is the name of the frst field?
And memory if we are at it
Path is the path to your object
though it's probably not going to need much memory
like what?
since the worlds are small
Is a £500 mini pc likely to have this?
i have something like
playerId:
section:
field1: String
field2: String
then if i want to get "section" i should do like getConfigurationSection("playerId")?
getConfigurationSection("playerId.section")
[ERROR] Failed to execute goal on project craftbukkit: Could not resolve dependencies for project org.bukkit:craftbukkit:jar:1.20.1-R0.1-SNAPSHOT: org.bukkit:bukkit:jar:1.20.1-R0.1-SNAPSHOT was not found in https://libraries.minecraft.net/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of minecraft-libraries has elapsed or updates are forced -> [Help 1]
[ERROR]
oh ok thx
this:
is:
an:
example:
list:
- "x"
- "y"
- "z"
FileConfiguration config = ...;
List<String> content = config.getStringList("this.is.an.example.list");
oh i got it thanks
.?
hell
no
what
the
hell
Go into your system setting and tell us your specs. Then well give you advise on it.
All though this is more of a #help-server discussion.
How do I fix this?
I do not have the pc on me rn but I will look when I can. This is bc I’m hosting on the pc but operation it through Wi-Fi on my iPad 😅
what?
So I think there is better way to save this sections instead of adding HashMap<String, HashMap<String, String>> to config file, isn't it?
yes
Yes?
Map<String, ?>, ? being whatever you need it to be
So Map<String, String> if its a string value
.put(some.plugin.config.id, getConfig().getString(some.plugin.config.id))
So I’ll tell u the specs later
So what is it?
Figure it out
You can store any arbitrary Object in a FileConfiguration by letting it implement ConfigurationSerializable.
Make sure that you follow the javadocs on this:
i didn't follow the javadocs at all...
Is there a place I can send photos In here?
why not just use DFU
you can make account on spigot.org and verify it in #verified to send photos
No access
For example you could have a whole data manager stored in a config and simply load/save it like this:
FileConfiguration config = ...;
PlayerDataManager dataManager = ...;
config.set("manager", dataManager);
...
FileConfiguration config = ...;
PlayerDataManager dataManager = config.getObject("manager", PlayerDataManager.class);
! As long as you let PlayerDataManager implement ConfigurationSerializable !
dfu is chad
im trying so hard to understand this, I'll come back to you when I actually manage to get the hang of HashMap
does any1 know if there is a way to use Minimessage on item names?
Ima send a photo in #verified
Only if you translate them before applying or on outgoing packets
oh
DFU?
im using LegacyComponentSerializer rn that works. but stuff like rainbow just shifts by whole colors
data fixer upper
I thought this was burried
nop
never
isnt it better to use gson?
stll used
for yaml?
for yml something else
I would prefer Gson as well.
yml is better for configuration files but if you
want to persist data i would go with json.
alr ty
use dfu with jsonops
for json, dont use just gson

dfu is great way of handling json
and nbt
and other formats if you implement them ofc
DFU is overengineered for most people's purposes
what dfu?
see above
Didnt really dive deep into it, but isnt it only useful if you have potentially changing schemas
between versions? Doesnt make much sense in most cases.
Correct
i mean it isnt so hard to use anyways and it can do many stuff tho
You can say the same thing about Docker and K8s, but I'm still not going to use that to spin up my local test server lol
.s/most/all
secretly put a server on ur gfs pc and add ftp and test on that
I mean I just have my own VPS
I don't need my girlfriend's desktop for it
but the desktop is free
True. Who needs a gf if you have your own root server. 

choco who is ur work husband
Is that a thing people have?
@worldly ingot pr whore', this is ur job
Did you build Bukkit first
Sorry i'm not very smart, and it's a bit hard for me...
playerId:
section1:
field1: String
field2: String
But is it convenient to create a new class with only two fields to store data?
I think there is easier way...
run the install goal then reload craftbukkit maven
i feel very stupid..
Yeah this is totally fine
These are called POJOs, Plain Old Java Objects
if you could be any exception what would it be
This Install?
yeah
Okie
id be no class def ex or npe
Minecraft has alr a combat log?
public void onEnterCombat() {
super.onEnterCombat();
this.connection.send(new ClientboundPlayerCombatEnterPacket());
}
public void onLeaveCombat() {
super.onLeaveCombat();
this.connection.send(new ClientboundPlayerCombatEndPacket(this.getCombatTracker()));
}```
combat tracking more of combat loggign
yeah
I'd be a HeadlessException
It does but it hasn't been used since forever. It was primarily used for Twitch integration iirc
So like... 1.7?
how i can i use that to prevent freecam or phase
protected void onInsideBlock(BlockState iblockdata) {
CriteriaTriggers.ENTER_BLOCK.trigger(this, iblockdata);
}```
@young knoll what about you
You can't. Criteria triggers are for advancements
You can't stop people from free camming. It's entirely client-sided
The client is sent world data too so it's welcome to explore it however it sees fit, especially if it's just moving the camera about and not actually moving the player entity itself
What about for phase?
should I do this, or make it a class, or do something completly different
this weeks snapshot waas fuckin shite
how to delete field from config file?
set it to null
anyways to spawn server side npc
Use Citizens
no but with custom pathfinding etc
Yeah Citizens
how does citizens do?
what is the twitch integration it nedver wroks (the button being it)
like nothing happens
is there source ocde?
Yeah it's open source
oh nice
Also just use their API
The Twitch integration was sort of half-baked and incomplete so it not working anymore is likely just as a result of Twitch's API changing
I will try to remake similar
No need to make yet another implementation
do you have a link to an article about it
or should I just fgind mc src
to learn about it\
It's not worth learning
That's been done so many times and it's just a waste of time
It doesn't exist anymore
SethBling made a video about it 9 years ago if you'd like https://www.youtube.com/watch?v=UqDpDIbT-OY
Minecraft+Twitch one-click streaming integration is a new feature coming soon to Minecraft. I give you an exclusive first look at the feature as I help Dinnerbone test it out.
SethBling Twitter: http://twitter.com/sethbling
SethBling Facebook: http://facebook.com/sethbling
SethBling Website: http://sethbling.com
SethBling Shirts: http://sethbli...
I can access Craft stuff
Hm
GameProfile is in authlib
<repositories>
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.5.21</version>
<scope>provided</scope>
</dependency>
</dependencies>
but what do you need it for?
Just curious
I dont need it
Im really after NameTags
over head, with the ability to have diferent colors
so rainbow for example
bring this back

Remember when they added the custom world generation? and then they just removed it
That was actually a great feature
why this isnt working
packet.send(new ClientboundMoveEntityPacket.Pos(npc.getId(), (short)(3 * 4096), (short)(106 * 4096), (short)(5 * 4096), true));```
Hello so I want to get yaw to rotation and found smth like this
public static Rotation yawToRotationBackpack(float yaw) {
return Rotation.values()[Math.round(yaw / 45f) & 0x7];
}
but it's placing it forward (first photo) and I want reverse of it (second photo), how I can arvhieve it?
try ```java
public static Rotation yawToRotationBackpackReverse(float yaw) {
int totalValues = Rotation.values().length;
int index = Math.round(yaw / 45f) & 0x7;
int reversedIndex = (totalValues - 1) - index;
return Rotation.values()[reversedIndex];
}
I find it terrible that they believe that datapacks are a suitable replacement for that
Like no - I ain't going to learn datapacks just to have fun for a few minutes
It was so easy to just click create world and use the GUI and then boom you have th exact world you want
datapacks is mostly commands
I'm confused. I'm using intellij. I have a config file called tools.yml, when it's empty it is fine. When I add my desired content, it errors with newPosition < 0: (-1 < 0), if I then rename the file, it's fine. Any ideas?
What class is Rotation
.
Sounds like an intellij plugin thinks tools.yml belongs to it. Maybe a stack trace would help
It's hell of a pain/time conssuming for me to make one full biome via datapack, I mean learning and testing each thing untill it will be like I want to
Seems like an enum
yup its enum
Idk, where is it being used
tried now and nope it place at an angle;/
Looks like it's for item frames
exactly yes
to place custom furnitures on item click/use
If that was the case why not just call rotateClockwise twice?
Are your furnitures based on item frames
@signal kettle java public static Rotation yawToRotationBackpackReverse(float yaw) { int totalValues = Rotation.values().length; int index = Math.round(yaw / 45f) & 0x7; int reversedIndex = (index + totalValues / 2) % totalValues; return Rotation.values()[reversedIndex]; } try that
yes they base on item frames
Not sure if I have a stacktrace? This is when doing any of the lifecycle tasks for Maven, such as package. All it shows the package, the jar:version, 'resources', then the newPosition text
learnjavanotbukkitlearnjavanotbukkitlearnjavanotbukkit
what
not related above
how i can get itemstack from player hand?
player.getInventory().getItemInMainHand()