#help-development
1 messages · Page 721 of 1
?
Soo... what's differences between item pdc and custom tag
if the pdc is too custom tag?
Because they made a fluid system then never actually made it useful
Yes
How should manage my db interactions?
-
OnEnable cache everything, when something changes add it, remove it, edit it in cache and then OnDisable sync it with db
-
OnEnable cache everything, when something changes, cache it and sync it with DB and OnDisable nothing?
I wanna make Ranks, Sanctions, Login, etc.
Were talking about HikariCP
PDC is part of the api
Generally you should be fine to just send changes to the DB right away
Okay
Connection always open?
HikariCP will manage the connection
okay
I have a wild theory
So I have a working menus library, but specifically everything is working but when remove item and update is called the item is removed then it's there again in the inventory
https://paste.learnspigot.com/motizifeci.java
Keep in mind everything works in a different plugin but not this.
Tested on versions 1.19.4 and 1.20.1 versions
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.
But lets say i mute "Player7" in Hub and when he joins Skywars, how should i fetch data? Can i listen when there's a change in DB or should i fetch data from DB when player joins?
yo any ideas ^Du hast (?<name>.+) (?<amount>\\d+)\\$ gegeben! $ about whats wrong with my regex?
it’s not regexing
Hello, I need some advice.
I want to make a small "banking" system, but I don't know how to do it better: 1. Separate backend server with Discord bot and web interface, and the plugin will simply send requests to the API. So, users will be able to transfer money whenever they want. 2. Do everything in the plugin.
I just want the user to be able to use the application at any time, regardless of whether the server is running or not
and it blows up your ram
It depends
(as always)
There are multiple approaches to do something like this
Some are better than others
In a flawless world it's a mix of a few
You can:
- Make a bungee plugin that loads the data and applies mutes globally
- Make a spigot plugin that loads player data on join, saves it on quit (high potential for de-sync if reading is faster than writing)
- Make a spigot plugin that loads player data on join and puts it in a low-latency cache
- Make a bungee plugin that loads player data on join, puts it in a low-latency cache for spigot instances to read from
- Make a spigot plugin that loads player data on join, and relays that data to other instances when transfering a player
What we do at work is put it in a low-latency cache that invalidates 30 minutes after the player quits
At some point I need to write a session manager and publish it out for free to standardize this kind of process
Define low latency cache
something like redis
Where the write and read latency are far faster
but it isn't necessarily a persistent database
Just something temporary
I assume the 30 minute period is to prevent reading it again if the player relogs right away
lol
Depending on the application and database performance we can automatically adjust between 5 minutes and like 2 hours
I was gonna complete some stuff for driving school and a commission
done neither and I feel like shit
is there a way to keep a certain list of chunks loaded
whats wrong
you can make plugin tickets
does that keep it loaded forever
or does it just load it in for a certain amount of time
hi, does anyone know a really good game server management panel? (except pterodactyl)
ping me if you found one
Feel like most people use pterodactyl these days
AMP and Multicraft are the other big ones I know
Much older
how would i change the type of sapling leaves drop when they are broken/decay
oopsa
I think decaying calls a BlockFadeEvent
However idk if you can control the drops from that event
if I have a regex like this:
^[Waffenschrank] Du hast deine (?<gun>.+) mit (?<amount>\\d+) Kugeln beladen.
^ should mean beginning of line, but I somehow suspect that it does something with the [ ]
is that a thing
?
[a-z] match a though z. [abc] match a b or c
well it's part of the string I wanna patch tho
the [] stuff
but I do not want it to do regex stuff with it
then escape
^\\[Waffenschrank\\] like that?
yeah
alright imma try
What about screen you guys?
Try screen, if you have a vps/dedicated server
Don't.. just don't. Screens suck
Hate them. Had to use them for the longest time and I'm glad that better things came along to replace it.
I had names for all my screens
It wasn't a issue
I forgot which button i had to press for detach tho
docker + portainer 😌
ig bungee is the best option?
how would you do it?
depends on complexity and budget
Well its just to learn idk, fun
And well, budget, idk what u mean w/that
Has to do with like
how many resources
y'know
do you have redis, mongo and influx
or just mysql
or whatever
So many fun things can work
Just mysql
wanna make the plugin simple for the user
and well, there's no need to be fast to code
just fun for me
thanks for the help
just fyi you can use mysql like you would redis
as mysql does have memory only db's/tables
if you set it up
latency tho
latency should be better and if its on the same host its a none issue
and if you really want low latency go with linux sockets with mysql
about to head to work
rip
I like turtles
what the actual fuck have I encountered
what the actual fuck, worldedit
how is this able to paste fine but reading the contents is fucked
__reserved__? 
no fucking clue
this reads out as what's on the console
wtf is _reserved_ and why are all the coordinates fucked
man fuck this it's not worth the 200 bucks or whatever
Lol?
apparently fawe does stupid conversions if you're on paper
I can't read schematic data with their own api
I simply won't bother
Interesting
I haven’t tried my latest project on paper actually, so I wonder if I’ll encounter that
how do I add jpa repostories, and derived queries into my plugin similar to spring's jpa system? I know I can use hibernate ORM but how what do I use to make the queries? Or is there something that wraps this all together for me nicely?
is getScore method statis?
yeah, for sure
im just trying to use lombok getter
that creates
ig like
SCOREBOARD.get or smth like that
CHub is a direct class call or is it a variable? Paste code
goinmg
?paste
Ah nvm
das main
Yo, quick question. Is it possible to create a system like Wynncraft (model display inside barrier) without adding a huge list of locations into my plugin?
Well you’ll need to track it somehow
You could technically track it with an entity at that location
So am I just better off making a list of locations?
It’s either that or some janky entitiy scanner
Everytime a runnable repeats its creating a new instance? Cause lets say i wanna do a count 1+1+1, setting up count, everytime it repeats will start count as 0 or the last value?
It’s far more elegant
@Override
public void run() {
Configuration cfg = CHub.getInstance().getConfig();
List<String> strings = CHub.getScoreboard().getConfig().getStringList("scoreboard.title.animation");
int count;
}```
runnable
public class TitleRunnable extends BukkitRunnable {
int count;
@Override
public void run() {
Configuration cfg = CHub.getInstance().getConfig();
List<String> strings = CHub.getScoreboard().getConfig().getStringList("scoreboard.title.animation");
if (count >= strings.size()){
count = 0;
}
for (Player player : Bukkit.getServer().getOnlinePlayers()){
ScoreboardManager.getBoards().get(player.getUniqueId()).updateTitle(ChatColor.translateAlternateColorCodes('&', strings.get(count)));
}
}
}```
i came up with that
Yes but java edition had something similar too that was a placebolder
for a class name gmccommand are we thinking GmcCommand or GMCCommand
Nahh not matter
which one is better though
GMC is an acronym but
idk
You can't ignore just because it's long
its fine lol, feel good
😭
😡😡
just throw some PDC tag on the barrier block
or the item display itself
also what's wrong with having a huge list of locations?
Collection<Player> playerArg = (Collection<Player>) args.get("target");
Collection<Player> targets = playerArg;
if (playerArg == null) {
if (!(sender instanceof Player player)) {
Component error = miniMessage.deserialize(
"<red>Console cannot use this command unless a target is provided.");
sender.sendMessage(error);
return;
}
targets = List.of(player);
}
if (targets.isEmpty()) {
Component emptyMsg = miniMessage.deserialize("<red>No targets were found.");
sender.sendMessage(emptyMsg);
return;
}
intellij is yelling me about this duplicated code fragment which will end up being in at least 5 of my commands and I don't know how to simplify it
public static Collection<Player> getTargets(args) {
Collection<Player> playerArg = (Collection<Player>) args.get("target");
Collection<Player> targets = playerArg;
if (playerArg == null) {
if (!(sender instanceof Player player)) {
Component error = miniMessage.deserialize(
"<red>Console cannot use this command unless a target is provided.");
sender.sendMessage(error);
return null;
}
targets = List.of(player);
}
if (targets.isEmpty()) {
Component emptyMsg = miniMessage.deserialize("<red>No targets were found.");
sender.sendMessage(emptyMsg);
return null;
}
return targets;
}
idk something like this, then your other methods just return if getTargets(args) returns null or is empty
I like this approach better than what I was going to go for with throwing an exception and catching it
thanks
throwing exceptions yourself is only fine if you don't wanna catch them
I call this anti pattern "do not jump off bridges" https://blog.jeff-media.com/dont-jump-off-bridges-or-why-you-shouldnt-use-exceptions-to-control-code-flow/
Exceptions are a wonderful thing. They can let your code recover from unexpected situations in a nice and clean way, if you use them properly. That does not mean that you should always rely on them though. For example, imagine this: Most highways have guardrails in the middle to avoid cars going into oncoming traffic....
you can also think about using a command framework like ACF that automatically handle this for your
e.g. ACF allows you to declare a method like this
public void onCommand(CommandSender sender, Player... targets)
and then it will only only "player names" as args and create an error message itself
acf on top
can anyone link some plugins that use gradle and implements a SQL database? never used a SQL database in Spigot (or Java) previously, looking to do some digging into how it's implemented :)
thank you, I'll do some more research on that :)
hello mr. md5 hash
what the fuck
🤢
what the actual hell
how would i change the sapling type a leaf drops
I have fancy tree schematics with different types of leaves
But I want the game to be practical too and I want them to drop oak saplings
Is there a way to do that
Someone needs to meet with the person who made that class and have an intervention
I am trying to change the text of a TextDisplay using the .setText() method. However, anything I put into that method becomes this:
text:'{"extra":[{"text":"This is a test"}],"text":""}'
/Version?
Sounds like a bug but I would expect it to have been reported by now
?jira
Here's my code:
if (command.getName().equalsIgnoreCase("createEntity")) {
if (sender instanceof Player) {
final Player player = (Player) sender;
final TextDisplay textDisplay = player.getWorld().spawn(player.getLocation(), TextDisplay.class);
textDisplay.setText("This is a test.");
// Show a particular entity
if (!entityHider.getMembership(player, textDisplay.getEntityId())) {
entityHider.setMembership(player, textDisplay.getEntityId(), true);
}
}
}
Just made a ticket: https://hub.spigotmc.org/jira/browse/SPIGOT-7483
That's how the nbt is meant to look
You made it sound like that's what the actual text looks like
ask ur question
how to vote shop vip click gui download sent?
what
wait i
🗣️
balance /goldshop
ur just saying words, explain ur issue with what isnt working and what you want to happen
google use buy 500 /goldshop take click vip work download make pls?
you want a plugin that has /goldshop that does something?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
are you just pressing the middle type complete on mobile
bc your just saying words that dont make sense
either that or he's a far ancestor of yoda
kek
If I wanted a player to be able to run my command, and pass in an entity, such as a TextDisplay, how would I parse a selector (@e[type=text_display])?
?jd
declaration: package: org.bukkit, interface: Server
How would I add a tag to a entity with a plugin?
?pdc
This seems a bit convoluted. For clarification, I am looking to do the same thing as /tag add ingame, but through a plugin instead. Additonally, being able to check an entity for tags would be nice.
The proper way are PersistentDataContainers as they can hold keys+values which greatly improves the
usability of your tags. If you want a simple ScoreboardTag then you can call
Entity#addScoreboardTag(String)
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Entity.html#addScoreboardTag(java.lang.String)
declaration: package: org.bukkit.entity, interface: Entity
Is the overworld / world where all the player data is stored always the first loaded world? (so Bukkit.getWorlds().get(0))
is there a limit to how many entities can target a player at once?
no afaik
i am doing a wave-defence sort of game
and every second i set all entities targets to the nearest player
each entity manages it's own target and no other class is told about it
but some just like to wander around
well other classes can know about it
i can have up to like 60 entities at once
would something be interfering idk
it didnt happen when the server started up, but as more mobs were introduced more started to wander around
i might try LivingEntity.setAware()
I have a question.
I would like to know how many zombies are in the World, but I don't know how to do that.
you get the world, get the entities of that world, iterate over, check if its instanceof zombie, count + 1
world.getEntitiesByClass(Zombie.class).size();
Welp - apparently so
Quick 5s in IntelliJ
thank you!!
np
Can someone please help me, i am trying to do so the skull is in the middle of the end portal frame and so it is in the "normal" high, the picture to the left is how i want it, and the picture to the right is how it is right now
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(label.equalsIgnoreCase("vps")) {
if (!(sender instanceof Player)) {
sender.sendMessage("Kun spillere kan gøre dette.");
} else {
Player player = (Player) sender;
Block targetBlock = player.getTargetBlock((Set<Material>) null, 5);
targetBlock.setType(Material.ENDER_PORTAL_FRAME);
Block aboveTargetBlock = targetBlock.getRelative(0, 1, 0);
Block blockBlock = player.getWorld().getBlockAt(aboveTargetBlock.getLocation());
SkullCreator.blockWithBase64(blockBlock, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjgyMjAyODJmMmVlNTk5NTExYjRmYzc0NjExMWM5NzM2ZDdiNDkxZThiY2ZiNjQ4YThhMTU2MjkyODFlZTUifX19");
player.sendMessage("Blocken blev ændret til en vagtpost.");
}
}
return true;
}
the right one is using an armor stand
Does the SkullCreator.blockWithBase64 change the material type ?
also, Block blockBlock = player.getWorld().getBlockAt(aboveTargetBlock.getLocation()); is completely redundant
just use aboveTargetBlock
i am looking for like minded coders to work on a project for fun any one up for it
Nty
no, this is the wrong place buddy
I got enough projects on my mind
where would i post it then
(And from experience I can say you 99% won't get anyone actually good and active work on it with you by asking strangers)
No it isnt, i just placed it with right clicking
Here is the blockWithBase64 method
public static void blockWithBase64(Block block, String base64) {
notNull(block, "block");
notNull(base64, "base64");
setToSkull(block);
Skull state = (Skull) block.getState();
mutateBlockState(state, base64);
state.update(false, false);
}
the left one is skull placed on wall, the right one is skull placed on floor
Ok, so you're using SkullCreator by deanveloper
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
can anyone plz help
?whereami
thanks that is realy helpfull
your fault for running paper and asking for help in spigot server....
Can you look at the left head, press F3 and send picture of that ?
Also, what version are you running
1.8.9
What of it?
?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
I don't know what it's called in 1.8.9 nor where it is...
ye the first one
What here?
you again 💀have you done your basic Java
Where di you come from? bro you just spawned
yes xd
Ok ye
I'm gonna guess that you're using this SkullCreator (and it does look like it)
1.8.9 is not supported
Ohhh.. i didnt see that
honestly surprised it didn't shit itself when you ran it
It probably did
Do you know another skullcreator method i can use where i can place a skull with a value and place it as i want?
He just haven't smelled yet
No i didnt get a signle error
Can someone who knows about plugins help me?
im too braindead to understand this rn lol
But it probably did do something
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
@smoky anchor
?1.8
Too old! (Click the link to get the exact time)
I have a kitpvp plugin, which I downloaded and am using, but its configuration is in a jar, I can't modify it using yml, I wanted to know if updating it in Java would be very difficult or not
Sorry, I don't use this old versions.....
Does anyone know how to remove invisible armorstands, they are there for spectators
what are you using them for and for what version
maybe?
Or are you asking to change the plugins code
i want change the plugin code
we use the spectator-mode for a Minigame which we are developing at the moment but the armorstands above the playerheads arent cool
sorry for confusion, what are you using the armorstands for :D
we dont use them
they are there with the minecraft spectator mode
we want to delete them
it depends if the jar file is encrypted or the plugin is open source best you send us/my the link
in the minecraft spectator mode are sometimes invisible armorstands
above playerheads
Well the armor stands have to be spawned for the spectators to see them
so you seem to be using them...
maybe a different plugin is doing that ?
mhm we have to check that, i dont think so but we wil lcheck it
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
well, i have only the .jar file but it is open source (my .jar file has a pt-br translation) and is it possible to use the .jar to modify or just with the source code?
Call it creative mode. You dont need to append command to the class name if the package it resides in is called commands lol
Makes it a bit redundant
if you only want to change the language file you can do that in the file you named otherwise you have to rewrite certain things in the source code and export a new jar file from it. so from the source code you make the jar file
i want rename the scoreboard etc
You can freely edit most files that are not the class files without issues. If setup properly you can make it to where you can add translation files without issue as well
i can't send .jar files
Then you have to change that in your Code
Send where you downloaded it from
the Spigot website if possible
I didn't download it from spigot
well you had to download it from somewhere
youtube video
Yes, the tick rate. Only so many things can happen in a given tick to include setting entity targeting
so send the link to that video
is it necessary to set the enemies' target every second
or should i do it just once
is there a way to make them not change target
ok it links to some discord...
Can't help here then
i sent for u
Generally if you set the target to a specific player as opposed to nearest it should probably help with that. So might have to implement your own detection for nearest. Also may have to resort using scheduling to update entities so that you are not trying to do too many things in a single tick and lets the server spread that out over a few ticks if necessary and not be missed.
Are those NPCs ?
Unless you specifically coded it so that happens, it is a different plugin doing that shit.
The NPCs I get, it is not updated for TextDisplay
mhm
maybe Citizens, we work with that becaue of NPC´s and the Skins of them
we will check it, write again in a few minutes
should .setAware(false) affect .setTarget() ?
Does anyone have the time to tell me how I modify a .jar
Depends on what you want to change in it
only text in .jar
scoreboard name for example
I recommend opening the jar with Recaf 3 then
You can use the bytecode editor to change the text
anyone know
Hello, I have a question. Does anyone know a way to sort players in the tab list without having access to the scoreboard and teams?
Yes, it would be best if the player name stays the same. I just want to sort them according to roles but don't want to use teams for that either.....
what's the event fired when you drop an item with q?
declaration: package: org.bukkit.event.player, class: PlayerDropItemEvent
Hi does anyone know how I can use player.launchProjectile to shoot 3 arrows with flame?
But I dont get how to use the method
as far as I am aware the default order of the list is by connection, that is whoever connects first is higher up in the list
you can however use that packet to sort that list and send it to clients, as well as have per player ordering
You give it the Arrow class as the first param and optionally a vector as the second
Can you send me example code maybe?
launchProjectile(Arrow.class)
why .class?
Because it wants the class
so i cant just create an item stack?
I've already tried the package to change the list of players but I didn't get any results. I used this method from Paper but no matter how I arrange the players in this list the tablist stays the same.....
public ClientboundPlayerInfoUpdatePacket createPacket(List<ClientboundPlayerInfoUpdatePacket.Entry> entries) {
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME);
return new ClientboundPlayerInfoUpdatePacket(enumSet, entries);
}
player.getWorld().spawnArrow(start, direction, speed, spread);
start - A location
direction - A vector
speed - A float (Like 1F)
spread - How much should the arrow deviate? A float (Like
^^ that would work too
@crystal swift what do you want to achieve
I don't see where you are setting the order of the list for the UUID's
I want multiple arrows to shoot when a player uses a bow
Ah
There's an event called ProjectileLaunchEvent
ik
Check if the launched projectile is an arrow and the shooter is a player, if so use the scheduler to spawn two extra arrows after some time
I don't use uuids for sorting the players... in the list that is transferred, the players are sorted in such a way that they are listed according to the ranks that I defined in it, but the sorted list is not shown in the tab list like that....
the packet takes an array of UUID's
you have to the modify this array, to sort the UUID's in the order you want
just so you know, there is 2 arrays
its Array(UUID(Array Actions))
There is no array in the package that I have open, which package do you mean exactly
I don't know what you mean by package, I am talking about the packet itself
if whatever you are using doesn't allow you to do this, you may just need to modify the packet yourself
well this is spigot
as far as I know you should be able to just modify/send packets that you want by hooking into the network manager
if you are wanting to use paper, then it may be wise to move to their discord where they can help you with paper specific things
and not be here where its spigot specific things
What is a vector 😭😭
a way to describe the direction of a thing
Imagine you are pointing your finger at the sun. the direction of your finger is the vector.
A vector is a collection of 3 numbers, or x, y, z, you can create a vector like so: new Vector(x, y, z);.
You can also obtain a vector from a location in two ways:
Location#getDirection gets the rotation of a location as a vector, without position
Location#toVector creates a vector from this location, without rotation
okay, thank you for you helping, I'll ask on the other server
for example, to get where the player is looking, you can use:
somePlayer.getEyeLocation().getDirection()
Vectors represent directions, and have a length, length can be used for example in velocity to specify the power of the impulse
Vector direction = player.getEyeLocation().getDirection();
player.setVelocity(direction.multiply(5)); // Direction is a "unit" vector, basically has a length of 1
Normalizing a vector is just scaling it down to a length of 1
Multiplying a unit vector just multiplies it's x, y and z by that number
To set a vector's length, you normalize it and multiply by the new length :)
It's not that complicated
^
otherwise known as magnitude
if you want to stick with math related terms 😛
definitely, but probably should be important they know the appropriate terms in case they might want to do some googling and see what you said doesn't quite match what they find lmao
Ah fair
Anyways, you know that feeling of rewriting a good chunk of your plugin because you got a better idea while the plugin itself was working 💀
well
that's the cycle of development
you write something
learn the flaws in your design
and rewrite it all
it wasn't even flawed
btw ike did you also get an email from socks management?
I just kinda felt like making it more customizable
Then throw it all away and start again
I don't think so
had a hr manager reach out to me
might be because you're still underage and can't sign contracts
they're like rebuilding the team or something
it was just a basic "my name is xyz and I'm reaching out because I have a few questions, add me on discord"
hm
totally doesn't match any spam filters with that
you know like your every day scam email XD
fr
I don't think I've received, and if I did they managed to put it in spam ¯_(ツ)_/¯
welp
I got their discord elsewhere because the tag on the email didn't work and everything checked out
then they told me they didn't have any positions for me and to basically fuck off

happens
No, it's one of those months
I quit a project last night because I spent too much time and worldedit was fighting me
so now I'm only facing 3 deadlines 
damn lucky ass
I am pressured on all sides lmao
haven't worked on a small project in so long
neither have I
worldedit or fawe?
I got 3 work deadlines, 4 deadlines in my disc, got to mad train for a FIDE tournament in 4 days and have to try and use duolingo more 💀
more fawe than wedit
just use AI to train you for that tournament
just invent a atom replicator to clone yourself 10 times
honestly i would still not finish
in time
I am training myself with stockfish and watching narrated GM matches (as well as playing)
just throw all your pawns out there, you should be fine 😉
🥹
someone mentioned to me to not complie but run code from the IDE directly. Is there an explanation as to what that is or how to do it?
Just add a run configuration that starts your server. Intellij will do the rest in terms of
detecting if exceptions belong to your project. Thats the simplest approach-
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
that looks like i still need to build it though?
is it just that it doesnt need a reload or smth?
Thats hot swapping. Something different.
Sometimes useful but limited.
You dont need to recompile for small changes.
Adding new methods, classes etc still needs a recompile.
ah
lright ill just keep remote debug then
so that if my IDE crashes again the server aint going down with it
on an entirely different topic, does anyone know why i cannot hear any sound using this command
/playsound minecraft:entity.ender_eye.deathrecord master @a ~ ~ ~ 1 1.5
are you running it from chat ?
yea
did you disable your master volume?
no
only the music cuz i want my own background music
and i can hear other sounds
like me walking around on the floor
is that even a real sound effect ? the "deathrecord" sounds weird
---__---
irritating that its not like 'sound doesnt exist' but just doesnt do squat
ye I would have expected that to pop up...
or at least maybe a warning message in client console ?
no
its like 'yea this sounds correct'
Moterius issued server command: /playsound minecraft:entity.ender_eye.deathrecord master @a ~ ~ ~ 100000 1.5
[15:20:52] [Server thread/INFO]: [Moterius: Played sound minecraft:entity.ender_eye.deathrecord to Moterius]
client console
What does that even mean?
Yes sounds are client side
not all of them
Resolving is
The server just says “hey play this sound”
And the client figures out the rest
well
reason why playsound doesn't trip at you is because resource pack sounds are a thing
yes
The server has no idea if a sound with that namespace exists or not
So it just yolos a packet to the client
in a plugin, if you perform an action which would call a listener (eg: player.attack could call entitydmagebyentity), will all the listeners be ran immediately, or will they be ran after the block of code (method) from the first plugin
i know that with callevent() it runs immediately but i dont know about this
immediately
blobfish?
ye what
immediate I'd say
A calls event
Listener 1 runs code
Listener 2 runs code
Listener 3 runs code
A checks if event is cancelled
A does coolmath if event is not cancelled
I'm kinda surprised to see you here lol
It's all single threaded
Minecraft be like
Minecraft isn't all single threaded
i know that when its called then the listeners run, but my point is does player.attack immediately call the event
yes
yes
World gen?
Here let's fuck around and find out
Worldgen is multithreaded, yes
Chat is also it's own thread (Or at least it was before the chat reporting update? idk if it still is)
Do hurt target
what would you expect to be more intenvive, searching for nearby entities within a 4 block radius, or doing a 3 block raycast (i can either raycast straight away or do a nearby entities check first)
ik neither are very intensive at all but im talking about doing like up to 1000 per second (over multiple ticks ofc)
bros got no clue how big his scale is
1000 per second?
i dont have a clue, thats why im asking
i dont really know what scale of stuff i can get away with in java
measure them both and come out with your own conclusions
Maybe measure multiple times for more accurate measures
There's a framework for that
I wonder what those 1000 per seconds are for
No guns?
Miniwatergun
Yeah Mojang doesn't like guns
Wait
That's genius
Just say those are medieval weapons and not guns
Or it's waterpistols
Or just go scifi
And the hearts are actually how wet you are
Laser gun
Lol
Or rather, more hearts = more dry
And when you have no hearts you "lose", you don't "die"
Guys, we are making a guns server
i need to raycast 3 blocks from the players face on every animation event but that calls a lot when digging and i cant just disable it when digging because minecraft sometimes just decides to not send the cancel digging packet
(no im not making an anticheat)
Yeah, I thought the same too
tbh it would be harder to explain the plugin than to explain this spesific point, there isnt a more efficient way of doing it
maybe there is, who knows
there isnt
Well, ¯_(ツ)_/¯
I still doubt it
The animation event is basically just arm swing
Which also fires interact event
List<Location>[] projections = new List[12 * 20];
I'm... not having a good time right now lol
is there a better way to store an ordered list of lists
that gets eaten by method signatures
But generally it's better to make a data class than to nest collections
Time for another data class
OR you can just stick with the array
It's not the worst thing ever
oh ffs auto import
import javax.xml.stream.Location;
can i be like 'prioritize bukkit and spigot imports'
Ah we love auto import
Can anyone help?
for (PotionEffect effect : battleplayer.getActivePotionEffects()) { battleplayer.removePotionEffect(effect.getType());}
error: 94: incompatible types: java.lang.Object cannot be converted to org.bukkit.potion.PotionEffect
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
oh you're writing code directly in Recaf
You need to provide all the libraries or it won't know what the methods are
I was just changing the translations and it gave me this error when I tried to save
question about class instances: The methods only exist once, and all the instance-specific fields once per instance, correct?
yes?
k
That's a very confusing question
ah well
i have a 'shape' class which contains a list of locations
idea was to just throw back a list of shape instances
but if the methods bloat it I'd just throw in a mergeShape method
@see NullShape#mergeVertexList(List)
This doesnt seem to work properly, can someone give me an @see example pointint to a method that has a list in its signature?
oh wtf
it needs to be on newline???
ah yea thats how annotations work
i need sleep
how to get if there are any numbers in string?
Regex can help there
kk
[0-9]+ i think
i found this "
.*\\d.*
"
is itemMeta could be a null?
like if i'm trying to do new ItemStack(Material).getItemMeta()?
would it be a null?
Only if the material is air
if the item is air yes
oh ok thanks
What is Block#setTypeIdAndData deprecated in favor of?
setBlockData I imagine
how do you deserialize a chat component when getting a message json through protocollib?
because i just want the message the player receives in chat
how do i get the direction behind a certain player
location contains a direction vector
i want to push the player backwards
Get their direction and multiply by -1
i'm sure's md's components have a method to deserialize chat
text components are not really json
at least i think so?
They are
they are
i see
Is it possible to make something like split but every 10 letters?
substring
Or regex
or getChars
Like i have a string "123456789"
and i want an array ["12","34","56","78","9"]
Or manual looping over the strings char array
simple for loop
oh ok
you can turn string into char arrays using String#toCharArray
split \d{1,2} ig
i did
for(let i = 0; i < 2; i++){
list.add(String.substring(i*2))
}
why
that doesn't work
the fook is let i
oh
also that wouldnt work
use substring start end
this simple
or use regex
hmm but yeah it would be better
I suggest you learn basic java operations and logic. e.g. I need to do X what is the logic for doing that. it'd honestly best for you if you figured this out yourself through trial and error
this is such a basic thing to do you just need to be-able to do it for the sake of learning the logical thought process
on Java u need to escape itll become \\d{1,2}
yeaaah but after school my head works too poorly
then take a break before you code :P give your brain a rest if school is challenging
sooo i I just wanted to know if there is, in principle, a similar method in java without regex or loops
but you ll split what
yes substring with start and end argument
digits or something
javadocs can crash install???
yeah i think i just should have a break......
thanks
why does minecraft sometimes decide not to send a cancel digging packet
What would be better logic to handel itemshop which has limited stock items
so some item can be bought 10 times and when it is sold it will restock after specific amount of time
so now I am thinking making check with for loop which will go thru all items in shop and check do they need to be restocked
code will be executed on specific delay like 1 sec and I think that would be bad
or make it so check is made when player opens shop or when they do /shopfastbuy <itemname> <amount>
thing is stock amount has placeholder which should be updated if item gets restocked
so if I do it only when player opens gui shop and item get restocked few sec leter placeholder will not be update
thing is I got stock limit per-player and global
so would it be to intensive if I do update once a second thru all items because they could be a lot of items in multiple gui shops
I really don't have inspiration and idea how to make this code logic
Thanks for reading my book 🙂
In order to use ChunkSnapshot#getHighestBlockYAt(int,int) and it uses ranged coordintaes from 0 to 15, I've tried using module operation, but sometimes the operations produces a wrong result
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
?paste
in theory the solution is to create a new location object and using the snapshot chunk coordinates times 16
Making a snapshot like that is redundant
can it be run asynch isn'tit
You still need to get the snapshot sync
And if you're only going to grab the top location that's going to be slower
let me explain
I'm inside a synch task since recent version reduced asynch operations, and I need to apply a disease to a player if it is exposed to rain, this is for each task tick
I can def increment the task period but I still have the same problem, it can cause lag
Getting the top block is actually quite efficient
^ It's stored via heightmap
getting just the player top block?
?paste
actually I can just get 1 block, since a player can be covered with the second top block, it won't work
so I would need either to iterate throught player top blocks
what
Did you just ignore the method you yourself used a moment ago
Just send it twice!
No need to loop anything
I didn't even tried actually using asynch with that method
one of my friend suggested me to
but it would cause lag either so I have no clues
Can someone please help me with this problem
The skull isnt being the skull i want, its a skeleton head not the orb head i want and the skull is being placed 2 blocks too much to west and north
Code: https://paste.md-5.net/hesiretisa.java
That skull value isn't a player username
?conventions
Yeah you can't just set the owner to a base64 string
"String skullValue"
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
They are on pre 1.18
I dont want to create a skull, im getting the skull from minecraft-heads.com
You need NMS then
btw that dude using 1.8.9
I do use 1.8.9 but i dont want to create a skull i got the skull im just wondering why it isnt the right skull that is getting placed
Because
.
concluding, I just need to get the top block to optimize?
That method requires a valid username
But look at this "String skullValue"
private void placeSkullOnTop(Player player, Block endPortalFrame, String skullValue) {
That is not a spigot method
Just because you call the paramater skullValue won't magical make it accept a skull value
Okay but if i am using a username that wouldnt still fix the problem with it isnt placed correct
It would if just the texture is the problem
Did you try the version with !
What you're seeing is a mix of spoon and copy pasted code
Is there a DataWatcher field for baby zombies that would prevent them having amror?
it really should be sending us the armor but it seems to be super buggy, only shoiwng certain pieces or none at all
You can probably listen for when the data is sent
and stop it or replace the information
is there a way i can stop mobs from growing up without cancelling their growing up event? Like some nbt i can modify or something?
You should only send one packet with the whole equipment
Hey, I'm trying to make a cooldown that can be used for multiple events.
Here is my CooldownManager class.
package me.thatkermitguy.medievalmc.utils;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.UUID;
public class CooldownManager {
public static HashMap<UUID, Double> cooldowns;
public static void setupCooldown() {
cooldowns = new HashMap<>();
}
public static void setCooldown(Player player, int seconds) {
double delay = System.currentTimeMillis() + (seconds*1000);
cooldowns.put(player.getUniqueId(), delay);
}
public static int getCooldown(Player player){
return Math.toIntExact(Math.round((cooldowns.get(player.getUniqueId()) - System.currentTimeMillis()/1000)));
}
public static boolean checkCooldown(Player player) {
if (!cooldowns.containsKey(player.getUniqueId()) || cooldowns.get(player.getUniqueId()) <= System.currentTimeMillis()) {
return true;
}
return false;
}
}
I'm getting the error
Could not pass event PlayerInteractEvent to MedievalMC v1.0-PREALPHA
java.lang.NullPointerException: Cannot invoke "java.util.HashMap.containsKey(Object)" because "me.thatkermitguy.medievalmc.utils.CooldownManager.cooldowns" is null
at me.thatkermitguy.medievalmc.utils.CooldownManager.checkCooldown(CooldownManager.java:25) ~[MedievalMC.jar:?]
at me.thatkermitguy.medievalmc.events.weapons.BattleAxeEvents.onRightClick(BattleAxeEvents.java:21) ~[MedievalMC.jar:?]
Any ideas?
I haven't worked with HashMaps that much so I'm very confused lol
why does it have to be static
also your error happens becauase you never called setupCooldown
but this is static abuse
i mean i got an error from intellij telling me it should be static
mm no
lmfao
.
you didn't used setup
sorry, setup cooldown is called here:
package me.thatkermitguy.medievalmc.events.weapons;
import me.thatkermitguy.medievalmc.items.weapons.BattleAxe;
import me.thatkermitguy.medievalmc.utils.CooldownManager;
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;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class BattleAxeEvents implements Listener {
@EventHandler
public static void onRightClick(PlayerInteractEvent event) {
// Potion ability (onRightClick)
if (event.getAction() == Action.RIGHT_CLICK_AIR | event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (event.getItem() != null) {
if(event.getItem().getItemMeta().equals(BattleAxe.battleaxe.getItemMeta())) {
if (CooldownManager.checkCooldown(event.getPlayer())) {
event.getPlayer().sendMessage("Success!");
CooldownManager.setCooldown(event.getPlayer(), 10);
} else {
event.getPlayer().sendMessage("Failed! for another " + CooldownManager.getCooldown(event.getPlayer()) + " seconds");
}
Player player = event.getPlayer();
player.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 5, 2));
}
}
}
}
}
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Mehhh
wait what the fuck i dont think i called it
Cooldown manager sounds like a fine singleton
id leave that as static 🤷♂️
Singletons should only be used in weird niche circumstances where DI is not applicable
Means you don't have to DI something for basically no reason
if you face such an issue 9/10 times it's a design flaw
i just trust intellij at this point, it does 20% of my work for me
Sure there is an argument about testability but meh
does it? ;) I mean chances are u gonna have different modules that want to have independent cooldown systems lol
does setting fire ticks add onto the original tick or change it directly
The method is called setFireTicks
you don't want to share cooldowns between eating an apple and running a command
erm
just make it an object so you can have separate cooldowns for stuff
ok im just asking
I guess you can do that
Or you can just give each cooldown a unique key and use the singleton
:p
lol like a multiton?
i do have a singleton somewhere
ok im about to test with calling setupCooldowns in my onEnable in main class
doesnt work

