#help-development
1 messages · Page 285 of 1
Remove the getCommand("chud").setTabCompleter(new CoordinatesHUDTabExecutor());
alright
Should I make the tab api synchronized? (only on main thread), or should I just support multiple threads editing it?
package me.pulsesapphire.firstplugin;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class BlockBreaks extends JavaPlugin implements Listener {
@EventHandler
public void BlockBreakEvent(Block brokenBlock, Player player){
final String playerName = player.getName();
final Location brokenBlockLocation = brokenBlock.getLocation();
String position = brokenBlockLocation.getBlockX() + " " + brokenBlockLocation.getBlockY() + " " + brokenBlockLocation.getBlockZ();
Bukkit.broadcastMessage(playerName + " broke " + brokenBlock.getType() + " at " + position);
}
}```
i am trying to look send a message in chat when a player breaks a block.
This is the code i wrote so far but it gave me an error when i tried running it on the server.
the ghost items are pretty much all client side so there isnt really much you can do
I dont see it always happening in othet gui plugins
In my cursor
you could try and set the cursor to null
how do i find event function names? like onPlayerJoin() and onBlockBreak()?
normally they are called BlockBreakEvent or PlayerJoinEvent
those are the class names though of the event objects.
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
event.doSomething();
}
that is without registering the listener
so just get rid of 'event' and prefix 'on'?
is that the convention of spigot plugins?
the BlockBreakEvent in the parenthesis should be which event you want
Oh ok!
also make sure to register your events
yep.
How i can place a block with face direction?
Most likely using the BlockFace enum
My ocd when unreadable code 🤬
There’s also rotational
I'd personally just call it at, otherwise I like it! :)
i want to spawn schematic, and than despawn it, did anyone know methods?
Don't you need to use the WorldEdit API for that?
yes
there is no info how to despawn
But what you mean with despawn?
remove all the blocks?
You should keep track of where you placed hte schematic
And remove the blocks
^^^^
remove all blocks
if you already have the schem you could make a copy of it with all air, then just paste that over the old one
im trying
Yes, so just keep track of the 2 corner locations
otherwise you would have to work out a bounding box
What is the part you're strugling with?
i dont even understand how worldedit spawn it
Follow the tutorial
SchematicFormat.getFormat(schematic).load(schematic).paste(session, new Vector(0, 200, 0), false);
i do that thing but how to get corners?
Not too sure, you might have to iterate over all the blocks in the clipboard and fetch the corners yourelf
Okay, so let me ask the all knowing AI lol
// Load the schematic from file
File schematicFile = new File("path/to/schematic.schematic");
Schematic schematic = MCEditSchematicFormat.getFormat(schematicFile).load(schematicFile);
// Paste the schematic at the specified location with the `false` option set
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
WorldEdit.getInstance().getPasteFactory().createPaste(schematic).to(editSession, new Vector(x, y, z)).ignoreAirBlocks(false).paste(false);
so by setting false, it would remove it again the AI say's
not too sure if this is reliable
so I ssume that x y z represents the exact location of where the schematic was pasted
then WE does the rest for you
i already tried, problem is that i use Worldedit 6 version
// Load the schematic from file
File schematicFile = new File("path/to/schematic.schematic");
Schematic schematic = MCEditSchematicFormat.getFormat(schematicFile).load(schematicFile);
// Paste the schematic at the specified location
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
WorldEdit.getInstance().getPasteFactory().createPaste(schematic).to(editSession, new Vector(x, y, z)).ignoreAirBlocks(false).paste(true);
// Remove the schematic from the world
editSession.remove(schematic.getRegion());
Spigot Server Build Failure
Hi, would a kind soul be able to point me in the right direction on where to begin with adding a permission to craft my custom item?
The results that I'm finding are from 2015 or earlier and seem to be outdated. Thanks in advance
check if the player has the permission if(player.hasPermission("your.permission.path"))
and then log the permission in the plugin.yml
permissions:
your.permission.path:
default: op
Apologies, I meant using a permission check upon the crafting of the item
something like if (recipe === custom item) check for permission permission.example then allow or disallow based on permission
I'm currently looking at the event.getRecipe() but I think this is the wrong one
How i can set block face to south or smth else in 1.12.2?
use the Rotatable Interface
what is that
Is it possible to change a mobs behaviour, or perhaps even add custom behaviour to a model/armorstand (such as a custom mob following you around and it attacking specified mobs. Basically a wolf but with more custom behaviour)?
hi
how do i iterate through all 16 colors of wool blocks?
i am trying to make an array of blocks with all 16 colors of wool.
how can i do it?
Ever heard of for loops?
i know that
but how do i generate the array?
instead of manually typing out each color?
anyway to iterate all colors?
Hmm good question. In this case I think it'd be easier to just type it out 🤷♂️
there are only 16
ok.
it might be possible though, but not that I know of
https://www.spigotmc.org/threads/loop-through-all-possible-blocks-in-minecraft.223157/ This might be of help
also
the Material class represents the type of item a block is, right?
like wheat_seeds or diamond swords or grass blocks, right?
if i got that correctly?
ye
What version are you on?
do you have java experience?
Coming back to this, all I want to do (for now) is make a wolf run away when it's low health. I found the function called .setTarget. Would it possible to set the target of the wolf to the player when it's low health, so that it runs away from the enemy?
i am making a small minigame.
This will prolly help you: https://www.youtube.com/watch?v=e55PHe3hiuY
In this episode, I talk about how to spawn a custom mob naturally into your world! It is very simple, just uses an event but you need to make sure you code it correctly or lag may occur. When making the "spawning chance" I recommend making it very low however, this ultimately depends on the mob! I hope you all enjoy this video, many more coming ...
for (Material mat : Tag.WOOL.getValues()) { }
Then this should be available to you, try it please.
or that, didnt even know wool had a tag too
kinda stupid that specific tools dont have a separate tag too
Well, where would you draw the line? There are an infinite amount of tags you can create, based on all kind of needs. I'm already happy that this concise list of Tags is being maintained.
ow codedred
i learned coding spigot from that guy
oof, i already typed them all out lmao
yeah he's one of the best
he's the best* (for me)
agreed
how does spigot run on paper?
Damn, that's sicks. Thanks!
giv incoming
by that i mean, how well does spigot run on paper?
all spigot plugins I tried on paper worked perfectly
ok
I'd still advise you to use my solution, as you thus don't have to maintain this manual list. What if a new version adds a new color block? :)
paper is a fork of spigot so all spigot plugins should work on paper
hm, okay then!
ah floating point division
000000000001
when using a float as divider it only becomes worse: 0.12300000106915832
could also use a double but then i have overflow after around 10 digits behind the comma
Can i see current()?
Damn dude, what java version is that?
17
That loop label got me good, haha
otherwise it breaks the switch and not the loop so cant do anything else
Of course, I just didn't know that was a thing.
Could've just returned result tho
ok thought i'd have overflow but no
what is your theme?
one dark
ew
This seems lile it's easier to just convert to a charsrquence, put a 0. To the start and parse a double
then dont ask it
haha
*asked
Did you compare times between those?
Double.parseDouble is slow
Halcyon is better.
Why does this not work?```
@EventHandler
public void onXPBottleBreak(ExpBottleEvent event){
Block block = event.getHitBlock();
block.breakNaturally();
}``` event.getHitBlock() always returns null (it also didn't work in the tutorial)
and it tests for a bunch of things like NaN which i dont need
i have nothing against it
Null check it?
ye i did, forgot how much slower it is actually
why worldEdit spawn schematics witch are exact same size with the same code in 2 different places?
SchematicFormat.getFormat(schematic).load(schematic).paste(session, new Vector(20, 64, 0), false);
all parser i tested seem to have the same rounding issues
but it won't fix the thing will i
Why would there be two different sizes?
if it doesn't return null everytime
null check is the option
Guess why...
6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 guess why
You need to null check
Has nothing to do with the parser, at all.
fine
i do that code for 2 same sized schematics
ye ik it just sucks
Idk what you're trying to achieve but you always have to null check something that can be null, that's how it works lol
Like this? public void onXPBottleBreak(ExpBottleEvent event){ if(event.getHitBlock() == null) return; Block block = event.getHitBlock(); block.breakNaturally();
So what's the problem
If you spawn two of the same sized structures with the same code and they're the same size
then there is no problem
Optional.ofNullable(event.getHitBlock()).ifPresent(Block::breakNaturally) :)
what the heck is that
the short and weird way
Can you explain what it is?
I got you covered: https://www.youtube.com/watch?v=vKVzRbsMnTQ
Full tutorial on Optionals in Java!
Thanks to FlexiSpot for sponsoring! 🖥️ Get your coupon code for an extra $30 OFF through my link: https://bit.ly/3QPNGko
FlexiSpot Pro Plus Standing Desk E7
https://bit.ly/3xTvGNF (US site)
https://bit.ly/3OEL9aT (CAN site)
Join FlexiSpot Member Day during 29-30th June 2022! Up to $100 OFF! https://bit.ly/3u...
i thought one will replase another, but they spawn like with 3 blocks offset
wraps a nullable thing and executes a consumer when its present lol
right...
Noooo, don't create a new object to abstract the null check away, this is insanity!
oooh
lemme guess that jit will optimize it
static public void spawnFinish(Location loc) {
try {
EditSession session = worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld("world")), 999999);
File schematic = new File("plugins/WorldEdit/schematics/finish.schem");
SchematicFormat.getFormat(schematic).load(schematic).paste(session, new Vector(20, 64, 0), false);
} catch (DataException | IOException | MaxChangedBlocksException e) {
throw new RuntimeException(e);
}
}
static public void despawnFinish() {
try {
EditSession session = worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld("world")), 999999);
File schematic = new File("plugins/WorldEdit/schematics/voidfinish.schem");
SchematicFormat.getFormat(schematic).load(schematic).paste(session, new Vector(20, 64, 0), false);
} catch (DataException | IOException | MaxChangedBlocksException e) {
throw new RuntimeException(e);
}
}
whatever, thre are people who code like that
Who's jit?
bru
Make sure you don't have an offset in the schematic
Schematics save the relative position where you are when creating them
So what should I do?
A normal if statement
relative to what?
To the schematic
You meant by the bytecode runtime? Sorry, but JIT was a bit vague for me.
if (value != null) value.doSomething()
0, 0, 0 in a schematic is one of the corners
well it optimizes the performance of an application by compiling hot java bytecode
hot meaning thats its called often enough or smth
Ah, you mean the "JIT optimizer", so to say. Alrighty. But still, it first has to get hot. Why make it hot, if you can just do != null. I think that's just wrong.
probably 2nd time it runs it will be considered hot
got the same thing for my parser
a simple '1+1' executes in 12000µs without taking jit into account, second time that becomes a magically 30µs or smth
Can I also just return null?
Are we really starting to get into the age of brainless coding because our machines get smarter than the average programmer? Ouch.
Yeah just say if its null return;
You can't return null if the return type is void
I don't know what your code looks like, you could show me the troubling method and I can give you a specific answer.
Just keep that in mind
@EventHandler
public void onXPBottleBreak(ExpBottleEvent event){
if(event.getHitBlock() == null) return ;
Block block = event.getHitBlock();
block.breakNaturally();
}
ok not 12000 but whatever :)
Right, that works out, doesn't it?
Yeah that's fine
k
@EventHandler
public void onXPBottleBreak(ExpBottleEvent event){
Block hitBlock = event.getHitBlock();
if(hitBlock == null) return;
hitBlock.breakNaturally();
}
Change that last block to hitBlock
I did haha, no proof
how do i give items to player on join?
PlayerJoinEvent
What he said
i just save schematic, than do //set 0, than save another one
so i hoped one will clear another
but it spawns with few blocks offset
By subscribing to PlayerJoinEvent and calling player.getInventory().addItem()
alr
Is subscription expensive?
the first time it can be
only 5$ a month
I paid some onlyfans chick and she didn't even pose without bikini. Very dissapointed.
...
What a bitch
Very expensive, you have to go through a whole bunch of bad-code-writers before you can let that packet finally do it's job, because they all subscribed to the event.
why tf would you pay for onlyfans if it's leaked and free
Hello, no matter how hard I try I cannot use craftbukkit dependency. I have run buildtools and it has generated the jars.
I am using maven for my dependencies. Even when i add the craftbukkit dependency manually as a jar with systempath it still doesn't allow me to import anything from craftbukkit.
Does anyone know how to help me?
Don't depend on CraftBukkit
Why would you ever rely on that tho.
Yeah use spigot
it wasn't leaked.
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
Also this ^^
I should have mentioned im using 1.8.8, and I need craftplayer to try and remove arrows stuck inside players
optionals are hella overrated
Well no errors, but it still doesnt fix my issue of it not breaking the blocks
Are you sure you're importing from your local maven repo? Have you got any references to the spigot repo?
True. I never use them
I swear you're using expevent? What you trying to achieve?
break the block which the expbottle hit
Does it work?
...
Why you using expevent then? Or am i tripping
need help importing craftbukkit using maven dependencies 1.8.8 (sending again to create a thread)
Because I want to break the block which the bottle hit when the bottle breaks
?
@dry yacht
how do i get the overworld dimension?
Right, thanks, I'm just all over the place again.
World overworld = getServer().getWorld("overworld");
is this going to work?
whats your world called
if you have a world named overworld yes
"world" probs
Otherwise no
i need the overworld.
Bukkit.getWorlds().get(0)
yes whats it called
0 is always overworld, 1 is nether and 2 is end and all others are custom worlds
the world folder is named "world".
oh ok
then put world in the string args
okay.
@EventHandler
public void onXPBottleBreak(ExpBottleEvent event){
if(event.getHitBlock() == null) return ;
Block block = event.getHitBlock();
block.breakNaturally();
}
no
you don't need .get
the get() method is red.
No
oh ok.
Don't combine the two
Bukkit.getWorlds().get(0), Bukkit.getWorlds() returns a list of all worlds on the server
get(0) gets the first one remember
It just returns null each time
that's the issue
event.getHitBlock()
it just returns null
every single time
put null check after the block variable declaration and check if block == null
testing smth new is always fun
How do you know its returning null did you debug?
Wait, I'll send you a solution in a second
proguard just eliminated my events as unused code and I was wondering why the heck nothing works, damn dude
need a better conf
i would say theres something up with your server jar
been as yesterday using player#damage would crash the server then this
Why the hell can't i paste code into the chat bar without it being ruined... Stupid ass app.
That's legit all you need to accomplish your goal
That won't drop items
He wants natural drop
Oh, didn't read that
Depends on what your goal is with that task
Well, not that hard either once you got the right event
Then onEnable is fine
Ill give it a test
Seems to work. Now I'm just wondering why the previous code didn't work
The event probs
https://paste.md-5.net/icekowuhok.java
Block can be null, added a check, please update the code.
Good question tbh
you just made the code 3x as long by adding a null check?
Personally I think the block is just null so the code isn't running
https://paste.md-5.net/geluvucayo.java
Btw, no need to drop the item manually, I'm not familiar with these APIs.
I've seen you discuses this for a while now but you haven't actually checked if it passes the null check
You're right: logged: ExpBottleEvent.hitBlock=null
Btw, thanks for being that appreciative, :).
Why even have the property then?
Sorry, didn't mean to come over that way. I was just a bit pissed because everyone asked the same question 10 times over. Thanks for helping, I appreciate it a lot 🙂 I'll share the code in the comments of the video (the dude who made the vid also wasnt able to get it working)
It depends on whether you want to drop the block type or the actual material you'd get when mining it which dictates whether breakNaturally or dropItemNaturally is to be preferred. Otherwise, I think the ProjectileHitEvent is the only solution, as the ExpBottleEvent never provides you with an actual target block value.
I can but will they fix bugs from a previous version? Won't they just continue fixing bugs for only the current versions?
ExpBottleEvent extends ProjectileHitEvent
So it would supprise me if the event fired is the same instance passed to different listeners
I asked that often because this chat is way too active and I'm working on a project on the side, so I missed a lot.
Then it's simple fix it yourself or update
Well I wasn't talking about just you lol. But I get it, the chat can get cluttered
Here's your reason
The API's confusing as hell tbh.
So this is intended, don't file anything, btw.
I don't get it
It's always null in the spigot code
When they call the event in CraftBukkit, they use the constructor (ThrownExpBottle, int), which internally calles the super-constructor of the ProjectileLaunchEvent, as every ExpBottleEvent is a ProjectileLaunchEvent, because it inherits from it. But that super constructor invokes a constructor of the ProjectileHitEvent where the block as well as the thrower have null as their default values.
ahh alright
why cant java do defaults args like in kotlin or c++ smh
I think the information should be available, if the NMS MovingObjectPosition represents the position when hitting, which this would kind of suggest.
No idea why you wouldn't call the event with it. Seems like a weird decision to me.
That's not Mojmaps
Who cares about mappings?
It's called HitResult in Mojmaps
So yes that appears to be the information required
Mojmaps are nice tho
I just grep -rni around within the build tools folder, not really thinking much about anything, just want to get my information.
If making a PR was easier I would have fixed that
Doesn't seem like a hard thing to fix
Yes, use the spawn method that takes a consumer
(modify the armor stand in the consumer)
Hi guys , i have created this event but idk how i can give this item OnJoin... https://paste.md-5.net/weyategivo.java
I applied a wither effect to a player but it doesn't damage the player, does someone know why?
ooooooc
What is loc
idk wdym
declaration: package: org.bukkit, interface: RegionAccessor
Object oriented concepts
bros repeating OOC like the guy knows what he's talking about lol
No
I mean the other guy
He's asking what you mean
You're just repeating "OOC" lol
@humble tulip Was it you that I shared my proguard conf for shrinkification with? Because there's an important update, xD.
Nah
oh yeah that kind of hurts to look at
Okay, weird.
Cant seem to remember who it was, hahaha, hopefully they're not using it.
👀 Can I have it
My eyesssss
https://paste.md-5.net/sezejoboyo.coffeescript
The important part is the keep rule for EventHandlers. Drove me insane 10 min ago. I was questioning my sanity, lol.
?
?
Does anyone know why this:
player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 2, 3, true, false, false));
adds the effect but doesn't damage the player?
Wither: "
Deals damage to an entity over time and gives the health to the shooter."
Does the player have the effect? That's a short ass duration tbh
That duration is 2 ticks, not enough to damage the player
oh right thats it
Yep, it's in ticks, so at least a multiple of 20 i'd say, for you to see it
duration is in ticks, not seconds
But usually wither is given to a player by a different entity (or the other way around) so now there's no entity to gain the health taken away from the player
perhaps that can cause problems, but Im not sure
?tas i guess
Install Java 17 at https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot
?jd-bcc
bruh
?jd-bc
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
The bot gets a run for it's money today, huh
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
?paste
I read networking by mistake, close enough.
))
ntm#1234 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
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!
bruh what's this
another one
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
ntm#1234 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
love notworking
which other commands are present
i guess we listed most of them
oh
do ?cc list in #bot-commands
oh
Guys this is not a command spam channel
why
That’s not how it works
jar
im gonna get banned
cant we just make a thread for it
#spigotcraft isn't really the right channel either is it
Dont think the bot works in threads
lets try
no
Yes, but its better than doing it here
spigotcraft is just our shitposting channel
k it doesnt work in trheads
Is there anyway to send a bytebuf as a packet?
lol
yeah thanks
cc list command doesnt work in other channels tho
Its not supposed to work here also afaik
Not sure what you mean. A packet by definition has to travel across the network, so you can only send bytes. It would be best to destruct the ByteBuf into it's real byte[] before sending and reconstructing it at the receiver's endpoint. If you're talking about the client, there's a plugin message packet which offers you a way to transmit raw bytes.
this.getCommand("blockparty").setExecutor(new CommandBlockParty());
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.pulsesapphire.firstplugin.MainClass.getCommand(String)" is null
at me.pulsesapphire.firstplugin.MainClass.onEnable(MainClass.java:19) ~[FirstPlugin-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[paper-1.19.2.jar:git-Paper-307]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:636) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:422) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-307]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
I'll explain in a bit
Command not registered in plugin.yml
Make sure the command is in your plugin.yml
Depends on how your project is setup
its running a paper server.
in your resources folder
Since you don't know where it is I assume you used the Minecraft Development Plugin for Intellij to create your project
server type doesnt mean project setup
Anyone know how to get working placeholders on your own scoreboard? I parse them in game and they work but on my scoreboard they don't?
so this
Show your code
?paste
Do you mean PAPI placeholders on your own, custom written scoreboard? Or is it a public scoreboard plugin?
My own scoreboard
commands:
blockparty:
description: Creates a block party game.
usage: /<command>
permission: FirstPlugin.operator```
is this looking right?
Show your CC class
That's just colour converter
You need to call placeholderAPI to substitute values in, how else would it know about your code.
i am trying to make it so that only a player with /op can run the command
I've never done papi with my own scoreboard so no idea.
All packetplayoutblabla instances have a method that accepts PacketDataSerializer and writes the contents of the packet to a bytebuf.
um
So you have no placeholders?
You have to define the defaultness of the permission
did i get the thing above correct?
ofc it isn't working
Yes I do
I have placeholders...
I'd like to send a packet that i wrote without having to turn it back into a packetplayout
.
you need to use PlaceholderAPI.setPlaceholders
They work in game when i /papi parse me
um, could you elaborate more?
Not in the code you've sent
you just use CC.translate
I have a seperate class for them of course
Anyways use this
PlaceholderAPI won't magically change strings for you
should it be /<command> or do i have to put the command name there?
In ur plugin.yml
permissions:
firstplugin.operator:
default: op
You need to tell it to replace placeholders
oh ok!
basically saying, this permission will be by default inherited to all OP players
Just add papi to your dependency list and call this method. Also, add a depends entry to your plugin.yml
permissions:
firstplugin.operator:
default: op
commands:
blockparty:
description: Creates a block party game.
usage: /<command>
permission: firstplugin.operator```
So you're writing a custom client?
Nah
should the usage be /<command> or /blockparty>?
Just wanted to know if it's possible
<command> just shows the command
Do I do this in papi class where I created the placeholders or in scoreboard class?
okay
You need to replace the placeholders in the string just like you need to replace the colors
kk
What are you trying to achieve then
um
Send a packet but without creating a packet object
i am still getting an error.
You will need an object. You can use reflection to create said object
io.netty Channel#writeAndFlush can write Objects, you'd need to inject the player using my code to gain this type of direct access. But again, you need to modify the client or it'll either crash or drop the packet.
ah right you cant extend records \😢
To a bytebuf
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.pulsesapphire.firstplugin.MainClass.getCommand(String)" is null
at me.pulsesapphire.firstplugin.MainClass.onEnable(MainClass.java:19) ~[FirstPlugin-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:565) ~[paper-1.19.2.jar:git-Paper-307]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:479) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:636) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:422) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-307]
at java.lang.Thread.run(Thread.java:833) ~[?:?]````
And send it
So you're making custom packets?
Please use pastes
Nope regular packets
.
What's the point of rewriting them?
um, what?
?paste
The chunk packet
?paste
You just spammed away my message with your mile long stacktrace, haha :,D.
This is why pastes are preferred.
sorry!
I'd like to send modified chunks to certain players by sending a chunk packet
So use the vanilla one
But using mc to send a chunk packet is slow
does the plugin.yml actually get added to the jar, use 7zip or winrar to check
All good, just wanted you to understand the reason of pastes, rather than to just tell you to use them.
Your chunk packet isn't going to be faster
You will still need to follow the exact same format containing the same information
and the client will process it in the same way
everytime i compile, the contents of plugin.yml seem to get deleted.
How are how changing the plugin.yml
And what plugin.yml are you changing
the one in the resources folder
how does it make sense, immutable data carier ok i understand that
ah yeah that's the wrong one
The target folder is the output from when your plugin is built
yay, the command works!
How are you gonna modify it tho? Intercept real chunk packets and then create your own carbon copy and modify that? This effectively duplicates the memory burden and also takes some time.
Non final makes it non transparent
Fourteen, don’t forget that they’re not only immutable data carrier, but also transparent
Can I use spring boot in a spigot plug-in ?
Yes ofc
To host a rest api
Yes you can do that
wdym by transparant
If you just want a rest api try Javalin
they should make record classes to avoid writing a bunch of fields and getters
meanwhile lombok 😬
Never heard of it, can you link me it?
Not only that
mmmh
Well sort of zacken
which one tho
395
In this case transparency as in that for all terms X of record type T, all fields are known for X
If we suppose T is non final, a subtype S could presumably add additional fields
And that’d remove the transparency
got it, its still annoying tho
So you’re gonna become a lomboker?
i dont dare
🥲
ill see
Lombok is fine tbh
I'm a proud lomboker
probably in the future
Mye, just dont find its usefulness personally
annotations just look brr
I usually use @Data
Ah
i always find it confusing when you find just a few annotations instead of a class' impl
Yeah, sounds like kotlin data classes
I've also used @Delegate
exactly like them
that comes in handy
lombok is the poor mans kotlin
Oo right
is there a way to specify what methods to delegate or does it just delegate everything?
does anyone use intellij on linux and know if i can access other storage devices in the file browser thingy
Kotlin + lombok must be a death sin then
wdym file browser thingie
You give it a class or interface to delegate
this
i cant access the other partition on my ssd or my other hdd
i think lombok will just spass out
since kotlin already does everything lombok does
maybe try pasting it the path in the box above?
I don't use it very often either
Just when I really need it
I usually write my own getters and setters
ye i was thinkign about /dev/sda whatever too
do you ever just open all of your intellij projects at once to have them available to use
I did once but my pc crashed so never doing it again
im most likely never gonna use them all at once or most again
i just like having them there
so incanse i need them
how many projects do you have, damn
It was maybe 10 or less
my pc once crashed when i opened a txt file optic sent me with a few thousand lines and it tried rendering it 🤔
you what
just why
Yeah lol
so i can open them if i need them in the future
why i set this block as vector, but schematica spawned like this?
https://imgur.com/a/ikg0CLf
might need code out of them
bruh just open them when you need them
but that means having to find them
💀
also takes too much effort to upload them all
Lol
It takes like 3 seconds
i could upload the entire folder but meh
you cant be a git noob for that
Well, you are a developer so I assume laziness is prevalent in you
if you ask me to code something thats fun ill do it in an hour
imagine having discipline
everything else i need atleast 4 working days
i got out of my bed at 11am this morning
Nice
games.put(name, new BlockParty(x, y, z, length, width, sender.getServer().getWorld("world")));
public static HashMap<String, BlockParty> games;
whats with the world
why this so true tho
This static variable is null
Or well it points to null
So using any method on it, games.someMethod() results in an exception
You’d have to assign it to some value, probably a HashMap
mfw they only post code but no error
exposing maps hehe
or problem
🤣 so true
I have a question. Why is the player name not displayed in the desired color in the tablist? This is my code
💀
Omg waht the fuck
oh i remember again, my first plugin was an ode to static abuse
mate hasn’t learnt about lists or arrays yet
it’s like so funny in my hs coding classes how they teach stuff like that late
and you end up seeing like 20 variables each numbered
oh we learnt about arrays like 4 weeks ago in college 💀
we learnt the arraylist before
arraylist ye
that’s just too funny
it was so stupid, using lists where a map should be used
mfw arraylist is just an expanding array
Can someone help me?
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!
Error handling was the last part of our school Java course
instead of a list and loop
ah wait he asked first and then asked if someone could help
Have you tried to print some debug messages to for example check what the value of your team string actually is, and if the code even executed?
maybe try creating a method dude
They even taught basic Swing before learning how to read and handle stacktraces
whats spring
honestly I can’t with coding classes, that’s such a problem
how do you teach a library before the actual language
ah in the beginning of the year they showed us some graphical stuff and then said oh we arent gonna tackle that this year 💀
I'm not sure if anyone actually understood how the stacktraces work
a few people of my class cant even properly write a class
and im just bored in class
I'm sure they get plenty of occasions to study them in their natural habitat, lol.
I’ll be going into ap csa next year (Java class)
can’t wait to see how that’s taught 😏
lol
The course is already over
Yeah, but the stacktraces are gonna haunt them at home if they'll ever code again.
A few of us started web dev and they're completely lost with js
It's back to the basics
tbf I can only imagine what Swing stacktraces look like
probably a shit ton of internal methods
dis is disgustin'
correct
https://github.com/EsotericSoftware/reflectasm
Wait, this only works for public members?
That would suck, actually
Well if you're generating actual code you can't bypass that
So normal reflection is required
Here is my code in spigot 1.16.5 :
package best.lahuiss.linkedinventory.listeners;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.scoreboard.Team;
import java.util.Set;
import java.util.UUID;
public class InventoryListener implements Listener {
private void syncInventories(UUID id, Set<OfflinePlayer> targetPlayers) {
Player initPlayer = Bukkit.getPlayer(id);
Inventory inv = initPlayer.getInventory();
for(OfflinePlayer player : targetPlayers){
initPlayer.updateInventory();
//Bukkit.getServer().broadcastMessage(initPlayer.getInventory().getContents().toString());
Player p = (Player) player;
p.getInventory().setContents(initPlayer.getInventory().getContents());
}
}
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e){
Player p = (Player) e.getPlayer();
p.updateInventory();
UUID uuid = p.getUniqueId();
Bukkit.getPlayer(uuid);
Team team = Bukkit.getScoreboardManager().getMainScoreboard().getTeam("bleus");
Set<OfflinePlayer> players = team.getPlayers();
syncInventories(uuid,players);
}
}
It's sensed to be a listener that listens to every change in an inventory and sets the content of the inventory to every people in the team "bleus". But every change is offbeat ; for example, if player 1 gets a diamond block, the inventory of player 2 is empty, then when player 1 gets an emerald block, player 2 gets the diamond block but not the emerald block. How can I fix that ?
why is there so much unused code
my guess is that it’s a cancellable event and it’s dispatched before the inventory object is updated
you can put it into a schedule if u want
just sync inv 1 tick later
First of all, I'd advise a few code changes to you in order to clean the code up and not perform unnecessary actions, but the reason is simple: The pickup event is called before the inventory is actually modified in order for you to have a chance to cancel pickup. Delay the code in the event by one tick (runTask on Scheduler) and your problem should be solved
is paper multithreaded?
negative
is java multithreaded
only chunk generation iirc
is each command run in its own thread, asynchronously?
is it?
AsyncPlayerChat comes in
okay.
forgot about the chat event kekw
There might also be an async player join event
iirc, but I’d not take my word for it
declaration: package: org.bukkit.event.player, class: AsyncPlayerPreLoginEvent
that’s what I meant
Would this change the compass direction with only That Compass?
because the player.setCompassTarget changes it for every compass
i would it only with that one
Packet I/O happens asynchronously, but bukkit often times synchronizes to the main thread in order for you to not have to do so before - for example - manipulating the world. I'm sure commands are parsed asynchronously and then the executor is invoked within the main thread. If you want async commands, you need to listen to the AsyncPlayerChatEvent (or whatever it's called), cancel it and continue to operate out of that async context.
The lodestone property of the CompassMeta of an item only affects that Item, yes.
ok thanks
yes
well, im quite sure this code won't work
cuz modified itemmeta is not set back to an item after that
this
Remember that getItemMeta always returns a new copy, representing the ItemStack's NBT, in essence. Modifying that copy does nothing until applied by calling setItemMeta again.
instance
null
throw
new
Throwable
Exception
Cloneable
Compilation error
MAVEN BUILD ERROR --
Cloneable not of type Throwable
0 tests passed
The hardcore version of that would be to intercept the PacketLoginInStart and just close the pipe without any warning if they're banned, lol.
JREE FAVA LESSONS
Bukkit.getBanlist().addEntry(...)
you can just run 1.19.3 spigot on java 8 to get JNI erorr
Can you invoke JNI manually? Is that like a thing
like this one
wdym
you can call a JNI method of course
but actually, place a handler first in the pipeline and check the type manually using the byte buffer
you just do System.loadLibrary(...) and run an associated native method
interesting, will need to fuck around with that someday
and well, code a .dll on c++ 64bit
to work with this method
i have a guide to hello world somewhere on my telegram java channel
native version
I’ve never used telegram before 😂
no worries, my channel is on russian anyways
ah ic
public class JNIExample {
static {
System.loadLibrary("exampleLib");
}
public native void helloWorld();
}```
```java
public class MainClass {
public static void main(String[] args) {
var jnie = new JNIExample();
jnie.helloWorld();
}
}```
```cpp
// c++: some generated shit after you run javac -h
what kind of exception do you get when you call a native method that isnt implemented?
iirc UnsatisfiedLinkError
ah
Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.
help?
anyone
can anyone say how this fix this multiscreen pls
I dont know most of hidden controls of IntelliJ
@ancient plank
@crimson jasper If you can?
@wild nexus ?
@mossy loom
?
Sorry for the Ping but.
Don't ping random people/staff for development help @fast sedge
Sorry
What a disgusting theme
Yes
Press view and look at the settings
Ok thanks
Hello, I have this error when I try to call a kotlin class from a java file
Could not initialize class me.keano.azurite.coins.EconomyKt
Close every tab in the right
or just close the apps onthe right
I am just new to IntelliJ , Cause I used Eclipse.
Thank you guys and once more sorry to ping you and disturb you!
Ok so this might be a weird question, I wanted to make a quick plugin that would give me data when I input something, just that
Just post and wait for an answer.
So I am totally new and totally understand spoonfeeding is illegal
ok.
is there any help I could get?
It’s not. It’s looked down upon
?spoon is the reason
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.
Not any good news either
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Ah no worries 😅, I am newbie but I am in urgent help atm, I also have exams but I cant let the server I work for down
The multitasking experience
Huh?
The multitasking experience
Whatever
The multitasking experience
?
ok weird to ask, but can I get spoonfed once? I know its unacceptable but I need to get it done asap
Does anyone know how to fix it?
Askl chatgpt https://chat.openai.com/chat
depends on what
Really can be anything
Where is that at
like do you build it properly
etc.
well it is supposed to be a simple minecraft mod where you input a number and get an output number as I can make the parameters to be
Like in the image below, if I enter 450, I want output to be P20 and Degree 45
I built it with maven package command, the kotlin folder is separated from the java folder
mod? this is the wrong place for those
plugins are made with the spigot api
aw man
fabric or forge?
did u tell maven to build kotlin properly?
How?
fabric
Kotlin is configured in the project
idk i use gradle
thanks ❤️
hi guys, can you help me?
?paste
@ocean hollow we need more context than those two lines.
hopefully I will :), thanks
There's no getNearybyEntities on the location object in spigot.
declaration: package: org.bukkit, class: Location
is there a way to tell which version of spigot a plugin was compiled on?
thanks, i made this
now it doesn`t have errors👍
Hmm, well easiest would be to check plugin.yml for api-version
right. not sure why i didnt think that
is there no way to get jre 19 without the jdk?
default jre download is 8
well there probably is, but jre is not being bundled seperately anymore.
there is no reason to download it seperately
why wouldnt there be any reason?
@olive lance Why would there be a reason with the newer java features?
i thought the jdk was only for development, is it required for running compiled code too?
@olive lance The JDK includes a JRE.
yeah, i mean all it is is wasted space if youre not going to use the jdk unless im wrong about that
hi, i have a question: how do you make a loop that starts whenever u open an inventory and stops when u close it?
how do i get a player's skull (heads)?
Using SkullMeta
this is what i got until now
add a variable outside of that that can be set by 2 locations
in that scheduler check if the var is false
if it is cancel it but on the first run set it to true
Use a map uuid bukkit task to track session
Make sure it's emptied on inventory close
how do i do that?
You don't know how to make a hashmap?
no, i mean..
Bukkit schedulers return BukkitTask variables just add them to the map with the p l ayers uuid
Yeah but make it private static final
ok
Also you might beable to store task ids look into that if you can just store the task Id
Can I somehow refer to the collection by index?
Yeah that's how you get things from a collection lol
i dont know how to do the bukkittask part
Bukkit#getScheduler everything In that class returns a BukkitTask
okay
yes
so, it gives error
but like what do i put in here
?learnjava!
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
.
how else do you add things to hash map
Whatever task you want to run
👍🏽
Using 1.8.8 how can I make a player punch/swing their hand.
On newer versions there is a player.swingMainHand() function.
However on older versions I think you have to send an nms packet, how can I do this and what packet do I send?
Thanks in advanced
Packets
You won't recieve good support for legacy versions please update you can mimic the api with plugins
thats what im asking, how do I work out which packet to send?
?1.8