#help-development
1 messages · Page 593 of 1
How do i give a player an effect?
I am trying to give the player absorption for level 4
p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION), 4);
But this dosent work
NamespacedKey isSheepHelmet = new NamespacedKey(HB.getInstance(), "isSheepHelmet");
ItemStack rare = new ItemStack(Material.PLAYER_HEAD, 1);
SkullMeta rareMeta = (SkullMeta) rare.getItemMeta();
rareMeta.setOwnerProfile(pP);
rareMeta.getPersistentDataContainer().set(isSheepHelmet, PersistentDataType.BOOLEAN, true);
rareMeta.setDisplayName("§l§bSpecial Sheep Gear");
rareMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
rareMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 58, true);
ArrayList<String> rareLore = new ArrayList<>();
rareLore.add("§l§bProtection 58");
rareLore.add("");
rareLore.add("§3This item gives you");
rareLore.add("§e10% §3chance to earn");
rareLore.add("§e2x §3block drops.");
rareLore.add("");
rareLore.add("§o§8It also make you look cool. B)");
rareMeta.setLore(rareLore);
rare.setItemMeta(rareMeta);
if(e.isCancelled()){
return;
}
if(player.getInventory().getHelmet() == null){
return;
}
if(player.getEquipment().getHelmet().getItemMeta().getPersistentDataContainer().has(isSheepHelmet,PersistentDataType.BOOLEAN)) {
Block block = e.getBlock();
Location bLoc = e.getBlock().getLocation();
player.sendMessage("Mining with head");
if (random_int < 11) {
block.getWorld().dropItem(bLoc,new ItemStack(block.getType(),1));
player.sendMessage("double drops");
}
}
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
take the helmet into your main hand. then enter /data get entity <yourname> SelectedItem and check if it contains your "isSheepHelmet" key
wait maybe its cuz I forgot to get a new helmet
oh yeah you need a new one ofc lol
oh yeah now it registers that I mine with the helmet on
thank you for the help
Finally figured it out. My main issue is I actually had no fucking clue code wise where the corners were. So I figured it'd be easiest and rather inexpensive to run a check on every corner and calculate the distance between the 2 corners. The furthest edge should always be the edge I want therefore yielding me a good result without needing to now save the specific furthest apart points
Wait i forgot this
So where should i put this in?
corners are always just
minX = chunkX * 16
minZ = chunkZ * 16
maxX = minX + 15
maxZ = minZ + 15
?
nowhere
you seem to lack basic java knowledge
you cannot just think like "oh, there's a method in class x. Let's just use it on class y"
getAction() is a method declared in PlayerInteractEvent. You cannot magically use it on a SignChangeEvent. It wouldnt make sense anyway
no, a SignChangeEvent simply has no "Action"
same like a Locatio ndoesn't have a getName() method but Players do
kind of, I mean this logic works if I always want the block starting at the relative cordinate (15, 15) in the chunk, but that's not always the case
If i were to do that there would be some cases where I'd end up with 30s etc
what's the purpose of the signchangeevent? normal players could also just create that sign by simply writing "ABSORPTION" into the second line
btw that's not even valid java syntax
your onInteract method's signature doesn't even have any symbol / "name" assigned to the PlayerInteractEvent param
?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.
It's also nested inside the other method
yeah, that too lol
let's imagine the second method wouldn't be inside the first one:
what is "e" supposed to be? I know you want the passed event to be called "e" but you didn't give it any name (so it wouldnt compile anyway)
same thing
same issues
i got a question for y'all. Would making lots of BukkitRunnable's be wise. I do know a workaround (deques ofc)
i'm just too lazy to test myself
i'm guessing using 1 Bukkitrunnable is better lol
yeah true
more like 1000 but 1 looks way better than 1000 lmfao
deque would probably be the way to go
cuz im making a farming thing that regenerates the plant every 10 seconds after the player breaks it
actually
not sure how would do that with a deque
😓
i see
yeah i see it now
never knew that existed lol
yeah
but pretty simple
no, everyone can place a sign and write ABSORPTION into the second line
wait for the expiredmap
how would i make each value have a timer
and how would i check without lagging
alot
who cares? you don't check for the other lines. and even if you did, I could just place a sign and write that exact text onto it
if you can't get signs, then why do you need a permission check for changing the sign's text
Okay and if im removing that it isnt still working
Inventory pvpshopgui = Bukkit.createInventory(p,45, ChatColor.BLUE + "PvP Shop");
for creating inventories it requires a parameters of an owner but I want to store an inventory as a variable that I can use for many different players
what exactly isn't working
anyone know how?
use null as holder
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
the inventory doesn't open when I put the owner as null
inventories with null holders work fine, many plugins do it like that. do you get any errors?
tbf it really shouldn't be exposed
well e.g. imagine someone opens a chest. you can listen to InventoryOpenEvent, then you can get the chest by doing Inventory#getHolder()
how would i go about splitting an image/map so i can use it in multiple item frames (3x2)
you gotta write fancy logic
aka splitting it into 128x128 chunks with m a g i c
it's literally just making an array
ive never worked with maps before so i am clueless with this
that splits each image into 128x128 chunks?
YEah
Well
the setImageSupplier part does
The idea is to just loop through the image in 128x128 blocks (or less if you're at the last block)
You calculate the amount of blocks by dividing your width by your block size
So let's say that you have a 1000x500 image and you want to segment it in 128x128 blocks
It'd be
1000 / 128 blocks wide, and
500 / 128 blocks tall
wait
maps are basically like blocks put into an image?
as in you can individually set each "block" on a map?
what I refer to "blocks" here are just segments of an image
Each frame suports a map item with a view attached
And that view renders 128x128 pixels
So if you want to render a 1000x1000 image you need 7.8 maps both in width and height
is this in a public github or yours
mine
if my image is 3840x2066 for example
that means it would take 30 images in width and 16 in height?
Hello, I need to convert a picture from the Internet into a minecraft map (as an item) and the server is on version "spigot 1.20.1".
Thank you for now.
What determines if a block can be broken by water/lava? I'm guessing it's either isBuildable, isPassable or isReplaceable but they seem very similar so not sure which is actually accurate
I'm reading through Mojang API documentation and found this: https://wiki.vg/Mojang_API#Player_Attributes
If I go through the steps and get an Azure OAUTH key and toss in a bearer token, can I check any player's attributes or just my own attributes?
Post more code
Let's see how the ItemMeta is being created too.
Set a breakpoint on the finished ItemStack too, does it all appear normal?
Also, 1% isn't a ton of difference to notice, have you tried anything more?
What do you mean?
So 200% is working?
OK, so it sounds like your code is at least partially working though, right?
Can you post more code?
What you've written looks fine, but maybe more background could help
you ever write an event listener then forget to register it, so then you wonder why its not working and spend 30 minutes debugging it?
You have to ask someone else man. I am no where near experienced enough to know what you need help with.
idek what that is.
https://github.com/crackma/Utilities/blob/master/src/main/java/me/crackma/utilities/user/UserListener.java
if i add Bukkit.getLogger.()info("sdffudsi"); before if (userManager.get(uuid) == null) userManager.add(user);, then none of them execute
You think if you layer and stop and start diffrent minecraft sounds in perfect timing with perfect pitch and volume it could sound like a human voice?
With vanilla resources
thanks
pvpshopnpc.getLocation().setYaw(90); pvpshopnpc.getLocation().setPitch(0);
For some reason this doesn't make the entity face straight forwards
pvpshopnpc is just a villager
anyone know why?
I spawn it at my location and it just faces the same direction im facing
public static void spawnOresShopNpc(Location location){ Villager pvpshopnpc = location.getWorld().spawn(location, Villager.class); pvpshopnpc.setCustomName(ChatColor.GREEN + "Minerals Shop" ); pvpshopnpc.setCustomNameVisible(true); pvpshopnpc.setAI(false); pvpshopnpc.setAdult(); pvpshopnpc.setInvulnerable(true); pvpshopnpc.setProfession(Villager.Profession.NONE); pvpshopnpc.setAware(false); pvpshopnpc.setRemoveWhenFarAway(false); pvpshopnpc.getLocation().setYaw(90); pvpshopnpc.getLocation().setPitch(0); pvpshopnpc.setSilent(true); oresshopvillager = pvpshopnpc; } }
here
I FINALLY GOT MY ARMOR SETS TO WORK!!!!
double it and give it to the next person
huh?
Mysql will lock anyway, you don't need to worry about it
There's this funky concept called sharding
Idk who told you that, but every major database should have table/row locking
Easier to do with mongo than sql but basically you can cluster out parts of your database into separate machines and they'll talk to each other and get your data fast
Helps with scalability :)
I just cloned something from github and now I have over 200 errors
anyone know how I can fix this issue?
when I pull something from github it doesn't recognize it as a spigot plugin
It says module JDK is not defined
Hey there, im trying to make an addon for a plugin that should use methods from another addon. So i added the .jar as dependency and then i successfully imported the methods in my class, although when i try the addon i get this error: https://paste.md-5.net/fuxuneyenu.pl
This is my pom.xml:
https://paste.md-5.net/itorapifok.xml
?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.
This is my class: https://paste.md-5.net/judonuwaja.java
is variables a plugin?
No, its an addon for a plugin
So it's not in the /plugins folder but in /plugins/PluginName/Addons
Guys I have a problem
I pulled something from github and my intelliJ says module JDK is not defined
does anyone know how to fix
project structure -> sdk (select an sdk)
Do you need more info?
I can't figure out for a few hours what the problem is.
if(playerContainer.get(new NamespacedKey(ToastsRPG.getPlugin(), "Voldemort"), PersistentDataType.INTEGER) == 4) {
int currentMana = ManaManager.getMaxMana(event.getPlayer());
playerContainer.set(new NamespacedKey(ToastsRPG.getPlugin(), "maxMana"), PersistentDataType.INTEGER, currentMana + 1000);
}
if(playerContainer.get(new NamespacedKey(ToastsRPG.getPlugin(), "Voldemort"), PersistentDataType.INTEGER) == 2) {
int currentMana = ManaManager.getMaxMana(event.getPlayer());
playerContainer.set(new NamespacedKey(ToastsRPG.getPlugin(), "maxMana"), PersistentDataType.INTEGER, currentMana + 500);
}
How could I go about inverting this without the affects stacking?
inverting?
first create your NamespacedKeys as fields so you only create them once.
second, use a switch on the value
Can I
run build tools
and somehow copy the decompiled stuff from work into spigot so I have full nms?
why this isn't the way it always is
boggles the mind, but whenever I do it manually there are little fiddly things and it takes an ass long time to fix them all
does remapped
give you a spigot project with eveyr nms class in it
could care less which mappings are used, but I don't want to mapping back and forth and I doubt existing plugins would cope if I just compiled with mojang mappings
I just want to be able to power refactor nms
Mojang mappings is what we use from 1.18+
Ok, then back to original question
how can I get a spigot project that contains all the nms classes
so I can convert to gradle
see:
https://gitlab.com/glayve/client/-/blob/master/build.gradle.kts
for an example (happens to be client but same concept for server is what I'm looking for)
Spigot is based on Maven as a build system
yes, I can make the change just need all the nms files
cannot get it to compile copying from BuildTools/work/decompiled-latest into Spigot-Server with maven either
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
there you will find all you need on building any custom spigot
Find the work/decompile-XXXXXX folder in your BuildTools folder.
Find the class you want to add in the net/minecraft/server folder and copy it.
Copy the selected file to the src/main/java/net/minecraft/server folder in CraftBukkit.
Implement changes.
but seemingly if I copy entire directory
it's full of fiddly little errors
The true true question is wouldn't the project just always have all of nms in it? Instead of the weird recursive depend on nms.jar
What would I do to store a villager's Profession and Trades in a Villager spawn egg?
no, Spigot-api is what we use. Spigot is the server jar which includes NMS
yeah?
But I need to rip and tear into nms and spigot to get it to not be too heavy for docker
otherwise it's going to cost like trillions a second to host a network in 1.19
but u can't refactor with only half the classes
This is Spigot nothing to do with nms. nms is Mojang/Minecraft code. Spigot is an API
at the end of the day
spigot.jar contains nms compiled
so this is just demonstrably false
argue with yourself., I've stated facts.
"
Find the work/decompile-XXXXXX folder in your BuildTools folder.
Find the class you want to add in the net/minecraft/server folder and copy it.
Copy the selected file to the src/main/java/net/minecraft/server folder in CraftBukkit.
Implement changes.
"
these steps, outdated or expected to contain errors after performing? If those steps are legit then this issue should be solvable without huge effort
Are we talking compile errors
Yes
List<Attribute> list = (List) stream.map(map::get).filter(Objects::nonNull).map((minecraftserverbeans_a) -> {
return new Attribute(minecraftserverbeans_a.name, minecraftserverbeans_a.getter.get());
}).collect(Collectors.toList());
getter cannot be resolved or is not a field
Yes that’s expected
just a bunch of tiny things, I've gone through and fixed them all before in older versions
The decompiler isn’t perfect
Okay, so have to go through and fix them by hand sadge
Why didn't one person just fix them all once and then call it a day?
Where would I set Villager trades on a villager spawn egg?
Then no cyclic depend and everyone is happy, ide works better, etc.
its decompiled and changes so...
but it almost certianly takes weeks (maybe months) to update spigot anyway
Spigot has fixes for teh nms it needs. Beyond that is not a part of the API so would be wasted time and effort
Huge communal L
as I said Spigot is an API for plugin development, that does not include nms
It does not take that long to update spigot
using nms is on you.
Even so, I mean I'll report back on how long this takes if I decide to do it for 1.20.1 but I've done it for 1.8.9 and 1.7.10 several times
it's a pain in the ass but like < 1 day pain in the ass
cause of mojang maps or just not that many changes? I haven't been keeping up that carefully
Also lets say I do this, would you all accept it so everyone else that wants to fork spigot can do so without exploding with rage?
What's wrong with that? buildtools already takes an eternity, would make the actually process of building faster probably without the cyclic stuff
oh hi exerosis
hey bud
So you want pure nms no spigot?
Because they would have to be maintained
If it were adding API functionality which would be useful to others, it might be accepted. If it's just to make your life easier, no.
There’s no reason for spigot to fix the decompile errors in field it doesn’t need to modify
there is no way I'm the only one in the world forking spigot
paper's doing that too but generally spigot only patches nms classes it needs to patch
Which is of zero benefit to Spigot or it's users
there are networks all over the place, I can't imagine they are all willing to dedicate 5000 millicores to each container
How is someone forking not a user lol
an exploiter
But yeah I mean ultimately not suprized here, spigot has always had the worst mindset on the internet from inception.
wait until you see paper
does your fork push anythign back upsptream? In almost all cases, no.
True, my friend already told me it was less worth attempting this with their build hell
I just don't see how I end up having to do this every time lol
damn you got friends?
lol
mine probably not, but other peoples absoutely
because by making mine compatable with spigot api and performant enough to run on a network
that enables plugin devs to sell resources (that you take a cut of) to network owners
None of that is of any benefit to the Spigot API or its users.
Plus if we find some great performance optomization in theory you could just include it especially if it's been tested to not cause problems.
or if we make a banger API change
just switch to minestom at this point
I don't like minestom, but yeah I've got my own thing that I was working on.
But eyah the rewrites are more promising fs
imagine taking a cut and then pretending that easier forking was not useful in 2023
How would I find out if the entity that killed another entity is a player? I know there's EntityDeathEvent but not sure regarding how to get the killer of said entity
LivingEntity has a getKiller() method
Oh that's my issue, I'm just casting it to Entity. thanks
Hi, I can't import the Skin Restorer api into my plugin. It doesn't give me any errors.
show us your code
wait pls
and wdym "Cant"?
Hello, I can't compile SkinsRestorer API in my bungeeCord plugin that's why I tried to use shadow but it doesn't work either, could someone help me?
My build.gradle:
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java'
}
group = 'fr.zonedelta'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven {
url 'https://repo.codemc.org/repository/maven-releases/'
}
}
dependencies {
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
compileOnly "net.md-5:bungeecord-api:1.12-SNAPSHOT"
compileOnly "net.skinsrestorer:skinsrestorer-api:14.2.3"
}
def targetJavaVersion = 8
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
expand props
filteringCharset 'UTF-8'
filesMatching('bungee.yml') {
expand props
}
}
shadowJar {
configurations = [project.configurations.compileOnly]
}
Thanks in advance to anyone who can help me.
Hi i notest in some plugins is present JProfiler as a "profiling for java application and understand many other parts of your code that sucks", how they set it up for minecraft?
please
Help me
bro your message is literally at the bottom, once someone who knows how to fix whatever problem you're having comes here, they will probably help you
just be patient
Okay
What are the error(s)?
Also shading the API is probably not what you want - you need to make sure the appropriate plugins are installed though
Another problem is that my skinrestorer api is not initializer.
package fr.zonedelta.bungee;
import fr.zonedelta.bungee.manager.Initialize;
import net.md_5.bungee.api.plugin.Plugin;
import net.skinsrestorer.api.SkinsRestorerAPI;
public final class ZoneDelta_Bungee extends Plugin {
private static ZoneDelta_Bungee instance;
private static Initialize initialize;
private static SkinsRestorerAPI skinsRestorerAPI;
@Override
public void onEnable() {
instance = this;
initialize = new Initialize();
getProxy().getLogger().info("Plugin Bungee of Zone-Delta is enabled");
initialize.createEvent();
skinsRestorerAPI = SkinsRestorerAPI.getApi();
}
@Override
public void onDisable() {
getProxy().getLogger().info("Plugin Bungee of Zone-Delta is disabled");
}
public static ZoneDelta_Bungee getInstance() {
return instance;
}
public static SkinsRestorerAPI getSkinsRestorerAPI() {
return skinsRestorerAPI;
}
}
This my code
06:52:48 [WARNING] Exception encountered when loading plugin: ZoneDelta-Bungee
java.lang.IllegalStateException: SkinsRestorerAPI is not initialized yet!
at net.skinsrestorer.api.SkinsRestorerAPI.getApi(SkinsRestorerAPI.java:65)
at fr.zonedelta.bungee.ZoneDelta_Bungee.onEnable(ZoneDelta_Bungee.java:19)
at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:266)
at net.md_5.bungee.BungeeCord.start(BungeeCord.java:295)
at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
06:52:48 [INFO] Enabled plugin cmd_list version git:cmd_list:1.20-R0.1-SNAPSHOT:c7adcf9:1716 by SpigotMC
06:52:48 [INFO] Listening on /0.0.0.0:25565
06:52:48 [INFO] Started query on /0:0:0:0:0:0:0:0%0:25565
this my error
My error is a line skinsRestorerAPI = SkinsRestorerAPI.getApi();
Thanks in advance to anyone who can help me.
Use 3 back sticks not only one, this way look harder yo read or paste the code here
?paste
move this line into your onEnable not in a Field
no
it should be in onEnable, but your plugin also needs a depend in plugin.yml for skins restorer
yes
depend:
- SkinsRestorer
your plugin must start after skin restorer
LoginEvent.java:19
this is my code
According to my research it's supposed to be right but I've made a mistake I don't understand.
getSkinsRestorerAPI() is returning null
move to the top of your onEnable skinsRestorerAPI = SkinsRestorerAPI.getApi();
Yes
I'm testing this
No, it doesn't work. On the contrary, it makes the same mistake as before.
And uh, are you shading it?
Then don't. It should be compileOnly
Okay
Yes I cleared all error thanks
Oh
I have a new error 😭
My class
My error
Aaand?
User error pretty much
How do I fix it?
Use the correct player name?
[SkinsRestorer] Error: Premium player with that name does not exist.
didnt you see that
Ah hell yes that's true but I'd have to get the skin at the url and not a player
I am trying to set a persistent data into a white wool block after placed. But during the check, it's not a tilestate, which I cannot set. Why?
normal blocks have no pdc
So, are there any way to set a custom data into it?
not on a normal block
sad
https://paste.md-5.net/ayejewaqog.java
So here it would have to retrieve the url and therefore the skin on the url and not the player how could I do?
Wait, I see Block#setMetadata. Is it the alternative persistent data container?
no
Like ElgarL said, we can't set a persistent data into a normal block
Wasn't there some lib that made it possible to kinda give blocks data?
a request about something i remeber but not the name, i remeber this tool to test plugins with commands inside like /debug etc... to see what the plugins does, /rebuild and automaticaly reload when a new build is inside and was useful because you could see memo leaks etc
Yeah, useful thing ngl
tag me if you find it
using java 17 and 1.20 spigot
looks like you did not add the dependency properly
show your pom.xml / build.gradle file
are you not using maven or gradle?
probably not
RIP
i just created java project
did you manually add the dependency using eclipse?
yeah
spigot-api-1.20-R0.1-20230612.113428-32-shaded
show a screenshot of your dependencies thingy pls
just create a maven project, it's easier
hm looks good. Well, I have no clue how eclipse meanwhile works, everyone should be using maven nowadays
oki
https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/ here's a guide for IJ + maven but it should be basically the same using eclipse
there is only one file, which is pom.xml
the rest are empty directories. you are supposed to put your classes into src/main/java
that are directories
btw because eclipse is confused it shows them as packages
because eclipse is not very smart. use a new project
tbf eclipse's maven integration is really really bad. that's why I switched to IJ
i just wanted to switch to eclipse because why not
I love Eclipse 😉
yeah well for example the tab completion is bad, the auto-fixes suggest total bullshit sometimes, and as you see, the maven integration is also bad
Why is geol not here rn, would be perfect
no
ok
first message in minecraft is send and why I don't have permission nor am I an operator later
what are you even trying to do?
block command process if player dont have permission and list from config dont contain that command and in send event retainAll by list from config
But you dont do anything in your CommandPreProcessEvent
All you do is send a message
i do
but i cut it
beacuse it dont return when i'm op
but i came up with idea to make list with ignored nicks
Yeah that worka
How on earth can I get the side of a sign from PlayerInteractEvent? trying to check the sign side for dyeing / glowing
get the block, check if it's a sign
cast sign to the block
the get ur data
probably you gotta check the clicked blockface, then check the sign's rotation, then manually check whether it must have been the front or back side
e.g. if the sign's front points to west, and the clicked block face is west too, it must have been the back side
right, that's frustrating but makes most sense! Thank you
A little newer to bukkit dev, always happy to dig through the docs but seeing as you're here could you point me to where I can check rotation?
oh its in blockface?
to get a sign's rotation, you gotta get the BlockData and cast it to Rotatable https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Rotatable.html
declaration: package: org.bukkit.block.data, interface: Rotatable
You seem to misunderstand, connection pooling have nothing to do with async execution of queries
Hey
been a long time help-dev
anyway- does anyone know if its possible to get a user's cps inside a ui
what UI?
if the UI is an inventory, sure
Listen inventoryclick, count clicks but it's really not accurate
if the UI is the escape menu, ofc not
wait I misread lul
I do that, a lot 😉
what you mean inside a UI in the player screen you can use "actionbars with negatives" and create the illusion or they mentioned it up here
Any Idea how I can check if a player moves an item from his inventory into another one, cause InventoryMoveItemsEvent calls just for hoppers, and with InventoryClickEvent you cant check if an item is moved from an invetory to another one and with InventoryDragEvent doesnt work with shift + click. ig?
InventoryDragEvent is/was for touchscreens iirc
I guess there is no event for this, you'd have to implement some logic yourself
dragevent fires when you drag a stack across multiple slots
Oh that's a different one then
inventory click will fire when you click a slot. drag fires when you move the mouse a pixel while clicked
can I use InventoryClickEvent and check if player's opened inventory is a chest or an ender chest?
ig it should kinda work
InventoryType view = e.getView().getType();
ye ik
hello, is there any way that I can get all possible BlockStates of a block using Spigot API?
HOW can i send a hexcode of any colour in chat? i have no idea i sorry i new to this
A BlockState is just a snapshot of a Block
I already have a method for string to COLOR, but not CHAT color
how should i integrate spigotapi with my next.js app? rest api? are there better solutions?
right, so how can I iterate through the blockstate keys of a block? similar to how a debug stick does it?
there is no such thing as a BlockState key
Why do you TYPE like this lol
net.md_5.bungee.api.ChatColor#of(Color)
is it a dot there instead of # ?
yes
hang on ill make a spigot accoutn so i can send images
?img
Not verified? Upload screenshots here: https://prnt.sc/
What Color are you using ?
Yo
import org.bukkit.Color; this ?
also, your "parseHexColor" is useless since you can just do Color.fromRGB(0x9aecdb)
Ok, what version are you making the plugin for ?
im new to java and mc plugin development how do i get the spigot api library sorry if im saying the name wrong im from c++ i dont know what libraries are called in java
1.19.4
oh ok, well I am sure there is a better way to do that but I am too lazy to think rn
I just think having the way I suggested in code is better
you use either maven or gradle as a build tool
Why is ChatColor underlined?
both handle downloading the dependency for you
where do i get them
net.md_5.bungee.api.ChatColor is deprecated
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
wait i think i have the maven source code
if you want to follow a guide
are you using only spigot ?
Can someone help me with this
Im trying to make so when you are clicking on a sign and if the second line is "ABSORPTION" you will get absorption by clicking on the sign
Code:
@EventHandler
public void onChange(SignChangeEvent e) {
Player p = e.getPlayer();
if ((e.getLine(0).equalsIgnoreCase("buffs"))) {
if (isPlayerInGroup(p.getPlayer(), "admin") || isPlayerInGroup(p.getPlayer(), "h-admin")) {
e.setLine(0, "---------");
e.setLine(1, "ABSORPTION");
e.setLine(2, "Click here");
e.setLine(3, "---------");
}
}
public void onInteract(PlayerInteractEvent e) {
BlockState bs = e.getBlock().getState();
if ((bs instanceof Sign)) {
Sign sign = (Sign) bs;
String line1 = sign.getLine(1);
if(line1.equals("ABSORPTION")) {
p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION), 4);
}
}
}
beyond the fact that that isn'T valid java
e.getBlock().equals(Action.RIGHT_CLICK_BLOCK)
A block tends to never be a RIGHT_CLICK_BLOCK action
if ((e.getLine(0).equalsIgnoreCase("buffs")))
Too many ()
omg you have it there two more times
And for one if you just don't put any....
Check now
missing event handler annotation
But when i have @EventHandler
It says Annotations are not allowed here
You are missing closing brackets 
you never close your onChange method
is your IDE not screaming at you ??
Nope
What IDE are you using ?
literally anything should yell at you for having syntax errors
notepad
dude I thought <nope> responded and had a mild case of serious heart attack...
are u kidding me
lmao

