#help-development
1 messages · Page 321 of 1
is there still no such thing? ugh
nice, works
i couldnt find anything
yeah do that pls
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
ill read that later
no. for bukkit, you just clone the repo, add your changes, and commit them
well you also gotta fork it so you can commit/push
Why they added that shit to spigot api? its really annoying to having those annotations because IJ get more stupid as it is cuz of that
1st: Epic was talking about the enchantment names, not the annotations
2nd: the annotations are extremely useful
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
[11:16:45 ERROR]: [SQLite] File write error: table_name.db
[11:16:45 ERROR]: [SQLite] SQLite exception on initialize
java.sql.SQLException: path to 'plugins\SQLite\table_name.db': 'C:\Users\USER\Desktop\Mc Server\1.12.2 2\plugins\SQLite' does not exist
Why are they so useful? I don't see it that way, they just cause me problems and crappy warnings, when it tells me that it may be null and I don't want to check if it is null or not. For example when you do a Config#getString()
So what are you doing so far
ill probably just like add a method fromKnownName or getKnownName or something
Url is down in my country cuz of cloudflare problems
yikes
So please use paste md5, to sent your code and ful stracktrace
?pastebin
?paste
create the directory first
just statically import Objects#requireNonNull if you can't be bothered to handle configuration mistakes by the user
just use saveDefaultConfig
yeah but "knownName" is maybe a bit confusing
maybe fromIngameName or sth
because internally minecraft also uses the weird names iirc
That its really oddy cuz i add more shit to my code tho
ah
It might be more helpful to return the translation key
[12:00:45 ERROR]: [SQLite] Unable to retreive connection
java.sql.SQLException: Values not bound to statement
send the full stacktrace please
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
wha
Not wondering to be rude, but have you learnt basics about JAVA?
im not sus at all
u literally are
can ii see who gave me a like?
uh, yes?
Its weird, because when you learnt java first things you must learn is how to read stracktrace
i'm wondering how can i modify the permissiondefault of one command's permission (the command is directly registered via CommandMap not plugins.yml)
is it enough to use Bukkit#addPermission or what?
You can getCommand() and modifiy the command settings
ikr but Command class does not contain the permissiondefault
CommandMap#getCommand() will return a PluginCommand, and then you can do PluginCommand#setPermission()
That is a fast research over the docs, they are really useful i should recommend using them haha
just get the permission from the plugin manager?
String permissionName = getCommand("myCommand").getPermission();
if(permissionName != null) {
Permission existingPermission = Bukkit.getPluginManager().getPermission(permissionName);
if (existingPermission != null) {
existingPermission = new Permission(permissionName);
getServer().getPluginManager().addPermission(existingPermission);
}
existingPermission.setDefault(PermissionDefault.TRUE);
}
@tender shard im just looking at bukkit source before i download it and the enchants are correctly named on their new EnchantmentWrapper it looks like a case of just getting this name
hm is there a way to get it from a plugin without reflection or sth?
So how does one remove just a set boss bar that naturally occurs? cause this end dragon bugger is sitll being persistantly ... persistant
no idea lol
cool thanks
that modifies the string permission not the Permission class
Also as the chap is really busy and has given me full reign to edit the code as and when, there is a portals plugin i use where it just utterly refuses to not cancel end gate normal functions
I need to modify permissiondefault
i.e. if the main portal doesnt work, it uses the end gate block
Wasnt what you where trying to do? Maybe i didnt udnerstand what were wondering
btw this should work
if i yeeted the listeners in hre could someone help and have a gander?
okay so it looks like the namespaced key to represent the enchant is the actual correct enchantment name, as seen in game. Its just the values on the enum which are wack
Im trying to add a PermissionDefault for the command
PluginCommand#setPermission() isnt for that? 🤔
nope that modifies the permission name not the permission default
So this is the awkward bugger, what is happening is: I have portals set up to function when a player walks into blocks that are end gateways but, if the portal doesnt work due to some base requirement not being met, the endgateway works as normal which is utterly against design
What i sent allow you to modify the command permission... 🤣
That modifies the freaking command's permission name not PermissionDefault can't you understand?
weird lmao - so the namespaced key is actually "efficiency" instead of "DIG_SPEED"?
it looks like it
oh yeah indeed. how weird is that
proooobably, it used to be "DIG_SPEED" in vanilla / nms code, but got changed when 1.13 turned everything into resourcelocations
for this the wrapper looks like
that means you can indeed name your methods fromVanillaName or sth
No sorry, you are not explaning the context of PermissionDefault, cuz setPermission() is used to set the command default permission
oh ok
for most of the stuff
I thought was ur code
nah lol
spigot 1.19 is not shit. spigot 1.8 is shit
well spigot 1.8 is shit compared to 1.19. when it came out, it wasnt shit
oh alex how do i actually get bukkit onto my ij, do i just download it or is there a better way
- fork the repo on stash
- clone it (File -> new Project -> from VCS)
- done
what would the url on this part be?
ahh
be sure to use the URL of your cloned repo, not the original one
otherwise yuo cannot push
yeah lol
yeah right sorry if i was rude too
am i correct in saying i make a new branch for the stuff i pr
i dont think it matters if you forked it, but you can do so just in case
its harder to make one later than to remove one
you don't have to
i always just commited to master on my fork, then create a pull request for that
okay so im guessing i would add this as an abstract method to Enchantment.java and add it as a method in EnchantmentWrapper
i dont trust myselft to not fuck it up
Where is on the spigot Netty side which listen to this query https://github.com/SpigotMC/BungeeCord/blob/master/query/src/main/java/net/md_5/bungee/query/ ?
or would i just add it somewhere here
why an abstract method? couldnt you just do
public abstract class Enchantment implements Keyed {
...
public String fromVanillaName(String vanillaName) {
return getByKey(NamespacedKey.minecraft(vanillaName.toLowerCase());
}
or similar
i was just looking at this lol
id just make an enum for vanilla names
How does the docs appear on code, if they are remove when you compile it
thats the javadocs, this is a fork of bukkit
by letting maven download the -sources and/or -javadoc .jar
or yeah, by using the actual source code lol
whats the warning?
show the code
its the enchantment wrapper stuff
what
the code that was already there?
cast the new block state to rotatable / directional / whatever it is
yeah
dafuck? the hell is it getting the name from then
That are IJ docs because of the color, normal javadocs are all whites and burns your eyes
@EventHandler
public void onPlace(org.bukkit.event.block.BlockPlaceEvent event) {
if(event.getBlockPlaced().getState() instanceof Directional directional) {
System.out.println("Block " + event.getBlockPlaced().getType() + " is facing " + directional.getFacing());
}
}
Signs are Rotatable, while e.g. logs are Directional
rotatable is IIRC 16 directions (NORTH, NORTH_EAST ...), while Directional is SOUTH, WEST, NORTH, EAST, UP, DOWN
no. Well, you could manually check the logic by checking either which blockface was clicked, or which direction the player is looking at
IIRC e.g. logs check the direction you look at, while hoppers only care about the clicked face
not sure though, this might have changed
im gonna test this before i actually decide to compile bukkit
because it would probably end up in me compiling it a lot
if i remember correctly
I would have recommended MockBukkit, if it wouldn't have gone to shit in the last year
lol
it's full of bugs, requires paper api, and other problems
you basically even need paper-api as scope test to use it
that means you couldnt even test your own bukkit-api fork with that
MockBukkit 1.X still uses spigot but yeah the latest version for that is 1.16 IIRC
mockbukkit seemed really confusing when i looked at it efore
before
and i just never attempted to use it
it's actually quite easy to use, but as said - it now requires paper, and also has some bugs sometimes regarding the maven resolver thingy
why would they even do that
however for only bukkit api, you could probably just use surefire + junit without any mockbukkit stuff
if you only need to check the enchantment stuff
i have no idea what either of those are
surefire is what actually runs your tests
junit provides the annotations needed, e.g. @Before and @Test etc
you can check JeffLib to see how it works
or MorePDCTypes https://github.com/JEFF-Media-GbR/MorePersistentDataTypes/tree/master/src/test/java/com/jeff_media/morepersistentdatatypes
im guessing im not allow to supress deprecation warnints
been as i might need to use the .getName method if
if that actually returns the mc name
can't you use getKey().getKey() ?
Enchantment.DIG_SPEED.getKey().getKey() should return "efficiency"
@remote swallow I always use MockBukkit-v.1.18 version 1.24.1, that one still works with regular spigot-api so you could test your own stuff
i just use the server i have on ur vps lol
but then you need to compile a spigot server.jar
i keep saying vps when its not a vps
well the ptero is a VPS
im just testing rn
i think ptero isnt having a good day
console seems blurry
lmao the ptero is just idling since I kicked cazcez off the server
lmao
wdym
It's most likely you
hm the screenshot also looks a tiny bit blurry to me
?
it looks blurry on my 3 monitors, it looks blurry on that so
its probably blurry
ive seen and said blurry too much
it doesnt seem like a real work
[17:46:50 INFO]: [BukkitTestPlugin] Enabling BukkitTestPlugin v1.0.0
[17:46:50 INFO]: [BukkitTestPlugin] [STDOUT] Enchantment[minecraft:efficiency, DIG_SPEED]
[17:46:50 INFO]: [BukkitTestPlugin] [STDOUT] efficiency
``` it looks like it works
because i dont npe
and it has the dig_speed of it
I'll restart the VM ok?
might take a while, it waits until all servers are shutdown
thats fine
ill just start adding this to bukkit
how do i actually test this lol
ok it's back up
i just thought about it
does it still look blurry?
i think it does
its hard to tell
because its what ive seen for the past 10 minutes lo
weird idk lol
it's funny how the ptero uses 1300 threads, but the proxmox host only has 300 threads running
lol
kvm is like magic
also would i be correct sying i need @Contract("null -> null") and @Nullable on my 2 methods
i remember, when I was in 7th grade, my IT teacher was like "in the future, everything will run in virtual machines and in the cloud. People will have virtual machines to visit shady websites or to run their services"
and he was sooo right
that was in 2007 or so
damn
now he's the principle of a school in another city
lmfao
he still owes me a pizza
This issue is legit getting critical now and its driving me nuts
less than 24 hours before relaunch and its rpetty much the last hurdle
wwhats the issue with it
The system as designed:
-walk through area designated as custom portal
-Get tp'd to desti if you interact with trigger block
-If requirements not meet or other issue, not sent anywhere
-Nothing happens
What happens
-walk through area designated as custom portal
-Get tp'd to desti if you interact with trigger block
-If requirements not meet or other issue, if trigger block is an end gateway block.... vanilla tps you as if gateway block was active
Hello I've tried a lot of different way to get the messages receive by a player with protocollib packet listener
but I did not succeed
protocolManager.addPacketListener(new PacketAdapter(ConversationPlugin.getInst(), PacketType.Play.Server.CHAT) {
@Override
public void onPacketSending(PacketEvent e) {
System.out.println("Packet " + e.getPacketType().toString());
System.out.println(e.getPacket().getChatComponents().getValues().toString());
}
});
When I send a player message in chat the listener is triggered but I can't get the message
.... [19:28:41 INFO]: [Conversation] Packet CHAT[class=ClientboundPlayerChatPacket, id=49]
.... [19:28:41 INFO]: [Conversation] []
and with plugin message the listener is not triggered but there is no other chat PacketType
.... [19:28:46 INFO]: SuperMax_8 issued server command: /broadcast fqdsfdsljnh
to clarify, plugin message listener is not triggered unless you receive a plugin messaging packet
Totally diff things
i think they want to get chat messages players are receiving, not plugin messages
yeah that why i say it, i figure that
I want to get all the message in chat of a player
Question, if I want to make something that would automatically send mined items to a specific chest in a chunk
Do I need to have a list of chests in a player chunk, check for updates and then send the item?
there is more than one packet the server can send to send a message in the chat?
I'd listen to ChunkLoadEvent, get a ChunkSnapshot, then search it for chests in an async task, then keep that in memory, e.g. with a Map<ChunkCoordinates, List<Location>>
but instead of a nested map, I'd create a new class like "ChunkChestMap" or sth
What if a chest is added after the chunk was loaded?
async update every few seconds?
then also listen to BLockPlace and BlockBreak event
nah
however
instead of getting the chunksnapshot on chunkload...
just save the chest locations in the chunk's PDC
well it's easy
one second
this allows you to save a List<Location> on the chunk
so just listen to blockpalce and blockbreakevent, and then save a List<Location> of all chests in the chunk
If I save the location of the chests
e.g. namespacedkey "chest-locations"
Can I get a chest object from the location?
or COntainer if you also wanna allow barrels etc
Nope it's my custom chest
kk
Which actually turned out sick
how did you make it invisible?
with hideEntity or with setVisible?
does the invisible armorstand have a custom name that's shown`? because if so, I'm 100% sure that you can detect right clicks.
Yes you can detect clicking, listening to EntityInteractEvent or smth called similar
try whether it works with a custom name and setCustomNameVisible true
if that does work, you probably HAVE to have a custom name, maybe you could use "&c" as custom name so that there is a name, but nothing that's visible
you could also try whether PlayerArmorStandManipulateEvent works
I use this to check whether a hologram was right clicked, not sure whether it works for invisible armorstands without a name, but you could try
note it's PlayerInteractAtEntityEvent
but apparently that only works if the invisible armorstand has a custom name
why the heck do I have a random empty c++ file in angelchest lmao
why do you
no you tell me
probably I created it by accident
Is there anyway for you to run a command and see if their hunger is full?
So like a feed command if the users hunger is already full then it sends a message
Yes
You need to parse CommandSender into a Player object and then you can read the docs about Player object to see the methods you can use
okay
wdym "to run a command"?
you wanna code a /feed command?
Yes i think he want to code the feed command
just cast the sender to player, then check if they are hugnry, then set the food level
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
sender.sendMessage("This command can only be run by a player");
return true;
}
Player player = (Player) sender;
if(player.getFoodLevel() < 20) {
player.setFoodLevel(20);
player.sendMessage("You've been fed a tasty filet mignon with sauce bernaise.'");
} else {
player.sendMessage("You are not hungry you fool");
}
return true;
}
I feel so dumb now of course you have to specify the health sorry
and thanks
i was just using 20 instead of < 20
np
I’d like to search all inventories on a server for an item, anyone know how to do that?
Well that seems like a task
You can listen to chunkloadevent and look for all chests etc. and search them that way.
Or you can simply listen to inventoryopenevent / hopper event and check items there.
anyone know off hand which server version added javax.inject
I need your hand again with maven, but now having the trouble to replace things but with multi-module project
I have the next arch:
Command:
--> Core (depends: nothing)
--> Spigot (depends: Core)
--> Bungee (depends: Core)
--> Example (depends: Spigot)
When im compiling all the project via "mvn clean package", the example plugin,yml doesnt replace the properties with the ones taken from example module pom
@tender shard
To make a chunk pdc like you said do I need to do the same thing I did with the Chest pdc?
Make a object, serializable, etc
I’d like to have a way to scan all inventories, however
Is tht not possible?
I just told you how to do it.
what maximum size of premium plugin i can upload?
Fairly certain it's just like any other.
Integer.MAX_VALUE before it overflows hehe
that would be fun
there arent probably that many plugins on the whole site
and wat it is?
There's multiple ways.
wdym
I told you two ways.
How can I access and store a PDC <Location> in a chunk
@tender shard go
you're not answered to my question
-> For player inventories, you can check them on player join.
-> For others there are 2 ways. Check with InventoryOpenEvent and the hopper event
-> Or check on ChunkLoadEvent and loop over the tileentities and scan them.
You are not able to scan the whole world easily, so you do it procedurally.
I could listen to events, certainly, but are you implying that I gradually load and then unload all chunks and scan their inventories for items?
oh
Bruh
But i did indeed answer it too @urban mauve
-> For player inventories, you can check them on player join.
-> For others there are 2 ways. Check with InventoryOpenEvent and the hopper event
-> Or check on ChunkLoadEvent and loop over the tileentities and scan them.
You are not able to scan the whole world easily, so you do it procedurally.
i did not get a specific answer
how can I detect when a player places my customblock?
customblock = normal block but with a name and lore
what have i been doing
wdym with "chunk pdc"?
Chunk inherits from PersistentDataHolder https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Chunk.html
it might just be easier to store three shorts/ints if the location is within the chunk (relative to the chunk)
you should use PDC to identify your custom itemstacks
instead of name and lore
sighs
Hmmmm
with MorePersistentDataTypes, use DataType.LOCATION
chunk.getPersistentDataContainer()
yes
Ok let me try
ok thanks I'll check it out
myChunk.getPersistentDataContainer.set(new NamespacedKey(plugin, "chest-locations"), DataType.asList(DataType.LOCATION), myListOfLocations);
@regal scaffold
Tyyyy
Is posible to use maven enviroment variables, while working with multi module maven projects?
I can't recall the specific thing, amount around like 4,5mb
why does that matter
on your key yes
Cause can use that as a feature
Cool
Suddenly .getKeys() returns a array with size of how many separate block data I added to the chunk 🙂
yes
Are PDCs only for tileentities likes chests or can they be applied over to a stone block?
only tile entities. for stone blocks, you can use my CustomBlockData library: https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
eh no
don't count on that
you can also use CustomBlockData.getBlocksWithCustomData(yourPlugin, chunk) to get a list of blocks where you added custom data: https://hub.jeff-media.com/javadocs/customblockdata/com/jeff_media/customblockdata/CustomBlockData.html#getBlocksWithCustomData(org.bukkit.plugin.Plugin,org.bukkit.Chunk)
declaration: package: com.jeff_media.customblockdata, class: CustomBlockData
Oh no alex
I'm really really tempted
cause that's exactly what I need
but no
I will say no to alex
I'll write a program to do it for you. Not aplugin a program. Basically it will cleanse all worlds of the item by reading the region file if you pay me
Do nsk need to be unique?
if you want to store multiple datatypes yes

