#help-development
1 messages · Page 918 of 1
can you send your pom
Can i dm you?
no
?paste
fr
!paste
yeah msg the dev I'm not really sure
okok
I'd love to show you, but like I said, I can't even call expressionParser
It's something weird with my build probably idek
One question before, which spigot dependency to i need to use to get those classes in 1.20.1:
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_8_R3.WorldServer;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
Back in 1.8 i could just import them
cant you like show a screenshot? :)
But in 1.20.1 paper api doesnt find
or even normal spigot doesnt find
then i tried remapped => same.
https://mappings.cephx.dev/ you have to find the equivalent on here
What all do you want to see?
some of them might be a pain you have to find their 1.20 equivalent if they're deprecated
But they wont be in there because its api:
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
or?
thats paper
I mean, nothing happens... It's as if ExpressionParser doesn't exist
Which is why I'm so lost... the dependency is fine
If you need to access NMS classes from inside your Spigot plugin, it is a very good idea to use the so called Mojang mappings. Disclaimer: This post is written for 1.20.4. If you use another version, you of course have to replace every occurance of “1.20.4” with the version you actually use. What are...
spigot
the remap plugiun is for spigot
spigot plugins can run on paper servers
Do i HAVE to use remapped or can i use normal spigot? im so confused
<groupId>com.github.FourteenBrush</groupId>
<artifactId>MathExpressionParser</artifactId>
<version>1.0.1</version>
</dependency>```
With the jitpack repo, maven takes it and it's fine up until trying to actually use it
if you want remapped methods (you do) you have to use the remaped-mojang classifier
but keep in mind none of these imports will resolve because they're using diff names
so you'll have to find the Remapped equivalent
i did a push that makes the project java 17, gotta have to wait till the jitpack build is finished
Perhaps that's the reason... just let me know when it's finished
yea then i find it and methods in it are missing
bruh stupid java, it compiles but it doesnt
A lot of nms has changed, it's not as easy as just updating the version name unfortunately
you'll have to rewrite a portion of it if you want to use remap
u know how hypixel got those "pets" in the lobbies? (parrot, sloth...)
how can i easily make them? is there a library for that, or should i hard code it
you can use blockbench and a renderer plugin
not specifically pets only, but things that are similar
ah
can i pay u to do that? xd
pretty sure @torn shuttle is making one
believe it should be working
if jitpack refreshed its cache atleast
Same issue D:
get into dm
If someone is able update NMS Classes/Methods from 1.8 to 1.20.1, DM me. Im paying up to 100€
?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/
also depending on the size of the plugin it may be more than €100 just saying
?paste
Am I missing something? When it spawns, it already appears with the translation ignoring the interpolation. Spigot 1.20.4
Yeah, you're setting the transformation around the same time it's spawned on the client. Give it about a tick or two before actually changing its transformation
It's strange because this doesn't happen to me in another project
But with 2 ticks, it worked fine. Thanks :)
is it possible to make a sound follow an entity?
No
Sounds have a position from which they are played
but this position cant be changed
You can stream mono sounds directly to the player
player.performcommand does check if a player has permission to execute that command right
like if the server ran randomguy.performcommand("ban Unknown_abs") it wouldn't actually ban them right
...im pretty sure it does
can gradle change constants in my project , if yes how can i do it?
like for example I want to replace "XContant" in
private static final String CONSTANT = "XContant";
in compile time
permission checking is performed by the command itself as it's being executed, performCommand will trigger that just as if the player was typing it in chat
Its easier to have a middle man file
Is there a way to specify the main class of a plugin outside of plugin.yml? I've forked a plugin from github and I can't figure out where it specifies its main class (I know what the main class is)
If its gradle it might use minecrells build.gradle config for it
Thanks, it was specified in the gradle (not sure if minecrells or not). Since you seem to know some things about gradle: I was trying to add the paper api to build.gradle using the instructions on their website (https://docs.papermc.io/paper/dev/project-setup), but adding the third block gives the error The new Java toolchain feature cannot be used at the project level in combination with source and/or target compatibility I'm confused because I haven't set sourceCompatibility or targetCompatibility anywhere. Is there somewhere other than build.gradle that it could be set?
i got it right omg
like a constants.properties?
or smth
Plugin is RPGInventory which hasn't been worked on by it's author for a few years. I modified it a bit to add support for MMOProfiles, but the only other change to build.gradle is adding the three blocks from the paper documentation. https://paste.md-5.net/xededogida.cs
heya, anyone know how to run code every x number of seconds with a bungeecord plugin?
I would be impressed if it didnt
how do i get all the players but sorted from the closest from a entity to the furthest from an entity?
you can use getNearbyEntities() which is part of the World class
thank you
Is there any way I can disable the arm swing when clicking a noteblock?
woah hold up
is the velocity of a controllable mountable entity the velocity of the entity mounting it?
Are data classes bad design ?
no, but it depends on what you are calling a "data class"
newPosition < 0: (-1 < 0)
im getting this error after typing
chestDisplayTime: 100
in my config.yml
does anyone know what it means?
probably a formatting issue
What do you consider a data class?
that is my entire config.yml
Doubt. try /walkspeed 10 and riding a pig
Stacktrace?
where can i find this?
When an exception / throwable is thrown you get a nasty error with a stacktrace (what's printed after the error)
there is nothing there
no inage, 404
you're broken
^
is that your whole config.yml?
yes
^
then it's impossible for that to cause your issue
run mvn clean
then try building again
Fields getters and setters
uh So Java
But No funcionality
ty it worked
Where do i put the funcionality tho?
It sounds like you need to re-think what you are doing
data is just that, data. Operations on that data are not data
your "facade" / manager class
You have a UserData class and a User class. UserData holds all data while User holds all your functionality, if it needs to be per user and not a Holder/Manager across all.
ehh
that adds complexity
In some cases yes, that's good
I'd argue that's more in favor of hiding volatile / instance data
Woukd it be Bad tho to put funcionality in the data class am im using the data in the functiond either way?
It really all depends on wether the User can change its own data.
For example on my skyblock core I use that pattern to separate InstancedIsland (world, IslandData) with IslandData (islandId, ownerId, members)
Depends
You're adding more points of entry which is not great
But it's generally acceptable
Let's say you have something like uh
public final class UserPopularityData {
private final UUID userId;
private int likeCount;
private UserPopularityData(UUID userId, int likeCount) {
this.userId = userId;
this.likeCount = likeCount;
}
public static UserPopularityData create(UUID userId, int likeCount) {
return new UserPopularityData(userId, likeCount);
}
public static UserPopularityData create(UUID userId) {
return UserPopularityData.create(userId, 0);
}
public void addLike() {
this.likeCount++;
}
public int getLikes() {
return this.likeCount;
}
}
Ok
This, by norm, is fine
Now, could you go the extra mile and make a package-private setLikes method and having your whole manager class be responsible for modifying? absolutely
So god like Manager that do everything from a encapsulated system?
Your UserPopularityTracker class would be responsible for implementing the addLike / setLikes / removeLike / clearLikes methods
And it'd just call the "hidden" setLikes method
Okay
It'd also be responsible for creating the data itself
But instead of making the setLikes method package-private we can instead extrapolate the UserPopularityData to an interface, provide read-only methods and make the setLikes method not part of the interface, but rather the implementation
and now we're starting to over-engineer this
😛
Okay this is so complex for just having setLikes in a data class?
Well, there's simple code and then there's enterprise code
I'm going the overengineered enterprise code route
but this is simple and acceptable in 99.95% of cases
Guys I need help, I'm trying to make a plugin where there are schematics of rooms, and I'm trying to get a random schematic, and summon that schematic besides the previous schematic, and it would look like a infinite randomised rooms connected to each with an opening.
My main plan is to set a main room, then following up an infinite amount of rooms, but not really infinite AT definition.
I want it so that after the player has passed 3 rooms, the previous room would degenerate, and it would generate another room in front of the 2 rooms, which are already generated.
So where are you stuck as now?
Getting the random schematic, and the generation.
As of now I have set the commands up, like setting the main room, setting the schematics.
I'm not really familiar with schematics, but as far as I now those are file containing some block placements right?
So depending on how many schematics you have you can wether:
- load them all in memory (such as a list) and fetch a random one each time you need one
- or list your schematics directory and load a random file on this directory
(PS: you might like to avoid generating two similar rooms one after the other, for the player's experience ig)
For generating what do you mean? Actually generating the schematic, or the process on when should you generate a room based on the player's location ?
generation = pasting for him
i think
would be the obvious
hm
like depending on how big the schematic is yk
sometimes big ass schems could lag the server
will it generate a new room?
So for pasting the schematics you really have two ways;
- the easiest is to use WorldEdit's Schematic API, which contains the methods for loading, pasting (and even saving schematics)
- make your own schematic format (including making the saving, parsing, and generating)
I feel like we're already beyond this stage
If there is a degeneration ig that he plans to "close" the possibility of going back (maybe some kind of doors like many famous horror games)
Yeah so we're past the point of "how do I paste a schematic" and the true question is how do we track this data
Spigot has it's own Schematic system https://hub.spigotmc.org/javadocs/spigot/org/bukkit/structure/StructureManager.html
This problem breaks down in a few steps:
- Picking what room to paste
- Knowing what room we're in and how it's related to the rooms around it
- Unloading rooms and sealing off? its neighbours
i'd like to say we is the best way to go
And I feel like we want a kind of graph structure for this
public class RoomInstance {
private final RoomTemplate template;
private final Point position;
private final Collection<RoomInstance> neighbours;
}
If he picks random rooms it means that the problem is very simple: each room has same dimensions (at least in one direction) and the opening of each room is standardised
Yeah
So only tracking a direction coordinate seems enough
And each time passing the coordinate modulo length of the room, do something
We need a constant scale to determine
- Where to paste
- Where a room starts and ends
Do u guys know the famous horror game on roblox called "Doors"?
I think you might be disappointed if it's standarized ahahah
¯_(ツ)_/¯
I worked on a randomly generated dungeon system before
a solid 3 years ago
it's a pain in the ass
I love those kind of problems
Well, it's exactly like it, where instances of rooms have been initialised in the code, and there are doors, as per the game name itself.
And, whenever a player walks through the door, it triggers an event, and the room, which was generated 3 rooms ago, would degenerate, and the door would close in front of it.
I do have a idea tho, could I use the files name to it's advantage, where there will be a list of strings, which are the file names, and choose a random name, and paste that schematic file?
Well
I already gave you most of what you needed with generation here
Now we just need to define
- The room template class
- Our room template registry
Your room template is basically your schematic
Ye
It might also have some kind of list of entrance directions
Let's just make it an interface for now
public interface RoomTemplate {
String getName();
void paste(Location location);
}
We can add metadata to this later on
@dusk moth is it a straight line room generation or might it changes direction for some rooms ?
Straight
This also allows us to use both worldedit schematics and bukkit (nms) schematics
And let's make our little registry class
public class RoomTemplateRegistry {
private final Map<String, RoomTemplate> registeredTemplates = new ConcurrentHashMap<>();
public RoomTemplate getTemplate(String id) {
return this.registeredTemplates.get(id);
}
public void register(RoomTemplate template) {
this.registeredTemplates.put(template.getName(), template);
}
public RoomTemplate getRandomTemplate() {
...
}
}
Something like this
Oh and I also wanted to ask, can I store a number of locations instances in a list, and get a random instance of that location, so that a chest could be spawned on the random location from the list?
Ideally instead of random templates we'd have a bunch of picking strategies and some kind of context system
Yeah that can be part of your metadata on the RoomTemplate
Let's rework the getRandomTemplate part into a generator class
public class RoomGenerator {
private static final int SCALE = 16;
public RoomTemplate getIdealTemplate(RoomInstance previousInstance) {
return ...;
}
public RoomInstance createRoom(RoomTemplate template, Location location) {
Point point = new Point(location.getX() / SCALE, location.getY() / SCALE, location,getZ() / SCALE);
template.paste(location);
return new RoomInstance(template, location); // The method calling this is responsible for registering neighbours
}
}
We can expand this class a bit
No, like I mean, say for example I have a big maze, and I want many chests with a diamond inside it on random location of the maze.
I make command, where I can set the location of a random spawn, with its own getter name.
I store that location into a list.
And so, before the maze minigame starts, it would generate all the chests before hand, at the random locations.
I believe at the time we used signs for that
that ran scripts
When the room was pasted / when a player got nearby
why am I writing this entire system for you
Place the chests in teh schematics, then insert a diamond in random ones as they spawn
I'm srry, I'll try to make this conversation short. I just want the base idea of it to be cleared
Well, thank you guys, I will try out those options
And srry for bothering you all.
I liked seeing the system being live coded bellow my eyes ㅠㅠ
Can't imagine the muscles aching 🗣️🔥
im bored
What do u call a mob which makes you angry?
boss
A pro-evoker!

That reaction was way better than my friends.
not the entity speed I mean the literal velocity you get from getVelocity()
I think this .toString has side effects making the code work perfectly in debugging
dies
deja vu
well I am almost done with this
I think the only bug left with my display enities is just the origin compensation system I put in for armorstand, just gotta find a way to decouple it
ngl this is kinda nightmarish
It's been quite a long time since I've coded a plugin.
Is storing Player UUIDs as primary keys in tables good?
Hey ! I'm investing plugin development and I have this code :
@EventHandler public static void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
Material material = block.getType();
if (material.equals(Material.DIRT)) {
player.sendMessage("Tu as cassés un block de terre.");
}
}```
It seems to be right but I still have an error :
```java
Required type: Material
Provided: BlockType <capture of ?>
Change variable 'material' type to 'BlockType<?>'
___
org.bukkit
@deprecated
public enum Material
implements org.bukkit.Keyed, org.bukkit.Translatable
___
Deprecated
spigot-api-1.20.4.jar
I'm using IntellliJ and trying to dev' this for MC 1.20.4
Where did you get this jar ?
Material is not deprecated on Spigot
You're using a weird snapshot build
This seems like the material rewrite
Yep
on the spigot API things where you can download those
Hi guys, I have an gradle project with submodules and I just made a module depend to other one but I'm getting ClassNotFoundException but at the project the classes works. Any idea? If you need code or something tell me
Okay but if I'd like to use 1.20.4, what should I do ?
You should be using BuildTools to build the jar yourself.
You need to shade your modules
wait
buildtool
Import the existing 1.20.4 api, not a weird 1.20.5 build
I misunderstood
?bt
It's not .5, it is ?
Ohh okay, let me see how I do it
Iguess
You're using a 1.20.5 development build
BuildTools
going outside with the doggo, taking a small break then... Get back to work !
C ya and thx for the help !
wait
in the BT
java -Xmx4G -Xms4G -jar BuildTools.jar --rev latest 1.20.4
pause
my buildtool bat
"Select Version", I use 1.20.4 ?
or just doubleclick it since we now have UI
but the new version has gui
yeah the new build tool has it
😎
Can I somehow make this not appear under specific circumstances, or change what it's wearing, or anything of that sort to make it appear different?
Not unless you add a unicode char with a texture that covers it in the title
Fucking autocorrect
Did that, didn't work, it renders over the title
Use negative space fonts
You can move it around with those
This is the texture, I'm using negative space, but the entity renders on top of it
Ohhh
I don't think you can then unfortunately
Even if you could it'd require going from the ground up In NMS which is uhhh not fun
nah it's entirely client sided
Sadge mojank yy :(
i ve now just read that dataclasses are bad design because they lack meaningful behaviour
Their whole point is to store data
where did you read that?
if a manager only interacts with the data contained in such object cant they just contain the managers methods in the first place
pretty much everywhere, where code smells are discussed
I disagree
okay
java literally added record classes for data classes
yes but coupling these classes to a manager isnt really needed as the manager also just uses the data thats already there?
I've seen somewhere that someone succeeded to do so and iirc he used shaders
Its all about how you want to expose that data to the user
Like red for error lmao
am i not the user?
That's still a great practice to do so. And when programming in oop you're the client of your own code
but the bt doesn't seems to work for melmao
As said before, it's well builded but don't work in Intellij
That breaks SRP
The point of data classes is to contain data, the manager class is responsible for collecting it
okay so static manager?
point of entry?
delete their dat file while they are offline
@kind sundial huh what are you talking about here?
Like
I can't show you because despite I'm verify, I can't paste img.
Fun
but I used the BT to get the 1.20.4 jar I needed
?img
also, you clearly are not verified
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
I also assigned it as a module in my intelliJ project
you did what
but it's still not working out, when I do that all of my code become an error
do you not use maven/gradle ?
I build the 1.20.4 jar I needed using the BuildTool, then I choose it as a module in my IntelliJ project.
What's that ?
I just followed a tutorial... ;-;
bad tutorial then
I do not know how to guide you to the correct resources
Hopefully someone else knows
Ah, sad... dw
What I don't understand is that it's seems to be something really important but I still can load the plugin and do things
Still not working
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
if (event.getMessage().equals("math")) {
EntityPlayer player = ((CraftPlayer) event.getPlayer()).getHandle();
BlockPosition bp = new BlockPosition(player);
PacketPlayOutOpenSignEditor packet = new PacketPlayOutOpenSignEditor(bp);
Generator generator = new Generator();
generator.nextFormula(ThreadLocalRandom.current().nextInt(14) + 1, ThreadLocalRandom.current().nextInt(2));
NBTTagCompound ntc = new NBTTagCompound();
ntc.setString("id", "sign");
ntc.setInt("x", bp.getX());
ntc.setInt("y", bp.getY());
ntc.setInt("z", bp.getZ());
ntc.setString("Text1", "{\"text\":\""+ generator.result+"\"}");
ntc.setString("Text2", "{\"text\":\"Answer:\"}");
ntc.setString("Text3", "{\"text\":\"\"}");
PacketPlayOutTileEntityData tile = new PacketPlayOutTileEntityData(bp, 9, ntc);
player.playerConnection.sendPacket(tile);
player.playerConnection.sendPacket(packet);
}``` I want a sign to open to the player with the text using packets
but why can't I see the text?
why are you checking if their message equals something
have you never heard of commands or something
I'm just doing this for testing
I'll change it later, what about the problem itself?
Are you still on 1.12 ?
yes
which packet should I send first?
PacketPlayOutOpenSignEditor or PacketPlayOutTileEntityData
doesnt the client need to think theres a sign at that blockposition?
saw people do it with sendblockchange before
wouldn't sendblockchange change the text of the sign block itself, rather than the graphical representation of the sign?
lol
?
i think its just for the opening part
the way i did it is create a blockposition at the player under the world. where i would send the block change
then sent those 2 packets
in the same order as ur doing
Try minecraft:sign for the id
PS: I also think you might need to send a block change first. Otherwise the entity metadata is sent for an air block
which simply makes the client discard it. Not sure about older versions.
But a simple player.sendBlockChange(location, Material.OAK_SIGN.createBlockData()); should be enough
player.getBukkitEntity().sendBlockChange(signLocation, Material.SIGN);``` need third byte argument
Again: No idea. Im just guessing. I dont touch versions this old usually.
Just throw a byte in i guess
I have a shared inventory between several players that gets updated. I'm storing the players in a hashmap, and iterating through all of them to create a new inventory each time. Issue was that, when the players close the inventory, any action done to update it will reopen the inventory for them. To fix this, I removed them from the hashmap on InventoryCloseEvent.
Since every time the menu updates, it triggers an InventoryCloseEvent, what else can I use to detect if the player has left the inventory?
why are you creating a new one for each update?
because of how my inventories are structured
Hey, I am currently doing an internship for a game server hosting company and I am looking into improving the performance of Mc servers. I was wondering if you could help me out with your experience. What are some concepts that could theoretically improve server performance but have failed? I was thinking of solutions like offloading chunk generation to a more performant environment or trying to incorporate multithreading.
well seems like they arent structured very well then
seems odd to have to create a whole new inventory when the inventory size stays the same
seems to me you could pretty easily just update the contents for all viewers
incorporating multithreading into mc isnt that trivial. there is an ongoing project thats doing pretty well called "Folia" maybe see if that helps you?
Yes I know about it! Folia is great, but multithreading is just one solution. I just wanted to see if there are some solutions I've missed, some can be just conceptual. Proving a resource optimization strategy can't be made is still a relevant research finding for me
u could reprogram the server in C 😂
Not working
Pretty well and pretty broken :/
yea. still they got the furthust so far
could try but probably would be outside the scope of my assignment 😦
yeaa that would probably be out of scope.
but i feel like there really isn't much more you can do than picking your hardware intelligently & optimizing your server settings for your use case.
if your server is really custom you could go for something like minestom as well. which is library to build a mc server on top of. meaning it would have no useless bloat running in the background ur never going to use. bad news is that u would have to program any vanilla mechanics u want urself.
I have a menu creation class that connects to both a yml config and sqlite database. There is no way to update the inventory without creating a new inventory if I wish to display new items.
why not. if i update a menu and call Player#updateInventory it works fine
My main goal is to improve performance of servers with high player counts and a lot of plugins and modpacks. Your suggestion is really good and I will look into it, thank you very much!
I'll try that, I supoose
good luck 👍
Does not work :p
if (event.getMessage().equals("math")) {
EntityPlayer player = ((CraftPlayer) event.getPlayer()).getHandle();
Location playerLocation = player.getBukkitEntity().getLocation();
BlockPosition signLocation = new BlockPosition(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ());
TileEntitySign sign = new TileEntitySign();
sign.setPosition(signLocation);
player.getBukkitEntity().sendBlockChange(playerLocation, Material.SIGN, (byte) 0);
Generator generator = new Generator();
generator.nextFormula(ThreadLocalRandom.current().nextInt(14) + 1, ThreadLocalRandom.current().nextInt(2));
PacketPlayOutTileEntityData tile = getTileEntityData(signLocation, generator);
player.playerConnection.sendPacket(tile);
PacketPlayOutOpenSignEditor packet = new PacketPlayOutOpenSignEditor(signLocation);
player.playerConnection.sendPacket(packet);
}
}
private static PacketPlayOutTileEntityData getTileEntityData(BlockPosition signLocation, Generator generator) {
NBTTagCompound ntc = new NBTTagCompound();
ntc.setString("minecraft:sign", "sign");
ntc.setInt("x", signLocation.getX());
ntc.setInt("y", signLocation.getY());
ntc.setInt("z", signLocation.getZ());
ntc.setString("Text1", "{\"text\":\""+ generator.result+"\"}");
ntc.setString("Text2", "{\"text\":\"Answer:\"}");
ntc.setString("Text3", "{\"text\":\"\"}");
PacketPlayOutTileEntityData tile = new PacketPlayOutTileEntityData(signLocation, 9, ntc);
return tile;
}```I'm sorry to keep you guessing, but I think maybe you can see what's wrong based on your experience
it still doesn't work
then ur doing something wrong ;p
seems like this line ntc.setString("minecraft:sign", "sign"); should be ntc.setString("id", "minecraft:sign");
i can just do
EntityPlayer player = ((CraftPlayer) event.getPlayer()).getHandle();
Location playerLocation = player.getBukkitEntity().getLocation();
BlockPosition signLocation = new BlockPosition(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ());
TileEntitySign sign = new TileEntitySign();
sign.setPosition(signLocation);
Generator generator = new Generator();
generator.nextFormula(ThreadLocalRandom.current().nextInt(14) + 1, ThreadLocalRandom.current().nextInt(2));
sign.lines[0]= new ChatComponentText(String.valueOf(generator.result));
player.getBukkitEntity().sendBlockChange(playerLocation, Material.SIGN, (byte) 0);
player.playerConnection.sendPacket(sign.getUpdatePacket());
PacketPlayOutOpenSignEditor packet = new PacketPlayOutOpenSignEditor(signLocation);
player.playerConnection.sendPacket(packet);```
How do you add something to a creative category ? I'm investigating it but I don't find a lot of ressources abt that...
IS there a plugin or way to make all items have a different nametag and subtitles and stuff?
What do you mean by "add something to a creative category"?
The client displays all materials which have the same category in those windows.
Like
I've created an item
how can I made it to be in the TOOLS category ?
What line of code I have to use ?
I tried "creativeCategory" but nothing
Those are client side and for Materials. You cant add ItemStacks to them.
EntityPlayer player = ((CraftPlayer) event.getPlayer()).getHandle();
Location loc = getDefaultLocation(player.getBukkitEntity());
BlockPosition signLocation = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
TileEntitySign sign = new TileEntitySign();
sign.setPosition(signLocation);
Generator generator = new Generator();
generator.nextFormula(ThreadLocalRandom.current().nextInt(14) + 1, ThreadLocalRandom.current().nextInt(2));
sign.lines[0] = new ChatComponentText(String.valueOf(generator.result));
sign.update();
player.getBukkitEntity().sendBlockChange(loc, Material.SIGN, (byte) 0);
player.playerConnection.sendPacket(sign.getUpdatePacket());
PacketPlayOutOpenSignEditor packet = new PacketPlayOutOpenSignEditor(signLocation);
player.playerConnection.sendPacket(packet);``` for some reason it still doesn't work
sign.update(); I've added this, but nothing has changed.
- Send block change
- Send metadata for that block
- Open sign menu for that block
What am I doing wrong? should I move the sendblockchange up?
Does a sign appear under you?
no public Location getDefaultLocation(Player player) { Location loc = player.getEyeLocation(); return loc.clone().add(loc.getDirection().multiply(-3)); }
Add the sign in front of you, dont open the editor, and try to get the first part working: A sign with text on it
And you should keep that approach in mind. If you have a complicated method like this, and it "doesnt work", then you
need to find out where it fails. There is no point tinkering with all possible dials and levers, if you have no understanding about what
is actually going on.
Debug it step by step. If you master this, then you will be able to debug 90% of problems on your own.
I've made a sign with text appear, but it still displays empty sign editor
Send the sign editor one tick later
Are generic method parameters possible (amount and type). I want an abstract method that must be defined but the parameters can be whatever?
how can i get the number of scores currently shown by a scoreboard?
declaration: package: org.bukkit.scoreboard, interface: Score
Show your code
println("collected length: " + collected.length)
println("our scores: " + collected.indices.map(i => s"${i.toHexString}").map(scoreboard.getScores).flatten.map(score => (score.getEntry, score.getScore)))
println("found: " + scoreboard.getTeams.map(_.getName).filter(_.startsWith("score")).map(scoreboard.getScores).flatten.map(score => (score.getEntry, score.getScore, score.getObjective, score.getPlayer)))
println("found size: " + scoreboard.getTeams.map(_.getName).filter(_.startsWith("score")).map(scoreboard.getScores).flatten.size)
```output:```
[18:10:48] [Server thread/INFO]: collected length: 10
[18:10:48] [Server thread/INFO]: our scores: Vector((0,0), (1,0), (2,0), (3,0), (4,0), (5,0), (6,0), (7,0), (8,0), (9,0))
[18:10:58] [Server thread/INFO]: found: List((score5,0,org.bukkit.craftbukkit.v1_20_R3.scoreboard.CraftObjective@3ef214ce,CraftOfflinePlayer[UUID=229c776f-e945-4c65-b190-c0c337a236d2]), (score6,0,org.bukkit.craftbukkit.v1_20_R3.scoreboard.CraftObjective@3ef214ce,CraftOfflinePlayer[UUID=4d2b6401-845b-3b84-a655-4be5d9aad20b]), (score3,0,org.bukkit.craftbukkit.v1_20_R3.scoreboard.CraftObjective@3ef214ce,CraftOfflinePlayer[UUID=3a6c6b8b-ca87-3778-a52b-e5b9379c2b16]), (score4,0,org.bukkit.craftbukkit.v1_20_R3.scoreboard.CraftObjective@3ef214ce,CraftOfflinePlayer[UUID=ee631dbf-733d-4c49-99c2-91d28fd5af83]), (score0,0,org.bukkit.craftbukkit.v1_20_R3.scoreboard.CraftObjective@3ef214ce,CraftOfflinePlayer[UUID=c0ba1508-4619-43e3-b62d-4f4652f24697]), (score9,0,org.bukkit.craftbukkit.v1_20_R3.scoreboard.CraftObjective@3ef214ce,CraftOfflinePlayer[UUID=c650e842-e5a6-413b-a572-08d1a343d2ad]), (score2,0,org.bukkit.craftbukkit.v1_20_R3.scoreboard.CraftObjective@3ef214ce,CraftOfflinePlayer[UUID=7a0ac395-9d60-4ba1-b63d-3d7ef0e73e15]), (score8,0,org.bukkit.craftbukkit.v1_20_R3.scoreboard.CraftObjective@3ef214ce,CraftOfflinePlayer[UUID=691187f1-4596-39a8-8ddc-fb4e663a7706]), (score1,0,org.bukkit.craftbukkit.v1_20_R3.scoreboard.CraftObjective@3ef214ce,CraftOfflinePlayer[UUID=765c3432-e1f3-36dc-8221-60608a187546]), (score7,0,org.bukkit.craftbukkit.v1_20_R3.scoreboard.CraftObjective@3ef214ce,CraftOfflinePlayer[UUID=14739beb-0c5e-3a74-a2eb-fdbac73f602c]))
[18:10:58] [Server thread/INFO]: found size: 10
for whatever reason it makes the server lag for 5 seconds when i call getObject or getPlayer on all of the scores lol
the scoreboard here only has 9 scores currently shown
u can ignore the first two print statements
scores.indices.foreach { i =>
val hex = s"§${i.toHexString}"
obj.getScore(hex).setScore(i)
val team = scoreboard.getTeam(s"score$i")
if (team != null) {
team.addEntry(hex)
} else {
scoreboard.registerNewTeam(s"score$i").addEntry(hex)
}
}
this is how i set the scores
the last two might be wrong lol
since the score entry is actually that hex one
but the the scores are 0 regardless
maybe i need to call getscore on the objective
OK I figured it out
why does the damager is null in blockexplodevent using a respawnanchor?
How are you getting the damager
getDamager() (?)
anyone here that ever used jacoco for code coverage and knows how to upload those reports to codecov.io with github actions?
keeps telling me it cannot find those reports, documentation is kinda bad too
That method doesn't exist
at least not in Spigot
if you're using something else go ask them
How do I get an item display name please ?
Like, I have the diamond shovel vanilla item, how to get it ?
ItemMeta#getDisplayName
What is not working
I don't know if the server even has any language files
So idk if it can get the default name
Localized should just get the English one
I thought
¯_(ツ)_/¯
Meh could be wrong ig
There is
but if I want to get the name of the item you have in hand when breaking a name
I can't use it
ItemStack is translatebale you'd have to use components which spigot doesn't yet support
Not where you need it atleast
I mean you need to send it to the client for that to work
So if you want it server side you're out of luck
Oh
So not possible to get name of the item in name when breaking a block ?
But-
ahhh
if its just vanilla items, is the material not enough for your case?
or you could convert the material to the name if you want it in a nicer format
I was wondering if it's possible to open a writable book, I've tried p.openBook() but that requires an ItemStack of written_book?
I guess not then
Lol
it is not even inherited from entitydamage parent class
it's part of damagebyblockevent class
has anyone had to do any in-depth string cleaning here cus i aint got a clue where to start w/ this
is there some simple AI libraries for this or what 😭 🙏
Wdym cleaning
string = "";
but it has to be some other type of cleaning, maybe removing certain elements from a string?
For loop usually does the job
String clean = str.replaceAll("\\P{Print}", "");
String clean = str.replaceAll("[^\\n\\r\\t\\p{Print}]", "");
That's not the BlockExplodeEvent
yea
Alright
you could also just
dip that material check and do like if(!(block.getState() instanceof final Sign sign)) return;
orrrrr
Tag.SIGNS.isTagged()
if you need the speed of avoiding state snapshotting
o
but like, its still faster and nicer than your .endsWith
Block#getState just isn't a free operation
Yeah..
btw how could it throw a null exception here
the block is nullable?
your IDE is not smart enough to know that an event that is CLICK_BLOCK will have a block assigned
yeah lol
EmilyIDE
💀
I havent worked with signs for a long ass time
you can write on both sides
read the javadocs ™️
getTargetSide im guessing i have to check
why does getSide take in a Side parameter when its returning the same data type
XDD
Then how am i supposed to check which side the player clicked on
Ah yeah we should have named it SideOfTheSign
obv
player.getWorld().rayTraceEntities why do i need a location and a vector? is the location a starting location and the vector just the direction? the vector im using contains the location, is it so you can use a normalized vector?
vectors don't contain locations
Location is the point where it starts
but yea, your initial guess is correct
location is ray origin, vector is ray direction
Or an rgb. Or an abc.
i meant block location
Vector at home is just double[3]
okay excel, chill
warning - 2024-03-05 19:31:45,802 -- Some files being explicitly added are found in the list of excluded files for upload. --- {"files": ["core/target/site/jacoco/index.html"]}
warning - 2024-03-05 19:31:45,803 -- Some files were not found --- {"not_found_files": ["core/target/site/jacoco/index.html"]}```
Ah yes how does that make sense
and the double is just how far to cast?
location,vector,double
January
February
Marchuary
Apruary
Mayuary
...
*glares at PotionEffectType.DOLPHINS_GRACE, HERO_OF_THE_VILLAGE, and Fire BlockData*
Hey I fixed the potion effects
You mean you RUINED them :((
The old stuff is still there!
lmao I didn't realize "BAD_OMEN" had oof in it. That's great
lol I hadn't seen fire until now
Fire is a classic
When MD gonna drop that mixtape tho
Fire I think was the OG of md's shenanigans in the Javadocs and I'm in full support
Arrays.stream(chest.getInventory().getContents()).forEach(item -> {
if(item != null) plugin.getLogger().info("item: " + item.getType().name());
});
why does it print this:
[23:30:03 INFO]: [DeluxeMenuFromChest] item: GOLD_CHESTPLATE
[23:30:03 INFO]: [DeluxeMenuFromChest] item: AIR
[23:30:03 INFO]: [DeluxeMenuFromChest] item: AIR
[23:30:03 INFO]: [DeluxeMenuFromChest] item: AIR
[23:30:03 INFO]: [DeluxeMenuFromChest] item: IRON_CHESTPLATE
when I have these contents: https://imgur.com/a/HLgHV00
btw why does playerinteractevent fire twice
it fires for two hands
as far as ik
Thank you!
np
Likely missing api-version: 1.13 (or whatever version you're using) in your plugin.yml
api-version: "1.13"*
yeah, that helped, ty
so we don't have to banish floats from a whole yaml file because the community does not care to specify its strings
YOU DON'T HAVE TO DO THAT 
We banished floats because floats weren't used anywhere in the plugin.yml 
yet ™️
Speaking of banishing
YET
How do you compare which side was clicked?? XD (ignore the naming signTop.. it's just a sign)
SignSide isn't an enum
SIgnSide is the data thing
only Side is
SignSide is the clicked side
So....
I mean... I guess we could add Side to the SignSide interface :p
so does gteLine
oh
ohhh
No
They're DIFFERENT >:((
I need to check which side was clicked
it would work though
Can I do that?
Yes
Can't wait until we can put text on the top of signs too
Returns a referentially comparable instance
We should probably add in getSide() to SignSide though. It's stupid easy. Just need to add it to the constructor
Does it even implement equals
Maybe a getSign() for good measure
(it does not override equals)

Mhmmm, holding references to heavy things
virtual entity moment
I mean, you ignored my qtπ compliment early so
yea
fuck you too
Oh I saw it

I just hated it
because you can't name a variable π, dummy
Also
You got a problem with virtual entities cat boy?
how do you check which hand was used to interact with the block (LEFT / RIGHT ?)
Kotlin:
The event has a getHand
OFF_HAND
I was going to say, how CONVENIENT
btw how could you possibly click with your feet
Very, very carefully
Welllll
the enum isn'T just used for that event
There is Action.PHYSICAL
pressure plate?
lolll hahahaa
What does Action.PHYSICAL actually return for getHand
Why is stone spawning instead of gold?
pushups
yea, I am actually collecting examples for this @worldly ingot I'll need a video of you pushing a button with your naked toes
thanks!
Probably just HAND
Sad
You probably need to send a meta packet too
The heck is the integer in that constructor
how?
Uhh
So basically...
Action.LEFT_CLICK_BLOCK is the same as EquipmentSlot.HAND
That's old naming so idk what it was called
"Equivalent" is doing some heavy lifting
PacketPlayOutEntityMeta maybe
thx
Left click block will always be a hand slot, yes
By right clicking :p
(its nullable for a reason)
ohhh right yeah
Is it?
(Ur nullable)
so wait if I go to the client settings and change my main hand to left / right.. is that a client side thing or will it apply ingame
All my homies don't care about nullability of getHand() because we compare with == 😎
and event

It's client side
Server's aware of your main hand, but either way it's not a matter of "left" or "right" handedness
It's hand or off hand
alright
Your off hand can be either your left or your right
It's whatever hand is used for your offhand slot
Your offhand can be left or right but it is always off
Which means of course your main hand is always on
hey question, could I get someone to help me to troubleshoot an install of xenforo? lmao
yeah I know, its mad offtopic, but I figured Id ask, on the offchance
@worldly ingot did you happen to handle the xenforo install for hypixel
lmao no. That shit would not be running if that were the case
xD
xenforo is easy to install though 
they 99% do
yeah its og
tippy tappy
?paste
happy?
i will pretend like i understand
Hey if I check the block type at the itemframe location, why does it return AIR, when itemframe is placed there...
I guess itemframe isnt a solid block ? but how do you check for it
The tapping of your thumbs on your phone was being recorded in your audio lol
oh i didnt notice xd, im in a Teams meet rn and wearing headphones
Why is it AIR, when theres ITEM_FRAME placed there?
item frame is an entity
no a block isn't an entity
Exactly
how do i check for it
XD
How do I check for an entity that I know will always exist, at a certain block, in this case an item frame
declaration: package: org.bukkit, interface: World
maybe listen for the right click (or any event that opens a chest) of a player, cancel it and open a new inventory with the contents of the chest
the contents should be in sync if done correctly
player.openInventory(chestInv);
that always returns 0 in size no matter what
no matter how many itemframes i place around the location
"around the location" 
yea
upon closer inspection
this is why its BoundingBox
does that location happen to be at 5, 5, 5
you'll notice you are not passing said location to the method
the bounding box is absolute
I though BoundingBox was like an area lol
a rectangle
animation that i want (gold): https://www.youtube.com/watch?v=PQYT4gG3OCU second 0.22. any suggestion?
code: https://paste.md-5.net/seyilezope.cpp
my animation: https://imgur.com/a/ESXuvGK
AkumaMC Season 6, the summer update will be releasing this Saturday, 17th of June @ 2PM EST // 7PM BST
» Server IP: fun.AkumaMC.net
» Bedrock IP: Bedrock.AkumaMC.net
» Store: https://store.akumamc.net (50% OFF SALE!)
» Discord: https://discord.gg/akumamc
» Forums: https://www.akumamc.net
AkumaMC Is definitely the best OP Prison Server. Minecra...
Ok so what am I doing wrong now?
I just need to check at the current location if theres a single itemframe, I am basically checking 1x1x1 block because I don't need more
its always zero
wheres the fuckin tippy tappies
Yes
okay
I am looking at the 1x1x1 block
how much volume fits into a cuboid
with its two corners exactly
at the same location
deleted so he feels better 😤
i dont know
what is the height of your cuboid
1
bring it the fuck back
Alright
Sure yeah what are they?
ill make you visable in the javadocs
say less
spigotmc's members are so iconic
what else would we be
like at this point, if i saw lynx irl i would instantly recognize him
just from how many times ive seen his pfp
i fuckin wouldnt
same for 7smile
i can barely see the fact its a person let alone what he looks like
basically no one changes anything about their profile
you can't recognize a selfie is a picture of a person?
THATS A BATHROOM?!?
yes...
I THOUGHT IT WAS A WARDROBE
noo 😦
bring it back or i start a vote ban
wtf do I come back to
also yikes
💀
me thinking ur pfp was you stood infront of a wardrobe with a mirror
nope
this is years old
time to change
I forgot about it tbh
I have compact mode without pictures
nah this picture is tradition
Welp
cant break it now
its time to look forward
rip
how do you know who ur talking to with no pfps
names
lol
who has the effort to read that
fair
i made choco think i was simple by setting my pfp to his photo of an oraguntan
Clearance is good?
Is there a way to accurately detect whether a player hits an entity and misses it by hitting a block or air?
could probably do a frustrum cast on an interact event but would be pretty costly
yeah, i tried depending on just the damage event and interact event, but they seem to both fire when hitting an entity
i didnt wanna check if an entity is actually in their view
guess i might have to do it
Wait what
you dont have to hit an entity for itneract event to fire
How do you hit an entity but not hit an entity
Are you going for like, accurate hitboxes?
im trying to track the accuracy of hits, so i use the damage event for a successful hit, and the interaction for misses
Ah
but at some certain distances, it also fires the interaction event despite hitting the entity
You’d have to figure out which order they fire in
And then check if one is fired right after the other
how do you get the block's PDC again?
Not all blocks have PDC
Blocks don’t have pdc
Only tile entities because they're the only ones that store NBT data
I need it for a Sign
Block entities do though
It has it
BlockState#getPersistentDataContainer()
Ahhh block state
Iirc it has to be a TileState
Yeah, or your Sign object
Right, yeah, TileState, but practically all block states (if not all of them) are tile states
Well no
Awesome
All blocks have a state, just most are the basic blockstate
Yea figured it out lol
btw so from what I remember you first gotta create a NamespacedKey and then how do you use it?
Noice
Wait I shouldn't use new NamespacedKey("", "") ? How do I initialize the NamespacedKey class then
You’re meant to use the one that takes a plugin and a string
ohhhhhhhhhh
should never be used by plugins, for internal use only!!

Alright a complicated question, so how do you place an itemframe and then rotate it based on the player's looking direction? XD
Get player direction, normalise it to block face
done
you have the block face, just apply it accordingly
what is the process for gaining access to objects through dependent plugins? this is kinda driving me absolutely insane right now...
i've added my dependent plugin through my local maven repository (after trying to add it as a provided dependency in intellij to no avail) with the scope set to provided, registered it using the Bukkit servicesmanager, and i cannot get it back as a registeredserviceprovider using the same class in my other plugin... it's showing up in the plugin that registered it, however.
previous to that, i got the plugin instance from the pluginmanager and attempted to cast it to the type of the dependent plugin, but the cast failed as it's looking as though it's trying to use another classloader between plugins.
i can't find anything on the web for this and i'm about ready to punch GPT in the face
The plugin classloaders are parented by the spigot classloader and will end up searching on the same classpath on runtime.
If you have two plugins installed, then you can simply get an instance from other plugins through the static JavaPlugin methods,
or by having a singleton instance of your JavaPlugin implementation with a static getter in your plugin.
Example for the both:
// PluginA
public class PluginA extends JavaPlugin {
private static PluiginA instance;
public static PluginA getInstance() {
return instance;
}
@Override
public void onEnable() {
instance = this;
}
}
// PluginB
public class PluginB extends JavaPlugin() {
@Override
public void onEnable() {
PluginA instanceA = PluginA.getInstance();
PluginA anotherA = JavaPlugin.getPlugin(PluginA.class);
}
}
Just make sure that the plugin.yml of PluginB contains a yml to signal this dependency:
depend: [PluginA, ...]
or
depend:
- PluginA
- ...
This ensures that the onLoad and onEnable methods on all dependencies are
called before yours is.
that was what i tried first. the dependency has been set in the plugin.yml file and load order has been verified.
the classes are not matching, and using a static reference still gets a null reference in pluginb
What’s the reason for it being internalized anyway?
A certain fork does expose it as api iirc
How do you get the block that the player is looking at
Are both plugins loaded without exceptions, and did you make sure to not shade one plugin into the other?
Player#rayTraceBlocks(...)
or
Player#getTargetBlock(...)
wasn't there another way to do this




