#help-development
1 messages ยท Page 410 of 1
And using ./gradlew.bat does somethign similar?
it return as not a command
Those are not commands but rather files within your working directory
We are attempting to execute one of these files (gradlew.bat) as a command
it dont work
But it seems as if we need to chmod' it, which doesn't seem right to me
java makes me cry
in what way?
error
I doubt windows has chmod
in ever instance
hence it doesn't seem right
even gradlew.bat has the same error
r54tt5tzghzt
I even tried making plugin with the api
what is this joke
Isn't chmod from GNU or something
java is making us question rality lmao
windows has attrib
start x.bat?
plugin having vodka with banana beer
๐
or even open
this is 100% windows being windows
ok file just went away now ๐
Microsoft should abandon cli
I feel like copy con: x.bat isn't the proper command
Why is the yellow stuff an empty body?
i feel like i saw that in a spigot forum
Because you have no code in if body
Thanks.... thanks for telling me that
it copies the text input to a file s.bat
like I know that con is some funny I/O handle, but why :
theres copy x.bat NUL: too or smth related
@quiet ice how should we proceed
echo. > file.txt ๐ฝ
ok i have no clue what im doing
every programmer ever
Oh my bad, I meant why do I get this error
Condition 'item != null' is always 'true'
that doesnt create an eempty file
It does?
Use eclipse - it hard-bundles gradle so it is easily available on the terminal
Because it will never be null ? its even stated by the docs
Alternatively we figure out how to run a command under windows. But it will take a while till the linux-centric hivemind figures that one out
the devs at minecraft mod development are more concered with how textures appear lmao
I read somewhere that other third party resources are capable of writing it to null. So null cases are very much possible.
then docs are wrong ig
k. I can always just ignore the warning right. It's not like the extra if will break anything
better be happy that there are docs
anyway if its rare, it shouldn't be annotated with notnull
Use Objects#isNull instead
i feel like that should not work
but it does
Yo, is on the spigot api (api.spigotmc.org) a way to get the changelog of the latest version ?
๐ข
but everything we have been trying on my project seems to end with more errors
stop messing with poor geolykt
give this man some head pats
I would love to eat some fish
man this is awsome
why does IntelliJ like crashing so much
๐คจ
ikr
looks like a you problem
I literally tried typing item and it froze at ite
Looks like you are fresh
i mean if you look hard enough it says BRB ERR
imagine some dev makes messages using commits
lmao
What did you smoke today
you
who here is good at fixing bugs
Hi, I'm pretty new to spigot plugin coding, although I do have some java experience from past projects. I am making a custom weapon plugin.
In this plugin I have a weapon manager, and a custom weapon class to extend it from my new weapons. So i've got this in my CustomWeapon.java class:
public abstract class CustomWeapon {
String name;
int dura;
ItemStack item;
public ItemStack getItemStack(){
return item;
}
public abstract void useItem(World worldIn, Player player);
public CustomWeapon(String name, int dura, ItemStack itemStack){
this.name = name;
this.dura = dura;
this.item = itemStack;
}
}
Therefor, to make a new weapon, I create a new class which would look something like this:
public class FireWand extends CustomWeapon {
public FireWand() {
super("FireWand", 12, new ItemStack(Material.BLAZE_ROD));
}
@Override
public void useItem(World worldIn, Player player) {
player.sendMessage("You used firewand");
}
}
What I would like to achieve is enchanting my itemstack directly. I've tried making a itemstack function when I would return the item after enchanting it, but it does not accept it inside the super() function.
Any idea how to fix?
<insert access modifiers>
tf
I can't believe yall are still trying to help
just write an abstract getItemStack method instead of passing it through the constructor
Alright I'm gonna try
you can make abstract enchant(Enchantment) method and implement it in every child class
id just made json files for each custom item and write a loader
i got a new error lmao i need your help
๐
`||Task :compileJava FAILED
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-
What went wrong:
Execution failed for task ':compileJava'.
Changes are not tracked, unable determine incremental changes. -
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-
What went wrong:
java.lang.StackOverflowError (no error message) -
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
============================================================================== -
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 4s
1 actionable task: 1 executed||`
i cant help with gradle
gradle trowing stackoverflow lmao
always gradle throwing the most weird exceptions
tf is this supposed to mean
is there a page where i can find all mobs' height? https://technical-minecraft.fandom.com/wiki/Entity_Hitbox_Sizes is outdated, for example, there's no allay height
Minecraft code i guess
Make the enchanting method static
p a g e
?
just open the textures
It will draw the ire of many people on here but what can you do
No that's not how it works @quaint mantle
exactly.
i was gonna say delete that and make a new texture
The texture of the bat is much smaller than it's hitbox
tbh i don't think static will make sense, as enchantement will be unique for every item from what i understood
i need not the hitbox but the height of the visible entity
btw i found the problem with my project
You did not.
reminds me i still want to make a custom items plugin
everything that has errors has got to do with gradle now
i am doing maven
now
You cannot.
fabric it is

