#help-development
1 messages · Page 831 of 1
so no resourcepacks or mods? just plugin?
Yep
Just an API rn
Just gotta fix some things and get multi-versioned nms working
Cuz rn only works for 1.20.2
Fully vanilla
Nice
datapacks are an amazing thing
how can i convert ChatColor to Color?
bukkit or bungee chatcolor
org.bukkit.Color
that didn't answer the question
oh yeah
mb i read it wrong
org.bukkit.ChatColor
(want to set leather armor color based on chatcolor but it requires bukkit color)
You can convert bukkit ChatColor to Bungee ChatColor to Java Color to Bukkit Color
like this:
Color.fromRGB(color.asBungee().getColor().getRGB());
?
what would be a method to obtain the blocks that the block dropped in the blockbreakevent?
BlockDropItemEvent
Oh can I not get it from the blockbreakevent?
ok thx
The BlockDropItemEvent is usually better if it works with what you're trying to do
I think I did something wrong
its possible more than 1
it gives u either a list or a array
ah nvm its block but now I need a collection
it says to you what it should be used. Collection<ItemStack> 
Or if you want some """"extra"""" features, wrap the collection into a list List<ItemStack> items = new ArrayList<>(block.getDrops())
Use a LinkedHashMap over a normal HashMap every time where insertion is somewhat rare
It is much faster at iteration/access
oh interesting. Does it matter for <30 entries?
¯_(ツ)_/¯
I am talking larger maps
but generally if you need to loop over it use a Linked version of any collection
Also LinkedLists are faster for insertion because they don't need to resize
Oh, I kept reading "iteration" and was really confused why you thought they were faster
Yeah, faster for insertion lol
LinkedHashMap/LinkedHashSet is faster for iteration over a normal HashMap/HashSet
Yeah
around 50% faster
Out of context, thought you were comparing against ArrayLists, hence my confusion :p
fair enough
How to get player message from AsyncChatEvent?
declaration: package: org.bukkit.event.player, class: AsyncPlayerChatEvent
no getMessage()
i use paper(1.20.4)
?whereami
head.getValues(false)
Why am i getting an empty map from this
in the yml i have this value
head:
LEATHER_HELMET: "{display:{color:3949738}}"
little question, if i wanted to place a structure in the world at specific coordonates, 3 questions
1- how do i save the structure? like if i built it in single player how do i sace it
2- once the file is placed, how do i access the structure (the file is in the server files)
3- how do i place the structure
declaration: package: org.bukkit.structure, interface: Structure
i can put it where ever, i hand place it in the server file, where should i place it?
You can just load it as a datapack then
uh is the entire code rlly needed. The problem is isolated in that 1 single line of code
I guess we can't help you then
i want it to be in my code, before the world generates, and once i do a certain command, i places the structure
If you won't give us any information, there's nothing we can do
Then load your Structure https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/structure/StructureManager.html#loadStructure(java.io.InputStream)
declaration: package: org.bukkit.structure, interface: StructureManager
well that's some static abuse
lol
uh so why is it returning an empty map
so id use this? (and imagine its not null im just placing null here as a placeholder)
Yeah, just populate those fields correctly and yes it will place it in the world
Think of Structure#place() like a structure block in-game
init structure with "null"?
once again, read what i wrote please
"and imagine its not null im just placing null here as a placeholder"
what version are you making the plugin for
1.20.2
anyone?
IJ probably doesn't find a method called place without any arguments
since it doesn't exist
tried with arguments , still the same
what import are you using
There are like three Structure types
what do int palette and float integrity do?
0 and 1.0
docs are useful for that kind of stuff
palette- The palette index of the structure to use, starting at 0, or -1 to pick a random palette.
integrity- Determines how damaged the building should look by randomly skipping blocks to place. This value can range from 0 to 1. With 0 removing all blocks and 1 spawning the structure in pristine condition.
so would this do?
the world cannot be null as it is generated just above
oh and, if my file is here how would i get it?
is there any way to filter events that happened in certain bounding boxes? i know i could just add if check before every handler but that would make it pretty bloated
well i know i wanted to know if theres some preevent checker where i could place this if check
Just use an if statement
or implement your own layer between the event handler and your listener code
is that possible?
yea i did that
yes ofc
I am getting "java.io.EOFException" at this line:
Bukkit.getStructureManager().registerStructure(MoonHouseStructureKey, Bukkit.getStructureManager().loadStructure(getResource("moon_house.nbt")));
Because of "loadStructure()". Moon_house.nbt is a valid file
also do see what getResource returns
an InputStream and not null
already checked that
is that all?
yea
how can i do what the comment says i have spent all day trying to figure this out but nothing works...
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
public class PlayerInteractListener implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
Player player = event.getPlayer();
Block block = event.getClickedBlock();
/* wait 2 seconds if player is still holding the left
click button break the block and give the player 1 diamond */
}
}
}
i double cchecked and its only that
please held me
you can wait 2 seconds using BukkitRunnable but i dont think u can still check if he is breaking the block
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockDamageEvent.html
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockDamageAbortEvent.html
declaration: package: org.bukkit.event.block, class: BlockDamageEvent
declaration: package: org.bukkit.event.block, class: BlockDamageAbortEvent
that is what i need help with do you know somewere i can fighture this out
are u fucking kidding me
?scheduling
btw
i gave the player infinate mining fatuge
will those events still work @chrome beacon
Oh the blockdamageabortevent is something that i didnt knew of. Great to know!
Should work
triple checked and its only that
maybe i shouldnt store it as a resource?
uh good luck with that. We've all tried it at least once and failed
wait so @chrome beacon would i detect when a block is damaged then put the player in a variable then if they let go remove them from it and then when the timer runs out just do whatever
yeah
i think i can manage lol
going a bit insane
It's a massive project
but its fine
ik
should that work
yeah
but try not to keep a direct reference to the player
store the uuid and make sure to remove it when a player leaves the server
seems like storing structures in resources is a bad idea. I checked some open sources and they all used a custom structure file for it.
welp
that is what i ment
fuck java
honestly idk what else i would use
i just have java
hate*
What's wrong with Java?
nothing
boiler plate
eh makes things easy to read and follow
That'll come back to haunt you later
^
the problem is that its already begun
BUT IM ITALIAN
eat the spaghetti
bouta start speekin java
kk
ima try make a file
that is not spageti
@chrome beacon
mt ide says the abort event dosent exsist
uh oh
my*
What version are you making the plugin for
1.8
That event didn't exist 9 years ago
what dident
yeah
eh I really don't feel like messing with versions that old
why not
no point
wait what version do i need for the abort event
🤷♂️
how about 1.19.2
Same
I get you like the enter key, but you should atleast keep minecraft versions on the same line
just pray simple doesnt see this
that was an accidemnt mb
who dat
someone with a wife
ok
well
ima go update my plugin, wish me luck
@chrome beacon just a quick question, u said it was a big project, how long do u recon this is going to take me for the first like 1.0 update
Depends on what you want to include
Just to check, is it okay to give out UUIDs of players within my plugin (eg allow players to get the UUIDs of others they're online with)? I'm not 100% sure how they work.
Yes UUIDs are public information
is hitting a player counted as interaction?
Alright, cheers 👍
as in triggering the PlayerInteractEvent?
is there a way to get all the nearby entities in a sphere instead of a square?
seems like location.getWorld().getNearbyEntities() doesn't have an option for spheres
yes
yes
okay
or at least I think so
well it would make sense
get players in square and filter based on distance from center
how do i make my plugin not a legacy plugin now it has the yellow star next to it in /pl
gotcha
i'll go try it
set api-version in your plugin.yml
to 1.20
._.
i think i did do that
so you get bug fixes and support
ok so now my plugin is rad and dosent work
wtf
this is how it should be correct:
api-version: 1.19.4
version: '${project.version}'
main: uk.co.agwoo.zelrpg.ZelRPG
authors: [ agwoo ]
commands:
gamemode:
permission: ZelRPG.command.gamemode
aliases:
- gm
description: "Changes your gamemode."
gms:
permission: ZelRPG.command.gamemode.survival
description: "Changes your gamemode to survival."
gmc:
permission: ZelRPG.command.gamemode.creative
description: "Changes your gamemode to creative."
gma:
permission: ZelRPG.command.gamemode.adventure
description: "Changes your gamemode to adventure."
gmsp:
permission: ZelRPG.command.gamemode.spectator
description: "Changes your gamemode to spectator."
give:
permission: ZelRPG.command.give
description: "Gives you items."```
1.19 not 1.19.4
ok
yay fixed ty
Hi , iam making a big plugin and it have 2 moudle :
- lobby
- game
and i don't want to have 2 files of the same thing for example in lobby i would need to make :
kits.yml
and in the game module
i also need to have kits.yml
is there a better way ?
i was thinking about saving kits into mysql .
Hi i want to use WorldGuard dependency in my plugin but when i try to compile, maven says to me : cannot access com.sk89q.worldguard.WorldGuard
Could you send your pom
?paste
That's not your pom
You need WorldGuard bukkit
cannot access com.sk89q.worldguard.WorldGuard
How are you compiling your jar
using "package"
i have a quick question about Bukkit.getScheduler().scheduleSyncRepeatingTask()
so it has 4 arguments: a plugin, a runnable and 2 longs
what are those 2 longs for exactly?
one for the interval between each execution and one for the duration after the task will be start
ah i see
thank you
?scheduling
?jd-s
i can change player attak speed and range ?
Speed yes, range not yet
not yet mean can but not so easly?
but in creative range can be change
do you have an idea for my problem or not ? It's realy cursed
Try clean package
not work...
Isn't everything that is felt by another player programmed on the server? After all, the other player will take damage
i need more help
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockDamageAbortEvent;
import uk.co.agwoo.zelrpg.ZelRPG;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class BlockDamageListener implements Listener {
private Set<UUID> damagingPlayers = new HashSet<>();
@EventHandler
public void onBlockDamage(BlockDamageEvent event) {
// Add the player's UUID to the list
damagingPlayers.add(event.getPlayer().getUniqueId());
int delayTicks = 20;
Bukkit.getScheduler().runTaskLater(ZelRPG.getInstance(), () -> {
// Check if the player's UUID is still in the list after the delay
if (damagingPlayers.contains(event.getPlayer().getUniqueId())) {
// Break the block
event.getBlock().breakNaturally();
}
// Remove the player's UUID from the list
damagingPlayers.remove(event.getPlayer().getUniqueId());
}, delayTicks);
}
@EventHandler
public void onBlockDamageAbort(BlockDamageAbortEvent event) {
// Remove the player's UUID from the list if they stop damaging the block
damagingPlayers.remove(event.getPlayer().getUniqueId());
}
}
so basicly
if u hold it down
it dose break
but if u dont let go
and look at a block
then let og after
let go*
it breaks
Well you are breaking the block
but only before the first one breaks
so ofc that happens
can we call so i can show u
i dont think u understand
mind u nore do i
nor*
Well yeah that happens on ancient versions
im using 7.0.1
if an arrow has touched a block how can i get the block before it touched?
You're on 1.8
yes but for WorldEdit / Guard
Yeah but WorldEdit / Guard doesn't change what Minecraft version you're writing code for
but the problem come from my idea
so that class won't be available
the problem is that i cant compile my code because i "cannot access org.bukkit.block.data.BlockData"
can someone help me
thats what says maven when i try to compile
Yeah
Whats your problem ?
That class doesn't exist in 1.8
like this: i want to get location of the yellow cube(red is the arrow)
can i dm u
I'm using depedencies
?
The event is cancellable so it fires before it actually hits. The getHitBlock() method will give you the block (if it hit a block)
you want the block in front of the block that gets hit?
And the location of the arrow cant help u ? i mean if you world.getBlockAt(locationOfTheArrow)
yes
getHitBlock().getRelative(getHitBlockFace())
so basicaly i have this code:
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockDamageAbortEvent;
import uk.co.agwoo.zelrpg.ZelRPG;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class BlockDamageListener implements Listener {
private Set<UUID> damagingPlayers = new HashSet<>();
@EventHandler
public void onBlockDamage(BlockDamageEvent event) {
// Add the player's UUID to the list
damagingPlayers.add(event.getPlayer().getUniqueId());
int delayTicks = 20;
Bukkit.getScheduler().runTaskLater(ZelRPG.getInstance(), () -> {
// Check if the player's UUID is still in the list after the delay
if (damagingPlayers.contains(event.getPlayer().getUniqueId())) {
// Break the block
event.getBlock().breakNaturally();
}
// Remove the player's UUID from the list
damagingPlayers.remove(event.getPlayer().getUniqueId());
}, delayTicks);
}
@EventHandler
public void onBlockDamageAbort(BlockDamageAbortEvent event) {
// Remove the player's UUID from the list if they stop damaging the block
damagingPlayers.remove(event.getPlayer().getUniqueId());
}
}
but if your mining a block then look at another one strange this happen
i need to fix it
@chrome beacon please can u write an exsample im actualy so confused rn
also cancel the task
BukkitTask task = Bukkit.getScheduler().runTaskLater
and instead of private Set<UUID> damagingPlayers = new HashSet<>();
do a Map
Map<UUID, BukkitTask> map = new HashMap<>();
a what
A Map
wait so how do i cancel it
is there a way to make it so that the zombie entity being spawned wont be a baby zombie?
aside from Zombie#setbaby(false)
BukkitTask t = map.get(uuid);
if (t != null) t.cancel();
What's wrong with that method?
How can I resize a Firework Effect? I use "BALL" I want to make it smaller
because im not sure if the entity will be zombie and such
there's a lot of mobs that can be baby tho
so
i dont think manually checking them all would be feasible
Just check if it's a zombie???
If you want to prevent all baby mobs you can just check if it's Ageable
Check instanceof Ageable
please someone tell me how to cancel this
o
i see
?scheduling
btw is there a way to disable their natural drop
LootGenerateEvent
no were did that say how to cancel it
is there no property to disable it?
event.getDrops().clear();
OR
set their LootTable
to an empty one
dunno if it can be null
They do
under the section called Canceling a Task
Please read the page ._.
ok
i hope this works
@chrome beacon
not in a wired way
i love you
thanks for ur help
any ideas?
Using a database is fine for storing kits
Hello! Are any of you conducting tests for Spigot 1.8? If so, which library are you utilizing?
if i don't want to use a database , is there any alternative ways?
cuz with database [mysql] for example , admin can't edit the kits ..
and it will have to many connections ..
in game editor
?
have them edit kits in game
if you are talking about just storing the info and you dint want a databse, save them in a file
if you are talking about how admins or serv owners can set up the kits and stuff, most intuitive for them would be a way to configure it in like an ingame menu
but what is a module
so a module is a separate plugin?
game -> seprate plugin
lobby -> seprate plugin
and i add core in pom file of both game and lobby
cuz i need it in both places .
and the user should buy / select the kits in the lobby server
Are those two different servers?
yes
and it won't be only 1 game servers , it can be multiple like 15 game servers
and 2 lobbies for examples ..
This means you need to transfer data between them or have a shared location for data.
yes ,what is the best performant way to go with?
A database
storing kit information?
[name , price , slot , items]..?
the name , price , slot , are easy my problem is how would i store an actual items ..
ik using deserlizing and serlizing ..
but wouldn't it be allot of work doing that?
Its a decent amount of work for sure.
Is your concern the creation of new kits?
Because admins usually have yml files which can be used as templates.
thanks .. for answering , i will start working on it right now ..
what do you mean by admins have yml files??
i don't understand ?
What event would I use if I want to generate loot chests randomly in the map? (I know how to handle positioning I just don't know what event to use)
ChunkLoadEvent?

not sure ..
So map is reloaded each time the event ends
I guess I just retrieve all the chunks in the map, randomly select a few and then from there appropriately position the ches(s)
✅
Or I could harcode it, specify all available locations, randomly select them
I guess
👌
try the plugin i sent to you . maybe it helps?
ty
should I check direction someone is facing like that?
if(yaw >= 135 && yaw <= 255) {
System.out.println("facing NORTH!");
} else if(yaw >= 45 && yaw <= 135) {
System.out.println("facing WEST!");
} else if((yaw>= 315 && yaw<=360)||(yaw>=0&&yaw<=45)) {
System.out.println("facing SOUTH!");
} else {
System.out.println("facing EAST!");
}
If you don't mind values like up and down you can use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Entity.html#getFacing()
declaration: package: org.bukkit.entity, interface: Entity
thanks, that is a good alternative
it is you need to run buildtools
java -jar BuildTools.jar --rev 1.20.4 --remapped
can I run it anywherE?
I still don't understand this though, how does the IDE know that I ran buildtools?
it just scans the whole computer?
how does it know what server to pick I have like 7 directories with different minecraft jar versions
after its done, can i remove the buildtools folder?
if you want
Whats better for an index:
Have a hashmap with Integer and Value or
Have an ArrayList and get it by the index
Also is it impossible to have different objects in an arraylist?
depends on how large your map is going to be, how many reads, writes and what not
generally I would say arraylist is easier
you could use something like what i made ^^
makes things a lot easier
Why would it be impossible
Or are you talking about different types
I assumed a specified object was required
Different Objects
For example Player OfflinePlayer
So different types?
yes
._.
yes or no
i mean arraylists are there for a consecutive sequence of elements
Is it possible to make an arraylist that would accept multiple types of objects
Ok epic
Possible yes
but not a union type
Bad idea also yes
we're not typescript
k ima just stick with my hashmap system since it works
honestly I thought your question was around whether it is more effective to associate an object to an index via a hashmap or custom array(list)
that was the initial question
2nd question was this
alright, well this is a custom map-like implementation that you could use, should be faster than HashMap<Integer, ...>
Honestly though you should go over your design
I have a feeling it needs to be reworked
hey getCommands() on PlayerCommandSendEvent contain names and don't include slashes before right?
Try and see
👌
Hello I want to create a flashbang. For that I thank about a title with a custom texture with unicode but in 1.20.1 mojang removed unicode. By what I can replace the unicode ?
Pretty sure it’s still a thing
Likely a stupid question, but is NMS faster than worldedit at setting a lot of blocks? I'm only wanting to set a large region to air that's all
World edit if i recall uses some nms to do what it does and isnt just strictly api
So it's safer to stick with just using the world edit api and not going off wasting time making nms stuff?
Most likely given world edit has been around for almost a decade
well after few hours of coding and thinking , its just to complex and not worth it ...
i will just copy paste the files from lobby -> all game servers in kit folder.
how would i replace the default unknown command message?
what event should i go for
also how do you save Unknown command. Type "/help" for help. to config?
I think it's in one of the ymls
spigot.yml iirc
What if I want to remove it?
set it to "" or something
or on command execute, if it doesn't exist then just don't try to run it
also
spigot.yml > messages.unknown-command
I can't 😭
so i keep getting red errors on configuration can someone help me fix it?
https://paste.md-5.net/fujiboxeri.java
is there an event for when an entity's hitbox touches another one (another entity hitbox)
or just an event for entities collision
(the closest thing i found is VehicleEntityCollisionEvent)
no
damn
can someone help understand what this error is?
https://paste.md-5.net/perenetoxe.css
show ur code
did you add the command to plugin.yml
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
^
Idk if thats good place for this question but i'll ask it here bcs mc is related to netty
index: 14, length: 1434 (expected: range(0, 512))
What might cause this error?
I send rly big string around 1400 characters
in the plugin.yml
there should be no spaces here
||i think 🙂 ||
Are permission and config separate commands?
If so they should both be indented 1 space
and yes
no
so they need one space each?
Yes
it should be just like the permission:
like this>
no
Indented
now is this correct?
https://paste.md-5.net/efoguniyad.makefile
what do you mean?
This
Is an indent
Is another indent
ye, just remove the space between commands: and permission: and remove the testplugin.use
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Instead of guessing and checking read this and look at its example
sure
u are not back to the first problem 🙂
The wiki should solve their issue
ig
Likely they aren't a native English speaker so the examples should help
no i am i just have a lot of issues understanding sometimes
It's always easier to learn by example anyways 😉
the green one is good, it should not be changed, the red one is bad, u have to remove the yellow "spaces" before the red one and make it like the green one
:-)
ye
its like, nested, but without the { and }
Json superiority
thanks again
https://paste.md-5.net/coyizopoke.coffeescript
i keep having this error no matter what i do to fix it
and here is the main class code https://paste.md-5.net/ujotinezin.java
send your plugin.yml
name: TestPluginee
version: '${project.version}'
main: com.oisann.testpluginee.TestPluginee
api-version: '1.16'
authors: [Oisann]
description: Cool plugin
sound: ENTITY_ENDER_DRAGON_DEATH
commands:
permission:
config:
change it to this
when you have an incorrect answer make sure to remove it lmao (refering to Oisann)
what is happening 💀
if you mean my name
that's correct i am called oisann xd
still having the error
It's not inaccessible
If it is you haven't signed the cla
This is a limitation of stash
I mean... not really
you can just have something that closes PRs opened by accounts that haven't signed the CLA
Not exactly a clean solution
about a zillion companies do it with their own repos all over the place
its a super super common solution
mojang/microsoft does it with their repos on github, surely companies that host code via stash also have something
Is there a plug-in that can do per player borders please let me know!
Is there any way i could trace where an arrow is going and place there a head or smth
So it would kinda simulate a ball if you know what i mean
Just make the ball constantly update to arrow location?
Well but how do i make the ball? Since blocks cant really have position in floating points, should i use Armor stands or smth
just dont actually use an arrow, it tends to turn invisible
So i can have some sort of block projectile?
have been planning to mess around with off-grid blocks but not done anything with it yet. Personally I'd advise you to use armour stands without collision and custom model data item on it
what kind of ball you want?
you coud just use a collection of particles or maybe use snowballs lol
Well i wanto be able to cancel the ball if its clicked during flight do thats the only requirment
not sure how you are going to click something flying through the air o.O
Thats going to be difficult as you need interact and not have your target mess with the projectile
I have the same question, i have no idea how would i implement smth like that
explain what you are doing and someone may have a better idea
the whole ball effect etc is easy
the clicking part, not so much
but I agree you need to probably provide better details on what it is you are trying to do
If it's somethign like volleyball then scrap the projectile and plot an arc for an entity
all I have right now, is an arrow with a ball trail?
It is
Its a basketball plugin
Basically when someone shoots an arrow and someone clicks it midfly i want it the clicker to get the ball
use a bat entity with custom texture then. This way it lets your players hit it
left click, check if it intersects with the area of the ball?
yep, scrp the projectile
doesn't work that well with arrows or snowballs XD
But how do i make the trajectory
math using vectors
in the launch event you can get the direction and then spawn an entity and plot its course
i meant manually, draw a sphere around the orb and see if the player is looking at it and close lol
Is that all?
That cant be
Right
yes, you have to apply gravity is all
doesnt gravity apply to entities by default
then you can detect an interact click from a player
its really not overly difficult, there might be some other things as they come up, but relatively its not all that difficult in terms of math
yes
I would use snowballs for when the player has the ball in their hand
don;t forget to cancel/remove the projectile in launch. You want your entity nto the projectile
this way you can get force and direction, and then when the snowball spawns, change it out for a bat entity with a custom texture
apply all the stuff from the snowball to the bat
reason for bat, is because its hitbox is small but not too small, but good enough for a ball size 🙂
another entity might be some magma cubes, the smaller variants
or slimes
plenty of entities to choose from 😄
interaction :)
Multiple ways of doing it. Database (NoSQL), Storage buckets that store json files, compressing your json file on bungeecord level and sending in to other servers through bungeecords pipeline, ...
Or if you want a dynamic server network that can scale: through docker
what would be the best way to achive it?
easier and best way?
bungeecords pipeline maybe i can use redis?
Depends on your environment
If you have a nosql database, I'd say that, otherwise the storage buckets
S3 object storage is inexpensive
But doesn't make a lot of sense if you just want to store configurations
There's many ways to do it
As long as you have a centralized config that can be accessed online or offline through all servers
so lets say the files are in lobbyserver/plugins/lobby/kits/....json
how would that work if i want to use mysql? to save / load it in mysql ? or that won't work?
You don't
You shouldn't store large json in a MySQL database kinda defeats the purpose of a relation based database
but i will serlize and deserlize the items ..?
And?
so using mysql is good?
Having a configuration mysql table is totally fine
Or you could use mongo for better scalability
I mean it works yeah
what i got my idea is :
https://paste.senior-studios.com/ejetimihag.java
This
Yeah totally works, just load the config file into the database on startup
amen
Alright thanks
what is the difference from EntitySpawnEvent and CreatureSpawnEvent?
aint they in different apis?
ah
no
but one is a subgroup of the other
i really dont know what the right word to use is here
creature extends entity. It's just like the damage events
If you ONLY want to listen to creature spawns.
shouldnt it be LivingSpawnEvent?
a creature does not include players or armor stands
https://paste.md-5.net/lotopuduli.java
so i made this but no matter what i do it doesn't show the message or sound in the game anyone have an idea why?
you never registered the class as a Listener
ohhhh i keep saying what am i forgetting or doing wrong
wait so witch one should i use
i just dont want mobs to spawn naturaly
then creature is fine
i implemented listener but still no luck didn't fix it
register
like import you mean cause i did that too
no
i am making a plugin that prevent player entering safezone if they are combat tagged, using player.setblockchange client sided
for now i use this:
public List<Block> getBlocksInRadius(Player player, int radius) {
List<Block> blocksInRadius = new ArrayList<>();
Location playerLocation = player.getLocation();
World world = player.getWorld();
int rSquared = radius * radius;
for (int x = -radius; x <= radius; x++) {
for (int y = -radius; y <= radius; y++) {
for (int z = -radius; z <= radius; z++) {
if (x * x + y * y + z * z <= rSquared) {
Location blockLocation = playerLocation.clone().add(x, y, z);
Block block = world.getBlockAt(blockLocation);
if (block.getType().equals(Material.GLASS)) {
blocksInRadius.add(block);
}
}
}
}
}
return blocksInRadius;
}
public void updateBlock(Player player, Location loc) {
if (pvpmanager.getPlayerHandler().get(player).isInCombat()) {
player.sendBlockChange(loc, Material.RED_STAINED_GLASS.createBlockData());
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
@Override
public void run() {
if(player.getLocation().distance(loc)>=9){
player.sendBlockChange(loc, Material.GLASS.createBlockData());
}
}
}, 40L);
}
else {
player.sendBlockChange(loc, Material.GLASS.createBlockData());
}
}```
Is this a good approach?
Or is there a better way
Then you have a lot of faith in people not simply walking through your blocks, because the server surely wont stop them from simply walking through that 🙂
I stop them from walking in there anyway
I just want to display a red wall of glass
If they are in combat
You could display a world border as well if you want
hey an entity harm, red colored effect is client side? From what I've read online. Is there a way to prevent it or customize it without a mod? with a plugin? Eg.: Cancel the harm event and manually calculate the damage? and then harm an entity, apply knockback
Like I want to make a barrier that goes red near player radius
On the walls of a region
Yeah still reading. Your approach for getting all blocks in a radius should work but is inefficient.
The midpoint circle algorithm
cant you just use distanceSquared?
How do you update the blocks? What triggers your updateBlock method?
public void updateBlock(Player player, Location loc) {
if (pvpmanager.getPlayerHandler().get(player).isInCombat()) {
player.sendBlockChange(loc, Material.RED_STAINED_GLASS.createBlockData());
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
@Override
public void run() {
if(player.getLocation().distance(loc)>=9){
player.sendBlockChange(loc, Material.GLASS.createBlockData());
}
}
}, 40L);
}
else {
player.sendBlockChange(loc, Material.GLASS.createBlockData());
}
}```
Ok that is the method again. But what triggers this method being called?
Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
List<Block> blocksInRadius = getBlocksInRadius(player, 8); // Example radius: 5
for (Block block : blocksInRadius) {
updateBlock(player, block.getLocation());
}
}
}
}, 0L, 2L);```
this
inside onEnable
you probably want to filter at least by dimension
oh btw
you likely can use the boundingBoxes here
You should def profile this with spark if you want this to run on a server with more than 10 players.
Its a lot of computation for a simple visual effect.
i believe it was something like world.getNearbyPlayers(BoundingBox)
also youre trying to update blocks possible outside of render distance
cap it to a distance of maybe 31, thats vanilla's particle distance for non-forced particles
He implicitly limits it to a distance of 8
i saw it on a server once with 100+ players
uh thats the distance where it gets toggled, not where it filters by player
so how should it be done to handle a lot of players?
Yeah, they def used a more efficient approach
Yeah, thats what i need help with XD
like i said, just grab the players that should see it in the ffirst place
ok, what after
i mean at that point you should be fine?
you might want to pre-process your effect locations tho
I personally would add a ton of new classes to this, depending on what you are doing.
Define a distance around your wall and create a BoundingBox of that size.
Then on tick, you get all players in that BoundingBox and only update blocks for people which are
actually near your barrier.
so i made this so far but i was wondering if its possible to make a config file where i can change the sound and the welcome message to the player from the config.yml if it possible can someone tell me how i know how to make a configcommand and yml just not how to be able to add these so i can change them from the yml
https://paste.md-5.net/ekayexudob.java
That has no correlation with the render distance...
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
the most efficient if we are to stick with api is to ensure the block changes you are doing are not permanent
however, the best way to do this would just simply use packets though
packets are a pain lol
this way in terms of server processing there isn't that much
Doesnt the API literally just send packets?
do i need to uzse nms?
it seems like i do
probably since this is all custom stuff anyways I don't really see the issue
this is a server you control correct?
can you explain a little bit the logic?
of how to make it
the api can set custom model data of items if you use the armor stand approach. NMS might be cleaner in some cases
not sure what logic, the only difference is you are moving to just packets so the server isn't really aware of the blocks or keeping track of them. Since its just for visual purposes only the client needs to know about it. The only thing you need the server to do is just to ensure they don't cross the boundary
i thought player.sendchangeblock is only clientsided
no i dont have access to that server
well yes i know how to do those i can't find a lot about changing sound from yml mostly
so you are commissioning a plugin for someone?
indeed
when i started doing it i didnt know anything about bukkit lmao
Wild
its just an api ¯_(ツ)_/¯
You'll need nms for what you want
?nms
Sound is an enum. You can write the enum name as a String into the yml file, e.g. "BLOCK_AMETHYST_CLUSTER_BREAK"
and later retrieve it via Enum.valueOf ->
String soundName = ...;
Sound sound = Sound.valueOf(soundName);
Cant you just mount an interaction entity on the arrow?
Makes it clickable 🙂
while it does send packets, it still has to do other things before then. You can just inject directly into the network manager and bypass all the server stuff. Up to you which way you want to do it. If you want to stick with the api you can, however you wanted the most efficient which is not using the api.
dont remember seeing that, when was interactionentity added?
ohhh i didn't know it was read as enum but thank you so much
so basically i dont change anything in my approach, but instead of snedblockchange i send a packet?
like a passanger
or what
imo that is a negligible optimization compared to simply not ticking all players and retrieving the blocks in a more efficient way.
You are probably gaining a few hundred nanos at best.
I haven't tested the difference in a long while, but its actually much larger then that
the api is great, but its not efficient
Just use the api and focus on more impactful optimizations
api has never been efficient and has never really been the goal. This is why any network striving for efficiency should just make their own custom server
so i should just optimize this and ill be good?
Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
List<Block> blocksInRadius = getBlocksInRadius(player, 8); // Example radius: 5
for (Block block : blocksInRadius) {
updateBlock(player, block.getLocation());
}
}
}
}, 0L, 2L);```
There is not much to optimize to be honest.
Def focus on filtering out players first
if you're sending many block changes in batches then you might wanna use sendBlockChanges
so running this every tick is fine if i filter out players?
Oh yeah, batching them in multiblock change packets is a good idea
i dont see it in the docs
Multiblock change packet changes chunk sections. Thats pretty optimal for this case.
it was added to the API fairly recently, wasn't it?
if that is what it does then yes, it would be the most ideal
who knows, most of the vulnerabilities that anything complains about these days don't even apply majority of the time
since it requires to have access to begin with
i guess
which one is the correct for remapped again?
the one with the super long name?
something something "reading untrusted data sources"
if someone has access you have larger things to worry about. Second, most require very very specific things to even apply
to be specific
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>D:/Work/DSMP/Server/plugins</outputDirectory>
</configuration>
</plugin>
can i make this copy the correct plugin file?
https://paste.md-5.net/uyaguzatom.java
is this correct?
the way i impleneted the sound enum you showed
soundName and sound in onEnable are local variables. They are not usable in your onPlayerJoin
well it works like that
so they all need to be in the same place?
sorry still new to plugin making so i am trying to learn as best as i can
your line 36 is the line playing sound at the moment
yeah i want to be able to change the sound just from the config.yml
move those two lines into your onPlayerJoin
and use sound instead of the Sound enum you use to play
which of the mappings on ?mappings are used by remapped? Yarn?
alright
Mojang
Mojmap
Mojang mappings 💪🏻
They started releasing em a few versions ago
ah i see
is there anything else i need to do like or is this all i need?
im trying to find packet hex 26 (?)
but i might need the entity packet
is there a simple way to listen to outgoing packets btw?
i want to duplicate it for a different location
I think u can inject a handler into the packet pipeline
ill look into that later then
i dont want to rely on timing for this
i cant believe duplicating the crack effect is this difficult
there is API for teh crack effect
since when lol
whats it?
oh its a particle now?
i thought it was still considered an entity
so uhh having an issue where the config file no matter what i do keeps showing this even if i delete it or make a new one
https://paste.md-5.net/iwikijajez.php
?
it keeps making the config file to this when i don't even have that config file
yea but how to detect it?
can you just query blockDamage?
I thought you wanted to display
duplicate
No idea what you mean by duplicate
extend the effect over a larger area
ah ok
while being in sync with the player crack
i could do it with timing but thats a terrible idea
I'd check damage then, if that works, sendBlockDamage for all the other blocks
block doesnt have any damage methods
there is a block damage event but I think it only fires once when you start
yea im aware of that
then there is an abort event if you stop
but theres a ton of things that affect how fast you break it
Thats probably not sent client to server though
as block toughness is fixed
its probably calculated
why not just change the toughness of the block
can the api tell you how long itll take for entity x with item y to break material z?
cuz then its just divide by 10
no
oh irritating
theres no check method on item
What check
how much damage/how long to break a block
hm
theres block.Block::getBreakSpeed but it grabs it for the current player
its not accurate if for example you start breaking on a ladder and then step off
im filtering players and spark profiler doesnt even show my plugin with 1 player
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
if(region != null && region.contains(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ())) {
List<Block> blocksInRadius = getBlocksInRadius(player, 8); // Example radius: 5
for (Block block : blocksInRadius) {
updateBlock(player, block.getLocation());
}
}
}
}```
like this
getBreakSpeed looks like what you want
from that you can start in teh damage event and apply to all blocks (fake Damage), then finish when it breaks or aborts
well its by tick so reasonably accurate
you fetch the speed each tick
so if an enchant fades you apply the new break speed
yea
nah it's just addition
just keep track of how much the block is broken and adjust accordingly
add until 1.0+
+1+2+1
float should be good enough
and you just send the fake damage to each block other than the one you are actually breaking
ye makes sense
on a different topic
can i see without building where im missing javadoc? in IntelliJ
ah ok
it looks like you have to enable inspection mode
uuuh
oh i see
it only highlights it in code like that tho
i was more thinking along the lines of scanning the source files and get a list 'missing here, here, here' cuz i can see that part myself, i just dont want to open and read through all of the files
I don;'t use intelij but it says you can run an inspection
does IJ not have an error/warnings tab?
It does
you shoudl be able to click in there to be taken where you want
Specially when building too
yea but building takes a while
i was wondering if i could just open it up somewhere
eh, guess its at least visible when building lol
If it shows a warning then you click in your errors tab to select any
There is probably a window
oh interesting
not sure if its here cuz of me runing the analysis but its faster either way than building
ty
if you have it set to warn in inspections they should all show up in the problems tool window
if you're wanting to make custom break speeds you will need to use nms to accomplish it
????
wdym ???
i aint reading up on your whole convo
but ive implemented custom breaking speeds so if you want to do that too i can help you along a bit
oh so you just want to make the things appear like its breaking
i mean i guess it would be interesting to know how you do it :V
not for area break
when using
as.setVisible(false);```
u can see the armorstand for a second before it turns invisible, anyway around this to make it not visible at all?
