#help-development
1 messages · Page 208 of 1
hi, can any 1 plz help... im trying to make it so the compass tracks to the location provided... it doesnt work but the location isnt null
?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.
hello does anyone know how to teleport a player to a construction like the stronghold
you are not setting the item meta to the egg item
oh wait nvm
but like
tf is that code
🤣
no that's beyond abuse
I think the issue is that you are trying to use the loadstone tracking feature, yet you are forbidding the compass to use that feature.
If you get the item, does it show that it glows? Like compasses would that actually are pointing to loadstones?
Try setting the #setLoadstoneTracked to true and setting the location to a location of an actual loadstone
easily crackable
i think
Not really
at least he used the lambda
how would I go about decoding the chunk byte[] buffer on the chunk packets, 1.19?
🤔
It's just a fuckin byte[] idk how to decode it
and modify it
PlayerChangedWorldEvent is not firing. Here is full code: https://paste.gg/p/anonymous/5f259b6325b5451daa9b3fd40f1c068c
Ok, how would I do this?
I dont know how to regester a listener.
How would I do this?
Thanks, ill try that.
Hey guys, I need some help to convert this to an actual code instead of using switch cases
@echo basalt hey I feel like we're no longer in touch and that's sad. So I just wanted to hop on and let you know I am still at work by going to the gym, lifting those heavy weights so I can one day yeet you off the cliff like you deserve.
basically I want to make some glasses to spin in order
did you dig this code up from tartarus?
nop
thanks for the inspiration big bro
was there an ancient mummy curse on the sarcophagus that code was in?
I just make this code with the help of copilot
String alphabet = "0123456789abcdefghi";
char[] characters = alphabet.toCharArray();
char[] rotated = new char[characters.length];
for(int index = 0; index < characters.length; index++) {
int newIndex = (index + rotation) % characters.length;
rotated[index] = characters[newIndex];
}
String result = new String(rotated);
and then just add the 4 spaces in the middle
or whatever
how come
you know how you want some code to work in a specific way
player.connect(target, (done, error) -> ...
Error is null, but that message is sent. Printing both server's names both print different values
(BUNGEE)
what I want vs what it returns
don't put the spaces in the alphabet string
Nice mongo db is trolling
{
"_id" : ObjectId("6362d4fce9c1d74824b11e14"),
"uuid" : BinData(3,"hz5tv5G9ev6A0W4V9LH9sQ=="),
"build" : false
}
IllegalArgumentException: Invalid BSON field name uuid
we can just add an "exemption zone" by substringing and adding it back later
oh yea
Really weird LMAO
this just makes me think of people who say that one day AI will write all your code for you and you will just tell it what you want done
Answering to?
wizardly's code
oh k
I just added an if (index == 10) to add my spaces and it worked ^-^
It worked, but now the code is giving me a "org.bukkit.event.EventException: null" error
Oh, how would I avoid this?
I am still in two minds as to whether it is better to pass null or empty
What is a null check? I am very new to java lol
Have you learned basic java before starting to code?
I feel like empty is cleaner but sometimes null just makes more sense because empty might signify some kind of logic
You musnt start coding smth which you havent learnt the lang basics
Ok
Bson not finding database field
How do I create an array of JSON objects in a file?
Example: [ { "property1":"EXAMPLE_TEXT" }, { "property2":"EXAMPLE_TEXT_2" } ]
using GSON ?
Yes.
you litearlly just shove a YourType[] into it
Would this allow me to add the objects in a dynamic way?
With Gson
why would you use the intermediate format xD
you loose like, half the functionality of gson
And then I'm guessing I do the same but in reverse to get the data?
what?
I mean you can easly create json arrays with JsonArray class
half the heavy lifting gson does for you is converting json into java types
I never knew how to use it properly, It's hard to find the right documentation imo
oh right, he can do that
if you have to convert your own java type into the intermediate format of JsonObject and JsonArray
that is just useless work
It's just strings, dates and longs.
Master, you can declare you own java object, then use Gson#toJson() and Gson#fromJson()
I would like to understand what shit is happening with mongo is not finding any property i have declared
👏
I have my own object class already which contains the properties I need but every time I try, it's not putting it in an array properly.
But it just replaces the old one with the new data or when I try to append it, it's still not in an array so it then becomes an invalid JSON file.
?paste
Let start from the begining, paste your object and code for loading/unloading the file
I haven't got anything that unloads it currently.
It's just meant to write to a .json file but I can't get it in an array properly.
sorry for late reply but on enabling you can load each quest from config then add it to the map.
https://paste.md-5.net/uxihotixog.coffeescript (for the code I use to write it)
Any time I try to append it, it adds it but not in an array so it's then invalid.
MyObject obj = gson.fromJson(reader, MyObject.class);
Parsing back what you saved into the object
I'm guessing it's a JsonReader that I need?
You can use java Reader
I just got a Malformed JSON Exception.
I'm just going to clear the current file and see what it does then.
Alright, there we go.
I see all 4 of the properties that my object has.
Helpful for reading the object itself at least.
how do you guys get the server version on 1.17+
i used to do the nms way
and now there's no such thing as net.minecraft.server.1_17_R1.Classname
Bukkit Version or Minecraft Version?
mc
Try Bukkit.getServer().getMinecraftVersion();
hmmm ill look into that
It's a string value.
I've not used it personally but I'd imagine it just returns the version of the game it's on.
What do you need the version for?
?tryandsee
Just shows a video.
i use it for my disguise API
xd
I'd recommend using a switch statement instead of a bunch of else-if statements.
Smooth logo btw
ty
and i considered doing that
im just waiting till i find a better way of doing this
or just use an enum class
Also please try avoiding nested if/if-else
define your own enum values and provide methods to them
it would save a bit of cpu usage
because you will not be dealing with string comparisons
which are O(N) in the worst case
I still can't get the objects go into a single array.
Hi mate, such a long time since last time we seen
yea, i was busy
I remember you used to help me a lot on Skript discord
I recently graduated from school and entered an uni
Myes
well even that isn't really helpful
it's a 1 time initialization on the java app startup anyways
so it doesn't matter as much
im sorry, what was the problem?
i just gave you an advice
Can I detect if player click on GUI (virtual inventory) or on his inventory? event.getInventory().getType() always return chest.
check if player.getInventory() is equal to the bottom inventory of the view
Yeh, in that event Im getting chest as return
im trying to get the version of the Minecraft server just to use X class as a DisguiseProvider
It should return InventoryType.Player
and my old method doesn't work with 1.17 because of obv reasons (nms names removal)
and an enum isn't really the key to solve it
If I click in bottom inv, returns Chest as well
server files are still obfuscated. its just that your ide maps the nms to prefer readability. try searching for nms mappings viewer
i can work with it as it is i need to figure out if the server is 1.17 on startup
smh
in runtime
if (event.getPlayer().getInventory() == event.getView().getBottomInventory()) {}
try this
yuhhh... i would use Object(s?) .equals
i might misnamed some of method names tho
Indeed
arent they the same objects
if (event.getPlayer().getInventory().equals(event.getView().getBottomInventory())) {}
No
"==" doesnt compare memory instance, while "equals" does it
== compares hashcodes of an objects
if the instances are the same it would return true
This works, thanks!
We can use == operators for reference comparison (address comparison) and . equals() method for content comparison. In simple words, == checks if both objects point to the same memory location whereas . equals() evaluates to the comparison of values in the objects.
googled it
i've used C/C++ for the past two months so idk
Na dont worry, for more readbility you can do:
if (!event.getPlayer().getInventory().equals(event.getView().getBottomInventory())) return;
// do actions when menu is botton one
Gson is so weird ngl
I just think, If I will click on bottom inventory, it will return InventoryType.Player but it doesn't.
SnakeYAML is even more weird 😄
but i kinda liked it while i was developing experimental things
"memory instance"?
I still can't get it to put the objects under 1 array.
wait till you see this
size_t j = ((k%3)%2)*((n-1+i*n)%(size+1))+((k%3)/2)*(size-i-1)+(k/3)*((i*n)%size+i/n);
this nasty hack allows me to rotate array matrix by 90-360 degrees
without if statements 😄
you specify k [0-4] and it will output you the transformed index for specified i index
How would I make a for loop that gets each items in the players inventory, and checks for the lore "Anomaly" and deletes the items that do not have the lore "Anomaly"
Here is my current code
Check if the items in the player's inventory have the lore tag and if they don't then delete the item.
Could you give me an example of what that would look like? Still very new to java
for (ItemStack item : player.getInventory()) {
ItemMeta meta = item.getItemMeta();
for (String line : meta.getLore()) {
if (line.contains("Anomaly")) {
item.setAmount(0);
}
}
}
maybe smth like this
i've almost forgot spigot api
Thank you, ill try this code
ok
it would delete anomaly itemstacks
I haven't really used item lore yet but it should be as easy as doing something like:java if(!lore.get(0).equals("ºxºBº2º0º0ºEºDAnomaly")) { item.setAmount(0); }
Yea, I am using a multiline lore
True.
anyone know nms raytrace fields without mappings lol
Why though...
tryna get collider collisionoption
for (ItemStack item : player.getInventory()) {
ItemMeta meta = item.getItemMeta();
boolean flag = false;
for (String line : meta.getLore()) {
if (line.contains("Anomaly")) {
flag = true;
break;
}
}
if (!flag) item.setAmount(0);
}
try this
and fluidhandler
Ok, thank you so much!
Why without mappings though?
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.
Check Screamingsandals
i did it only once for the past 3-4 months
Surely the mappings would be easier
They're pretty easy to set up.
i've never actually used them
i learnt a whole section of mojang unmapped 💀
my code was looking something like
getHandle.b.a().c.d
tbh i've got so used to obf nms, that it was hard for me to adopt since 1.16
have spigot api implemented custom biome api yet?
Not that I'm aware of
Here is my old spigot mapping dependency from my pom.xml
You can make a PR
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<classifier>remapped-mojang</classifier>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
You need more than that
https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/#post-4184317 for more information though.
There are great tutorials for setting it up.
man i wish to be embedded developer
what do i need
i love fighting with computational limits
Here is the tutorial video I used to learn how to set up the mappings: https://www.youtube.com/watch?v=5AVezxCH-oM
In this video, I introduce you to the topic of NMS, which stands for net.minecraft.server and is the vanilla server code for Minecraft. We start from the ground up by introducing the source code of CraftBukkit, Bukkit, NMS, Spigot, and the Spigot API. Using these things and understanding how they work will allow you to start diving into using NM...
The special source plugin for maven. Read the release post for your version for the full information
Make sure you set them up so it's remapped on compilation since you can't legally distribute the Mojang Mappings.
I prefer the mojang mappings personally.
does any of you know what's the order of arithmetic modulo operator?
% one
answered myself
it has the same place of order as division or multiply operations
Hello, how do I change a player to op as soon as the plugin starts?
lol
how do i get the player part heres my code
it depends what kind of player do you want to make as an operator
a spisific username
specific*
yea i forgot spigot api since i havent wrote anything for it since may
no you're good, my mistake
What to create /commandspy?
lol
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.
that's like asking what to do in order to create google search engine
research
why couldnt you
commandspy like plugins are being abused like keyloggers to steal credential data from the players in plain text
that's why they do not advise to use that event
that's not the problem, some people purposefully set up fake servers and invite people to join and (especially on cracked servers) to register, knowing 99% that the inputted authme password is the same as in any real server
or even worse they try to access people sensitive data such as emails if the same pass is used, since player chat input is not encrypted (well it is kinda since 1.19, but server afaik still can see it in plain text)
How i can put that terminal on the footer?
I have clicked on smth and now i can move the terminal everywhere
I mean i want to pin the console
ive done that before and now trying to remember how to put it back lol
i typed int to open intellij and opened internet explorer smh
Buenos dias
if i want to check if superclass is a superclass or the same class as subclass, and both of those are Class objects, what should I do?
maybe object.getClass().getSuperClass() == SuperClass.class for the first check?
Returns the Class representing the superclass of the entity (class, interface, primitive type or void)
java.lang.Class javadoc
i think i've found it, superclass.isAssignableFrom(subclass)
You can only speak engkish
Okay, sorry
Na its fine
I speak spanish tho
hahaha
I tell because i dont care helping in spanish but it should be via dms
Ahhh ok hahaha
Spigot rules 🤡
Did you were looking for help?
What are the reasons of mongo, not saving a document?
Sorry
Yes, via dm?
What does the add line look like?
Is it only default ItemStacks being added to the list?
Idk what you're trying to do but if you're looking to count all the nether sprouts just keep a hashmap of material and amounts
And loop through your itemstack list
:chad_emote:
How can I edit an entity before a spawn entity packet is generated?
World.spawnentity sends out a packet
And that’s before I edit the entity
?paste
no i just needed the link
Oh
Well if anyone knows, lemme know
I’ve thought about maybe using NMS
But god that shit is frustrating
I already use it to make the packets themselves
It’s fucking horrifying
Like digging my fists into my own eyeballs
@restive mango You're just trying to edit an entity before spawning it right?
Yeah, I’m trying to grab its persistentdatscontainer and add a value to it
I have a packet listener which catches outgoing packets and checks if the entity has this persistent value, and if so, deletes the outgoing packet and then sends my own version of that packet
https://paste.md-5.net/zajukeqini.cpp
https://imgur.com/a/GaEpqOj
I have no clue why this is happening. The scores #1 None, #2 None, #3 None arent showing
I asked a spigot mod earlier and he didnt know why either
In this case, the outgoing packet has the entity replaced with the entity ID from the persistentdatscontainer
@sonic goblet
.
PersistentDataContainer container = zombie.getPersistentDataContainer();
zombie.setRemoveWhenFarAway(false);
zombie.setCustomNameVisible(true);
zombie.setAI(true);
zombie.setCustomName(name + mI.colorize(" &r&7/ &4 ❤" + Math.round(hp)));```
Sadly on creation a packet is sent BEFORE I do the editing to its persistentdatscontainer
Thanks man
Oh wait
This spawns the entity though
That’s the problem
Oh I see what you're trying to do now
Yeh
Hmmmm
My hacky solution right now is to just send an additional packet whenever an entity spawns but like that’s gross and ugly
I want something pure
Anyway let me know if you have an idea @sonic goblet
Someone else mentioned something about a ‘consumer version of the create event’ but I have no idea what that means
I believe they were referring to this
you can always use PacketSerializerAdapter object or something like that
in that case you dont need any NMS object to modify packet data before sending it
Its a class part of NMS that lets you send raw packet data and construct the packets without instanceiating fake nms classes. You just construct the packet with that constructor which accepts that class
I did this before to bypass the strict NMS encapsulation of some fields
its very similiar to ProtocolLibs way of manipulating packet data
^^ (I mentioned the wrong dude previously, lol)
you just use https://wiki.vg/ protocol documentation to construct the packets properly and abracadabra your packets are ready to be sent
Im using citizens api, they werent able to help much in the citizens support. I've created a trait and I assign it my npc. How do I pass a string to the trait when its assigned so I can use it in its trait functions.
he mentioned me because im great
Anyway to make players not take any knockback when a shield they are holding is active? (1.18.2)
Good morning, I'm new to a question, how do I add permissions to a command in my plugin?
how can you do line breaks in spigot without sending tons of separate blank messages?
\n\n\n\n\n\n doesnt work :sadness:
does the TextComponent API have anything for this?
edit: im gonna test escaping the \
brb
ok didnt work
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
You can't
The best way is
Arrays.stream(message.split("\n")).forEach(player::sendMessage);
i actually just worked out a way
put characters that mc renders as invisible on each line. spigot compacts lines that dont have content from what i can see. e.g putting \n&e on each line with translated colour codes means it works fine
but without content on each line it just compacts it
Hey- I'm looking for an event that is called when a water source block forms. I've played around with the method described here: https://www.spigotmc.org/threads/detecting-water-source-forming.292697/#post-2812999
However, it is three years old, and the BlockFromToEvent event does not fire for the created source when another source is placed in flowing water.
It's possible that I could make it work with this event if I played around with it for a while, but it would most likely require lots of relative block checks; and that would start to get intensive for a pretty common event.
These also do not fire:
BlockFormEventBlockSpreadEvent
I need to avoid scheduler tasks if possible. Is there a method for detecting this that I could not find, or should I create a PR?
I've not looked since you didn't send me your structure
I camt send it rn, but whats with the error
No memeory
Or
Too much to handle for the server
what error?
*crash
no clue
Well maybe it was too much for the server to handle?
Why can't we load the chunk with the changes already made
you can
How then?
but not until you can successfully copy/paste a structure
Well cant we just paste one at 16 16 16 to test it?
Or do we have to paste it every 16 blocks
you haven't managed to copy/paste one yet
Ok ill send it to you later today
The nbt file
It works for me
Huh same code as me?
near enough
Try it with bigger nbt files
Whats the difference?
I did delay the paste by 20 ticks
How do you do dat
runTaskLater instead of runTask
Ok will this help with perfoemanfe?
Performance
Is that the only difference??
Dude I'm confused so what exactly are you trying to do
interesting, no need to set blocks to air for the worldgen
So what are we doing again pls get me up to speed
just testing at teh moment. trying to find the optimal way to paste
There is an optimal way to paste if you apply the rules of 3d arrays
It is not optimal for an array to be perfectly even
When dealing with more then 1 dimensions
Well pasting manually might be the way to go. The optimal way to paste would be to arrange the array at the y value since in terms of pasting commonly there isn't as many y values as there will be x or z
We were looking to use teh Structure API in Bukkit, but it seems slow
Structure#place(loc, false, StructureRotation.NONE, Mirror.NONE, 0, 1, new Random());
Doesn't surprise me as typically vanilla stuff is exposed and left unchanged until a reason to change it
I wonder if using the pallete in worldgen would be faster
I was thinking the same lll
So the code for pasting structures most likely has a bunch of unnecessary calls it makes
I am also intending for different random rotations in the structures as well
How would I make the array?
NMS is the only practical way to create custom worlds now It's sad that Spigot deprecated/removed ChunkGenerator#generateBlockSections..
Deprecated does not mean unusable
Doesn't it mean like super buggy
No
Last time I tried overriding #generateBlockSections caused UnsupportedOperationException
(because I didn't override #generateChunkData
so it seems like java public void onServerStart(PluginDisableEvent event) { ... } is firing twice, same thing with start?
I am at work currently so can't help with that right now
I think you have at lesat 2 plugins installed?
The event is fired for every plugin
like 2 files or i registered it 2 times or...?
But your plugin might not receive every PluginDisableEvent because after the plugin is disabled your plugin can't receive PluginDisableEvent anymore
2 jar files
only 1 jar file
Anyway you should check the plugin
public void onServerStop(PluginDisableEvent e) {
if(e.getPlugin() != this) return;
..
}
This makes sure the actual code is only processed once
im still confused how an instance besides the only class I have the disable event called in would be passed to the event
but ill try it
@eternal oxide can we just stick with what we have
I'm planning alot more than this 1 world generator
not really. it is too laggy to generate
O ok
Well, how do other world generators run so smoothly
Like iris world gen
flying around in creative, just placing this one Structure in every chunk causes Moved too quickly errors
odd as its only a 16 x 7 x 16 Structure
A way to reset a map After a minigame?
Set world#setAutoSave(false) and unload the world using
Bukkit.unloadWorld(world, false) after teleporting all players to lobby
And load the game map once again
its firing 0 times now
I think "this" does not extend JavaPlugin
Make sure you pass your plugin main object instead of "this"
I have this error
https://streamable.com/ulp3u2
The error that comes up in the console, translated into English is as follows: Unable to access the file. Another process blocked part of the file.
public ServerEvents(SaltyBot plugin, TextChannel relayChannel) {
Bukkit.getPluginManager().registerEvents(this, plugin);
this.relayChannel = relayChannel;
}```
should I use plugin instead?
public void onServerStop(PluginDisableEvent e) {
if(e.getPlugin() != plugin) return;
..
}
Cant we use the 3d array like he said?
ok
possibly as that is basically what the Palette is for
it a List of BlockState mapped to the BlockVector
I recommend you should attach debugger/profiler to a running Spigot server. That way you can see which part of your code is slow and improve performance with that information
So spark
Etc
a profiler would do no good as teh "Slow" part is in Bukkit
I just need to work out which order teh BlockList is in the Palette to use it
works, now i need to figure out why java public void onPlayerQuit(PlayerQuitEvent event) { ... } seemingly isn't firing
because you forgot to add @EventHandler
ty
?stash
What does the 3d array even do
K so what does the array even do
its just a List of BlockStates
every Block in the Structure
However, decoding the order of the List is more work than I really want to do in a project I'm not writing myself.
Yeah Structures have Terrible performance when placing
The only efficient way would be to use it's Palette in the generateSurface method of the ChunkGenerator. However thats somethign that needs time to pull apart as you need to know the order of the BlockStates in the List
Does it store X then Y then Z or some other order
Know that and its easy to use the data
Slow part is most likely mojang code and not bukkit
yes it is, Bukkit only wraps the Mojang code
I did look at that but without knowing the order I can;t be bothered to experiment
oh a Pr
Nothing to Pr really
There is to make it efficient
The Palette is usable IF you know the order of X/Y/Z
you can place it directly in teh surface gen
but I can;t be bothered to experiment and find what the order of it is in the List
Well typically mojang stores by y first. Not if that matters fo palette
so Y,X,Z
Yep
Yeah, it's not hard if thats the case. Just multiply by the BlockVector and pull the relevant BlockState#getBlockData()
something like (example) (y * (xSize * zSize)) + (z * xSize) + x
to calculate the index
again depends on teh order of storage
Thats incorrect if Y is first, just an example of the math.
How can load the world after unloading it?
Simply use WorldCreator
Hello I was setting large blocks with Block#setBlockState(); but it lags a
how do you set block(blockstate, type, etc) with 1.19.2 nms? I couldn't find anything realated to 1.19.2.
How many blocks are you setting?
// 1.19.2
@Override
public void setBlockSuperFast(Block b, Material material, byte data, boolean applyLightUpdate) {
WorldServer nmsWorld = ((CraftWorld) b.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
IBlockData ibd = CraftMagicNumbers.getBlock(material).m();
ChunkProviderServer chunkProvider = nmsWorld.k();
//modify blocks
nmsChunk.a(bp, ibd, false);
//update lights
if (applyLightUpdate) {
LightEngine engine = chunkProvider.a();
engine.a(bp);
}
// send to client?
chunkProvider.a(bp);
}
Hey 😄 I'm trying to develop on Intellij, and started a new project using the Minecraft extension and selected maven 1.19. The compilation works fine but the problem is that I don't get any import error/suggestion.
For example when I write Location location = player.getLocation(); , I don't get any error (only during compilation, not in IDE) and when I hover it with my mouse, there is no import suggestion
So I have to manually import everything, and this is quite annoying
I also imported spigot.jar in the project dependencies but it doesn't do anything... Any idea ?
Yes, there is the same as in https://www.spigotmc.org/wiki/creating-a-plugin-with-maven-using-intellij-idea/
<repositories> and <dependencies> sections
alright. in your project structure should be a map named "external resources" i believe. is spigot in there?
Yes sir !
But something weird is that my java files are marked 'Java outside of source root'
ok.
right-click ur "java" folder. almost at the bottom should be a menu named something like "mark directory as", you want to select "sources root"

Uh
My main file is full or errors
Oh
It can't resolve JavaPlugin
Spigot looks like is not imported
if that is still the case can you send ur pom.xml?
your resources is also not marked as resource root. how did you create your maven project. it should do all these things automatically for you
I used the Minecraft Development extension
my man added the bootstrap jar as a dependency 💀
just run a clean install
if it works, it's IDE cache
mvn clean install or mvn package
Uh
I just find out what was wrong
It was the spigot jar
I just manually runned the build tool
And i works
Thanks guys !
make sure to mark your recources folder as resource root
Yep I just did it 😄
Guys, Can I set the displayname of armor stand from placeholderAPI?
you want it to display the viewing player's name or something?
I want to showing ranking of island like this %SRank_1% %SName_1% SLevel_1%
You usually gotta pass any player to parse papi text
yeah I was check it
as well... the placeholders apply to the player
You can just get any random one or do some hacky shit to display the player's own values by modifying outbound packets
So I think I should use for-loop
You can set the entity name to anything
entity.setCustomName(PlaceholderAPI.setPlaceholders("%player_name%", player)); type deal
I don't remember the actual method
And for setting a sub title for player name?
I mean I want to change the player name and add another lines under it
Mainly how does nametagedit
Ok so ive been asking for help for abt 2 days now and alot of ppl did help but theres still 1 issue, im trying to increase pvp dmg by 15% but it doesnt seem to be working
?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.
Im trying to monitor InventoryAction.COLLECT_TO_CURSOR. This should sync gui with specific player inventory. But, If I do this (code), its remove form first slot witch contains that item. Is there way how to monitor slot of GUI where is item removed? Probably I will save the previous content in inventory and check with updated one? Or can I do it other way?
//TODO
player.sendMessage(ChatColor.RED + "Need to be done...");
ItemStack item = new ItemStack(Material.AIR);
if (event.getCursor() == null) {
item = new ItemStack(event.getCurrentItem());
}
else {
item = new ItemStack(event.getCursor());
}
item.setAmount( item.getMaxStackSize() - event.getCursor().getAmount() );
Thief.thiefs.get(player).getInventory().removeItem(item);
}```
Ye, this will only return clicked slot, but change is on more then oneSlot
that's just a marker armorstand following the player around
Doesnt lang the sever that tho?
you can make it entirely packet based
no u
Spigot api is looking line paper shity
a title system?
Idk what had happened
with infinite lines?
Are the same?
what are you trying to do anyway
can you give an example
I'm making a plugin to thief players. I don't want to display the entire looted player's inventory. So I need the items that the player sees to be the same in the clone and in the player's inventory.
On InventoryAction.COLLECT_TO_CURSOR, multiple inventory slots are affected. event.getSlot returns only the clicked slot. That is, I need to find out which slots have been changed.
I think there wil be some othre way. But looks like is not 😄 Problem is, onClickEvent return the inventory before click. So I need send that inventory somewhere or something. Thanks
If I click in inventory, onClickEvent event.getInventory will return inventory before the click. So I if click on slot 1 and it will contains 64 stone, it will return 64 stone on slot 1. But, after click the slot is empty and I have it in cursor slot.
inventory has getContents() which returns an itemstack array of the entire inventory
Thanks, but couldn't find a way to get byte from blockdata in 1.19.2
I have BlockData and it requires Block b, Material material(Can be solved with BlockData#getMaterial()), byte data(This is problem), boolean applyLightUpdate
Ye, but the old one before click. Never mind, Im gona try something.i wanted to avoid inventory storage and just simply monitor inventory actions. Store inventory seams to be easier.
why avoid it xd
just clean up. afterwards
use this instead
declaration: package: org.bukkit.block, interface: BlockState
how do i check if every value in string[] is an integer?
materialdata has byte you need
Wouldn't it be better to clean them when closing the inv?
just be forewarned that MaterialData is deprecated so no guarantees that it will exist in the future but for the time being it should work for your usage
declaration: package: org.bukkit.material, class: MaterialData
what the answer
yes
Gona try, thansk for now.
well thanks too but I couldn't find way to change BlockData to BlockState
get the blockstate of the block
i wanted to find out if there was a way to not do it by looping through all of the strings
But to do that, you have to create a block, set block data, and when you create a block and set block data, it's like it's already placed.
no
you cant look at all the values
without looping lmao
why woulndt u wanna loop there?
love it when one line of code fucks up my whole database
love to see it
(Of course, but i dont wanna confuse you, if you just do getBlockState on the block without changing the blockData of the block at the location of the block you want to place, the data of the previous block will come out, not the data of the block you want to change.)
@quaint mantle in most cases you can just input (byte) 0
actually it looks like the byte is not even being used in the 1.19 version
Hello, I have a problem and i can't resolve it on google. I managed to set permissions to player but it is still in red in the tab when the player types the command but the command works
Someone can help me please ?
how do i stop a constructor if the values are invalid?
Throw an exception I guess
String[] xyzS = twoXYZ.split(";");
for (String s : xyzS) {
if (!isInteger(s)) throw ;
}``` i have this
if the string isnt the right format
what exception would that be>
IllegalArgumentException i guess
thank
Frandma
I was rly dumb...
public void onInventoryClick (InventoryClickEvent event) {
if (!(Thief.thiefedInvs.containsValue(event.getInventory()))) return;
if (event.getClickedInventory() == null) return;
if ( !(event.getClickedInventory().getType().equals(InventoryType.CHEST)) ) return;
if (event.getAction().equals(InventoryAction.NOTHING)) return;
Player player = (Player) event.getWhoClicked();
new BukkitRunnable() {
public void run() {
updateInventory(player, event.getInventory());
}
}.runTaskLater(Main.getPlugin(Main.class), 1);
}
public void updateInventory (Player player, Inventory inv) {
Inventory thiefPinv = Thief.thiefs.get(player).getInventory();
for(int i = 0; i < 36; i++) {
thiefPinv.setItem(i, inv.getItem(i));
}
}```
Bum done 😄 How simple 😄
Location is serializable.
getConfig().set("Location", event.getLocation());
Location location = getConfig().getLocation(''Location");
not everyone likes the way spigot serializes. and also not everyone uses bukkit config api
Location adds a bunch of unnecessary shit tbh I'd just serialize the minimum necessary
I mena just dont reivent the wjerl
its not reinventing the wheel at all. spigot serialization is just garbage imo
So x y and z minimum in a easy x,y,z format
I would just serialize location as World name, x, y, z
also to "deserialize" a location and create the location object. its world must be loaded
which would be a pain in alot of cases
I mean location is fine if you need rotations and all
Otherwise I'd rather just store a vector
just fyi, java objects/classes are serializable themselves as long as they implement serializable 😉
in other words you can store a java object itself if you really wanted to and just pull the object back out
yes, data version
basically an attempt at making sure that your data from like, 1.8 is still loadable on 1.19
iirc spigot runs the item through the data converter at some point
haha conversion layer go brr
I remember seeing the world conversion code somewhere nested into NMS
they converted between every patch 💀
every snapshot had world conversion
Well... every snapshot that changed anything
you mean DFU ?
I mean there is https://github.com/PaperMC/DataConverter
I presume that is what you are talking about 😅
yeah might've been that
for some reason, when this code runs in my PlayerInteractEvent, the game crashes java ItemStack skullStack = event.getItem().clone(); event.getPlayer().getInventory().remove(event.getItem()); event.getPlayer().getInventory().setHelmet(skullStack); event.getPlayer().getWorld().playSound(event.getPlayer(), Sound.ITEM_ARMOR_EQUIP_GENERIC, 1, 1);
it crashes with Encountered an unexpected exception java.lang.AssertionError: TRAP
does anyone know why this would happen?
full error?
oh nvm
I found it
its something to do with removing the last item in a stack while the event is still running
I found some random github issue for some thing explaining it
I'm gonna try it now
still lookin horrible
You probably want to create second table called locations and make some column in homes like locationid foreign key into locations table
Yap, cuz location is different entity
And it's some kind of pratcice
But however are you comfortable tbh
kinda weird nobody in highschool or college has ever told me how to create a good table 🤔
thats what they call education then
Hi im having a problem with this code when i type and probably result is empty
Code: https://sourceb.in/AUflyDEPhH
Error:
Caused by: java.lang.NullPointerException
at it.zerotwo.luna.Manager.Moderation.AIType.AnalyzeChat(AIType.java:34) ~[?:?] // float is the line
at it.zerotwo.luna.Listener.Chat.onChat(Chat.java:28) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_282]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_282]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_282]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_282]
is the float result
uh one of those things is null?
how do I set an armor stand to not equip armor if you right click it with armor?
because currently you can right click it to swap a leather helmet for example with the player skull I put on it
that's what I was thinking
probably but how i should check it if it is null
just do a nullcheck on those things?
yes but it is a float by doing == null is not possible
Yeah, because float can't be null
so should I add a persistent data container to my armor stand and check for it in the interactevent, and if it's there cancel the event?
is this the line: float result = Luna.pAPI.analyze(text).getAttributeScore(AttributeType.TOXICITY).getSummaryScore().getValue();
yes
one of those chained things is null
probably getValue()?
i dunno
Get value is probably only one that can't be null
and how i should check it if it is null?
As fourteenbrush said, one of those chained things is null
This is why you should multiline a statement. The stacktrace should tell you your error
Agree
float result = Luna
.pAPI
.analyze(text)
.getAttributeScore(AttributeType.TOXICITY)
.getSummaryScore()
.getValue();

ah perspective API. What a masterpiece
i thought i was looking at an itembuilder for a sec
I thought it was for getting a custom attribute from a player
Does anyone know how I can sort the players in the Tablist by ranks (using LuckPerms)
what would one call a class that serializes/deserializes an object 
context resolver huh
idk sounded fancy
Lool
depends on what kind it is
it would be a class that deserializes / serializes my player wrapper class and it would be versioned. so i can still deserialize older versions and update them
VersionedPlayerWrapperTypeAdapter 🤡
just call it postliminary
Hi question how i can make an external "library" for comunicate to my plugin and create an API
i believe we should all make a essentials 2.0 or smth together lol
Hey guys, how do I remove this space? The code is here https://github.com/WizardlyBump17/bingo (index.html, css/global.css, css/index.css)
You can see your issue with inspect element
I dont think thats the problem because I have the same issue with another project
The issue here is you're not respecting your margins
can you explain please
1s let me make a video because I'm too lazy to type
yw. Use inspect element more.
I used but I didn't realise that
actually, I didn't even know what the colors meant
The colors each represent specific formatting types.
I don't know them either but I get the gist of it
Hi, does anyone know how to change the skin of the head of a player, the one you see next to the player name on tab?
Learn first the lang
I would recommend first learning about java works or Kotlin depending which you select to code
I did some work in it
Then learn any dependency manager like Maven or Gradke
but the minecraft part is a bit differ
Done
And finally learn how to use the spigot api
I learned Maven
I am using the paper one for plugins
A guy told me paper is faster for localhosts
.
Oh paper 🤢
You cant...
Patient
nvm actually you can
If you want to perdist your message create a Thread
using a custom command
Money
?
Let talk back we were
Ok
So you al read learned java and maven right?
I would recommend reading spigot tutorial about Basic things line plugin.yml, commands, events, event listening
I learned plugin.yml, commands is left
and others things are left
Ok
Mhm
I also learnt from a udeny tutorial
Alr I'll try /fly, /nick and little commands on it
Can you give link?
I'm away from my desktop atm so I'm on my Macbook trying to do some Spigot patches but ./applyPatches.sh seems to have some issues on macOS for me? It's giving me this, anyone seen it before? Jamess-MacBook-Air:craftbukkit james$ ./applyPatches.sh ../../Documents/BuildTools/work/decompile-latest find: -printf: unknown primary or operator
Happens in both a zsh and bash shell
For none coding plugin questions ask it on #help-server
uhh no it's not a server question, it's a Spigot development question
No no, I'm making some commits to CraftBukkit
Hmn no idea sorry
For git just run:
git add . - For adding files into the local repo
git commit -m "message here" - Making a commit
git push - For uploading commits into remote repo
It's okay, it's not to do with that
@worldly ingot have you ever tried applying CB patches under macOS? I had to change the script to use gfind instead of find and then it worked
Also take care we give support to paper
Never tag staff
Please read the rules first
Bro relax, I'm leaving him a message to see when he logs on.
im pretty sure tagging staff for that is reasonable
I mean depends for what
Not for asking for coding support
I dont know why this society is really anxious and doesnt like waiting patientlly
Hello, maybe someone can help me here:
I need the ItemStack from the destination of the InventoryMoveEvent.
How do I get this?
I'm trying to get started with plugin development following:
https://www.spigotmc.org/wiki/creating-a-plugin-with-maven-using-intellij-idea/
but everything directly copy pasted from papermcs official page is immediately throwing errors
https://papermc.io/using-the-api#maven
"http://maven.apache.org/POM/4.0.0":mailingLists, "http://maven.apache.org/POM/4.0.0":developers, "http://maven.apache.org/POM/4.0.0":contributors, "http://maven.apache.org/POM/4.0.0":licenses, "http://maven.apache.org/POM/4.0.0":scm, "http://maven.apache.org/POM/4.0.0":organization, "http://maven.apache.org/POM/4.0.0":profiles, "http://maven.apache.org/POM/4.0.0":modules, "http://maven.apache.org/POM/4.0.0":pluginRepositories, "http://maven.apache.org/POM/4.0.0":reports, "http://maven.apache.org/POM/4.0.0":reporting,
"http://maven.apache.org/POM/4.0.0":dependencyManagement, "http://maven.apache.org/POM/4.0.0":distributionManagement}' is expected.```
?paste your pom
'isCancelled()' is deprecated. so how can I check if event is cancelled?
so when I went to update my 1.18.2 plugin to 1.19.2, I'm not entirely sure what I did, but the org.bukkit library doesn't seem to exist anymore if im reading the errors right, anyone know if i can just download it somewhere and import it or if theres a proper maven section to add so it can be found?
Hey guys im pretty new to spigot coding and i wanna get some practice, but im out of ideas. Would be cool if u tell me some ideas for plugins or general practices that i could do 🙂
what version?
1.19.2
Use maven don't add the jar manually
a spawn plugin?
depends just tell me some ideas
ok, what dependency am i putting into pom.xml?
Make a plugin that does something cool
an interactevent?
1.19.2 spigot and the spigot repo use good for this it's super easy to find
ok
can you explain pls?
Al event have this. but isCancelled() is deprecated
there should be a reason for it
look at its jdoc
there may be tips on what to do instead of the isCancelled() method?
umm, got it
so I should just check useInteractedBlock() != null as I am working with block. right?
not sure what the workaround is but isCancelled() is set by other plugins so a null check wont do you too well
hot
copilot weird
Hey everyone, I'm trying to use the api of CoreProtect for rollback, but it doesn't really work. This is my code. I made a minigame. The variable Time is the number of seconds ago to rollback to. From lookup.size() I get 0
Bukkit.getLogger().info("Time is " + time);
List<String> playerNames = new ArrayList<>();
for(Player player : playerList){
playerNames.add(player.getName());
Bukkit.getLogger().info(player.getName());
}
List<String[]> lookup = coreProtect.performRollback(time, playerNames, null, null, null, null, 0, null);
if (lookup == null){
Bukkit.getLogger().info("Lookup is null");
}
Bukkit.getLogger().info("blocks: " + String.valueOf(lookup.size()));```
Can anyone help me?
If you're doing a minigame wouldn't saving the state yourself and "rolling back" by just loading the data you've saved be more efficient than using a 3rd party library?
does anyone know why acf doesnt recognize the kPlayer as a context resolver, do i need to annotate it or smth?
seemed to work for other commands but it decided to fuck up 🥲
oh well its called a command context actually
Yea maybe, but im beginner, so it is simple to use an api
All my arenas are in the same world
Yes, but using core protect is not the way to do it
Oke, thanks
ok final thing
man I just wasted 3 hours being gaslit by my past self
I need to stop being so specific with my method calls
I almost always use super when calling methods from something I extend, trolled myself because now something that gets extended below under that class wasn't able to adequately override method calls
what API you using?
if i make a bukkitrunnable in a constructor, will it be stopped when the object is deleted?
no
cum momento
what a terrible day to be literate
uh
if an object isnt stored anywhere
then
it is not there yes?
garbage colector
if it's not referenced then it's flagged for removal
The runnable is it's own object, it's reference is held by the Scheduler
whether it truly is there or not is hard to guess
ok so
i have arena object yes
it contains seconds
and every seconds
wait
scratch\
public class Arena {
private String name;
private Cube cube;
private Material material;
private int seconds;
public Arena(String name, Cube cube, Material material, int seconds) {
this.name = name;
this.cube = cube;
this.material = material;
this.seconds = seconds;
ArenaManager.addArena(this);
}
public String getName() {
return name;
}
public Cube getCube() {
return cube;
}
public Material getMaterial() {
return material;
}
public int getSeconds() {
return seconds;
}
}```
this
every seconds
you should bottle it up and sell it
haha
fnny joke
the cube\
which is x1, x2....
gets filled with material
how do i do that
thanks
every seconds ^
a runnable
but can runnables contain time so that I can sell it to our amazon overlords?
I want my seconds back
haha
too bad, I stole them and I ain't giving them back
How many arenas will you have at a time?
use a single runnable that iterates over your arenas and does whatever is required
what if different sekunde
each arena will be different
put new arena in a Map, runnable iterates over teh map every second and does whatever that arena needs
yo guys 1 question: how to check if an arg is equals any mob?
a Set, Map List.
im kinda getting stuck right here oof
explain in spoon feeding terms
an arg is a String, how are you wanting to compare that to a Mob?
i mean a mobtype or mobname sry
MobType.valueof(arg) or something close
exactly
you probably have to try catch
EntityType
to parse it
spoonfeed
mommy