cause i sure as hell am not going to quilt
Oh if you are using fabric you basically have the choice between gradle and (sl-)brachyura. Maven should not work
that shit suck
Thanks it worked
You do realize that it is a superset of fabric?
i opened the texture file
not many posts on it
so where is the height
cool, you can make it also protected and call it on constructor in CustomWeapon class
make it a block
What applies to fabric also applies to quilt
Could you stop trolling?
yeah and i'm trying to get the height so what the hell do i do?????????
Decompile server
lamo
Sorry if this sounds like a newbie question but I am not familiar with protected, what does it do exactly?
are you trying to feed me the hitbox size or the height
And look at entity classes I guess
Don't be sorry lmao. Protected is basically private, but public in subclasses and same package
Ooh alright
I am trying to make a Team and add the player and an entity to it so they can't attack each other. But when I add both of them, they can still attack each other
ScoreboardManager manager = Bukkit.getScoreboardManager();
assert manager != null;
Scoreboard board = manager.getNewScoreboard();
team = board.registerNewTeam(p.getUniqueId().toString());
team.setPrefix(ChatColor.DARK_PURPLE + p.getName());
team.addEntry(p.getUniqueId().toString());
team.setCanSeeFriendlyInvisibles(true);
team.setAllowFriendlyFire(false);
fun fact: if you try to make chatgpt write code to kill a mob it legit does it through commands
there's a button called block
Or just stop bring annoying
too bad i am on coffee
Being*
I'm pretty sure I'm not the only one annoyed
everyone who is, will use the sweet button
please help yourselves to it
feeding attention to a person with nefarious intentions will spark a second breath into them
wtf is going wrong here 'registerEvents(org.bukkit.event.Listener, org.bukkit.plugin.Plugin)' in 'org.bukkit.plugin.PluginManager' cannot be applied to '(me.justins_2006.forcepowers.forcepowers.EnableHotbar, me.justins_2006.forcepowers.forcepowers.ForcePowers)'
Should I use implements EventListener or smth? I tried but it didnt work
it's always so fun to wait 39 hours for a gradle project to start working
only 3 minutes
Hi everybody! Is it possible to add default language to resource pack? I'm using TranslatableComponent with PaperSpigot (but it doesn't matters here), and I need default translation if it was not found for specific language
it's still going
is a TranslatableComponent like Component.translatable("container.crafting") -> Crafting Table?
Yes
xd
lmao
i better hope im looking at the right class but it seems to have a fallback
dunno how that lombok constructor stuff works tho
well NoArgsConstructor means that there's a.. no args.. constructor
dont see any code that sets the fallback
I'm on paperspigot, it's different. But the question about vanilla translations. PaperSpigot classes just use resourcepack for magic
It's fork of spigot
well isnt that class present then?
How could I spawn in an Entity with a custom pathfinding ai using nms? The resources I found didn't work for me, or sometimes I couldn't get the correct class name because I am using spigot-mappings
How do i get the drops of an entity on death? I want to put them in the player's inventory.
I'd recommend against not using mojmap
Using spigot-mappings will become more and more painful
Then, sorry to ask this, but how would I change it to mojang-mappings
?switchmappings
reverse engineering crafting be like
EntityTypes.spawnEntity(new CustomZombie(Bukkit.getWorld("world")), new Location(Bukkit.getWorld("world"), 100, 100, 100));
And what would the equivalent to that using mojang mappings be?
I'm sorry to bother you again but I can't find the spawnEntity function in the mojang-mapped class
Or is there maybe some sort of nms guide using the mojang-mapping? I've never really used nms
Might need to look at teh compiled code then. Chances are it's a method introduced by CB (and thus should have the same name)
Spawning a custom entity is as simple as this (mojmaps)
I do have a guide that goes over the basics https://www.spigotmc.org/threads/all-you-need-to-know-about-nms.582651/
?nms
real
thank you
alex's guide only goes over mappings
i didnt read the full message 
clown
huge
anyone knows where to find the critical hit checker in mcp
?whereami
no shit
And is MCP Spigot?
so you don't know where to find it?
Hello, I was wondering if there is a way to cast a ray from a player that checks if there are blocks in path. Thank you
Why would we?
World#raycast
so the answer to my question is "No I don't"
But if you just want to get the target block, Player#getTargetBlock should work
no need to give a shit attitude towards the people around you
i'm calm as hell rn
You come to a minecraft plugin related server asking about critical checks for a platform we don't support or care
You can still be calm and give a shit attitude
i'm simply asking because i want my critical checker for SPIGOT to be as accurate as possible
Isn't it just "if vertical velocity < 0"?
nah there's a lot of conditions
It isn't just vertical velocity
-
A player must be falling.-
A player must not be on the ground. -
A player must not be on a ladder or any type of vine. -
A player must not be in water. -
A player must not be affected by Blindness. -
A player must not be affected by Slow Falling. -
A player must not be riding an entity. -
A player must not be faster than walking (like flying or sprinting.) -
A base attack must not be reduced below 90% damage due to cooldown.
-
from minecraft wiki
but more like vertical offset compared to next tick
for (int i = 0; i < text.getText().length(); i++) {
ChatColor color = ChatColor.values()[(i % ChatColor.values().length)];
text.setTextComponent(i, new TextComponent(color + "" + text.getText().charAt(i)));
}``` What is wrong with it?
Hello, I'd like to run something every tick after a condition is met
So I have a wand that makes you go up in the air and applies levitation
I would like to make it so the levitation goes after reaching the ground, but for performance issues I don't think running every tick would be nice
How would I achieve that in a way smart way (not checking every tick)
if you dont know
?scheduling
Thanks
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (player.isFlying()) {
Location from = event.getFrom();
Location to = event.getTo();
if (from.getY() > to.getY()) {
Block block = to.getBlock().getRelative(BlockFace.DOWN);
if (block.getType().isSolid()) {
player.setFlying(false);
player.setFallDistance(0);
player.removePotionEffect(PotionEffectType.LEVITATION);
}
}
}
}```
Something like this?
oh right, I can just use another event ๐คฆโโ๏ธ
I'm gonna try to implement it thanks
No worries man
Yeah, I think it could work well
Can anyone tell me what im doing wrong with this spawnParticle?
player.getWorld().spawnParticle(Particle.BLOCK_DUST, blockPosition, 1, blockPosition.getBlock().getBlockData());
no errors but no particle on break? When i swap the particle to something else it works am I not putting in the correct data for the Block_Dust particle
public void onEDeath(EntityDeathEvent event) {
if (event.getEntity().getKiller() != null) {
Player player = event.getEntity().getKiller();
ItemStack playermeat = new ItemStack( Material.ROTTEN_FLESH, 1, (byte)4 );
player.getLocation().getWorld().dropItem(player.getLocation(), playermeat);
player.sendMessage("hi");
}
}
Any Idea why this event doesent fire at all?
for 1.19.3
is registered?
yeah ofc, its in my listener class
poor even
:c
the amount of times i've pinged them smh
They were pinged 55 times, once from you.
I wonder how many times they've been pinged then it was deleted lol
That'd be an interesting stat
wait untill you find out about @urban grotto
yeah
hey quick sanity check, don't fireworks explode after a set amount of time based on power no matter what?
they have diff explosion times based on power
like power 1 2 and 3
they travel further
Wait no yeah i am high
same tme
Hey I have this right-clickable item in the first slot of my players hotbar, though I want the player to not be able to move it in the inventory, nor be able to drop it. The item should stay there forever. I don't think clearing and giving continuously is the best idea for this though, does anyone have any ideas?
What about using InventoryClickEvent and e.setCancelled(true), and do something similar for dropping
It works, but whenever I move it I keep the nether star in my movable cursor hand thingy, so it basically duplicates it
Hello , i have a questions regarding Packets with procotollib , i got it working but i cross-version .
but i have a question about it if anyone good with it .
Ughh whatever I try, it just won't work!!!! It doesn't clear the item in the cursor, and Ive already tried 10 billion things
@EventHandler
public void onMoveCrystal(InventoryClickEvent event) {
// Check if the clicked inventory is the player's inventory
if (event.getClickedInventory() != null && event.getClickedInventory().equals(event.getWhoClicked().getInventory())) {
// Check if the clicked item is a nether crystal
ItemStack clickedItem = event.getCurrentItem();
if (clickedItem != null && clickedItem.getType() == Material.NETHER_STAR && clickedItem.hasItemMeta()) {
ItemMeta meta = clickedItem.getItemMeta();
// Cancel the event to prevent moving the nether crystal
if (meta.hasCustomModelData() && meta.getCustomModelData() == 1) {
event.setCancelled(true);
Bukkit.broadcastMessage("Cancelled!");
if (event.getCursor() != null) {
// Clear the cursor item if the event was a result of a hotkey press
event.getClickedInventory().setItem(event.getSlot(), clickedItem);
event.getWhoClicked().setItemOnCursor(null);
}}}}}```
iam not sure but maybe you need to do player.updateinventory?
hi, what is the way to make your custom item (itemstack) unplacable? For example my ItemStack is a tripwire hook and I want it to be right clickable (which I did) just not able to be placed
just put something on the pdc and scan on placement
pdc?
persistent data container
?pdc
aight ill look into it, thx
man this sucks
I've been working so much my wrist hurts
I bought a new vertical mouse, I'm working if I should get a split keyboard as well
angle of hand to arm is the most important
it doesn't really matter, I pulled a 24h work day followed by over a week of 16h work days
at some point regardless of your position your body is just going to give up
you'll regret it later in life if you end up with carpal tunnel syndrome
well to be fair I stopped when it started hurting, I'm still waiting it out right now
ngl the pdc is confusing me a ton
it's going to take a couple of weeks for my new mouse to get here
I sort of like this keyboard, shame it uses brown switches I hate those
I like browns
not for me, I just find them to be hella sticky
but I have found a BIG difference between one manufacturers browns to another
I mean cherry mx brows are just cherry mx browns, isn't it all provided by the same manufacturer at the end of the day?
unless you're getting brown-alikes
not these days, Cherry is the brand, but not all keyboards use cherry. They just say brown
huh
I mean I've only been buying keyboards that specifically say they're cherry mx switches so I guess I'm just out of the loop
I'm using red switches right now, I quite like them
I started with cherry mx browns and disliked it so much I switched as soon as i could
actually you know what I just went to check and I think I might've had it wrong this whole time, that keyboard might've been using cherry mx black
it probably was
Hey,
Is there a way to pass the name a World should have with the WordCreator? Because I get a duplicate error when trying to load/create the same world twice I have copied from a worldfolder I have multiple worlds in.
Sure, either through the constructor or a setter. Both work
Also: You cant load a world twice ofc
declaration: package: org.bukkit, class: WorldCreator
yea, but I copied the same world from a worldfolder in the server folder and load them both so the player can play on both seperate
Inside the world folder there is a file containing the UUID of the world. You need to delete this in your blueprint world.
how can i check if under the block placed event there's another block like a scaffolding?
oh, is it getting regenerated?
Yes if its not in the world folder then it generates a new uuid
- Get the placed block
- Call
getRelative(0, -1, 0)orgetRelative(BlockFace.DOWN)to get the block below the placed block - Check if its type is scaffolding
me needed 2 hours to figure out the formula for (row - rowStart) * width + (col - colStart) - 1 ๐
and lemme guess it wont work in all 100% of the cases
if you have enough money you could go for some proper tactile switches
Like holy pandas or something
you should know as well as I do that you can't get niche expensive keyboards with a portuguese layout
I went Ducky
I am currently on a ducky v2, my favorite keyboard out of all I bought throughout the years
umm
just go with an ISO layout ??
you can find keycaps with the fancy รงยบ~ยด keys
ยซ
I've been holding back from switching out of a portuguese layout because until recently one of my main activities was as a translator
that's sort of not really been the case lately and is unlikely to change so maybe I'll go back to other layouts
time to get dvorak
I'm fine enough with my keyboard atm
logi mx keys
ain't even mechanical
but costs as much as one
I used to use the shitty 30$ mechanical keyboards
the one I posted earlier costs nearly 400โฌ
I bought a 1life mechanical keyboard that lasted a whole 2 days
wow
for like 25 bucks
but tbf I also bought a HP keyboard for 10$ that lasted about 2 hours
I'm shocked you found a 1life product that costs more than $10
or 15$ or whatever
it was a mechanical keyboard
they're a weird brand
ah yes of course
I used to have a 1life mouse that I bought for about 12โฌ
that lasted me like 2 years
the paint on the abs plastic was peeling
I used to have a sun microsystems keyboard when I was little
I've always lived off cheap peripherals because I sweat tons and it always brokey
It was a good keyboard
and then I just bought some real good ones that are basically waterproof and haven't had problems since
are you making puddles on your kb? the hell
yes
nasty
It's a medical condition :(
reminds me of why I want to throw you off a cliff
It's also one of the reasons why I hate phones
and touch screens in general
I only use my phone to check discord and play hay day
meanwhile I had to stop washing my hands as much because they were so dry they just started cracking
I get surprised when my hands are dry
I once went for about 30 hours dry
felt weird
I have no grip
even at the gym my hands barely get sweaty
I'm the complete opposite
I was thinking of travelling up north
maybe firebomb a couple houses around your neighbourhood
all fun n games until law enforcement sees this
what a coincidence, I was considering going down south to train my portuguese water dogs for home security training
funny enough I got attacked by a dog today
I am a master of disguise
letting em shit on the sidewalk
only when I know it's a sidewalk you'll be using
nah bro I levitate
levitate higher and maybe the dogs won't get to you

Can someone please help, my code won't work
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (event.getSlot() == 0 && event.getClickedInventory() == player.getInventory()) {
ItemStack clickedItem = event.getCurrentItem();
if (clickedItem != null && clickedItem.getType() == Material.NETHER_STAR && clickedItem.getItemMeta() != null && clickedItem.getItemMeta().getCustomModelData() == 1) {
if (event.getAction() == InventoryAction.HOTBAR_SWAP || event.getAction() == InventoryAction.SWAP_WITH_CURSOR || event.getAction() == InventoryAction.PLACE_ALL || event.getAction() == InventoryAction.PLACE_ONE || event.getAction() == InventoryAction.PLACE_SOME) {
event.setCancelled(true);
player.updateInventory();
}
}
}
}```
As you can see in the video, the item is still replaced by a nether star, or just straight up disappears
The last part is me pressing 1 when hovering over the second slot, to swap the items
I've literally been trying to figure this one little thing out for 5 hours now and it's still not working
I don't get it
I've literally tried everything
do me a favor and use early returns
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (event.getSlot() != 0 || event.getClickedInventory() != player.getInventory()) return;
ItemStack clickedItem = event.getCurrentItem();
if (clickedItem == null || clickedItem.getType() != Material.NETHER_STAR || clickedItem.getItemMeta() == null || clickedItem.getItemMeta().getCustomModelData() != 1) return;
if (event.getAction() == InventoryAction.HOTBAR_SWAP || event.getAction() == InventoryAction.SWAP_WITH_CURSOR || event.getAction() == InventoryAction.PLACE_ALL || event.getAction() == InventoryAction.PLACE_ONE || event.getAction() == InventoryAction.PLACE_SOME) {
event.setCancelled(true);
player.updateInventory();
}
}```
and now variables
Even like 50 AI enquiries from different chatbots couldn't figure it out
wha
never heard of variables
getItemMeta returns a copy every invocation
In my plugin.yml, if I provide commands with permissions, do i need to then register the permissions or can I just leave it like that?
e.g. do I do this
commands:
test:
permission: test.test.perm
or do I do that + adding a permissions list with test.test.perm
nothign more
a permission on a command is automatically registered
I doubt you have to update the inventory if you cancel the event
@dry yacht Finally got it done! Dont mind the stupid heads
question for resource staff, can i sell an addon of a plugin that is not coded by me?
Yo that looks amazing, congrats :)
Thanks!
If the addon is made by yourself (but the depending plugin not) - most likely so. If it isn't - probably not.
If the addon depends on a premium plugin - no.
But would it matter a lot?
The impact on performance is probably so small it doesn't really matter right
oh wait you mean player.updateInventory();
Let me remove it and see what happens
k it doesnt change anything. Ill keep it removed
Is there som way i can get minned blocks from player "Statistics" ? where you have everything from jump to killed mobs
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/OfflinePlayer.html#getStatistic(org.bukkit.Statistic) maybe that?
declaration: package: org.bukkit, interface: OfflinePlayer
and use this statistic https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Statistic.html#MINE_BLOCK
declaration: package: org.bukkit, enum: Statistic
you are tryign to stop them moving the netherstar?
Yes
They cant drop, cant swap, cant select, cant do anything with it
But it doesnt work
as shown in the vid
then the InventoryAction doesn;t matter. if it's the star slot cancel the event. You also need to listen to drag and swop hands events
I've already tried cancelling the event in 50000 different ways and it never ended up working
this is the closest it got to working... kinda
What would be the best way to save the state of a map before a skywars game?
Trying to think of how map resetting would work for something like skywars without nuking memory
I guess I could store the map as a schematic and load it then rebuild it when the arena is restarting?
@vagrant stratus just to confirm this
Depends.
Is it an open source addon? If so, did you make significant changes to the fork
If the addon was coded by you, is the plugin paid? If so, no
no. the original plugin is not paid, the addon is not open source but the original plugin is
Can someone please help me with this? I've literally spent 7 hours trying to get this SINGLE LITTLE thing working and it's still shit and won't work.
Even AI just ruins the code even further when trying to help
I just tested and my code protects hotbar slot 0 for everythign bar pressing Q
?paste
does anyone know how to set entity's equipment enchanted?
uh oh what happens again when the client is fully responsive
You can still swap it with a different block using hotkeys (so numbers)
Go in your inventory, put a block in slot 2, hover your cursor over slot 2, press 1
ah ok, not a difficult fix for that though
how do get random number from 1 to 2 (must look clean yes)
Well it took me 7 hours to get one thing working
isnt that one of those things that takes 3 seconds to look up
all i see is Math.random(RANDOM BULLSHIT GO!!)
import java.util.Random;
// ...
Random random = new Random();
int randomNumber = random.nextInt(2) + 1;
iw ant clean
Random random = ThreadLocalRandom.current();
int randomInt = random.nextInt(2);
ok
does anyone know how to order mob to move to exact position? im trying to create custom mobs without nms, spawn/respawn is ok, but i dont think do pathfinding without nms is possible at all. any advice or arguments why i must use nms
You need NMS for pathfinding
ThreadLocalRandom random = ThreadLocalRandom.current();
int randomInt = random.nextInt(1, 3);
too much brain power
also if you do this, use remapped, it makes porting so much easier
And what would that fix be?
@EventHandler
public void onClick(InventoryClickEvent event) {
Bukkit.broadcastMessage("Slot: " + event.getRawSlot());
if (event.getRawSlot() == slotToLock || (event.getHotbarButton() != -1 && event.getHotbarButton() + slotToLock == slotToLock))
event.setCancelled(true);
}```
compile it first
just remember this code is using raw slots so will only work for teh player inventory
so 36 to 45
raw slots change depending on what inventory is open
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
not too difficult to use Slots though
So thats not really good
different event
Tell that to the guy who wasted 7 hours trying to make it
shiftclickevent or smth like that
theres a bunch a events for inventory
click, hover, shift, etc
shift click is in teh normal click event
oh
i spent 4 hours today figuring out basic math
Yes but the shiftclick only works in the chest
nice to know
just drag is not
wait
what do you call basic math
doesnt every container inventory accept shift click
int ingredientIndex = (row - recipeStartRow) * getWidth() + col - recipeStartCol;
unless its shulker into shulker or a recipe not recognized
reverse engineering mojangs crafting
My ass drank a teensie bit of alcohol and those words are just some letters scrambled together
average spigot dev
Sounds normal to me
Oh wait I have a solution for that let me find it
public class EverythingIsTrue {
static void setFinalStatic(Field field, Object newValue) throws Exception {
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(null, newValue);
}
public static void main(String args[]) throws Exception {
setFinalStatic(Boolean.class.getField("FALSE"), true);
}
kinda going well only handling empty columns or rows goes brr
im rethinking life choices now
why does this work
when did they fix it lol
probably cuz its public and static
java 9?
do it in c lol
understood, do you have complete guide with install? i followed md5 guide, it worked until i used EntityInsentient (got this error: 'y()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'y()' in 'net.minecraft.world.entity.EntityLiving'), i guess i did remapping wrong
Whenever the stopped letting you reflect the Modifiers class
code please
i doubt its a remapping problem per se
but its probs remapping causing the error
just empty class + ctor
im gonna check that myself one moment
i want to make sure it happens for me too
are you on 1.19
?
yep, 19.3
just to mention, i didnt add maven config, only dependency. i didnt get if this is necessary
if its on maven you need to have the dependency to 'see' the methods and the plugin to be legally allowed to publish it
do you mean this one?
oh, my bad, will try to add this
so you reobfuscate it
thanks in advance
How can I make a custom entity jump when he gets stuck? I have an entity extending EntityInsentient and I want him to jump when he encounters a block. I'm using MoveController to make him move to a point, but he gets stuck when he has to go up blocks.
I'm essentially looking for autojump for custom entities. How is this done?
uh
that path doesnt exist for me
i only have these two
net.minecraft.world.entity.monster.Zombie
net.minecraft.world.entity.monster.Monster
this zombie extends monster
you probably meant to use one of those two
i have EntityZombie and EntityMonster with same paths
you mightve not reloaded ur maven
that sounds like nms paths
but without the remap applied
how do i read and insert a boolean into config.yml?
This works with any inventory https://paste.md-5.net/xanucibexu.java
config.set("path", bool)
config.getBoolean("path")
Thanks I'll have a look when Im not tired, dizzy, tired, and dizzy
mans so dizzy he saw the word spin away and retyped it again
Alright, I have been trying to get this to work for over 5 hours with no luck. I have followed every tutorial I can find to a tee and nothing.
Trying to get 1.19.3 NMS. Yes, I have followed ?nms. Yes, I have looked at the wiki. Yes, I have ran buildtools already.
import net.mine nothing shows up. IntelliJ does not see it. I don't what to do anymore. I'm losing my mind over this
Maven or Gradle?
Maven.
Paste your pom pls
send pom
?paste
oh shit I thought it said something else
Im too tired Im out of here
Click this pls
@smoky oak thx) got properly remapped classes and it works fine ๐
Thanks so much
Yo does anyone know how to make movecontroller jump when the entity is stuck on a block
sure. remapped is irritating to work with at times
No gradle ๐ญ
sloppy fix: make the pathfinding keep track of the current position every 20 ticks. then make it jump if it didnt change position
Yea sounds like a good sloppy fix
Definitely know there has to be a normal way to do this
Guess ill just keep scratching my head at the code because my NPCs might be idle and standing still and stuff
paper userdev
What do you mean by stuck on a block=
Like autojump
The same criteria as autojump
When you're on a one block high jump and it should jump for him
Well... if your pathfinder changes from Y to Y + 1 then you need to jump.
I'm not using pathfinder for efficiency
He'll walk in a straight line to the player and if he gets stuck like that then so be it
But there should be a non-pathfinding way to determine whether or not to autojump
I know for a fact that there isn't pathfinding code running for the player for autojump, right?
That can only be really done by polling the block in front of the entity
This is done client side
The code should translate across the boundary right
I mean I'm fine doing polling since I'm recalculating every tick
Should I just check the bounds? Seems like a dirty solution
Yeah but its not exactly cheap. You basically ray trace in front of you and jump depending on your current velocity
Yikes a ray trace per tick per entity isn't exactly efficient so yeah
You can just get the block in front and let him jump until he climbs up. Not exact but very cheap.
Like if there's any block towards the front of him yeah I guess that would work
Any full block, yeah
And entities might get stuck jumping on walls but that is whatever
Already happens ๐
You also need to check if the block above is air
Shouldnt add much time
How should I do this just round the current look direction into one of 4 Vector3s
Vector3(1,0,0)
Vector3(-1,0,0)
Vector3(0,0,1)
Vector3(0,0,-1)
And then find the relative block with that vector3
Get the current block and facing of the entity and then block.getRelative(facing)
Or better translate the movement vector to a BlockFace and call that method.
Because then they can also jump over blocks backwards.
Cant you shoot a ray from your players feet and see if there's a block in a very short distance
idk if thats possible with spigot
and minecraft
Yes. Too expensive.
someone have good guide about packets, i want to know how to manage it all
RPG
Could be thousands of mobs
Want really basic pathfinding
Hello anyone that can make a plate system like warzone 2.0 or a chest system dm me
BlockFace constructors are private ๐ญ
This isnt an advertisement server mate
Bro i just need help
Then ask for help. But you're asking someone to make something for you
?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/
Well for an RPG you can do that completely multi threaded
True i guess
Okay let me re say it in a better wording
Can someone Pls show me how to make a plate system like warzone 2.0
Just generate a height map of the entire world. That never changes. Then you can use this (immutable) height map
in multiple threads for some really efficient pathfinding. This way you could even create paths over thousands of blocks.
Pathfinding still doesn't need to be great it can be dumbed down for them
Hmmm
Then it can be done in multiple threads too
Just turn them into zombies and make them all follow a target, if thats what you need
Well what if I have caves and shit
Exactly what I'm doing, just vector to player pathfinding
If they get stuck on a wall then they can pound it
They get mapped out as well. If they are static like the rest of the world then you just need to map it out once and
every time the world changes
Just kill them if they get stuck and spawn a new one elsewhere
For dynamic dungeons: Generate a height map when the dungeon generates
Well they would only get stuck temporarily
Until the player leaves or kills them or whatever
Unless they fell into a hole or something lol
Tough shit, execute them
Lmfao
Interesting, PlayerDropItemEvent fires after modifying the Players inventory and a cancel throws the item back in, so no way to check where the item came from
how do i make an item invulnerable to any damage
like fire explosion etc
i tried unbreakable but it didnt work
Is this about the system Ive been trying to make for 7 hours?
yep just been messing around
in yoru case this part is easy as you have meta on it
Ahh alright
if you don;t have a way to identify it you can't detect in teh drop where it came from
btw I got teh click all cleaned up ```java
@EventHandler
public void onClick(InventoryClickEvent event) {
if ((event.getSlot() == slotToLock && event.getSlotType() == SlotType.QUICKBAR)
|| (event.getHotbarButton() != -1 && event.getHotbarButton() + slotToLock == slotToLock))
event.setCancelled(true);
}```
that protects a hotbar slot and only that slot no matter what inventory you have open
yep
I wanted to block Q too but I can't with general items. You can easily though as you have custom model data to check
Wow, you really improved that again by a ton! It's great to see how you persisted and didn't give up on the idea, and you made it work out eventually :D.
Yep im happy its done ๐
Altough i wanna add some more visual stuff like particles, its kinda boring atm.
Yo, just implemented this and it works really well
Thank you brother
how can i drop experience orbs in a specific location? i have seen that you can use this:
"world.spawn(location, ExperienceOrb.class).setExperience(experience);"
But for example in the spigot API it doesn't say (?)
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html
Is there a better way to do it?
the player for example has a method to set experience or levels, if I want to drop 2 levels of experience in a particular location are there methods to do so? should I use NMS?
use the spawn method that takes a consumer
yes, but is there a way to give experience levels? or should I calculate how much experience I should give him?
you calculate it as it only accepts an int
it would be nice if there was a method for levels as the player has for example ๐ง
How can I wait 1 tick in event listener?
I found soemthing like e.wait() but thanks thats what Im looking for
@sterile token werenโt you working on some command api to make handling tab completions and handling arguments easier or something?
swore someone was working on that
I did it
Check BlobLib
It's like a framework for Bukkit/Spigot development
It wraps everything in managers. It has builtin stuff like CrudManagers (quickly make CRUDs for SQLite or MySQL, a CrudManager for MongoDB is coming soon)
It is oriented to design objects to be serialized and deserialized asynchronously, even Bukkit worlds without any issues.
wheres the actual command framework then
so wheres the command lib they wanted you said it had
I'm first orienting wrappers to work with BlobLib plugins.
i been tryna figure out the same thing ๐ญ
I also made an IntelliJ IDEA plugin to quickly generate classes for BlobLib plugins
The best thing from BlobLib is that it can share objects between BlobLib plugins and BlobLib, such as BlobInventories, BlobMessages and such
The idea behind it D.R.Y
` List<String> loreList = player.getInventory().getItemInMainHand().getItemMeta().getLore();
String lore = loreList.get(0).toString();
int charge = Integer.decode(lore);
charge--;
ArrayList<String> NewLore = new ArrayList<>();
NewLore.add(ChatColor.GREEN + "" + charge);
player.getInventory().getItemInMainHand().getItemMeta().setLore(NewLore);`
I'm trying to get the lore of an item
turn it to an integer
minus one
set the new value as the new lore of the item
this doesn't work and I've tried many methods can anyone help
the code copy pasted kinda weird
but hopefully you can read it
if its just 1 arg needed and you dont mind the bukkit command api check out this https://github.com/The-Epic/EpicSpigotLib/blob/master/src/main/java/me/epic/spigotlib/commands/ArgumentCommandHandler.java & https://github.com/The-Epic/EpicSpigotLib/blob/master/src/main/java/me/epic/spigotlib/commands/SimpleCommandHandler.java thats how i normally just handle 1 sub command
iโve got more than one, i was thinking about doing a tree structure but i also wanna avoid a class explosion
I can update BlobExecutor to not require a BlobPlugin argument but a JavaPlugin instead
ah, acf might be good for that but no idea how expandable it is
It's not needed, I did it that way prior to ensure people starting to adopt BlobLib ๐คก
you forgot to set the item's meta back after changing it
ItemStack#getItemMeta returns a copy of the item's meta
ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();
//your code minus the first and last line
player.getInventory().getItemInMainHand().setItemMeta(meta);
^
this sucks, I can't work on anything because I'm starting to have a repetitive strain injury on my wrist
at net.md_5.bungee.api.ChatColor.translateAlternateColorCodes(ChatColor.java:216) ~[bungeecord-chat-1.16-R0.4-deprecated+build.6.jar:?]
at nesancodev.com.supershows.spotlights.SpotlightCommand.t(SpotlightCommand.java:148) ~[SPM-1.0-SNAPSHOT.jar:?]
at nesancodev.com.supershows.spotlights.SpotlightCommand.onCommand(SpotlightCommand.java:137) ~[SPM-1.0-SNAPSHOT.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[pufferfish-api-1.19.3-R0.1-SNAPSHOT.jar:?]
... 23 more```
why is this error happening
```java
sender.sendMessage(t(MessageUtil.getText("spotlight", "created")));```
```java
public static String getText(String category, String key) {
String lang = SuperShows.getInstance().getConfig().getString("lang");
FileUtil util = new FileUtil(new File(SPM.getInstance().getDataFolder().getAbsolutePath() + File.separator + "languages" + File.separator + "lang_" + lang + ".yml"));
YamlConfiguration configuration = util.getConfiguration();
return configuration.getString(category + "." + key);
} ```
```java
private String t(String m) {
return ChatColor.translateAlternateColorCodes('&', m);
}```
I already exceeded my yearly dog budget because someone keeps shooting it
raise the budget then
whats SpotlightCommand.java:148
the bottom method
String m is null im guessing
text to translate is coming from ChatColour so m is null
say I have the lore as ChatColor.GOLD + "50"
how can I get the "50" as a string without the chatcolor being involved
basically how do I remove chat color
ChatColor.stripColour(string)
String lore = loreList.get(0).toString();
so if I have this
where do I put
ChatColor.stripColour(string)
wait im stupid
nvm
String lore = ChatColour.stripColour(loreList.get(0));
i dont understand how it could possibly be null, "spotlight.created" is a valid path in the file
do some checking on that huge FileUtil line
double check your path after those 10 million concatenations is correct
and verify that using File.exists, so extract it from the FileUtil instantiation
and then print every key inside of that YamlConfig
iirc util.getConfig() or something you have it
will an error be thrown if i sendMessage to a command sender that is a console
this is a really dumb question but im on my phone and cannot test it xD
no, no error
why should there be
sendMessage exists on CommandSender for a reason
sorry i meant if it would just fail silently
does it send a message to console?
it does
Hi, is there any way to load a world multiple times into the memory at the same time? (They are never going to save anything and the actual world file is supposed to function as a backup file/template)
how would I check if someone starts eating a food? like they're in the process of eating the food?
what event is that
PlayerItemConsumeEvent
Potions and shit are included too so make sure to check it's food
doesnt that fire when someone actually eats the item?
I wanna check if they player like right clicks it and starts eating it rn
if that makes sense
Yea i'm not sure if an event exists for that
Oh yea cuz I don't think there's any packet to send to cancel the eating animation
So cancelling it wouldn't make sense
yeah
So it doesn't exist :p
np
Im making a plugin based on GUIS
but when i like, click and open the gui and stuff
its ok bc i cant move anything
but then i cant put or destroy blocks
OH NVM
I JUST NEED TO DELETE THE LAT LIKE
LAST LINE
Lmaoo
how can i disable chest open animation?
if I want to pardon an account, do I have to unban the account AND the IP? Like how would I check if it is IP or Name banned?
did you used
/ban-ip
or
/ban?
Should i use multiple classes for each gui i wanna listen?
like
actually i have 4 different guis
and im listening to them in the same class
my question is: Affect anyway if i do multiple listeners classes?
hello
i am having trouble at build tools installation
is someone online to help me pls?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
If you mean performance wise, it will have minimal impact
So not smth to worry about
can i send images here?
hey, how would I send a plugin message directly to a player's client from bukkit?
[ERROR] Cannot invoke "java.util.List.stream()" because the return value of "org.apache.maven.project.MavenProject.getCollectedProjects()" is null
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [C:\Windows\system32\cmd.exe, /D, /C, D:\apache-maven-3.9.0/bin/mvn.cmd, -Dbt.name=3669, install:install-file, -Dfile=work\bukkit-c69e3af0-members.csrg, -Dpackaging=csrg, -DgroupId=org.spigotmc, -DartifactId=minecraft-server, -Dversion=1.19.3-R0.1-SNAPSHOT, -Dclassifier=maps-spigot-members, -DgeneratePom=false]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:1055)
at org.spigotmc.builder.Builder.runProcess(Builder.java:986)
at org.spigotmc.builder.Builder.runMaven0(Builder.java:955)
at org.spigotmc.builder.Builder.runMavenInstall(Builder.java:914)
at org.spigotmc.builder.Builder.main(Builder.java:523)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
I am having this trouble when run BuildTools
the .bat file:
java -jar BuildTools.jar --rev 1.19.3 --remapped
pause
Hmm maven 3.9 jumps out at me, I'm not sure if that version has been tested. Could be worth trying a different version
No, just i search for organization
oh ok
ok thanks very much
where can i find the download of another version of maven? i am searching around https://maven.apache.org/download.cgi but not finding anything
buildtools will download an appropriate version though, you dont need it unless oyure developing plugins
thanks again!
Player interact event
Then check if itโs a right click
And they are holding it
If that triggers add them to a list of players and ignore it if the list contains it
Or just cancel the interact
@EventHandler
public void onPlace(BlockPlaceEvent event) {
ItemStack placedItem = event.getPlayer().getInventory().getItemInMainHand();
// ...
For some reason this is returning null if the player places with only one item. What can I do to get the item they're placing? I have tried event.getPlacedItem() or whatever it is but it doesn't work either.
Try getItemInHand() Otherwise getPlacedBlock() should work as that will return the Block then you just get the itemstack from that.
I tried that before switching to this and it didn't work
I haven't tried the getPlacedBlock() but I need the itemstack specifically for the nbt
BlockPlaceEvent#getItemInHand
Should always return the item before it gets removed/modified
to ban someone using IP, is the target the players username or hostString
If you want to ban a player using their username (not player module) You will need to use the getPlayer() bukkit funtion, than you will add them to the bukkit banlist.
make sure to have null checks
this is my code for ipbans, does IP banning auto ban name? or do I have to also add it in
One moment while I read through this.
oop forgor to set the expiry
but what I did for my banning plugin, I actually used a custom banlist with a bans.yml
I dont believe so in 1.8.8 (what I am using)
uhh
because i do remember reading somewhere they deprecated name bans
did you just disconnect people from joining
ikr
?
im stupid LMAO
wait no I think it was player login event
Thatโs what everything on the internets seems to recommend
you're not stupid :C
ill help yuou in 1 moment
I canโt find any actual info on how the Bukkit ban lists work
is there a difference
ye
X__gamer you might not even need a plugin for that, just use a chunk loader
thats what I used ๐
not sure
Im trying to use it in my plugin to load Minigame worlds ๐ค
it does exist in 1.8
The same world multiple times into the memory with no saving (I think the World UUID is preventing it)
use bukkit.getWorld
is that what that dat file is for
The idea is to not clone/delete the entire folder to make it efficient and just load and unload
Yeah but that would get me the same world two times
try
getServer().getWorlds().add(worldname);
and
if(getServer().getWorlds().add(worldname) == true)
{
System.out.println(worldname + "is loaded")
}
not using logging smh
Iโm almost positive that list is immutable
getServer().createWorld(new WorldCreator("WorldName");
Iโm not sure if you can load the same world folder several times
I guess as long as you prevent any writing it should be possible
Can't load same world multiple times
hi md_5!
Hm that sucks would be so nice could it be done with replacing the UUID File or is it locked when the World is loaded? ๐ค or NMS maybe?
World e = Bukkit.getWorld("worldname");
assert e != null;
getServer().getWorlds().add(e);
There's a lock file created which will prevent it
Sounds like the solution might be a bit messy thanks for the info I might try it
Thx but the question was not how to load a world itself but if there's any way to load the same world (folder) multiple times into the memory ๐
ah
How would I go about getting all of the list items from a section in config file with the following format:
rewards:
- type: MONEY
money: 1000
- type: EXPERIENCE
money: 1000
- type: ITEM
item:
material: "DIAMOND_SWORD"
name: "&b&lDefault Sword"
amount: 1
So I have the section "rewards" Idk if this is how it works but I need a ConfigSection per list item.
it doesn't
xD ty
probaby not going to be able to use this format as I need to get item as a configuration section
I mean a config section is mostly just a fancy map
I think there may even be a method to convert a map to a config section, donโt remember
@EventHandler
public void onPlace(BlockPlaceEvent event) {
ItemStack placedItem = event.getItemInHand();
// ...
}
PDCs are NBT-like (and are actually stored in a (Craft?)Bukkit-managed NBT tag iirc) and have existed since 1.14
Inb4 1.8
god i hope nyot
I know what PDC is but I use the nbt api for block nbt as well so it's more consistent to continue using it across the project
and here's the weird part
I just restarted with a debug line to output the placed item
and it output it normally and no errors
it's very inconcistent as to if it's air or not for the event value or the method I tried using before
sometimes it works sometimes it doesn't and I don't understand why
What do you need block NBT for
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
two different instances of the placement of the same item
1st time it works
2nd time it doesn't
alex also has a PDC lib for blocks iirc
what you guys are discussing doesn't solve my problem
bump still not working
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
update: when I get the item and I right click it on air (not placing it), it refreshes as if I just got the item in my hand and then when I place it it's not air according to the place event
happens with any item I'm given with nbt
fixed
can someone help me code a plugin that will give fly for example 10 min a day and will reset back to 10 min of flight after 24hours dm me plz
How do I get API on Mac? I'm used to Windows and haven't used my laptop to code in quite some time...
?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/
Its like python 3 atm so would need big recode
Do ?cc list in trivia
Why are my bukkit imports not working?
i put the unbreakable tag on an item but it still takes explosion / fire damage
am i missing something?
unbreakable means the durability doesn't go down
so then what would i do for an item that doesn't have durability?
items that don't have a durability can't really be unbreakable
cuz yk they don't have durability
im trying to make it so they don't burn or get blown up
hmmm Maybe check out EntityDeathEvent for that
I wonder if Items would trigger that
?jd-s
maven or gradle?
maven
I think so?