#help-development
1 messages Β· Page 1018 of 1
The thread.sleep is for debugging purposes
I tested real-world performance and was doing about 1M blocks per second with 4 threads
uh your hash returns an int?
possibly
Bedrock spotted
test server's running geyser
π©
with some heavy internals
When I drop an item on the ground and pick it up, I get an error sent into console.
Code: https://pastebin.com/msjpt4dH
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.
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.
currentItem has no entry for that UUID
ok ty
Nothing seems to happen when I click an item in the inventory. It's supposed to cancel the click when you click a gray stained glass pane but doesn't and doesn't add the player to the hashmap when they click the coal block
This line if (event.getView().getTitle().equals(ChatColor.GREEN+"Personal Compactor")){ will never pass
color codes will already be translated when in teh view
Alright this pretty much works now, cool
what do you mean?
maps everything except the initial location, hm
it will contain a translated color code not CHatColor.GREEN
i get it tysm
I removed ChatColor.GREEN and nothing changed
do i need to add the color code or smth?
wasn't there a memo about not using title checks
i dont pay attention to memos
most of them are trying to screw me up
praying on my downfall and such
@echo basalt im just joking what do I do instead of a title check?
when the gui is open you toss the view on a Map<InventoryView, MyCustomGuiData>
When the gui closes, you yeet it from the map
and to check if it's your custom map, get the data and do stuff
sounds complicated
yeaa
eh what this
Non working octree ig?
quadtree
can i call loc.getWorld() or other bukkit read methods inside a compltetablefuture?
hard maybe depending on surrounding code. make sure nothing is going to change the variable during the time that the future is running, then it's probably ok
but you're playing with fire
is there any other way to access loc.getWorld() inisde a completablefuture
get the world outside of the future and pass it into the threaded computation
but even then, the world could unload while you're working on it
so you're still playing with fire
it depends what you want to do off the main thread
what are you doing
loop through blocks
and check their materials
idk if i can even do that on another thread
Isn't there a chunk snapshot or smth
yes, that would be good to use
loc.getWorld().getChunk(x,z).getChunkSnapshot()
the ChunkSnapshot object is thread safe and you can do whatever you want to it inside of a completable future
when your future returns, figure out if what you wanted to do is still valid (world is still loaded? chunk is still loaded? player is still there? whatever); if so, continue on the main thread
Is that expensive to make
i have no idea about its implementation
It copies a bunch of arrays
Is that expensive
yeah, probably
but depending on what you're doing in a separate thread, it's a tradeoff
if what you're doing off the main thread is even more expensive it may be worth it
Multi-threaded surface thing
Creates snapshots on the main thread and flood-fills given a filter
Made it for scanning valid mob spawning locations in an island type deal
world is fine
things within the world are not
i think theres a diff problem
i asked this because my completablefuture was not returning stuff properly
it either returned null or crashed
.exceptionally and print it out
Lets say I have two models
One is a triangle the other is a square
I have to put one side of each shape on top of each other but for that I need to rotate the triangle in "quaternion" or "axisangle"
how do I calculate the values I need to set?
Usually by using maths
thats gonna depend
Is this just in a 2d plane?
if you have a triangle with a flat base then you just move one point of that base line towards the squares line
ok I should have mentioned im talking about transformations in item or block display entities
then how do you have triangles
was just an example,since you can take the thickness of it as 1 unit or 0
No isnt
then what is that
Well thats in a 3d vector space
it literally says in the document that euler angles are axis angles
u were talking about 2d shapes
a rotation around an axis
yes mb
Consider it being a cone and a cube then
"Axis-Angle Representation of 3D Rotations
According to Euler's rotation theorem, any 3D rotation (or sequence of rotations) can be specified using two parameters: a unit vector that defines an axis of rotation; and an angle ΞΈ describing the magnitude of the rotation about that axis."
that doesnt say euler angles are axis angles?
that just means that axis angle is rotation along a vector taken as an axis
whereas Euler angles are angles around 3 fixed axis
I wanted to know how I can visualize quaternions and move them around like im 3d modelling
which I simplified in saying by giving an example, which I gave in 2d, my mistake, think of it as a cone and cube instead
ah, well them im not the right person xD
lol iz alright
ill wait on someone or figure it out myself after some gruesome hours of mathematic videos
Hi!, I have problem with checking if player has item in inventory, this is my code:
if (!targetPlayer.getInventory().containsAtLeast(gpsItem, 1)) {
this.notificationAnnouncer.sendMessage(player, this.messageConfiguration.medic.playerHasNotGpsItem, formatter);
return;
}
this is check is always false. I'm convinced that player has this item because when Player join I'm putting this item to his inventory, like this:
ItemStack gps = this.pluginConfiguration.gpsItem.asGuiItem().getItemStack();
player.getInventory().addItem(gps);
What does that asGuiItem().getItemStack() do
?paste
this is my item builder from triumph gui, it is creating triump gui inventory item and then I'm getting itemstack of it
Uhhhhh
what's wrong?
I'm like 99% sure asGuiItem adds a random UUID to the item meta for the purposes of it being a trackable GUI item, so the contains will return false because the pdc doesn't match
I have idea, to loop player inventory contents and check if some item has specific nbt data, is it good idea?
uh, why not just use build() instead of asGuiItem()? that will give you the "raw" ItemStack without the GuiItem ID
yes
How to create a graph using BStats?
I get that, but I can't find out how the spigot site displays the graph
https://bstats.org/signatures/bukkit/<your-plugin-name>.svg
well you gotta put it in a image tag
[IMG]https://bstats.org/signatures/bukkit/<your-plugin-name>.svg[/IMG]
Thanks!
No problem!
Looking at the documentation it's not obvious to me whether spawnParticle can be shown only to specific players like the vanilla command can.
I'm thinking maybe it's hidden in extra or data.
World#spawnParticle
Or it's not supported.
Isn't there a spawn particle method in the player class
or just Player#spawnPsrticle
yea
Oh?
Oh .. so it is already specific to player.
Nice.
Thank you.
Now that you say it it seems obvious.
How is it possible that an item retrieved from the cache isn't considered similar (by ItemStack#isSimilar) until it has been displayed in a GUI?
My bad, I noticed the error while sending the code...
I was modifying the display name of the cached items directly and never got the correct banknote.
It was only considered similar after modifying it through the GUI loading π€£ π
Thank you!
π½οΈπΏ

will inheriting an abstract class with public methods be bad if the inheritor does not use ALL the common methods of its parent?
general methods in protected
does not use or does not override?
Extending an abstract class will force you to implement any unimplemented methods
you can choose what others to override
just make the subclass has consistent behaviour with the parent and dont care about unused methods
the actual @override annotation is just a compiler thing. it will tell you if your method signature is correct in the IDE. It has no implementation at runtime
yeah though its very advisable to make override mandatory (in your head I guess) for every method you override, just so you know whats going on
also because the ide will let you know if you override a method incorrectly
does not use but contains them in an abstract class.
and not using override it will just shadow the method instead of overriding
is protected
well you have to implement every abstract method, but whatever else you do depends on what you want
will this be a burden for the heir?
code will not compile if you do not implement an abstract /interface method when using the class
itβs just that not all inheritors of the abstract class use it completely
if you actually call the method is up to you
you don;t have to use a method just becuase its there
that is, not all inheritors can use auxiliary protected methods of an abstract class, and is this normal?
usually the reason I make a class abstract is that there are some functions I want to be variable depending on something else and then I call the abstract function inside the abstract class, and let the inheritors decide what to actually do in the method
you are using strange terminology. Its hard to understand exactly what you are asking
if your abstract class has protected methods, only the class that extends/implements it will be able to access those protected methods
look - there is an abstract class with its own logic implementation and its descendants class A and class B. Class A uses methods of the abstract class internally (protected), but class B does not
descendants? is not a Java term
heirs*
children
yes
i bad speak engl this all translate google
it all depends on what you wanna do with each class
Nothing wrong there. you are not forced to use a protected method
so I can put a method inside an abstract class and it's not a bad thing if not all childrens use them
not bad
does this apply to default methods of the interface or not( probably because of the public type)?
but there's nothing wrong with using it as a utility inside an implementing class I think
like abstact class
haha
No nothing wrong with that. Generally default will just allow you to ignore it unless you want to use it
how do I make ConfigurationSection#getBoolean(String) return null if it doesn't exist
it will return false, unless the section doesn;t exist, then you get an NPE
oh sorry, it will return null
i mean
how do i make it return null sorry i made typo
cuz rn it will return false if it doesn't exist
no it returns null if it doesn;t exist
can't return null
boolean is a primitive
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
ConfigurationSection#getBoolean(String)
no i mean getboolean
That's not the right method
oh sorry I'm looking at getString
You can use isSet
to check if the value has been set or not
contains is also an option
i see
@chrome beacon how do i make it so that the value is actually boolean
and not some random stuff
isBoolean
return section.isBoolean(path) ? section.getBoolean(path) : null;
that will return a boolean or null
so you'd have to use Boolean
kinda overkill to wrap
why do you want null if its not there?
surely false would suffice.
if (clickedItem.getItemMeta().getDisplayName().equalsIgnoreCase("Gray Stained Glass Pane")) {
Is this valid to check to see if an item clicked in an inventory is a Gray Stained Glass Pane?
Don't detect items by their name
don;t match names
item.getType() == Material... https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html#GRAY_STAINED_GLASS_PANE
to prevent confusion on users. Lets say they made typo on something, it won't be hard to find out what went wrong
Is matching by ItemStack okay?
π why does code have to code
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket
...
private fun hidePlayer(bukkitPlayer: Player) {
val profile = (bukkitPlayer as CraftPlayer).profile
val entry = ClientboundPlayerInfoUpdatePacket.Entry(
bukkitPlayer.uniqueId, profile, false, -1, GameType.DEFAULT_MODE, null, null
)
val packet = ClientboundPlayerInfoUpdatePacket(
EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED),
Collections.singletonList(bukkitPlayer.handle)
)
val field = packet.javaClass.getDeclaredField("c")
field.isAccessible = true
field.set(packet, listOf(entry))
Bukkit.getOnlinePlayers().forEach { (it as CraftPlayer).handle.connection.send(packet) }
}
kotlin eeww
it is in my pom.xml
and did you build with maven
yup about 17 times because i cannot figure out why its doing this
no special-source plugin
?nms
Hey, i'm trying to create a npc but when I create it, it doesn't appear
I don't recieve any error
version 1.20.6
this exact same code was working in a diff plugin so its a config error i just dum
?nocode
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
i'm searching it 1 s xd
public ServerPlayer createNPC(Player player, String name) {
MinecraftServer minecraftServer = ((CraftServer) Bukkit.getServer()).getServer();
ServerLevel serverLevel = ((CraftWorld) player.getLocation().getWorld()).getHandle();
String translatedName = hexTranslator(name);
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), translatedName);
ServerPlayer npc = new ServerPlayer(minecraftServer, serverLevel, gameProfile, ClientInformation.createDefault());
npc.setPos(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getY());
SynchedEntityData synchedEntityData = npc.getEntityData();
synchedEntityData.set(new EntityDataAccessor<>(17, EntityDataSerializers.BYTE), (byte) 127);
setValue(npc, "c", ((CraftPlayer) player).getHandle().connection);
showAll(npc, synchedEntityData);
return npc;
}
public void showAll(ServerPlayer npc, SynchedEntityData synchedEntityData) {
for (Player player : Bukkit.getOnlinePlayers()) {
sendPacket(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc), player);
sendPacket(new ClientboundAddEntityPacket(npc), player);
sendPacket(new ClientboundSetEntityDataPacket(npc.getId(), synchedEntityData.getNonDefaultValues()), player);
Bukkit.getScheduler().runTaskLaterAsynchronously(NPCore.getInstance(), new Runnable() {
@Override
public void run() {
sendPacket(new ClientboundPlayerInfoRemovePacket(Collections.singletonList(npc.getUUID())), player);
}
}, 40);
}
}
there's the code
?paste
what about this? i'm using buildtools and have reinstalled it for 1.20.2 already incase it was some weird compiler thing, also i am using java 17 so that's fine. very confused by what im supposed to be reading in that link
?nms
^ read this one instead
i was already using mojang mappings?
no
not correctly
which is why you're having problems
you're using remapped spigot, but not unmapping after compiling
is it the stuff in <executions> in the pom
you are missing the special-source plugin
me when class Foo extends @NotNull Bar is valid
Do someone know why the npc isn't spawning?
npc.setPos(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getY());```
oh
@chrome beacon @eternal oxide ty both i am a bit dumb when it comes to compilation stuff :greg:
i knew that
hi rad, I'm always watching
same ποΈ
LMAO
he's losing it
although when has he ever been sane after that yt session
Bro I was writing a program to add spigot mappings into others until I understood tiny needs a field descriptor, which csrg doesn't have and now I am depressed
tiny π
I could either not give up and make it take a server jar to find the descriptors itself or I can just say "ah, fuck it" and go relax
I chose the latter
Tring to build complie spigot from my IDE, but I keep running into this. Any ideas?
I have the bukkit and craftbukkit repos installed already
The applyPatches script started a rebase, and I connot abort it
I think you have to use buildtools jank to create/setup the source. then you can compile normally via maven
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
I have read though all of these
There is no explination I can find as to how to compile spigot
From the idea at least with my changes to Bukkit and Craftbukkit
? it tells you to run the package task
I have
if you are patching bukkit/craftbukkit and spigot fails to patch on top of that, you need to resolve the merge conflicts and then rebuild spigot patches to save that state
I am testing without changes to Bukkit and CraftBukkit forst
I just want to get a spigot built to complie from the repos I cloned
I can get CraftBukkit easy. But Spigot on the other hand...
The scripts just are not working
The applyPatches script gets most of the way and then failes here. But I do not understand why, as I have not made any changes to Bukkit, CraftBukkit, or Spigot
well what's the conflict?
You mean if I try and run that git command?
My ide thinks there is a rebace in progress, but when I use git commands it apreas as if nothing is currently happing
a rebase is in progress in Spigot-Server
ah
Ok now I got something
All of the patches are failing to apply. I wonder if I need to rebuild them
Get all this when rebuilding patches
grep: warning: stray \ before -
grep: warning: stray \ before -
grep: warning: stray \ before -
grep: warning: stray \ before -
Patches saved for Bukkit to Bukkit-Patches/
fatal: ambiguous argument 'origin/patched': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
grep: grep: warning: stray \ before -warning: stray \ before -
If it's any consideration, whatever it is you're wanting to contribute, unless it specifically needs to be in Spigot (e.g. a performance change or adjustment to existing Spigot-exclusive API), you only really need to make your change in and compile Bukkit and CraftBukkit
You can test on those server implementations. That's all we ever do
Spigot's patch system is a bit convoluted and difficult to follow. I've been contributing for like 8 years and I'm only just now sort of getting familiar with Spigot patches. And I'm still shit at it
proof?
The component API that originally targeted Spigot :p
Working with the patch system for that was a bitch
how do we know you wrote that
My commits are signed
what if ur pc got hacked
Yeah, I just would like to test with my spigot plugin, so I would like to have a spigot server. But If I cannot, I guess I can deal
I mean yeah I just let my Spigot-dependent plugins fail on my test server lol
Usually I only ever boot up CB to test the new feature I added which I write a test plugin for
ill let you fail all over my test server
Sometimes it's a good idea to not send messages
its funny though
I think I need to use build tools to setup some sort of workspace to do it properly
But I think I will just go your route and just... Not
And just make a new plugin that is not spigot reliant to test
this is a pain in the ass to setup lol
In fairness, I use the BuildTools directory as a workspace root as well, pretty much. But yeah, all you really need is to depend on the Bukkit artifact instead. It's installed locally when you build Bukkit (assuming you're using mvn install)
Yeah using mvn intsall
Then yep, just depending on that artifact and version should have your changes after you've made them and installed
My project pom literally just looks like this lol
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>wtf.choco</groupId>
<artifactId>TestPlugin</artifactId>
<version>1.0.0</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<!--
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
-->
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
That source should really be 21 now though
I'm proud of that domain lol
I know how to create a customConfig.yml but can i create it inside my plugin and get it in my plugin folder?
Yes. That's what getResource() and saveResource() are for
how does this work?
please
π
public final class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
this.saveResource("customConfig.yml", false /* don't replace the file on disk if it exists */);
}
}```
why does it send a message
Then you can load it with this:
YamlConfiguration customConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "customConfig.yml"));
I don't know why it sends a message tbh. It's annoying. I've considered removing it but I keep forgetting lol
Maybe I'll throw a comment on Coll's PR
fr thx you
i dont think colls pr covers it
It doesn't, so I'll ask him to cover it :p
new pr time
Well, no, because we could just use the --verbose flag that he introduced
PR hasn't been merged yet
Nope
is there an event where it fires when a player sends a command?
and that is how a PR is never accepted into mainline
there will be no bug if i uograde to 1.20.4 to 1.20.6?
PlayerCommandPreprocessEvent or ServerCommandEvent (this one is for consoles)
well there always are
idk but it says this
This event is called whenever a player runs a command (by placing a slash at the start of their message).
okay thx
But in general they are safe to ignore
does that mean placing a slash at the start of the message triggers that event?
Just remember that the bukkit API (and thus the documentation) was designed decades ago
i mean like
Not sure how that's relevant. That Javadoc is correct
even if the message is not yet entered its still triggered?
as long as it has slash? or wat
The enter key was pressed
Yeah, but in today's language it is a bit odd
so use nms instead
oh so the enter key shud be pressed. ok got it thanks
Anyways - quick question, does anyone happen to know the command for updating the gradle wrapper
Prob stole some weed from my classmates or something
./gradlew wrapper --gradle-version=8.x iirc
might have to run this twice ^
Ah, forgot the gradle- part; darn it
i manually update mine kek
could also use latest instead of a specific version but I digress
It's valid English, but you'd probably not say that a command is prefixed by a slash these days
sometimes being too specific can cause confusion
I'm confused
Well I was like "huh? Aren't commands handled by brig these days?"
the "(by placing a slash at the start of their message)" implies that a command is run just by typing a single '/', and not even pressing enter
but thats not how that works it just reads slightly weird
idk - I always took for granted that commands are commands so when someone tries to explain me what commands are I might be a lil confused
But it's correct, yes.
"runs a command" implies actually running it
idk man. This isn't a hard thing to grasp
yeah ik
i'm gonna try my best to explain this, so basically i have a cannon and i want to make it so the player can rotate it (WITHOUT MOVING IT), it's made out of block displays and the player doesn't ride it, so the position of it and the cannon isn't sync. I've tried changing to yaw and pitch of all the cannon parts based on the player's yaw and pitch and it worked but the position wasn't sync, and the player was basically floating
this is an image to what i want to do, the cannon shouldn't leave the blue circle and the black point is where the player stands
each part has to be relative to the origin you want to rotate around
where the player is is the origin
ic
I have added a new method in Bukkit, and implented it in CraftBukkit, but how can I update my local maven repo with the chnges I made in Bukkit, so I can see them in my local CraftBukkit repo?
mvn install or smth?
I get this faliue when I do that
With or without my changes
Oh wait maybe not
Ah forgot to add an annotaion
Yeah the tests should tell you exactly why they failed
how do i get the location 2 blocks infront of the player depending on the yaw not the pitch
getDirection().multiply(2)
you did say in front
and i did say depending on the yaw
if you want flat plane getDirection.setY(0) then .normalize().multiply(2)
ok
that was yaw, pitch would be looking up/down
yo guys i have a pvp zone for my server where u can place blocks and stuff, is there a plugin i can use which clears stuff the players place every 30 minutes or so
Can someone tell me if I linked these prs properly accorsing to the contribution guidleines? I think I did, but I would like to confirm before I make something bigger
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1408/overview
I mean the Bukkit and CraftBukkit prs
Thats likely never getting merged
teh int id only use is for packets/nms
which is not API
Yeah, I realize that. I do use it with NMS. Would be nice to have it as api for what I use it for, but I understand if this does not get merged. More interested to know if the prs are done properly. Cause the guidlines say I need to link them, and I am not sure if the way I did it is correct
I only see teh CB commit
So they are not linked correctly hmm
simply add the craftbukkit PR link to the bukkit PR, and vice versa
Just as a comment, and the URL?
Okay I can do that
You can also do bukkit#<id> and craftbukkit#<id>
But yes, a link to the related PR would suffice
yo guys i have a pvp zone for my server where u can place blocks and stuff, is there a plugin i can use which clears stuff the players place every 30 minutes or so
#help-server β€οΈ
can anyone help ? : (spigot 1.16.5)
Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft("mending");
Caused by: java.lang.IllegalArgumentException: Invalid key. Must be [a-z0-9/._-]: mend?ng
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:191) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.NamespacedKey.<init>(NamespacedKey.java:50) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.NamespacedKey.minecraft(NamespacedKey.java:141) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at me.erano.com.kit.KitService.parseItemsFromRequestedKit(KitService.java:72) ~[?:?]
at me.erano.com.kit.KitService.getKitListFromConfig(KitService.java:45) ~[?:?]
at me.erano.com.menu.kit.CustomerKitMenu.displayTo(CustomerKitMenu.java:31) ~[?:?]
at me.erano.com.menu.Menu.onOpen(Menu.java:65) ~[?:?]
at me.erano.com.menu.MenuService.handleOpen(MenuService.java:40) ~[?:?]
at me.erano.com.menu.MenuListener.onOpen(MenuListener.java:23) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_202]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_202]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_202]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_202]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
... 29 more
mend?ng
something is wrong with theiyou have in your source
Why do letters from other alphabets always get their own char, even when they're identical to the latin letter
because its not about appearance
its about teh alphabet
and that means
using a specific codepage would be pointless if you had to keep jumping to a different one for certain characters
ah
yeah i guess:
kits:
dirtman:
display-name: "wqeqwewq"
menu-lore:
- "asdasdasd"
- "asdasdasd"
price: 10
item-list:
WOOD_SWORD:
count: 1
enchs:
KNOCKBACK:
ench-level: 1
MENDING:
ench-level: 1
armor-list:
LEATHER_HELMET:
count: 1
enchs:
MENDING:
ench-level: 1
permission-string: "MileniumCraft.Dirt"
icons:
DIRT:
custom-ench: true
COARSE_DIRT:
custom-ench: false
^^
thanks
Dead channel. I guess devs are taking friday off
enjoying some minecraft
Does it have mods or plugins at least
spigot smp
#1242181722326569000 enjoy it with us
I'm having a lot of trouble adding more textures to the Minecraft clock item than the default 64.
I added 144 textures, thinking that it would be a nice number divisible by 12.
But now the time is all out of whack. When the MC time is midnight the clock shows 6.
12 is at correct position.
how many are there by default
then you can't add more?
And why is that?
mojank i'm guessing
I mean there's support for the "time" predicate.
It ranges from 0 to 1.
However any small adjustments to the values simply won't do anything because it's so much out of sync.
All the textures are, eventually, shown correctly on the clock.
But it's just not in sync with the actual time of the day.
I wonder what would happen if I shortened the values so it ranged from 0 to 0.5 π€
You know about this page right? https://minecraft.fandom.com/wiki/Daylight_cycle
Anything in particular in there?
You most likely will need todo some kind of conversion or your current conversion is incorrect. I am also assuming you are updating textures via code? I am not home but I will give you an algorithm possible later that will make it in sync
Nah clocks update automatically
No, I'm not updating them via code.
Ah ok nvm
It's the vanilla Minecraft clock.
With the time predicates ?
I just realized
Yeah correct
Boo fandom wiki
Ik lol
Well, the formula is supposed to be 2xn-1 / 2xphases.
I wrote a program for outputing the values:
using System;
public class Program {
public static void Main() {
string timePredicates = "";
for (int i = 0; i < 145; i++) {
decimal increment = (decimal)(2 * i - 1) / 288m;
string theString = $"{{ \"predicate\": {{ \"time\": {increment:F7} }}, \"model\": \"item/clock_{i}\" }},\n";
timePredicates += theString;
}
Console.WriteLine(timePredicates);
}
}
But it doesn't really matter what the values contain it's so much out of whack.
Do you feel like the time is offset or are the values and textures showing are all over the place?
Noon is shown correctly. But midnight is shown as 6 pm on the clock.
Hmm could it possible be that it also goes negative for the time?
Like you have to account for -1 to 1
I am not sure like havenβt done time predicates before. Just giving external suggestions from things you could miss π
Make sure you have them in order from lowest to highest
Yes. From 0 to 1.
Not sure if adjusting the textures themselves to a different midpoint would help or not.
That's the first thing I did. clock_00 is showing noon. 32 is is midnight.
And 63 is noon again.
Oh...
Yeah, so my textures have noon at 00. Noon again at 144.
But at the mid point, sure enough, it has 6 pm.
Well that's interesting.
I mean, I just started from noon and progressed forward from there until all of the textures were done.
weird it has 32 as midnight and not 31, where as 63 being noon again is more correct then 32
however I guess it would seem appropriate if midnight and towards noone from there is all even's and then noon to midgnight is all odds
if that is the case, makes it easy to know which side of the clock you are on
I'm still trying to wrap my head around what exactly went wrong and why.
Maybe I've been going in the wrong direction.
Now someone make a full analog clock accurate to the minute
Thatβs only 1440 textures
Well, this is accurate to 5 minutes. Anything more than that and you'd have to raise the resolution.
I would, but have no interest in making textures
would still need textures for a digital one no?
720* because am and pm look the same
Well yeah but numbers are easy
now with digital how many variations would there need to be π€
well, its half if we use 12 hour clock
Did I just do it wrong and I should have made 288 textures instead of 144 ... ?
Is that why it failed?
Oh snap.
Because even though the clock face only displays 12 hours there's still 24 hours in a day. So with half of them missing that would land me at 6 pm at midnight.
Yes, I think so. Well, it's easy enough to fix.
I just copy the existing textures one more time.
Thank you for your help.
Although that's kind of silly .. maybe I can just define them to reuse the existing textures in clock.json.
don't see why not
You can
hence I said I would only need half the amount of textures for a 12 hour clock lol
makes no sense to make 1440 textures if half of them are the exact same XD
Well yeah but you still need to show am and pm on a digital clock
1440 is if we had 24 hour clock which is what your math shows
hmmm
I wonder if two textures can be used
I really don't want to make 1440 textures
what if you make a script to do it
at the end of the day it's just a base image + some image/line distorted / rotated in a way, for each hand
For a digital one it would be easy
For an analog one a bit more effort but probably still easy
If you want to make hands by hand you can just make a quarter / eighth and mirror and flip
You can also just make the 12 hour hand ones and the 12 minute hand ones
Then mix them together
Not 12, 60
What is reflections used for in java exactly?
During runtime, scan variables, methods and generic types of classes and do stuff with them
Like check if theyβre annotated
Or maybe invoke them
Okay so what I need to do if I want to make a custom Subcommand loader is use reflections.
public abstract class Subcommand extends WarpConfigHandler {
public String name;
public String permission;
public String noPermissionMessage;
public Subcommand(String name, String permission, String noPermissionMessage) {
this.name = name;
this.permission = permission;
this.noPermissionMessage = noPermissionMessage;
}
public abstract boolean execute(CommandExecutor sender, String[] args);
}```
This is the format I'm going with, what i want to do is loop through a package and have it load all the subcommands with name/perm/nopermmessage
So with that being said, reflections would be the right way to do it, right ?
sorry, reflections π
why goofy ?
because its generally considered a pretty useless automation
I meaaaaan..
I guess you're right, but at the same time I wanna learn how it works and implement it on a custom command handler later down the line
yea
i mean when u learn
sometimes doing the wrong thing teaches you the right thing
:D
I cannot get remapped spigot with BuildTools anyone can help ?:
Patching net\minecraft\world\level\WorldAccess.java
Rebuilding Forked projects....
Resetting Spigot-API to Bukkit...
HEAD is now at 7e29f765 SPIGOT-6502: Loading a class from a library of another plugin resulted in a ClassCastException.
Applying patches to Spigot-API...
error: unsupported value for gpg.format: ssh
fatal: bad config variable 'gpg.format' in file 'C:/Users/Erano/.gitconfig' at line 5
Something did not apply cleanly to Spigot-API.
Please review above details and finish the apply then
save the changes with rebuildPatches.sh
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [C:\Windows\system32\cmd.exe, /D, /C, sh, applyPatches.sh]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:1042)
at org.spigotmc.builder.Builder.runProcess(Builder.java:967)
at org.spigotmc.builder.Builder.startBuilder(Builder.java:679)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:60)
public void register(final AbstractCommand command) {
System.out.println(command.getAliases());
cmdMap.register(Papyrus.inst.getName(), command);
}```
I have this right here and command.getAliases() is empty (prints out `[]`) but for some reason now the command `/papyrus:` without anything exists as an alias to the command even though it should be empty
is it ok to use Executors.newSingleThreadScheduledExecutor() for scheduler that checks if config has been modified
why
why do you even need that tho
GUYS i solved
it was all about git configuration
https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key
https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key
new error : [WARNING] The requested profile "remapped" could not be activated because it does not exist.
Maybe I'm wrong, but have Mojang mappings been released for 1.17 or later?
Sounds about right, what version are you trying to build and share your full log
meow
any1 know a good way to take a number and convert it to a number between -1 and 1 (im trying to make a custom speed stat)
is there any way to re-obf under 1.17
I mean probably
1.17.1 yes
But not with spigot
what would be a good way to learn reflection?
Depends entirely on what numbers you want to take
well I have a number (Double) however that double is often way more than 1 or -1 the way im currently doing it is multiplying it by 0.01
Math.min(Math.max(value, min), max)
meow
Yes but how much more
You need to think what your input range is
several hundreds
my input range is my cat
Then just divide by the maximum
ah I see
Issue with reflections
?nocode
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
reflection or reflections?
reflection
The problem is, that it scans but for some reason, reads nothing.
Reflections reflections = new Reflections("com.ancho.commands");
Set<Class<?>> classes = reflections.get(SubTypes.of(Main.class).asClass());
for (Class<?> clazz : classes) {
System.out.println(clazz.getName());
}```
`2024-06-01 02:29:04 INFO Reflections:219 - Reflections took 47 ms to scan 1 urls, producing 0 keys and 0 values`
what is a HangingEntity
Hey guys, could someone tell me a simple way to add an enchantment effect to an itemstack?
I don't want it to show the enchantment when you hover over it, but I want it to glow
itemMeta.addEnchant(Enchantment...)
itemMeta.addItemFlags(ItemFlag...)
I tried that but it didn't end up adding the effect
Youll have to show some code you did
remove the add item flag part, does it add the enchant?
I think youβre overriding the enchantment you are adding with the setItemMeta call
Donβt add the enchant to the ItemStack directly
instead of is. use im.
Or do it before the getItemMeta call
whats wrong with normal enchant LURE?
it has a boolean parameter that does the same as that
so does true mean safe or unsafe?
im.addEnchant(Enchantment.LURE, 1, false); prob something like this
okay cool i got the enchant to get on it
just try it
lemme see if the hide flag works
you might need HIDE_POTION_EFFECTS in addition
anyone know if there is a guide out there for custom enchantment tooltip creation? specifically, i want a generalizable way to appropriately add the text for a custom enchantment to an item's description
rn i find it just creates blank space
like dat
I don't understand
public String translateColorCodes(final String string) {
return string.replace('&', 'Β§');
}
public Component colorText(final String string) {
return Component.text(translateColorCodes(string));
}```
I have something like this but it gets a warning in console. I want to do this instead of like Component.text().red() or whatever because im making a language like Skript where i can just do "&c[Something] &7Something" instead of the weird component builder syntax
?whereami
oh is adventure not a part of spigot??
nope
my bad
there are adventure bindings for spigot
but its built in to paper
which is likely what you're using
no worries
?whereami
Can someone help me, I want to change the default essentials text like when u do /warp something it says teleporting
I wanna change that
Sounds like you should just look into their translation files and configure the text...
Okay
how to I set different amout of homes allowed for each rank in essentials
like I want vip to have 3 homes
but member to have 2
There are ideas on how to make the blocks move smoothly and so that they are solid. 1.16.5 (not display entities)
Falling block + Shulker
Why not barrier block?
They don't move
https://pastebin.com/WzsMePcS
I wrote this function to reproduce the time predicates in models/item/clock.json and it works perfectly.
So, next I set it to 288 iterations.
But the clock does not show the correct time.
It's off from 5 minutes up to almost 1 hour.
?paste
falling block can it move smoothly??
And solid?
Shulker box, the chest like block. Not the mob.
No
You need the mob
I don't understand π€
Box is a block and can't move
I've never had any problems with falling block entities, though.
You can disable this
It's showing the wrong time π’
Even though I'm using the same algorithm as Mojang.
It's a minecraft:clock.
Oh
What better use for block move? Shullker mob or armorstand for not solid block
in terms of resource consumption
They have a different texture for it
Here's the code if you want to play with it:
https://dotnetfiddle.net/n8O3f0
And here are the results:
https://pastebin.com/yB1HVBRD
I've been trying to get this working for several days.
I'm not sure why the time is off.
It produces correct time predicates for 64 clock models, so I don't see why it would fail when changing the iterations to 288.
can i set display entity as a passanger?
yes
Hello, I'm making a taser plugin. It all works but It doesn't play the custom sound. I have no error in the console and with the command /playsound the sound work.
Here's my code: https://paste.md-5.net/wuzugogoku.java
does the player have the resource pack installed?
yes
wait me or the target?
cause my test target it's actually an npc
entity.playSound(...)
this only plays it for that entity
how can I play it in a 5 block range?
use World#playSound
an example?
entity.getWorld().playsound
just change it to entity.location.world.playSound
ok thanks I'll try
yeah or that
ok it works, thanks
also work on reducing that hadouken
anyone know why glass is showing through text displays?
o it wont let me add a photo
like this ^^ it shows through all, even when transparent or with a background colour
makes text very hard to read
I don't understand
shader issues
this is default minecraft tho, no mods; is this just how glass interacts with text displays in default?
a better picture might help
are you finding the glass rendering in front of transparent Displays?
if class create classes in constructor and has only getting methods this manager class or factory class
what are you saying
or a builder
builder has set methods
right, but a factory doesnt need to only create objects in its constructor
it also just have a create method that does everything
however, you shoudl not really be creating objects in your constructor
why
a construtor has the responsibility of creating the class instance, not the objects it can give out
in your getThsiItem() you would `if (this.item == null) {build and set item instance, then return}
else just return this.item
where then are objects created that need to be obtained in getting?
The way I see it is
factory - isolates the creation of an object from its instantiation
builder - mainly just helps with long arg constructors
yeps
large quantities?
google translate be like:
if you have a method like createThing(), then inside of that method ideally you create a new Thing and return it
if you have a class which returns the same item over and over you can simply create it once, then return clones
if you want seperate instances
like Singleton ?
with null check
hm
it's cool to check for null but I'll ignore it in bukkit ahahaa
wdym
a singleton is different
elgarl is talking more about a template kind of thing
also its pretty impressive if you can avoid null checks for your entire plugin
it's probably best to describe my class as a "Singleton" factory
I donβt know what to replace so that it would be easy to transfer objects as parameters
singleton factory doesnt make a lot of sense
hi! Why when player is in spectator mode, the action in PlayerActionEvent is only left click air and right click block why there is not right click air and left click block?
but elgar is maybe talking about the prototype pattern?
Iβm surprised left click air even fires
Spector mode players canβt really left click
ohh, so there is no possibility to check that?
Right click air requires an item in hand, and players in spectator mode arenβt holding items
You can raytrace to see if they are looking at a block or not
this is a wrapper for a large number of parameters + creation of singleton objects
I think I need only right click air and left click air
is it possible?
Well right click air isnβt going to happen
Unless you can somehow get them to hold an item
okay thanks
no all im saying is, if u need a singleton factory, sth is wrong w ur code
idk maybe
That doesnt need to be a singleton
at the moment there are no problems, I donβt know what will happen in the future
its also somewhat of an antipattern to pass ur Plugin instance everywhere
do you change anything about these configs? else its just a container for a bunch of configs
reload, load
right
its not really a factory then
you arent really creating anything that this class doesnt need I guess
Its not a factory, nor a singleton
I originally created wrappers to pass them as a parameter to other manager classes.
bc there are a lot of them
wait you mean inside configs or insade configManager
unsafe?
well inside the manager
since its supposed to be managing these configs
then no
or does it just holds them as like a wrapper
yes
sorry if im disturbing the on going conversation, but does someone have a clue why i cant import the spigot / bukkit api
This is my pom
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.io/repository/maven-releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.retrooper.packetevents</groupId>
<artifactId>spigot</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
but i get this error
Dependency "org.spigot....snapshotstuff" not found
this error is in the version line of the spigot dependency
its from the spigot api maven wiki
so the shapshot should work
this is where i got the dependency
Make sure you are defining and using java 21
looks like im defining java 1.8
is it enough to replace that with 21
Hopefully
5 seconds on my pc xD
shit
well if you mean just building the plugin
1:40 mins rn
like the package lifecycle action
I mean it depends on how many changes I have made in between building it
but usually no longer than 20 -30 seconds
what on earth is your definition of "small"?
hmm any idea why its taking more than 2 mins rn? btw last time it wasnt even successful aka i stopped after 20 mins
I suppose you are using some random maven plugin
nah i aint
What is it stuck at?
i mean when i started building, it said that it has no output location, then when i click on where it pointed, im just seeing how long it has been taking to build but idk where to define the output path
Could you just paste the logs then?
sure, can you tell me how to get those?
Uh idk, your IDE?
im on intelJ
Or just run it in the command line - in which case it should be trivial
do i just need to run mvn clean install?
well you rarely can go wrong iwth doing that
Though you need to have maven installed previously
Not too difficult to install on linux systems since it's usually in your package manager of choice; on windows you'd probably be best off getting it from apache directly and adding it to your PATH
hmm so i just chose maven instead of gradle in the options of the build stuff, i have the pom.xml and i can reload using maven, but if i even type "mvn" in the terminal it doesnt find anything
is there a way to check if i have it running correctly?
what terminal?
in my project the local one
i get this error in german
mvn : Die Benennung "mvn" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausfΓΌhrbaren Programms erkannt. ΓberprΓΌfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern
enthalten), und wiederholen Sie den Vorgang.
which means
mvn : The naming "mvn" was not recognized as the name of a cmdlet, function, script file, or executable program. Check the spelling of the name or whether the path is correct (if
included) and repeat the process.
btw i cant send pictures
Sounds like maven isn't installed.
tho if i right click on the pom i have the option to reload using maven
yeah that error means you don't have maven installed
hmm weird
That being you should still be able to make use of maven through your IDE
Then use the ide to build using maven.
can i reload a YamlConfiguration like the config.yml with reloadconfig()?
Maven window top right of yoru IDE
ye i have a maven window there
Then use it
I don't use IJ but there is a button there to open a terminal window
mvn clean package
yep i found the mvn clean install there
running it rn
any tip on where the .jar is now?
target folder
or jars. depends on yoru build
no target, its maven
folder called target
should i clean package or install? a guy earlier told me to run mvn clean install
package, unless you are building to use as a dependency
in the end both are usually identical as install also runs package
package and install do very similar things. just install adds the built jars to yoru local maven repo.
so unless you need it as a dependency you use package to save cluttering your .m2 with junk
there will not be a pom in yoru target folder
[INFO] --------------------< Recoil:packetevents-example >---------------------
[INFO] Building Recoil 1.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ packetevents-example ---
[INFO] Deleting C:\Users\carlo\IdeaProjects\Recoil\target
[INFO]
[INFO] --- shade:3.2.4:shade (default) @ packetevents-example ---
[INFO] Replacing original artifact with shaded artifact.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.807 s
[INFO] Finished at: 2024-06-01T14:44:03+02:00
[INFO] ------------------------------------------------------------------------
btw my plugin is called recoil
this is after i ran mvn clean package
go look in C:\Users\carlo\IdeaProjects\Recoil\target
why does it not execute the compiler and jar MOJOs?
theres only a pom called "packetevents-example-1.0-SNAPSHOT-shaded.pom"
you did not build the project yoru thought you were
yeah it never ran compile
?paste your project pom
Your packaging is the issue
You want to remove the <packaging>pom</packaging> part or use <packaging>jar</packaging>
yeah, line 10
Also, that is not how you define a proper group and artifactid, but alas - I digress
aye .jar
is there a reason i have the .jar and also another one with the same name but with original- before the name
brb
because you shade
the original jar can usually be ignored
<groupId>me.carlo</groupId>
<artifactId>recoil</artifactId>
<name>packetevents-example</name>```
although, in your case you don't shade anything into the jar so I'd just get rid of the maven-shade-plugin
ill just leave it for now, dont want to mess up anything
where does this go?
thats an example of a correct setup
alr
thank yall for the help, appreciate it
do libraries require a depend in the plugin.yml?
depend:
- packetevents
cus i cant load the plugin because it tells me to download the packetevents plugin, tho the packetevents is a library not a plugin
brb
now it has a problem with the main declared in the plugin.yml, it generated net.recoil.recoil.Recoil which obviously sounds wrong, do i just input the C:/Carlo thingy or src/main
name: Recoil
version: 1.0
main: net.recoil.recoil.Recoil
api-version: '1.19'
current status
that does not match your pom
where in the pom should it match the main
in my pom example yoru main would be me.carlo.recoil.Recoil
which is the group id of the pom?
your package is your groupId + artifactId + whatever path to your source
so if that is the path to your Recoil main in your jar your GroupId would be net.recoil Your ArtifactId would be recoil
im not sure what to do rn, ill provide more info
server error
[15:25:37 ERROR] Could not load plugin 'recoil-1.0-SNAPSHOT.jar' in folder 'plugins'
[15:25:37 ERROR] org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.carlo.recoil.Recoil'
pom before <properties>
<groupId>me.carlo</groupId>
<artifactId>recoil</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Recoil</name>
file structure for the starting stuff
src/main/java.net.frontlinemc.common #in there are all the packages
besides that the resource is in the same place like this
src/main/resources
fix teh package in your source
very top of your Recoil.java class
what teh hell is frontlinemc?
its a server a friend made, im trying to integrate his recoil stuff into a single plugin
it doesn;t seem like you have anything correct
rename the main or what do you mean
your package, main: GroupId and ArtifactId are ALL incorrect
is the group id of the main declared in the pom groupId at the top where its currently me.carlo?
GroupId and ArtifactId are sections of yoru codes package definition
so <groupid> in pom means where to start?
im confused rn
i hate spoonfeeding but could you tell me what to change to what, im confused rn
It seems like you need to change everything. Nothign matches
i dont understand what should match
first thing to do, look at teh top of your Recoil.class
where it defines teh package
what does it say
at the Recoil.java it says this
package main.java.net.frontlinemc.common.item.weapon.ranged;
ok thats terrible to start with
