#help-development
1 messages · Page 1587 of 1
Yes but
will my code now
Please DONT do that
stop the player from stealing stuff from the gui
Do NOT compare inventory titles
If another plugin has the same title
It will fuck up
In that case yes
inventory#getView is the same as title?
Its the text above GUI
??
I already made a check
I know i can use
yes
And if the items slot is 7
Pulse, do you know how I could do what I'm trying to do?
Check if an item at a certain slot is not null, then if the item at a certain slot is a certain item, then if the itemmeta is not null and if the itemmeta is equal to a certain items itemmeta
Theres problaly many different ways to do this
but you can try this one
All I need is to read the tags
isSimilar compares itemMeta
Okay yea then use isSimilar.
@vital ridge that is not what i wanted
lol
what i asked for is
how do i stop players from dragging the gui items into their inventory without preventing clicking
Use your known item item.isSimilar(slotItemStack)
Why wouldnt you want to prevent clicking?
You can still apply certain tasks if you click something even if clicking event is cancelled
@grim ice you need to compare your Inventory view, if its your UI you cancel the event no mater what type it is.
is there sound call event?
oh
or any alternative
so my stuff still work if i do event.setCancelled
Yea
I mean
Look
If you want the player to not move stuff around in GUI
Cancel the event after MAKING SURE that the GUI player is clicking is YOUR PLUGIN'S GUI.
And then just create code which can apply tasks if a certain item is clicked
ok
?paste
rate my new random location generator https://paste.md-5.net/avomubevor.cs
@vital ridge
sorry for the late response
but
if (e.getClickedInventory().contains(Spawner)) {
if (e.getSlot() == 2) {
if (e.getWhoClicked().getInventory().contains(new ItemStack((Material.AIR)), 1)) {
e.setCancelled(true);
if (e.getWhoClicked().getInventory().contains(new ItemStack(Material.DIAMOND, 8))) {
if (e.getWhoClicked().getInventory().contains(new ItemStack(Material.ZOMBIE_HEAD, 1))) {
e.getWhoClicked().getInventory().removeItem(new ItemStack(Material.DIAMOND, 8));
e.getWhoClicked().getInventory().removeItem(new ItemStack(Material.ZOMBIE_HEAD, 1));
e.getWhoClicked().getInventory().addItem(new ItemStack(Material.ZOMBIE_SPAWN_EGG));
e.getWhoClicked().closeInventory();
}
}
}
}
}
like this will it work
hey so i have a question
im coding a plugin to detect if the user has citizens installed, and for some reason that wont work, but yet when i use another plugin it will work,
i dont understand the logic, soo kind of wondering what is citizens really named.
bump
Afaik no
how to get sound name from protocollib?
What i have now:
manager.addPacketListener(
new PacketAdapter(Main.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Server.NAMED_SOUND_EFFECT) {
@Override
public void onPacketSending(PacketEvent event) {
Bukkit.getLogger().info("Sound: " + event.getPacket().getStrings());
// Sound: StructureModifier[fieldType=class java.lang.String, data=[]]
}
}
);
You need to extend an entity
If not the client will be like wtf and have a hissy fit
Ngl kind of wondering why Arcade works fine and ive tried Citizens , citizens , citizens2 , Citizens2 , CitizensNPC , CitizensNPCS etc and it wont work but yet Arcade does??? I dont understand what im doing wrong here tbh
?paste
wtf dude
k
what the "Arcade"?
In a PlayerEggThrowEvent, how could I get the metadata of the egg item that was thrown
?jd
?jd spigot
decompile it and find the "avaliable name"?
Um. Look, I already searched for how to do it. And I couldn't find it so that's why I'm here
from plugin.yml
bruh
read java docs
The event only gives me the Egg Entity. Shouldn't that be different from the actual egg ItemStack?
I don't know how to decompile it,
Okay, fine, I'll check again
- on the github it says Citizens2 and stuff,
i tried both names for it, and it doesnt wanna detect it,
simply you must to get item stack from this egg
and all
bump
accept friends
Oh okay, that makes sense
i did that already,
It implements ThrowableProjectile. getItem()
If you have not changed its appearance, getItem
Sorry, was thinking of sommin else
player.teleport(new Location(Bukkit.getWorld("flatworld")),0,0,0); i get the error cannot resolve constructer help
Hello,
I would like to make a block unbreakable (like bedrock) so that you don't even get the block breaking animations. How could I do so?
new Location(Bukkit.getWorld("flatworld"),0,0,0));
just install a block protection plugin
guys is ther a faster way 2 check if a chunk exist or not? .-. i got dis code https://paste.md-5.net/ahuwacideq.cpp it work but it slow af lol it takin hours
(taht code checks all chunks in 1 region, plugin checks all regions taht have .mca files)
that's what I tried unfortunately it doesn't work
I think this is a client side issue
I am trying to change the hardness of a block, it works fine for blocks like bedrocks
but when I try to do the same for blocks with a normal hardness it doesn't
unless the hardness I set is lower than the actual hardness of the block
may be I should use mining fatigue?
i've fixed my issue.
Sound name is: packet.getSoundEffects().read(0)
sorry for the spammy text, but any ideas
?paste
oo
som1 help miiiiiiiiiiiiiiiii
🤣
um
how can i apply a custom texture to my custom creature?
why when i right click the nether star nothing happens https://paste.md-5.net/koqotamexi.cs
why?
ResourcePack. CustomModelData recommended for use.
please could you tell me more
this is knowledge passed down from age to age... Khm. OK, Google. What is CustomModelData? Minecraft
Is there a catch-all event to prevent any block updates in a region (like to preserve it)? I tried BlockEvent but I get this error https://paste.helpch.at/erotipatax (I assume BlockEvent itself isn't an event you can listen to, it just provides methods of other events)
bc you haven't detecting click the nether star.
getClickedItem
i dont thinj it will work but ill try
better to star.isSimilar(event.getClickedItem())
BlockPhysiscEvent
I'll try it
using star.isSimilar you will avoid any null checks
useful knowledge
how?
if(Star.isSimilar(event.getClickedItem())){
like this?
and yes.
Cannot resolve method 'getClickedItem' in 'PlayerInteractEvent'
getItem
i fixed my issue.
Bruh
its right clicking an item....
So not in an inventory
yes not in inventory
um, how are you using a Nether Star in the world?
Do you mean you are holding a Nether Star and you are right clicking?
ok
Hi, im trying to get a location
Im sure this should work
yes i did
oh thanks lol
I'm trying to get into using the persistent data holder of an ItemStack's meta. I did it for an egg item stack. I give myself an egg and set some persistent data values, but in the egg throw event, I get the egg's item stack, and it seems the properties I set aren't there
It's like I'm not getting the same ItemStack
pretty sure if you throw a egg it turns into a entity and looses all its properties
Well, the egg item stack and the egg entity are different things, yes
However, Egg is a ThrowableProjectile which has getItem()
¯_(ツ)_/¯
It returns the generic item
in the throw event copy over teh PDC data to the entity
I'm only given the entity in the event
Okay, something isn't clear. Copy what PDC data into what other PDC
I see what you mean. See if the Player still has teh egg in his hand in the event
but doesnt it call that event as soon as its thrown?
Man, I really want to include Spring Boot into my plugin for easy Hibernate/JPA support and also to add a REST API too, but I'm not sure I can justify 60MB of dependencies being shaded into the plugin jar
All events are cancellable, meaning events intervene
So it's possible the player's item will remain?
I will check
As its not cancelable I'm assuming it happens after the itemstack is removed, but it worth checking
It isn't cancellable?
Not all events are
You can do something dirty
If it's not a public plugin
I don't remember how exactly I did this. But I modified the MANIFEST.MF file to search for the shaded dependencies in a relative path
And then I kept those dependency files on the deployment machine
It is public unfortunately, I wanted to use Spigots new Library Loader feature but I need to support pre 1.16
Aww
I'm not sure how my users would react to the plugin jar going from 500KB to 60,000KB +
Part of me is just like fuck it 😄 😄
what is charged creeper enum called?
declaration: package: org.bukkit.entity, enum: EntityType
same as the regular creeper
you will use Creeper#getPowered()
Thanks
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Creeper.html#isPowered()
@quaint mantle sorry, isPowered() actually
How can i set the type in citizens plugin?
can anyone help me test my plugin please? for some reasons i cant use my server
sus
lol
u can decompile it or smth
its not a virus or smth
idk use a virus detecter or smth
sus or smth
There may be another way
How so? 🙂
Error: too much info, cannot fix
Gimme a sec
(Try providing less info)
im guessing that's sarcastic
of course it is!
it's supposed to message me a value from a mongodb document
"Error" in the java world can mean vastly different things
Usually I consider it as a stacktrace, but given that there is no stacktrace there is nothing to fix
so in a sense I wasn't joking, that little word will result in me not looking any deeper
Stacktrace or bust
ElgarL has talked bout it before - you may need to @ him
I can’t find it on his repo anymore
Or I’m just blind
Didn't he complain about it not being possible anymore due to Classloader changes
Yeah, I guess you could do both - the new library way and messing with the classloader as a fallback solution
Yep
That was my idea anyways
@eternal oxide sorry for the ping but do you still have that library loading code lying around for James? He needs support for legacy lib loading
Location is a web address afaik and file name is the output file
If you can find a link to download from - look at the usage of the class
Yep
So those jars have been hosted by them, but if you can find a GitHub releases or something afaik that should work
Okay cool, suppose I can substitute in maven urls to the jars instead!
Sweet thanks!
maven central is not keen on you installing stuff at runtime fyi
You can actually still append to the class loader in Java 16
But it doesn’t use reflection, it uses agents
In my case, I just used slimjar (library) which assists me and does all the complex shit
They get a bit funny bout it - what was the reason, I forget…
im working with something very similar, could you share the final proyect once you are done?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
is this even worth implementing?
Context?
Gonna start working on a licensing plugin, where the developer of the spigot plugin uses the licensing plugin's developer api.
However my idea is to download the pl from a cdn, where a auth header is parsed, and delete the pl file before shutdown.
Not sure if its a good idea.
You mean writing custom events?
You need to be able to use all spigot plugins without an internet connection.
more of event handeling in general
What do you mean by "worth implementing?" then?
replace general events with that
entierly
but i think i missunderstood what thats focused on
its for custom events
not evnets in general
What? Do you want to fork spigot and scrap the whole event API?
haha that would be interesting
but no
Also, is it a good idea to have over 10k endpoint to prevent blocking?
Are you asking if writing custom events that make use of other events to call them is a good idea?
Like a shit ton of free domains with cloud flare.
This site just explains how to use spigots event API and how to do custom events.
Custom events are generally only useful if you provide an API to other devs. Internally you
can just use your own registration system using functional interfaces or callbacks for example.
Ill think of a solution for that later on, but I need to somehow make a connection and still connect to the endpoint api.
Worst I can do is make a file that it will check every reload, if it cannot ping google, or something.
As stated: Every spigot plugin needs to run even if the executing server has no connection to the internet.
So a licensing plugin that locks itself until a connection to a 3rd party server is established, is against the tos.
Ah.
Out of interest do you know why it is against the tos
Well, as said, If I can somehow make it validate the encrypted file, and update the algorithm every update, I shouldn't have any issues.
how can i check RAM usage for individual plugins?
I have no idea why this was established...
Umm. U can’t afaik. It all runs in the same java process
Yeah fair enough - just seemed a bit weird
You mean using java or in general. Because you can always use a profiler like YourKit for that.
Nvm I stand corrected , that’s cool
I see this before but I want check this on hoosting
this is posible check this use YourKit?
You can run profilers like YourKit or VisualVM in headless mode with remote data access.
is there some way how to convert old nms names to mojang mapped names
?
because I still cant find come classes
Buildtools —remapped not work?
Or have I mis understood
yep, but this generates me the dependency
but I am asking how can i find the new name of nms some class
Oh
You mean convert the old package/class names to the new ones? I dont think there is a way to do that. But i just started using 1.17 nms so im not 100% sure. But seems like a bit of a reach...
but I haven't VPS
only hoosting minecraft (with ftp) but without option install program
Hm. I think you can do some hacky stuff like uploading the visualvm jar and writing a spigot plugin that runs the profiler when the server starts...
But your host might block starting new jvm instances from within a running one
posible I can try but maybe exists better method the best plugin?
This also means keeping track of AUTH key versions.
CURRENT AUTH key version 1
LATEST AUTH key version 2
TOLLERANCE gap = 1
If (Math.abs(Number(lauth[0] - toll)).equals(auth[0]) || lauth[0].equals(auth[0])){
/*
2-1 === 1 ?? TRUE
1 === 1 ?? TRUE
*/
}else{
//Disable plugin.
}
Sorry for the bad quality, I'm on my phone.
And my hands hurt.
btw, from what is in the update log, I can use mapping-mojang only for development but i must convert it to mapping-obf for publishing, but do I need to do this also for private plugin, that will be used only on my server?
You can use the moj mapped plugin if you also run the moj mapped spigot jar. Otherwise the package names dont match.
So reobf is theoretically only needed for public plugins.
and when I am using paper, if there mapped jar?
As said, I will have a algorithm, that I will update every ver, to prevent further piracy.
And it will work when someone purchases, with automatic validation.
Its 00:04 and I'm literally thinking of authentication for a spigot plugin.
Im still trying to figure out how to properly use nms with paper. I would just wait a bit for that.
Generally using nms with spigot/paper shouldnt break the other one. But then again: nms is not part of the API and there is no guarantee that anything is cross compatible there.
I believe they got paperweight which is suppose to help with that, if I’m not wrong
I want to start using 1.17.1 nms asap, because now I am writing some bigger code that requires nms
and even now i have to rewrite 2 days of coding with the old nms
how 2 patch custom minecraft versions with craftbukkit? Cant seem to find out how to get the csrg file things, anyone know how? https://hub.spigotmc.org/stash/projects/SPIGOT/repos/builddata/raw/mappings/bukkit-1.17.1-cl.csrg got an answer from optic in general
How to I make the {if} at line 16 can be able to execute the item type of the picked up item?
ItemStack#getType() returns a value of type Material which is an Enum and can be compared using ==
Ich you just want to check the Material that is
- the method shouldnt be static
- the method sohuld be void and not return anything
Non-static method 'getType()' cannot be referenced from a static context
?
As I am extremely new to this java script world
java isnt javascript
you want to remove that static notation in the method
@eternal oxide By the way, checking the player's active item did not work
public void pickup(EntityPickupItemEvent event){
//do stuff
}```
pog
Does anyone know what is equivalent of WorldServer in 1.17.1 nms
hey there how would i go about appending an object in an arraylist?
You will have to see if a Projectile launch event happens for the egg before its launched.
thing is that im using json so when the server reloads the arraylist gets cleared and then the objects that are already saved to JSON get updated not added
@unkempt ore ^^
You'll have to do this persistently then
Let me read this again, wait
What are those objects?
could you give me a sec. i have maybe found a solution
Alright
I actually hate you
In a way I respect that he had the guts to post that
😂
Ik but ...
Like wtf is that code even ..
Doesn't even look like java..
java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.meta.ItemMeta.getPersistentDataContainer()" because the return value of "org.bukkit.inventory.ItemStack.getItemMeta()" is null
That's...weird. The docs don't say getItemMeta is nullable
ItemMeta is null if the ItemStack is of type Air
The main hand of a player is never null but Air if empty
Aside from the fact that that should be documented in getItemMeta(), there is no way my ItemStack can be air right now
Unless I'm not understanding this
I'm in a ProjectileLaunchEvent, and I'm getting the active item of the player launcher
This event is also fired if a plugin calls Player#launchProjectile(...) in which case the ItemStack in the players hand might be Air
Ah, well. I am throwing it and this happens
By the way I've resorted to this because the item is supposed to be an egg, and PlayerEggThrowEvent seems to be doing the same thing
Show some code pls
if (event.getEntity() instanceof Egg egg
&& egg.getShooter() instanceof Player player)
{
var eggItem = player.getActiveItem();
var pdc = eggItem.getItemMeta().getPersistentDataContainer();
Bukkit.broadcastMessage(eggItem.getType().toString());
Bukkit.broadcastMessage(pdc.get(bridgeKey, INTEGER).toString());
Bukkit.broadcastMessage(pdc.get(distanceKey, INTEGER).toString());
Bukkit.broadcastMessage(pdc.get(blockKey, STRING));
var isBridgeEgg = eggItem.getItemMeta()
.getPersistentDataContainer()
.has(bridgeKey, INTEGER);
if (isBridgeEgg)
onBridgeEggThrow(event);
}
All those broadcasts are for testing
So, the ItemStack is removed from the player's inventory when it's thrown, but a reference to it is still bound to the ThrowableProjectile right?
Im currently thinking about if the ProjectileLaunchEvent is fired before or after the ItemStack is removed.
That would make the difference
But probably before its removed.
However, I was using PlayerEggThrowEvent, and getting the Egg's ItemStack
And this same thing occurred
I only attempted getting the player's held item as a fallback from that not working
The egg throw is fired after the ItemStack is reduced (as its not cancelable). Projectile launch is before as it can be canceled
Have you checked if the ItemStack returned by Egg#getItem() contains the PDC data?
Yes, that is exactly what failed
In the same way
Though, to sanity check, let me do it again
Ah i see. I remember having the same problem when i was writing a custom item lib and snowballs.
The ItemMeta doesnt get transferred. Have you tried.
Ah, alright alright, it was different this time
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.toString()" because the return value of "org.bukkit.persistence.PersistentDataContainer.get(org.bukkit.NamespacedKey, org.bukkit.persistence.PersistentDataType)" is null
You should be able to get the ItemStack in hand during the ProjectileLaunchEvent
This time I'm in an egg throw event, and got the egg's item meta
The first print worked. "EGG" was printed
Though it seems the persistent data which I had set to the ItemStack when I gave it to myself is not there
Hence that error above. How annoying
var itemStack = new ItemStack(EGG, (int) args[0]);
pdc.set(BRIDGE, INTEGER, 1);
pdc.set(DISTANCE, INTEGER, (int) args[1]);
pdc.set(BLOCK, STRING, ((BlockData) args[2]).getAsString());
player.getInventory()
.addItem(itemStack);
I do this when I give myself the egg I'm throwing
And I guarantee the namespacedkeys are the same references, as I'm passing them to the listening class
I just don't get it
If the active item was not available, I don't think the held item will be
there is no "active Item" in Spigot so I guess you are not using spigot
Though I will try for the sake of it
Oh I am using Paper. Sorry. Let me try the held item then
I usually use Spigot, but I was trying Paper this time
The same thing as above happened @eternal oxide
It seems the item stacks are different. The type is an egg, sure, but it's not the same instance I set the meta for, somehow
That sounds very odd. You sure you are setting the meta correctly?
This is how the meta is being set at the time of giving myself the egg
You tell me. It looks completely fine
you didn;t set the meta back on the item
Hm?
when you get the meta it gets a clone
its just a thing with ItemMeta
do item.setMeta once you are done and it should work
Yeah
Is the copy for defense or something
Why would they do that
What sucks is that I knew this, too
I remember knowing that was a thing before
It works @eternal oxide . Thank you very much
What a silly mistake
We all make them
so I am trying to save to a yml file with a class var but I am getting a constructor exception?
smth like this?
(I can send you whole class if you need)
Default would have no params. Though actually I'm not quite sure how it is that the config API serializes and deserializes Class types
no... I don't have any that has not params
Hmmm, that must be why
Since ConstructorException is a reflective thing, it's trying to find a way to build your class
But it can't
so what should happen in the one with no parameters?
ConfigurationSerializable uses a Constructor that takes a Map. the Javadocs has all you need to correctly implement it
which JavaDocs is that? the spigot one?
So yeah make sure your class implements this
?jd
should it just be the regular public <class name> with no params?
No, no, this is a change of plans now
You have to implement ConfigurationSerializable with a constructor that takes a Map
And then use said Map to build your class from there
implement https://hub.spigotmc.org/javadocs/spigot/org/bukkit/configuration/serialization/ConfigurationSerializable.html and follow the instructions on that jd
yeah I already had that open
you register it then you can simply get and set in teh config and it will serialize/deserialize it for you
Hmmmm, no, I wouldn't do that @quaint mantle
oh, I see
how come
Call the main class what the plugin is called
alright
The only class that deserves the name Main is the main class
Which is deep in Minecraft
whats the best way to take a string like this "100h24m" and parse it to » 100 hours and 24 minutes, get that as a Date or something and convert it to millis?
Does it have to be that specific format?
I'm confused, how do I use ConfigurationSerialization.registerClass(Class)
well it has to be without spaces and h = hours m = minutes s=seconds and so on
when I try to run that nothing comes up
You give it the Class
I’d guess
(Your class name).class
well yes, but how do I access that function
?paste
well... ConfigurationSerializable does not show to have any static functions for me
mobEnums
Also, it's ConfigurationSerialization, with the statics
ConfigurationSerialization.
replacing the return TimeUnit.MILLISECONDS.toMinutes(instant.toEpochMilli()); to return instant.toEpochMilli() would return it in milliseconds right?
will that include the normal unix current millis?
still doesn't show any static functions for me
does for me
oof, how can I get the millisecond of the result without epoch?
An Instant is essentially a parsed unix milli
nothing pops up
Lemme see though
If you're working with Instants, you're working with the epoch time
Do you want milliseconds to be included in your parsing though?
Or just down to seconds?
I need milliseconds
Well dang, not gonna ask lmao
Hmmm, you'll need a more granular regex to include a token for millis then
no no wait
Unless I'm not quite getting what you're say-
Yeahh
You want to parse to epoch millis huh
I need to parse hours, minutes and days count them and calculate them and then convert that value to milliseconds
what are you doing, just 'ConfigurationSerialization.' and then results pop up?
Ohhhhh okay
aka 100h = 100 hours = 3,6e+8
I mean, then it should just be a small modification to that paste like you were saying
Hmmm
well if I knew what todo I wouldnt xD
but the epoch will not work with our bansystem
as it uses millis
Right, I get that
But it seems what the code is doing is just taking the epoch time, which is 0, and adding the intervals
And then getting the epoch time of the finished instant, which, since it based on 0, will just be the sum of the intervals
So I believe you just want to cut TimeUnit.MILLISECONDS.toMinutes off
And just return instant.toEpochMilli() @untold rover
That code I showed you I use that to set future schedules
got it I will try that
But like, this is kinda...weird
I do java try { period = Tasks.parsePeriod(split[1]); } catch (Exception e) { period = 0L; } timed = Instant.now().plus(period, ChronoUnit.MINUTES);
If you want to deserialize this at the place you want to use it, you'll have to get the instant from the milli, and then get it's fields
that gives me a future time
and I can check if Expired by return Instant.now().isAfter(Instant.ofEpochSecond(timed));
To do that though I'm sure you could convert it to one of the several datetime objects
God, Java time API is a mess
.
.?
How would get the events of a projectile entity's movement?
I'm not seeing an EntityMoveEvent here
you would need to schedule a timer
Good idea
I want to get into anticheat plugin development. Any idea as to where to start? (srry if this is the wrong place to ask...)
Something I've been trying to get into for a while... thanks for the wish of luck. prob gonna need it against those pesky hackers.
Start with something simple
Perhaps
The less subtle cheats. Bhopping or something. Detect uncanny movement patterns
And if you detect them, cancel their movement events
True. Wish cheats and stuff where open source. Would make this so much easier
Problem with that is fault tolerance regarding lag however
If you detected bhopping through quick movements, your genuinely laggy players would get teleported back very very often
how do the permissions in plugin.yml work
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i know that
but the permissions section is super weird?
if i set a permission to be default: false, a command with the specified permission just wont appear in tab completion
but i dont want everyone to have the permission?
like how should i
its just not working??? or what?
idk what you mean by that... can you send your permissions.yml and plugin.yml here (sensor any data you don't want shared) and tell me what you want it to do
name: Nectar
main: com.ankledev.nectar.main.Nectar
version: 0
api-version: 1.17
permissions:
nectar.regular:
default: true
nectar.vip:
default: false
nectar.staff:
default: false
nectar.helper:
default: false
nectar.moderator:
default: false
nectar.admin:
default: false
commands:
discord:
permission: nectar.regular
spawn:
permission: nectar.regular
say:
permission: nectar.staff
warn:
permission: nectar.staff
kick:
permission: nectar.staff
mute:
permission: nectar.staff
ban:
permission: nectar.staff
vanish:
aliases: [v]
permission: nectar.staff
mtp:
aliases: [modtp]
permission: nectar.staff
s:
aliases: [staffchat]
permission: nectar.staff
who:
aliases: [whois]
permission: nectar.staff
setrank:
permission: nectar.moderator
toggledev:
permission: nectar.admin
theres my plugin.yml
and im not using a perms plugin... but the plugin i have "Nectar" does manage the permissions
ok. i don't need anything else. lemme look over it really quick
sure thing
and if you're wondering they are getting the perms, i debugged a few days ago just to make sure and the permissions all sent to console after the user joined
Do you get any error messages on startup of the server? I think I see the issue.
what is the issue?
if any
Moved.
we serve food here sir
What does that have to do with what i said
i feel like that's more of a #help-server message :D
as it doesnt have to do with plugin development
Yea you are right
I just didn't get the food part lmao
¯_(ツ)_/¯
How would I make an Egg entity unhatchable
Make sure no chicken comes out
Ugh what, I missed setHatching
Did spigot 1.17 change it so Block#getLocation returns the center of the block rather than the corner?
Someone told me it did and I really hope that's not true because that's really annoying for backwards compatibility
You can cancel the CreatureSpawnEvent
There may be a SpawnCause for the egg spawning a chicken
SpawnReason.EGG
If they did... just subtract .500 Location.subtract(.500,0,.500)
Yeah it turns out I was lied to
I know how to get the corner but the inconsistency between versions would be annoying
can I ask a question about mongodb here?
I would have to go back and make it floor all the coordinates
?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.
I try to set the BlockData of an air block, but it seems to not actually replace the air with the block
It's only doing it in solid blocks
Weird
What should I do here
Code?
Code really won't help you
loc.getBlock()
.setBlockData(blockData);
It's just what I described
so I have this collection of documents for every different minigame my sever has which stores information about the display and teams and such. (im using mongodb btw)
how would I grab the Display:"string" value from every document inside the collection?
BlockState.update()
Thank you
Also how are you getting BlockData?
Parsed
Somewhere else
What's the difference between Block#setBlockData and BlockState#setBlockData
One is modifying the state the other is modifying the block... I assume lol
Well I mean BlockState is an extension of Block so...
Its takes the methods from it.
Ah, is it. Makes sense
Wait, it's not
And doing update on the block state didn't work
hello
i try to make if its true the program will run, if its not the program will return
but i didnt get any response
no error at all
and this my code https://pastebin.com/y3DX9kD4
I smell MCDC integration
MCDC ?
Minecraft + Discord
yes
I see you're trying to...interconnect announcements
what do you mean ?
Is that it? It looks like a cross-chat bot
yes
the issue is
i didnt get the message
its should send the message to server when someone announce on discord
I don't see you actually instantiating JDA anywhere though?
Look, you're extending ListenerAdapter but that doesn't just register you with JDA
i register events from my Main file
The...Main...file?
yes
This isn't the Main then? I see
Show me the events being registered please
I want to see how you build your JDA
public void startBot() {
try {
jda = JDABuilder.createDefault(getToken()).build();
} catch (LoginException e) {
e.printStackTrace();
}
}
public void addListeners() {
// jda.addEventListener(new Global(this));
jda.addEventListener(new Towny(this));
// jda.addEventListener(new SkyBlock(this));
// jda.addEventListener(new Survival(this));
// jda.addEventListener(new JDAUtil(this));
}
Okay, yeah, no
This won't do
You're passing the event listener class, that is fine. However you're missing the GUILD_MESSAGES gateway intent
Also, use createLight please, not createDefault
What do you mean on your global class
The Towny class? I don't really understand
"Global class" doesn't mean anything
refactor ?
uhh i dont understand, can you show me an example ?
No, I can't right now
But you see in your Global class
You're repeating things three times over and over
oh yeah
For announcements changelog and events
You could separate these things into functions and make your code much clearer
Yeah...
aight
Also do not call your plugin class Main
i called a plugin class Main, because i want to add an event listeners
in the Main class
oh
It's a plugin, not an application
xD
Can't believe I just helped someone with JDA in the Spigot server
hahaha
Hello. My plugin.yml file doesn't seem to be working properly. All of my commands work, but as soon as I add permissions, it doesn't autofill on client side (where you can press tab to complete the command). Command still works tho.
okay
So I'm trying to find a way to do this using code, the brick is what a player places on the ground, and the wool is what the code places after he places the block, but I don't know really how to do this specially because of "orientations", so does anyone have an idea on how to do so? Thanks....
ded chat
Hi umm, I am trying to show the client world generating/loading screen that is shown to the client when you join a server, some told this was a client thing and not controlled by the server. I found this, but my editor can't seem to pickup the types
Even in the javadoc online it says it can't find it, maybe it doesn't exist anymore
are you using mojang names?
How can I do this?
i'd hope you would know
Not really
well PacketPlayOut isn't mojang names so that might be why you can't find them
Hmm but this was on a spigot forum surely they would be using the bukkit/spigot API?
Maybe it is not possible on server side?
1.15.2
So is it possible or not?
Ill do some more research
My IDE doesn't even know what CraftPlayer is?
Do I have to use a jar with craftbukkit or something
What about the Bukkit API
There isn't that there too.
You need to use nms.
Also why do you even need CraftPlayer?
You have almost everything in Player object.
I need to do Packet operations
Protocol lib?
I want to be able to show the loading screen
how do i create player object i need wanna create black hole
Player player = new Player not working
yeah use protocollib in combination with packetwrapper for that. otherwise add the craftbukkit jar to your lib and shade it via build tools to use NMS.
Do I have include protocol lib in the plugins/
I really don't want another dependent
why not? you can just rely on it without even shading it in since its already on the server.
What protocol lib?
why is it not being used??
ohh
Yeah
still not being used
Protocol lib is installed on pretty much any server
yeah i would say your project is fucked. but i cant tell what it actually could be since we cant see your source.
okay ill send whole code
Hmmm, how so? The server I will be running has no other plugins except for mine. I could shadow it in?
No you need to install it
But what is the problem with installing protocollib ?
its the typical "i just wanna have my plugin on my server WITH EVERYTHING in it so its a big ass project"
Pastebin.pl is a website where you can store code/text online for a set period of time and share to anybody on earth
I'm sorry but you don't understand my circumstances enough
No cap, you will just waste your time.
Just use protocollib.
okay
Oh what is your code about? @twilit vector
So I have two options use ProtocolLib or add CraftBukkit to my dependencies, right?
onEnable is a method which only works in your main class which extrnds JavaPlugin
yeah
OHH
Yeah just install spigot with build tools and you’ll be able to import NMS
Sure
yes but its unclean af
you have
what?
Listen man, I have a bigass server
by creating an extra class for your listener
I don’t need to have everything within one plugin
i want that method to keep calling it self
But everything in one class
right but the variables are in the listener class
thats good. more classes = less performance obv.
so move them
One class = no static
then i will have to move listener also
So much bettter
Hmm I am using bukkit, so I just need to add BuildTools?
i need those variables for BlockBreak event and for the onEnable
so DI it
Hmmm I’m not sure
Wit spigot you have two dependencies and one requires you to have built spigot with build tools so you have it in your maven local
what? no. buildtools.jar is to build the latest version of any api
?
dependency injection is a thing. passing your variables throught methods, your constructor etc
Well using craftbukkit is impossible with no docs, I'm not about to do deobscate it. So I am gonna use protocol lib, do I need to shadow it into my jar?
no because it have to be provided on your server
So I have to put the jar in /plugins folder?
OR inject protocol lib's source code inside your plugin
yep
can i set somehow a display name with a line break to an item?
how can i do this with the tabcompleter for a command? instead of a list of strings that can be selected
just add [<pos>] to the list 
but i dont want it to be selectable with tab
hm.. there is a way with placeholders, but idk it anymore.
there was a framework for it iirc
I don't know if I can get help with this here, but I have decided to use craft bukkit and this is what I have
Packet enable = new PacketPlayOutLogin(
entity.getId(),
entity.playerInteractManager.getGameMode(),
world.worldData.isHardcore(),
world.worldProvider.getDimensionManager().getDimensionID(),
world.getDifficulty(),
60,
world.getWorldData().getType(),
world.getGameRules().getBoolean(new GameRuleKey<GameRuleBoolean>("reducedDebugInfo"))); ``` But it says it can;t find a constructer
Never mind ill use protocol lib
when making plugins for your server, what would be better?
to throw everything into one jar?
or split them and use as libraries?
depends on the plugin and what you are trying to do
do you have an example?
if you plan to do 10 different plugins.. for example essentials, worldedit, plotsquared and so on, i would do an extra jar for each. if its just a big ass project which belongs together, i would throw it in one jar
im trying to install this https://github.com/JorelAli/CommandAPI, but i get this error
[INFO] Reactor Summary for commandapi 6.1.0:
[INFO]
[INFO] commandapi ......................................... SUCCESS [ 9.067 s]
[INFO] commandapi-preprocessor ............................ FAILURE [ 1.727 s]
[INFO] commandapi-core .................................... SKIPPED
[INFO] commandapi-1.17 .................................... SKIPPED
[INFO] commandapi-1.16.5 .................................. SKIPPED
[INFO] commandapi-vh ...................................... SKIPPED
[INFO] commandapi-plugin .................................. SKIPPED
[INFO] commandapi-shade ................................... SKIPPED
[INFO] commandapi-annotations ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.998 s
[INFO] Finished at: 2021-07-22T05:05:20-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project commandapi-preprocessor: Fatal error compiling: invalid target release: 16 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :commandapi-preprocessor
any idea why? i always get errors when installing something manually with maven, i hate it
Fatal error compiling: invalid target release: 16 -> [Help 1]
Maybe it means that Java 16 is not supported?
Just a random thought.
not suported by maven? or the repo/module/whatever thing?
im using maven 3.8.1, which is the latest, so...
huh then it's commandapi...
but don't makes sense to me, since there is 1.17... which you need java 16 for
but it supports mc 1.17, how can it support 1.17 without java 16, java 16- plugins work in 1.17?
yea, then whats the problem? mmm
also it says "merge branch master into java 16 support" in a recent commit
it can support mc 1.17 withouth using java 16 by not using the java 16 methods from the api.
java is backwards compatible.
also in the changelog of the version 6.0.0 it says "Changes build version from Java 8 to Java 16"
mvn --version:
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\ProgramData\chocolatey\lib\maven\apache-maven-3.8.1\bin\..
Java version: 1.8.0_211, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_211\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
why does it say Java version: 1.8.0_211?
does it use the first java installation it finds?
in the path env variable or something
yea, it was that
now that i have it installed, how do i actually import it into the maven project?
If you ran maven install just add the group name artifact and version
to pom.xml?
and how do i know the group id, artifact id and version?
literally idk how to use this thing
can i change the coords that show up in the F3 menu?
for example a player is somewhere but they get other coords
No f3 is client side
As long as you don't want to mimic the entire world the player sees at their position
Hey, what would be the best way to store data in a block?
I just need to store a string
not sure if a block has a PDC, but probably not. you can store the location of the block and the informations you need to store
you just have to listen if the block is being destroyed by comparing the locations
hello, how do i can cancel beacon event?
wtf does this mean??
Failure to find dev.jorel:commandapi:jar:6.1.0 in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of spigot-repo has elapsed or updates are forced
pom.xml:
<repository>
<id>local-maven-repo</id>
<url>${user.home}\.m2\repository</url>
</repository>
...
<dependency>
<groupId>dev.jorel</groupId>
<artifactId>commandapi</artifactId>
<version>6.1.0</version>
</dependency>
how can I put my CratesPlus key in Essentials kit?
you don't have to specify maven local in your repositories o.O
nah - i have used redlib's persistent block data api for this in the past
Hello?
wdym beacon event
I have a problem can you help me ?what is this error message?
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.
just cancel the event if the inventory is the right type
"if you wish to use IP forwarding , please enable bungeecord config as well! ?"
or just cancel the right click on a beacon with the PlayerInteractEvent
ok*
yep that also works
just thought that route was easier
cause there are no null checks
and they are a white role ><
hi
How do I encode the source code of my plugin, and no one can see it in any way, only I can see
you are looking for "obfuscation" tho this is never a 100% guarantee
once your code is in the hands of others there is always a way to restore it
this is nearly impossible in java
why
cuz i'm developer in minecraft server
and this server have alot of developers
so ididn't need any one know my codes
Hello, how do i can list online players in menu?
what does your code make that important so no one else than you should be able to see it?
creating a GUI, making it a paginated menu, adding the heads of the onlineplayers in it and add a +page and -page button
I mean, if you are a dev in a network surely you all share code anyways?
^
anticrash plugins redpvp plugins and alot
yes
why don't you know how to obfuscate?
or even why don't you know that its nearly impossible to encode or even make the source unaccessable?
iknow that but always the other developers know my codes
so i'm not good in obfuscate
and thats totally fine
because you are a team
its normal to share code with your team or even code together
@hybrid spoke we team ok but other developers gets money from the server
but me no
and? whats the point?
so ididn't want share my code

and ineed to buy plugin to another server
but ican't obfuscate good
yes
on any obfus methods website they show how to use it
give me link for any website
same
Google "Obfus methods java"
so now thats out of the way.....
im wondering how i can get the server commandmap w/o using Paper
reflection 🥳
by googling
Hmm. Reflections on private fields in Java 16 ...
well my question is how to add onlineplayers heads..
works perfectly fine in java 16 ?
idk why everybody thinks reflection is completely dead in java 16 😂
and i just answered that question
then how do i use the thing i just installed?? (manually, using mvn in a directory with stuff) i dont get it
? you can add a dependency you installed (idk installed through mvn install) in another projects dependencies list
It isnt dead but since version 11+ reflections have been made more and more restrictive.
i added it, like this
<dependency>
<groupId>dev.jorel</groupId>
<artifactId>commandapi</artifactId>
<version>6.1.0</version>
</dependency>
and i get Cannot resolve dev.jorel:commandapi:6.1.0
and you are sure it is installed into your local repo ?
i guess so? idk
how do i check it
the ...\.m2\repository\dev\jorel path exists, so, i think so
yeah but as neither the craftbukkit/nms implementation are defined modules, they expose everything by default and you can access them.
are you sure it is the correct version
no im not, bc i dont even know how to know the version
i just copied it from here https://github.com/JorelAli/CommandAPI/blob/master/CommandAPI/pom.xml#L30
and the group and artifact id
why are you even building it xD afaik it is distributed through the jitpack repo
e.g.
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
``` add this repo
idek what jitpack is
just note that jitpack has different groupids
WHATS A FIELD
AAHH
which import is that?!
<dependency>
<groupId>dev.jorel</groupId>
<artifactId>CommandAPI</artifactId>
<version>Tag</version>
</dependency>
🤨
also, google java relflection and learn
if we were to give you a full course of java reflection, we would be here for a while 😅
am i supposed to guess? the readme doesnt say anything about that
well, thanks
no, the page I just send
lists the versions
But getting the commandmap reflectively is often overkill
clearly states the latest version is 6.1.0
i mean, using jitpack instead of, whatever i was using
maven local should suffice
usually maven artifacts are distributed through a maven repository
in this case, command api is distributed through the maven repository jitpack
yes, and the readme doesnt say anything about that
to access it, add the jitpack repository
thats what im saying
The official repo is codemc
I hope I highlighted the link well enough
is that "commandMap" field still a thing??