#development
1 messages · Page 47 of 1
I mean yeah with Java's scope restrictions and encapsulation, it's quite hard to get information about stuff without them exposing it with like annotations and stuff
that's called a segmentation fault!
the problem is, it's not trivial to convert a Java object into a serializable representation
unlike with JS and JSON, where objects are prototypes etc.
you need something like this to make sure it can be converted back into what it was supposed to be, then you just store all the fields in a nice way
thats pretty much what java serialization does, just with more explosion protection
perhaps the more important question is why do the specific types matter?
it's a little concerning
but worst case scenario make a DTO object and convert to/from that when you serialize. then you can wrap/recreate the specific types manually
yeah Java record/kotlin data class is ideal for serialization
well said Emily
hello, is there anyone here who has experience updating spawning in armor stands packet based with armor items
👋 What do you need?
mostly just, how do you spawn an armorstand with ClientboundAddEntityPacket with armor 
WorldServer ws = ((CraftWorld)location.getWorld()).getHandle();
EntityArmorStand nmsStand = new EntityArmorStand(EntityTypes.ARMOR_STAND, ws);
PlayerConnection pc = ((CraftPlayer)player).getHandle().playerConnection;
nmsStand.setLocation(location.getX(), location.getY()+1, location.getZ(), (float)location.getYaw(), (float)location.getPitch());
nmsStand.setBasePlate(true);
nmsStand.setArms(true);
nmsStand.setSmall(true);
PacketPlayOutSpawnEntityLiving spawnP = new PacketPlayOutSpawnEntityLiving((EntityLiving) nmsStand);
pc.sendPacket(spawnP);
DataWatcher dw = nmsStand.getDataWatcher();
List<Pair<EnumItemSlot, net.minecraft.server.v1_16_R3.ItemStack>> equipmentList = new ArrayList<>();
equipmentList.add(new Pair<>(EnumItemSlot.HEAD, CraftItemStack.asNMSCopy(<item>));
equipmentList.add(new Pair<>(EnumItemSlot.CHEST, CraftItemStack.asNMSCopy(<item>);
equipmentList.add(new Pair<>(EnumItemSlot.LEGS, CraftItemStack.asNMSCopy(<item>));
equipmentList.add(new Pair<>(EnumItemSlot.FEET, CraftItemStack.asNMSCopy(<item>));
equipmentList.add(new Pair<>(EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(<item>));
PacketPlayOutEntityTeleport teleport = new PacketPlayOutEntityTeleport(nmsStand);
pc.sendPacket(teleport);
PacketPlayOutEntityMetadata metaData = new PacketPlayOutEntityMetadata(nmsStand.getId(), dw, true);
pc.sendPacket(metaData);
PacketPlayOutEntityEquipment entityEquipment = new PacketPlayOutEntityEquipment(nmsStand.getId(), equipmentList);
pc.sendPacket(entityEquipment);
```1.16.3 adjust accordingly for future versions.
Is there a way to detect a row update with Jetbrains/Exposed? I'm trying to have a "updated_at" column that changes whenever any other column in that row is updated.
I'm using the DAO API
what database are you using
some of em have auto updating columns you can use for that
bcz I can?
An auto-updated column is automatically updated to the current timestamp when the value of any other column in the row is changed from its current value.
Thanks. Got some connectivity issues right now but will let you know how it goes.
Well shit. I thought Exposed had like built in caching and stuff. Turns out that's not how it works. this is going to be a bit more painful than I thought 😭
bruh
xd
exposed is built to be as native as possible to give you the most possibilites while still using most of kotlin and dsls
caching isn't that painful either
Hello! I'm trying to check if a target player has a specific permission, but it doesn't work. Any ideas?
register_command: true
args:
- target
open_requirement:
requirements:
target_has_permission:
type: javascript
expression: '"{target}" == player.getName() && !(player.hasPermission("example.permission"))'
deny_commands:
- '[message]&c[Notificare] &6{target} doesnt have permission!'```
read the topic of the channel @fossil moth
it's considered configuration help if it's javascript?
thats pretty much what yaml is
oh okay then sorry about that
no worries .:D
I claim no ownership of the sound I just found the original file (that wasn't the same sound you're used to hearing it in the game) and fixed it so no one else would go through the trouble.
All rights belong to Mojang.
Download Link (Dropbox): https://www.dropbox.com/s/vxsckhucjhh25w3/Minecraft Bowhit (Ding!) Sound.mp3?dl=0
thx
With Guava's caching system, when I set the refreshAfterWrite duration, and the duration is reached, the refresh is not automatic. It waits until a request is made. Is there a way to make sure it actually gets run when the duration is reached or do I have to implement this myself (😭)
Looks like you might have to use a ScheduledExecutor or something and set it to a fixed rate every couple of minutes.
Yeah. That's what I found as well. it is what it is
I don't know about Guava, but with Caffeine you set a Scheduler in the builder, Caffeine....scheduler(Scheduler.systemScheduler())..
guava doesn't have that. I just used ScheduledExecutorService#scheduleAtFixedRate
works like a charm
well that isn't exactly "refresh after write" tho
that's just refresh at a fixed rate regardless of write time
yeah that's fine for me in this case.
most (or probably all) of the plugin libraries require relocations in maven and gradle (I use maven). I am confused on why its needed and what are relocations actually used for?
because the classpath is shared between plugins
if plugin A depends on LibX version 1, and plugin B depends on LibX version 2, there're gonna be multiple versions of the same class on the classpath
could very easily cause conflicts & errors
ahh I see
thanks for the explanation
I am actually working on a library(my library) for my plugins which I want to compile in my plugins and the library(my library) itself has other libraries as dependencies with compile scope. How would the relocations work there? I am relocating the other libraries in my library, will that work if I use the library in my plugins?
as far as i know you shouldnt be bundling dependencies into a library jar
just expose the transitive dependencies and let the consumer handle them, whether they want to shade them or library loader them or whatever
alright, thanks for the info
Is there a way to actually download an ecloud placeholder in a plugin without having to execute /papi ecloud download? (Player, Luckperms).
yeah, just gotta do the http request and download it into the right folder
bad class file: /home/jitpack/.m2/repository/io/papermc/paper/paper-api/1.19.3-R0.1-SNAPSHOT/paper-api-1.19.3-R0.1-SNAPSHOT.jar(/org/bukkit/plugin/java/JavaPlugin.class)
class file has wrong version 61.0, should be 54.0
Please remove or make sure it appears in the correct subdirectory of the classpath.```
how can I fix this error?
Compiled with wrong java version
54 is java 10, 61 is java 17
do I need to install java 10 or smth?
What are you trying to do exactly
trying to upload it on jitpack so I can access my github repository
Hm I'm not sure, havent dealt with such issue, someone else might know better
I'm a little confused, because you don't upload to jitpack, jitpack uses what's on github?
I assume the error is probably from jitpack
yea didn't mean upload
yes
There's some documentation on their website about applying settings to the build IIRC so that it uses the correct java version needed.
let me see
Or just update to 17??
or
is it related to the java version installed?
coz there was a java update recently
and I did update it
it's related to the fact that spigot 1.193 requires java 17 or higher and you seem to be building using java 10
Jitpack is building with 10 afaik
that doesn't affect jitpack
how can I fix it?
Does anyone have any idea why the event doesn't get cancelled?
When I left-click, it stops the pickup, but not the dragging.. So it just gets duplicated
But when I place it in another slot in survival, the duplicate disappears
But in creative it's just as if I pressed middle-mouse button
I'm 100% sure the event.setCancelled(true); line gets reached, since the settings.open(clicker) does work when testen
Here is the code:
@EventHandler
public void onInventoryInteract(InventoryClickEvent event) {
// Get the clicker
if (!(event.getWhoClicked() instanceof Player)) return;
Player clicker = (Player) event.getWhoClicked();
// Get the clicked item
if (event.getCurrentItem() == null) return;
ItemStack clickedItem = event.getCurrentItem();
// If clicked on settings item
if (clickedItem.getType() == m_settingsItem.getType()) {
event.setCancelled(true);
//clicker.closeInventory();
// Open settings menu
//SettingsGUI settings = new SettingsGUI();
//settings.open(clicker);
}
}
Screenshot of setCancelled not working:
https://prnt.sc/9ydkN1hs3XYX
Could i ask for some assistant, im loosing my mind!
its for 1.8.8
you don't check if the player is flying in removeInvisibility
oh im 18 minutes late
whoops
¯_(ツ)_/¯
As said previously:
Learn java before anything else. ONLY after learning the basics of java, do you learn bukkit.
try this amalgamation of links
https://www.spigotmc.org/wiki/spigot-plugin-development/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i believe it includes stuff to learn plain java as well
💀
if theyre not flying and flying?
players flight status is not updated until after the event
so its checking if they were not currently flying, but they now are
although im not sure why the first variable is needed...
oh the event is the receiver of the second call
its a flight toggle event, so im guessing the only possibilities are either start or stopping fly, i dont think the player.isFlying() check is needed
although isn't it unneccessary because PlayerToggleFlightEvent only gets fired when it's toggled?
oh
mb
i should've read the rest of the messages lol
no worry haha
umm do I need to?
Oh BTW I fixed it, I had to delay the onplayeritemconsume
Anybody who can help me with this?
When in creative, is the itemstack you pick up actually valid? Like can you move it around your inventory/throw it on the ground etc?
Also you don’t have to close the inventory before reopening a new one, try just opening the new one
you create a command executor and register it for ex. via your main plugin class by the command name that is defined in plugin.yml
Yes it is valid
Ah okay
but the item duplicates, so the fact that the item is picked up is cancelled
but not that the item is on the mouse
dragging is handled by inventorydragevent
not the click event
@EventHandler
public void onInventoryInteract(InventoryClickEvent event) {
// Get the clicker
if (!(event.getWhoClicked() instanceof Player)) return;
Player clicker = (Player) event.getWhoClicked();
// Get the clicked item
if (event.getCurrentItem() == null) return;
ItemStack clickedItem = event.getCurrentItem();
// If clicked on settings item
if (clickedItem.getType() == m_settingsItem.getType()) {
event.setCancelled(true);
clicker.closeInventory();
// Open settings menu
SettingsGUI settings = new SettingsGUI();
settings.open(clicker);
}
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
// Get the clicked item
ItemStack draggedItem = event.getCursor();
if (draggedItem == null) return;
// If clicked on settings item
if (draggedItem.getType() == m_settingsItem.getType()) {
KamaniRPG.logger.info("Dragging settings item");
event.setCancelled(true);
}
}
So now I have this
and it still does the same thing
So draggedItem is always null for some reason?
how should I test on which item you're dragging?
(the logger never gets reached)
Hello, Im accessing the Menu class in DeluxeMenus plugin Collection<Menu> menu = Menu.getAllMenus(); Is this ok to do. am i breaking any rules by doing this as there is no public api for it
Is there any way to use the @silence feature in a message sent by a bot through discord.js?
[sorry for the ghost ping user Silent, accidentally tagged you]
Any ideas why this could be happening?
ItemStack writtenBook = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) writtenBook.getItemMeta();
bookMeta.setTitle("Blank");
bookMeta.setAuthor("Server");
List<String> pages = new ArrayList<>();
pages.add("Refunds for " + target.getName() + ":");
bookMeta.setPages(pages);
writtenBook.setItemMeta(bookMeta);
player.openBook(writtenBook);
tbh unless i really have to i usually just cancel inventorydrag at all times
oh its an inventory item
yeah, never test in creative mode
if your testing if it works then use survival, cus creative mode has some missing stuff that allows this kinda prevention to work
otherwise it just duplicates
which i experienced while doing custom inventory items
Yeah but I don't want to cancel other inventory drag events
I just want the upper-right slot (which always contains the settingsItem) to act like a button
yeah but in survival the issue remains
it just becomes weirder
just so your aware the event fires before it changes the cursor afaik
so when you pick it up, when the event is fired its still in the slot
so maybe try checking getRawSlots() and see if it contains the slot the settings item is in
- click on the item
- pickup gets cancelled, but item is still on my mouse (so there are 2 version)
- SettingsGUI opens
- press esc (close all gui's)
- press e (open inv)
- the item is still on my cursor
- I press somewhere interactable on the inventory
- the item disappears from the cursor (back to 1 item)
could be a ghost item
in the click event or drag event?
ig try calling Player#updateInventory()
drag
also is this in a hub or is this just everywhere>?
after cancelling the click event perhaps?
well yeah
just somewhere
any world, any where, at all times.. a player will have a settings item on the top right of his inv
I'll give it a try
getrawslots, loop over the slots, check if the itemstack at that slot is the settings item, cancel if it is or smth like that
Just calling updateInventory() worked
everythings works wonderfully now :D
thx
In case you're interested in the code:
@EventHandler
public void onInventoryInteract(InventoryClickEvent event) {
// Get the clicker
if (!(event.getWhoClicked() instanceof Player)) return;
Player clicker = (Player) event.getWhoClicked();
// Get the clicked item
if (event.getCurrentItem() == null) return;
ItemStack clickedItem = event.getCurrentItem();
// If clicked on settings item
if (clickedItem.getType() == m_settingsItem.getType()) {
event.setCancelled(true);
clicker.updateInventory();
// Open settings menu
SettingsGUI settings = new SettingsGUI();
settings.open(clicker);
}
}
Uhm, any ideas if it's possible to modify the default minecraft settings menu (not main menu, settings) with a forge mod? I know this is possible with a custom client, but is it with just a mod?
sure
"custom client" is literally just a mod
yes, and the other sub screens
oh lol
public BulletProcessor(Rust plugin) {
this.plugin = plugin;
this.threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
}
public void bulletCheck(Bullet bullet) {
Player shooter = Bukkit.getPlayer(bullet.getShooter());
double bulletSpeed = bullet.getBulletSpeed();
Vector towards = bullet.getTowards();
threadPool.submit(() -> {
int ticksPassed = controlhub.getTickCounter - bullet.getTicks;
double distanceTraveled = bullet.getDistanceTraveled();
Location currentPosition = new Location(shooter.getWorld(), bullet.getX(), bullet.getY(), bullet.getZ());
if (distanceTraveled < bullet.getDistancetoTravel()) {
ticksPassed++;
distanceTraveled += bulletSpeed;
Vector movement = towards.clone().normalize().multiply(bulletSpeed);
currentPosition.add(movement);
if (checkCollision(bullet) != null) {
//todo
} else {
bullet.setX(currentPosition.getX());
bullet.setY(currentPosition.getY());
bullet.setZ(currentPosition.getZ());
bullet.setDistanceTraveled((int) distanceTraveled);
if (ticksPassed >= 5) {
//todo update bullet object and re run
Bukkit.getScheduler().runTask(plugin, () -> bulletCheck(bullet));
break;
}
}
} else {
return;
});
}
``` is this better then looping thru set?
of bullets
and doing same checks at the end
didnt try to perform yet
is the threadpool just for performance increase? I think these calculations are very light and wont affect anything
however i keep getting a org.bukkit.event.EventException: null
hmm, is this code inside your event listener?
yes
i dont believe you xD
bro it should work ^^^^^
what line is the error on
it builds ok, its only when i run it in game
yes, its a runtime error, can i see the message?
its this line, i comment it out and its fine
ok, ENTITY_EXPERIENCE_ORB_PICKUP isn't a valid enum
you're probably running it on a different version than youre compiling on
1.8.8
the server is spigot 1.8.8, is that what your plugin is being compiled on?
i believe so
let me check
nvm i was compiling on 1.12
;/
this website also lied to me then ;/
well umm do you know of a "Ping" noise in 1.8.8
the same noise is in 1.8, but im not sure what the enum is called
yeah
cheers!
nice
i am getting this error
while the plugin has no error
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "lars.devop.testbnr.Bannerboard.getCommand(String)" is null
add the command to plugin.yml or it wont be registered
Thank you
np
im in need of some help with deluxemenus and superior skyblock 2
trying to make an upgrade gui that has alot of upgrades but having alot of issues
view_requirement:
requirements:
HasUpgrade:
type: string equals
input: '%superior_island_upgrade_upgrade1%'
output: 'has upgrade'
tried doing this but the its not working
[Craft Scheduler Thread - 242/WARN]: [DeluxeMenus] Plugin DeluxeMenus v1.13.7-Release generated an exception while executing task 318109
java.lang.NullPointerException: upgrade parameter cannot be null.
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:907) ~[guava-31.1-jre.jar:?]
at com.bgsoftware.superiorskyblock.island.SIsland.getUpgradeLevel(SIsland.java:2256) ~[?:?]
at com.bgsoftware.superiorskyblock.service.placeholders.PlaceholdersServiceImpl.parsePlaceholdersForIsland(PlaceholdersServiceImpl.java:317) ~[?:?]
at com.bgsoftware.superiorskyblock.service.placeholders.PlaceholdersServiceImpl.handlePluginPlaceholder(PlaceholdersServiceImpl.java:266) ~[?:?]
at com.bgsoftware.superiorskyblock.external.placeholders.PlaceholdersProvider_PlaceholderAPI$EZPlaceholder.onRequest(PlaceholdersProvider_PlaceholderAPI.java:58) ~[?:?]
at me.clip.placeholderapi.replacer.CharsReplacer.apply(CharsReplacer.java:119) ~[?:?]
at me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(PlaceholderAPI.java:71) ~[?:?]
at com.extendedclip.deluxemenus.menu.MenuHolder.setPlaceholders(MenuHolder.java:95) ~[?:?]
at com.extendedclip.deluxemenus.requirement.InputResultRequirement.evaluate(InputResultRequirement.java:21) ~[?:?]
at com.extendedclip.deluxemenus.requirement.RequirementList.evaluate(RequirementList.java:21) ~[?:?]
at com.extendedclip.deluxemenus.menu.Menu.lambda$openMenu$5(Menu.java:374) ~[?:?]
at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
fixed the error was a typo but still cant see the item in the gui
i think it has somthing to do with the output but not sure
you want me to post it there?
yea
or #1007620980627230730
ok\
correct how ever calculaons arent really light
calculations are just raytraces... how ever i take in the other hand that app to 10000 bullets can fly at same time
hmm, why do you raytrace when youre also moving the bullet every iteration
you can just check if its colliding with anything at each iteration
unrelated but use execute instead of submit because with submit you're supposed to handle the returned value, but you're not
so execute simply just executes it and handles it with a "default" action
more specifically if it throws an error, execute will show, but submit will not
🙃
wait how's that even compile?
I may be blind but there's nothing to break out of
oh I'm responding to a message from yesterday
ok ignore me
👍
although note this
why handle an value if we dont retturn an value
yeah ignore that part but read this part
i kinda said it weird
we execute other method if theres a collision else it will re run the method till one of condiitions goes false like travel distance , returns somethng (collision)
wdym
I mean the thread pool submit method
to change to execute instead
d;jdk executorservice#execute
void execute(Runnable command)
throws RejectedExecutionException, NullPointerException```
Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation.
command - the runnable task
RejectedExecutionException - if this task cannot be accepted for execution
NullPointerException - if command is null
Future<?> submit(Runnable task)
throws NullPointerException, RejectedExecutionException```
Submits a Runnable task for execution and returns a Future representing that task. The Future's get method will return null upon successful completion.
a Future representing pending completion of the task
task - the task to submit
NullPointerException - if the task is null
RejectedExecutionException - if the task cannot be scheduled for execution
aside from the threads though, i really dont think the whole raytracing distanceToTravel() part is needed
it will either hit something "now", or it will move forward and hit it on a later iteration
correct how ever the bullets are different callibers for example 556mm would go 70blocks
imagine some monkey shoots the air
before it ii used snow balls mc entities as projectiles but bruh performance goes poop
they tick since its an entity
ill rewrite it rn
i mean i use it to check if there an collesion
because there no really a bullet like an entity in game
like a projectile (bukkit)
im confused by ur question tbh
so each iteration, it traces from its current location to wherever the next location will be?
ok, i understand now
eh i cant send pictures how ever
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
Heklo + - to explain the concept
why we do check next location
letts say num represents a check that executes every 10 ticks
now its pretty good for combat as well since aimbot would never work very well because of delay which will make the game more challanging
why is mc API so poor damn
anyone can think of efficent way to go to hitboxes?
lets forget about bukkit existiance because its dog poop so
so far i was thinking to use a hashmap
Chunk , entity set
so ill loop everythng according to a the chunk but by same time problem is if bullet is crossing 2 diff chunks which will be still not light check
actually ill probably check for nearby entites and create a hitbox for the check
like check according to their loc .
hmm this is for a gun right
correct
10 ticks is a pretty long time isnt it
it was for the example
ah ok
ill do around 2 ticks checks probably
so for example if it fliies 20 blocks per second every cheeck will be 2b A - B
I want to show a overlay with some text but im not sure how, any library which does that ?
in 1.8.8 btw
An overlay on what
you know how there is this
"you are invisible to other players" text
i was wondering how you do that
ah, it's called the action bar
ah its this right, https://www.spigotmc.org/resources/actionbarapi-1-8-1-14-2.1315/
yes, are you working in 1.8?
yeah you can use the action bar api then, probably easiest
i added it to the libraries
but i still get this
package com.connorlinfoot.actionbarapi does not exist
when i try to compile
shoo emily, 1.8 is needed for lot of gamemodes xD
1.8 is still what the original minecraft players play smh
any idea what could be the problem?
https://prnt.sc/Ic6L600T1rlS
im bad at dependency issues
same
Hi, does anyone know why in the jobs gui that I created I don't see the custom icons and instead I see the vanilla ones?
It won't let me send the image of what it looks like.
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
you added the dependency to your pom.xml aswell right?
you could also just copy and paste the code from actionbarapi and put it in your plugin
this is the pom.xml
when i try to add
im on 1.8 too
just use nms shitt
acttionbarapi is poop
send packett
b[i] = '§';
^
error: illegal character: '\u00a7'
b[i] = '§';
^
error: unclosed character literal
b[i] = '§';
^```
I don't really understand what's going on here.
from what i can tell, actionbarapi does send a packet
ohh i ment repository
if it doesnt list one then you can use jitpack to allow it
or just copy and paste the sendPacket method from the source on github
or you could use nms to do it so you can avoid using reflection if the plugin is only made for 1.8
post the full code rather then just a snippet
cus that error doesnt give alot of context
id assume thats a char array, perhaps it doesnt support that unicode character for whatever reason
@NotNull
public String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) {
char[] b = textToTranslate.toCharArray();
for (int i = 0; i < b.length - 1; i++) {
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRrXx".indexOf(b[i + 1]) > -1) {
b[i] = '§';
b[i + 1] = Character.toLowerCase(b[i + 1]);
}
}
return new String(b);
}
That's the section of code that's causing the issue
Why is your ide warning you about spigot code?
yeah thats just weird
how are you getting this error?
are you trying to compile spigot or something
Yeah
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "papi ecloud download Player");
But it just does [18:44:28] [Server thread/INFO]: Unknown command. Type "/help" for help.
Is the plugin using commands on a brigadier dispatcher?
*I've even tried adding a / !
Do you have papi installed on the server
yes
papi
[21:30:59] [Server thread/INFO]: PlaceholderAPI (2.11.3)
[21:30:59] [Server thread/INFO]: Author: [HelpChat]
[21:30:59] [Server thread/INFO]: PAPI Commands: /papi help
[21:30:59] [Server thread/INFO]: eC
omg it works! I just replaceed bukkit with getserver but it replies with [21:35:10] [Server thread/INFO]: Downloading necessary placeholders!
[21:35:10] [Server thread/INFO]: Failed to find an expansion named: Player
[21:35:10] [Server thread/INFO]: Downloaded!
but when I type papi ecloud download Player it works (manually)
ughh illj ust have my plugin downlaod it from the web
would this be bad? (I mean in all sense, performance etc)
Basically, that the data expires if not accessed after X time
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
the imports if someone wonder 👆 (Ping me, thanks)
You're caching a cache?
useless API
its like an API for coloring Strings lmao
Why is that? 1.8 doesnt have a public api for actionbars
What exactly is the concern?
Also, you might want expireAfterWrite
I usually just have an expiryTime in there, when doing economy systems because for Vault it's better to have some value and fetch the data async than no data
Yeah that seems a lil illegal too
public static void sendActionBar(Player player, String message) {
CraftPlayer p = (CraftPlayer) player;
IChatBaseComponent cbc = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + message.replace("&","§") + "\"}");
PacketPlayOutChat ppoc = new PacketPlayOutChat(cbc, (byte) 2);
p.getHandle().playerConnection.sendPacket(ppoc);
}
does this require an AP
API its a joke
imagine living years in the past
I might puke looking at it
actionbarapi doed exactly that
but with reflection
it just allows people who arent using nms to send acttion bar messages
and like ive said before they can just copy and paste the sendactionbar method into their own plugin so they dont have to rely on another plugin
still no reason to use AP
API
the guy who asked probably doesnt know to code yet
apart from the fact that that will break on any different version
Could make reflection easier using my Reflection Library 😉
Simple reflection library. Contribute to TheCrappiest/ReflectionLibrary development by creating an account on GitHub.
dawg how many times are u gonna post that
also i thought you didnt make projects for people to use
also if you want people to use it so bad, the least you could do is add a bit of documentation on how to actually use it
god forbid, publish it to a maven repo too
Single or Multi-Class reflection library.
Example usage (Multi-Class);
Object playOutSpawnNamed = Class.fromName(<PacketPlayOutNamedEntitySpawn>).newInstance();
ReflectObject reflectSpawnNamed = new ReflectObject(playOutSpawnNamed);
reflectSpawnNamed.setField("a", entityId);
reflectSpawnNamed.setField("b", uuid);
reflectSpawnNamed.setField("c", location.getX())
reflectSpawnNamed.setField("d", location.getY())
reflectSpawnNamed.setField("e", location.getZ())
Example usage (Single-Class);
Object playOutSpawnNamed = Class.fromName(<PacketPlayOutNamedEntitySpawn>).newInstance();
reflect.getField(playOutSpawnNamed.getClass(), "a").set(playOutSpawnNamed, entityId);
🤷
nobody with a modicum of self-respect is doing that
great now add that to a readme
One day lol
🤷
cant have it both ways man
you want people to use your stuff, make it not painful to use
The way I see it is someone might copy the code and change it up a bit to apply to their usage. Why force them to use it exactly as I coded it?
that should be a last-resort not the primary approach
Difference of opinions.
why should i spend ages cloning and copying every file when every other library lets me add a single line to my gradle config?
ages cloning every class
Hence the dual options... single or multi-class
No they are separate with their own code. The multi-class files just make things alot cleaner and easier to read/use.
not really easier to use if i have to copy 4 separate files
and definitely not eaiser to use for you
now you have 2 separate things, that do the same thing, to maintain
really have to wonder if the anti-convenience evangelicism is worth it
No issue with maintaining them since it was basically a one off. Unless I think of something later down the road.
Also for the maven bs... I hate using github I'm not gonna bother trying to do maven repos xD
then we're back to here
if you're not gonna put in the effort, why should anyone else?
No we're not.
I'm hella fucking lazy when it comes to developing... but I still prefer not using maven or other dependency builders.
...
then frankly you're a hypocrite lmao, dependency managers are objectively less effort than doing it all yourself. there's a reason they exist
and this is pretty terrible reasoning
Difference of opinions.
In some cases
name a case when managing dependencies is easier the hard way than with a build tool
a single case

Requiring a build manager (tool)...
what?
Manage dependencies by self -> only require the dependencies
Manage dependencies with manager -> require dependencies, their repos to be online, a manager
requiring the manager isnt usually an issue. both big ones have wrappers that you can commit which dont require installing anything
yeah if I want to download something from the internet, I need a place to download it from
shocking
requiring the repos WOULD be a good argument if you actually committed anything other than the source
so yeah, anyone wanting the dependencies has to hunt down the jar files rather than just running a single command
and in my experience this is not fun or always easy
Single command would require the link to the repo... if you can have the link to the repo you usually have the link to the jar either way it would be 1 command or 1 click to download.
?
Take spigot plugins for example...
People post mavens repos for their api, but I also could just download the jar.
sure you could
but then you have to download a new jar if it updates, and anyone else also has to hunt down the exact jar
im not sure you understand the point of a build tool
it's not like theyre solving some impossible problem, it's convenience
1 click to download
also no lol
I said to someone recently normally api methods don't change its usually the code they run that change so having to update the dependency usually isn't as often as you'd think.
Yes
1 command to download every dependency vs multiple clicks through spigot/bukkit/maven repo pages (which are very nested since theyre not meant for humans), then moving the jars to the right folders, then adding the jars to the build path manually
thats just not 1 click is it
🤷
I'm talking about the single dependency. You have the link you click once to download.
If we're talking multiple dependencies of course it's more then one click xD
You have to find the repo link to xD
no you dont bruh
you, as the developer, put it in the build script and then it stays there forever
i, as the end user, can build an entire project without even knowing what dependencies it's using
You enter the repo url and then enter the group/artifact/version....
Most of the time that is the url lol
but you aren't publishing to a maven repo, are you?
No it's not
That is the point I'm making
I don't think you read the convo
I've been reading this whole time
if i want to add a popular library (say, guava) to my project, all I have to do is copy a single line of code and it just works
if i want to add a library made by you to my project, i have to clone the repo, figure out all of its dependencies, find the jars myself across the internet, download every jar, add each jar to the build path manually, and then copy your library code
1 of these 2 things is objectively easier than the other
So for context then...
I'm basically saying if you use maven it's downloading the src by generating a url to the download from the repository using inputs such as the repos url, group, artifact and version.
If you have all that info you can download the source yourself using the same url...
The difference is one is a command and one is a click (to download) but both are essentially 1 motion.
you are still being extremely disingenous when you say it's 1 click
it's just not, in practice
the same principle applies to you as a developer
adding 1 line to add guava, which also provides infinite future-proofing and reproducibility on the off-chance that you get a new PC, or someone else wants to use your code
vs downloading the jar, getting the right path, adding it to your IDE, and this only works for you! anyone else has to do the exact same time consuming process again
what if the dependency has a transitive dependency?
god forbid
https://github.com/aikar/commands let's use this as an example
Frameworks! aahhh!!!
this depends on at least 4 other things
so (in your mind) that's 5 clicks, rather than 1
this is already scaling pretty badly
what else hmm
guice, that's also pretty popular
that has no fewer than 9 transitive dependencies
so for a project with acf and guice, we're on 14 clicks at least
adventure, that's a very modular project so that's a lot of dependencies too
a build tool, on the other hand, is always just 1 command
https://hub.spigotmc.org/nexus/content/repositories/snapshots/
group -> org.spigotmc
atrifact -> spigot-api
version -> 1.19.4-R0.1-SNAPSHOT
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.19.4-R0.1-SNAPSHOT/
Click on the jar to download
Pick 😉
no
also building the url, that takes time
do i use the shaded or normal jar? what's the difference?
hear me out, you could also paste 24 characters in a text file and it's done
this is confusing man
Dependecy builder does the same thing... So you already have the url you just put it together.
oh my god man
me when i read and process information
anyway please answer my question
which jar do i use?
shaded, or not? what version?
There's a released jar?
the point is that you are making it inconvenient for other users to use your library by not publishing a maven artifact, not about using jars from a maven repo outside of projects with a build tool
because a dependency manager could figure this out automatically
i, as a simpleton, cannot
if the 2 processes are completely equivalent there should be an obvious answer
Depends on scope 😉
what does that mean?
There isn't even a build script to create the jar file
Unless there's like a released tab that the github app isn't showing
Read the definitions
where do i find these definitions?
Now you're just being lazy 😉
no, you're just missing my point entirely
Scope can be many things really
if your argument is that a build tool and downloading the jars manually is entirely equivalent, then i shouldn't have to ask these questions, because gradle doesnt make me ask these questions
i genuinely do not know what "depends on scope" means lmao
and i shouldnt have to
but so far this is a pretty terrible example
Can't help you then 🤷 If you know how to use it in gradle (or other managers) then you could easily figure it out.
The first one is more then likely. I've explained everything I'm not gonna repeat it.
Mitten we've gone through this many times already, don't try to explain or change Yappers opinion
If he could he would rewrite the JVM because he doesn't like using other peoples stuff
"i'm lazy"
"just navigate through the repo manually, figure out exactly what snapshot you need, figure out what shaded means and which you need, download the jar, and move it to the right location and add it to your build path, it's definitely less effort than pasting 1-2 lines of code into a gradle script!"
👍
just navigate through the repo manually,
Navigate what? You already have the input
now say something about all the other things
or perhaps you cant
i wouldnt care if he wasnt constantly plugging his library
"please use my things"
"no, im not going to make it easier for you to use"
Or jar file
epic super reaction fail
Idk where ur finding the jar file
can money buy happiness
Tbf for a single class that's fine but not for multiple classes
is it me or jira buggin
probably not just you
Why would you have to use \ to multiline in readme 🤦
?
you wouldn't?
yeah what
One sec. I clicked back and it erased it all xD
What
Just add another newline
Anything between empty lines is going to be on the same line and wrapped
Thanks discord for not grouping in the order attached
👍 Doesn't help the cases outside the code block
2 newlines
.
Anyway to not have to add \
Literally just this
Yeah... everything but a newline is a new line xD Thats so annoying to read it but have it display differently.
I think ## is also a new line
you are an odd one
I prefer a file host with readability... but they don't normally have nice UI's github is the closest but I hate the commit BS (yes I know thats the functionality of git)
god forbid you ever work on a big project and have to actually collaborate / look through history
100% uptime basically forever
collaborate
I literally say I hate working with others code, and on multiple occasions have shows I will make my own shit before using smeone elses xD
what are youse every arguing about lmao
I hope you don't plan on getting a job in the software dev field
That's probably not going to happen either way
his coworkers better hope not
I will... but it won't be for any current company.
I currently don't do client development but will probably be getting back into that in the future.
HelpChat more like BullyChat
as in... minecraft?
Not just minecraft. Anything java related really.
hmm
are you gonna tell your clients to clone ur repo and build the project themselves
yeah lmao
🙃
i was gonna say
Nah source code is extra
why would you charge extra for source code
If they don't pay for the source but pay for project.... I'm obviously gonna give them the completed jar.
so if they pay for source code you won't package it for them?
Because if they want me to update it in the future... I'm not gonna use edited source.
?
They would get both lol
what.
If they bought source, had someone edit it, then ask me to edit it, I won't do that.
I only edit my own source.
so why not charge em extra to make updates if the source has been modified since itll take longer
or just refuse to update code thats been modified
ok buddy
that's cheeky
Cause with some peoples code it becomes unreadable and hard to keep track of everything. If it's all my own code I know where everything is, what it does etc...
I'm not gonna charge extra just to work on someone else's code. I mean if I did choose to work on it I would charge for what they are requesting.
so confused. you just said you would charge extra for the possibility that someone could edit it and you might possibly have to update it later but you charging extra only when they have edited it is different for some reason?
That's why I stuck with public plugins for so long I love working on my own creations and if some people want to purchase it then that's great too.
you do you
I do me
no thats my job
😳
Basically it would be if you purchase the source code from me I would no longer create updates.
Because then it becomes their source code.
btw @hoary scarab https://github.com/TheCrappiest/ReflectionLibrary/blob/f8cadda8949849027ce7ccad5a4c50ca66a1c93e/src/com/thecrappiest/library/reflection/single/ReflectionBase.java#L253 you probably want to return the result of invoke here
dare i say it, add some unit tests to prevent things like this (although that might require a build tool lol)
Ah yeah I forgot to edit the single portion. The multi class has that fixed.
🙃
call me apollo the way i've got the gift of prophecy
a what???? never heard of one of those. (i like my code not working)
heheh
I mean technically could just copy the code from the multi into the single, then I won't have to do anything on my end lol.
👍
Why expireAfterWrite? I want to cache some values until its not used anymore for x time, the first Cache (with uuid as key) is that they are per player, so only after X time the player not being used at all its removed, would be bad? 
definitely a development approach
Incase it's never accessed
You might cache it and forget and then it becomes a memory leak if you do it enough.
whats a single and multi supposed to mean
But the cache expire in 30 secs if not accesed 
Yeah
the answer to this question is like a flashbang of words
It’ll temporarily stun you
In my library... it explains it. Single or multi... class
I haven't read the source but if I had to guess no because you're just adding it to the cache
is it just that all the classes in the single package are members of ReflectionBase whereas in multi they're top level classes?

Check it, it shoukd (i mean in my mind)
It really doesn’t explain it lol
the single thingo seems like a job for a utility class that just has a bunch of factory methods
How does it not... do you not know the difference between the words "single" and "multiple"?
dont see a need to provide two completely seperate apis that do the exact same thing in the same project
Multi is cleaner and easier to read. Single is a bit more code to achieve the same thing (in use)
You can read the example usages to understand what I mean.
the example isn't even correct
it's Class.forName not Class.fromName and it's also deprecated iirc
so is Class.newInstance
Don’t think forName is deprecated
I wrote it on discord lol. I'll change.
This eviction strategy is based on the expiration time of the entry and has three types: Expire after access — entry is expired after period is passed since the last read or write occurs. Expire after write — entry is expired after period is passed since the last write occurs.

so why ever use single?
The whole idea of “Single or Multi-Class” is utterly absurd so just saying that doesn’t really explain it lol
Yeah why would you ever use single
They should make a single class version of spring
That would go hard
fr
in case you are too lazy to copy three sources instead of one
because you have to copy it manually
its actually even harder than 3! ||its an entire 4!||
jokes on you, i can just clone the repo and copy the directory
checkmate, gradlecels
The multi class portion is more OOP so fits better with java or other OOP languages where as single is more utility methods as someone said earlier.
another word flashbang
never said that
so, since java is an OOP language, as you know, isn't the single class bad design?
i said that if you want it similar but not as shitty, you could provide a utility class with a bunch of static factory methods
i wouldnt even call that similar
Not necessarily. Some people might want a single class vs multiple.
I have alot of single classes that could be spread out. Its cleaner to put them in 1 class.
?
you're now contradicting yourself
Methods wise. Not OOP
what?
I really can't explain it to you. If you haven't figured it out by now 🤷
the idea of a class that constructs the objects for reflection isn't a bad idea. the bad idea is having it the two completely separate.
man if we're gonna play the condescending game i have a LOT more criticisms about this library
and not just about its lack of a build tool
Post away.
to me (i didnt rly take a good look) it looks just like a factory (but completely separate from the "multi classes") which is very oo 🤯 🤯
and in fact it's straight up worse than just using normal reflection
since were doing this im loving the comments https://github.com/TheCrappiest/ReflectionLibrary/commit/2b3c69e882eb13f8d8acca866c53754a11e1d8ee#diff-8b7d0e633e6155f7ef324e3155750aa0b06fc5828ff0ef63fb7bff0102432346R9-R10
javadoc comments should be /** not /*
it's such a thin wrapper that it doesnt really add any convenience, and it's worse because it just takes away all control you have over error handling
some of the design decisions are also frankly noncensical
I don't do javadocs lol. I barely did the readme
Probably takes more time to copy the classes and figure out what license to use and how to credit the author, then find out how to use it because there are basically no docs before finding a bug which you then can't easily fix since it's not just a dependency but an actual class, and when you have fixed that you have to somehow clone the project, copy the contents of your edited version, commit and push to another repo, not to mention that you have to create a pull request too just to find out that Yapper hates people and collaborating with them and closes your pr without any reason than just to use reflection
bro can't type a single *
People gotta learn java some way 😉
I wouldn't care if Yapper was 11 or so xD
by people do u mean u?
i think the person that needs to learn java is you
In a way yeah. I'm still learning java even after 6-7 years of developing with it.
if i want to get a ReflectMethod from a method int blah(int x), none of the methods in ReflectionBase work because they only work with no-args methods, so my only option is
to get the method manually, then wrap it with a ReflectMethod - then what the hell is the point of the library lmao
You can look at my past plugins lol
I removed alot but some are still there
Why did you remove them?
same goes for all the other constructs
Cause they lost usage.
PerVersionResource, LobbyBowGame, PunishGUI etc...
buddy the oldest repo is the same age as ur github acc
I only recently started posting on git. Look at my spigot and mc-market.
this is just not gonna work with overloads
at all
Why did they lose usage??
I have tons and tons of private and public repos I haven't touched in ages I just have there because I don't want to lose them and build my portfolio.
Also, that extra capital letter was very important.
Could you explain this?
I didn't have a need for them...
what can i do
If you haven't figured it out, he can't explain 🤷♂️
TRUE
getMethod(Class, String)... okay that doesnt help because you cant specify the parameter types
same goes for getMethodByReturnType
What's so hard about that lmao, read the definition
if you have overloads like ```java
int blah();
int blah(int x);
so with that, and the terrible error handling this is looking like a straight-downgrade from normal reflection so far
I'm really not seeing the issue lol. Mojangs obfuscation require you also have to check return types.
the whole design of the ReflectX classes is also bizarre... why are things like getFieldByType not static factory methods?
yes but you also have to check parameters
No point. I don't use paper
🙃
please tell me how i can get (consistently) the second method using your library
Probably use the jar from minecraft.net
In some cases yes... Hence why in the multi class I added the option to ignore types and it counts the parameters. Some objects don't return the same class type.
For example the packet used in the example returns Class as the class which can't be used to test in the parameters.
6-7 years mhm
constructor.getParameterTypes().equals(parameterTypes)
Hence why in the multi class I added the option to ignore types and it counts the parameters
where are you doing this
(ill give you a clue, you're not)
I know where it is
For example the packet used in the example returns Class as the class which can't be used to test in the parameters.
#development message
In C:\Users\Yapper\Projects\ReflectionNewNew2.0NoGit
What types are those?
class array lmao
And what's that check supposed to do? Can you send it? Tryna figure out the context
Ah my bad Its in the constructor methods. Can also be added to the getMethods.
😵💫
@hoary scarab can you figure out why this test is failing?
class HomosexualityTest
@Test
void test() {
final var o = new Object();
assertTrue(new Object[]{o}.equals(new Object[]{o}));
}
}
also theres no way of doing setAccessible
so you're fucked if you need to access non-public methods... which is one of the main points of reflection
but let's say i copy the code and add that, because im a kind heart
now what?
Pretty sure you asked about it before and I added it
Probably too stupid right now to figure out why that is a really bad idea
damn
my gift of prophecy is on fire today
thank god we've got 2 versions of the same code to maintain
@spiral prairie take a look at this
if ur still stuck, arrays have the same implementation of equals as Object
your mistake is doing whatever @Test is, we don't do that here
@hoary scarab ```java
static class Test {
public int blah() {
return 5;
}
}
System.out.println(ReflectionBase.instance()
.getMethod(Test.class, "blah")
.invoke(new Test()));
Shouldn't the hash code be the same on both of them?
your mother
Ok sad
oh this is nice, i have to pass the same object twice!
oh also setAccessible isn't fixed in the multi either lmao
it's only fixed in ReflectField*
theyll never be the same, Constructor.getParameterTypes() returns an defensively-cloned array
Yeah about the example you sent
lmao
rookie error
So you can't invoke a method with no paramters? I'll look into that. The lib might be behind from my testing.
Will also add the accessible to the methods that need it.
You can’t ever distinguish a specific overload
you need to call invoke(null) at least right?
No
Shouldn't have to
Yeah obviously it will fail bruh, YoU dIdNt PrOvIdE eNoUgH aRgUmEnTs
I provided too many arguments actually
Then provide the correct amount?
The point is that getMethod/invokeMethod only ever returns the first overload
So you’re fucked if there are multiple
Cool
Plus like I said, setAccessible is still non-existent in most of the classes
He'll work on that mitten, haven't you heard him?
Legit convinced this hasn’t been tested / used at all
It has. But for specific use case only
only convinced?
be more confident
Then stop sending it everywhere
Nah lol
If you haven't tested it in 50% of all usages
alright man
don’t worry bro I’ll be there to make sure people dont use it
until it actually works, at least
And the example usage is whats been used (the correct code though untill I rewrite it)
mhm.
😭😭😭😭
I hope one day Yapper goes like and says, well, i learned that i have many things ahead of me to become a proficient developer including git and gradle/maven and a proper repository in addition to proper programming patterns and OOP
yeah that xD
nah man that’s never happening
not with this mindset
ChatGPT could have written a better library
Let's try
Mitten wanna quickly write a prompt?
Damn same
Oh rip
gimme a minute
Maybe Yapper can write one
Perhaps
I'll even give the proompter the honor of GPT 4
wow
Soy anybody up for the challenge?
Well
im on desktop now
Cool
If that fits your needs then its good. Also, I think the cache is not exactly cleared after the time expires.
https://imgur.com/a/UlYj6ep
Hello, I am the one who had this problem, I realized that in the itemsadder if I see the objects, but not in this menu, do I have to change the custom model data?
Yes
Ill try it with gpt4 lets see
Per player caches ig, smth like a Table
odd
yeah only on cleanup call or when read ocassionally
i dont find other solutions to what i needed
You might need to be logged in Sparky
the other was a class and save expire time as long 
face with spiral eyes

If it fits your usecase? For what is it
I wonder if you can use smth like a CacheKey(UUID, String) as key and keep only one cache that expires after 30s
So Cache<CacheKey, String> or w/e
@icy shadow
Asked it to make use of generics
Haven't looked at the code
aha
now we're getting somewhere
thats a lot more useful
just a lil bit of almost type-safety
None of the custom items I put are visible in the deluxemenus.
Read the topic of the channel
yeah probably want #general-plugins
Anything else GPT should add?
type safety for methods would be nice, but probably tricky
could at least make it safe in the return type
probably not the arguments
without 255 different subclasses
sorry
at least it doesn't handle errors by returning this
if thats even called error handling
😋
to be fair this is just as bad
wait no it's not
the gpt3.5 one was
result type could be cute
i'd probably just wrap in RuntimeException but that's not much better
my shitty version essentially this did the same
actually nvm it had its own versions of the exceptions that were unchecked
maybe caching? the lookups can be pretty slow
Yup
Just pasted your messages
God I hate this paste
Hm?
It is not suitable for mobile, it goes in edit mode at the slighest touch
shame because it's the nicest looking by far
https://pasty.lus.pm/
What you think bout this?
Not ours but probably yappers
Time to release this using gradle and go my repo
Hi, im using ProtocolLib, i want to clear nodes in ClientboundCommandsPacket, problem is that there is nothing like getNodes method in PacketContainer, what can i do about that?? is there any work-around??? maybe there is easy way that i dont see. problem is that there is no ProtocolLib's discord server or anything so i cant ask them.
And spam everybody
syntax highlighting is a bit shit
hai
good plan
That should be fairly interesting, shouldn't it?
After I published my GPTReflectionUrinal obv
Could just contribute to pastes instead
ChatGPT can't really do that easily without pasting all classes
You can contribute, I like it
I wish luko just added a way to disable the editing
Not as much as it could but
cant gpt4 read webpages? could send it the github
Lol
Nop
Have tried gaslighting it into thinking it can, but even with dan it can't
Can't take a job I don't have 😉
that's where Copilot Chat comes in
that ting is inzane
Shii yeah
been using it for a while
How do I get it
I love how it sees all the context of your project
I have normal Copilot

