#help-development
1 messages Β· Page 1921 of 1
Indirectly via the load factor
void addEntry(int hash, K key, V value, int bucketIndex) {
Entry<K,V> e = table[bucketIndex];
table[bucketIndex] = new Entry<>(hash, key, value, e);
if (size++ >= threshold)
resize(2 * table.length);
}
the code that hashmap uses for resizing
Yeah, though you can give it an initial size and a load factor if you want
you may want to search up on how hash tables works
No no, value from 0.0 - 1.0
Determines when it doubles
Default is 0.75 iirc
(75% full)
sounds like an async process
Depends on the map lol
sounds like sync
if its sync then what's the use in doing it at .75 instead of 1.0
No relation to synchronousy here
ah oops
0.75 is just the most optimal value for resizing and rehashing
i confused sync and thread
Hashtable is synced though
Uhhh, I think you can get your clipboard history in Windows. Sec. Lemme find the keybind
(or well, all methods are synchronized)
technically yes o.O
c moment
i just remembered minecraft has negative coords now urgh
short*
thats gonna be fun to implement
temporary block
with no drop
and since blocks dont have pdcc
i cant just tell it 'here's a flag, you dont drop anything'
If you want to push two signed ints into a long you can use
public static long hashPositions(int x, int y) {
// We make use of (y & 0xFFFFFFFFL) as otherwise y values such as -1 would completely override the x value.
// This is because `long | int` automatically casts the int to a long, where as the cast is by decimal value
return (((long) x) << 32) | (y & 0xFFFFFFFFL);
}
whats the reverse code for that?
that set my ram usage to 100%
and crashed my pc
lol
x = (int) (hashed >> 32);
y = (int) (hashed & 0xFFFFFFFFL);
something along this
is it something different for win 8.1
not sure how the signs work when doing this. I always use my hashing as a one-way operation
I think so
is there a check if a block got naturally spawned?
for example what block?
cobweb
ever seen a mineshaft
... kids these days
that is not naturally
Never even seen a mineshaft
that is from the world generation bruh
uh yes it is?
Pretty naturally to me
^
So the dirt block wouldn't be natural either because it is from world gen?
more like, if cobwebs don't generate naturally, where do they come from?
so you meant every blocks that players didnt place is naturally? then just check if that block didnt place from a player
well how?
i miss the part where that's my problem
no what i mean is that i cant recall or find any kind of method that gives me information about who placed a block
i dont think it gets saved
i think the api did have a method for it?
cant find any on the api
Gotta write a PDC to every block placed 
?xy
Asking about your attempted solution rather than your actual problem
Huge hashmaps and that thing. But they often prune it every two weeks or so
what are you trying?
Temporary blocks
so you need info about who placed blocks, not trying to check if that block is naturally spawned (from worldgen anyway)?
you can save a snapshot of the chunk
thats not an answer
oh no
i mean for what do you need them, i still dont understand
Well these temporary blocks should likely not get any drops or something like that
spawn cobwebs on a player
but thing is
they're not supposed to drop stuff
and since i cant flag a block to not drop stuff
im at a bit of a loss
blocks do have metadata but not pdc
which means i need some way to either delete or track them over restarts
Are these cobwebs still present when the player goes away from them?
Lmao so i have an image, i opened it as a text field, made it utf 8 then went to a utf 8 to binary converter, made it binary code, then went to a binary to image converter
not supposed to
made it an image and installed it
without previewing it
then i opened it
my pc crashed
LMAO
it didnt crash but the memory usage went to 99%
kekw
putting them on a timer and using metadata would probably help
(a few minutes ago i thought it was cuz of pressing win+v)
why did it happen btw
is it cuz it tried to read binary code that doesnt show as an image
as an image
what was it even doing when it couldnt read it π€
I personally have https://github.com/Geolykt/EnchantmentsPlus/blob/4xx/src/main/java/de/geolykt/enchantments_plus/enchantments/NetherStep.java#L80 and https://github.com/Geolykt/EnchantmentsPlus/blob/4xx/src/main/java/de/geolykt/enchantments_plus/Enchantments_plus.java#L85 for something similar to this (block breaking logic excluded)
maybe your below 1.14?
idk the ram usage went to 99%
im on 1.18
Blocks do not have pdc
then i had to take my battery off
BLOCKS have no PDC, Chunks have no metadata
if either would have both it'd be fine
but this way it's just plain dumb
that is a way to crash pc, i know it but i just didnt remember how it happened
I just removed my battery
it might damage my laptop cuz it was still on
but idk
i didnt care about data loss
π³
org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event FinishedEvent. Static getHandlerList method required!

