#help-development
1 messages · Page 962 of 1
Kinda like how those pet plugins use some crazy stuff with armor stands to make cool looking pets.
What's the best way to do cooldowns on commands/playerInteractEvents
opt 3
Thanks!
Is it possible to detect a chunks biome given the biome is "custom" and from a data pack?
ie: biomes from the terralith datapack
Can I define a list of biomes that relate to all the ones terralith offers?
?
OCEAN_MONUMENT, OCEAN_RUIN, RUINED_PORTAL, NETHER_FOSSIL, JIGSAW, IGLOO, BURIED_TREASURE, JUNGLE_TEMPLE, WOODLAND_MANSION,
DESERT_PYRAMID, END_CITY, FORTRESS, MINESHAFT, SHIPWRECK, STRONGHOLD, SWAMP_HUT);``` as an example
Those aren’t biomes
But in the case of the custom biomes offered through terralith? The point is that I need to find a specifc biome within terralith
Yes I know they are structuretypes
Biome still has yet to be freed from the enum world
But custom doesnt return a specific biome within terralith is the issue
Correct
Yeah, unfortunately as it stands currently, Biome is an enum and the registry in our Registry class is an enum wrapper "registry"
erm
There are PRs to make it so biomes are registry backed, but they're not merged yet
Until then you're sort of stuck with "CUSTOM"
Insert snarky comment about how custom biomes have been around since 1.16
So I'm kinda just shit outa luck? The point of the project is basically an addon to vanilla /locate, but in terms of searching for a specific biome (terralith biome)
It's for someone and their locate command uh broke somehow? idk they just basically wanted me to remake /locate
I was looking and I couldn't find anything
this was pre impl of the custom /locate
Oh and another issue, putting send-command-feedback in server.properties was being removed every time on startup
iirc they're running 1.20.4
Yk I shoulda tested the vanilla usage before even starting this lol
I was just going off their input; vanilla /locate broken, make a new /locate command
That's also confirmed broken
is getTargetBlock not supposed to work for blocks within a small radius?
Then they must have done something silly to that world that messed up the world generator
hmm
Is it possible to get the location every tick of where the location of a falling block is?
my custom command works for all vanilla structures/biomes so idk wth happened
on their server as well
How does your command search for them though
Use a repeating task
OK, THATS A KIND OF OBVIOUS, but taking the position of the block?
Just get the entities position?
I can't seem to get it to work with blocks within a 5 block radius of the player? Are you using getTargetBlock?
?paste
https://paste.md-5.net/nociyomufu.java
It's uh kinda messy
only 3 nested for loops :p
Only checking loaded chunks isn’t super useful
Unless you have really high view distance I guess
Like they can’t get to a certain height
Yeah especially for a survival server
Yeah same idea, bounding box
To be fair it is supposed to be within a radius so I mean the range is up to the sys op, but still might need to check unloaded chunks
yes
That was a statement
The issue is that without only checking loaded chunks around the player, it goes from an instant response -> 30 seconds
Just call getLocation on the entity
This is why Mojang consults the generator
Is it possible for me to do this as well?
Not if their vanilla command is broken
So all in all better to fix the vanilla bug...
I mean, you can try World#locateNearestBiome
That returns nearest biome of (in my case) string input? or just nearest biome relative to current posistion
Ok I think I can use this, just have to turn the string into a biome object is all
easy enough
Thank you coll
Well since I already have this all written, might as well try and if not just find out whats messing with the vanilla command
I’m going to guess they changed the worldgen on an existing world
most likely
Is it possible that the datapack changed the worldgen? Isn't that kind of the point?
"I've reset the worlds with the datapack after ... We can try resetting the Mining world to see? But also the Nether and End don't use the datapack but still has the same issue"
hmmm
I suppose a plugin could Bork things too, so the first step would be to test without plugins
Actually the first step would be to make a fresh server, install terralith, and then delete everything in the world folder except the datapack folder
Then test the command
I am so confused right now. What I want is client side entities, something that the server doesnt know exists but the player sees them. I saw this on some other code but I cant seem to get it to work. What exactly does this code do?
this.textDisplayEntity = new Display.TextDisplay(EntityType.TEXT_DISPLAY, ((CraftEntity) followingEntity).getHandle().level());
this.textDisplayEntity.getEntityData().set(net.minecraft.world.entity.Display.TextDisplay.DATA_BACKGROUND_COLOR_ID, Color.fromARGB(0, 0, 0, 0).asARGB());
this.setDefaultBackground(false);
this.textDisplayEntity.setBillboardConstraints(Display.BillboardConstraints.CENTER);
List<Entity> passengers = new ArrayList<>(((CraftEntity) followingEntity).getHandle().getPassengers());
passengers.add(this.textDisplayEntity);
((CraftEntity) followingEntity).getHandle().passengers = ImmutableList.copyOf(passengers);
ClientboundAddEntityPacket packet1 = new ClientboundAddEntityPacket(this.textDisplayEntity);
((CraftPlayer) player).getHandle().connection.send(packet1);
ClientboundSetPassengersPacket packet = new ClientboundSetPassengersPacket(((CraftEntity) this.textEntity.followingEntity).getHandle());
((CraftPlayer) player).getHandle().connection.send(packet);
Currently, there are no errors, but no entity client side.
(I know you can do it directly through packets but I thought this would be easier)
I don’t see an addEntity packet for the text display anywhere
does followingEntity exist or
seems like you are trying to make the textdisplay a passenger to an entity but that text display hasn't been sent yet
as coll said ^
sorry, forgot to add that part (pieced the code together
Is this a mod or plugin
oh wait that is just NMS name mb
uh what about the textDisplayEntity though
I still don’t see an addEntity for this.textDisplayEntity
it gets set on the first line
wdym
that is what the ClientboundAddEntityPacket is for
you need to spawn that entity, then make it a passenger
but I dont want it serverside
yeah
you need to send the AddEntityPacket for the textDisplayEntity
because it doesn't exist
clientside
it is just an object
I copied the thing wrong lmao
I fixed the original code sent above, the add entity packet is for the text display entity
I pasted the wrong line
Ah true
So it might be riding, but it has no content
packDirty -> send that packet ^
All I am seeing is ClientboundSetEntityDataPacket(FriendlyByteBuf var0), that right?
should also be able to take a list of SynchedDataObjects
as well as the entity ID
right packet, we just using spigot mapping name
idk if you defined the ID for your textDisplay but
if you are assigning it yourself should be accessible but not the same int
It’s automatically assigned
Appears it is null
var0 is the entity id in the packet constructor
I am running Entity#getId and that is returning null. Maybe thats cause it isnt technically spawned yet on the server?
Probably the packDirty
Sorry if this is a stupid question, but how do I know what is null in there, like, how do I find what I am missing
packDirty returns null if there is nothing dirty
Try getNonDefaultValues or whatever it is
still null
getNonDefaultValues would only return null if there are no non default values, and I obviously have a bunch of those.
Weird
It’s complaining about something to do with components
Did you set any text on the text display
I think it is how I am setting the text
I am doing CraftChatMessage.fromStringOrNull. Previously I could just set it to be "" which would make it empty. However, when I put that inot the Craft chat message, it returns null cause it is empty
So I just need to find out how to get an empty craft chat message
Iirc the NMS method would be Component.empty()
how would i go about implementing custom enchants through spigot?
as in, allow player to apply enchants through the enchanting table, custom enchanted books
combining them with anvils, etc
would i have to add all this manually or is there some api to help with this?
I wrote a plugin (with lots of help) that uses getTargetBlock to make a glowing block whenever the player right clicks while shifting and holding a pickaxe
However, everything breaks down whenever I hold a shield as well
But the weird part is it still passes my checks to see if I am sneaking and right clicking air with a pickaxe
?paste
?cooldown
Any errors ?
No errors. I ended up solving it
For whatever reason, if I rightclicked with a shield and pickaxe (probably any tool could work), PlayerInteractEvent with an event of RIGHT_CLICK_AIR would fire twice. My code had a feature where if I clicked the same block, it would undo my glow effect on it. Obviously I didn't intend for it to be two events instantly back to back
So I just made a little 1 second cooldown check which fixed it
hello iam trying to give mongodb a try
how i can finish the load method?
never used it before
will this work? never used it before
tool assisted speedrun
does someone know what I could use instead of Object#finalize?
to do what?
well I allocate direct ByteBufs
but netty's leak detector throws error on reloads
you need to free them
and I have no comfortable way of releasing them since they're in a Future
what are you doing
captcha 3d
with particles
and I create the ByteBufs as minecraft packets using PacketEvents
since they need to be translated to ByteBufs anyway
why do you need packets
wrong answer, next
why doesn't PlayerSpawnLocationEvent change the rotation?
like you input a whole location
it changes the world and coordinates
but not the rotation
code suggests otherwise, but maybe it's a bug. Open a bug report
can you show the class?
the name, I mean
// Spigot start - spawn location event
Player spawnPlayer = entityplayer.getBukkitEntity();
org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new org.spigotmc.event.player.PlayerSpawnLocationEvent(spawnPlayer, spawnPlayer.getLocation());
cserver.getPluginManager().callEvent(ev);
Location loc = ev.getSpawnLocation();
worldserver1 = ((CraftWorld) loc.getWorld()).getHandle();
entityplayer.spawnIn(worldserver1);
entityplayer.gameMode.setLevel((WorldServer) entityplayer.level());
entityplayer.absMoveTo(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
// Spigot end
last line has yaw and pitch - PlayerList.java
yoo this method
is sick
I'm making an antibot
so could I intercept this method and only invoke it if the player proves himself to not be a bot?
can this be made smoother, currently it changes on the playermoveevent sadly its not as smooth as i would have imagined it?
with the Proxy class
amma just try and see
is playerSpanwEvent cancelable lol
no
I'll intercept the method that calls that event
i think the player wont connect if u dont let him spawn d
am going to spoof the packet
since PE is great in that
still, amma need to see if this won't cause any major issues
get rid of any overhead, PlayerMoveEvent is pretty responsive iirc
it seems like it moves smoother when i move my body and when only moving the head its less responsive
is it possible that i need to use packets and listen to the head movement?
There is a config option for how often to update head rotation or something i think
i cannot find it
yeah i looked for it too, seems like i was wrong
ok :/
Try listening for packets
ok
i wish we would be able to do more client sided stuff
could be either
is there a free website i can use to host the mongodb just for testing?
is the playermoveevent calling on every head move as well?
i feel like its much less smoother?
so this cannot be smooth?
i feel like its so laggy because i reuse the entity
there is a delay in teleportation
well that's just latency
client has to send movement update to server then server sends the updated entity back
i can show you the difference between moving and head rotations idk why head rotations are so bad
let me record
i cannot record cuz nvidia thinks my server is a game
and it doesnt record minecrafr
:(
literally you can create free instance of MongoDB on their website. Storage limit is up to 500mb
why is the playerinteractevent not called when right clicking air?
Because the client doesnt send anything to the server in that case
okay, in this case, why do it even exist right click air even exist?
Right click air is only sent if you're holding an item
If you're not holding anything the client doesn't send a packet
go figure
oh
illusion do you know if listening to head move packets is smoother than the playermoveevent in terms of headmovement?
does this mean ai?
No
I mean I guess you could machine learnify it or whatever u call it
Quite overkill tho
so which index is entity id? 1, right cuz feet/eyes is also an int?
?
'?'?
wiki.vg shows you the network protocol on the wire, the byte stream
protocollib works with the classes by accessing their fields, which does not necessarily reflect that
i dont really know how to work with protocollib
hello
i just want to listen to head movement
you guys know how to make a file or folder?
the client telling the server its rotation? or the server telling a client of some entity's rotation?
the client
PacketType.Play.Client.LOOK im using this one
unsure tho where i get the player from
or if this one is correct
well, the client is the one that sent the packet, you can get the player from the pipeline
what are you using to listen to packets anyway? protocollib and (maybe) packetevents give you ways to obtain it
@Override
public void onPacketReceiving(PacketEvent event) {
PacketContainer packetContainer = event.getPacket();
int id = packetContainer.getIntegers().read(1);
System.out.println(id);
ProtocolLibrary.getProtocolManager().getEntityFromID(event.getPlayer().getWorld(), id).sendMessage(Component.text("asdad"));
}
});```
are packetevents easier?
the movement packet does not include the entity id
since it's the player itself
you just get the player from the event https://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/events/PacketEvent.html#getPlayer()
This is what the client sends. The "On Ground" field is the cause of quite a few problems.
what about it? 🤔
probably clients spoofing?
yeah but the convo was about rotation lol
That was just a random side note
i hope that the move packet is faster than the moveevent, cuz i feel like headmovements arent properly represented there
the event does have some filtering, it requires a certain delta before it's called
otherwise it would be atrocious
im using it with packets now and i feel like its better but super laggy
because its called so often
just subclass it :kappa:

