#help-development
1 messages · Page 803 of 1
You gotta use the exact class it is in for getDeclaredField to be used
yeah
hrm
You should also be caching the field
honestly method handles would be nice here
No need
I've barely ever done this side of things before
so I'm a bit clueless
so I've got CraftEntity then?
get the handle and walk the super classes until you find the field
craftentity implements entity
not the nms type though no?
Hi , iam having an issuse :
iam trying to load WinEffect :
what iam doing wrong?
both of the WinEffects are in that path?
you're right, it's the bukkit version
sorry no hold on
I got twisted around
getHandle gets the nms entity
right, that makes more sense
so then I should be affecting the nms entity class
then why am I not accessing the field?
types. what?
You are going insane
You need to for loop the jar file and get those classes
Well
Ur not
A Zombie nms class is not the Entity nms class
Even if it inherits Entity
well yeah but I cast it to craftentity and get the handle
shouldn't that do the trick?
Internally minecraft also has seperate entity classes
You need to call getDeclaredMethod on the nms “Entity” class not nms “Zombie” class
@Override
public boolean setCustomHitbox(Entity entity, float width, float height, boolean fixed) {
if (entity == null) return false;
return Hitbox.setCustomHitbox(((CraftEntity) entity).getHandle(), width, height, fixed);
}
public static boolean setCustomHitbox(Entity entity, float width, float height, boolean fixed) {
EntityDimensions entityDimensions = new EntityDimensions(width, height, fixed);
Class<?> entityClass = entity.getClass();
try {
Field field = entityClass.getDeclaredField("be");
field.setAccessible(true);
field.set(entity, entityDimensions);
} catch (NoSuchFieldException e) {
e.printStackTrace();
return false;
} catch (IllegalAccessException e) {
e.printStackTrace();
return false;
}
entity.setBoundingBox(entityDimensions.makeBoundingBox(entity.position()));
return true;
}
Print entityClass
print what about it
The name will be fine
What the hell
Why are you getting the fields by name
The nms fields at that
Cause he can
He can't
because it's private
He can
Private fields
and I can
He’s getting the obfuscated name properly so now worries
Im doing this recipe and Im thinkig about best way to remove all 10 steak and coal from crafting inventory. Probably best way would be to cancel crafting event remove items and add crafted item to player inventory? 🤔 If I wont cancel event it will remove only 1 steak and 1 coal.
I'm using intellij, lookie here:
Yes
What are you coding for
You can change the version later in the pom
Don’t code for bukkit use spigot or smth else
It's either your Minecraft Development plugin is super outdated or something idk
this ^
why, bukkit is more efficient no?
No
No
Spigot is pretty much bukkit nowadays
i was aware it was practically the same thing but bukkit had more efficient method calls
not at all
damn it, it's cow
no one really PRs to spigot anymore outside of a few things like Components
makes sense
But regardless, if its giving me version 1.15.2
And I want to use 1.20.2
The Bukkit.java class still exists, not exclusively bukkit specific :>
And also CraftBukkit != Bukkit where CraftBukkit is like the abstract layer and Bukkit is the impl (AFAIK!!!! Might be the other way around!)
Just change it in the pom
After creating the porject
Do I just change it to :
1.20.2-R0.1-SNAPSHOT
Yea
in the pom.xml
it gives me an error tho
Reload the pom
thanks I was thinking if there is some esieast without canceling event and looks like is not
It gives you the error because 1.20.2 is not yet in your local m2 repository
After reloading it'll be downloaded
Nah it makes perfect sense
It does not automatically know when you're done typing your new dependency, or version, or whatever
fr iirc there is a setting to change that would auto-install it
I'm just a little used to visual studio
Oh I wasn't aware
You see what i mean now?
VSC auto downloads too
Never used it for Java😄
its my second favorite java IDE
yeah, I thought the handle would force it
so how do I bypass this?
if they made teh autocomplete faster I would switch back in a heartbeat
Ur already using nms
So just Entity.class
I'll carry on coding gl everybody 🙂
or just walk the superclasses
but I'm using set (entity, entitydimensions)wont' that cause problems because the entity is extended?
no it'd be fine considering that you'd be providing it an instance of Entity
Grats
yeah it would be very impressive had it worked lol
I take that back, it's sort of working
I am guessing mojang has a weird hitbox system
great, so it works for dealing damage to me but it doesn't work for dealing damage to it nor does it seem to change the radius at which entities push
weird then that the only one working is the client sided one
time to delve into the source
wish me luck
Dealing damage to it is calculated client side
so... raytracing?
and custom aabb collision checks
I think that might be the only solution
fun
Alternatively tell versions below 1.19.4 to get screwed and use an interaction entity
I'm doing a hybrid anyhow
what's an interaction entity actually
that's the one with the configurable hitbox?
yes
is that what it was called? couldn't remember it earlier
ah yeah
seems legit
neat
is this a good way to do something?
storage.
ConfigStorageImpl (interface)
FileConfigStorage (impl ConfigStorageImpl)
ConfigStorage (wraps, caches, and provides async for the ConfigStorageImpl)
Is it possible to teleport an entity with a player as Passenger somehow?
no, have to dismount and mount again after
is it possible to force a plugin to start first?
Why
how change jar name without affecting the inner class only visually
like plugin-bukkit-1.0.0.jar
Patch the jar
Or do mixins
Or run some asm jar prior to server start
im making a plugin that syncs files, i dont want other plugins to modify stuff before mine
Pretty sure spigot has loadbefore just put every plugin in that list 
Is there a way to detect when a player's inventory is updated (not just with pickup/drop and etc) without having to check every tick / every few ticks?
No
why do you need that
dupe prevention
Im making a plugin that turns small fireballs into regular ones, and for some reason, my fireballs are all going in the southern direction. If anyone knows why, please help me 🙏
@EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent event) {
Entity projectile = event.getEntity();
if (projectile instanceof SmallFireball) {
SmallFireball smallFireball = (SmallFireball) projectile;
Location location = smallFireball.getLocation();
Vector velocity = smallFireball.getVelocity();
Fireball fireball = location.getWorld().spawn(location, Fireball.class);
fireball.setVelocity(velocity);
smallFireball.remove();
}
}
}
maybe try normalizing the velocity vector
im not sure why its not working
try cloning the smallfireball velocity, removing the smallfireball, and then spawning the large one a tick later
maybe they're interfering with eachother someway somehow
dont think normalizing would work though
normalizing would ensure the magnitude is 1 so it's the same direction, it depends if its always going in one direction or going "southern" to his perspective.
it would affect the speed of the fireball though
the direction will be the same regardless of normalizing or not
good point, yeah probably cloning the original's projectile applying it to the new fireball and removing the old one may fix it.
hi does anyone know if chunk tickets are persistent even after a restart?
figured it out, turns out that repeatly copy and pasting the velocity and giving it to the fireball does wonders
the ol beating into submission tactic
why would it produce null?
Because sql will always be null
?
ohnoes
You declared a variable named sql but never assigned a value to it.
This means your variable will always contain a pointer to null
okay whatever will this work
asList is immutable
Depends on what you expect this code to do
idk what it means
I wonder why
I want for loop with sql statements
and fire them one after another
does bungee have a subchannel for command execution?
no
guess i'll have to make a bridge
there are a few pre-defined actions is all
sad
just read
NoClassDefFound => No class was found
but for what?
me.grimek.rpg.utility.db.ConnectionManager
Did u overwrite the plugin whilst the server was running
the class is literally there
it cannot find that class!
why? idk probably just need to debug
maybe loading order
This ^
no lol
I built plugin
and then enabled server
Immuntablity means that you cannot change the value. in this case, you cannot add any more elements.
https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html
This Java tutorial describes exceptions, basic input/output, concurrency, regular expressions, and the platform environment
then load order
I think it’s 1 plugin spleed
isn't he using an api or smthng
Show the constrcutor of your RPG class
ooh damn i tought he was using an api
yoo smile pretty cool to see u discord helper instead of just having the server boost
xd