use gradle
what the fuck would yield a rewrite of code because of a build tool
I was just getting some erorors, nothing else
But this dosent still work
e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION), 4);

and i have like 19 classes
what
maven just calls the java compiler
then wtf is the website on abt
what part are you talking about
"some errors"
If you're getting errors and are incapable of understanding them then go and google what they mean and try to resolve them yourself first before coming here
about public classes

Dude i was just getting these error
´;´ or ´)´expected
Ye, so you add those where they are expected
It literally holds your hand with syntax
Okay but its fixed now
Do you know why my potion effect is not working
Its but i cant send photo and its very long
?img
Not verified? Upload screenshots here: https://prnt.sc/
it can't be that long
I am just gonna do a wild guess tho
"constructor does not exist"
Look here
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffect.html
declaration: package: org.bukkit.potion, class: PotionEffect
your parameters are wrong, it tells you that the constructor you are trying to call does not exist/has different arguments
@stuck notch I do not provide support in DMs

still friendlier than me. I usually just ignore DMs that ask me about programming help
Why dosent this work
e.getPlayer().addPotionEffect(PotionEffectType.ABSORPTION, 999999, 4);
Cannot resolve method áddPotionEffect(PotionEffectType, int, int)´
it was not actually programming help
their discrod glitched
READ MY MESSAGE DUDE
reading is hard
how are you supposed to help with a broken discord?
just told them to restart
honestly can't do more
how did it get worse
huh
the ✨ spicy ✨ addPotionEffect method
Lol
What was it called when you can have multiple methods with one name but different arguments?
overloading
overloading
Why does the lines on the sign not be setted?
@EventHandler
public void onChange(SignChangeEvent e) {
Player p = e.getPlayer();
if ((e.getLine(0).equalsIgnoreCase("buffs"))) {
if (isPlayerInGroup(p.getPlayer(), "admin") || isPlayerInGroup(p.getPlayer(), "h-admin")) {
e.setLine(0, "------");
e.setLine(1, "ABSORPTION");
e.setLine(2, "Click here");
e.setLine(3, "------");
}
}
if ((e.getLine(0).equalsIgnoreCase("heal"))) {
if (isPlayerInGroup(p.getPlayer(), "admin") || isPlayerInGroup(p.getPlayer(), "h-admin")) {
e.setLine(0, "------");
e.setLine(1, "HEALTH");
e.setLine(2, "Click here");
e.setLine(3, "------");
}
}
}
@EventHandler
public void onInteract(PlayerInteractEvent e) {
Player player = e.getPlayer();
BlockState bs = e.getClickedBlock().getState();
if ((bs instanceof Sign)) {
Sign sign = (Sign) bs;
String line1 = sign.getLine(0);
if(line1.equals("buffs")) {
e.getPlayer().addPotionEffect(PotionEffectType.ABSORPTION.createEffect(999999, 4));
}else if ((line1.equals("HEALTH"))) {
e.getPlayer().setHealth(20);
}
}
}
}
fabsi was faster tho
you sent the packet to players so they don't see that players armor.
you want to hide one players armor from other players, right ?
Yes
So where exactly are you stuck ?
At understanding how I have to do that
So you don't know how to send packets to players with ProtocolLib
No
I need to learn that
But I tried reading some stuff google told me, but I don't get any further
I assume you have tried something like this then
Something like that, but with PacketType.Play.Server.ENTITY_EQUIPMENT, so, now I have a PacketContainer and Idk what to write
I believe you construct the packet based on this
container.getInts().write(??, entityId)
Can i create custom ShapedRecipe when i have to add 5 blocks to each crafting slot without using CraftItemEvent?
I have tried writing the entityId, but I got some error about out of bounds or something like that
The creation of the packet is the easier bit
y is protocollib so low level 🤔
you have to ensure to filter later packets too
if you mean the amount of items in one slot is 5 then that is not possible with ShapedRecipe
Unless something changed since I last tried recipes
Any method to do this without events?
wouldn't you just cancel the non-custom packets ?
which I can see how it could be a bit harder but is def. possible
well that would be easy, just don't do anything if the equipment is-
nvm.. it's array -> you'd have to modify the packet to remove the armor part
Yeaaaa 
Does anyone know how to make items look enchanted? I'm trying to make a player head look enchanted but I can't find a way to do it
give it an enchant, set itemHideFlag to hide enchantments
HI, i want print my cooldown comands in h/M/m
how to do (because my cooldown is in ms)
but next time try to google first 🙂
i have alrady try
Well, hiding the in-hand item seems like something I could need too
what name can i give if it is a breed of team fortress game could there be copyright issues))
Fortress Teams
is it the same no?
I clearly switched the order of the words and added 's'
as the law* is concerned it is something completely different
*not an actual law advice
Ie in law this not one thing and, too,?
w h a t
Where did your English go
bro i not engl i use traslate))
English did /vanish
translators won't give out this broken english tho....
Ploho angliskiy v shkole uchil
So in a legal sense it's not the same thing?
sounds Polish

