#help-development
1 messages · Page 1240 of 1
okay thanks
just get the minecraft version property in your buildscript and depend on NMS with that version
yeah that's what I'm doing, combined with patrick's remapper
hum
I put my code in the main ? not subfolders ?
yes
why can't I use CB ?
you haven't shown any part of your buildscript so, how would I know
why does this need nms?
I need to do some registryAccess etc.
but I prefer working with nms instead of reflection
I'll send you it
but like what are you doing
build.gradle.kts :
https://paste.md-5.net/xuyimudilo.gradle.kts
settings.gradle.kts :
https://paste.md-5.net/juquxoboyu.gradle.kts
I'm using Foliage colormap to get a color based on a biome
and then use text display to do Falling leaves
but on spigot
and I also want to know how to deal with nms on gradle for future projects that'll need it
i'd probably just bundle the default color palette and the humidity/temperature function used to access it in the plugin
if it's a training wheel project for leaning nms, sure
but for an actual project project it's needlessly fragile for what little it achieves in my opinion
yeah maybe, but actually it works with maven but gradle ecosystem is just goat
pretty sure the whole color map doesn't even get used, each biome has its own flat color from the map and iirc the rgb values for those are even on the wiki
almost all the code is done, I just want to put it on gradle
for supporting custom biomes
and also for training
I'm already doing that
did you find rad ?
you can get humidity and temperature directly from Block
so if you already have those and the function to get the colormap coordinates from them and the colormap... that's basically all of it; what need for nms?
it's done
get the biome foliage color
I mean looks generally fine to me, just make sure the remapper actually runs
Can we return to how to use multi module project to support multiple nms versions ?
It should run
But idk why I can't use CB on the project
I can't even compile if there is package error
that's based on the temperature and humidity and the colormap, all of which you already have
There
I'll check that after if I need to edit
and are you sure you have run BT
My code is 1 year old lol
Yeah, and everything is okay for that
but
CB is just working for the vcs version
but looks like it overrides other CB versions or idk
never used stonecutter before
maybe you know rad ?
I mean, check what the current stonecutter version is
It's 0.5.2
well, the Minecraft version
Oh
It's 1.20.6
what if I name my plugin minecraft
where do I change that
Is there any way to add two lines into action bar? I have power bar and 2 abilities and I want to make the abilities on top of the power bar
plugin.yml
yes, you need a resource pack with custom fonts and negative spaces though
I have resource pack with the bar and abilities but I don't think so I have negative spaces
I have like empty space for spacing something foward
I don't fuckin know why
well me neither
the problem is the java version to compile
you need to compile to the lowest version you want to target iirc
but it doesn't want to resolve spigot jar if it's using java 17
https://github.com/PaperMC/paperweight-test-plugin/tree/multi-project has some ideas around java version management
I didn't link it so you can look at paperweight
(no I joke)
I linked it so you can look at the gradle module setup 
I was joking lol
(I'm not funny)
😅 my bad then, went over my head
yeah it's perfect, I'll look at it thanks 😄
no you definitely just wanted to promote paper
Hello everyone!
Guys, tell me pls, how can I get src's of Spigot 1.6.4?
BuildTools support 1.8 - 1.21.4 😔
is that text and red color set by client?
can it be changed so it doesnt show an error
just a plain white string, like it used to be?
maybe with a shader, you'd have to isolate the chat text though
looks exactly like what I need, thanks !
(learnt some new useful things for gradle with this too)
huh paper feel so heavy
wait till you make your own extensions in conventions, that's when shit gets fun
and @DEPRECATED AAAAH
ahahahha, let me stay in my ignorance
(french word btw)
then you can just ```kt
axi {
paper {
internals()
}
}

ahahah wtf
seems good
but I don't like paper
when it works for spigot it works for paper
so I'll use spigot, because paper is trash for "simple" dev imo
well this isn't something paper specific, it just happens that that project uses paper
oh okay I see
I watch you
IF YOU PREFER PAPER TO SPIGOT
this is all custom made is the point
looks like you're a good dev
I just know some gradle basics that's it
please do not call me master
can I learn from you dev branch ?
does anyone know how i can perfect combine to codes for 2 different plugins into 1 or am i better off having them seperate
Just keep them separate
do note that paper hardforked early december and this assumption on longer holds.
love them
i like
them foranything that isn't javascript
ftfy
that's what im thinking about is the prettiness of arrows and equality operators really worth it in exchange for less clarity of the input you should know because you've typed it
I mean, in java it is perfectly fine
mostly because java isn't operator spamming
(like other languages
)
I thought it was a soft spoon
keeping this framed on my wall
kotlin haters hate this one simple trick
fuck.
Lynx is purposefully going to break comparability with all spigot plugins tomorrow
I told you that in secret /s
i love you too bro
my bad I'm just dumb
I'm not
or maybe not
* What went wrong:
Execution failed for task ':nms_1_21_4:remap'.
> Could not resolve all files for configuration ':nms_1_21_4:detachedConfiguration1'.
> Cannot resolve external dependency org.spigotmc:minecraft-server:1.21.4-R0.1-SNAPSHOT because no repositories are defined.
Required by:
project :nms_1_21_4```
huumm
even when specifying all repositories for all projects, it keeps saying that
Did you build 1.21.4 with build tools
yeah for sure
also is mavenLocal defined as a repo
yeah using repositories {... mavenLocal() ...}
clearly strange
yeah idk it seems to be complaining about missing repo
can you build 1.6.4 with build tools?
No
(((
OfflinePlayer target = Bukkit.getOfflinePlayer(arg[0]); <- the getOfflinePlayer for the user Name is deprecated how can i use the Uuid in a command like /ban mattyu <- if i do with the method i said before it's deprecated i should use the uuid of the player but if i can't catch the player how can i get the uuid?
If you use the name as a command argument getting the offline player by name is fine
Do note that it can do a blocking network request
getofflineplayer itself won't iirc, but if you call getName or something on it it will if it's not in the usercache
pretty sure it will?
^^
on spigot at least
It will work just fine
what iirc means? sorry for the stupid question
if i remember correctly
oh yeah getting by name
nevermind
that'll be a network request if it's not in the usercache
because it kinda implies getName
getting by uuid won't fire a request
Oh i thought it was some abbreviations for some sort of coding stuff hahaha Ty 🙂
Would it be possible to force a custom resource pack on a player, play a custom sound from that pack and remove the resource pack again? As a way to play custom sounds?
not sure about removing, but you can enforce a custom resource pack
does it force that loading screen when changing resource pack or is there a way to do that sneaky?
and it will force the player to reload all assets
not just your custom sound
on a low end machine this may take 10+ seconds
not something you want to do to fire an one-off sound
i would just leave the resourcepack on
no need to remove it afterwards, even if it doesnt serve any function after the one sound
I keep getting a ticking block entity issue now that I've made changes to the populate method in my BlockPopulator, but I don't really understand what that means. Everything online about it pretty much says it has to do with mods, and that I need to restore an older version of the server or whatever, but I can't figure out what is causing it.
Here's my crash report: https://paste.md-5.net/pohupuwuru.pl
And here's my BlockPopulator code: https://paste.md-5.net/ohagiyumib.cs
does spigot have tags like Forge does? like instead of specifying accepted items using the Materials enum, like:
if(item == Material.DIAMOND_ORE || item == Material.IRON_ORE), is there some global tag for "ores"?
Tags @mortal vortex
huh?
You can also check if the block's BlockData#requiresCorrectToolForDrops() returns true, which should narrow it down,
Looks like there are STONE_ORE_REPLACEABLES and DEEP_SLATE_REPLACEABLES tags
Idk if those apply here though
Open a bug report
?jira
Alr, thank you
can i hide or block recipe popups?
Thanks
hello im trying to make my custom mob target players not matching an assigned faction ID of said mob
I am not sure how to make this TargetGoal properly though, here is what I have so far
public class TargetNonFactionPlayersGoal extends TargetGoal {
private final CustomWitherSkeleton customWitherSkeleton;
private final UUID factionId;
public TargetNonFactionPlayersGoal(CustomWitherSkeleton mob, UUID factionId) {
super(mob, false);
this.customWitherSkeleton = mob;
this.factionId = factionId;
this.setFlags(EnumSet.of(Flag.TARGET)); // Set the goal flag
}
private boolean isPlayerInFaction(Player player) {
KingdomManager kingdomManager = KingdomManager.getInstance();
Kingdom playerKingdom = kingdomManager.getPlayerKingdom(player.getUUID());
return playerKingdom != null && playerKingdom.getID().equals(factionId);
}
public class CustomWitherSkeleton extends WitherSkeleton {
private final UUID factionId;
public CustomWitherSkeleton(Level world, UUID factionId) {
super(EntityType.WITHER_SKELETON, world);
this.factionId = factionId;
this.collides = false;
this.expToDrop = 0;
this.goalSelector = new GoalSelector(world.getProfilerSupplier());
this.targetSelector = new GoalSelector(world.getProfilerSupplier());
this.setInvulnerable(true);
this.setCanPickUpLoot(false);
this.setAggressive(false);
this.setCustomNameVisible(true);
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, true));
this.targetSelector.addGoal(1, new TargetNonFactionPlayersGoal(this, factionId));
}
public UUID getFactionId() {
return factionId;
}
}
This is my custom wither skeleton
hi guys how can i motionless particle?
when i do this my particle is flying
world.spawnParticle(Particle.CLOUD, player.getLocation().add(0,1,0), 1,0,0,0);
Anyone know why this makes entity's "jump"?:
this.locY += this.motY;
I know it's not Spigot API related but don't know where to ask
Some particles can not be made motionless. The motion is controlled by client.
Not sure if cloud is one of them
Water particles don't seem to have motion I think
Not splash, the ones you see when in the water, or perhaps they're only client
can u give me idea for vanish plugin
im can make but if player find invinsible player and hit sound still hearing
Doesn’t using hidePlayer stop you from hitting them
ah i was using setInvinsible
im looking hideplayer method now
mb
ty
why setPlayerListName deprecated?
because you're not using Spigot
ah i was looking wrong doc
Is there any way to add two lines into action bar? I have power bar and 2 abilities and I want to make the abilities on top of the power bar
oh do you want to move those above that bar there
yes
just the negative space font then
How to add this into existing json file?
why would you
@short pilot
You could use
public CustomWitherSkeleton(Level world, UUID factionId) {
super(EntityType.WITHER_SKELETON, world);
this.factionId = factionId;
this.collides = false;
this.expToDrop = 0;
this.goalSelector = new GoalSelector(world.getProfilerSupplier());
this.targetSelector = new GoalSelector(world.getProfilerSupplier());
this.setInvulnerable(true);
this.setCanPickUpLoot(false);
this.setAggressive(false);
this.setCustomNameVisible(true);
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, true));
// Nearest Attackable Player
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, (target1, world) -> {
// Check if player is from faction?
// Yes -> Return false
// No -> Return true
return true;
}));
}
It now showing this but if I put into jsonlint json is correct, files too
oh the resource pack isn´t working 💀
Hey guys
so i made long ago a ban plugin
but i today coded the pardon command but it doesnt seem to work
if i do /pardon the console reminds me of the usage of the command
^ PardonCommand.java
^ BanCommand.java
^ plugin.yml
^ Main Class
Could anyone tell me where the problem is?
Errors? We’d rather not look through code we don’t have to kek
sure ill send them now
hi kat
Hi rad
Hi kat
how you been
Feel like an old ass man
you're 19 now aren't you
You don’t return on the usage message.
Yeah
wdym
can I call you old now
I guess you can psh
Look at your length check. You don’t return after you send them the usage message.
Can I put here resource pack and can someone look at it? it says "Resource reload failed"
check your console
well, there you go
it isn´t working in singleplayer either
if it failed to load it, there will ALWAYS be something in the logs
why do i get a Forbidden error html stuff if i try to do /ban SalC1
"Got an error with a html body connecting to Minecraft Api"
's API does that sometimes
this?
no
unless you show me the actual error I literally cannot help you lol
java.io.FileNotFoundException: minecraft:textures/font/splitter
at knot/net.minecraft.class_5912.method_43043(class_5912.java:23) ~[client-intermediary.jar:?]
at java.base/java.util.Optional.orElseThrow(Unknown Source) ~[?:?]
at knot/net.minecraft.class_5912.getResourceOrThrow(class_5912.java:23) ~[client-intermediary.jar:?]
at knot/net.minecraft.class_5912.open(class_5912.java:27) ~[client-intermediary.jar:?]
at knot/net.minecraft.class_386$class_387.method_2039(class_386.java:131) ~[client-intermediary.jar:?]
at knot/net.minecraft.class_378.method_51616(class_378.java:207) ~[client-intermediary.jar:?]
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source) [?:?]
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(Unknown Source) [?:?]
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source) [?:?]
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source) [?:?]
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source) [?:?]
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) [?:?]
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) [?:?]
please learn to read full logs
I fixed it, thank you
ok so i fixed a bunch of things but
I banned /ban salc1 in my server
but when i do /pardon salc1 it tells me that he isnt banned
^ PardonCommand
I want to precise that in the config there is only his UUID and not his username
Is it a problem of paths?
if (section.equals(target.getUniqueId())) {
String Object not equals UUID Object
try:
if (section.equals(target.getUniqueId().toString())) {
But your code gave me anxiety
why lol\
huh?
yes
if (cmd.getName().equalsIgnoreCase("pardon")) {
// Unnecessary, if you register your command with "pardon", you dont have to check the command name.
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Please Specify A Player");
return true;
}
OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
target.getUniqueId(); // What the hell?
if (sender.isOp()) { // Do Guard clauses instead of pyramids
if (plugin.getConfig().getConfigurationSection("banned_players") != null) {
for (String section : plugin.getConfig().getConfigurationSection("banned_players").getKeys(false)) {
// When you have more than one person banned you get spammed with "Is Not
if (section.equals(target.getUniqueId())) {
plugin.getConfig().set("banned_players." + target.getUniqueId(), null);
sender.sendMessage(ChatColor.YELLOW + target.getName() + ChatColor.GREEN + " Has Been Pardoned From The Server");
Bukkit.broadcastMessage(ChatColor.GREEN + " Has Been Pardoned By " + sender);
} else {
sender.sendMessage(ChatColor.YELLOW + target.getName() + ChatColor.GREEN + " Is Not Banned From The Server, Or Inexistent");
}
}
}
}
}
return true;
("banned_players").get(target.getUniqueId().toString())
maps are convenient
and a configuration section is essentially a map
Hi do you have an idea how I can start an anti cheat plugins ?
Don’t
my first advice is to give up
Okay, on second thought, I'll let it go.
Bro just saved themselves years of pain
thats a C2 Experienced Pluginner level right there
wdym by spam
you're looping over the entire list of banned players
How I can know my level ?
"Is not"
if you have 100 banned players, it will print "x is not banned" 100 times
by doing step by step plugins
or 99, if x is among banned players
oh no thats not what i would want
so what you want to do instead is to check whether the set of banned players contains the to-be-pardoned player uuid
so what you do is you get the configuration section "banned_players"
how can i fix it
this
this will return null if the configuration doesn't contain a mapping with that key
well i did that
let's see that code
wdym
for (String section : plugin.getConfig().getConfigurationSection("banned_players").getKeys(false)) {
bad
for -> for everything in the list -> do that
should i just remove the for loop then?
r u italian?
german
what's the error
Nah bro
the crystal ball's in the repair shop
cannot resolve symbol section
okay, where did you declare the variable named symbol?
this isn't python; you have to declare your variables before using them
u mean section
yeah section
well i did in the for loop
that's right
and now the for loop isn't there anymore
so you have to do something else
yes
when thinking about what code to write and how to write it, it's a good practice to go through what it is that you're trying to achieve in your head
what are you trying to do?
specifically in this piece of code
Trying to check if a player is banned or not
right
by looking through the config.yml
and how are we storing that information?
in a .yml file called config
yes, more specifically, we are storing the set of banned players' UUIDs in a configuration section named banned_players
are you familiar with sets, maps, or dictionaries?
HashMaps yes
how do we check whether a hashmap contains a specific key?
containsKey?
that's right
now, something to note is that a configuration section is basically a hashmap
the method names are slightly different, but the principle is the same
there are keys and each key maps to a value
how could we make use of this knowledge to check whether the banned_players configuration section contains a specific key?
You are only storing a UUID as a String so it will be a List, which uses .contains(
Hi uhh i need help with mongodb .. idk why i have been trying for serval hours and no success to connect to it
iam using ubuntu 24.04 , the auth info is correct the service is up and working
iam trying to connect from my pc to the vps mongodb
}```
????
warmer, but not exactly right
this is in principle correct, but you are calling the wrong method on the wrong object
remember that we want to check the banned_players configuration section
you are currently checking the config's root instead
so throw in a plugin.getConfig().getConfigurationSection("banned_players") there
well then everything i wrote + getConfigurationSection
use getList as thats what it is expected to be
the other problem is that although i said it is basically a hashmap, the method names are slightly different
if (plugin.getConfig().getList("banned_players").contains(target.getUniqueID().toString))
pretty sure it's a section
though i haven't seen the code that writes to it so i wouldn't know
the config is a section already
his banned players "should" be a List/Set of Strings
shooing away
sure
the other problem with the code is that although i said it's basically a hashmap, the method names are slightly different; specifically, the method to check whether there is a key isn't containsKey, but just contains
Can you switch 2 letters to make visual studio code? :c
wh0t
vcs = vsc
version control software
Oh you are sexy git
should i remove the != null?
contains returns a boolean which cannot be null
but let's see the code first so we know what you're talking about
if (sender.isOp()) {
if (plugin.getConfig().getConfigurationSection("banned_players").contains(target.getUniqueId().toString())) {
plugin.getConfig().set("banned_players." + target.getUniqueId(), null);
sender.sendMessage(ChatColor.YELLOW + target.getName() + ChatColor.GREEN + " Has Been Pardoned From The Server");
Bukkit.broadcastMessage(ChatColor.YELLOW + target.getName() + ChatColor.GREEN + " Has Been Unbanned By " + sender.getName());
} else {
sender.sendMessage(ChatColor.YELLOW + target.getName() + ChatColor.GREEN + " Is Not Banned From The Server, Or Inexistent");
}
}```
apart from the messed up indentation that looks about right
So is it cool rn?
Wanna talk about guard clauses?
which guard clauses
if(sender.isOp())
Nothing but you are creating pyramid if you do guards like that
a lot of if's u mean
Pyramid:
if(a) {
if(b) {
if(c) {
// do
} else {
// do
}
} else {
// do
}
} else {
// do
}
But Guard Clauses is
if(!a) {
// do
return;
}
if(!b) {
// do
return;
}
if(!c) {
// do
return;
}
// Do your main stuff
oh
If you can avoid pyramids, avoid them. You cant avoid them everytime and anywhere. But if its easy and possible do it.
Your code gets more readable.
indeed ure right
I also have a problem with another plugin
should i share the problem?
Sure
im looking at the code rn
and i immediately spot the error
it has the same structures with the ban plugin lol
thats why i had 3 times the same message when i sent the command
👏 You learned today
I want to add a feature to my custom chest that allows it to pick up items above it, similar to a hopper. Would an asynchronous task that runs every second, checks for items above all loaded chest (so all chests inside loadeds chuncks), removes them, and places them inside the chest be a good approach?
for (String section : plugin.getConfig().getConfigurationSection("join_date_players").getKeys(false)) {
if (section.equals(target.getName())) {
sender.sendMessage(ChatColor.WHITE + target.getName() + ChatColor.GREEN + " Was First Seen On " + plugin.getConfig().getString("join_date_players." + target.getName() + ".first_seen"));
} else {
sender.sendMessage(ChatColor.WHITE + target.getName() + ChatColor.RED + " Was Never Seen On This Server");
}
}
}````
You know how to fix it now yourself! c:
this is also called "early return" and there are pros and cons to it; on one hand it's easier to read and the indentation is nicer, reading much like a checklist where you bailout immediately if any check fails
the opposing design is "single return" where all flow control is managed by if-elses and there is only one return statement at the very end
this has its benefits as well, specifically that it's much easier to reason about and be assured that code at the end runs
Depends on how you implemented your chest
as with all things it's mix-and-match and you should use what works out best; in this case early return is better
I have a list of all loaded chests. All Chests have a Map of itemstack present in chest with custom gui etc
But i mean i dont know what is better an async task every x second or use EntityMoveEvent since i have a map of all loadedchest with Location
something to remember that getting entities in a location is orders of magnitude more expensive than getting the block in a location
this is because blocks are voxels and only one can occupy a location at once; it's a simple map query working in O(1), essentially
EntityMoveEvent only calles for LivingEntity or not? So that event wouldnt fire for dropped items?=
conversely, getting the entities in an area (e.g. on top of a hopper) involves iterating over the entire entity list of that chunk section, which could be tens or hundreds of entities, and checking whether they are in that block one by one
i don't know if this is in vanilla/spigot yet, but this is why paper switched it around such that hoppers don't look for items, but items look for hoppers
i can listen both 🤷🏻♂️
getting all of the entities in a world to iterate over is a bit expensive as well and iirc isn't thread safe either
if you don't have many chests, i would probably just search for nearby items on a timer for each chest
and what about getWorld().getNearbyEntities() ? Maybe i can just check entity nearby the chest (so above it) every x time instead of getting all entity in chunk and check if there are near the chest
that works under the hood by iterating over all entities in the chunk section and checking if they're in the range specified
oh yep nvm
how many chests are we talking?
i dont realy know its for a customer maybe 10, maybe 500 depends on players
yeah
?workdistro
are you relying on a pdc to identify the chests or do you have e.g. a block -> chest map in memory for them?
I have a map of all loaded chests in memory
private Map<Location, LuHopper> customChests;
just doing getNearbyEntities on a timer (and maybe staggering the calls like noted above) would probably be good enough
if it isn't, you can look into batching the checks
okay
that is, group all chests within a chunk section into a batch, then get all the items in the section, then map the items to the chests below them
this will improve the performance of chests placed close together
and if you really want to go into clown territory, you can offload this entirely from the main thread by maintaining your own entity list to iterate over; add to it in EntityAddedToWorldEvent and remove from it in entity remove event
then you can iterate over the set on a separate thread and map the items to the chests below them using that location -> chest map
but this is 🤡 and unless you have a ridiculous number of chests and items you definitely shouldn't need to do this
yeap i think getNearbyEntities on a timer will be enough and i can batchhh
Another question—I'm not going to do it anyway since it's unnecessary given the number of chests.
But could NMS help with this kind of feature? I heard that WildsChest has this feature and implements it using NMS.
yeah, you can hook into the entity list of the chunk slice
iterating over it isn't exactly thread safe but the worst that'll happen is that you get a CME and have to try iterating again; it's not going to corrupt the chunk or anything
another way would maybe be to shove extra logic into the dropped item ticking method that'd look for your custom chests but that's not doable without patching the server i don't think
you could uh replace your chests with hopper block entities in the block entity tick list 🤡
Okay, I'll keep this solution in mind as the most optimal in case the number of chests increases and I need to revisit it. For now, I'll stick with getNearbyEntities.
i'm not sure if any of these really perform any better than this, though; the hopper replacement and item tick patch have to run on the main thread, and the chunk slice iteration has to iterate over all entities in the slice, not just items
I can definitely use a hopper instead of a chest as well, lol, and use InventoryPickupItem but its more fun when its harder 💀
Anyway thank you guys For the help. ❤️
when i put item in anvil it gets called (the event) 4 times, what does that mean, do i ignore it?
you fiddle with it until it works right
it's required to do this -> Objects.requireNonNull(getServer().getPluginCommand("test")).setExecutor(new testcmd());
That will still blow up with an error, it only silences your IDE from complaining
an assert would do the same job
or just turn the warning off in IJ
I saw the code from getCommand looks like it only would blow an error if you register your command twice or not?
it'll return null if it isn't listed in plugin.yml
if its missing from the plugin.yml
and how can i turn off this warning?
ty
guys i should make:
- 1 class for all the inventories
- 1 class for each inventory
- 1 class for each group of inventory (Example: for the shop all the shop guis in just one class)
?guis
yeah thats it
ty
But for answering your question, ask yourself following questions:
- Object Orientation?
- Readability?
- Code management?
- Why tf i want to scroll 9000 lines because 20 of my inventories is one fucking class
the answer is probably to make clases for all 3
i think the last one is the more important xd
manager for inventories, single inventory wrappers and common base classes for similar inventories
yes i think i will pick this one too
a class per gui is the best choice, altough you should have a basegui class to extend from, so that you dont repeat code which is shared
right observation
Hi, please tell me how I can spawn mobs in a zone.
We are not chatgpt. A bit more independence for researching and coding would be good ^
#World.spawnEntity()
does anyone know why i cant import org.bukkit.GameMode into one of my commands? i used minecraft preset on intellij
this is my pom: https://paste.md-5.net/pemunikita.xml
Update Intellij
thx youre 100% right i havent opened this since 2022
Yeah if you're wondering why it broke it's because your IDE version is older than Java 21 which Spigot (and Minecraft) is using so it doesn't understand the code properly
how can i put the lapis in the enchanting table if the enchanting has the number 1 how the player inventory does?
If the enchantment table is open the players inventory dont start at 0 its 2
0 = Tool slot
1 = Lapis
2+ = Player
Depends
Example:
InventoryClickEvent#getSlot = Inventory specific slot (Slot id is not unique, player & other start at 0)
InventoryClickEvent#getRawSlot = 0 & 1 is enchantment table, 2+ is player (Slot id is unique)
why is display text in GUI items by default italic
ask 
Mojunk
does not work
Wanna show what you are doing?
ItemMeta balanceItemMeta = balanceItem.getItemMeta();
balanceItemMeta.setDisplayName(ChatColor.RESET + "test");
balanceItem.setItemMeta(balanceItemMeta);
config:
....
balance-slot:
slot: 13
material: GREEN_STAINED_GLASS_PANE
enchanted: true
text: "test" # <-- value
- why is it colored in AQUA by default
- why it defaults to italic
??
hmm
How would you check that?
i dont know lol
Oh, you want the name to be something?
Oh wait
fixed it
Hey look it’s me
"Matata" my head just read first "MetaData"... I should shutdown my pc for today
I am MetaData
Everytime someone interacts with you, you cloning yourself?
for put a specific potion in a gui how can i do? (Speed for 8 min) <- Example
declaration: package: org.bukkit.inventory.meta, interface: PotionMeta
Something like
ItemStack a = new ItemStack(Material.Potion);
PotionMeta meta = (PotionMeta) a.getItemMeta();
// set potion
a.setItemMeta(meta);
(Im on smartphone so i wrote that with my hands could be wrong)
who
it's italic because it has a custom name and its blue because it's enchanted
Multi threaded access to the list you're copying?
If you're removing elements from another thread then your list size is gonna be smaller I guess
do we have a stack trace
copyOf is one of those factory methods that delegates the actual construction to one of like 25 different impls depending on the class and size of the passed list
was copying a map's values
changed it to a ConcurrentHashMap and it's gucci now
crazy
at a glance the only place where i could see that happening is in the toArray method of the collection you're passing it to
kinda uh sounds like concurrent modification yeah
except instead of a comod it's an aioobe
cme's aren't guaranteed, null pointer exceptions and array out of bounds are
in most collections it's just a non-volatile modcount check
specifically it looks like your map might be growing while list.copyof is copying it
since toArray typically allocates an array of the collection's current size and then iterates over the collection's elements, writing to each index
i can see that easily exceeding the allocated array's length
muutability bad
somewhere between functional and the more classic oop
So you're at like a Kotlin then
When I'm inside a player and shoot with a bow, the other player doesn't get any kb . How do I fix this? I forgot how xdd
anyone know how to fix these errors and warnings in a code ?
Add @NotNull to the two parameters in the method implemented on line 165 of punishmentgui.java
and you'll need an instance of whatever class getOffenseCount is declared in to use it on line 268
bro wtf, I woulda asked this guy to send his code. GGs for doing it just from the error msg
side note, read up on https://google.github.io/styleguide/javaguide.html,
summary:
- ClassNamesLikeThis
- FilesClassesAreDeclaredInAlsoLikeThis
- methodsLikeThis
- parametersAlsoLikeThis
- variablesLikeThisToo
- CONSTANTS_LIKE_THIS
... I think that covers it
hoping I got the cause of 268 correct, could be something else
a java course for beginners
on that note, you should paste your code into https://pastes.dev/ whenever you have questions
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
I don't need to learn Java again, but The Connor Gamer most likely does need it
who tf is that
@jade oasis ^
How can I use a Statistic placeholder for do something in my plugin ? Like I want to do playtime rewards can I take the playtime from Minecraft/Statistic placeholder and use it ?
Guys, do I understand it correctly that if you need nms you need to switch your whole project to use mojang mappings? Or can you just use it to get some additional methods on top of spigot api?
Right
declaration: package: org.bukkit, interface: OfflinePlayer
Is there any way to retrieve a player's name from within world files? I've heard theyre saved somewhere there
Oh that's cool
Sorry for the reply
I didn't know about that
Not sure why'd you want to get a (possibly) outdated username
but yes it's possible if you wanted to
No http request
How the statistic will return and which one I need to choice for the playtime ?
declaration: package: org.bukkit, enum: Statistic
- read the docs, they tell you
- read the docs, they tell you
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
Wdym
Bukkit#getPlayer(UUID) doesn't do a network request
But it only works for online players...
right?
yes
getOfflinePlayer has a uuid method as well
But that makes a request
It does not
Or doesnt it
Then the name will be null
Interesting
how can i add empty tabslot?
in a gui how can i get if the player click left click, right click or q?
use the clicktype from the click event
e.isRightClick() e.isLeftClick() i can't find the q click
no in the gui i want that the player get a stuff if he right click, another if he left click and another if he q click (it's a shop different amount of items)
its an enum value
use getClickType() == ClickType.DROP or whatever
declaration: package: org.bukkit.event.inventory, enum: ClickType
ty
there is a method or something for check if the inventory has a slot empty? (Aka not full)
check if its null or air
oh wait
to see if it has no empty slots just use firstEmpty() == -1
what first empty do?
oh okay
and why not 0?
Though if you’re attempting to prevent an item getting lost when you add it to a full inventory, the method (I forgot what it is called) returns a HashMap of items that couldn’t be added.
declaration: package: org.bukkit.inventory, interface: Inventory
nono i will do a check if the player doesn't have an empty slot he can't get the item, wait if the player already have the item in his inventory the firstEmpty will count or not?
Correct that’s why I’m suggesting this way instead, it’s better
oh okay ty then
If they have an inventory with one stick in each slot then first empty will say they have no empty slots but if you give them a stick they can take it
yeye
So call #addItem like normal then iterate through the HashMap and drop it in the World where they stand
“It is known that in some implementations this method will also set the inputted argument amount to the number of that item not placed in slots.”
? I mean seriously? What is this documentation
that's bukkit for ya
So does “spigot” not provide that implementation? 😅
I mean most of the API is still derived from bukkit
idk about specific ones but that probably is
Yeah okay the hell was being thought here
if a partial is added indeed it doesn’t go into the map
git shame fr
anyways it’s implemented how it says ‘some implementations’ are
so it’s safe to use the returned Map and drop the items
my brain just didn’t process the while true at the top
What will Block.getDrops(ItemStack) return if ItemStack is null
Empty collection?
it used to return the drops when mined with the "optimal" tool
i think now it returns the drops when mined by hand
probably what it drops if broken with no item (without a too)
i remember this causing butthurt because at the time there was no way to check what the drops with the "optimal" tool would have been, or to get what the optimal tool even was, so you were just kind of fucked
Hi, is there any way to make the sounds work on versions 1.21? My plugin is using the 1.21.4 API, but they don't work and it throws an error 😦 I got a bit lost.
Hi i have a problem with gradle
this mode is not recommended for production use .. (in red)
impossible to help without the full error nor build scripts
?whereami
use the 1.21 api
ok thx
How would I go about storing data on certain blocks that I need to access the data of every 1-3 seconds? I was originally going for PDC, but I found out that doesnt work for blocks.
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
Thx
But if you need to access the data that often you might want to consider storing them somewhere else as well for faster access
Is there any way to know when a boss bar appears for a player? I can't find any event for it.
I am currently keeping location data of all needed blocks in a database, but I only use that for knowing what blocks are right. I have a ConcurrentHashMap<UUID, List<Block>> for all blocks that need to be ticked every 1-3 seconds
So basically the database is only for the data to persist over restarts
pdc and database are not the same
olivo is just talking about caching im pretty sure
which seems like what you are already doing
i'd make that a Map<UUID, Set<Block>> (with a linked hash set) and pair it with a Map<Block, UUID> or that customblockdata thing that was linked, so removing/adding blocks to the cache remains O(1)
also, since you're using a concurrent map, make sure that you also synchronize on the value (the set/list) correctly; just putting the thing in a concurrent map doesn't make access to it thread safe
the only thing that concurrent map provides guarantees for are happens-before relations of get/put and atomicity of computeX calls
how do I set respawn location after death event?
Use the PlayerRespawnEvent
how can I link playerrespawnevent to playerdeathevent
You can see in the event if the respawn was caused by a death
remember that unless you force instant respawning, the player might not respawn before the server restarts (or possibly ever), so don't expect any values you read from the death event to be available during respawn unless you go out of your way to persist them to disk
i dont really know how it works...
here's the code, can anyone explain?
(i cant take the diamond block and when i change the title it disappears)
ItemStack item1 = event.getInventory().getItem(0);
ItemStack item2 = event.getInventory().getItem(1);
if (item1 == null || item2 == null) return;
if (item1.getType() != Material.STONE || item2.getType() != Material.DIRT) return;
event.setResult(new ItemStack(Material.DIAMOND_BLOCK));
seems like that should work, i have something principally similar but a bit more complicated in a plugin somewhere
but i'm on paper, maybe the event behaves differently there
Does anyone know everything I need for a plugin to work using litebans tryna make it so when clicking wool for example that says
Cheating
1st offence: 30 day ban
2nd offence: 90 days ban
3rd offence: perm ban
In that order but need it to run the litebans command to ban try a figure out how I can implant that if you need my code lmk
Official LiteBans API repo, wiki and issue tracker. https://ruany.gitlab.io/LiteBansAPI/
Didn’t know there was a like api link for it around this thing
how do i cancel knockback in a damage event
how can i return 4 strings from a method? because for making lore of item in a gui i'm using this way
ItemMeta meta = item.getItemMeta();
if (meta != null) {
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
List<String> lores = new ArrayList<>();
for (String s : lore) {
lores.add(ChatColor.translateAlternateColorCodes('&', s));
}
meta.setLore(lores);
item.setItemMeta(meta);
}
return item;
}```
i need to do a lot of lores one equal to the other with only some values that change ->
public static ArrayList description(String material, int price, String type) {
if (type.equalsIgnoreCase("single")) {
ArrayList<String> description = new ArrayList<>();
description.add(Utils.color("&7test"));
description.add(Utils.color("&7test " + price + " &7dd"));
return description;
} else {
ArrayList<String> description = new ArrayList<>();
description.add(Utils.color("&7test"));
description.add(Utils.color("&71x " + price + " &7[r]"));
description.add(Utils.color("&716x " + price * 16 + " &7[l]"));
description.add(Utils.color("&732x " + price * 32 + " &7[ǫ]"));
return description;
}
}
here i can't make the return of the array because in the function for create items it want more strings
i fixed everything with List<String> 🙂
.?
Hi i got the TAB Plugin but idk how i replace the Ping next to the Player Name with their deathcount
Yo man
Is It ur code ?
Does anyone know how to import net.minecraft.entity.player.EntityPlayerMP into the spigot plugin?
Anvila are kinda weird. The reason why it works when you change the title is because that involves reopening the whole gui
It not updating could be some quirk of the anvil gui, but i may be wrong
That's not a class that exists
but there is no way to import?
net.minecraft.server.level.EntityPlayer exists
How is that supposed to work if that class does not exist
isn't that a client class?
Are you trying to turn a forge mod into a spigot plugin?
That won't work. You could try that fork that combines spigot and forge, however thats called
I just want to know how to import net.minecraft into spigot
?nms
?mappings
Compare different mappings with this website: https://mappings.dev/
but it doesnt work when i change the title
what do i do ?
maybe ill just give up with that :(
from what i skimmed from your conversation, it looks like changing the inventory title re-opens the gui without firing the prepare event
you could try copying your logic into InventoryOpenEvent to catch that perhaps?
idk, why cant i take the item though
idk
tryitandsee
now ima sleep so tomorrow but still
hey people!
I'm currently working on Empire Forge, a Minecraft Kingdoms server that brings strategic wars, economy, and unique gameplay to the community. We're in the final stages of development, and with my exams coming up, I could really use some extra hands to help push things forward.
If you're passionate about Minecraft servers, plugins, or general development and would like to contribute, I'd be truly grateful for any help. Tasks include plugin setup, configurations, testing, and balancing—nothing too complex, and I’ll guide where needed.
I completely understand that time is valuable, so this is purely voluntary, but you’d be a part of something exciting and get credit for your work. If you're interested or have any questions, feel free to DM me.
?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/
No.
you are requesting services
so i've to post on web forums?
not here?
yeah, or find people offering services and dm them abou tit
or ask in something like helpchat requests (https://discord.gg/helpchat)
damn did helpchat lose that
should I?
They didnt
Not even being able to find the correct channel and instead advertising somewhere makes me fear of whatever you are doing. Especially considering that your tasks have nothing to do with plugin development
Plugin setup can be vaguely tied to plugin dev
Makes you fear? Fear Of what ?
And its the server development ,
And obv plugins' config / dev is included in the server development.
Fearing it to be not worth to undergo and later regretting a collaboration with somebody who doesn't even manage to post a hiring letter properly. That's not a good sign and only shows potential for worse
Server development can be found in #help-server . This channel is about programming
You're not here to judge my server's potential.
And you can't even judge a person on based of one mistake.
Ive organized way to let my team complete tasks,which many lack.
I am only speaking from experience and warning everyone else. I am not juding that your server will ever become popular, that's the least that matters
https://www.spigotmc.org/resources/vouchplugin-create-and-redeem-custom-command-vouchers.122670/
can you see if is good plugin?
Aight
Rate this plugin please
Are you interested in development of my server anyway?
Wait
ok
It is strange that this server has no showcase-section
yes is my plugin, is the first
0/7 just for you yelling like this
until 5minutes and i fix all
#1100941063058894868 would be best imo
It would require you to show your code tho
But reading "executes command from console" I'd be worried that a player can create a voucher with "ban <username>" and it would work
That would be interesting
"op myName"
execute as @e at @s run summon tnt
decompiled for fun, your package is "org.example"
That is bad..
I assume by players that you mean server admins and not all players, that can create the vouchers
it checks for permission "vouchplugin.create" which I don't see documented
Stores the command on lore only...
Are there comments in the code with emojis in them
Can't see comments ofc, but it does have emoij :D
I just appreciate some good emoji use
yes this will def work on my terminal
Are you using config file as logs ? (you actually just don't use the config nor the map, I read this hastily but still, useless dead code)
I can't see any good reason for storing the created vouchers
And I don't think you ever clear them so over time you'll just run out of memory (ofc this would require thousands of vouchers)- wait, <UUID, String> map, it just stores last created vouchers. Why..
But it does do Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd.substring(1)); So if someone has the permission to create a voucher, they can run any command (with length less than 256 or whatever the chat limit is ig)
Overall probably like 1/5, has severe security vulnerability
@low wagon
Massive security risk
Low Taper Fade
@low wagon
You could make it so that admin has to create vouchers via config
Or smt like this:
https://github.com/InfLabss/VoucherZ
please get that off my screen
LMFAOO
oh boy
I think this is why the block button exists
that's metrics
how to get axis of nether portal block?
its BlockData is Orientable
Hey guys
I have a question
So im doing this plugin, First Seen plugin
But i need to register a PlaceHolder
But when i do it i receive an error
^ Placeholder class
^ Main class
it cant resolve the method register
in the main class
?
I told u
u sent the code but not the error
oh you mean this
^
i cant see the method in your class
well how do i do it
its a method thats on placeholder expansion
does it resolve PlaceholderExpansion ?
well yes bc in the Placeholder class it extenns PlaceholderExpension
yes but it could be that it doesnt so you dont have the resolve method yk
looking at your screenshot, you have errors in the placeholder class
fix them first
what are the errors inside of placeholder.java
what errors do you have in PlaceHolder
They are related to this
bruh
show them
did you add placeholder api to your build.gradle
No
?
do you think it might help to do so
do you wanna go read the docs
i love being google
And i love being helped by human beings
that's just spigot help-dev for you
also my ethernet broke on arch
ratio
where s the build.gradle
Gracias
why do i have the same problem tho
i placed
maven {
url = 'https://repo.extendedclip.com/releases/'
}
}
dependencies {
compileOnly 'me.clip:placeholderapi:2.11.6'
}```
and have you reloaded gradle
did you add them in the correct place or did you blindly copy and paste it first
I indeed did the last one
because i have a feeling you already have a repositories and a dependencies block
yes i do
so copy the entries into the existing blocks first
do not api me
I can't see it, can you make it slightly clearer?
More clear than that u couldnt do it
is that axi kerbal space program?
axi kotlin symbol processing
smh
I will runtimeOnlyApi you
nuhuh
implementation("universe") { exclude("ebic") }
I don't know all that much about gradle
it's a special symbol trust
how about project("universe")
project("insecurities")
cannot help without any actual error lol
And the error u will get
and the error I will get...?
?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.
well make sure the command is in your plugin.yml
A stupid question maybe
but if i have api-version set to "1.21"
will this casue the error
no
then whats causing the problem
.
Fixed
Hey, how to set the maturation of a seed to a certain age in 1.21.4 ?
declaration: package: org.bukkit.block.data, interface: Ageable
