#help-development
1 messages ยท Page 1016 of 1
Persistent data is only for bukkit values
Not for the entirety of it's nbt
Check with I think /data get @s Inventory[0] with the item in hotbar's most left hand side
Is that how you spell it?
"Left hand side"
i have a method for creating an itemstack with a custom class named ItemData, i use that void to create item1 with a static BaseStats value from another class, then i use the itemdata item1 has to create item2, item1 and item2 dont stack
item1 is created from ItemData/from scratch, item2 is created from retrieved ItemData from item1 which is an itemstack
thats the difference basically
aight 1 sec
yeah they have differences in itemdata
wtf
ill prob check what wrong tomr, thanks for the help
I found this piece of code and I was wondering if it's possible to also add a listener for a drop action (when the player drops the 'boomerang' item) https://hastebin.skyra.pw/juxahusive.csharp
Haven't used java in a while so am not in any state to completely change around this code, but was wondering if its possible with a simple extra if statement
declaration: package: org.bukkit.event.player, class: PlayerDropItemEvent
Trying to copy a world, why is it not working?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
and InputStream::transferTo
eh Files make more sense
You also have directories returned bny list()
using Files
Mm nesting ifs
from some random spigotmc forum
go play with some toys or something
E
I can't even think of an insult back
Also, you wish to fully copy each file?
I actually don't see what could be wrong
ima retry
Since I'd probably write that almost the exact same way
Did it work?
nope, its as if nothing happened
it creates a new world
yes
but its just default generator settings
What about the files being copied?
Maybe they're just not being loaded?
Anyway, gl, amma go sleep now
good rest
Isn't it late for you as well?
affirmative
Man, I love the way you speak
Okay, thanks
Quick question; How do I send a variable in a String?
send where
How to make such a skorbovrd without numbers with Packets, I tried with mine only with ticks, and I know that this is only possible with 1.20.4
https://ibb.co/b3HyMqR
how can I filter out black heart particles on damaging an entity? I tried using ProtocolLib and reading about it on forums but it didn't work as intended
If there's no better thing than ProtocolLib, then how can I use it properly?
That's very likely done on the client
Do someone have a datapack that modify the witch drops to match the new witch buff?
omw to judge your ass for creating a copy of an immutable list, never modifying it and using exclusively contains checks
(what is a private static final set)
Literally cancel every particle packet
If it still shows there's nothing you can do, other than making the particle invisible in the resourcepack and redirecting packets to some other particle
A learn java question
I tried doing exactly what was said here
and it didnt work at all
get rid of the second if check
Just to be sure
It could also be related to a world event
Is there much reason to be using pdc for inventory populators? Such as those for menus with no persistence really needed?
What is an inventory populator
Any item
Why would you need pdc on it
lore and what not, but that's what I'm asking is there any reason for pdc given these are just like menu buttons