He's a slave now
Build and try again, run the server with a spigot jar
He's got the collar and everything
Did you initialize fields in your class?
everything as is
^
its never been a problem
and making those fields private, ik they are already by default but i would prefer to see them written
well it CAN be tho
fresh startup your server
My bet is you did update with the server running and forgot
and bam I cant use this shit in onDisable
its literally inside onEnable method
Cause he just copy pasted all of it into onEnable
oh
bro just change the scope of those fields?
yep moved all fields to method variables
like bring them out without initialization
You obvls still have to declare the fields in your class, but you initialize them in your onEnable
and initialize inside the onEnable
still same
How do you “enable” ur server
Do you call Class.forName anywhere?
no
?paste
Ur main class
of course no
Which line is line 26
afaik InvalidPluginException shows up when the plugin.yml just dies
I'll ask but getting an answer may be difficult
Do you have any static class initializers?
ConnectionManager connectionManager = new ConnectionManager();
paste your class on the link provided by the bot
Declare your fields in your class but initialize them in your onEnable
?paste your ConnectionManager class
We want the main one too
his main likely wont help
Doesnt matter.
You should always initialize in your onEnable.
Start there, and show us the updated exception (which will give us more insight)
It's a NCF exception which means updated while live (wrong class loader, or there was an exception while loading the class, static error
Which will be revealed to us after he starts initializing in his onEnable
probably not
it just throws a NCF if a static initializer/field errors while loading
If its still a NoClassDefFoundError then he either has a cyclic static reference, or an exception was thrown in a
static initializer
yep
I'm guessing he has a static reference to RPG in his ConnectionManager
which is exploding
does anyone know how to stop 2 minecarts from coliding?
@EventHandler
public void onEntityCollision(VehicleEntityCollisionEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Player && event.getVehicle() instanceof Minecart) {
event.setCancelled(true);
}
}```
Two tracks 💪🏻
I wrote this code but it doesnt work
haha
Make one of em do a sick jump
Xplode them. Cant collide if its blown up
you want them to pass through each other?
Collision is hard coded in nms.
Probably only throgh a custom minecart nms implementation.
yes
oh no really
probably only able through a resourcepack model as using the built in minecarts in any way will have client side issues
even as a custom entity
💀
theres no way its not possible...
Let us know if you find a way 🙂
but you can change the collision of players so why cant you with minecarts??
how would i store a chunk?, im trying to set a chunk to air, and when the player enters another command, it gets set back to default.
3d block array?
or material array
or idk
a 3d array could work
ye
I would like to be given a block that cannot be placed, without nms. How can I do it?
Get a Snapshot of the Chunk
how would i do that?
ChunkSnapshot snapshot = chunk.getSnapshot();
I see nothing wrong in the code you posted
I'd not make your RPG class final
Could you please screenshot your top of class with package and everything?
Yeah, you are not stopping your server
Uh oh. I think he has two plugins which depend on each other without telling us
Is he using the reload command? I sure hope he is not!
anyone?
one of those errors was from onDisable, the other was onEnable so you replaced jar while server was running and did a reload
in both instances I get the exception
xd
I dont think spigot has an api for the canBePlaced tag.
In that case: Just add a PDC tag to your item and check the BlockPlaceEvent
Yo so I accidentally installed some maven dependancy on my intellij and now its causing errors, how do I remove it?
[ERROR] Failed to execute goal on project HeeseTroll: Could not resolve dependencies for project org.heesetroll:HeeseTroll:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.bukkit:bukkit:jar:1.20.1-R0.1-SNAPSHOT (absent): org.bukkit:bukkit:jar:1.20.1-R0.1-SNAPSHOT was not found in https://repo.papermc.io/repository/maven-public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of papermc-repo has elapsed or updates are forced
You have two plugins, right? And one depends on the other.
how do i do that?
Discord text wont be enough to explain the full extend of this undergoing
I removed them
I had 2 more, in fact
I dont fucking get it
Alright, you are probably copying one of your plugins into another. This causes the classloader to get confused.
?paste your pom
Lets hope he is not building artifacts
i basically want minecarts that go in opposite directions to go past eachother
Did you add any dependency to your project, outside of using the pom.xml?
did you manually add any libraries to your project?
List the steps you take in order to compile your plugin
I cant explain it better than with those pictures lol
I just click a button and it compiles
also how could I get the block the player is looking at? whats the method for what
I get this all the time but it never bothered me cuz plugin always worked
Elgarl he is building artifacts and probably has jars added to the project by hand. You resolve this, i just got home after 10h of uni.
🙂
Show a screenshot of your project structure with your dependencies/libraries entry expanded
expand external libraries
looks fine
right side of screen expand the mavem window (m)
Might want to not shade Lombok
on the other note, deleting any of those might have caused this perhaps?
ah yes slot index -5
just saying thats the only thing Ive done recently between opening projects
i dont think my gui lib completely works
nope
like that?
😶
oh just provided
xdddddddddddddd
on the other note
this warning is not there anymore
open your plugins jar with any archiver and see if your ConnectionManager class is in there
else throw your jar in here
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.BlockIterator;
import org.bukkit.util.RayTraceResult;
public class LightningSword extends JavaPlugin implements Listener{
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
player.sendMessage("test");
if(player.hasPermission("heese.lightningsword")) {
if (event.getAction().name().contains("LEFT")) {
player.sendMessage("test");
if (player.getInventory().getItemInMainHand().getType() == Material.GOLDEN_SWORD) {
// Get the block the player is looking at with infinite range
Location targetLocation = (Location) player.getTargetBlock(null, 100);
player.getWorld().strikeLightning(targetLocation);
player.sendMessage("test");
}
}
}
}
// Helper method to get the target location based on player's line of sight
}
``` What did I do wrong? why is my event not firing? And yes I did register the event in the main class ```getServer().getPluginManager().registerEvents(this, this);```
Send the entire class in a paste
okay for future
?paste
how do I rename packages safely
both of them?
depends on IDE, but mine is rightclick and select rename/refactor
well that was the entire LightningSword class, but heres the main one https://paste.md-5.net/jufejedama.java
._.
That would be the problem
bro wtf
hm?
wtf is this
you can't extend everything with javaplugin lol
and how did i cause this with the bukkit api
Rip
you tried to add the same listener instance twice for teh same plugin
what do I extend it with then
how can i can disable this from sending? https://iraz.insane.rip/📸/69akvq0u.png
It's a listener so all you need is to implement listener
are you sure?
i dont see any bukkit related
methods
thats what the error says
also do register the events on the listener and not your main class
hi guys its very important i need this done ASAP
is it posibble to have runTaskTimer and BukkitTask at the same time?
this is a good point
updated plugin, nothing still runs
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.BlockIterator;
import org.bukkit.util.RayTraceResult;
public class LightningSword implements Listener{
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
player.sendMessage("test");
if(player.hasPermission("heese.lightningsword")) {
if (event.getAction().name().contains("LEFT")) {
player.sendMessage("test");
if (player.getInventory().getItemInMainHand().getType() == Material.GOLDEN_SWORD) {
// Get the block the player is looking at with infinite range
Location targetLocation = (Location) player.getTargetBlock(null, 100);
player.getWorld().strikeLightning(targetLocation);
player.sendMessage("test");
}
}
}
}
// Helper method to get the target location based on player's line of sight
}
but it is 1.8 😛
the "test" messages dont get sent
Why
Well did you register the listener like I told you
ig this might be it
i have a plugin where every 30 seconds it spawn an whiter skeleton on an nether brick but when i destroy the block it keeps spawning, i have to fix that ASAP
That’s an easy issue to fix, but if you want us to guide you. Share your code in
?paste
so I put the onEnable in the LightningStrike class...? How do I register the events without the onEnable method
done
or how should i share my code with that?
i pasted my code in there and pressed save
Then copy url and post it here
copy the link it gives here, after clicking save
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
No, the second param of the register events method is the listener
yea
I would take a look at BukkitRunnable
No
no?
but can i use it tho even if i have runTaskTimer?
BukkitRunnable instead of ur scheduler line
Ignore me it's correct
Ok thanks
but i want them to spawn every 30 secs
Yes?
30 * 20
and if i break the block it stops
Okay
i had to remove it temporarily from my server bc of that issue
yeah I found the exact issue
refactoring the name from db to DB didnt change package name inside plugin
all package names should be lower case anyway
You need a swift kick 🙂
?paste
Just smth like this, had bing write it for you
block.getLocation()
Here is a possible way to rewrite the spigot event to spawn a bukkitrunnable that checks the placed block is netherbricks in the nether, if so spawn a wither skeleton on top, every 30 seconds. The task rechecks before running if the block is still a netherbrick, if not it cancels itself and returns:
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
Block block = event.getBlock();
World world = block.getWorld();
if (block.getType() == Material.NETHER_BRICKS && world.getEnvironment() == World.Environment.NETHER) {
BukkitTask task = new BukkitRunnable() {
@Override
public void run() {
if (block.getType() == Material.NETHER_BRICKS) {
world.spawnEntity(block.getLocation().add(0,1,0), EntityType.WITHER_SKELETON);
} else {
this.cancel();
return;
}
}
}.runTaskTimer(this, 200l, 600l);
}
}```
and it will respawn the whiter skeleton infinitly until the block is brocken?
Yes
no
Sortof
ill try it
// Get the block the player is looking at with infinite range
Location targetLocation = (Location) player.getTargetBlock(null, 100);
player.getWorld().strikeLightning(targetLocation);
}```
seems this part specifically doesnt work, any ideas why?
Restarts and reloads = no
Ohh woops
Well atleast it gave him a BukkitTask this time he can interact with
how do i get a text from the book opened by Player#openBook()
yep
What are you studying?
Fix the amount of indentation
how
Ok I fixed it
I renamed them
well your smartassness was actually helpful thanks
how can i can disable this from sending? https://iraz.insane.rip/📸/69akvq0u.png
np, I help trolls now and then
Just started*
do you really think that a troll would work with plugins for over a month now just to piss you off?
😭
I may not be the smartest
um use paste not some random site that looks like it's going to hack me
but god damn
It's e-z.host, use a vpn if you want
I'll send a normal screenie
!verify
Usage: !verify <forums username>
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
!verify iRazvan2745
Rate limited. Please try again later.
wha
i just needs embed perms
Engineering. Almost done and in jan ill start with CS
https://iraz.insane.rip/📸/n1t41n18.png this is litterally the code
just simple console on start
why... dont you just send paste
what are you trying to stop sending?
I CANT
the Paper nag message?
?paste
Are you leaning to build robots? Or what exactly is being teaxhed in engineering?
i have my own paste
good for u
ok
We don’t want pictures thank you
oh okay, sory
yeah you are seeing teh Paper nag message
wdym?
not a Spigot thing, but use the Plugin logger instead of sysout
in your main class, getLogger()
ohhh
so getLogger().info("blah");
Idk if this is allowed, but here we go.
https://www.spigotmc.org/threads/script-on-rightclick-on-entity-not-working.626773/
this is skript
Yeah we don;t do Skript here
Yea, i dont see any skript-channels, so i thought all 'development' were in here
awh
Its a deviation of electrical engineering with more emphasis on computer science. Im in the machine learning branch.
We learn a ton of things. Designing analog and integrated circuits. Micro and nano electronics. Power electronics.
Automation and robotics. Systems engineering. Programming. Machine learning and visual computing. Digital signal processing.
Transmission and antenna technology. And ofc a ton of math.
,gg/skript
ask there
I believe they have their own discord
oh, okay. Thanks
yeah no one here uses it so we spit on those dweebs
ByteSkript >
Heyho,
Can I Spawn a Pillager with Banner that gives me Bad Omen?
Because why would you touch skript if you could just write some java? 🙂
Are Kody Simpson's plugin tutorials good? so i dont waste my time
they are ok
yes
thanks for helping me use logger
sysout is ok for dev work, but you should use the logger
everyone used sysout until Paper added a nag a year or so back
im making this plugin for simple stuff, and just jave fun with it
hello i have a big problem with world edit
I mean i still use Log4J on the old server i join /s
when i create a schematic with the command, and i past It, the schematic is cut in half, even if the schematic is correct
can you help me?
I think only patrol leaders have banners, right?
yea
Then set him as patrol leader 🙂
declaration: package: org.bukkit.entity, interface: Raider
Metadata is 🤮
Show the method in which you load the schematic
anyone can help me please? it's very important
tyyy
yeah, One minute
If it doesnt work im gonna blame you even tho I was the Person who didnt knew it in the first place okey? ❤️
Sure 👍
you spoke italian? so I can make myself understood better @lost matrix
no scusa
English only channel
Okay not problem
Wait is this a coding related issue?
welp didnt work
Blamed
Show some code plox
how?
?code
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
brain afking
?paste
So, wich the wand i select the bordere of the build, After i made the command //expand and After /schem save {name_schem}, so After i go to the Place when i can Place che build and i made the command /schem load {name_schem}, but After loading the build is cut, so the upper part is not glued @lost matrix
private void spawnRaiders(Location location) {
new BukkitRunnable() {
@Override
public void run() {
for (int n = 0; n < 3; n++) {
for (int i = 0; i < 15; i++) {
Pillager pillager = (Pillager) location.getWorld().spawnEntity(location, EntityType.PILLAGER);
pillager.setPatrolLeader(true);
pillager.setCanJoinRaid(false);
}
for (int i = 0; i < 3; i++) {
location.getWorld().spawnEntity(location, EntityType.VINDICATOR);
}
for (int i = 0; i < 5; i++ ) {
location.getWorld().spawnEntity(location, EntityType.WITCH);
}
}
}
}.runTaskLater(Main.instance, 20);
}
15 raid leaders nice
yea Im trying to make a Plugin wich simulates Raid Farms
Ah i see. Please refer to #help-server or the worldedit discord. This channel is called #help-development because we help resolve development related problems. 👍
ah okay i'm so Sorry
Try spawning the pillager with the callback spawn method and set its property there
sorry but I dont know what you mean by callback spawn method
location.getWorld().spawn(location, Pillager.class, pillager -> {
pillager.setCanJoinRaid(false);
pillager.setPatrolLeader(true);
});
Is it possible to cancel a player opening his own inventory?
The server sadly has no idea when a player opens his own inventory
okay, thanks for the quick response :)
in theory yes, but in practice no 🤣🤣🤣
?
perhaps I used a term that we only use in Italy, forget it
Still not
hmhm
Maybe they need to be part of a Raid for this to work
The random spawns aren’t part of a raid
was it maybe an Illager
Would it be possible to listen for the advancement that occurs when a player opens his inv for the first time, then redirect the player to a bukkit made inv and then close it and reset the advancements?
(To stop players from opening their inventory?)
anyone can help me in #help-server ?
yep Illegar are the guys
I think so?
People did that ages ago
ok
.
Wonder what could be done with that
you could use e to interact with stuff
Could do a fully custom inventory
yeah
Although you’d still have to sync it with the real inv
the question is can you disable the advancement popups?
those would be ugly to See everytime
Sad times haha
client would probably get annoyed with toast messages
yeah you woudl probably need a texture pack
You can just make a new advancement
With no toast
At least I think you can remove toasts
I'd assume it'd be harder to untoast than toast bread 🤷♂️
Nah you just gotta get a fancy conveyer toaster like they have at hotels
And then run it through backwards
Give this man a nobel prize
world peace through toast
Better than world toast through peace
that's how my command to spawn custom mobs with custom max health, type and name looks like as for now, ill add spawn location and such later, but does that look okay so far? EntityPDC is method from static class to assign PDC to entity so that I dont have to write namespaced key etc. everytime, and Im using SQLite database's cache map that's taken on server enable to look for information
tl;dr asking how does it look like in terms of code
basically taking needed statistics from here
I'd put the spawning logic on your enemy stats class
by the way, is this an okay method of spawning custom enemy?
¯_(ツ)_/¯
oh yeah something is inherently wrong with my plugin
whenever I rename package to something that was used earlier but isnt present
lets say I had "PlayerStats", deleted it and made new "playerstats" in plugin.jar the directory playerstats is all the time written as "PlayerStats"
How do you build your project
I need a way to delete stacks of items from an inventory. The problem is that I have to eliminate 9 stacks, but if the player has 18 stacks I remove 18, if he has 17, I remove 9, so to speak. How can I do? Someone help me I'm running out
Just remove (currentCount / 9) * 9
((currentCount/9) * 9 ) = currentCount
What
cant you divide by 9 and convert the value to an int, so the decimals are gone?
That expression is not lvalue
after taht you * 9
mathematically
Exactly what I wrote
I told you formula
With that, you get amount yo want to remove
9 / 9 = 1 * 9 = 9, it's changend nothing
workwolf
.
That means you want to remove 9 items
.
If you have 17
17 / 9 = 1 * 9 still 9
So you again remove 9
That is what you wrote
Just make newAmount be (preAmount/9)*9
yes
what do you want to do @brazen badge
.
Man I literally told you what to do
and I do that
sounds mildly concerning not gonna lie
ah sigsegv in java
ah yes the most understandabe
show code
how did you get a sigsegv in java
i dont know but
i can replicate it
now
I smell memory fuckery
i love memory fuckery
i'm trying to run an exe through the runtime exec
using the wine thing
and things arent going to plan
[179.361s][warning][os] Loading hsdis library failed
um
i see what you did, newAmount should be preAmount - (preAmount/9)*9
thats going to be zero if preAmount is 9
and it should
k
is that what u wanted ?
nop
:(
final var removeCount = 9 * 64;
while(inventory.contains(Material.WHEAT, removeCount)) { // If the inventory has at least 9 * 64 wheat
var total = 0;
int first = 0;
while((first = inventory.first(Material.WHEAT)) != -1 && total < removeCount) {
var item = inventory.getItem(first);
var toRemove = Math.max(Math.min(item.getAmount(), removeCount - total), 0);
var newAmount = item.getAmount() - toRemove;
if(newAmount <= 0) {
inventory.clear(first);
} else {
item.setAmount(newAmount);
}
total += toRemove;
}
}
```Slightly over-engineered piece of code
show us your code
its literally just Runtime.getRuntime().exec(..) atm
with a path
i tried the wine thing and its a WIP so i reverted my changes
and now whenever i even run it normally
i get a fatal error
thats it
I need a way to delete stacks of items from an inventory. The problem is that I have to eliminate 9 stacks, but if the player has 18 stacks I remove 18, if he has 17, I remove 9, so to speak. How can I do? Someone help me I'm running out
@brazen badge according to this, you said you want to remove only amount dividable by 9 , is that not true ?
and in inventory is?..
inventory is the player's inventory
Player#getInventory
how can I get all primary keys from table and put them into a list?
you're using the deprecated version of exec
map.getKeys().stream().toList() is the convenient way
if you need performance just do it by hand
it worked beforehand, also providing the 3 params for the directory and the filename does the same thing
as i'm not using any special commands
but yes i'm going to just do some tests
oh, yes, true
myabe ill go sleep and forget about my problems
I mean I need to get primary keys from SQL database
there is only one primary key per table
all values that are under primary keys
oh dear
or like get amount of rows of database
Hey
npnp
Can you detect key presses on a gui
not really?
Eg. When user hovers an item and presses Q. Is that client side
If Q is the drop button, then no
that is server-side
(I mean the client removes the item, then tells the server to drop it)
Yeah so I need to cancel it and just remove an item from that specific gui
yep
yep, there's a DROP action which also has a slot
if the slot is -999 it means they picked up an item and dropped it from the edge of the screen
Awesome
I had done that, if that were the case it would have caused another error but anyway, I corrected it.
select count(primaryKeyColumn) from table
that is amount of them
is SQLite language just SQL essentially?
It is SQL
there are some minor differences, if u are referring to mysql
with differences
for example autoincrement or on conflict clause
that is just on top of my head, there are probably more
auto increment is in base SQL iirc
sqlite use AUTOINCREMENT while in mysql its AUTO_INCREMENT
ah
HI orange man
Hello. Any ideas how I could define a section of blocks which can include a lot of different shapes, not only squares? I tried using VoxelShapes but that seems weird. I also want it to be able to check if a player is inside it
Look at polygons and checking if a point is in a poligon
well I'd just like to start with a simple solution which can do it efficiently
not some custom algorithms that take 100000s to process, just simple collide checks
Yeah, point in polygon is pretty straight forward
isn't there some built-in boundingbox or aabb stuff which I could use?
BoundingBox is a class
yes
You can use that
I can make a BoundingBox out of just a square of blocks right?
do I just make my own impl. and write some algorithm to check if it collides with the boundingbox of a player?
I mean, that would make it hella inefficient but may do the job
No, bounding box has a contains method
You can make a bounding box from two xyz coords
well then I only check against one boundingbox each
I gotta iterate through all and then .contains(playerBox)
well but if multiple boxes may intersect, that would cause issues
if it intersects with multiple, then it may trigger two
so I gotta write methods to prevent that one I guess?
alright, thanks, I'll try to look into it
anyone has experience with JFrame who can give me a small hand? Because im trying to apply colors but they get broken when i try to move them
im adding 2 panels, with 2 colors o nthem
Mhm
Can i send cap?
Sure
This is one
now i want to put another color on it, to emulate a navigation bar with a darker color
hmnn
How?
I try adding another panel to it, but doesnt seem to apply the color correctly
Thats how looks when trying to add another color with another panel
You want one panel with a layout and then set the other panel to anchor top
I forgot the layout though
what is the difference between contains and overlaps in BoundingBox?
yes, that. How can i do that?
I cant find info about it, because Java interface libraries are too shity
Overlaps is contains but BoundingBox
#setLayout on the JPanel
Lemme get it for you
allright really thanks and sorry for taking your time
both has BoundingBox as an arg
This Swing Java Tutorial describes developing graphical user interfaces (GUIs) for applications and applets using Swing components
Your IDE can probs allow you to control+click the method to see the difference
ah I see the difference
contains only triggers if it specially contains it, so yeah if for example the target would be bigger it would not trigger
Really thanks, but now they are all together the sections im trying to addd
?paste
any writting or reading operation to a database has to be async, thats what i learnt
Because both of them (writting and reading) are blocking operations
Should be fine but do check how long your queries take
Depends which type you want to use. In memory db doesnt necessarily mean in memory of same application that needs it lol
Also depending on your data you might not be able to hold it in memory only.
That’s completely erroneous to assume, as frost said, in-mem DB doesn’t mean it uses the same memory as ur main app
Does anyone know if there is any way to hide holograms when a player is x blocks away from the DecentHolograms plugin?
if i put a second nametag on an entity and make the real one invisible
will it fly higher
or on the hight the real one would be
?tas
thought someone might know
dont wanna code for 20 minutes if i can just ask
Setting stuff as passenger is like 4 lines including spawning, an extra line to make one of them invis
Lazy smh
is that really an insult towards a dev?
Is there a show/hide api method from DecentHolograms? I'm making a plugin and I want so that the holograms hides and shows when a player is x blocks near the hologram or away from it.
Idk go look at their documentation
Why dont you go look at the resource page for it
They might even have a discord as is the case with plugins these days
Cant seem to find it. Thats why I'm asking in case that I missed it
Thats true, I'll see if they have one
Top result when i googled
Its even open source with a link to repo
😑
They have a wiki and discord server too
I know, but I looked into it. I forgot that they had a discord server, and I already asked there. I looked into the open source, but couldn't find anything, so I just wanted to ask to make sure, so chill man. Its just a question.
Hi . uhh iam wondering what would be the best database type to load a significnt amount of data for the player?
for example :
- Solo:
- kills
- deaths
- Double:
- kills
- deaths
- cosmetics:
- maybe selected Cosmetic?
- selected kit
- selected win dance
- selected kill effect
- maybe selected Cosmetic?
I think if you want to store a lot of data mysql databases are going to be the best choice
alright
You should probably Cache the data too
allot of data and code :p
no just let me know if iam doing somthing wrong
so for the stats i have an idea :
a HashMap :
- SoloStats map
- Double Stats map
with methods to add stats like
swUser.getSoloStats().put("kills", resultSet.getInt("solo_kills")
swUser.getDoublesStats().put("kills",resultSet.getInt("doubles_kills"));
ok how csn i help here?
oneblock plugin recommendations?
mb I missclicked
I think there is a really good ressource on how to worl with data by 7smile7
what do you think about this?
i can do soloStats.get(uuid).get("soloKills").var it will send the solo kills
Why not make map out or UUID and Data Access Object?
That way you can mash both datatypes together
i dont get what do you mean?
Class with setters and getters
And make hash map <UUID, ThisClass>
bro gave us arrows
Idk why youd separate it like that
You saving the class object to the player roght?
yeah
I might be wrong but cant you just Set the values in the clsss without a hashmap
You are saving to object so the numberd should remaim
swdata.getkills() which just Returns the int?
yeah
I dont know it has any benefits tho
If you wamt to use a map you can, i dont think you need to tho
its alr
for some reason only the first player who joins the server his data will be loaded?
There is no reason for that if, just call put regardless
how might I enable this get the threads within spigot, and not whatever its doing right now?
ThreadFinder threadFinder = new ThreadFinder();
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
ThreadInfo[] threadInfos = threadFinder.getThreads()
.map(thread -> threadMXBean.getThreadInfo(thread.getId(), Integer.MAX_VALUE))
.filter(Objects::nonNull)
.toArray(ThreadInfo[]::new);
for(ThreadInfo threadInfo : threadInfos) {
MessageUtil.send(commandSender, threadInfo.getThreadName());
}```
public final class ThreadFinder {
private static final ThreadGroup ROOT_THREAD_GROUP;
static {
ThreadGroup rootGroup = Thread.currentThread().getThreadGroup();
ThreadGroup parentGroup;
while ((parentGroup = rootGroup.getParent()) != null) {
rootGroup = parentGroup;
}
ROOT_THREAD_GROUP = rootGroup;
}
// cache the approx active count at the time of construction.
// the usages of this class are likely to be somewhat short-lived, so it's good
// enough to just cache a value on init.
private int approxActiveCount = ROOT_THREAD_GROUP.activeCount();
/**
* Gets a stream of all known active threads.
*
* @return a stream of threads
*/
public Stream<Thread> getThreads() {
Thread[] threads = new Thread[this.approxActiveCount + 10]; // +10 to allow a bit of growth for newly created threads
int len;
while ((len = ROOT_THREAD_GROUP.enumerate(threads, true)) == threads.length) {
threads = new Thread[threads.length * 2];
}
this.approxActiveCount = len;
return Arrays.stream(threads, 0, len);
}
}```
the result is this https://paste.md-5.net/aweyicemar.md
but its not actually returning all the threads in spigot
something that a spark profile would yield?
how might i actually get it to show spigot threads?
What exactly is the problem? I went through your screenshots looks fine
now it works
What was the issue
here was the error , it wasn't giving any null pointer ..
Here's another issue - there's no guarantee that the user data will be loaded by the time playerjoin is called
yeah what you can do is to create the player object on join with default values to then populate it with fresh data from the database, so you won't get nullpointers. You can do all of this on join asynchronously
Hi! I want to access method parameter names in my code. Therefore I need to use javac -parameters, as I have learned from StackOverflow. How can I integrate that setting into my run configuration? I'm using the maven goal package to build my jar
You can have a boolean or date value that keeps track of updates so you know when your data is still being fetched, when it's stale or when it's fresh
what?
?xy + it's hard to make out what you're trying to say
Asking about your attempted solution rather than your actual problem
sounds like you actually want to find/replace things like name and version when compiling, which Maven already supports with filtering resources.
So thats what I want to execute:
var routeWithParam = method.getParameterCount() > 0
? MessageFormat.format("{0}/<{1}>", route, method.getParameters()[0].getName())
: route;
```. However, now the ```method.getParameters()[0].getName()``` always returns arg0, because the name isn't present in the classfile (see java.lang.reflect.Parameter::isNamePresent). To get the name into the classfile and use it in my code, I need to compile with the -paramaters arg (see https://docs.oracle.com/javase/tutorial/reflect/member/methodparameterreflection.html). How can I integrate this parameter into my inteliJ run configuration or can I do something in the pom.xml?
It's a maven / InteliJ question
I think this explains how to do it
But honestly I think using annotations to describe your route segment is much more expressive than using the parameter name
not sure why you would want to do any of that in a plugin.
requires a custom compile which bloats your jar
Wuold you by chance be trying to reflect using arg names for nms?
That is exactly what he's doing
if so, you can';t do it that way
No I want to create a web framework 😂
Honestly annotate your parameter or your method when it adds to some kind of route, it is much more expressive and clearer when it comes to that. Most frameworks do it that way
Yeah I know, but my routes work a bit different, but thanks anyway :D
Set<Thread> threads = Thread.getAllStackTraces().keySet() @shadow zinc
thank you