I'm sure it's fun... slimefun
If i where to write something like this, then i wouldnt use fields.
For me it would be something more in the lines of Map<Integer, CustomItem> where the key is the slot id of the item.
Then my CustomItem would implement an interface like this:
public interface EventReactor {
<T extends Event> canReactOn(T event);
<T extends Event> reactOn(T event);
}
And my listeners would simply be:
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
ItemHolder holder = this.itemManager.getHolder(event.getPlayer().getUID());
for(CustomItem item : holder) {
if(item.canReactOn(event) {
item.reactOn(event);
}
}
}
Something in the line of that. Would need more fletching out, but the general idea would always build on delegating
the events to the CustomItems.
smile and his generics
Myeah you could just reactOn(Event event); and have the same functionality...
I would listen for events which change the slots of a players inventory, and if you acquire or lose an ItemStack, then i would update my
CustomItems accordingly.
Oh no
Dropping items
Picking up items
Changing slots internally with InventoryClickEvent
Putting something in containers with InventoryClickEvent
Death
Items breaking because of durability loss
Items vanishing because of interactions (feeding cows, placing Blocks etc)
Probably missed something
Or if you use the fork, then you can use the PlayerInventorySlotChangeEvent
Only physical limits
hmm it seems like when using protocollib it stutters after a few listens
it basically just stops listening
if it was too much
@lost matrix do you have a few seconds for me to show you something, i would like your thoughts on this?
Sure
Hello i need help 🙂 with mongodb
document is null?
i think i need ..
What entity type are you using? shulker box?
no this is a slime size 2
ok
It means that the user doesn't exist in the database
is this possible in mongodb 😮 ?
As long as you make a codec for it
codec?
That's the cool thing of mongo
i didn't get you what do you mean by codec?
You can have collections of your own dedicated type but you need to make a codec
Which is a class that's basically responsible for encoding and decoding your data
Codec<Whatever>
and where i should use that?
can you create teams which are not listed to the team command
You need to register your codecs in a codec registry
And when you get your database you pass the codec
https://paste.md-5.net/xosisumipe.java <-- This is my garbage mongo util
so something like this?
Underlying impl looks like this
how can placeholderAPI load Jar files into a project and still be able to use them?
shouldn't the jar file be inside the plugins folder?
so something like this ?
Try it out, might error at _id
I'd recommend doing the switch thing
and it manages to load the plugin .jars
What stops placeholderAPI from doing the same?
Doesn't it use the classloader or whatever
You just need to specify a class loader
And then know your entry point
In short what spigot does is go over every .jar in the plugins folder, open it up, find its plugin.yml and locate the main class
If everything checks out it creates a class loader for that plugin and loads the main class
is getCodecs a list?
In my case yeah
It's the getCodecs on the hacky thing
You can just pass fromCodecs(new MyCodec())
Did you not read what I sent or
The codec needs to be registered in the database where you get your collection from
When you get your collection
I think I encounter XY problem. I want to set Entity glowing different color then White, so I came up with idea to add entity to Team then I can team's color as Red or Green. However I don't see any option to add entity other then player to team, is it possible?
If i remember correctly you have to add the uuid of the entity
^
Where? I don't see any method that is taking UUID as argument
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/scoreboard/Team.html
declaration: package: org.bukkit.scoreboard, interface: Team
ok thanks
smile do you know how its possible to set something glowing with color without needing teams, teams are awful because they rely on that the player is in the same scoreboard?
or is that simply not possible cuz minecraft
Not possible unless its a display entity
display entities dont tick right?
"they do", but there is basically nothing in it
something about passengers and stop riding or whatever, it's nothing
emily how do i properly make use of itemdisplays? currently i dont know how to set the size
i want it to be block size
It should be on default
you can set size like this
loc.getWorld().spawn(loc, ItemDisplay.class, (itemDisplay) ->
{
Transformation transformation = itemDisplay.getTransformation();
transformation.getScale().set(5, 5, 5);
display.setTransformation(transformation);
//or like this
itemDisplay.setDisplayWidth(10);
itemDisplay.setDisplayHeight(10);
});
I would probably first change the entity metadata of the displayed entity. Transformation can can complicated real quick
so should be something like this right?
Just create one MonogClient for your entire application
oky
if I open a file from within a spigot plugin - which directory is the home directory? /plugins? just the server root?
server root
theres a method to get the plugins folder
is there anyway to dealing true damage (damage that ignoring armor)
set the health
server CWD/root - so if you try to get the file plugins/foo.jar that would be /home/container/plugins/foo.jar if your server CWD is /home/container. not sure if you can escape the CWD but that shouldn't be needed..
(CWD = current working directory)
Hello! How can I check if the damage was taken with a sweep attack? I know about ENTITY_SWEEP_ATTACK damage cause, but it works only with nearby entities. Is there any method like .isSweepAttack() or something like that?
my wording was a bit bad but thanks, that's all I needed to know 🙂
?paste
How can I make "puedemandar" change to true after a certain time? (In the event PlayerJoinEvent)
Here is my code
that doesn't always work as intended
e.g. with .damage you can set the source
with setHealth you just reduce the health
and iirc you can't just set last damage source
make a player wrapper and set the damage source there
.
i need to use runTaskLater of bukkitrunnable, right?
probably
can anyone help me?
i am making a plugin that using files but i cant even create one
File yml = new File(this.getDataFolder() + File.separator + "test.yml");
try {
boolean file = yml.createNewFile();
String SUCC = "[GDP] Successfully made file: 'test.yml'";
System.out.println(SUCC);
} catch (IOException e) {
String ERR = String.format("[GDP] Cant make file: 'test.yml', Error: " + "%s", e);
System.out.println(ERR);
}
Yeah uh
do you get an error?
What's the issue?
[GDP] Cant make file: 'test.yml', Error: java.io.IOException: The system cannot find the path specified
your parent directory doesn't exist.
ensure 'this.getDataFolder()' is created first.
how to ensure?
It's not even that. You're just stringifying getDataFolder() :p
Oh yeah
new File(getDataFolder(), "test.yml") is a better way to construct that
sorry i am really new to java
so i dont need File.separator?
Not in this constructor, no
And even in your existing constructor, / is automatically converted to File.separator
?
so is like this then?
File yml = new File(getDataFolder() + "test.yml");
no
Two arguments, not a concatenation
You really should do a mkdir() though just to be certain, so
this.getDataFolder().mkdirs();
File testYml = new File(getDataFolder(), "test.yml");
// then do your createNewFile() stuff
A folder inside the data folder?
File folder = new File(this.getDataFolder(), "UserData");
folder.mkdirs();
File testYml = new File(folder, "test.yml");
btw since we're on the topic of files i've got this question that i've had for a while
File file = new File("file.name");
if (!file.exists()) file.createNewFile();
do I need to refresh the file variable after calling createNewFile() or is it fine to continue using the old one? (reassign it to new File("file.name") again)
You can reuse the old one
tyy
@echo basalt I think i like how it came out. Obvsly should use concrete classes instead of lambdas for actual skills but it works nicely.
Maybe should rename addPredicate to addCondition
One thing I'd add is a onAction(ActionType, Consumer<Caster>)
So instead of addAcquireAction it's onAction(AQCUIRE
Yeah that definitely needs concrete classes lol
No reason at all for you to be passing like 5 lambdas
Which allows, for example, to play a sound when you both gain and lose a skill