wait what
bruh
but btw
Asking about your attempted solution rather than your actual problem
before asking a question
I think you should actually read the info
Rekt
my ORIGINAL question was about a problem i encountered while designing my ORIGINAL solution
There is no indication of an XY problem here
then it got worse from there
i feel like it is π¦
it is not, not at all
The plugin places a temp block and there should be a certain action if the block is interacted with. Not a XY problem at all
i just dont understand what you are trying :)
he asked if there is a way to check if a block is naturally spawn first
Because that would be a workaround
But is not the actual question
xy problem from there
I was just looking through this project, and I just realized: is this a recoded Zenchantments?
It is a fork of this plugin
I made it almost two years ago
I am trying to prevent getting material from nothing
issue is if i use metadata a restart would reset the block to normal
and if i store it otherwise there's... different problems
like if i use PDC i would need to jump through a lot of hoops to record the blocks in the chunk pdc
I personally have a HashMap<Location, Long>, whereas the Location is the location of the block and Long the time it was placed. I then remove the block at the given location if X time passed or if the server shuts down
I do not know how well it works with chunk unloads however
you can edit blocks from unloaded chunks iirc
But I think the server will just reload the chunk and then alter them, and the server shutdown does not need to be that quick so shrug
Does that work? Changing a huge set of blocks onDisable?
yes
Neat
and you usually dont need to compute physics so its pretty fast
oh btw how do you do it the other way? How do you trigger that when a specific time is reached?
are you using the sceduler?
Yep
No idea
anyone know how to spawn an entity only visible in a certain range?
You probably would have to handle that manually. So a runnable checking position and sending packets for spawning and despawning
But how do I spawn a fake entity
like I just want to spawn an armor stand that's not actually registered with the server and then remove it later
thats unsupported
why packets
it's just an armor stand with no ai that doesn't even need to be persistent
just a damage indicator haha
you can do that with api
only visible in a range
setPersistent to false, setMarker to true, setAI to false
Was there not a entity added in 1.18 called Marker?
Who's sole purpose was to be a hologram?
it is not being rendered at the client at all no?
no but like
I thought it supported a display name
that's not the problem
im trying to make a hologram that's only sent to certain players
hide it from other players with hideEntity
nah that's too slow
have you benchmarked?
lol
non ticking armorstands are like, nothing for the server
packets are not necessary any more
Every time an entity gets damaged, an armor stand will pop up.
ok?
ok
every time something gets damaged
is a little much
plus a little distracting
why don't I just send a spawn entity packet once and then a remove entity later to the players that I actually want to show these armor stands to?
no it'll say a damage number
but I really just need to know how to provide the necessary packet arguments without actually making an entity
How can I set a POTION Material (Material.POTION) into a potion of strengh?
get the meta, cast it to PotionMeta
modify the meta then set the items meta back to that
bunp
'k I give this #### up
?????
PotionMeta
dude, just get the item meta
ugh wtf is this lol```
[INFO] --- specialsource-maven-plugin:1.2.2:remap (remap-spigot) @ Emoji ---
[WARNING] The metadata C:\Users\mfnal.m2\repository\org\spigotmc\minecraft-server\1.18-R0.1-SNAPSHOT\maven-metadata-jeff-media-gbr.xml is invalid: entity reference names can not start with character '&' (position: START_TAG seen ...tion(e,a,t){var n,r,o,i=a.createElement("canvas"),p=i.getContext&&... @16:72)
[WARNING] The metadata C:\Users\mfnal.m2\repository\org\spigotmc\spigot\1.18-R0.1-SNAPSHOT\maven-metadata-jeff-media-gbr.xml is invalid: entity reference names can not start with character '&' (position: START_TAG seen ...tion(e,a,t){var n,r,o,i=a.createElement("canvas"),p=i.getContext&&... @16:72)
Adding inheritance C:\Users\mfnal.m2\repository\org\spigotmc\spigot\1.18-R0.1-SNAPSHOT\spigot-1.18-R0.1-SNAPSHOT-remapped-obf.jar
java.util.zip.ZipException: zip END header not found
at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1469)
at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1477)
at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1315)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1277)
at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:709)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:243)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:172)
at java.base/java.util.jar.JarFile.<init>(JarFile.java:347)
at java.base/java.util.jar.JarFile.<init>(JarFile.java:318)
at java.base/java.util.jar.JarFile.<init>(JarFile.java:298)
at net.md_5.specialsource.Jar.init(Jar.java:242)
at net.md_5.specialsource.Jar.init(Jar.java:222)
at net.md_5.specialsource.mavenplugin.RemapMojo.execute(RemapMojo.java:193)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
(PotionMeta) itemMeta
maven moment
whoa lol
is there a way to make so you dont have to run buildtools to build a plugin
to be fair, maven is not at fault here but rather a plugin which could do the same thing in a gradle env if it was to support it
I won't stress myself with that shit
lmao I used 1.18 instead of 1.18.1
LMAO what's wrong
PotionMeta meta = (PotionMeta) item.getItemMeta();
Don't care.
alright, cya
I realised I don't need it either.
I am just happy that the alpha is finally playable.
Even if there is only one kit.
1k armorstands in a single place
sometimes im just thinking...
20 tps
why
512 MB RAM O.o
You only need to run it if you're using NMS
forgot about maven
You will not recieve any benefit from using packets. Just breaking on every version. We're in 2022
in 99% of cases you don't need to run buildtools at all?
anyone knows what event I can use to add fake players to tabcomplete and tablist?
I can't just create "normal" fake players because the players must have special chars in their name
unfortunately it doesn't do anything
is it possible to check if player is in third person?
no
nah
that's client sided
hm
I've seen it work not sure what version that was
it dont work unless we do so idk
no
there's a maven repo for spigot-api
Ah it was 1.16.5
its gradle btw
Gradle still uses maven repos
thats really nice about gradle tbh
gradle also uses maven repos
yes but the build dont work unless the person runs build tools thats all i know bro
yeah well you use spigot... of course you need buildtools for that^^
you never mentioned that you're using spigot as artifact
Depend on spigot-api and add spigot repo
in 99% of cases you only need spigot-api
however why don't you just run buildtools once? π
im fine with that but since its open source the owner dont want that to be nessacarry
Hmm, i am trying to use fastutils' find-deps.sh but im an idiot
https://github.com/vigna/fastutil/blob/master/find-deps.sh
./find-deps.sh find ./PathingAPIjust gives me:
->.class as an output
oh okay yeah then just add the spigot repository and use spigot-api instead of spigot
Hello does anyone know an alternative to block users from clicking a menu? for some reasons this is not working....
public void onPlayerInvClick(InventoryClickEvent e) {
Player player = RecipeSigns.plugin.getServer().getPlayer(e.getWhoClicked().getName());
if (RecipeSigns.plugin.viewingSign.containsKey(player)) {
Chat.printChatMessage(player.getName());
Chat.printChatMessage("cancelled1");
e.setCancelled(true);
}```
https://sapu.freevirus.click/vJVMWYFb
sorry for the link, it's a video i though it had a preview here
Repo is there. You're still depending on spigot instead of spigot-api
Not clicking that link...
Anyways does it print your message
why getting the player based on the player who clicked
@ivory sleet
nice link tho
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Thanks
i mess up that prefix too
how does Base64 work
BRO
H is SA==
HH is SEg=
tf
i want to learn it but its so hard
It's binary (base 2) converted to base 64
it takes bytes actually
yes it prints them
Ah
making a plugin for easier shearing
Gets a list of all entities within 3 blocks of the sheared animal, iterates through the list, and fires another shear event on every animal of the same instance
private boolean onEventAlready = false;
@EventHandler
public void OnEntityShear(PlayerShearEntityEvent event) {
if(onEventAlready) return;
System.out.println("Shear event fired");
onEventAlready = true;
Entity animalType = event.getEntity();
Location animalLocation = animalType.getLocation();
Player player = event.getPlayer();
ItemStack usedShears = event.getItem();
EquipmentSlot usedHand = event.getHand();
List<Entity> nearbyEntities = (List<Entity>) Objects.requireNonNull(animalLocation.getWorld()).getNearbyEntities(animalLocation, 3, 3, 3);
System.out.println("Collected list of nearby entities");
System.out.println("Looping through entities");
for(Entity animal : nearbyEntities) {
if(animal instanceof Sheep) {
System.out.println("Entity is a sheep, firing shear event");
Bukkit.getPluginManager().callEvent(new PlayerShearEntityEvent(player, animal, usedShears, usedHand));
}
}
onEventAlready = false;
}```
problem is that the console correctly prints ``Entity is a sheep, firing shear event`` but no sheep is sheared nearby
Firing the event does not shear the sheep
ah shoot, cant believe I overlooked that
You still have to do that
anyone?
You know you donβt need that weird getPlayer stuff
You can just cast HumanEntity to player
yeah, it has stopped working for no reason on my server so now im looking for an alternative, using the same plugin alone fixes it
but I really have no idea what other plugin could mess it up
does your viewingSign collection contains the player?
yeah
are you sure?
it prints the name, then it print cancelled
and then it should cancell it
can u come and see in general1? :D
k
what do you mean?
@EventHandler(priority = EventPriority.HIGHEST)
and change that player to (Player) event.getWhoClicked()
niceeee thx, this fixed it
does this regulate the priority in my plugin only? or between other plugins too?
java.lang.ArrayIndexOutOfBoundsException: Index 16 out of bounds for length 16
at org.bukkit.craftbukkit.v1_18_R1.CraftChunkSnapshot.getBlockType(CraftChunkSnapshot.java:83)
anyone know why this is happening
first, ALL plugin listeners that listen on lowest get called. then all on low. then all on normal, etc
The confusing bit is that i seem to be getting the coords:X: 12 Y: 256 Z: 1
ArrayIndexOutofBounds
are you working with chunk coords?
you can't access the 17th object when there are only 16, obviously^^
oh it it seems the issue is that i was checking 256
yeah
i didnt think about the y
Arrays index at zero, so entry one is [0]
but what's the difference between the 1.17 and 1.17.1?
check the changelog
so there is a 1.17 version without the .1 after it?
erm yes?
ah i thought it started at 1
hey, how can i have dependency nms spigot 1.18?
https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
Im trying to use this but im not getting too much luck
do i need to add that example maven config or just dependency?
aah java 16 pain
Java 16 = god bruh
?java16
Install Java 16 at https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=hotspot
and whats the difference with the oracle ones
Are build tools only installed in the folder with the jar or somewhere else as well?
Is there a way to remove them completely (for testing purposes)
is it even this one?
Only in the folder with the jar
And the final jar is put in your local maven repo
C:\users\user\ .m2
i saw eclipse and thought what
Yes Adopt Open JDK is now called adoptium and hosted by eclipse
Does constantly changing the pdc of a player lag the server?
Well, trying to make a skill plugin
something says me that it is a bad practice
And I would put it in a pdc
Store it in memory
pdc is memory resident, until the Player object is saved
Save when needed
or chunk
or tilestate ._.
I mean I guess PDC is already in memory, just feels weird to be interacting with it constantly
Where would you save it instead?
pdc is perfect for a skill system
But not in the player?
mk
I still like using external stuff because you can save it when you want to
Less data loss
Like, don;t store a book on the player
But thatβs not really a huge concern
you can call Player.save
Yeah if it's alot of data i would atleast backup everything to a yml or mysql db when the server shuts down / restarts
I would save it to a db for all players every 5 minutes ish, is that a good idea?
Thatβs sync though
i would save it to a h2 db file
just store in Players PDC and let the server handle the saving
He said Skill system, not Skull
ah skill bruh
if it's not much just use pdc
T <T> cast(T object, T clazz) throws IOException { object.cast(clazz)}
what are you trying to do?
I explain
I have an Interface that extends Serializable
Im trying to cast the received packet to class Object
Do I have explained?
I might be wrong but I don't think you can cast an interface to an object
Cuz for receiving im using ObjectInputStream reading from ByteArrayInputStream
Let me explakn avΓan
Again,
I received an object from Stream#read(). An im trying to cast that object to packet object
hmm nice
Wha tthst?
server memory usage
What jvm args are you using? :0
one to two gigs lol
nah
Okie 
._.
is there a randomtickevent of some sort
No
π
You donβt need colors in logging
i want
Logging should be plain and straightforward
How do you add names to itemstacks?
inventory.addItem(ItemStack(Material.DIRT))
so its notable
ItemMeta
nice constructor too
Get the meta from the stack, set the name, and set the meta back to the stack
@tardy delta Why you reacting to my message
Thanks, could you give me an example
Im using kotlin
i dont think ItemStack(Material.DIRT) is a constructor
Kotlin probably lets you skip the new
How can i set damage for certain entity?
entity.damage(amount)
hehe time for a nap
no i want to hit the entity
Is there a way to compile a minecraft plugin without running build tools first?
It's PathfinderMob ~ EntityCreature
looks like some sorting algorithm
π
is there a quicker way to do this or a method that already exists to do this for me? I'm just getting the correct wool color to drop
Material woolType;
switch (((Sheep) animal).getColor()) {
case RED:
woolType = Material.RED_WOOL;
case BLUE:
woolType = Material.BLUE_WOOL;
}```
Did ya run buildtools
Material.matchMaterial(((Sheep) animal).getColor().name() + "_WOOL")
yeah u can just use gradle or maven and add spigotmc repo + spigot-api dependency
unless u want to use NMS, then u need buildtools
ive never had to run build tools tho
and that'd be it, thank you
You are depending on spigot, not spigot-API
You need to run buildtools
is there a way to make it so i dont need build tools?
Why can't I log my console messages? Nothing happens when I use this code: https://pastebin.com/JypBK3fj
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.
Stick to the API
so is it stuff that needs to be changed in the code?
Change your dependency to spigot-api
compileOnly("org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT")```so i should remove the top one?
Yes
alr
Why do you even have a dependency on two different versions anyway
o i didnt even realize that
now im getting a ton of errors that look like this when trying to build:
C:\Users\REDACTED\Downloads\geeksmp-master\src\main\java\com\commandgeek\GeekSMP\commands\CommandAfk.java:12: error: pattern matching in instanceof is not supported in -source 8
if (!(sender instanceof Player player)) {
```
Your source is set to java 8
compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
compileTestJava {
sourceCompatibility = JavaVersion.VERSION_16.toString()
targetCompatibility = JavaVersion.VERSION_16.toString()
}```
VERSION_1_8 -> VERSION_16?
Yes
can anyone show an example on how to use hex colors in 1.16+?
i saw "(&?#[0-9a-fA-F]{6})" and "#[a-fA-f0-9]{6}" being used as a hex color pattern so is it used with a & before it?
now this:
import net.minecraft.network.protocol.Packet;
^```
So you need NMS in this project
Therefor you must run buildtools
i thought it was to support normal &f color codes too
is there anyway to change that? like change the code or stuff?
Sure
sry that im asking stupid questions, i didnt make the plugin, just trying to fix the gradle
Remove anything that imports net.minecraft
thank you!
I tried that but i receive this error
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT.
Searched in the following locations:
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/maven-metadata.xml
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.pom
- https://oss.sonatype.org/content/groups/public/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/maven-metadata.xml
- https://oss.sonatype.org/content/groups/public/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.pom
- https://libraries.minecraft.net/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/maven-metadata.xml
- https://libraries.minecraft.net/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.pom
- file:/C:/Users/emili/.m2/repository/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/maven-metadata.xml
- file:/C:/Users/emili/.m2/repository/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.pom
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.17.1-R0.1-SNAPSHOT/spigot-1.17.1-R0.1-SNAPSHOT.pom
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html```
wait
you dont need build tools for the api, but you do need it if you wanna import spigot right?
Yes
So this doesnt work
'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'
But this works
'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
Without buildtools
how do I use the Damageable interface with an ItemStack item? usedShears.setDamage(usedShears.getDamage()-1);
Correct
i see
Damagable is for the ItemMeta
Get the meta and cast
im not sure if this is a valid jdbc url
jdbc:h2:file:./plugins\MagmaBuildNetworkReloaded\database shouldnt be all slashes be backslashes
hello, for some reason on 1.18.1, when i rename an item it looks like this from an anvil.
https://img.olziedev.com/gD661515615a615dT.png
But when i rename an item using spigot, it looks like https://img.olziedev.com/i337KsEiKR337337q337e.png this
Does anyone know why it adds that {"extra":[{ thing there and how i can prevent it from adding that if there is no colours there
Why do I receive Steve's player head?
ItemStack skullItem = new ItemStack(Material.PLAYER_HEAD, 1);
skullItem.setDurability((short) 3);
SkullMeta skullMeta = (SkullMeta) skullItem.getItemMeta();
skullMeta.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(Main.getInstance().getConfigManager().getConfig().getString("SoulHeadOwner"))));
skullItem.setItemMeta(skullMeta);
and it says that this isnt a valid jdbc h2 driver
jdbc:h2:file:./plugins/MagmaBuildNetworkReloaded/database
because its not
the file isnt created yet idk if thats the issue
1, you need to create the file
2, you need to add the extension to it
jdbc:h2:file:./plugins/MagmaBuildNetworkReloaded/database.h2 for example
anyway, not sure why you're using the ./plugins/etc... when u can just use plugin#getDataFolder
Path path = plugin.getDataFolder().toPath().resolve("database");
jdbcUrl = MessageFormat.format("jdbc:h2:file:./{0}", path).replaceAll("\\\\", "/");```
im having this
but... why?
because manya told me to use this ._.
just remove it
but u will need nbt
so u will need nms
or u prob alr have nms
Wait wait, why using Path?
Lol
File file = new File(plugin.getDataFolder(), "database.h2");
if (!file.exists()) {
file.getParentFile().mkdirs();
file.createNewFile();
}
connection = DriverManager.getConnection("jdbc:h2:" + file.getAbsolutePath())
@quaint mantle xd
getParant its not necessary
im working with hikaricp too
Oh
i dont think u need to put urls then
Why using Hikari?
yeah i do, but why would i need to remove it
because why not
its annoying because i wanna use ItemStack#isSimilar, but its not comparing it properly because of the vanilla names and spigot names
?
your h2 jdbc url worked and mine doesnt :/
I dont see how thats a problem
Does Hikari not handle creating the file with h2?
it seems it isnt
Does with SQLite
Trying to damage the pair of shears used when mass shearing sheep. setDamage doesn't set damage because the console will repeatedly print out Shears damaged. Current Damage: " + usedShearsMeta.getDamage() despite usedShearsMeta.setDamage(currentDamage+1);
// Makes sure the shears are alive. If they are broken, will stop shearing the sheep
Damageable usedShearsMeta = (Damageable) usedShears.getItemMeta();
if(usedShearsMeta == null || usedShearsMeta.getDamage() <= 0) {
System.out.println("Shears broken, breaking loop because we can't gather wool anymore");
break;
}
int currentDamage = usedShearsMeta.getDamage();
usedShearsMeta.setDamage(currentDamage+1);
System.out.println("Shears damaged. Current Damage: " + usedShearsMeta.getDamage());```
isnt the url optional with that library ?
Who uses HikariCP lmao
idk lmao
I never used Mysql, Sqlite or H2 with hikarΒ‘cp
you need to set the itemmeta back to the item
me neither
lmfao
why not use the built in driver connector in java?
Yeah
what do you mean? it's usedShearsMeta which is part of ItemStack usedShears right?
It works really week
Because thatβs not a connection pool
Why the fuck you need a pool connection?
Hhahaa
set back the meta
well
usedShears.setItemMeta(usedShearsMeta)
common sense is better performance ig?
i love it how mojang named PacketDataSerializer a FriendlyByteBuf π
it is really friendly
Yeah you can invite him over for a nice spot of tea
That its the one from protocol?
That's from NMS
Ah
with mojang's mappings on
Idk what its mappings on
its an utility class for NMS to parse packet data into buffer
The buffer from Netty right?
dovidas
of ByteBuf
Do you agree with this?
with what?
you either need an jdbc url or a datasource class name
Im working on plugin for bungee and spigot side. For sending and receiving cross network data. Without using plugin message, sockets or message brokers (Redis, RabbitMQ)
sending = stream -> buffer -> bytes -> stream -> deserializer -> data
receiving = data -> serializer -> stream -> bytes -> buffer -> stream
That its how some recommend me have an idea
I will be working over the Netty instance from Spigot and Bungee side
Haha
but why
I have been paid for a work
That they are clowns
And they dont want to do their cross server core, using Redis or RabbitMq
Because they said that they dont truth on the authors, they extra infrastructure, they are really clowns
it does
sorry i forgot about you
what's your url
i had this jdbc:h2:file:./plugins/MagmaBuildNetworkReloaded/database
but i'll try again
why wouldnt just use mine? π
shears damage
String url = "jdbc:sqlite:" + dataDir.getAbsolutePath() + "/" + fileName + ".db";
Why dont you use relative path?
not using MessageFormat.format π
I will just use:
File file = new File(plugin.getDataFolder(), "Test.db");
"jdbc:sqlite:/" + file
so it doesnt work with relative path?
Idk
Yes Iβm not using a string builder on something that will be ran once at startup
Terrible
I use this. and Work
ill try with absolute path
Yeah try with that
Is there a good guide on how to update my plugin from 1.17 to 1.18
not sure if using \ instead of / messes things up
Yes it does
@FunctionalInterface
public interface ThrowingFunction<T,R,E extends Exception> {
R apply(T t) throws E;
}
It's beautiful
Always do File.separator
Meh
Lol that wasnt the thing i was wanting??
huh? I don't know what you looked for
I just wrote that for myself to be able to catch IOExceptions from a Function<String,String>
Using "throws" keyword on methods
?paste
Ah allright
ill try with this
"jdbc:h2:file:" + file.getAbsolutePath();
try this
File database = new File(plugin.getDataFolder(), "database.db");
if (!database.exists()) {
database.createNewFile();
}
"jdbc:sqlite:" + File.Separator + database
eeeeehm
Now yes
This i have just tried it and its working
i hate myself for this, but this works. https://img.olziedev.com/ag818_818f881818_gT.png
jdbc:mysql://localhost:3306/db_name this is how i do mysql, here you need the :// since that is a uri
nvm my brain
uhm
"jdbc:h2:file:" + File.separator + file.getAbsolutePath();```
Failed to get driver instance for jdbcUrl=jdbc:h2:file:\C:\Users\27747\OneDrive - Collegewaregem.be\Hosted\Vulcano Lands\plugins\MagmaBuildNetworkReloaded\database.h2```
without the separator ill try
is it the correct one?
it creates my file as a folder :/
File file = new File(plugin.getDataFolder(), "database.h2");
if (!file.exists()) {
try {
file.mkdirs();
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}```
getParent.mkdirs
h2 should be capable of creating file by itself
if it doesnt, there's probably something wrong
Files + Path ππ
heh
?justask
now it doesnt create the file but it cant find the driver too
File file = new File(plugin.getDataFolder(), "database.h2");
jdbcUrl = "jdbc:h2:file:" + file.getAbsolutePath();```
did you relocate the driver
I'm running into a weird issue. I made an update to something completely unrelated to inventories and my system for toggling between itemstates has just seem to break around one specific player head. My initial thoughts are that something is wrong with the way I create player heads, but I have other GUIs that use the same exact method.
This is the error: https://paste.md-5.net/gisacomara.cs
I doubt there is something wrong with how I create the heads: https://paste.md-5.net/idinecowab.cpp
I'm wondering why it also looks like an ArrayOutOfBoundsException. The list has multiple items and it rolls over if it reaches the end. It also works just fine for other items.
I will recommend reading the javadocs or spigot site about creating commands
you mean the relocation in my pom? i did relocate
did you set the driver class name in hikari settings
no
Thats why
how do i do that?
I dont know i never used HikariCP
ah there's a method on the datasource but to what should i set it?
That why
If you are just beginer your best alternative its to understand how the APi works
i think you need a h2 depdency too
What is the latest sprgot api version, i need it for my pom.xml
Wait
thats not the method
String[] at the back
also hovering over the error is something
Yeah
I think is really new
He just started with the API without knowing the basics from the IDE and Java
π
?
Are you native Speaker?
you?
Cuz i dont understand your language
he isnt fluent probably
Do you the basics about an IDE and Java API?
@quaint mantle do i need to add the h2 driver dependency in my pom to be able to use the driver?
Literally you have spin poof him
I will ignore the problem, cuz i wanna throw my computer outside my windows
yes sure
this one?
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
Does SpigotAPI contains Netty library or only the Spigot?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Yeah totally agree
Hey, im trying to build my plugin with gradle but apparently it cant find the spigot-api dependency. Heres the error:
Searched in the following locations:
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.17.1-R0.1-SNAPSHOT/spigot-api-1.17.1-R0.1-20210903.091420-65.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
and my build.gradle
repositories {
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
maven {
name = 'protocollib'
url = "https://repo.dmulloy2.net/repository/public/"
}
mavenLocal()
mavenCentral()
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly group: "com.comphenix.protocol", name: "ProtocolLib", version: "4.7.0";
implementation 'org.javacord:javacord:3.4.0'
}```
hmm it doesnt exist
Normal builds donβt let you republish
However snapshots let you re-release a new build without changing version
And there seems to be an issue there
Some version mismatch
what can i do to prevent that
java.lang.RuntimeException: Failed to load driver class org.h2.Driver in either of HikariConfig class loader or Thread context classloader```
Failed to load driver class org.h2.Driver from HikariConfig class classloader org.bukkit.plugin.java.PluginClassLoader@299ad93c```
Honestly idr what some of the others did I assisted concerning this very issue
But Iβd suggest, maybe use spigot and not spigot-api
lets try setting a dependency
That works but i want to use spigot-api
there's no big difference in reality
lets see if I get that issue btw
Im basically trying to build the plugin without having to run buildtools
Which means i can only use spigot-api
i dont care if you pay me 20 bucks tho π€‘
finally h2 works
and now i have syntax exception
plugins {
`java-library`
}
group = "me.conclure"
version = "1.0-SNAPSHOT"
repositories {
maven(url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
mavenCentral()
}
dependencies {
compileOnly("org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testImplementation("org.mockito:mockito-core:4.3.1")
testImplementation("net.jodah:concurrentunit:0.4.6")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}
tasks.getByName<Test>("test") {
useJUnitPlatform()
}
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
tasks.getByName<JavaCompile>("compileJava") {
options.apply {
release.set(17)
encoding = "UTF-8"
}
}
``` @pine forge
used this
also
make sure to invalidate your caches x)
(yes its kotlin dsl, tho im certain you can translate it into groovy dsl equivalence)
gradle clean build?
shame
lol
okay
conclure tool box π€©
I usually check every single one of them
everything*
Update to this. I've found that it does toggle, but it doesn't properly refresh because of the error thrown. However, I'm still confused about why it's happening.
Didnt change anything
same issue

how can i use scoreboards and scoreboards for tablist prefixes at the same time? when i try scoreboard conflicts (no errors) but then nothing comes up on tablist just empty, but scoreboard works. Cant have both? how to solve this issue
lets check database normalisation on my own database ready to find poor design
Sorry for the dumb question, but where's the file that I should be passing to SpecialSource in the --srg-in parameter? I tried passing in 1.18.1.json, which is in the same dir as the jar I'm deobfuscating, but it just gave me an error:
java.lang.IllegalArgumentException: Unable to parse srg file, unrecognized mapping type in line={"arguments": {"game": ["--username",...
Code?
I'm pretty sure you need to pass your plugin jar if you are using SpecialSource manually
would it make sense to migrate the database to another type if the user changes the storage method in the config
or just keep getting it from the method where it is stored in
It would, but it might be easier to make an export command and have the user reimport the data.
To clarify, it would also act as a way to verify that the user actually wants to move the data to the new database.
So if someone changes the setting in the config, the plugin will use a blank database. Once the user imports the data, it'll be like nothing ever changed.
but if the user doesnt import, the plugin wont be able to find the data
It also lets users try things out with a new database setup and possibly start over with something new.
Exactly. Some users may not want to do this, so an automatic conversion should be an option, but it should be another setting in the config.
Something like this:
databse: mysql
auto-convert: true
depending on how big the db has become, that may take alot of time
but i think its better than letting the users import everything
That's why I like having the user manually export and import.
users are problems lol
It may be an extra step, but it can prevent some headaches.
// Makes sure the shears are alive. If they are broken, will stop shearing the sheep
Damageable usedShearsMeta = (Damageable) usedShears.getItemMeta();
if (usedShearsMeta == null || usedShearsMeta.getDamage() <= 0) {
System.out.println("Shears broken, breaking loop because we can't gather wool anymore");
break;
}
usedShearsMeta.setDamage(usedShearsMeta.getDamage() + 1);
System.out.println("Shears damaged. Current Damage: " + usedShearsMeta.getDamage());
usedShears.setItemMeta(usedShearsMeta);``` this segment of code is not working properly. in the server console, it will display the damage being added up as it should but the damage is never applied when it ends
Thanks! I figured out the issue. I had to open 1.18.1.json, find the url for server_mappings, download the mapping file from there, and pass that file to --srg-in
Yeah because there's probably some internal method where the nbt tag is set, and display name is getting the clean name without the "Extra json stuff"
makes sense
I dont know how did it end up there from the first time tho
Durability is as: 0 full repaired
So if you wanna make it damaged you need to sum instead on minus
Also, only tools and armor are damageable, care of that
copied off @MrMaurice211
in forums
usedShearsMeta.setDamage(usedShearsMeta.getDamage() + 1);
I do need to get rid of || usedShearsMeta.getDamage() <= 0 though
saw
this
on forums
public void applyDamage(ItemStack is, int damage) {
ItemMeta im = is.getItemMeta();
if(im instanceof Damageable) {
Damageable itemdmg = (Damageable) im;
itemdmg.setDamage(itemdmg.getDamage() - damage);
is.setItemMeta((ItemMeta) itemdmg);
if (itemdmg.getDamage() <= 0) {
is.setType(Material.AIR);
}
}
}
not sure if it will work
it should
ive found that there is an issue that the item isnt getting deleted
so maybe make it this
?paste
dunno
this code has the issue you said mine had, it subtracts damage instead of adding damage
these guys made my brain die
same
wha
maybe it's because I'm not casting damageable back into ItemMeta like that code you pasted though
Hello
just try it
How would I be able to check if a player performed a command?
implement CommandExecutor
I tried googling and going thru the forums but didnt find anything
but like
then implement the methods
PlayerCommmandPreProcessEvent
event.getMessage()
really?
then I would be able to do it like event.getPlayer.getMessage("message");
why r u writing "message"
getMessage() will be the message
why write "message"
r u trying to set it
no
wait
if(event.getPlayer().getMessage().equals("message") {
//code
}```
smth like that?
od xd
prob use equalsIgnoreCase
/fp me
btw @dusk flicker ive been thinking of making my own website
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I aint no full web dev but depends on how good quality you want it
cant u make one with java
java is needed for web dev?
html = basic af website
css = better basic website
and js
ye
this is pain
html, css, js is the starter kit for basic websites
then theres php π©
why thoo
Could not find artifact org.spigotmc:spigot-api:pom:1.13.2-R0.1-SNAPSHOT in vault-repo (https://nexus.hc.to/content/repositories/pub_releases)
anyone know how to fix?
why 1.13.2 tf
specific server version Β―_(γ)_/Β―
@EventHandler(priority = EventPriority.HIGHEST)
public void onCommand(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if(event.getMessage().equals("/projectile heart")) {
if(list_of_players.contains(player)) {
}
}
}``` so this should work?
what server
the error from server console or somewhere else?
this is when i am trying to maven build the source
I have a system for changing what I refer to as Item States in GUIs. It's used to toggle all types of settings. I'm currently running into an issue with a custom player head. The issue only happens when trying to switch it to it's disabled state.
This is the error: https://paste.md-5.net/ejonuwoyaf.cs
Considering the nature of the error, this leads me to believe that something is wrong with my method for creating the head. However, that same method is used in other GUIs and works perfectly fine. This is really confusing me because this method worked fine before. I'm not sure why it started breaking.
oh
well
go to your pom.xml
and check the spigotmc version
idk
well @grim ice it didn't work
here's 2 listener events
[15:03:36] [Server thread/INFO]: Collected list of nearby entities
[15:03:36] [Server thread/INFO]: Found 3
[15:03:36] [Server thread/INFO]: Looping through entities
[15:03:36] [Server thread/INFO]:
[15:03:36] [Server thread/INFO]: shearing sheep
[15:03:36] [Server thread/INFO]: New damage amount: 59
[15:03:36] [Server thread/INFO]:
[15:03:36] [Server thread/INFO]: shearing sheep
[15:03:36] [Server thread/INFO]: New damage amount: 58
[15:03:36] [Server thread/INFO]:
[15:03:36] [Server thread/INFO]: Original sheep, continuing
[15:03:36] [Server thread/INFO]:
[15:03:36] [Server thread/INFO]: PLAYER is not a sheep, continuing
[15:03:36] [Server thread/INFO]: Listener ended.
[15:03:36] [Server thread/INFO]: Shears have 58
[15:03:37] [Server thread/INFO]: Shear event fired
[15:03:37] [Server thread/INFO]: Collected list of nearby entities
[15:03:37] [Server thread/INFO]: Found 5
[15:03:37] [Server thread/INFO]: Looping through entities
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: Original sheep, continuing
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: shearing sheep
[15:03:37] [Server thread/INFO]: New damage amount: 60
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: shearing sheep
[15:03:37] [Server thread/INFO]: New damage amount: 59
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: shearing sheep
[15:03:37] [Server thread/INFO]: New damage amount: 58
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: PLAYER is not a sheep, continuing
[15:03:37] [Server thread/INFO]:
[15:03:37] [Server thread/INFO]: shearing sheep
[15:03:37] [Server thread/INFO]: New damage amount: 57
[15:03:37] [Server thread/INFO]: Listener ended.
[15:03:37] [Server thread/INFO]: Shears have 57```
same issue, doesn't matter if damage is being added or subtracted
damage resets at the end
How would I make a repeating runnable which spawns a particle of my choice to a projectile of my choice every tick?
How can i get the player online time since the last leave of the player?
You can do it async @hollow sand ig
got an example?
Not rly, on mobile
Player#getLastPlayed() returns the last time as a long. Convert that with whatever date system you use.
use .equalsIgnoreCase then yes
and do it async
?scheduling
Yea I figured out the scheduling part, just the spawning bit
Bukkit.getScheduler().runTaskAsynschronously(Main.getInstance(), () -> {
CODE
});
thats gonna be repeating, yea?
I don't work with async and sync a lot so dk
No, you want to use #runTaskTimerAsynchronously if you want a repeating task.
Otherwise it will only run once with #runTaskAsynchronously
hey im trying to use maven plugin specialsource-maven-plugin 1.2.3 from:
https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
The thing is that the remapped-obf jar file is not being applied to the other compiled modules, any idea?
so like
Bukkit.getServer().getScheduler().runTaskAsynchronously(this, new Runnable() {
code
},0, 20L);``` ?
no
I think you can remove that Bukkit. Part
no
Huh
depends on what class its in
Ah
the class is in my main class :p
what??
okay
For a customer?
like
that doesnt justify it
Yes. you can actually remove the .getServer() as the #getScheduler() method is a static method from the Bukkit class.
freelancing
You guys are not passing server in the constructor??
why would you
you're giving a customer
DI
bad practice
ok
either way what platform do u use for freelancing btw
Probably green f
Ah true
and you can just use the Bukkit object, no reason to use DI for useless stuff like this