#help-development
1 messages · Page 885 of 1
Refer to this
i used EntityDropItemEvent
no
getDrops methods does not work?
should this do it ? https://paste.md-5.net/axiyuveqol.java
Try it and see. (It should though)
that worked thx for the tip
i was confused i didnt know what i was doing wrong
itemsFile = new File(getDataFolder(), "items.yml");
structureDataFile = new File(getDataFolder(), "structureData.yml");
deathMessagesFile = new File(getDataFolder(), "deathMessages.yml");
Map<File, String> paths = new HashMap<File, String>()
{
{
put(itemsFile, "items");
put(structureDataFile, "structureData");
put(deathMessagesFile, "deathMessages");
}
};
for (Map.Entry<File, String> configFile: paths.entrySet()) {
//System.out.print("Item in Config " + configFile.getValue() + " Exist: " + configFile.getKey().exists());
if (!configFile.getKey().exists()) {
configFile.getKey().getParentFile().mkdirs();
saveResource(configFile.getValue() + ".yml", false);
}
}
items = YamlConfiguration.loadConfiguration(itemsFile);
structureData = YamlConfiguration.loadConfiguration(structureDataFile);
deathMessages = YamlConfiguration.loadConfiguration(deathMessagesFile);
items.save(itemsFile);
deathMessages.save(deathMessagesFile);
structureData.save(structureDataFile);
}```
So anyone got any idea why these arent saving?
I am making a plugin for a friend, he wants it to prevent players from taking an item out of the offhand which he forces to be there. I was able to get it to block every action except the action of swapping the item from your offhand to the current inventory slot you are hovered over. (I want to be able to get the item that is swapped when you press the f (swap) key in a GUI)
I swear I already answered that question in another server over an hour ago
NVM... Im just braindead and forgot to change the path. :L
I must be deluded
No, you're Emily, silly goose
try to modify your method signature to include the throws IOException declaration and wrap the file operations in a try-catch block to catch and log any potential exceptions.
Yea I figured it out. It worked I just forgot to change the path I was trying to find. :L
Something so simple was driving me to insanity
It also does send an exception but it sends it from outside the method when its called
my brain dying
maybe its better to handle exceptions within the method itself or propagate them up the call stack?
Perhaps. But its unlikely they'll return an error. Ill edit it later.
This tho. This infuriates me. They are the same thing
try this exception handling: https://paste.md-5.net/codizilije.js
Its declared as Main.getPlugin(Main.class)
so it should (If java is like every code language I know) BE THE SAME
Okay but what is the type declared as
Man I don't know what to work on D:
And thus it is not the same
If your main is called main you need to declare the variable as such
interesting...
Alright so I've got some basic implementation so far. The goal of this one is to detect when a town is under an active siege, if so then it should change whatever permission that handles explosions in the town to false(to enable explosions in the town). When the siege ends, the permission gets changed back to true. I'm just not sure on how to actually change the permission...
private static void disableExplosions(Location location) {
TownBlock townBlock = TownyAPI.getInstance().getTownBlock(location);
if (townBlock != null) {
townBlock.getPermissions().set("explosion", false);
townBlock.save();
}
}```
This was my initial thought, just a helper method to be called any time a town comes under an active siege... Though I'm not sure if I could just get the town from the active siege and check that way, then instead of a townblock just for each town found to be under an active siege set the flag that way
you don;t want to change the TownBlock permission. Change it on the Town
If you change it on teh TownBlock it can be overridden by the Town
unless it's changed
Yeah I saw that as an issue as well, that was what I was going to do I just have no clue how to get / change the towns permissions
There shoudl be TownBlock, Town and World permissions
This is like day 3 of trying to learn a bit of towny api so
You should be able to get the Town from teh TownBlock, if not there is likely a helper method in the Universe
private static void disableExplosions(Location location) throws NotRegisteredException {
TownBlock townBlock = TownyAPI.getInstance().getTownBlock(location);
if (townBlock == null) return;
if (!townBlock.hasTown()) return;
Town town = townBlock.getTown();
if (town.getPermissions().explosion){
town.setExplosion(false);
}
}
private static void enableExplosions(Location location) throws NotRegisteredException {
TownBlock townBlock = TownyAPI.getInstance().getTownBlock(location);
if (townBlock == null) return;
if (!townBlock.hasTown()) return;
Town town = townBlock.getTown();
if (!town.getPermissions().explosion){
town.setExplosion(true);
}
}```
How do we feel about this?
(forced to throw in order to get the town from the townblock)
Yeah but I'm just trying to get the damn permission functionality written first haha
I just wanted to know if I was going the right way with actually setting these permissions for the town
I blame towny instead, checked exceptions are annoying
It was written in a different era
Oh wait is it rather :
or
town.setExplosion(false);```
Where’s towny 2 then smh
I genuinelly wonder wtf this does
public Pair<ResourceLocation, ResourceLocation> getNoItemIcon() {
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.TEXTURE_EMPTY_SLOTS[enumitemslot.getIndex()]);
}```
setExplosion tru, if you want to enable them (I think)
Wha
guess we will see
you know the little icons in like the enchantment table and stuff
Why is the empty slot texture thing an array
TEXTURE_EMPTY_SLOTS = new ResourceLocation[]{EMPTY_ARMOR_SLOT_BOOTS, EMPTY_ARMOR_SLOT_LEGGINGS, EMPTY_ARMOR_SLOT_CHESTPLATE, EMPTY_ARMOR_SLOT_HELMET};
SLOT_IDS = new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET};
I'm going to push custom menu system to its max I wonder if this could ever work in the Bukkit API lol
private static void disableExplosions(Location location){
TownBlock townBlock = TownyAPI.getInstance().getTownBlock(location);
if (townBlock == null) return;
if (!townBlock.hasTown()) return;
try {
Town town = townBlock.getTown();
if (town.getPermissions().explosion){
town.getPermissions().explosion = false;
town.setExplosion(false);
}
} catch (NotRegisteredException notRegisteredException){
notRegisteredException.printStackTrace();
}
}```
hmm I'm not sure which one to use haha
Well yeah a decent amount of inventory handling is server side
But textures just aren’t :p
These likely do the same thing
You could always open the setExplosion() implementation and check
I am going to try some cursed things!!! We will see if anything works
setExplosion is in teh permissions, so thats where you want to be
I know, it's just late and was hoping for someone who knows towny could just give me the hotfix haha
Ok gotcha
thank you guys
I wrote most of Towny, but it's been many years and other devs worked on it since
Shame we don’t have anyone like that around :p
There is also an Admin override level of permission but you best no tmess with those
I don't think it should be needed, this plugin is just for a siegewar fix i think... something about towny explosions not being enabled when a town is under an active siege
definitely on the Town object then. It overrides TownBlock permissions
Gotcha thats good to know
just remember what the settign was before you change it, so you can change it back after
Well I was going to have two helper methods for that, enable / disable
Just call them accordingly when a town has either just been put under active siege / when the siege ends
What if it’s already enabled
It will be enabled again when war starts, and then disabled after
Towny supports meta on teh TownBlock so you could store it's original setting there
and on Town
But its been far too long ago for me to remember using meta
Could also just pdc the home block chunk
Oh wait you can change towny plot sizes to stuff other than 16x16
It's for a specific server so I was just writing this out for the functionality of their wars, ie: You may siege a town but the town doesnt actually become "actively sieged" until the battle session starts, by default unless a town is actively sieged, its explosions should be disabled.
Therefor there shouldn't ever be a case when a town's explosions are enabled before becoming an active siege zone
Why not make a PR for the SiegeWars project?
Fix the plugin itself rather than hot fix
I have literally 0 experience with github and tbf already am in contact with Llmdl so just kinda lazy
ah ok
I was gonna get it working first before I presented it to them haha
Also I have no clue if siegewar is broken or not could just be conflicts server wise
Are you sure this server doesn;t simply have explosions disabled at teh world level?
Yeah, from the information given to me, it's all pointing to siegewar just not enabling town's explosions
https://github.com/pmdevita/CreeperHeal2
Hmm this one was also something that crossed my mind
I don't remember if it was this one or not, but a plugin along these lines. Something that regenerated blocks after explosions
Hmm that could also be the issue, I know they have something like this installed that is not towny's
This is mine https://github.com/ElgarL/Regen
Alright well thank you for all the help, I have to get some sleep haha it's been a solid 22 hour journey now
I decided to push to 24 hrs haha
@EventHandler
public void onSiegeStart(SiegeWarStartEvent event){
if (event.getTargetTown() == null) return;
if (event.getTownOfSiegeStarter() == null) return;
Town siegedTown = event.getTargetTown();
if (SiegeWarBattleSessionUtil.getFormattedTimeUntilNextBattleSessionStarts().equals(String.valueOf(0))) {
if (event.getTargetTown().getPermissions().explosion) {
siegedTown.setExplosion(false);
}
}
}
hmmm
I'm not sure how to detect when the battle session is currently happening... I think siegewarstart is when a town decides to go to war with another town right?
How do I find out my public IP to whitelist in fail2ban? Running curl -s https://icanhazip.com gives me one result, running dig +short myip.opendns.com resolver1.opendns.com gives another result, going to https://myip.com on windows gives me yet another result
So 3 methods and 3 different results
I'm sshing into the server with Termius if that matters
when i want to create a new project it just stuck in closing project for a long time
how do i fix
Just have it temp ban instead, so this way if you accidentally get clobbered you are good
I myself have like 3 connection points to the internet therefore something like this is typically not an issue for me
if my ip gets clobbered, I can just connect via the other two ways to undo it lmao
Ok that's fair, thx
also you could just look at the open connections under the ssh and port
and you should see your ip
not sure why you didn't bother just looking to see what your server said XD
Fair enough lol
just fyi I learned the hardway like yourself once before
but just like you I didn't really have much on the server so wasn't an issue
I misconfigured the firewall, forget what it was and it just denied all connections XD
normally I have a VM though where I test/setup stuff before applying it to the dedi
but I was being lazy
Yeah it's probably a good decision to test everything
I keep a VM that is exactly setup the same as my production 😛
Well so far my setup has been going fine so I hope it will stay that way
however, the difference though is that with OVH
I can use custom ISO's for rescues
they allow what is called IPMI
its a dedicated connection that is separate from the normal connection
and its for things like modifying bios stuff and uploading ISO's directly to the machine
oh btw, knowing now it was your fail2ban
it wasn't necessary to start over
had we known that
you could have used a socks proxy for the ssh
I am facing this today too
I was working fine yesterday
It was also my firewall
I seemed to have blocked all connections
And tbh it was easier for me to restart. I barely had anything on the server
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!
?paste
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
?xy
there's literally a bot command channel
#bot-commands
im adding vault api and its giving this error. what am i doing wrong?
press the refresh button that's in the right upper corner of the editor
where? i cant find it lol
okay thanks i think it works
And recommend upgrading to 1.7.1 as it fixes a long standing issue with Vault-API transitive providing Bukkit 1.8.
gotcha
ty
guys, how do I change my plugin version? cuz when I put a compiled plugin in a plugin folder an start a server it gives an error
nope
it is 1.16, not 1.16.5 that doesnt exist
The answer is right there
😭
Yeah people don't read
Can I make gradle's starting point a non-class main function?
// scope of a file
fun main(args: Array<String>) {}
All I found was mainClass in application.
hey
note a code related question, so you can see who played on a server by viewing world/playerdata folder right?
files in it
using nbtexplorer or something
arent there usernames in there?
only uuids?
1 sec i'll try my playerdata folder
so i used to played w my friends on the server and now we cant remember which usernames we used to play on it
it's in the bukkit tag so I doubt vanilla stores it 😛
Yeah that's what i said xD
Alex do you have any idea?
You seem to have been invested in gradle lately
gradle's? wdym?
you can only add an etry to MANIFEST.MF for the main-class and it will always have to be named "main"
Well like I run gradle run and I want the starting point to be this file-scope function
Uhhhhh
Sounds crappy
Surely there's a way to start from a non-class main fun
ah for gradle run? No, that also only takes the main method iirc. you can ofc just write a custom task
but why don't you just name the method main
You say it takes the main method
Can I specify where to take that mmethod
There's this:
application {
mainClass = "someclass"
}
The execution will start from the main method in that class
do you want to have a different main class for gradle run and for the "general" one ?
I want to start an execution in a method that's outside of a class
I'm not even sure if I need gradle run and not some other command. That's just what I assumed because of my shallow expertise in gradle
tasks.register<JavaExec>("runAnotherMain") {
main = "com.example.AnotherMainKt"
classpath = sourceSets["main"].runtimeClasspath
}
I just want to compile and subsequently start my rest api
O
Let me try that rq
AnotherMainKt = AnotherMain.kt, doesnt have to be a class but ofc needs a fun main(...) method
oh ok
Probably getView then getTitle
on inventory click event
why do you need the inventory title in the first place
You are creating GUIs and checking their name, arent you
It's an old code, I'm too lazy to create my custom GUI holder
you dont need a custom gui holder
Custom GUI holders are even worse
just store the inventory instance
but I have to check it because I was using 1.8.8 and it was working fine. But now on 1.20 the method to get name doesn't exist anymore
If you are comparing GUIs by titles I can rename a chest in an anvil and then I have your cool GUI where you didn't intend it to be
Afaik there are more pitfalls than just this
Anyways. Get the InventoryView and call getOriginalTitle()
Yeah checking inventories by name or having a custom holder are pretty abysmal. One is unsafe the other can cause lag really fast.
Is checking if a chunk has PDC on LeafDecayEvent gonna cause a log of performance issues?
I'm dockerizing my api that works with a database, should the database and the api be 2 different containers or should (can they?) run in the same one?
Two containers
Another question then, let's say I have two images, one that sets up my api and one that sets up the database, do I start them separately e.g. docker run -p 8080 --name api api and docker run -p 3306 --name db db, or is there some way of managing multiple containers?
Check out docker compose
Will do
will EntitySpawnEvent work for when an item frame is placed by a player?
ah wait I cant get the player who placed the item frame then, what should I do
Wouldn't BlockPlaceEvent be sufficient?
well an item frame isnt a block
You place it though
BlockPlaceEvent
I have an inkling feeling it'll get called but I'm not sure
If you could just try to see if it gets called that'd be awesome
I understand why you believe it won't
Let's find out
^
Ah, bummer
HangingPlaceEvent
thx
Would it be possible to have some sort of localized item displayname and lore? The only thing I can think of is to run some sort of global tick system that adjusts all items in the game (of all inventories and dropped items)
Obviously that tick system would be incredibly inefficient
How would that work?
Minecraft has translatable chat components
I ran docker-compose build --no-cache on a docker-compose.yml with 3 services, but for some reason only 1 docker image is in docker images, is that supposed to happen?
docker-compose.yml: https://paste.md-5.net/uzawakuneg.cs
I assume the Spigot PR for this is still being worked on but you can use NMS or the Paper API
Is it possible to change player nametag (above head) in 1.8 with teams, because I tried it and player's name was always white
To a different color
And text
Well... guess I'll have to wait for it then
How can I open the book signing gui for a player?
I am trying to use Protocollib in my project, but I ran into the problem that if I use api version 5.1.0, then this version does not work in minecraft, and if I use dev version 5.2.0, then I do not know how to get a link to the API
Adding to this: running docker-compose build accdb or docker-compose build backdb does nothing, but docker-compose build api builds and creates an image
It actually errors (?) but the errors are for some reason invalid strings:
time="2024-02-05T19:09:54+05:00" level=warning msg="The \"mC\" variable is not set. Defaulting to a blank string."
time="2024-02-05T19:09:54+05:00" level=warning msg="The \"j\" variable is not set. Defaulting to a blank string."
time="2024-02-05T19:09:54+05:00" level=warning msg="The \"mC\" variable is not set. Defaulting to a blank string."
time="2024-02-05T19:09:54+05:00" level=warning msg="The \"j\" variable is not set. Defaulting to a blank string."
Not an error but a warning*
Either <version>5.1.0</version> or <version>5.2.0-SNAPSHOT</version>
thx i already fix)
Normally, you shouldn't have to change the version for using the API.
I still use 4.7.0
But ProtocolLib isn't working for me on 1.20.4
Well 4.7 doesn't support 1.20 so that makes sense
Apparently these errors were caused by dollar signs in my passwords
bruh
Yeah but kinda makes sense
Sounds exploitable to me
Docker probably was trying to replace them with env variables
But well, I don't think it's exploitable when it's your stuff nobody else will have access to
Exactly
is there any way to open a book?
public class ProtocolLib {
private final ItemLore plugin;
public ProtocolLib (ItemLore plugin){
this.plugin = plugin;
}
public void openBook(Player player){
int slot = player.getInventory().getHeldItemSlot();
ItemStack old = player.getInventory().getItem(slot);
player.getInventory().setItem(slot, createBook());
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
System.out.println(manager);
PacketContainer packet = manager.createPacket(PacketType.Play.Server.OPEN_BOOK);
try {
manager.sendServerPacket(player, packet);
} catch (Exception e){
e.printStackTrace();
}
}
private ItemStack createBook() {
ItemStack book = new ItemStack(Material.WRITABLE_BOOK);
BookMeta meta = (BookMeta) book.getItemMeta();
meta.addPage("Delete and write somethings");
book.setItemMeta(meta);
return book;
}
}
I was trying to do something like this
doesn't the player have a method called #openbook ?
only with written book
Oh you want to use it as an input tool
yep
I know next to nothing about ProtocolLib, so don't ask me.
The book as an interface looks great
Sorry, idk currently.
Btw, you shouldn't call your class "ProtocolLib" if that's the library you are using
kk)
i know, it`s only for test
no, it has to be a written book, the client will ignore it if it isn't
?
Is there no way to simulate clicking on a book?
no
That writeable book UI is client-sided as far as I'm aware :p
You can ask them in chat to open the book. Prevent them doing anything else I guess
Or take the forceful approach steal their items and put a book in their hand then force open ir with the API
Replace their items when they close it or disconnect
Well that's kind of what I mean
Give them really no other option but to open the book
I don't need to receive data from the book in real time, I just need to simulate a click on the book and read the information only after signing
I feel like you're just ignoring what we're saying 
Maybe not native English??
it is not possible
kk
That'd be my only guess
I understand everything, but it seems strange to me
When this stuff happens you cry and say Mojank
🥲
It might be strange but it's just one of those things the server isn't really capable of allowing the client to do. It's a client-sided UI that only sends its contents once it's edited
fun fact you can put other items besides a book in a lectern inventory.
It's weird
Then it gives you that item when you press Take Book
yes the dude is russian
do you need a middleman
I'm actually surprised that that's the case 
Chiseled bookshelves restrict it to books and enchanted books
8 years of doing support and today I've gotten the most encouraging message from a support ticket ever
it's... beautiful 🥲

Fake news that never happens
I take it back, they didn't learn shit
I’m doing a Job-Plugin where you get points for breaking specific blocks, for example as a woodcutter for breaking wood.
What is the best way to check if that block was naturally generated (so one cannot just place and mine the same block over and over to get infinite points)?
My idea:
Make a new MySQL table in which i store every block position of blocks that were placed by a player or dispenser. if a block is moved via piston i change the saved positions. if a block is broken i check if its in the list, if yes you get no points for breaking it and I remove the database entry.
is this the best way of doing it?
Or does anyone have a better idea?
if you simply want to check which block was player-placed, I'd use PDC instead
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
@tribal zephyr but i don't know how to add the try and cath for that event
Sounds good, thanks!
ok i got it
How do I make a player wrapper class and an adapter for paper (for minimessage bundled inside and paper-plugin.yml and more stuff) and spigot and bungeecord in future
but i removed the static and i added the player.sendmessage in event and player sendmessage worked but the gui didn't work
Does it work with pistons?
Like if i write data to a block, and then it’s moved via piston, will it still have the data?
if you call CustomBlockData.registerListeners(yourPlugin), then yes
👍🏼
and didn't get any error !
Make an interface and then have two classes implementing it, one for each platform
?paste
Paste the code
i removed the code wait
Is there a way to use the warden sonic attack ?
and is good method for antibot ?
i don't know how to explain i mean for using antibot
public class Antibotevent implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event){
Player player = event.getPlayer();
Gui gui = new Gui(1,"Antibot");
ItemStack netherrack = new ItemStack(Material.NETHERRACK);
ItemMeta meta = netherrack.getItemMeta();
meta.setDisplayName(ChatColor.RED + "-");
netherrack.setItemMeta(meta);
GuiItem netherInGui = new GuiItem(netherrack , newevent -> {
newevent.setCancelled(true);
player.sendMessage("You Authorized !");
player.closeInventory();
});
gui.getFiller().fillBorder(netherInGui);
gui.setItem(1,netherInGui);
gui.open(player);
}
}
That should work if your code is correct
hmmm I see a fatal flaw in this code 🤔 if you want to sotp bots wouldn't you want to kick them. Bots can click GUIs
💀
also by joining the server they're already intrinsically causing some lag
I was about to say that
no i will upgrade my code if i know is good method
you might wanna add a timeout and hope no one with a dissability joins your server and gets kicked
lmao
granted someone with a disability will click the buttons much slower than someone with a bot so 🤷♂️
in the powerful servers isn't problem if bot join for 2 sec or much sec and player can fast enter because some famous servers in the my country uses this method but without gui and they have +200 players without problem
that's wild your country must have shitty ass bots then
Anti Bot easily bypassable ngl
Is there a way to use the warden sonic attack ?
good point their attackers are noob so isn't problem
I've always been in favor of open source clearly I need to make some contributions
not if over 10000 bots join and start sending packets and do weird stuff
is captha
Google java captcha libs
then use bukkit map api
captcha isn't good because is like gui even maybe gui is better because in the captcha mode will bot join your server for 2 sec
you can actually prevent full joins though
if they fail a captcha time them out for idk 10 or so seconds after x failed attempts
AsyncPlayerPreLoginEvent iirc
yeah but isn't any good method because usually servers have disconnector ( disconnect and player ) or have captcha or bungeecord auth
should beable to kick them before an entity is even created
sorry i see you talked and i talked to he is maybe in my country
Is there a way to use the warden sonic attack ?
declaration: package: org.bukkit.entity, interface: Warden
i saw some servers uses /captcha but i saw they player has fully joined !
Plugins like Jpremium have captcha
you checked ?
nah I am too tired to turn on minecraft
the term you are looking for is limbo
almost every plugin runs their anti-bot checks (including captcha) in a limbo server
yeh
but i saw captcha gui
I think you don't know how Antibot plugins work
the main thing you should focus is to send packets as less as you can
no because i don't know how some servers that i send you they give access fully to join player
and I don't think gui worth the cpu power
wdym by " fully to join player"
we really need more information to help you
firstly, what are you trying to achieve?
sorry for my bad english i mean "Full Join"
i talk about this chat
Captcha is to verify if the player is real
i know this but i told you what is problem
lol
i mean captcha can't protect if the bot send some bad packet in 2 sec with 1000 bot
thats the point
PaperMC left the chat
Most packet exploits have been fixed in Paper
i can't use it sorry they are blocked country xD
and for a while now (on the newest version of minecraft), there isn't much "bad packets"
like spigot fourm is blocked because paypal and very websites blocked :/
where are you from?
iran , check usa sanctions
why can't you use paper?
blocked *
but turkey has defferent , turkey isn't blocked by United states of America and Europe
ah I thought Iran government blocked papermc for a second
wtf
you can run this (or something similar) on your proxy
connect the players to limbo server and do your thing there
I didn't like to talk about politics
can protect ?
Anyone got tips on how to use plugins to create prison cells for a prison server? I've tried a skyblock approach with bentobox, worldguard and luckperms, but doesnt seem to work as the skyblock islands (cells in my case) get generated in different places each time. Therefore its difficult to set permissions for newly generated cells.
I think he is talking about making one for his server
not about using one
i don't want use other plugins because i want learn and training for making a plugin with some api
yeah i am looking for testing for write a new thing !
with new method that anybody don't using if possible
😅
protection plugins should be the last thing you make
or even think to make
yep
yeah one of my friend write it ( sorry i cant share screenshot from his plugin ) and i want rewrite their plugin
and i saw he used gui api
and was good antibot because we tested !
rewrite?
yeah i don't know how to explain for you but yeah "rewrite"!
well, try to understand how antibot plugins function. You can do this by reading the code of how other people do it
Checkout 2LS Antibot on github
or maybe Sonar, its for velocity but can help you understand
it really comes down to his knowledge about minecraft & spigot & bungeecord
i saw this api but i don't know is really blocked packet's or not
Don't worry about packets
yeah i can't work with them i tried to understand them but network developing like packet between client and server in advanced mode is really hard
so can i write without packet ?
and i use vulcan and i saw some times blocked bad packet
i know is anticheat but i saw have plus options for some features
is there a working checkstyle gradle plugin for kotlin?
ktlint probably has a gradle plugin somewhere
Thx
is there a way to get an inventory in the server by nms container id? currently trying to get the inventory a window click packet is manipulating
public class EndSiegeEvent implements Listener {
@EventHandler
public void siegeEndEvent(SiegeEndEvent event){
Town town = event.getSiege().getTown();
if (town.getPermissions().explosion){
town.setExplosion(false);
town.save();
}
}
}```
```java
public class SiegeStartEvent implements Listener {
@EventHandler
public void battleStartSession(BattleSessionStartedEvent event){
for (Town siegedTown : SiegeWarAPI.getActivelySiegedTowns()) {
if (!siegedTown.getPermissions().explosion){
siegedTown.setExplosion(true);
siegedTown.save();
}
}
}
}```
Does this look alright to disable / enable town's explosion permissions on siege start / end?
Only through nms
- Rename your listeners to FooListener instead of FooEvent.
- explosion is a public field. Make it private. (And i would not create fields for permissions, use an Enum and a Map/Set instead)
- I hope
save()doesnt actually save the town to a file or DB (or at least does it async) - The conditional check in your battleStartSession is a bit redundant. I would simply set all towns to true
Btw. Why do you save towns on each change?
Well because I thought I'd have to "update" the permission if you will
Also ehm this isn't a custom permission... this is already written into towny, I just had to grab it / change it
This was just supposed to be a hot fix too... some reason siegewar wasnt automatically letting towns be blown up when they are sieged & battle session is started
Best anticheat?
I would never attempt to make my own, bc i dont understand minecraft mechanics all that well to know how to catch everything
kotlin or gradle
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
how long has that existed
2018
Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT.pom
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT.pom
- https://oss.sonatype.org/content/repositories/snapshots/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://oss.sonatype.org/content/repositories/snapshots/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT.pom
- https://oss.sonatype.org/content/repositories/central/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://oss.sonatype.org/content/repositories/central/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT.pom
- https://maven.enginehub.org/repo/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://maven.enginehub.org/repo/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT.pom
- https://hub.jeff-media.com/nexus/repository/jeff-media-public/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://hub.jeff-media.com/nexus/repository/jeff-media-public/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT.pom
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html``` ye I tried
did I miss something
spigot needs to be built with buildtools
spigot-api = publicly available
spigot = build it yourself
do you really need spigot instead of spigot-api?
uh no
then use spigot-api instead of spigot
Hey guys, I have a quick question, so I have a plugin about clans and I'm trying to add placeholders (papi). (I am a new/young developer and am really new in this). How can I do this? Thank you :)
hi, are you using maven or gradle?
Maven
alrighty, first of all add the dependency to your pom with <scope>provided
https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Hook-into-PlaceholderAPI#import-with-maven
and then: do you want to create a custom placeholder like %yourplugin_something%, or do you want your plugin to be able to parse other plugin's placeholders?
I'd like to create a custom placeholder (%<pluginname>_clan_current%)
what does this mean?
ok then you basically only have to create a class that extends PlaceholderExpansion, and implements the default methods: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/PlaceholderExpansion#with-a-plugin-internal-class
(and then call register() on your instance of your PLaceholderExpansion class)
FinnInvite is the name btw, since I'm making it for someone called "Finn"
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
public class YourPlaceholderExpansion extends PlaceholderExpansion {
private final Plugin plugin;
public YourPlaceholderExpansion(Plugin plugin) {
this.plugin = plugin;
}
@Override
public String getIdentifier() {
return "FinnInvite";
}
@Override
public String getAuthor() {
return "__J3LT3_";
}
@Override
public String getVersion() {
return "1.6";
}
@Override
public boolean canRegister() {
return true;
}
@Override
public boolean persist() {
return true;
}
}```
"FinnInvite" is the pluginname since I'm making it specificly for his server and the owners' name is "Finn"
Any recommendations for a library to include NPCs?
Was looking at this, programmatically to interface with interactions, thoughts?
https://github.com/FancyMcPlugins/FancyNpcs/tree/main
Helloo, I'm currently working on a custom entities plugin. but i want to do a distance check, from the player to each entity. This could possibly be 1000+ entities. I want to really optimize this project, so im figuring out what methods to optimize. I have heard that Vector.distance is relatively slow, what method could i use to save some calculation power?
distanceSquared
thanks! is there any diffrence between the output?
Its squared
Instead of checking distance < 10, you check if distanceSquared < 10*10
pretty sure you can do some bit shifting operatins etc to make distanceSquared even faster
just ask the guys who made.. hmmm. what was it again? Doom or Quake
one of those
I once ran JMH on distance and distanceSquared and it was almost the same tbh
Lol no
But that might depend on CPU
Doubt, square root is definitely an order of magnitude slower
I posted the results here somewhere months ago
Let me try to find them
I remember it was an inverse square root, not square root
https://github.com/mfnalex/Bench-DistanceSquared/tree/main
Benchmark Mode Cnt Score Error Units
DistanceTest.testDistance avgt 25 1645,770 ± 4,010 ns/op
DistanceTest.testDistanceSquared avgt 25 1635,375 ± 11,381 ns/op
ok granted it doesnt use bukkit's distance() method
yeah there's a great video on youtube that explains this inverse square root thingy
In this video we will take an in depth look at the fast inverse square root and see where the mysterious number 0x5f3759df comes from. This algorithm became famous after id Software open sourced the engine for Quake III. On the way we will also learn about floating point numbers and newton's method.
0:00 Introduction
1:23 Why Care?
3:21 The Cod...
that code contains UB :3
hmm interesting, will have to test both methods out and see the actual performance on my server once done.
okayy will do, thanks!
I mean not only is it faster, you're just avoiding a square root operation that you genuinely do not need lol
I have a memory leak problem on my server that creates millions of Location instances and causes a huge memory leak, the only way to detect is to disable the plugins one by one? I mean, if I disable a plugin the data stored in the memory by that plugin will be deleted?
Use the square root if you're display it to a player. Never any other time
depends on the way of disabling the plugins
thanks!
using plugin managers like PlugManX
you could take a heap dump and track it down probs
Just restart your server?
a heapdump does not take 2 hours tho
lol. The ultimate move. Memory leak? Just restart before your server crashes 😎
before that GC goes crazy with 12gb ram and paniks
a lot of lag
What tool is that
Spark
could be anything that reads a .hprof file really
its a plugin
well i didn't got my answer yet
if i disable a plugin using plugman, the data in the memory is gonna be cleared or not
Due to how classloading works - it is impossible for it to get cleared unless you nuke all references beforehand
can't you just create a heapdump and check where those locations come from?
how?
i know how to create a heapdump but i don't know how to check where they came from
create heapdump using spark, jmap or any tool, then just analyze the references, there are lots of apps to do this, especially eclipse memory thing
While I think the classes may get nuked when the classloader gets nuked, I have never tested this hypothesis and thus wasn't able to attest the truthfulness of the statement
Eclipse MAT (https://projects.eclipse.org/projects/tools.mat)
that's not really true. Unless a (still enabled) dependant plugin has kept a huge reference or you've messed with NMS then it'll go away just fine
Does the Vault API work for everyone else? Ive been trying to figure out why when I add the dependencies its not working for me? Please tag reply
Yeah I was a bit unaware that the classloader can get GC'd too
I'm sure the vault api works for thousands of people
what specifically is the issue
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
The pom.xml/build.gradle specifically
90% of all cases it is either one of the two:
- Didn't obtain the economy lazily or didn't register the economy early enough
- Didn't install an economy appropriate
Actually I think It might be all imports with dependencies maybe I have settings wrong
Dependency resolution failure, not runtime error :p
in visualVM for example, you can see a list of all references to a given object
big words
So it works if i add the jar to my file but not if i just use dependencies
code no go zoom 2 your computer
I just read "Vault" and responded with the boilerplate response that applies to most issues that I've encountered on Vault's issue tracker since they are all near identical with each other
You still haven't sent the pom.xml or build.gradle file lol
it works on my machine
oh 1 sec 🙂
Well since noone is scolding you for running 1.15.2 in the year of 2024: WHY???
very nice, thank you
someone asked me today to add support for 1.15.2 to one of my plugins 🥲
after they bought it while it clearly said "1.16+"
That is very much akin to people asking me to support Java 5 in my projects
yeah that message is totally fine. it's supposed to look like that!!
looks great, dont change anything about it.
How do I send stuff as code in here?
?paste
You're just missing the jitpack repo is all
Actually you're missing the Vault API dependency entirely :p
what is that?
IDE-genned code?
<repositories>
<!-- ... -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- ... -->
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
</dependencies>
That's really all you're missing
my favorite class in bukkit is SuspiciousStewMeta
Mine is ChatPaginator because nobody knows it exists
Kind of irrelevant in age of components, but still handy 🙂
Honestly? The conversation API was such a weird add by the Bukkit team
It's one of those things that should have just been a plugin
i find it handy lol
What is conversation api
Api for asking players for text input in chat
Oh
Why is that a bukkit api feature lol
Wack
2 questions about this thing
is it free?
also for sure the servers are running on a dedicated server and i can't download the whole 12GB of heapdump, can i run it on the server too and see this stuff in a webpage or something? (ubuntu)
ughm idk about viewing it in a browser or anything. and yeah VisualVM is free
thanks
could probably use x11 forwarding to run it on the server but view it at home
well wish there is a tutorial for that
there probably is, X11 is decently ancient enough for that
lol, great then
but I have never done it myself - I just happen to know that that is a thing
it should be quite easy
here, I asked chatgpt https://chat.openai.com/share/03789e01-1fe6-4131-bdfa-949dd548170e
well this is the same thing which the ssh applications do right?
like bitvise or termius
i guess i can do this too
I don't know actually - but I'd hazard a guess that that is not the case. Although X11 forwarding is a feature of the SSH protocol (well, SSH by itself can do anything and everything)
Cannot resolve symbol 'milkbowl'
https://gyazo.com/314cdfb4e86b7d8f99169e67246d6e26
https://paste.md-5.net/menahawani.xml
did you click the "reload maven project" button?
Whers this located (im using intellij)
Sometimes, people suggest you to change something in your pom.xml, and then IntelliJ starts to complain: That is totally normal. You simply have to click the “maven reload button” in IntelliJ. Maven will then continue to download the required dependency/plugin, if it’s available. After a few seconds, everything should be fine. You can find the.....
Bruh.. So much time, effort, and energy wasted on such a small fix lol.. Cant be more grateful 🤣 I was not importning classes and having console run commands to other plugins bc I couldnt figure this out ❤️
Thanks to u 2 😜 ❤️
np lol
Context: I am writing a buildsystem in the style of maven (or gradle, I haven't made my mind up yet how the buildscript will look like)
I might have asked this question once before, but what do you think a good system looks like to transfer a collection of files between tasks?
Ideally "virtual" files should be supported, which means that at first glance I should avoid java.io.File and java.nio.file.Path - however is this actually a valid concern considering that you can just register your own filesystem under nio?
The other concern is whether I should use a different model for task inputs and outputs. As of now I use the same "SourceSet" approach, but I feel like that makes little sense - on the other hand I cannot think of anything else. This "SourceSet" approach basically has a bunch of logical file providers that can in turn provide a bunch of logical files. However, I feel as if that approach breaks apart once duplicate files come into play (META-INF/MANIFEST.MF comes to mind here) and allowing for duplicate files to be returned would cause a lot of headache at first glance.
The other concern is whether the task inputs and outputs should be named - I feel like yes but that would make initialization a bit harder.
I suppose I could copy the way gradle deals with this, but I have little experience with that system as I never quite understood it and just sneakingly bypassed it when developing my own tasks. So I am a bit torn on this matter
spigot 1.8 teams don't have a function setColor(ChatColor)
ok
because I can basically do it with command on client side I assume I can send a raw packet to set it
(scoreboard teams opions <team> color <color>)
Good evening, I would like to ensure that when a player dies, it updates a scoreboard with the number of players alive. Problem, I can't set this up, can someone help me? Im coding in 1.8.
finally meeting someone coding in 1.8
best version
Having an issue with creeperheal(2) not detecting explosions by cannons plugin, creeperheal(2) is written in kotlin so I'm not sure how to fix that... would anyone know of a way to go about this issue?
I've been reading through creeperheal2 a bit and it's looking like
@EventHandler(priority = EventPriority.HIGH)
fun onBlockExplodeEvent(event: BlockExplodeEvent) {
// plugin.debugLogger("A block explosion has happened! ${event.block.toString()}")
if (plugin.settings.types.allowExplosionBlock(/*event.block.blockData.material*/)) {
if (event.block.location.world?.let { plugin.settings.worldList.allowWorld(it.name) } == true) {
this.plugin.createNewExplosion(event.blockList())
}
}
}```
this the only thing handling block explode event
https://github.com/pmdevita/CreeperHeal2/blob/master/src/main/kotlin/net/pdevita/creeperheal2/core/ExplosionManager.kt
this is the explosions manager class as well... It sucks I don't know kotlin haha
https://github.com/DerPavlov/Cannons/tree/master/src/main/java/at/pavlov/cannons/event
this would be the event package for cannons, specifically talking about the projectileImpactEvent
I'm thinking the issue could be that cannons is using custom "projectiles" for cannonballs so perhaps that is why creeperheal2 won't detect the explosions? Please ping me if you have any ideas
how to check if a map with name x allready exists without acctually loading it
Like a world?
any public api that serves images of minecraft blocks
so
/api/grass_block would return an image of a grass block
The only one I can really think of is https://mcasset.cloud but I don't think it's really an "api" so to speak
I don't know if you can access its textures programmatically
https://assets.mcasset.cloud/1.20.4/assets/minecraft/textures/block/amethyst_block.png as an example would get you the amethyst block texture, but again, I don't know if you need to be logged in or something
Or how fast it will be. It downloads the textures from Mojang
I would personally opt to download texture assets from Mojang and store them locally to browse instead. This is probably the safest legal way to do it anyways
i did find this however : https://minecraftitemids.com/item/64/respawn_anchor.png
I would still exercise caution pulling textures and assets from a third party website 😅
I believe mcasset.cloud uses some GitHub api
Without being logged in you get 60 requests per something
60 per hour, lol
Guys, I am building a plugin and I wanted that plugin to consume an API(with Post and Get requests) and I made some stuff successfully but it is being really hard to mantain that endpoint calls, I am using okhttp3, I don't know if it is the best way, if you know any best way tell me, but could you please tell me if there is any straight way to do this? I went through a lot of github repos but couldn't find anything.
(I build myself that API)
javalin is decent
Is it good for minecraft plugins? I am asking this because ChatGPT told me that get and post requests in minecraft can be hard to manage due to the way that a minecraft plugin runs.
iirc it runs everything async so it should be fine
Sorry about this but last question, I need to know this, for example, when a user joins I am making a get request to get their roles and permissions, am I able to say someway on the plugin "the user will wait until we get the data" or someway to handle that kind of stuff cuz I dont wanna ruin players experience neither server performance.
does anyone know how to even "enable" an extension in vscode?
I downloaded the json extension and it just doesnt appear in the sidebar
Make blocking calls in AsyncPlayerPreLoginEvent
json extension?
that sounds like the stuff that should probably be stored in a db with just sql queries over doing a rest api call, but if you have to call it from the async pre login event and you should be quick enough
You can block in the pre login event for up to 30 seconds
thank you both that was the answer I needed
thats fun
im going to make them wait 29 seconds then transfer to hypixel
seems like extensions only work in "trusted" windows or sth
can I somehow tell it to allow certain extensions in all windows without having to "trust" it all the time?
whats the purpose of it? If its just make the json file prettier I recommend "prettier"
Vsc should have json support by default
did you restarted the vscode?
Why tf is it not pretified
wdym? as you see, the extension works, but I don't want to have to go to settings and "trust this window" every time I open a random file
file > preferences > settings > security > trust something change to new window
or one of them i think
I don't want it to trust all things automatically, Ijust want to allow this extension for untrusted files/windows
Was this the correct place to ask about this?
no clue then
I dont think vscode allows to do that because of security stuff
I am not 100% sure just making a kinda of a guess
minecraft:textures/atlas/blocks.png:minecraft:textures/custom/m4a1.png```
any ideas?
ugh and the json thing also shows up for every non-json file... is it normal that extensions are taht weird in vscode?
That generally isn't normal
Seems like a shit plugin
hm it was the best rated one in the list
I mean, you have it selected... Plus it says on the top to open a json file
prittier is prob better
Why are you using vscode tho
wtf is this
i can spell that corretly
Use notepad++ or brackets
this is supposed to work
prettier?
yes
I gotta question for texture and data pack nerds.
Is there any NBT that I can use in a Spawner block to give it a custom texture?
if your on 1.19.4 or higher use an inflated item display with custom model data prob
Perhaps...
idk what else to use to just view json files
anyway I got it to work by editing a settings.json manually (wtf)
yes, yes, yes, yes, yes, yes, yes, yes, yes, yes, yes
np++?
but I mean, I read json files in vscode but I dont use any extension but prettier to do so, I just prettify the file and read it manually
windows-only
hm how does one prettify it without extensions?
ah shift+alt+f
yeah I guess that works too, thx
well yeah, i was looking for the default keybind cuz I binded my vscode to the jetbrains keys but glad u got it
why is jitpack saying this?:
Gradle 'publishToMavenLocal' task not found. Please add the 'maven-publish' or 'maven' plugin.
See the documentation and examples: https://docs.jitpack.io```
here's my `build.gradle`: https://pastes.dev/8kUK2VHwUk
jitpack hella annoying
Guys, I need help why is the message being sent like this on my plugin? when I coded this: https://pastebin.com/QTWTb2N8
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I tried to log it and it is correctly formated but I just dont want the "<" neither the ">"
probs this wasnt the best thing to do due to the number of api calls but was the only quick solution to it (accepting suggestions)
you shouldnt need to apply the plugin if its in the plugins section
if anything its because of the afterEvaluate
Yeah I did that cuz it wasn't working
And I also tried it without that and it didnt work 😭😭
is this mutli module
did you remove the block completely, or did you just move the publication part out of afterEvaluate? Why is it inside that anyway?
Cuz I seen a forum of them doing it like that, and I removed it completely
No just 1 module
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
just do it like this
without afterEvaluate
when josh is done I have an error
send it here anyway or make a thread
well it's "java.lang.IllegalArgumentException: The NamespacedKey key cannot be null" and I really just want a clue to help me debug it
try using ```
maven-publish
?paste the full error
you're passing null into the constructor of a NamespacedKey
don't do that
EventOnClickLlamaVariant.java line 53
so what you mean is when I set a value for the key, I'm putting in something that is null?
whats this line
p.getPersistentDataContainer().set(llamavariantkey, PersistentDataType.STRING, variant.toString());
alr, sorry. One sec
show where you define llamavariantkey
public static NamespacedKey llamavariantkey;
llamavariantkey = new NamespacedKey(plugin, "LLAMAVARIANT");
?paste the whole class rq
ok
I need to restore a backup or something, everything is doing it... I'll come back if I can't figure it out
for wat
Build path specifies execution environment JavaSE-1.7. There are no JREs installed in the workspace that are strictly compatible with this environment.
The compiler compliance specified is 1.7 but a JRE 17 is used
what do i do im a noob
give some context
what are you attemping to do?
thats my "problems" when first generating a mavin project in vs code
vs code pog
Vscode with maven seems like a pain
there should be a setting to change jre
It's not bad you should see it with gradle
Can jdk 17 even compile for java 7?
IMHO its better than maven with intellij
No iirc
Or is java 8 the lowest possible?
I think 8 is lowest
Specify <maven.compiler.target> and <maven.compiler.source> in properties of pom.xml and set both to 8
how woudl i draw an image on a map
?paste your current pom.xml file
A png file or sth? Or what do you mean with image?
i dunno
declaration: package: org.bukkit.map, interface: MapCanvas
how would i get a mapcanvas tho
extend MapRenderer
it has a method render(...)
there you get an instance of MapCanvas
then you add the renderer to your map with MapMeta#addRenderer
well what's your goal
i wanna draw an image on a map
and you don't know whether that image is already existing as file or sth?
its stored in a var
what type does it have?
Image img = ...
declaration: package: org.bukkit.map, interface: MapCanvas
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties> ?
You don't create a MapCanvas yourself, you just use the one that gets passed to your MapRenderer instance
change 1.7 to 1.8
in both things
sheeeeeeeeeesh 🌊
you can also set it to 17 if you don't need to support MC 1.17 and older
hi guys
so
i know alot of popular servers have their own minecraft domain the same as their website
but how? my dns collides it cant be the same
anyone know if these two methods in Slot do anything server sided
public boolean isHighlightable() {
return true;
}
public boolean isFake() {
return false;
}```
I can't find any uses in craftbukkit but that doesn't include the entirety of NMS
prob client stuff
Isn't that recipe book stuff?
@kind hatch just made this API hoping to allow fine tuned control of Inventories without any hacks https://paste.md-5.net/ixosiwefuj.java
not for spigot ofc I guarentee this shit would never get merged
Ooo, quick craft, what's that do?
one sec let me open CB
I don't fully understand it, but I decided I should prob expose it anyways
honestly no clue what it does its not used in CB
wish I had raw NMS source somewhere
should prob update Mache
@young knoll since you're around now I figured I'd ping you I committed to actually finishing it this time https://paste.md-5.net/ixosiwefuj.java
@kind hatch stuff like this
public ItemStack quickMoveStack(EntityHuman entityhuman, int i) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = (Slot) this.slots.get(i);
if (slot != null && slot.hasItem()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.copy();
if (i == 2) {
if (!this.moveItemStackTo(itemstack1, 3, 39, true)) {
return ItemStack.EMPTY;
}
slot.onQuickCraft(itemstack1, itemstack);
this.playTradeSound();
} else if (i != 0 && i != 1) {
excerpt from ContainerMerchant
Ngl, still can't tell what that does, even with that context. lol
I think it controls what slot an item goes into when you shift click
Wouldn't that just be the next available one if not already matching an existing item?
that's quickMoveStack
For most inventories yes
You just showed quick move stack
Isn’t that what we are talking about
nah we're talking about onQuickCraft
int var2 = var1.getCount() - var0.getCount();
if (var2 > 0) {
this.onQuickCraft(var1, var2);
}```
this is the default implementation
Ah
than an implementation from ResultSlot
protected void onQuickCraft(ItemStack var0, int var1) {
this.removeCount += var1;
this.checkTakeAchievements(var0);
}
I think when you villager trade it can automatically refill the trade slots with items
So probably that
I think it can be used on any crafting Menu
considering SlotResult inherits and uses it
Probably if I had to guess
Also smh I don’t see quickMoveStack in your api
quickMoveStack is a container API not slot
that was just SlotBehavior
MenuBehavior is next
@young knoll do you think this impl would work with CraftItemStack I'm not exactly sure how these things work still lol
@Override
public void onTake(final Player player, final ItemStack item) {
final CraftItemStack craftStack = CraftItemStack.asCraftMirror(item);
if (behavior.onTake(player.getBukkitEntity(), craftStack)) {
super.onTake(player, CraftItemStack.asNMSCopy(craftStack));
}
}```
Hmm?
okay really?
Yes
@young knoll are you happy now
public interface SceneBehavior {
/**
* Handles quick move behavior. "Quick Move" entails shift clicking items or using num keys
*
* @param context the context of the scene
* @param player the player who executed the quick move
* @param item the item quick moved, which could be air
* @param rawSlot the raw slot number
* @return the moved stack
*/
@NotNull
default QuickMoveResult quickMoveStack(@NotNull final SceneContext context, @NotNull final HumanEntity player, @NotNull final ItemStack item, final int rawSlot) {
return new QuickMoveResult(item, true);
}
/**
* Determines behaviors for certain slots
*
* @return a map of slot behaviors
*/
default Map<Integer, SlotBehavior> getBehaviors() {
return Map.of();
}
/**
* Tracks the result of a QuickMove
*
* @param item the item
* @param delegate whether to delegate to the default chest quick movement
*/
record QuickMoveResult(@NotNull ItemStack item, boolean delegate) {
}
}```
Maybe
guys, how do I compile a plugin at the intelij? I just transferred my project data to my other computer, I downloaded a MC development plugin for intelij, and then opened my project from the folder. So, not it says "the file in the editor is not runnable" .
btw, I can't create a new Minecraft project
maven
Use the maven controls on the right hand side of IntelliJ to compile.
package is what you'll want to use to get the jar file.
thanks!
?paste
@kind hatch behold PineappleCustomScene
https://paste.md-5.net/tizihegudu.java
my most cursed creation
What does DamageCause.CONTACT mean?
OHHHHHH
“Damage caused when an entity contacts a block such as a Cactus, Dripstone (Stalagmite) or Berry Bush.”
Yay javadocs
:I
So I cant find a way to decern the difference between these. Since its a Type I cant really check the origin. So I cant check if Cactus caused it, berry bush, etc
Oh neat. Didnt even know that was a method
Im guessing that also includes magma blocks
Which is weird cuz for some reason they arent counted as contact damage
Yea but it gets called in block damage
And technically they are both block damages so I was just saying it seems pointless to make two types
Damage type has nothing to do with what event is called
It’s based off the internal damage types
Yea I know
Which control the death message among other things
Im saying It seems pointless to have hot floor if contact damage exists since the hot floor is a contact damage in itself
Yes but it’s a different damage type according to Mojang
And has a different death message
So do cactus and berry bushes but their called the same type. Guess its just mojang being weird
I thought they had the same message
Nope, stalactites have their own too
Or stalagmites
And hot floor is pretty much a mix of cactus and stalagmite damage.
¯_(ツ)_/¯
¯_(ツ)_/¯
Don’t think we have the damage PR merged yet
Would that change that?
Maybe?
Oh noice
what is the best way to store custom data for players, like vaults & levels system
ideally a database
Is it a good idea to have a class named Pos to store jusr x y z yaw pitch values instead of location?
just use a Vector
What event would I use for right clicking to activate?
if you want it irrespective of world
PlayerInteractEvent
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
no for like using them on a scoreboard or smth
yes
Save the data as PDC (persistent data container), it will be automatically saved by the server. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/persistence/PersistentDataContainer.html
The you can get the data from it and display on a scoreboard.
Attention: It's server side. It won't work if you have multiple servers -> Then you would need to use a database instead of PDC
declaration: package: org.bukkit.persistence, interface: PersistentDataContainer
ight thanks
How would I get the x/y/z of where the player is looking at?