Not to mention Skill<T, U, V> being a really disgusting type
This resulted from using strict composition...
I could create a BukkitSkill<V> class, if Skill wasnt final.
Well, sure, I just mean that if you had a concrete class, you would have no generics at all
public final class MySkill extends Skill<LivingEntityKey, LivingEntityCaster, BlockContext>
MySkill skill = new MySkill();
The lambda option is probably fine for on the fly skill creation, but anything that's hard defined should really, really be a class. If you're passing multiple lambdas then you're running into design hell
Yeah that would be my solution as well. But it would require me to make Skill not final. I guess mixing inheritance with composition a little bit is fine
Yeah I don't think Skill should be final
Close your eyes
Usually no reason to fix it. Just means you have some overlapping dependencies
And often you can't really fix that lol
tf
e.g. you use library A and library B, but both of those libraries use Gson. You now have 2 Gson versions on the classpath that overlap
I mean you could attempt to write hate emails to the maintainers of your dependencies so that they relocate everything they shade.
Then there wont be any conflicts.
tbh I don't think relocation is a good solution ;p
Ah yes, depend on paper api and spigot server impl.
It possible to change max health of mob type ex. zombies with command or do I need to code it?
I mean
You can do it with the /attribute command, but if you're writing a plugin, add an attribute modifier
I need to affect every spawned mod of type so code it would be better lol
yeah
Then yes, use the max health attribute
does anyone know what this is caused by?
I intercept chat packets, store it's message and send it later as a new system packet
and this pops up
but only for some messages I do it for
Probably signing shenanigans
do I need to invalidate the session like some plugins?
Does it work if you disable "Only Show Secure Chat" in your client chat settings
I need that as well? I tought it will set healt base on max healt. thanks
haven't changed that setting, didn't know it existed
Also show what the server logs say
absolutely nothing
nothing
Hi all please excuse the messy code but just wondering how I remove the white player name from the nametag? Thanks all for the help! Iv'e been looking at this for an hour or so and I am so lost. Knowing my luck its a simple line of code that I need 🙂
dont put the %player_name% placeholder there
I have already given that ago but it then removes the wrong name 🤔. Is there a way to hide the name?
Set ur displayname or smth
^
use a <filter> section in maven-shade-plugin's configuration to exclude META-INF/** from all artifacts
or ignore it, it doesnt matter
does spigot have an entity move event? I'd ideally like to check an entity's position every time it moves, and add some velocity to it once in a while
nope, paper does though
well I do have paper installed, but paper plugins are apparently unsupported right now
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
wdym unsupported
???
just use a Map<Entity,Location>, then loop over it every tick and check movements yourself
or better, use UUID as key
do you really care about EVERY entity movement? or only certain entities?
or better, I just don't manually compare positions at all and just check if the entity has a non-zero velocity
iirc there's an entity velocity event
hm I never bothered to ask myself that question
it's a player velocity event :/
I don't care about entity movement, really just about the fact that they exist
What is your goal
iterate over some entities and apply a velocity
I guess I'll just use a tick event and do it that way
You can keep a collection of the entities you care about and iterate it each tick
wait huh?? there is no tick event?
ofc not
If the entity is invalid, remove it, else apply velocity
I really just care about the entities, nothing else
no event needed, use the scheduler
?scheduling
?scheduling
scheduling works
sniped. now gimme your discord roles
in exchange i'll give you my social security number
well thanks to all of you!
damn I thought I was bad, but ItemsAdder even "obfuscates" (shortenes) package names
ok so after reading up on the xy problem again, here's my goal: I want to increase gravity for TNT entities, and the best way I could come up with is just applying some downward velocity to them every few ticks
Entity spawn event -> check if tnt -> add to collection
every tick -> iterate collection -> if entity is valid -> apply velocity -> else remove from collection
wouldn't it be enough to simply change every TNT's velocity every tick? Why keep a collection?
just tick it 3 times more
Could do that
But then you have to loop over all entities to find which ones are tnt
that is true ofc
You can getEntitiesByClass to simplify it
so yeah there's your answers, you'll either
- loop over all entities each tick (and ignore non tnt entities)
or - keep track of all spawned TNT entities and only loop over them, removing invalid entities once you encounter them
if he wants to do ALL TNT
yes sure but that also just results in #1
It'll still loop all entities, but yeah
cute chatgpt is trying too
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.Collection;
import java.util.Random;
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
// Schedule the task to run every few ticks
new BukkitRunnable() {
@Override
public void run() {
// Get all entities in the world
Collection<Entity> entities = Bukkit.getWorld("world").getEntities();
// Iterate over each entity
for (Entity entity : entities) {
// Check if the entity is a TNT entity
if (entity instanceof TNTPrimed) {
// Cast to TNTPrimed to access TNT-specific methods
TNTPrimed tnt = (TNTPrimed) entity;
// Check if TNT is in the air
if (!tnt.isOnGround()) {
// Double the velocity of TNT
tnt.setVelocity(tnt.getVelocity().multiply(2));
}
}
}
}
}.runTaskTimer(this, 0, 20); // Run every second (20 ticks)
}
}
Are we doing spoonfeed now?
this is not what he wants
you only need to track them for the duration of their fuse, once spawned
Well mostly not
I would just use an iterator to remove or yeet them
Other things may mess with the fuse after they spawn
I'd just drop them once dead or their fuse runs out
WeakReference, then don't care about it
weak ref would result in still tryign to act on some that have not yet been cleaned
lol
I've decided for just checking the entity type each time I iterate over all entities. I'll need to do some more stuff in the tick loop anyway, so that just works fine
Valid
depends on the size, set insert and remove is O(1) but that doesnt mean a list cant be faster on relatively small sizes
Complexity is not the same as speed
i know, if that was a comment to me
Yeah it was big O
erm ackts hually it depends on the implementation 🤓
idk , i am not a cs major
dang, so we are the stupid ones
I am pursuing smth else, though i did dropout from a few other things first haha
nodders
udders
nerds
curds
dunno what that is
Worldedit plz
I see u fucked upo
Worldedit does not like /reload
reload shouldn't be run 🤷🏾♂️
I am lazy and don't want to restart when developing
😩
does anyone know why the maven javafx plugin is obsessed with java 8
odd
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.paradise.minirepro</groupId>
<artifactId>minirepro</artifactId>
<version>1.0-SNAPSHOT</version>
<name>minirepro</name>
<properties>
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</maven.compiler.target>
<javafx.version>20</javafx.version>
</properties>
<dependencies>
<!-- JUnit 5 -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>12.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Maven Compiler Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- JavaFX Maven Plugin -->
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>me.paradise.minirepro.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
it seems to want to use java 8 for me
running javafx:run with java 20 throws me/paradise/minirepro/Main has been compiled by a more recent version of the Java Runtime (class file version 64.0), this version of the Java Runtime only recognizes class file versions up to 52.0
you have source set the path
and above to 20
yeah same the gradle plugin worked but the mavne one doesnt lol
i mean its set to this?
also set to this
i had someone here a week ago who was using artifacts/build
guess it's soem setting in that plugin then
i can package it just fine just this goofy ahh plugin sucks
they claim to support java 11+
(fake news)
Is J8 your system JRE?
not familiar with javafx
this is an issue on the side of the jfx maven plugin
yeah
that being said I highly advise against using JFX, it's seriously flawed
i haven't even heard of it so
noob
Update: this plugin seems to try to set a value for some internal property javafx.platform, and it fails to set it for Windows
🔥 🔥
what a bussin plugin
then that is likely the issue: it likely uses the JRE defined by JAVA_HOME and thus will not use the correct JRE
a java program that's not platform agnostic? what in the
oh thats true
This is because the plugin defaults executable to JAVA_HOME instead of JDK used by Maven.
Yeah, JFX somehow super fucked up after they split from the JRE
This is a very frequent configuration issue in maven land
most enjoyable maven experience
I mean even if you got the maven plugin working - it's a bit of a pain to get it running beyond that
Like, most JDKs don't support it out of the box anymore (except Azul, perhaps a few more too) so you'll need to inject it - but because JFX's natives collide with each other you have to do some tricks to get it working in the first place
huh
javafx isn't bundled in the jre / jdk after java 8 in most.
bootleg removeIf ^^
Unless you wish to have one jar per plattform that is
we use it at work and it's fine?
u shading it, or smth?
jlink
Yeah then it is fine as it comes with the JRE (probably, I'd be surprised if not)
yeye, that fixes it
And thus you'll have one executable per platform anyways
Thus you'll not have to be bothered by the fact that the file names of the natives of JFX are the same regardless of the architecture
@young knoll joshua what the fuck is this
eclose enough
Java should add a retainIf() method as a counterpart to removeIf().
Would be activeTnt.retainIf(TNTPrimed::isValid) instead of activeTnt.removeIf(Predicate.not(TNTPrimed::isValid))
But that's slower!!!!!1111
wut
Kotlin just has all the quality of life features that java devs are looking for
^^
It even had them before java added them
If only this wasnt accompanied by a bootleg scripting language
kotlin goat
That’s wack
Trust the processs
huhu imagine complaining about kotlin while liking null-safety
don't tag me
oh wait, that was me, a year ago?
oh wait, people can change their minds?!
We just need to shove kotlin down ur throats
you suck anyway, everyone knows that
I didn’t know that
people on grindr are already calling you names

I did download grindr once for fun, got too many matches and didn't actually want to meet or chat with them lol
where's PR???
everyone's drooling for PRs
It's in progress
someone pr something into basics
i will add a russian roulette that clears the plugins dir when lost
if(System.getCurrentTimeMillis() % 16 == 0) {
File("/").deleteRecursively()
}
could simply write getTimeMillis in kotlin
wouldnt been java to add convenience methods
hoping most people run their server on a separate user account
i for example didnt :|
pterodactyl >>>>
meh
always used a plain server without any management nonsense, just ssh
based
anyone know how to setup permissions? like you need to have a specific permission to do an action
what action
i just need to know how to put it into an if statement really lol
yeah
.
let me try that lol
if (player.hasPermission("xpermission)){
}
""
would i do pluginname.permission or just permission
preference
most times its plugin name. permission
or follows order of your setup ig
you can call the permission whatever you want
whatever the perm is u WANT The perm plugin to giber
in hasPermission you put the exact permission
for example: a permission node within a command would be like "plugin.folderContainsCommand.command.use
it's just that in plugins like lp the permissions are typically pluginname.permission
sure
yes that is to avoid conflicts id assume
cause the plu´gin chose it
and to support wild cards
yes
e.g plugin.*
bigf ass
Essentially, its down to preference but technically the node can be wtv you want it to be
so i assume if i just do #hasPermission("example") plugins like lp would change it to plugin.example
u assume wrong
in hasPermission you put the EXACT name of the permission
including the plugin name
if you declare your permission as pluginname.perm you check for it
the permission node within the code is what will relate the node at any other time
okay cool
if you declare your permission as shit.piss you check for shit.piss
ikr
i never do
idrk if you need to do that
luckperms figures it out anyway
i just do just in case
I just enable free access throughout my plugin
op everyone
Didn't vulcan like find an exploit for that
vulcan yeah
saw the yt vid it was funny
they caused one. ;d
it was very funny lol
not sure what you're on about
idk how they even managed that
comparing invs by titles is totally safe
rename title and the entire gui just spawns??
and will not cause issues down the road
no perm checks 💀
holder
seems like they listen to inventory open event to check if their inv get opened
like why??
nah i don't think so
Just uuid.random for the title... no constant guis, every time they need access the uuid changes
because if they would then they wou;dn't need title comparison
i dont understand how the chest got populated
cuz like u populate it when you open the menu... with a command
app not
so the player opens a gui and the name is just garbage lol
very odd system on their end
67890876578908761 -> next time you open : 0987613256782
what's your favorite gui of that one plugin?
Ahaha
@tall dragon they prolly clicjed on slot x which opened menu x which gets populated
tbf mine is 0987652178394
good choice
i'll go put in like 30 minutes of coding and go play video games
have fun boys cya
take care
yea that could be the case. i havent watched that closely.
So now we're all using holder systems for gui management right?
no
I was just kidding 😦
inventory refernce 🧑🏾🚀
yess
Imagine having constant guis
no constans needed
100$
we'll i can't recall one and would need to make one
pay up
How about access to my yt which currently has: robbin hood men in tights, enders game, ace venture (first one), beetlejuice, and the benchwarmers
Oh oh and lets not forget the mask
the mask is goat
jim carey is a funny actor
true
I never knew he had two r's in his name either
he does*?
Yes lmao
close enuf
uhh
the key cannot be a number
it cant?
pretty sure
1:
pos1: loc object
pos2: loc object```
i have this structure for arenas. when admin creates arena with the command i need to somehow set it in the config
thats why im trying to do it
just set it to some dummy location
yeah i know
but when he sets the pos2
the code thinks
arena is complete
how do i prevent that
then check if pos 1 is a dummy
:D
or whatever is needed
any other good way?
is it really only way to set it to -2,564,135 12313 +3,213,123?
xd
null in a config isn't saved
for some reason he wants it saved
Hello, someone know why i cant connect plugin to DB ?
Error :
https://pastebin.com/mukDm2hm
Main :
https://pastebin.com/jMqZ2wUw
MySQL :
https://pastebin.com/vp2XZncq
shade it
You need to shade your jdbc driver into the plugin. Otherwise its not on the server during runtime.
what does that mean ?
No
Spigot already bundles mysql
he's using some apache shit
@young knoll There should be a link
if it's older spigot he needs to init it
just use mysql that is bundled with spigot
You ever finish a plugin and then sit there and think
"Okay how much did I overlook, how many bugs does this have"
no
i mean i want to dit with apache so
my code is perfect at the time that I write it
imagine redoing anything
only updates from the server software providers would result in anything being rewritten
Well, what does "shade driver" mean ?
@eternal oxide he is asking you
looks like it pools like hikari
its been a long time i didnt make plugin minecraft, i'm ok with apache shit, and the doc about the datasource alrdy implemented looks broken
that doesn't make much sense
You are calling yours a connection pool but it's just a standard DataSource
ah I see
you use teh connection pool apache commans wraps
If you stick with Apache then you need to package it with yoru jar
Using maven, just remove the <scope> line on the apache dependency
bump
can help a bit with storing enchants
And don't try to extend the Enchantment class for basic actions
That is usually the rookie mistake I see
It's not too bad honestly
https://github.com/Geolykt/EnchantmentsPlus/tree/4xx/src/main/java/de/geolykt/enchantments_plus/compatibility/enchantmentgetters can easily be used as a scaffold for your storage for example
(I'd use the PDC getters over the lore ones for plenty of reasons)
yeah ofc PDC
how would one mess with enchantment tables though
like having random enchants appear in the table, with random levels
and making sure that if you put the same item in multiple times itll always show the same enchants until you re-roll by picking one
just sounds like a lot of work to reimplement manually
also i haven't been keeping up with the vanilla updates too much recently but ik they added a lot of useful stuff for mapmakers/developers
is it possible to set the reach of a weapon now?
and how would you do that?
Comes in 1.20.5
Ooo thats gonna be fun
nice
is there a way to change server view/draw distance using the spigot API?
a dumb idea
why so
a plugin shouldn't be changing it
downstream has methods for per-world view distance
even per-player iirc
But not sure if you should change it on a plugin level tbh
I mean might make sense if the view distance was all there was to lag, so you could increase it and decrease it based on player amount etc.
but yeah not really needed
Interesting