welp i have to go anyways so ill probably deal with this tomorrow
also you'll have residual data with your listener if you don't properly invalidate data on quit
it actually is already but yeah guess we have to deal with colls multiton from now and onwards
a singleton + objectpool can sometimes for the sake of convenience be a multiton
oh
i mean multiton is rarely ever considered a good pattern, but I mean you can find it being used every once in a blue moon
I'm making a system that needs to be able to get offline players by UUID, even some that have never connected to the server before and give their playername. So far, it isn't working and the playername is null by the basic Bukkit.getOfflinePlayer(UUID) method. Unless I'm doing something wrong, I wanted to use the mojang api to return information on the account if it didn't exist and then load it into the storage that craftbukkit uses to cache offline players. Does anyone know the method to do that in craftbukkit or where it might be?
Hi is the item on courser mean this?
the item on the mouse?
like so?
not the item in hand , but the item on courser right?
yes
ok then why my code does not work ..
it send the message , but it does not add the item
Try printing the material
i did it does print it
will raytraceentities go through blocks, and is there an alternative that wont go through blocks?
Is this factory pattern abuse?
``public class SomeObjectFactory {
public void registerBlueprint(String name, Blueprint blueprint) {
}
public SomeObject make(String name) {
}
}``
Don’t think so?
nice
Uh is this generated automatically or smth?
any idea xD?
i think it's intellij who inspected your code and it had come to the conclusion that it follows that contract and annotated it for later
to ignore rechecking it
Hmm... first time I opened bukkit in a project. 😄
it is not getting compiled
well all inputs are final
Doesn't that contract mean the method always returns null lol
yea
cuz im only doing the methods itself so i can put them in the other project
they're not populated yet
IntelliJ is relatively good at inferring contracts
you can stuff null into lots of things without intelliJ complaining
so thats what im using as a placeholder
public static Object getMeANull() {
return null;
}
nice
Meh, this needs a manual cast
public static <T> T getMeANull() {
return null;
}
there's also a bug in intellij where it assumes it returns null even if for a specific input it can't
Ah yes generics were designed for this
public static <T> T surpriseMe(T input) {
return ThreadLocalRandom.current().nextDouble() < 0.5 ? null : input;
}
and always surpriseMe("hey").charAt(0)
Imagine doing that with a 0.1% chance and then demanding someone to reproduce the error after they got it the first time
haha
thats what logs are for
im pretty sure even if theres a jackson in here hes got no idea what youre doing
oh wtf theres actually a java thing called jackson
Yes its the faster json library to just gson
And hella enterprisy
Ugh, I don’t remember but maybe yeah
Or at least u need to set some option I think
Ok, but why?
the JsonProperty annotation should suffice, no?
Jackson can just serialize enums by using their name
if you want to make them case insensitive, there's a MapperFeature for it iirc (ACCEPT_CASE_INSENSITIVE_ENUMS I think it was named)
public enum Icon {
ONE,
...
}
Will serialize just fine for properties
{
"icon": "ONE"
}
Explain what you mean by that
you can change the serialized name in @ JsonProperty
Are you using a weird enum morice?
Why not just have the enum and strings be named the same way?
Why not just use PYRO and HYDRO directly?
ask spigot
Sounds like you should be using Fire, Water etc as much as possible as well
And only map it to those fancy names such as Pyro and Hydro for the end user
HELP
I am trying to check if the player is currently allowed to build or if other players will block the building but im not sure what I should put in as the arguments, i cant really make new blocks in the world to input into it
?
I am calling a blockplaceevent to see if any other plugins will cancel it to see if the player is allowed to build
but im not sure what arguments to put into the event creation
there's BlockCanbuild
because i cant really create new blocks etc
or something like that
You don't need to create a new block
Why are you calling the event?
You can just use the existing one at that location
Well, then get the block at the players location...
Whats the text above the item bar called? Not the action bar the thing on the bottom.
The action bar
thanks coll
Idk what else there is
do you mean the item name?
I think he means the item names
cause you can’t change that
There's probably a packet that can be sent.
Well yeah