This conversation confuses me
It confuses me and I was part of it
Why are pdcs so hard to grasp for people.
I dont even understand your question reading it as a thirdparty
it seems you should ask a better question
Surely
Here's what I think: It was a bad question and I've already found my answer so thank you all for helping me
Oh, okay
pdt.List.type
Yes
nope
choose your type
eclipse + white theme = โ ๏ธ
๐
Okay I'm still really stuck on this.
I'm using "C:\Program Files\Java\jdk-21.0.2\bin\java.exe" -jar BuildTools.jar --dev --dont-update --remapped --compile CRAFTBUKKIT,SPIGOT
To compile and I've simply changed System.out.println("Loading libraries, please wait..."); to System.out.println("Loading libraries, please wait... TEST"); in craftbukkit to test if its compiling properly, but once I decompile the generated spigot-server jar I it hasn't changed.
Looking at the Craftbukkit jar it compiles fine and shows the TEST. I have checked my .m2 and it has the updated one with TEST. so where on earth is it getting the non-updated version from?
I've also tried generating patches for craftbukkit and still no change
It was from a SpigotMC Forum, I already rewrote that. At the very least help instead of saying that..
sometimes you just want something working then you make the code neat
@EventHandler
public void onRightClickDoor(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
Block blockClicked = event.getClickedBlock();
BlockState blockState = blockClicked.getState();
if (action == Action.RIGHT_CLICK_BLOCK) {
if (blockClicked.getType() == Material.IRON_DOOR_BLOCK) {
Door iDoor = (Door) blockState.getData();
blockClicked.getState();
if (iDoor.isOpen() == false) {
player.sendMessage(ChatColor.AQUA + "WORKS!");
iDoor.setOpen(true);
blockState.update();
} else {
iDoor.setOpen(false);
blockState.update();
}
}
}
}
why dose this code not work i want to be able to toggle the iron door to open or close on right-click
what do you mean by "Not work"
does it not execute at all
it dose
but door dosent open
wait no
it stopes after this line
BlockState blockState = clickedBlock.getState();
you need to apply the state to the door
how do i do that
the thing is code fully stops after that one line
it dosent even get to where we cheack weather door is open
try blockState.setBlockData(iDoor)
then update
and how are you verifying that the it is stopping
java code doesnt just stop unless theres an exception
@EventHandler
public void openDoor(PlayerInteractEvent event) {
Block clickedBlock = event.getClickedBlock();
if (!(event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
return;
}
if (!(clickedBlock.getType() == Material.IRON_DOOR) {
return;
}
BlockState blockState = clickedBlock.getState();
Bukkit.broadcastMessage("-1");
Door iDoor = (Door) blockState.getData();
Bukkit.broadcastMessage("-2");
clickedBlock.getState();
if (iDoor.isOpen() == false) {
event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
iDoor.setOpen(true);
blockState.update();
} else {
iDoor.setOpen(false);
blockState.update();
}
}it never broadcasts -2
doesnt really make sense unless its throwing an exception
java.lang.ClassCastException: class org.bukkit.material.Door cannot be cast to class org.bukkit.block.data.type.Door (org.bukkit.material.Door and org.bukkit.block.data.type.Door are in unnamed module of loader java.net.URLClassLoader @5a10411)
gives me this error
oh you're using the wrong import
declaration: package: org.bukkit.block.data.type, interface: Door
@EventHandler
public void openDoor(PlayerInteractEvent event) {
Block clickedBlock = event.getClickedBlock();
if (!(event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
return;
}
if (!(clickedBlock.getType() == Material.IRON_DOOR)) {
return;
}
BlockState blockState = clickedBlock.getState();
Door iDoor = (Door) clickedBlock.getBlockData();
Door.Hinge hinge = iDoor.getHinge();
Bukkit.broadcastMessage(hinge + "");
clickedBlock.getState();
if (iDoor.isOpen() == false) {
Bukkit.broadcastMessage("2");
event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
iDoor.setHinge(Door.Hinge.LEFT);
blockState.update();
} else {
iDoor.setHinge(Door.Hinge.RIGHT);
blockState.update();
}
}```
now this code runs all the way
but it still dosent open
.
m
Maybe a dumb question, is there a way to run automated unit tests on certain aspects of a plugin? Like... example; test to make sure player is successfully teleported. Is this feasible or must you test manually?
How do I convert net.kyori.adventure.text.Component to net.minecraft.network.chat.Component ?
Punched and does not work
public static @NotNull net.minecraft.network.chat.Component convertComponentToMinecraft(@NotNull Component component) {
return net.minecraft.network.chat.Component.literal(LegacyComponentSerializer.builder().build().serialize(component));
}
MiniMessage
https://ibb.co/fMQkbFQ
https://ibb.co/hDnDRcP
You generally shouldn't test that
You can maybe test if coordinates are correct
๐
i have a problem then I'm placing an item
pdc string returns null
serialize it to json and deserialize the nms comp from json
?paste
๐ฟ
And how is it?
GsonComponentSerializer for the adv one, idk what the class name for the nms one is
Thank you
it was something with component serializer iirc
I'm going to eat now
No work
public void newScoreboard(@NotNull String name, @NotNull Component title) {
String serialize = GsonComponentSerializer.builder().build().serialize(title);
MutableComponent literal = net.minecraft.network.chat.Component.Serializer.fromJson(serialize);
this.scoreboard.addObjective(name, ObjectiveCriteria.DUMMY, literal,
ObjectiveCriteria.RenderType.INTEGER, false, null);
this.name = name;
}
?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.
also try printing the serialized one
what are you even trying to do
objectives only support strings iirc
^
How is it ?
?
you cannot pass in an nms component into an objective
vanilla limitation
i meant that there's no way to ever use components for objectives
especially nms ones
nms ones will never work for normal api stuff iirc
yeah
even paper doesn't support it and they made almost every string method deprecated
lmao
@blazing ocean Thanks, it works! ๐งก
public static @NotNull net.minecraft.network.chat.Component convertComponentToMinecraft(@NotNull Component component) {
return net.minecraft.network.chat.Component.Serializer.fromJson(GsonComponentSerializer.gson().serialize(component));
}
๐ฟ
Paperians voted in favour of react ๐ฟ
๐ฟ
React not too bad
lol i forgot to set meta data
now it works
I think you have to provide just a bit more information so that anyone can help you ^^
EncoderException : java.lang.IllegalArgumentException: Cannot get ID for packet class net.md_5.bungee.protocol.packet.LoginSuccess in phase GAME with direction TO_CLIENT @ io.netty.handler.codec.MessageToByteEncoder:125
this error
when player try to join
The User in this thread ( https://www.spigotmc.org/threads/bungeecord-problem.543135/ ) had the same issue maybe you find your solution there?
Anyone know how to remove the thing that gets typed in chat after a command like for example /tp <player>
Player has teleprted to player
that seems like a #help-server question
how would one go about making permissions like "abc.#" where whatever the highest amount of # the player has i can grab and use?
pretty sure theres a gamerule to disable command output
you mean the tab completion?
no?
How to remove these numbers so that it is empty? NMC Packet Scoreboard
https://ibb.co/5Y7tXmc
https://ibb.co/qCfPMNS
i have not tested this but try StyledFormat.NO_STYLE for the number format?
the numbers are client sided
Thereโs an option to hide them now
So how to remove them? without resource pack
?
question about how people handle passing there plugin instance around, I previously had a getInstance function in my plugin class, but was told to do dependency injection. But it seems like I am having to just pass the plugin to every function now, just for logging etc. Feels like I am still doing it wrong, any guidance?
Did I stutter?
I added StyledFormat.NO_STYLE t, but the numbers became not red, but white, but they remained
https://ibb.co/vdZwFPG
Ah yeah I guess that's just for the color then
Well it was worth a shot
No clue how to do it directly with packets
But it is possible
@EventHandler
public void openDoo(PlayerInteractEvent event) {
Block clickedBlock = event.getClickedBlock();
if (!(event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
return;
}
if (!(clickedBlock.getType() == Material.IRON_DOOR)) {
return;
}
BlockState blockState = clickedBlock.getState();
Door iDoor = (Door) clickedBlock.getBlockData();
Door.Hinge hinge = iDoor.getHinge();
Bukkit.broadcastMessage(hinge + "");
clickedBlock.getState();
if (iDoor.isOpen() == false) {
event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
iDoor.setHinge(Door.Hinge.LEFT);
blockState.update();
blockState.setBlockData(iDoor);
} else {
iDoor.setHinge(Door.Hinge.RIGHT);
blockState.update();
blockState.setBlockData(iDoor);
}
}```
this still dosent work
.
You have to parse it yourself.
loop over all PermissionAttachmentInfo#getPermission() checking the #getValue() and find the highest
Wanna tell us what didnt work?
set teh data before you call update on teh State
i did that and now it works but it works as in it just rotates the door not opens it
use setOpen instead of setHinge?
well, all you did is move the Hinge. you never setOpen
iDoor.setopen(!iDoor.isOpen())
will toggle it
@EventHandler
public void openDoor(PlayerInteractEvent event) {
Block clickedBlock = event.getClickedBlock();
if (!(event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
return;
}
if (!(clickedBlock.getType() == Material.IRON_DOOR)) {
return;
}
BlockState blockState = clickedBlock.getState();
Door iDoor = (Door) clickedBlock.getBlockData();
clickedBlock.getState();
if (iDoor.isOpen() == false) {
event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
iDoor.setOpen(true);
blockState.setBlockData(iDoor);
blockState.update();
} else {
iDoor.setOpen(false);
blockState.setBlockData(iDoor);
blockState.update();
}
}
This dosent work for some reason
so no need for your if check or your duplicate code
event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
iDoor.setOpen(!iDoor.isOpen());
blockState.setBlockData(iDoor);
blockState.update();```
no need for your check
you don;t need to check IF its open
how can i spawn the structure overlay?
also, this line does nothign clickedBlock.getState();
Instead of:
if (!(event.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
return;
}
And you can use != in Enum comparing
like
if (event.getAction() != org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK)) {
return;
}
@EventHandler
public void openDoor(PlayerInteractEvent event) {
Block clickedBlock = event.getClickedBlock();
if (event.getAction() != org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) {
return;
}
if (clickedBlock.getType() != Material.IRON_DOOR) {
return;
}
BlockState blockState = clickedBlock.getState();
Door iDoor = (Door) clickedBlock.getBlockData();
event.getPlayer().sendMessage(ChatColor.AQUA + "WORKS!");
iDoor.setOpen(!iDoor.isOpen());
blockState.setBlockData(iDoor);
blockState.update();
}
This still dosent work i think ill start trying with redstone power or something
are you doing this on teh top or bottom of the door?
Question, do you get your debug message "WORKS!"?
yes i get it
um you are doing this in teh interact event but not canceling it?
clicking a door opens/closes it
ah Iron door
you may have to get the other half too
as its a biSected block
i just relized the problem why it dosent work i forgot that right lcick also gets ran for off hand
so the event gets trigerd twice
I copy pasted his code and its working for me ๐
I would say its just the hand problem
now it all works thanks for the healp
You need to pass it to the class constructor, not to every function
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
ItemStack Ares_Hammer = new ItemStack(Material.DIAMOND_SWORD, 1);
ItemMeta areshammermeta = Ares_Hammer.getItemMeta();
areshammermeta.setDisplayName("" + ChatColor.BLUE + ChatColor.BOLD + "Ares Hammer");
areshammermeta.setLore(List.of(ChatColor.GRAY + "A hammer hand crafted by Ares himself", "", "" + ChatColor.WHITE + "Kill" + ChatColor.GRAY + " a player to gain " + ChatColor.WHITE + "Invisibility" + ChatColor.GRAY + " and " + ChatColor.AQUA + "Speed 2", "" + ChatColor.GRAY + "for 15 seconds", "" + ChatColor.DARK_GRAY + "Cooldown: 60s", "", "" + ChatColor.WHITE + "Sneak + Right Click Ability: ", "" + ChatColor.GRAY + "Spawn 3 Vex's to fight for you", "" + ChatColor.DARK_GRAY + "Cooldown: 1m 30s"));
areshammermeta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, new AttributeModifier("generic.attackDamage", 9, AttributeModifier.Operation.ADD_NUMBER));
areshammermeta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, new AttributeModifier("generic.attackSpeed", 0.9, AttributeModifier.Operation.ADD_NUMBER));
areshammermeta.setCustomModelData(25);
Ares_Hammer.setItemMeta(areshammermeta);
ARESHAMMER = Ares_Hammer;
How can i stop it from added all of these extra stuff
i messed that up
areshammermeta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, new AttributeModifier("generic.attackSpeed", 0.9, AttributeModifier.Operation.ADD_NUMBER));
One of the attribute modifier constructors lets you specify an equipment slot
It may be worth trying this method here: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/ItemMeta.html#setHideTooltip(boolean)
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
I dont have much experience with custom items like this tho
That will hide the entire tooltip
The tooltip contains all the damage stats no?
what do i set the uuid to?
how do i make a uuid ๐ญ
UUID.randomUUID or smth
UUID.randomUUID()
thank you
so, titles do not support components in Spigot
you can use a custom unicode character instead
packets
Is there any resource that shows how to change GUIs texture? I haven't found anything
make a character with a really large sprite and add it to the title
real
We have API for components in inventory titles (and really all across the API) waiting approval
Until then, you can't really accomplish this in Bukkit
๐ฅ
for months now
I donโt get it
hey choco
How car
when can we edit an inventory view's title
Hold packet
You already can 
One thing I'd like to see is some sort of native parser for components
I'm sorry what
So plugin devs don't need to come up with their own for things like configurable messages / items
Mr chocolate when you pr do you have to create patches aswell
Something like minimessage but native
That's on the TODO list for me
Ah yes
but sadly I'm stuck on the ancient 1.17
Well that sounds like a you problem now doesn't it?
yes
Another thing I'd like to see on the component system is text replacement / manipulation
Adventure has the replaceText functions, bungee doesn't
Easy pr
Easier manipulation of components has also been on my todo list, I've just been preoccupied with other things
String replacement was discussed in the component PR
Do you work fulltime choco
Yes
Are you melded to your chair yet pog
Practically
first big purchase I made after I did full-time work was get a nice chair
So worth it
And for some reason there's an industry thing where expensive chairs don't come with head rests
Gaming chairs are horrible for ergonomics
So the second big purchase I did was spend 250$ on a headrest
Made that mistake once
Never again
Yeah
Bought a gaming chair for 140 bucks
it was just a slab of plywood with a little bit of something around
The cool thing about expensive chairs is that you can never sit on a regular office chair anymore, they're horrible
What would you recommend instead because currently i have one and my full-time jobs start 03.06 xd
I have some cheap $200 office chair and itโs great
I use a Haworth Fern with the Atlas headrest
chair was like 1k
If you live in the US you can find used herman millers / steelcase for as low as like 300 bucks
Thank you c:
Overall main models you're looking for are:
- Herman Miller Aeron (pretty famous) - Mesh
- Herman Miller Embody (better than aeron imho but like double the price, rare find) - Fabric
- Herman Miller Sayl (weird model, cheaper than others but no third-party headrest available) - Fabric with weird plastic back
- Steelcase Gesture (No headrest iirc) - Fabric
- Steelcase Leap V2 (No headrest iirc) - Fabric
- Haworth Fern (Third-party headrest made to order, takes about a month on average) - Fabric with rubber mesh behind
- Haworth Zody (No headrest iirc) - Mesh back iirc
You want components
This is a lot easier with paper
Or you can use nms to send packets :) and open the inv entirely through that
Love ya and thank you for the detailed description!
If you are sending packets, make sure to use the same container ID otherwise it nukes your inventory
And ideally call player#updateInventory to resync every item
Don't use toString on them
string concatenation calls toString anyways
try calling updateInventory a tick later
Or setting the items after changeTitle is called
hello,I am look for a method that allows players can switch into a new server in a new ip without using bungeecord.
โ(Making a mod with plugins to achieve it,I have done a lot for this with mods,but mods affect more seriously than bungeecord in fact)
โand I want to beg your pardon because I am a student but not a native speaker so there might be some mistakes
// On placing a trapdoor.
@EventHandler public void onPlayerPlaceTrapdoor(BlockPlaceEvent event) {
Block block = event.getBlockPlaced();
System.out.println("Block placed is: " + block.getType());
if (!(block instanceof TrapDoor trapdoor)) {
System.out.println("Block placed is not a trapdoor.");
return;
}
I don't understand.
block.getState()
Explain this to me.
if (!(block.getState() instanceof TrapDoor trapdoor)) {
Yes, I understood that, but ... ?
Why?
Why isn't it matching with Block?
It's not in the same inheritance hierarchy?
no it's not
Confusing.
also checking getState isn't very good for performance
What would be the better way?
it has to copy the entire block state
So what would you recommend then?
Keep a HashSet of known trapdoor materials and check against that
Urgh...
Oh, that's actually very nice.
Since when that exists or im just living on a fucking moon
oh nice there's a tag for that
Tags have existed for quite a while
There weren't that many of them last time I checked but it looks like they've added a ton
Probably
My MongoDB logging level changer that works in Spigot doesn't work in Bungee (it's Log4j-based)
/**
* Set the log level to WARN for the MongoDB driver
*/
private void disableMongoInfoLogging() {
// Set the log level to WARN for the MongoDB driver
Configurator.setLevel(
"org.mongodb.driver",
org.apache.logging.log4j.Level.WARN
);
}
Seems weird
Any errors?
protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.VEHICLE_MOVE) {
@Override
public void onPacketReceiving(PacketEvent event) {
PacketContainer packet = event.getPacket();
Player p = event.getPlayer();
p.sendMessage("1: " + packet.getStrings().read(0) + " 2: " + packet.getStrings().read(1) + " 3: " + packet.getStrings().read(2));
}
});
Trying to get data on player movement with packets but nothing happens according to intended code, what am I doing wrong? (first time using protocol lib)
Whatโs the intended output?
The player movement or the vehicle movement...
moon
Thank you xd
It should completely hide the MongoDB Sync Driver INFO-logging
but it doesn't
// Check for logging options
if(this.customConfig.getBoolean(ConfigKey.DISABLE_MONGO_LOGGING)) {
this.disableMongoInfoLogging();
}
// Initialize the databases
this.initDatabases();
And it's executed before the database connection
me still looking for years now how to change the mongodb logger level
Same ++
It took me about 72h of testing to discover this method. It feels like a super-power ๐คฃ
/**
* Set the log level to WARN for the MongoDB driver
*/
private void disableMongoInfoLogging() {
// Set the log level to WARN for the MongoDB driver
Configurator.setLevel(
"org.mongodb.driver",
org.apache.logging.log4j.Level.WARN
);
}
Unfortunately, it doesn't work on BungeeCord
But it does on Spigot/Paper and every other fork that has log4j
where does Configurator come from?
org. apache. logging. log4j. core. config
You'll need this library:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.23.1</version>
</dependency>
Yeah, haha, it's the only way I've found to lower the logging level without modifying the server's log4j.xml config located inside the jar
Unfortunately, no
Seriously? Thank you!
The player would be riding an entity... hence I used VEHICLE_MOVE while also another reason being I cant find any packet related to player movement directly
i see
what I need is exactly WASD movement
Basically to simulate controls in my vehicle plugin that is
@chrome beacon
Sorry to tag you, but do you happen to know the answer to this question?
pretty sure its a steerage packet
yea
Bungeecord does not use log4j
The server does
PacketType.Play.Client.STEER_VEHICLE?
thanks ill try that!!
It just uses the regular Java logging api
Take a look :)
also whats the difference between overriding onPacketReceiving or onPacketSending
Listening for packets recieved vs packets being sent
But what is meaning of a steer vehicle packet being sent?
does that mean the server is driving the vehicle or what??
its never sent from teh server
oh wait
I mean what does Server.VEHICLE_MOVE mean when its onPacketSending
does it simply not do anything if its on sending?
Thank you!
Now the question has changed haha
How can I change MongoDB's logging level?
private void disableMongoInfoLogging() {
System.out.println("Disabling MongoDB info logging...");
// Set the log level to WARN for the MongoDB driver
Logger logger = Logger.getLogger("org.mongodb");
logger.setLevel(java.util.logging.Level.WARNING);
}
16:25:47 [INFO] Disabling MongoDB info logging...
16:25:47 [INFO] MongoClient with metadata {"driver": {"name": "mongo-java-driver|sync", "version": "5.0.1"}, "os": {"type": "Windows", "name": "Windows 11", "architecture": "amd64", "version": "10.0"}, "platform": "Java/Oracle Corporation/21.0.3+7-
If it were that simple, i have yet to find a method to make it shut the fck up
As I've said before, Configurer is the spigot method
The problem is with bungeecord which uses Java's Logger
Answer
[Pets] Unhandled exception number 256 occurred in onPacketReceiving(PacketEvent) for Pets java.lang.IllegalStateException: Override onPacketReceiving to get notifcations of received packets!
ah yeah
@eternal oxide
I get this exception
Unhandled exception number 32 occurred in onPacketReceiving(PacketEvent) for Pets java.lang.IllegalStateException: Override onPacketReceiving to get notifcations of received packets!
with this code
protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Client.STEER_VEHICLE) {
@Override
public void onPacketReceiving(PacketEvent event) {
PacketContainer packet = event.getPacket();
Player p = event.getPlayer();
try {
p.sendMessage(packet.getBooleans().read(0).toString());
} catch (FieldAccessException ex) {
p.sendMessage("0");
}
}
});
Im not sure what it means
full exception
nvm I fixed it
idk how
Magic as always
Probably running an old jar
now im gonna mess around to figure out wat and how to take from the packet container
ngl I was thinking the same
Take a look at PacketWrapper
Looking at the structure of the nms packet class is also useful
since ProtocolLib is essentially a layer of reflection
PacketWrapper?
im sorry ive no idea what you mean exactly
im not familiar with terms especially like nms
@chrome beacon sorry to ping was bringing your attention to the reply
nms refers to net.minecraft.server which is the package of the code written by mojang
it can also be used to refer to CraftBukkit and/or non-api code that's part of Spigot
ohhh
basically the server internals
Nms is the thing that I have been remapping a whole week already
what are you working on
A vehice plugin
In a more basic form called a Pet
oh wait
i wasnt asked that
anyway
ah nice
Olivo how do I use packet wrapper is there a wiki?
It's just classes that wrap the protocollib api
open the class for the packet you want to read
and see how it works
okay ty
I cant import the api because of bad gateway
lmao
what do I do now ._.
and yes its an error from the repo
understable + the wrapper part figured that out for me still a question is how do I implement this in practice
Im a rookie in java as well
(I started java before bukkit but didnt get as good as I should have before starting on bukkit api)
ah their repo is down
you can just see what it reads/sets
this.handle is the packet container
Ohh so u mean like
just understand what its wrapping
and directly implement it without using the api?
ig that works
Oh shitttt
I figured it out..
the whole time the cause for blank output was .getField
I needed .read
bruhhh
@chrome beacon THANKS ALOT
I got WASD ANDDDD jump & shift!!!
Hey, does someone know how i can put text with a texturepack font as a GUI title name?
Because then it is a custom gui texture for me
/tellraw @a [{"text":"S","font":"minecraft:ui"}]
textcomponents wont work i already tried, and if it is with packets can someone send an example please?
I work with spigot 1.19.4
thanks so much
Personally I'd just use the PaperAPI
Yeah but not everyone uses paper for their server, or does paper plugins also work on normal spigot servers?
anyways people have told you what to do with the packet already, no?
Hey everyone!
I'm trying to access data from the commands.yml that is in a package inside the project structure, any help on how to access it ?
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
Yes i heard something about packets but i'm not good at that and i dont have a example to work with for changing inventory titles
Can i send you a screenshot in DMs of what i mean?
how can I iterate every item in an inventory view? Is that possible? Do I need to combine the sizes of the bottom and top inventories to loop?
Yea I think you just iterate through both top and bottom
ah thanks
man ghost items are difficult ๐ญ
(accessibility settings go brrrrrrrr)

var size = view.getTopInventory().getSize() + view.getBottomInventory().getSize();
for (int i = 0; i < size; i++) {
var item = view.getItem(i);
}
```Am I correct here?
Send the open window packet with the id of the currently open window
I have pretty much never used inventory views ๐
Alright thank you!
is a getter faster when there is less data in terms of memory? or is there no real difference
wym
Sounds like you're micro optimizing
it passes a reference
You probably have other code that you should focus on instead
i think InventoryView#countSlots give u the total as well but yea
When creating custom .yml files in resources The way to extract them is doing File file = new File(getDataFolder(), "file_name.yml"); right?
ah, figured this javadoc was implying something else
no that won't extract anything
you're just definging a path to a file
yea
why would it be more though
But it'll read the contents inside of it right ?
no
ugh I cant think of anything, but thereโs probably some interesting exceptions
not unless you tell it
I understand ๐ญ thanks
๐ฅฒ
The File object is just a path to the file
You still need to at runtime get the assets from your jarfile, and copy them over to ur data folder
Would getResource("commands.yml"); get the file's information ?
๐ญ
Contents i mean
I'm honestly laughing lol
getResourceAsStream gives you an InputStream
you can read all of the contents of that file with it
you need to specify the full path from the root of resources
so in this case, /plugin.yml for the plugin.yml file
if you're just trying to create a config read the wiki link sent earlier
if you had a folder, it would be /myfolder/whatever.whatever
.
then use getResourceAsStream("/commands.yml")
private void createCustomConfig() {
customConfigFile = new File(getDataFolder(), "custom.yml");
if (!customConfigFile.exists()) {
customConfigFile.getParentFile().mkdirs();
saveResource("custom.yml", false);
}
customConfig = new YamlConfiguration();
try {
customConfig.load(customConfigFile);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
/* User Edit:
Instead of the above Try/Catch, you can also use
YamlConfiguration.loadConfiguration(customConfigFile)
*/
}``` they have this here on the doc u guys seynt
looks alright
this will
- take the file from JAR and put it in DATAFOLDER if its not in the DATAFOLDER, it may also create parent folders and the DATAFOLDER itself if they're missing.
- read the file from the DATAFOLDER, the contents will be dumped into ur YamlConfiguration object
fake item?
yeah I need to make a single player see a "custom" item to their person
I figured editing a view wouldn't change the underlying container
honestly probably not worth it yet, I'll make that a proper feature in my framework later and deal with accessibility at another time ig
a view is just a reference to the inevntories involved
yea the name is a maybe a bit misleading but its not a deep snapshot of everything sadly
well, that's fine I guess
how is this possible? "Condition 'section == null' is always 'false'" when i try use it
this warning show me when i check null in another class
compiler wrong?
is anything calling that constructor
only when used via api and โunder the hoodโ only getting methods
Yea then maybe IJ just attempts to be smart
Does someone know where i can download paper 1.19.4 api jar?
And no im not going to use maven
use gradle ๐
No
lol
then suffer
I use eclipse
External jars ON TOP
no
Gradle is actually easier but is needed mainly in large projects, although this is a matter of taste
Oowh
So like, ggwp you'll be downloading like 20-30 jars
;(
YES
No you're just ignorant it's okay
I dont like changes i use eclipse with external jars for like 7 years now
I mean yea, you certainly can.
But you'll have to suffer your way there
gl with it
You and me both friend but even I use gradle
how do I spawn the display entity ?
java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.Display
Display is abstract
err an interface
you can;t spawn an interface, spawn one of the classes that implement it
(which, its still an inteface but yea, Display.Text would be one)
hi guys is there anyway i can create spigot fork that allow zombie spawn natural at the daytime?
today i tried to create spigot fork and i reliszed i can edit everything which in server-side and i want to make a server mob and animal be able to spawn at daytime
i know there are method that replace the anime or make a runnable
Hey guys! What should I use for multi module projects? Maven or Gradle ๐
but i think there must be the thing can able to spawn as vanilla system
both can do that
pick which one you are more comfortable with
Thanks! ๐
its fully tied to the lighting, mobs only spawn in 0 light
time of day has actually nothing to do with it
how I do know which class implement it
in the docs
it tells you in teh javadoc
but usually you would create a display type you want to use anyways
i think its just textdisplay, blockdisplay and itemdisplay
iirc billboard or smth
can you no longer set air in recipes (1.20.5+)
air is not a valid ingredient for any recipe
the network codecs will blow up
what recipe are you trying to use air with @rough drift ?
I have made a test recipe, pre 1.20.5 Material.AIR worked for a MaterialChoice, 1.20.5 and up it no longer accepts air
I meant what kind of recipe? what is even the point of having air as an ingredient
and yeah, air is not valid anymore
user-input
no what? what kind of recipe, crafting? furnace, smithing? what
yeah, just don't put air and it'll be fine
well, need to rework stuff now then
ty
wait
if it is a shaped recipe
do I just not set an ingredient?
i.e.
recipe.shape(" 1 ", " 2 ", " 3 "); (example for demonstrative purposes)
yeah, just put a <space> in the shape string
yes
that's always worked and been the way you are supposed to do it
Alrighty, I forgot about it
Can you please help me?
java.lang.ClassCastException: class org.bson.Document cannot be cast to class org.bson.Document (org.bson.Document is in unnamed module of loader 'WidenBank-1.0-SNAPSHOT-shaded.jar' @1a4d535c; org.bson.Document is in unnamed module of loader java.net.URLClassLoader @5ed2475d)
(I'm working with my own APIs)
?paste
This is from the API, WidenCommons. It's used inside WidenBank
Looks like someone forgot to relocate their shaded dependency
haha
thank you
Anyone got some code or could tell me how i could implement some code so that on right click it throws a pickaxe that mines blocks and damages players I was thinking/hoping to use item display entites
Listen to the interact event
check for pickaxe
spawn item display
every tick:
move item display
check for collision with block/entity with help of a bounding box
That's the general code flow
hold on a second, my dependency scope is provided ๐คฃ
<dependency>
<groupId>com.github.MichealAPI</groupId>
<artifactId>WidenCommons</artifactId>
<version>8439c0b9a9</version>
<scope>provided</scope>
</dependency>
It's probably from here
since it has bson as dependency
I'm not sure haha
yeah so relocate it
Yeah, thank you
It's the same, even after relocation
java.lang.ClassCastException: class it.mikeslab.widenbank.api.org.bson.Document cannot be cast to class org.bson.Document (it.mikeslab.widenbank.api.org.bson.Document is in unnamed module of loader 'WidenBank-1.0-SNAPSHOT-shaded.jar' @fb2a123; org.bson.Document is in unnamed module of loader java.net.URLClassLoader @30574c12)
at it.mikeslab.widencommons.api.various.aggregate.AggregatorManager.aggregate(AggregatorManager.java:51) ~[WidenCommons.jar:?]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>org.bson</pattern>
<shadedPattern>it.mikeslab.widenbank.api.org.bson</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
Hello! I'm trying to do a multi-project and I ran into my first problem.
Cannot set the value of property 'downloadService' of type io.papermc.paperweight.DownloadService using a provider of type io.papermc.paperweight.DownloadService.
id 'java'
id 'io.papermc.paperweight.userdev' version '1.7.1'
}
group = 'coma112'
version = rootProject.version
repositories {
mavenCentral()
maven {
name = 'papermc-repo'
url = 'https://repo.papermc.io/repository/maven-public/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
paperweight.paperDevBundle('1.19.2-R0.1-SNAPSHOT')
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.register('prepareKotlinBuildScriptModel')```
Anyone? ๐
I have absolutely no idea what's the problem in the plugin module it's working fine
?whereami
idgf tbh I just wanted a simple answer I didn't know that there is a fork wark ๐
you're asking for paper tooling help in the spigotmc discord
is there a way to make a method such that
if i give it, say "&f" or "ยงa" it would return "WHITE" or "GREEN"
(preferably without having a million if statements)
Cycling through a map?
you could combine ChatColor#translateAlternateColorCodes and ChatColor#getByChar?
does #getByChar work only on the ยง?
would just return null if not possible
so you can run it on each char
and if it's null, add the original char back in
Or you could just iterate through all the values of the chatcolor enum class
why do that on each char
the thing is lets just say i sort of have a color stored somewhere like ยงf or whatever and i have a button to change said color and that button is a piece of wool but i want the wool to be of the current color, which is why i asked
wools are seperate materials
a very small detail but i must implement it to satisfy my brain
yes i know ill append the WOOL_ to the string and do Material.valueOf
ah yes, BOLD_WOOL
or whatever way WOOL is named
well unfortunately im not allowing people to set the colors to BOLD
๐
colorCode = colorCode.toUpperCase().replace('&', 'ยง');
for (ChatColor color : ChatColor.values()) {
if (color.toString().equals(colorCode)) return color.name();
}
return "UNKNOWN";
}```
Idk if its working
I think I'm getting closer to the solution. WidenCommons (the core) actually uses the 'libraries' feature from plugin.yml to get the mongo-driver, which also contains BSON
libraries:
- "org.mongodb:mongodb-driver-sync:5.0.1"
why would i need toUpperCase
Maybe it's that that makes the conflict
You can delete #toUpperCase
It should work without it
It's just my thingy
ive implemented my own piece of code to just test it out real quick
is it possible to revoke advancements from players that arent online? i have uuid (and the advancement I wanna revoke)
I could only find methods on Player
hmm
weird
how do I edit the player data file
and will that work for online players? or do I need both methods (player data file and Player api)
I guess revoking it when the player logs in is possible but just kinda annoying
its surprising to me that statistics are available for offline players but not advancements..
Remove my.permission from the permissions section
You already defined it on your command
Well, no, that's just saying that you want to use my.permission for the command. That looks correct
Are you defining it anywhere in source as well? via the PluginManager?
Or do you have another plugin that also has the "my.permission" defined?
whats the best way to check if like a player has a permission mypermission.5 my method returns 5, if they have mypermission.99 it returns 99 and so on
even if they have both .5 and .99 it should return 99
What if bruteforcing or something
well thats an obvious way to do it but what if a person enters .999999999
im looking for an efficient way
Hello. I have a plugin that uses an API to query a BSON document from a database when requested by another plug-in through the API. The process is asynchronous and uses a CompletableFuture. However, when completing the future through the API, it returns a different class loader (the one the first program loaded), which causes an error. Can you please help me?
java.lang.ClassCastException: class org.bson.Document cannot be cast to class org.bson.Document (org.bson.Document is in unnamed module of loader 'WidenBank-1.0-SNAPSHOT-shaded.jar' @44bec7d5; org.bson.Document is in unnamed module of loader 'WidenCommons-2.3.4.jar' @2bfc24ac)
As I said before you have the Document class loaded twice
Don't provide it twice
If WidenBank requires WidenCommons then just provide bson it commons
and not in bank
also do relocate if you're shading
Its about the result of the CompletableFuture completed inside the API
It returns an instance created by a different class loader
You have bson loaded twice
that's the problem
Now do what I said
can u make a player ride a block display
Iโve already tried here
the docs for BlockDropItemEvent say to use getBlockState() to get info on the broken block
why does it return a block with type AIR for me
or no wait sorry I was calling getBlockState().getBlock() nvm
Yes they have passengers
But youโd want to use a interaction entity if itโs clicking required
I have a OfflinePlayer which has never played on my server before, and therefore it has no information besides the UUID. Is there any way I can tell the server to fetch that player?
declaration: package: org.bukkit.profile, interface: PlayerProfile
looks like that is a replacement API for OfflinePlayer? So I should always use that instead where possible?
It's not a replacement
how do you summon an entity in the world without having the server calling the EntitySpawnEvent
It's just a part of the offline player that handles the player profile
?xy
I wanna spawn an entity that already exists to another location, tried doing that and it crashes the server prob cuz it calls EntitySpawnEvent infinitely
so you're spawning an entity in the spawn event?
yeah like when the entity spawns I wanna spawn it again in another location
spawn another one
so you'll need a way to track the spawned entity
you can attach a PDC to the spawned entity
and then break the method if the spawned entity has it
I was just thinking that yeah, thank you
Use the spawn method that takes a consumer to spawn the entity
and modify it in the consumer
gotcha
that just ensures the entity is modified before it's spawned
instead of spawned and then modified
it's good practice when you want to modify the spawned entity
yeah
and in this case required
Since the SLP has been abandoned, anyone can help me about this: https://github.com/Minecrell/ServerListPlus/issues/417
someone who uses gradle. Building EssentialsX with EssentialsX:build -x checkstyleMain -x test
I get one error that halts teh build
how do you change the rotation of a group of block displays
(a group means they're riding each other)
I tryed to update a plugin to 1.20.6 however the class "Material" apparently is not in 1.20.6 anymore, how can i replace this class for example by the creation of itemstacks?
It's split
Item and Blocks have their own respective class
also that should only be in the feature preview builds
?
not the regular 1.20.6
Itโs in main, but marked as internal
Update IntelliJ
ah good to know
lol srsly worked, thx
?paste
?
oh wait the rotation is in the transformation?
the uuid should still differ
or just save it into a Map or a Set
with an identity check for equality
or maybe not, many solutions ahead
are glow colors broken on 1.20.4?
i registered a team, added the player name as entry, set the color to something and i set player.setGlowing(true) but the color is still white
Do you have the TAB plugin on the server?
i have armor stand that is being defined with rotations, but how do I get a vector based on it?
armorStand.setHeadPose(new EulerAngle(-angle.x, angle.y, angle.z));
final Vector direction = new Vector(Math.toDegrees(-angle.x),
Math.toDegrees(angle.y), Math.toDegrees(angle.z)).normalize();
I tried with math.todegress and without
but the direction is not exactly with the rotation pose:
needs a little trigonometry to convert the vector to an euler angle
An euler angle is made of 3 angles, all in radians
X (pitch)
Y (Yaw)
Z (roll)
Mess with trig a little bit and you'll get somewhere
Start by setting Z to like -90ยบ so it's flat
Then rotate Y for your yaw (should be something like atan2(vec.z, vec.x)) and rotate X for your pitch (asin(vec.y)?)
something like that
String playerName = player.getName();
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
if (isEnabled() && CBounty.getDatabaseManager().isBounty(player)) {
player.setGlowing(true);
Team team = scoreboard.getTeam(playerName);
if (team != null) team.unregister();
team = scoreboard.registerNewTeam(playerName);
team.setColor(ChatColor.valueOf(ConfigKeys.GLOWING_COLOR.getString()));
team.addEntry(playerName);
}
}```
try this
wait i want euler angle > vector
ye
I might be able to help you since I worked with vector math recently, but I don't quite understand what you're trying to do
Oh
So you want to convert from pitch and yaw to a normal vector of the same angle?
E.g. if you have pitch = 0 and yaw = 90, you want a Vector of (-1, 0, 0) for example
yes but i my euler angles it also has the roll value, now I dont know if this influences its rotation, for example
Nope, however, what is the roll for?
hm
Are you trying to get it to rotate like a player head would?
public Vector eulerAnglesToVector(final EulerAngle angle) {
double pitch = angle.getX();
double yaw = angle.getY();
double pitchRad = Math.toRadians(pitch);
double yawRad = Math.toRadians(yaw);
double x = -Math.cos(pitchRad) * Math.sin(yawRad);
double y = -Math.sin(pitchRad);
double z = Math.cos(pitchRad) * Math.cos(yawRad);
return new Vector(x, y, z);
}```
no, I just want to transform the head pose rotation of an armor stand to a vector direction
Guys im playing on a MC server with a backpack plugin. I put some important items in the backpack and they despawned. After trying for a while i discovered that its actually possible to dupe items with this backpack. Sometimes the items despawn and sometimes they duplicate, there is a pattern but since im not a developer its not easy to find the patern. Any smart developer down to help? I can pay.
I think I get you, but what I mean is that when you rotate armour stand heads, they don't rotate the same way player heads do
I came across the same issue a couple days ago, I'll share the solution with you
Lemme find the code
I can find the dupe with it. What's the spigotmc resource URL?
oh no yes I noticed since the roll value influences
Mhm
My solution was to use the Armour Stand's position yaw rather than its head yaw, but continue using the head pitch. That way it lines up properly
To influence its position yaw, you'll have to use .teleport
Does the head have to be yaw-rotated separate to the rest of the body or nah?
@graceful stream
im always teleporting the stand armor to pitch 0, and yaw 0, and it cant be changed, so im considering the armor stand head rotation, so yes
Ah. Is armour stand's yaw necessary for aesthetics? If not then my solution could work
you mean the ''head pose'' or the location.getYaw? if you mean the location yaw, pitch is always 0
I mean is the location.getYaw necessary for aesthetics
no
Cool beans
My solution can work then c:
public void armorStandFace(ArmorStand armorStand, float yaw, float pitch) {
Location armorStandLoc = armorStand.getLocation();
EulerAngle headPose = armorStand.getHeadPose();
// Yaw
armorStandLoc.setYaw(yaw);
armorStand.teleport(armorStandLoc);
// Pitch
headPose = headPose.setX( Math.toRadians(pitch+90) );
armorStand.setHeadPose(headPose);
}
There ye go @minor garnet
It sets the armour stand's look direction by changing its head's pitch but its body's yaw. This way it'll rotate like you expect it would
Im always teleporting the stand armor to pitch 0, and yaw 0,
You may have to find a way to maintain its getLocation yaw
Hopefully that helps a bit c:
@minor garnet Also for this part it should be degrees(atan2(-vec.x, vec.z)) for the yaw. And then for the pitch, it's -degrees(atan2(vec.y, horizontalDistance)) where horizontalDistance is just pythag of vec.x and vec.z
Sorry for all the math yap :3
uh actually that wont be useful
Alrighty
basically I have converted a quaternion to euler angles, but I needed to get the rotation direction vector that the armor stand had,
and yes I can directly use the quaternion for this, but I needed to find out how to get the direct rotation vector of the head from the armor stand head pose
Ah, I have no understanding of quaternion mathematics, sorry ><
Something along the lines of this
public Vec3d getRotationVector(float yaw, float pitch) {
final float f = pitch * (float) (Math.PI / 180f), g = -yaw * (float) (Math.PI / 180f);
final float h = MathHelper.cos(g),
i = MathHelper.sin(g),
j = MathHelper.cos(f),
k = MathHelper.sin(f);
return new Vec3d(i * j, -k, h * j);
}
thats what i use
yaw & pitch are just regular degrees
You could use Math.toDegrees() there instead of * (Math.PI / 180f) since it's more readable
i got it from MC source code so kinda weird
yeah i think is not woring
Ahh the compiler probably did that then :P
Why would it do that?
For optimisation. The code inside Math.toDegrees is pretty simple and it can just take the internal code from there and inline it into the calling function. That way a small bit of processing power is saved from function calling
I need the direction of the head so I can use it in mathematics that I have to get the center
the compiler won't do that
the runtime might but javac certainly doesn't do any optimisations beside constant folding which is very pepega
but also that's translating to radians, not degrees :p
What are you talking about bro ๐ญ
That's not what it does
What does this mean to you?
INVOKESTATIC java/lang/Math.toDegrees (D)D
this is just some simple bytecode.
Yes, I already found that out
๐
Java 22 is crazy. This is the code I put into this bytecode
3 lines lol
Oh yeah, I'm being stupid :c
no more public static void main???
no more public class main public static void main string args
holy hell
I mean the bytecode would look the same on basically any java version
no more public static void main(String... args) my beloved...
No public class Main either
You can still use it if it makes you feel better
why would you not be able to use it? that's dumb lol
The shortcut is only implemented to make learning Java much more clear
psvm is the first thing a new learner sees
it may seem complicated.. you get the point i'm tryna make
i wanted to create a custom item which is a dagger. i want its durability to be half of an iron sword. i used this is.setDurability((short) 125); but its not working. can anyone help pls?
declaration: package: org.bukkit.inventory, class: ItemStack
protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Client.STEER_VEHICLE) {
@Override
public void onPacketReceiving(PacketEvent event) {
PacketContainer packet = event.getPacket();
float ws = packet.getFloat().read(1);
float ad = packet.getFloat().read(0);
boolean jump = packet.getBooleans().read(0);
boolean shift = packet.getBooleans().read(1);
UUID id = event.getPlayer().getUniqueId();
if(ws > 0) fire(ControlKey.W, id);
if(ws < 0) fire(ControlKey.S, id);
if(ad > 0) fire(ControlKey.D, id);
if(ad < 0) fire(ControlKey.A, id);
if(jump) fire(ControlKey.JUMP, id);
if(shift) fire(ControlKey.SHIFT, id);
}
public void fire (ControlKey key, UUID id) {
Bukkit.getPluginManager().callEvent(new ControlKeyEvent(key, id));
}
});
(Please dont mind the multiple stupid looking if statements, its temporary but feel free to improve it)
java.lang.IllegalStateException: ControlKeyEvent may only be triggered synchronously.```
And I am not aware how to sync threads
Can someone help :(
[Im a rookie in java and barely started with bukkit..]
Wrap it in Bukkit.getScheduler.runTask
Can you explain what that does?
Ill just add I actually want to learn how the error came to be and visualize the issue
if someone is free enough to do that..
๐ Ill try that
It calls it on the main thread at the start of the next tick
So it basically syncs it?
Yes
Btw so is the packet on a different thread?
Alternatively you can make your event async by passing true to the super constructor
Yes
(Im trying to learn threads but very confused from all the different things on net)
can you elaborate on that
so the entire packet listener, do I wrap it within that scheduler?
Or just some part of it, if so
Bukkit.getScheduler().runTask(this, new BukkitRunnable() {
@Override
public void run() {
protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Client.STEER_VEHICLE) {
@Override
public void onPacketReceiving(PacketEvent event) {
stuff
}
});
}
});
Is this how it is supposed to be done?
Just the part that calls the event
Ohhh
Thanks ill test that
public void fire (ControlKey key, UUID id) {
Bukkit.getScheduler().runTask(Pets.getInstance(), () -> Bukkit.getPluginManager().callEvent(new ControlKeyEvent(key, id)));
}
```?
Thanks it worked!
@EventHandler
public void onControlKeyTrigger(ControlKeyEvent e) {
Objects.requireNonNull(Bukkit.getPlayer(e.getPlayerUUID())).sendMessage(e.getKey().name());
PetFrame pet = Pets.getInstance().checkPetRider(e.getPlayerUUID());
if(pet == null) return;
if(e.getKey().equals(ControlKey.W)) launch(pet);
}
private void launch(PetFrame pet) {
Vector v = pet.getInteraction().getLocation().getDirection().normalize().multiply(2);
pet.getInteraction().setVelocity(v);
pet.getModel().setVelocity(v);
Bukkit.getPlayer(pet.getPlayerUUID()).sendMessage("Launched!");
}
Intentions
- Send player the control key that is pressed (Works)
- Launch the pet some 2 blocks away [It sends the message "Launched!" but doesnt actually do anything to the entity's velocity]
Issue being ^
In this case the interaction's face is being used as the base of movement regardless of where or what the display item is facing
(getModel is an item display) (getInteraction is an interaction entity)
Another question, whats the packet that handles INTERACT?
Its mentioned here but doesnt say the name of the packet https://wiki.vg/Protocol#Interact
unpopular opinion, notch is not the power which powered minecraft success
notch stepped down from development of minecraft since the release of 1.0
wrong channel but sure
so actually its jeb's and other developers efforts (dinnerbone) that really took minecraft to another level of popularity
i have added cmi plugin when a person sends tpa request it is demading 50money i see whole config file i am not able to find config to change this
im working on a few different projects with 1 other developer. these projects depend on eachother and are private. does any1 know of any affordable solutions for hosting these artifacts online but also like private. i know about sonatype nexus. but i was wondering if there is anything more affordable out there. i coulnt find anything
I mean, do you plan on selfhosting?
Any cheap VPS should be enough to handle reposlite
well i thought about it. but from what i can read online nexus might need a pretty powerfull machine with quite a bit of ram
i might be wrong tho
oh what is reposlite
https://reposilite.com/ should probably run fine
Lightweight and easy-to-use repository manager for Maven based artifacts in JVM ecosystem.
i see, i haven't looked at that one yet. i'll see if i can get this one up and running thanks
*Deleted some messages because I found the solution
dang that was a really easy setup. works great thanks so much!
@young knoll are you available? I have some issues in code if you can help
sorry to disturb
don't ping random people, just ask
?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!
Im sorry I had received some assistance from that person before and impatiently decided to ping for another question