probably not
*not an actual legal advice
Polish is jeden miliard siedemset dwadzieścia osiem miliardów sto sześćdziesiąt dwa miliony trzysta dwadzieścia tysięcy sto dwa.
(Pls don't ban me)
just number innit
172817232102
or something idk
I mean you can guess how I can read this, should not be hard
What about "jedno piwo proszätm"
"one beer please"
note: I know no Polish
So, when will my beer come?
when you send a packet asking for it
🗿
i get Could not pass event EntityDamageByEntityEvent
with this code:
@EventHandler
public void onPlayerDamage(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player && e.getDamager() instanceof Zombie) {
Player player = (Player) e.getEntity();
//may add only add if damager is a player too (later/vote)
this.cooldown.put(player.getUniqueId(), System.currentTimeMillis());
BukkitRunnable task = new BukkitRunnable() {
@Override
public void run() {
Long TimeLeft = (5000 - (System.currentTimeMillis() - cooldown.get(player.getUniqueId())));
player.getPlayer().sendMessage(Long.toString(TimeLeft) + Boolean.toString(TimeLeft >= 1));
if (TimeLeft >= 1) {
if (bossBars.get(player.getUniqueId()) == null) {
player.sendMessage("1");
String title = "ANTY-LOGOUT: " + Long.toString(System.currentTimeMillis() - cooldown.get(player.getUniqueId()));
BossBar bar = Bukkit.createBossBar(title, BarColor.RED, BarStyle.SEGMENTED_20);
bar.setProgress(TimeLeft);
bar.addPlayer(player);
bar.setVisible(true);
} else {
player.sendMessage("2");
BossBar selectedBossbar = bossBars.get(player.getUniqueId());
String title = "ANTY-LOGOUT: " + Long.toString(System.currentTimeMillis() - cooldown.get(player.getUniqueId()));
selectedBossbar.setProgress(TimeLeft);
selectedBossbar.setVisible(true);
selectedBossbar.setTitle(title);
}
} else {
player.sendMessage("3");
cancel();
}
}
};
task.run();
}
}
how is the plugin version usually written if it is a beta version for example "FortressTeam- 0.1" ?
I bet you get more of the error
Send it in full
?paste
Progress must be between 0.0 and 1.0 (5000.0)
hah
yea i saw it, but how i can do so that 5000 is 1.0, 4000 is 0.8 etc.
okay i'll try
also, go back to school to learn basic math
(it will be really embarrasing if I am wrong lol)
is it work with ratios?
high school rn
bad at math tho
clearly, just study more, you might get it one day
now imagine the code where you work with probabilities
where the probabilities each have their own weight
i know probabilities
right there almost all the bukkit inhabitants?
Who knows what is the most difficult thing to do in projects?
if math is bad use chat gpt it helped me🤫
i used chat gpt once to help with my math, i got an f
you have to ask the right questions
What question can be "righter" then calculate me xy lol
i found that's
long notime = System.currentTimeMillis() - cooldown.get(p.getUniqueId());
// Conversion en heures, minutes et secondes
long seconds = TimeUnit.MILLISECONDS.toSeconds(notime) % 60;
long minutes = TimeUnit.MILLISECONDS.toMinutes(notime) % 60;
long hours = TimeUnit.MILLISECONDS.toHours(notime);
p.sendMessage("Vous pourrez utiliser la commande dans :");
p.sendMessage(hours + "h " + minutes + "min " + seconds + "s");
but, is reversed
I imagine wolfram alpha is better for math
what do you mean "is reversed"
what is reversed, can you show the output ?
when i execute the commande i get number at start
/iexecutemycommand (return mycmd)
/iexecutemycommand (return cooldown: 1 sec)
/iexecutemycommand (return cooldown: 2 sec) etc...
i want
/iexecutemycommand (return mycmd)
/iexecutemycommand (return cooldown: 1h 59m 59s)
/iexecutemycommand (return cooldown: 1h 59m 58s) etc...
I am guessing
cooldown.get(p.getUniqueId()) - System.currentTimeMillis()
i use this
System.currentTimeMillis() - cooldown.get(p.getUniqueId());
yes, so use what I sent instead
i try it
no i get 468923h
how i can delete bossbars from player cuz i got them a lot and don't have them stored
https://www.spigotmc.org/wiki/feature-command-cooldowns/#method-3-instant-the-better-method
Delor, why not use Instant and Duration?
i check
I'm still very confused on how to apply the enchanted glowing effect on other items that aren't enchanted books or potions. Any ideas on how to do this on something like player heads?
Couldn't you do something like this?
ItemMeta itemMeta = item.getItemMeta();
itemMeta.addEnchant(Enchantment.ARROW_INFINITE, 1, true);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
.addEnchantment() ig
well the client applies the glint effect based if there's a specific nbt tag in the itemstack
With NBTTagCompound?
but if i do
you have timeLeft.toHours hours and timeLeft.toSeconds seconds left
if I have a time, the timeLeft.toSeconds will return 6600 seconds? so I couldn't put the 2
the OG solution better
Duration implements TemporalAmount, which have the method get(TemporalUnit), and then u use ChronoUnit instead of TimeUnit since ChronoUnit implements TemporalUnit
Oh... that sucks
@sterile breach but anyway, just storing a timestamp of the cooldown trigger should do the work, regardless of Instant or using currentTimeMillis
wasn't that changed ?
how do i remove these, they are not declared, like in a list or sum
with a code like this?
long notime = - System.currentTimeMillis() - cooldown.get(p.getUniqueId());
// Conversion en heures, minutes et secondes
long seconds = TimeUnit.MILLISECONDS.toSeconds(notime + cooldown.get(p.getUniqueId())) % 60;
long minutes = TimeUnit.MILLISECONDS.toMinutes(notime + cooldown.get(p.getUniqueId())) % 60;
long hours = TimeUnit.MILLISECONDS.toHours(notime + cooldown.get(p.getUniqueId()));
p.sendMessage("Vous pourrez utiliser la commande dans :");
p.sendMessage(hours + "h " + minutes + "min " + seconds + "s");
Anyone?
how does it look when u use cooldown.put() ?
does ur code even reach the s.setLine(... ?
cooldown.put(p.getUniqueId(), System.currentTimeMillis());
I dont think so..
my code?
line 1 on sign is line 0 right?
long cooldownTime = ...;
long notime = cooldownTime - cooldown.get(p.getUniqueId()) + System.currentTimeMillis()
yes
Idk wgat is wrong with this
I dont get any errors and when im trying this im not getting the message
if ((e.getLine(0).equalsIgnoreCase("buffs"))) {
if (isPlayerInGroup(p.getPlayer(), "admin") || isPlayerInGroup(p.getPlayer(), "h-admin")) {
p.sendMessage("ewadad");
ah my cooldownTime is not time is hashmap
so i can't add it no?
idk why u're making it so hard for urself
ok i will try to add it then
yes
means one of ur if statements fail
and for event cooldown also it's better to use times like this?
yes
and with this type of cooldown i could make my post
h/m/s?
yes
ok ok I implement all this and I come back
it would be a huge coincidence but has anyone else here run into an issue where slimes when mounting entities won't move?
as in the mounted entity won't move
it seemed to be working for 1.18.1 but at least testing 1.19.3 and 1.19.4 it looks like they're no longer moving
quesiton,
cooldownManager.setCooldown(p.getUniqueId(), Duration.ofSeconds(CooldownManager.DEFAULT_COOLDOWN));
with what i replace default cooldown?
Duration.ofSeconds(CooldownManager.DEFAULT_COOLDOWN) --> Duration.ofSeconds(3)
that would be 3 seconds
u can use Duration.ofHours(4)
that'd be 4 hours
okay
okay so, alrady what i place here?
long notime = System.currentTimeMillis() - cooldown.get(p.getUniqueId());
// 10 - 8 = 2000 -> 2
long seconds = notime / 1000;
long minutes = (seconds / 60) % 60;
long hours = (seconds / 3600) % 24;
long remainingSeconds = 60 - (seconds % 60);
long remainingMinutes = 60 - (minutes % 60);
long remainingHours = hours;
p.sendMessage("Vous pourrez utiliser la commande dans :");
p.sendMessage(remainingHours + "h " + remainingMinutes + "min " + remainingSeconds + "s");
I feel a 🥄 coming soon
Duration cooldownTime = cooldownManager.getRemainingCooldown(p.getUniqueId());
if (cooldownTime.isPositive()) {
p.sendMessage("%sh %sm %ss".formatted(cooldownTime.toHoursPart(),cooldownTime.toMinutesPart(),cooldownTime.toSecondsPart()));
}
i try
p.sendMessage("%sh %sm %ss".format(cooldownTime.toHoursPart(),cooldownTime.toMinutesPart(),cooldownTime.toSecondsPart()));
he don't like this line no suitable method found for format(int,int,int)
what do you try to call here?
formatted
is it possible to use the enum class for 2 different objects in terms of properties and structure? e.g. beam gun and bomb in bukkit api
yes, but it disturbs me the %sh%
thats just string format
ah
use this private static final Map<Character, Integer> UNIT_SECONDS = new HashMap<>();
static {
UNIT_SECONDS.put('s', 1);
UNIT_SECONDS.put('m', 60);
UNIT_SECONDS.put('h', 3600);
UNIT_SECONDS.put('d', 86400);
}
public static long convertTime(String timeStr) {
char unit = timeStr.charAt(timeStr.length() - 1);
try {
long value = Long.parseLong(timeStr.substring(0, timeStr.length() - 1));
return value * UNIT_SECONDS.get(unit);
}catch (NumberFormatException e){
throw new RuntimeException(ChatColor.RED + "неправильный формат времени",e);
}
}
just learn to use Duration as Conclure said
yes thats possible also
what he want?
line feed in time?
I don't want to mess with the class
yes but just because YOU dont want to doesnt mean you should go around just feeding ur code to others arrogantly
I have speeded up the process
)
Instant and Duration are two of THE most useful classes in Java for managing times
no u have done everything but to speed the process up I believe Im sorry
it depends on the situation
every situation
yeah
nah
no probleme
literally yes though?
@ivory sleet you will find his beast but I can not understand where the error comes from
p.sendMessage("%sh %sm %ss".format(cooldownTime.toHoursPart(),cooldownTime.toMinutesPart(),cooldownTime.toSecondsPart()));
.formatted(...)
my method is convenient as for me because you don’t need to mess with the format
yes but I wouldn't trust ur method to cover all error cases
what you mean
}catch (NumberFormatException e){
throw new RuntimeException(ChatColor.RED + "неправильный формат времени",e);
}
good @ivory sleet that's work
thanks for your help it's been 5 hours that I was looking for how to do it
oh
yea here you right
it can be improved but i still think it depends on the situation.
it all depends on the seriousness of the relationship and the accuracy of the time
but this is bukkit api i think this not mistake
ok
I don't take the bukkit api too seriously)
lol ok
@ivory sleet last question, how is it that I have access to functions such as toHoursPart() which are not in coldownManager, it is integrated into the java time system?
yes just like HashMap
these are classes from the java standard library
made for u to use :)
also u might wanna change toHoursPart to just toHours
you tell me or him?
Im telling Delor
👍
what is the difference betwen these?
iirc toHoursPart goes from 0 to 24
if u get to 25 hours it'd be 1
toHours can go 24+
ah okay
and imagine that I want to display everything in minutes (so 1h30 -> 90 min) I have to call which function?
toMinutes() just
ah it detects on its own if the function is called before in the code?
ah okay
so like the remainder of 90 divided by 60 is 30
but it still manages to detect if I call the function sooner
therefore toMinutesPart() returns 30
waat
it has nothing to do with when u call it
to a block type as in material or a specific location?
Range [0, 4) out of bounds for length 3 Line: 73
Line 73: String title = "ANTY-LOGOUT: " + Float.toString(TimeLeft.floatValue() / 1000).substring(0, 4);
Why, it works but gives this error
Code: https://paste.md-5.net/mitutuwume.cs
Your Float toString doesn;t have 4 digits
hmm, I'm adding a gradle dependency, and it gets "resolved" successfully, but it doesn't get added to external libraries in IntelliJ, and when I go check the cache, I can see it downloaded the .pom and .module, but not the jars, what would cause that to happen? I've tried invalidating caches, deleting .gradle, and restarting, but it still happens, I can only assume there's something wrong with that dependency as others are working fine
you can;t subString longer than the original string
yea i know but it should give so many errors and it only gives 7, and i update the timer every tick
it errors when your float doesn;t have enough digits
i'll try to catch the error
use String::format else
String.format("%.4f",myFloat)
that will make it always have 4 decimals
else u have DecimalFormat
String title;
try {
title = "ANTY-LOGOUT: " + Float.toString(TimeLeft.floatValue() / 1000).substring(0, 4);
} catch (StringIndexOutOfBoundsException e){
player.sendMessage("catched it, michel jorden ");
title = "ANTY-LOGOUT: " + Float.toString(TimeLeft.floatValue() / 1000).substring(0, Float.toString(TimeLeft.floatValue() / 1000).length());
}
``` i did this and it catches it, but i'll try to use your code
oh wait it gives error
but different
length - 1
nah now its a different error
yeah I didn't think before responding on that one
org.bukkit.event.EventException: null```
```Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because the return value of "java.util.HashMap.get(Object)" is null```
```if (System.currentTimeMillis() - cooldown.get(player.getUniqueId()) <= 5000)``` this is causing it
i think its because there's no player in the cooldown hashmap
theres no cooldown for that player
Hey there, im trying to make an addon for a plugin that should use methods from another addon. So i added the .jar as dependency and then i successfully imported the methods in my class, although when i try the addon i get this error: https://paste.md-5.net/fuxuneyenu.pl
This is my pom.xml:
https://paste.md-5.net/itorapifok.xml
This is my class: https://paste.md-5.net/judonuwaja.java
Variables is not a plugin is an addon for a plugin so its lo cated in plugins/Plugin/Addons
Not looked at your code as you are doing your own loading, but to access across plugins you are going to need your classes on the same ClassLoader
This is for me?
It uses a lock
But not a classic lock
Its more likr AtomicReference
Where it guarantees atomicity
All or nothing
(ACID) atomicity, consistency, isolation and durability
And yes connection pooling has something to do with async execution of queries
They’re related to some degree
The point of connection pooling is first of all to not waste resources on invoking new connections all the time
Much like thread pool
But if u do everything synchronous it doesn’t really matter because you will only ever need 1 connection, and possibly cache it also for reuse
U know how compareAndSet works?
Didnt emily tell u that
Similarly, that’s what happens in databases
cas 🥰
^
Over a single connection all queries would run one after the other
But like in terms of implementation these databases try as much as possible to avoid large locking sessions
So if possible, it will run multiple queries at the same time (if received from 2 different connections)
And by if possible I mean normally pretty much
Tho in a lower level of abstraction it might be the case that CAS mechanics are implemented on individual operations
Basically u know when u run i++
Myes
There is usually a specification manual per database that talks about it
Since its implementation
Anyway in java using i++ is compiled into several operations, get the value of the variable i, increment it, set the value back to the variable
Now if 2 threads run i++ at the same time
There’s no guarantee that the order will follow:
thread1 get value
thread1 increment value
thread1 set value
thread2 get value
thread2 increment value
thread2 set value
It could vey much be the case that
thread1 get value
thread2 get value
…
yes
So even tho i++ ran twice
It only incremented once
Now compareAndSet is iirc sometimes even implemented in hardware
But in java it guarantees that the increment happened or not
There’s no indeterminacy
now java with AtomicReference will just endlessly loop compareAndSet until the value has been set (to make it consistent)
Anyway continuing with the connection pooling
Its good because connections are expensive
And it helps if u have access to concurrency since you can basically to some extent achieve parallel queries
(Concurrent is probably the better term)
it makes the 3 step process into just one
which is more expensive than the 3 step process
But it guarantees that the entire operation either succeeded or didnt at all
With hardware
Hardware has built in instructions
AtomicReference#getAndUpdate calls VarHandle#weakCompareAndSet or sth
And VarHandle at the end will delegate to low level hardware stuff
Yes
And its not bad at all
And connection pooling is usually what u want
Because it acts like a semaphore to save resources
Whilst not restricting the concurrency
Just don’t listen and trust everything that’s said in these help channels, sometimes people got it wrong, even me rarely
Heah
Yea
Hey there, im trying to make an addon for a plugin that should use methods from another addon. So i added the .jar as dependency and then i successfully imported the methods in my class, although when i try the addon i get this error: https://paste.md-5.net/fuxuneyenu.pl
This is my pom.xml:
https://paste.md-5.net/itorapifok.xml
This is my class: https://paste.md-5.net/judonuwaja.java
Variables is not a plugin is an addon for a plugin so its lo cated in plugins/Plugin/Addons
What info are you storing
LuckPerms has it so that u can have split storage
That is, users in 1 db, groups in 1 db
But like I’d probably use postgre for all my data
Except log data
https://www.hizliresim.com/aby1uy5 what is name of this plugin
I know ppl use mongo, but if my data scales I’d def want postgre
Has anyone gotten a jetty server with jsf to work on spigot?
What issues are you having
A blank xhtml page.
Thare may be that you have to temporary change classloader when setting up jetty
Enable jetty debug and see logs
It's probably missing dependency which can't be loaded with spigot classloader, had that issue before
There's just nothing in the logs. :/
Have you enabled debugging
Yep.
Hi, how with SkinRestorer api can I set a skin that is present on a particular url?
hello, how to get gradle access to craft bukkit and nms? It was possible in 1.19 with compileOnly 'org.spigotmc:spigot:1.19-R0.1-SNAPSHOT'
but now its not with newer versions
how i can change the title to be for example: 21.37 and 07.41 instead of 15.32 and 5.812
String title = "ANTY-LOGOUT: " + String.format("%.5f",(TimeLeft.floatValue() / 1000)).substring(0, 5);
hey guys i have this in my playermove event and when player is swimming its speed multiplies alot, it doesnt seem to bve normal
even if its 1
you should do get velocity instead of get direction
direction is not the same as velocity
well the player just jumps out of water
then
if i use velocity
event.getVelocity()
oh i used this
Hey there, im trying to make an addon for a plugin that should use some methods of another addon always for the same plugin. I added the addon as local dependency and in my class i succesfully imported the needed methods, although when i try the addon i get the following error: https://paste.md-5.net/oqisibehab.pl
This is my pom.xml: https://paste.md-5.net/buhacohumi.xml
This is my class: https://paste.md-5.net/gebutebera.cs
i don't think its the same but use event.getVelocity()
no such thing
maybe try player velocity event instead of move?? idk
in player velocity event you have .getVelocity
ye i see
if you don't want player jumping out of the water you can store velocity as a variable and reset the z value
that did nothing
what do you want to achive
make player go faster while swimming
give him hidden dolphin potion
also try to multiply it by 0.3 or something, it can take floats
like this?
obv the amplifier would change
but im not sure about the duration
you can do any duration and when player is not swimming just remove the effect
hidden = ambient true
oh no wait
other way around, so yeah, like this
ambient are sounds i think
i still see the icon in inv for a short amount of time is it possible to remove it
docs say ambient "Makes potion effect produce more, translucent, particles."
so yeah definitely set ambient, particles and icon to false, then it's basically "invisible"
right
Ambient just means the particles are semi-transparent
So if particles is false, obviously ambient isn't relevant because there are no particles
Hello, how can I use multiple nms with maven ?
Use a multimodule project
One module per nms version
use maven
okay thanks
?nms
why not gradle though
You need to find an unoffical remapper for Gradle
There are a few
Or just develop against unmapped
That works fine too
Hey there, im trying to make an addon for a plugin that should use some methods of another addon always for the same plugin. I added the addon as local dependency and in my class i succesfully imported the needed methods, although when i try the addon i get the following error: https://paste.md-5.net/oqisibehab.pl
This is my pom.xml: https://paste.md-5.net/buhacohumi.xml
This is my class: https://paste.md-5.net/gebutebera.cs
The .jar of the addon is in plugins/PluginName/Addons
i just use alvinn's nms
but it uses paper so
for gradle
Paper has offical gradle tooling
can I also get craftbukkit with paper?
how i can change the time of tnt explosion
paper is a fork of spigot
spigot is a fork of bukkit
therefore yes
can you elaborate on that alvinn;s nms
Looks like you're trying to use a class that doesn't exist on the server. Also system path dependencies are deprecated. You should use the maven install command to install projects to the local maven repo
i'd use this for gradle instead actually: https://github.com/PaperMC/paperweight-test-plugin
i have so much respect for the people who created skript, i can't even create a config file
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/

this sucks, I'm in so much pain from the gym that I can barely think about the code I'm supposed to be writing right now
that's why prescription painkillers exist - to help you coding
how's rehab alex
Hi, i have 2 questions about gui.
I want made a page system. To know/get the player's page is make an int page in the event ?
Second question, i think, get a gui with the name can be dangereus. So, how to do ?
Instance checks solves all.
store your currently open inventories in a Map<Inventory,YourInventoryData>. YourInventoryData is a class that contains all the information you need - current page, etc
even better <player, CustomInventoryObject>
odds are players aren't meant to have more than one at a time anyhow
Ah i stock the player ?
it's the easier way of doing it in my experience
what should happen
use UUID not player object but it doesn't matter that much because your should be wiping the data properly on inv close anyhow
Player as key is fine as long as you clear it on disconnect
only if you do it wrong