low quality kappa
What's the pdc to update a chunk>
otherwise your plugin handles the rest, eg 2 plugins can have key "amogus"
chunk.update() isn't a thing
no update
lmfao
just set
Or automatic?
auto
Alr ty
can u blame me tho
Yes
everyone can blame you
btw what does github's blame button do? i never understood it
Would this be a way to register a custom event?
`class EntityListener : Listener
{
@EventHandler
fun onEntityDamage(event: EntityDamageByEntityEvent)
{
if (event.damager is Player)
{
Bukkit.getPluginManager().callEvent(EntityDamageByPlayerEvent(event, event.damager as Player, false))
} else if (event.damager is Projectile && (event.damager as Projectile).shooter is Player)
{
Bukkit.getPluginManager()
.callEvent(EntityDamageByPlayerEvent(event, (event.damager as Projectile).shooter as Player, true))
}
}
}
class EntityDamageByPlayerEvent(event: EntityDamageByEntityEvent, val player: Player, val indirect: Boolean) :
EntityDamageByEntityEvent(
event.damager,
event.entity,
event.cause,
event.damage
)`
nice I got 42 stars
who's to blame for the code being the way it is
that's the answer to everything
ehh maybe if it uses the handlerlist of entitydamagebyentityevent
Else you'd have to implement that.
Jefflib?
CustomBlockData
Ahh that's a good one
Why would I pay you lol
I can code it myself
MorePDCTypes is also nice, if I may say this myself lmao
Frostalf got me on that NBT addiction though
but NBT is version dependant
Can't you just do event.damager is Projectile && event.damager.shooter
It’s as easy as creating a bukkit runnable and loading chunks scanning them and then unloading them
External files using jnbt
and doesnt support custom types
kinda dumb, but sure
It's not actually built into the server it's like reading a data file
sure but that's slow
what do you people think about those buttons? do they look okay or are they too ugly?
you start by starring it yourself and then you hope other people do the same thing
I like them
nice
true
someone just removed a star for me :(
i think 42 is the most stars i ever got
same for me lol
i got 1 now 💀 and thats orbyfied
add version somewhere
ugly
thicc
the version is already in the dep info
but yeah a button couldnt hurt
oh fuck off github
why does it also select hte line numbers
it's method calls
I know that
added
Is it as long as I think it is?
porty
suggestions?
private fun getPDCAndBlockState(location: Location): Pair<BlockState, PersistentDataContainer> {
val blockState = location.block.state
val pdc = (blockState as? PersistentDataHolder)?.persistentDataContainer!!
return Pair(blockState, pdc)
}
private fun createMasterChest(location: Location, colorCode: ColorCode) {
val blockStateAndPDC = getPDCAndBlockState(location)
val blockState = blockStateAndPDC.first
val masterPDC = blockStateAndPDC.second
masterPDC.set(isMasterKey, PersistentDataType.BYTE, 1.toByte())
masterPDC.set(masterLocationKey, DataType.LOCATION, location)
masterPDC.set(slaveLocationsKey, DataType.LOCATION_ARRAY, arrayOf<Location>())
masterPDC.set(inventoryKey, DataType.BYTE_ARRAY, InventoryUtils.toByteArray(Bukkit.createInventory(null, 27)))
masterPDC.set(colorCodeKey, DataType.STRING_ARRAY, colorCode.getColors())
blockState.update(true)
instantiateStorageChest(location) // Reads to make sure they were added and also saves them to the lookup tables.
}
Whats wrong?
PersistentDataContainer pdc = meta.getPersistentDataContainer();
pdc.set(new NamespacedKey(GenCore.getPlugin(), "name", PersistentDataType.STRING, GenLoader.genlist.get(name).toString()));
Error at Gencore.getPlugin()
Expected 1 argument
Wait
you can easily google that, even look at the javadocs
?jd-s
Thank you
you are missing a bracket
If I know a List<Location> contains my location cause I already checked
pdc.set(new NamespacedKey(GenCore.getPlugin(), "name"), PersistentDataType.STRING, GenLoader.genlist.get(name).toString());
How can I easily return that location from the list
declaration: package: org.bukkit.plugin.java, class: JavaPlugin
hm?
?
Error at Gencore.getPlugin()
Expected 1 argument
That's not related, GenCore could be anything
Think it's related.
GenCore is my main class
still they missed a brtacket to close the NamespacedKey constructor
yeye many issues haha
Nevermind, I thought they had a method getPlugin or smthing
to get the plugin instance
I guess
if you know that it's a chest, yes
then that's correct
As long as it's the correct chest import too.
It is
which one is it?
I can't, because: "Smart cast to 'Projectile' is impossible, because 'event.damager' is a property that has open or custom getter"
i see
what is a smart cast?
ah it's kotlin's version of java's enhaced instanceof
pretty sure that I need a NamespacedKey as the argument for pdc.set, so everything needs to be in the same namespacedkey object
Question:
I have a List<Locations> containing the locations of my chests.
How can I check if a broken block is in the same chunk as the List<Locations> which contains all the chests in a specificed chunk
a NamespacedKey takes two objects - your plugin and a string
you throw in 4 things
I don't need to check if it's a chest broken. I need to check the broken block is in the same chunk as my Locations
nah we got that too.
check if the block's Chunk .equals(...) the location's chunk
Well we got safecasts which can be used same'ish way. Tho we had smart casts first.
equals
You're right nvm
I'll take an explanation on that ❤️
I use == on my inventories and it works, fight me @tender shard
public void onBlockMine(BlockBreakEvent e) {
if (!verifyBlockMined(e)) return;
List<Location> locations = Keys.getLocations(e.getBlock().getChunk());
if (locations == null || locations.isEmpty()) return;
for (Location loc : locations) {
if (!loc.getChunk().equals(e.getBlock().getChunk())) {
return;
}
}
If a block broken isn't in the chunk list then do nothing, right?
CraftWorld.getChunkAt returns the NMS chunk's "bukkitChunk" field, which will be different once the chunk got unloaded and loaded again
how so?
well but if == in kotlin is java's equals(...), then obv you should compare == with ===
what even is Keys?
Was the most/least format used from at least 1.8 to 1.16?
wherre does that come from?
scroll up a bit
i dont know when it was used, but you could just check whether the UUIDMost tag exists, if not use the int array version
i wonder why they used 4 ints instead of 2 longs anyway
im writing instead of reading so i think my only option is to check the player protocol (the context is that im using protocolize)
What's a good way of preventing a broken item from dropping a block but for me to still be able to use that block
and it get removed
For example if I wanted to do autopickup when mine is what I mean
help 🥲
Was I blind or did noone reply to this, sorry if they did haha
hi im making a spawn protection plugin and i want to know how to make a smoke particle effect that plays after the block is broken (akin to worldguard)
How can I convert a Collection<ItemStack> to ItemStack or change Collection<ItemStack>
wdym? get the first element or something?
you could test if it actually is a list, cast it and call get
no clue tho
or .iterator().next()
exactly
But how can I just get 1 then
ItemStack items = e.getBlock().getDrops().iterator().next();
Technically it'll work
ye its a slist
What would be the smartest way to store data about placed blocks?
PersistentData(Containers) is only for entities/tileentities/itemstack, but not for placed blocks.
Would making a json file as a databse be the only option?
Don't use json file as database
what else?
depends on what you want to store too, i wouldnt place a bunch of data inside the pdc
okay...
i tried to look into the pdc impl but it seems to be nms or smth
wanted to see what datastructure it uses
@quaint mantle people ask about PDC for blocks every day - maybe add a ?cbd / ?blockpdc command for CustomBlockData? (https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/)
another command name noone will remember lol
at 2am it is
hmm
blue name now
?morepdc
now get pink
add
bug imagin about it
dm him
he also added ?nms and?switchmappings
?nms
and ?learnjava!
I gotta say, imajin is a nice dude, although he sucks #imajinsuckzZ
erm
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
imaij
que
can we get a ?morepdc too
do you only get to add 1 command a day
great, thanks!
give him money
mfnalex basically rules spigot
MorePDC allows to use Lists, Arrays, Maps, etc, and adds new PDC types like Location, BlockData, etc
lol I wish
e.g. MorePDCTypes allows you to store a HashMap<Location,HashMap<String, List<BlockData>>> in PDC
here it is ^
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
someone fix that last part
String value = "testStringBigSize";```
how do I create a string with a width of another string with a a number of characters at the beginning and end of string, i refer to it like this:
Might someone enlighten me, why this isn't working?
The repo seems online/available... so why is the dependency being rejected? I hope that I'm just being a dum-dum and it's a simple fix.
value.substring(start, end)
start and end is a number?
yes
alr
Did you click the maven reload button?
Send the repo url as text pls
hes on his phone remember 😂
I need a clickable link lol
did you reload maven
Repo offline?
guess so
tf
Its possible to reproduce that "charging" effect on every item?
maybe with packets?
🤔
guess i wont be working on better item config after @compact haven is avaliable
You can clone the nbtapi repo from github
ahhh ffs
seems to be NBT
@remote swallow im basically done, hope u get the idea
Player.setCooldown
So instead of what I had earlier use "https://github.com/tr7zw/Item-NBT-API" instead?
didnt actually implement the handler though, u tagged me too early
ah, sorry
ooh thanks!!
declaration: package: org.bukkit.entity, interface: HumanEntity
damn material 💀
No packets needed 🙂
https://pastes.dev/qsRhsxAlVC @remote swallow
Yes its per material
lmk if u dont get the idea from that
Not possible for custom itemstacks, only per material
💀
u might have errors, did it in Notepad++
im gonna guess i could make that default something else
better than nothing
because not everything has lore
😢
wdym
no the DEFAULT should have every single handler
and the handler's should return gracefully if it doesn't apply to the ConfigurationSection provided
ahhhhh
you can also make a method with signature boolean doesApply(ConfigurationSection section) if you want to know beforehand if it's supported, just like I did with doesSupportRead() and doesSupportWrite()
mm I didnt add it to the paste but if the handler has a doesSupport... for the target action, it should continue the loop ofc
im gonna attempt to make my brain understand whats going on
because the guess is that they'll override the Handler read/write with a throw new OperationUnsupportedException
(and you don't want the program to exit just because one handler doesn't support writing, when it might not even apply to the target ItemStack to be written)
but you can also catch the exception instead of a boolean doesSupport method, but that'll require generation of a stack trace and that might be expensive
explain that to me later if i ping you, my brain has just been handed a few too many things to brain over
u want me to finish the handler & base processor rq so you get the full picture?
i think i get that
alright
if not ill give you a ping
sounds good
ah now i see where that code is used for
should I ask why the name of that method and the parameters it takes make no sense
oh mb
hes judging my code
thought that was @Override
i just realised
my guess is that it's from a commandframework?
acf
makes sense now
acf best thing
thats the regular one
I use that sometimes or the annotations addon other times
but yes, that's the framework
is the one
yeah ik it's pretty similar at that point
some people use cloud because they dont like the annotations acf
and then you have the builder pattern 💀
kekw
im not a big fan of that, especially not the IntegerArgument.newbuilder() stuff
well thats because of how argument processors work
when are we finally getting the C++ style of default arguments 🥺
im just writing 5 methods that call eachother atm
@vagrant stratus is simpable
maybe Choco
but im scared to tag Choco
might send his dog after me
I-
whats that mean
i sounds like oui and thats yes in french
is there a way to check if an event has been cancelled from another plugin? For example a blockbreak event getting cancelled from a plugin like worldguard. I tried to check using event.isCancelled(), but that doesnt work. Are there any alternatives?
it should work when using EventPriority.HIGHEST assuming that plugin isnt using highest too
@EventHandler(priority = EventPriority.HIGHEST)
monitor is a thing too but you shouldnt modify the event then
you cant see who cancelled it tho
its cancelled from worldguard, Im pretty sure it has highest priority
what do i need to spawn a virtual sign?
i am currently sending a block update and open sign editor packet
but player sees the sign and then it closes itself
just flashes for a split second
Has the Id in a SkullOwner tag ever required to represent an actual player if textures is present?
I have a very cursed lib for that
that being said it doesn't work for absolutely all plugins
You need to cancel updates for the chunk and block of the virtual sign. There is a few packets involved with this. Essentially what is happening is an update of some kind is getting sent to the client after the open editor and the client realizes the sign doesnt exist and thus closes the editor
If you want something that works on every plugin (but isn't as accurate as CancelBacktrace) you can just register event handlers before and after all other event handlers. Will annihilate performance though
You are better off using a real sign for this though and then removing the sign once done
Probably
Hey there, it doesn't seem to work. As it is here, the same handler list is already inherited. But it produces a stackoverflow. When manually adding a handlerlist getter function, the event is simply not processed.
When creating a new plugin
Do you straight up use intelliJ maven archetype generator?
if you use maven sure
Or minecraft and then change the stuff
i use minecraft plugin + gralde
gradle
if you use maven you could probably use alex's maven archetype
a maven archetype makes the project pretty much
The desired archetype does not exist (com.jeff_media:spigot-plugin:1.0.0-SNAPSHOT)
did you download it
Did you use mvn install?
Or however the fuck you install maven archetypes anyways
Rarely.
I myself never use it (especially since I am an eclipse user but even then I don't use eclipse's counterparts)
then go ahead, you'll need it quite often - I'll tell you that much
wtf is this installation guide
even as a gradle user maven is quite necessary to have installed on the system
Detailed steps are:
Have a JDK installation on your system. Either set the JAVA_HOME environment variable pointing to your JDK installation or have the java executable on your PATH.
Extract distribution archive in any directory
unzip apache-maven-3.8.7-bin.zip
or
tar xzvf apache-maven-3.8.7-bin.tar.gz
Alternatively use your preferred archive extraction tool.
Add the bin directory of the created directory apache-maven-3.8.7 to the PATH environment variable
Confirm with mvn -v in a new shell. The result should look similar to
Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
Maven home: /opt/apache-maven-3.8.7
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"
It's terrible
Macos?
Or are you on windows? (Or on linux, but at that point you'll use your package manager instead)
Windows, I'm doing it rn
Ok I got it
@remote swallow How do I rerun the startup
If if failed half way lol
Basically the essence of it is that you unzip the jar somewhere, install the JDK correctly (i.e. JAVA_HOME and PATH) and the add the "bin" directory to your PATH
da who what nw
What
what startup
file -> new project
Don't work with archetypes
Chances are you have no idea what you are doing, at which point it is perfectly correct to work with sticks and stones
Could someone point me in the right direction..
I'm trying to get strings from my config.yml, the layout is like so: (end of the message)
The name of the ranks (rank1, 2, 3) can be changed to whatever by the user, how do I import permission and priority into the code?
Like for instance, if a player does /plugin rank (rank) it would return the permission and priority for that rank. How would I go about doing so?
Any help would be appreciated. Thank you <3
Ranks:
rank1:
permission: ''
priority: ''
rank2:
permission: ''
priority: ''
rank3:
permission: ''
priority: '' ```
config.getConfigurationSection("Ranks").getKeys(false)
It'll give a set with rank1, rank2, rank3
@mighty mica
public boolean exist (String id) {
Boolean error = false;
try {
PreparedStatement st= connection.prepareStatement("SELECT * FROM test WHERE id = ?");
} catch (SQLException e) {
getLogger().severe("Error: " + e.getMessage());
e.printStackTrace();
error = true;
}
return error;
}
yo guys
how can i do a exist
Return rs.next
If its true, it means it was able to move cursor
Which means there is at least one entry
lemme see
Rs stands for ResultSet
[19:44:27] [Server thread/ERROR]: Could not load 'plugins\BorderRealm-1.0-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.tomisanhues2.borderrealm.Plugin;'
Confirmed that the jar contains the path as well as main class
Checked all possible type typos
?paste plugin.yml and main class
PreparedStatement st= connection.prepareStatement("SELECT * FROM test WHERE id = ?");
ResultSet rs = (ResultSet) st;
return rs.next();
?
[17:42:32 ERROR]: [SQLite] Error: Values not bound to statement
[17:42:32 WARN]: java.sql.SQLException: Values not bound to statement
why do you have an onLoad and onEnable
Doesn't matter i'll remove them was just testing
- you dont need to super.on them
Intellij generated
judge intellij
?paste the full error rq
take a look at the name and group id
how are you building and what jar do you use
You get resultset by running st.executeQuery,readup on sql api documentation
Plus I'm not sure that your code would even compile
it do
?
PreparedStatement st= connection.prepareStatement("SELECT * FROM test WHERE id = ?");
ResultSet rs = st.executeQuery();
return rs.next();
whats wrong
That is alright
You last code makes no sense
That won't work because you don't pass the argument to the statement
You have a ?, but you never set it. st.setInt(1, id); before you execute your query
Whatever id it is you want to look for
My plugin won't get loaded, help plz https://paste.md-5.net/afosabaqas.coffeescript
The main in your plugin.yml doesn't point to the correct main class name
It does tho
Oh well yes, didn't notice that
name: BorderRealm
version: '${project.version}'
main: me.tomisanhues2.borderrealm.Plugin;
api-version: 1.19
description: Custom core plugin for Border Realm
depend:
- Vault
If me.tomisanhues2.borderrealm.Plugin is actually your main class, then make sure you're exporting your classes correctly
me.tomisanhues2.borderrealm
I checked the .jar with winrar
it works
Everything is there
Can you upload the .jar file here?
Wait a second a bunch of stuff just got added
(I think you can upload files if you're verified)
yeah
insane thing called shading
You're shading dependencies most likely
<relocations>
<!-- MorePersistentDataTypes start -->
<relocation>
<pattern>com.jeff_media.morepersistentdatatypes</pattern>
<shadedPattern>me.tomisanhues2.borderrealm.morepersistentdatatypes</shadedPattern>
</relocation>
<!-- MorePersistentDataTypes end -->
<!-- CustomBlockData start -->
<relocation>
<pattern>com.jeff_media.customblockdata</pattern>
<shadedPattern>me.tomisanhues2.borderrealm.customblockdata</shadedPattern>
</relocation>
<relocation>
<pattern>com.github.Despical.CommandFramework</pattern>
<shadedPattern>me.tomisanhues2.borderrealm.CommandFramework</shadedPattern>
</relocation>
<!-- CustomBlockData end -->
</relocations>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigotVersion}-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jeff_media</groupId>
<artifactId>MorePersistentDataTypes</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Despical</groupId>
<artifactId>CommandFramework</artifactId>
<version>1.1.5</version>
<scope>compile</scope>
</dependency>
that is called relocating so you are shading stutff
Oh
You have a semicolon after your main lol
main: me.tomisanhues2.borderrealm.Plugin;
o/
Not good looks considering I just finished a pretty big plugin lol
Makes me look 100% new

All good. I still forget to register listeners and command executors from time to time
I've been doing this for 8 years
i forgot about commands a lot
I also forget to annotate with @EventHandler
I made a template so I can just write "listener" and have an event listener automatically generated for me
Handy
get on intellij
i forget to put them in my plugin.yml and then get so confused on why getCommand was null lol
Just lay back and use your mouse
You don't really have to type much on Eclipse either if you know how to use it 🙂
IntelliJ still has more features, it's nuts
I make a conscious choice to stay
i need to make a method to auto add that stuff
I could have simplified the event typing with PJE + Enter, but meh. I've just been so used to typing out event names and I type fast enough anyways
You can use template in IntelliJ as well
I’m sure eclipse isn’t all that inferior feature wise to IntelliJ
that
the only ones i use are todo and fori
i should figure out how to make one of them
i thought you could insert lua syntax
It really isn't
Those that mock it tend to do so for one of two reasons. Either (a) their IntelliJ elitism gets in the way and it's the cool thing to do, or (b) they last used Eclipse Mars or something from 8 years ago
Admittedly however, I still refuse to use its Git integration outside of just the visual symbols in the file list. It's really not great. That and its Gradle integration can very much be better, but meh
I do hope Eclipse adds some new template placeholders variables. I'd love more. I feel like they haven't added any since its initial release
I still remember the Eclipse Juno days. I hated it.
It got better with Luna, Mars, and Neon, but IntelliJ just did things better for me at the time.
Okay while debugging my command framework i have find some bugs, one of then is caused by the next i have 2 classes SimpleCommand (for normal command class) and SimpleExecutor (for sub command or arguments). What its happening well i have done the command parser, which is not well designed because im assuming that args lenght < 1, is normal command and if args lenght > 1 is sub command
?doc
?jd-s
ty
Your welcome
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
Its bad designed, because normal commands can access to arguments too, issues came when in parsing because how i would know when to treat it as normal or sub command
event.getPlayer().getKiller()
k
and
for the first type
i can just put a players uuid
and the second one i can put like
number of kills right?
yeah
then add +1 after every kill
mhm
make sure to save that so it saves over restart
wdym
the kills can be tracked by statistic
if you add data to that map, restart the server it will not stay in that map
but i want it to stay in the map
Sorry i raged LMAO
Maps are in memory
k how do i save it then?
Database? Flatfile?
how do i save it in a flatfile
What flatfile are u using? Json? Yaml? h2?
json
So right, first of all take in care you will have to use a library for working with Json (Spigot already include one which is really great, called Gson)
Please tell me your map<?, ?> replace the "?" which your params, so i can see whats is your map keeping
HashMap<UUID, Long>
Is this what you mean?
yup
did
okay, what will keep your hashmap value?
wdym
yeah because there you will keep long type values
yes
