#help-development
1 messages · Page 274 of 1
so for example we could have one spawn
and then you can decide
"where do you wanna go?"
does this mean i get to learn bungee
- Survival server (what I was talking about)
or
2
the event server
oh and another thing
I am not sure yet how we will handle griefing
well if its mostly pure vanilla, then griefing is not a thing
Instant ban. Write a blacklist into spigot source for griefing
e.g. should griefing be allowed? Or would we rather say "Okay everyone can build stuff wherever they want, but you also gotta expect that someone else might burn your house down"?
I am not sure about this yet
that normally causes chaos from what ive seen
in almost pure vanilla you have to have some expectation that someone is going to burn your house down Xd
hm in that case we'd need some protection plugin. Or a custom protection plugin
I mean makes no sense to have grief protection but you can't lock your chests or doors
Or we could do a hybrid system
When you allow griefing you're pushing a narrative that will drive a lot of people away from your server.
for example:
well we could use towny plugin, and have a single massive town for everyone to build in with a single plot
"Okay, someone just burned my house down. But I can check who it was, 1 sec... okay, it was mfnalex. Now let's go to mfnalex's house and burn his home down, too"
then, if people want to travel outside of that, that is up to them
we could i suppose
did you buy towny?
and you can even set an NPC as the mayor of said large town
its free
towny is free o.O
oooh ok
theres only some addons that are paid
lol
yeah anyway, I'll spin up a new discord server rn
and invite anyone who's interested in helping setting it up and stuff
But another equally likely result is "someone burned my house down I don't want to play on this server anymore because I spent hours building it"
joined
but if you got any ideas already, ofc feel free to send them in general there
Please i need an explanation about player hands and how they work. Because im trying to block the hand usage where you can put them via letter F (default from mc), because i cannot understand how they works. You will ask why? The reason is that the OFF HAND is called when you place blocks too
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
Im using PlayerSwapHand
But its happen the same with both of the event
I dont kno why the f** treat hand from letter/key F, as the same hand which you use to place blocks
swaphand event should only fire once
So, how the heck i cancel usage of slot 40 from player or kno as letter F
Because if i cancel it from PlayerInteract them it cancel block placing, because the shity hand is also trigged when you place blocks, not only when you use letter F
Explain better
You can block offHand use in any event that implements it, Interact, Place etc
Yes 1m, im typing it via translator so oyu understand
I want to disable that you can place things in slot 40 of the player's inventory or via the letter F (both use the same slot). What happens is the following, when I try to cancel what I want, it not only cancels what I want but also overwrites the event of placing blocks. And personally, I think that this is very badly done, because Wednesday slot 40 or letter F use the same hand. According to the docs, the OFF HAND should only be the letter F or slot 40.
Do you understand know?
F is swop hands?
That why im not sure how to cancel it
Becaause there 2 ways of using what i want to cancel, either via slot 40 or using letter F
just always cancel swaphands if it's going to put anything in the offhand slot
Doesnt that also, cancel placing blocks too?
From what i test it does it
why would swapHands event have any effect on placing blocks?
totally separate events
That my question
For some reason OFF HAND is that slot 40 or letter F AND also is called when you place blocks
That is what im arguing about because they are not well identified or explained
only cancel the swap hand event IF it is putting something in the offhand
ok, but that only cancel putting them via letter F
Would it cancel putting it via inventory? Dragging nor shift + click over the item
if you want to keep 40 empty you have to listen also to inventoryClickEvent and inventoryDragEvent
Its difficult to understand because you keep talking about Placing Blocks when you really mean moving ItemStacks in your inventory
My ultimate goal is to totally cancel the use of the secondary hand in any form, since my client discovered that during the custom mini-game I made for him, he found that he can duplicate using the hand of the 40 or F slot.
prevent moving anything to the offhand in SwapHandEvent, InventoryClickEvent and InventoryDragEvent
ok
hello, do you have a plugin to custom nametag of player?
?paste
Don't send screenshots of code. Paste it.
ok
Unless you're meaning how to code one, it's better to ask in #help-server
i dont think there is problem in code. i did the same thing in eclipse and it was working fine
?main
You're getting those errors because the file structure is wrong
Either that, or you typed it wrong in the classes.
sorry i mistake
how do i fix it?
It's looking for a commands folder for starters. You also need to fix the plugins main class name
ok
can i just do it with refactor? or i need to delete the class?
Refactor
Thanks it got fixed
Hi lovely people, how would I make it so that my shapeless recipe would accept variants of a ingredient? In this case, I want to be able to use different bed colors to craft my item. Thanks in advance
/* Crafting Recipe */
ShapelessRecipe sr = new ShapelessRecipe(NamespacedKey.minecraft("teleport_scroll"), item);
sr.addIngredient(1, Material.ENDER_PEARL);
sr.addIngredient(1, Material.WHITE_BED);
sr.addIngredient(1, Material.PAPER);
Bukkit.getServer().addRecipe(sr);
is there any difference between using Bukkit#getPluginCommand and Plugin#getCommand?
Plugin#getCommand gets the command from the plugin instance. Bukkit#getPluginCommand Gets a command registered to the server and from any plugin.
so if i am getting a command from my plugin should i prefer Plugin#getCommand?
Yes
ok thx
Guys help , what could be the problem here?
public void onEntityDamage(EntityDamageEvent e) {
if (!(e.getEntity() instanceof Player)) return;
Player player = Bukkit.getPlayer(((Player) e.getEntity()).getName());
if (Main.getInstance().getGodList().getOrDefault(player.getName(), false)) e.setCancelled(true);
}```
except setExecutor()
yes
we already answered
this entire code is bad
@EventHandler
public void onEntityDamage(EntityDamageEvent e) {
if (!(e.getEntity() instanceof Player player)) return;
if (mainInstance.getGodList().contains(player)) e.setCancelled(true);
}
}```
ez
@EventHandler
public void onEntityDamage(EntityDamageEvent e) {
if (!(e.getEntity() instanceof Player player)) return;
if (Main.getInstance().getGodList().containsKey(player.getName())) e.setCancelled(true);
}
}```
now it works
tho you can use UUID instead of name
you really need to learn spigot api meh
its infdev 20100618 bukkit api 💀
what
?
Yes
what the heck is this
java.lang.NullPointerException
at dev.armlix.EntityEvent.onEntityDamage(EntityEvent.java:27)
at org.bukkit.plugin.java.JavaPluginLoader$54.execute(JavaPluginLoader.java:833)
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:354)
at net.minecraft.server.EntityLiving.a(EntityLiving.java:481)
at net.minecraft.server.Entity.a(Entity.java:613)
at net.minecraft.server.EntityPlayer.b(EntityPlayer.java:274)
at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:377)
at net.minecraft.server.Packet10Flying.a(Packet10Flying.java:22)
at net.minecraft.server.NetworkManager.b(NetworkManager.java:255)
at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:132)
at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:72)
at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:459)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:367)
at net.minecraft.server.ThreadServerApplication.run(ThreadServerApplication.java:13)```
if it uses java 13+
full error
?paste
^ use that
but its full error
That wouldn't be the full error.
is this your plugin?
yes
your Main instance might be null
can I see your plugin code?
cuz you get NPE
show your getInstance() method and instance declaration/initialisation codes
Yeah, need to see the code for the Class "EntityEvent"
public static Main getInstance() {
return instance;
}```
hey does anyone know how can i make gson prefer concrete type adapters over type adapter factories?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
That statement is false. An could be seen as offensive to girls...
wait it doesn't work like it should
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
containsKey is wrong for this.
if player is a key then it's not
wait wait
do you have HashMap<Player, Boolean>????
yes
bruh
No wait
memory usage goes brrt
String, Boolean
?main Not really relevant to the issue but still - Can lead to issues and it's not following proper coding standards otherwise
if string is in the list then it's true
if it's not present in the list, then false
reduces memory usage
list.remove()
??
btw
Set would be even better
Set<String> or String<UUID>
cuz you avoid duplicates
?personal kits
Well assuming they use a HashSet its not gonna be more effective in terms of memory footprint as a HashSet encapsulates HashMap
and yeah ArrayList is not quite scalable if you wanna check contains with it as that’s O(n)
There is some fully mapped 1.8.8 NMS mappings?
mappings being provided started being a thing I think at version 1.14
so the only mappings you are going to get for the outdated 1.8 version, is spigot/bukkit mappings or mcp
My problem is calculating realistic Y recoil
minecraft isn't really designed for realism to begin with
so yeah can see that being an issue
Knockback you mean?
i need it for bot pvp
Knockback
mby it was me? xd
no minion above did
i found method that calcualtes it nms
What did i ask?
Lol then just call that
Ah ok
is not complete, there is something more that affect it
i even found one thing
Well see where that method is called and what is done after
but there is still something more
it probly being calld by something before
mby not even connected with entity ineract packet
in the obvious way
Look at what is done when entitydamagbyentityevent is called in nms
Might be nms entity class
i even searched since entityInteract event
it not helps much
there is alot of .a().b() methods
Yes you need to read the code and figure what it does
i did my best and get this
double newY = getPlayer().getVelocity().getY();
newY /= 2.0D;
newY += (double) 0.4F;
if (newY > 0.4000000059604645D) {
newY = 0.4000000059604645D;
}
newY += 0.1D;
velocity.setY(newY);
but its not complete or something
there is still something more
Why do you say so?
i tested it
by giving hit 3 times every 10 ticks
????
wait
how can i make it so there is a tablist per world, like players that are not in that world are not displayed
there is 3 pakets will be send player with this formula Y velocity Value is
1: 0.46.....(the same as vanilla kb)
2: 0.32.....
3: 0.24.....
But with vanilld kb it soud be
1: 0.46.....
2: 0.38.....
3: 0.04.....
before 1 player is on ground, after 3 player is landed
believe you are missing gravity
if that isn't it, your numbers might be off due to rounding or precision
Does anyone has knowledge about annotation processing in Java? I have this simple example that suppose to generate test.txt file but nothing happends when I build the project
runtime processing
or compiile time
I only know about runtime processing lol. Compile time is probably a whole lot of bytecode I rather not do
Compile time
The idea is to make class that contains informations about permissions and everytime I build code permissions in plugin.yml are updated
compile time annotation processors happen before compile time
not sure what processor you are trying to use, but typically the code for such processors is not part of the project itself
I want to get a custom sound name. What should I do?
for(Sound sound : Sound.values()) {
completions.add(sound.name());
}
don't custom sounds take the place of an existing one?
otherwise don't think you can do it from the API since the custom sound isn't known
Hmm... I don't think I can? ;-;
well you probably can
just not from the API
that means most likely having to do it from NMS
Have you got idea why prosessor I've sended do nothing. Should I configure something in maven or Inteliji ?
as I said, I don't know what processor you are using
you would need to look at that processors documentation
The AbstractProcessor
are you saying you are trying to use Java's annotation API?
The sound added as resourcepack.
{
"example": {
"sounds": [
"custom/example"
]
},
"example2": {
"sounds": [
"custom/example2"
]
}
}
I guess people in all tutorials I've seen are using the AbstractProcessor
yeah that is Javax api stuff
Anyways, you are going about it the wrong way then. There is a reason something like lombok is provided as a maven plugin
lombok is an annotation processor, but because it generates code at compile time, it needs to happen before Java compiling actually happens
you can't really do that inside the project itself
so you need something like a maven plugin where you can utilize a lifecycle before the compilation process to actually do what you need done
I am going to assume the tutorials you were following were for creating your own annotation processing? And probably failed to mention the caveats lol
its asking for a double but its a double, what should i do?
you are using the wrong method
add() is for adding two locations together
yaw is part of the location itself
good point I will move the proccessor logic to my API project
i want to get the players Yaw
full qualified location object contains this World, x, y, z, yaw, pitch however to make a location object valid it only needs the coords which is what add, sub, and all those math methods interact on. So if you want the pitch to be changed you need to create a new location object with the new pitch or yaw added. if instead you want to teleport the player with the current pitch and yaw they have, then you don't need to do anything except continue doing your math stuff.
How would I properly teleport a player that has entities riding it?
I tried ejecting the passengers first, but that doesn't seem to work.
I also tried the teleportTo nms method.
That seems to work sometimes, but not always
dismount the passengers first then teleport them all, and then remount the passengers
you can get the passengers by calling getPassengers() which should give you a list of all passengers
Do I have to wait a few ticks before teleporting, because that didn't work for me 🤷
might have to wait a tick after dismounting possibly
and then wait a tick after teleporting all entities since they don't all teleport exactly at the same time
to ensure they are re-mounted
but the easiest method if those entities are custom
would be to kill the entities retaining their info in memory
and then just respawn said entities at new location and then remount after player has teleported
Okay, will try that, thanks
damn, thank you man
fun fact about teleporting
i did what i wanted to do with setDirection and now it looks weird xD
when an entity teleports in the same world, it just travels really really fast
i knew this with endermen
if you were to slow the server down, you could see this happen where the entity kind of zooms off
Another fun fact about teleporting:
When a player has a passenger, and you try to teleport him with a plugin, good luck.
Enderpearls and vanilla teleport command work just fine though
Just steal /tp code
Or execute the command to tp them😂
If that would allow me to teleport to other worlds via argument, sure
is there a way to get enchantments over level 5? For example level 6 prot?
Add unsafe
Seems like removing an AreaEffectCloud does not dismount it from a player 🤔
?
One sec
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
found it, thanks!
Nevermind... Was because of an EntityDismountEvent being cancelled by the PrefixSystem...
Even though I don't think that should be expected behaviour, since the cloud should be removed entirely 🤔
what does args[0] return in this command? /tpa someone "someone" or "tpa"?
someone
ok thx
can we get keyboard inputs with spigot?
Only those that give an action ingame
well ya can. if you write a custom client along with it :S
ooh ok
Hey yall if anyone could assist me, that would be much appreciated
you need to use RecipeChoice.MaterialChoice(Material... possibleMaterials)
the actual ingredient part can be replaced by such a recipechoice
oh wow, is that in the docs? I was looking at BlockData
you can pass on an exact item requirement as well, but specifically for shapeless recipes this doesnt work so you'd need to make your own implementation that way
yeah if you look at the methods for addIngredient you see there's options to add just a material, like you did, or a RecipeChoice
what
git add <file>?
Git add
shouldnt do that unless you yourself deleted them in your commit
did you do git remote add origin https://github.com/yourrepo.git yet
Hello , i have this class :
its for my QusetEvent
and i use example :
what iam trying to acheive now , is get the event from the config as i have it rn
thank you heaps, Ill read up the docs for it
i mean idk what to tell you, should be able to add files and commit and then push them just fine
i still dont know what you're trying to do but where is the part where you save this stuff to the config
you can legit give it a base parent class and make him create children using the given info
HandlerList singletons should be in concrete events
really?
yeahh
its insane
i made a base kit class
and each class i make extends it
so i gave chat gpt the structure and it made me more classes
thats what i'm talking about
let me try that
and you say event.setcancelled is wow
the key to getting good output from him is feeding him data step by step
and not throw it at him all at once
alright i will try that
yea that actually works fine hahahah
I told youu
I mean you can make way more than that
It can in principle design whole infrastructures
it was cleaning my code and it stopped responding half ways \🤔
cant u just ask it to continue? haha
idk didnt try, it was giving me same code i entered anyways
i will sent it now
sr.addIngredient(1,RecipeChoice.MaterialChoice(Material.WHITE_BED, Material.RED_BED));
Sorry mate, did you have any working examples?
damn thats what happens when i leave my pc on
this doesn't work?
oh yeah you do
gotta instantiate them
didnt notice
Like this?
So it just knows it requires exactly 1 of said item?
if you look at the docs you see that there is no method that takes in both an integer and a recipechoice
only a recipechoice
alright this is making more sense to me
But what if I had to lets say have more than 1 item to put into my recipe
lets say I had to put in x2 beds
then you do addingredient again idk
haha alright, that more or less works for me
lemme double check how i did it
yup pretty much just repeatedly doing addingredient
this is how iam creating new Quest :
i just want to know if its possible to call the event from the config file :
make that a builder lol
you Mean StringBuilder?
builder pattern to construct that quest
and why are you calling config.getConfig() like 100 times
Any Idea why this collides for the next person?
it should be per player
any idea?
merry xmas losers, hope you get good as a gift
if you have a problem with that 1v1 me in rocket league
especially you @worldly ingot
1v1 me in chess
can we play actually? @torn shuttle
of course, 'tis the season to be giving nerds in spigot a virtual wedgie
Join the challenge or watch the game here.
@lilac dagger that was a trick, chess is for nerds and you just proved you were one
what rating are you?
I think I played chess 3 times in the last 10 years
Wanna play?
sure
let me give you a link
Join the challenge or watch the game here.
@torn shuttle you're pretty good
you didn't blundered your pieces
I used to be a bit into chess but I stopped as soon as I got invested because I immediately realized it was just a memorization game and I hated it
i mean later on you did
true
I just like the strategy part of it, if you're just remembering openings and counterplays you're not playing against a person you're playing against a meta
I actually took my hnefatafl board to play with my family for xmas instead of chess, I just find it way more interesting because no one has played it enough to have developed a meta
and it's a fun game
how can I get the block that the players is aiming at?
Use the rayTraceBlocks method
whats the double?
declaration: package: org.bukkit.entity, interface: LivingEntity
wasn't it the range of the trace?
Time to read the javadocs
ew, reading
RayTraceResult rayTraceBlocks(double maxDistance)
I'm more of a write-only mode type of guy myself
gg
nah
Yh
~1500
Ah
struggling to get it higher
I was 12-1300
i see
But i stopped
database <—> custom server <—> minecraft servers
Is that a good way to keep mc server data in sync?
Yes but redis won't be able to communicate with sql
My main issue is data saving latency
Data saves slower than joining another server
If redis can work around this, I'll be happy to use redis
^^
I know that
Are there any public plugins that use redis?
Specifically to sync data that changes vert regularly
Hi, is there a way to get a Minecraft inventory out of a Bukkit's ?
(There's no getHandle or any other obfuscated method that returns a minecraft inventory)
is there a way to make a copy of a class where data is saved inside that class?
Imagine you have a class for players data like (Level, Xp) and what i want to do is store inside that class their Level/Xp when they joined(so when class is first made, like new UserData(player) and use this UserData for that data. and then I want inside that class to save the "before" progress and upon leaving update on the mysql(instead of forcing an update all the time, want to do one when players leave, so this way it checks if their data changed and updates only what's changed.)
is there a way to do it? I've tried to make 2 different classes but its not working, i've tried setting a "UserData before = this" but when updates the data, is also updates on the "copy" version so then there's no change and no updates happen.
is there a way to make such a copy using some "this" or "copy(this)" class thing?
if none of this exists i will just create even more variables with the numbers upon joining and checking that way, but ofc having one variable which is a copy of the class would be way easier.
i believe you can do
class UserData implements Cloneable {
// ...
public void clone() {
try {
return (UserData) super.clone();
} catch (Exception ignored) { }
}
}
{
// to copy
data.clone();
}
and make sure you clone mutable reference types too
public class User implements Cloneable {
private User before;
public User(Player player) {
// get all the data from mysql
try {
this.before = (User) super.clone();
} catch (Exception ignored) { }
}
public void saveDatabase() {
User before = this.before;
if (this.variable != before.variable) {
// update on mysql.
}
}
}```
i just did smth like this
worked fine, what do you mean by "clone mutable refence types"?
deep clone
you clone the values of the fields in the cloned object
so your clone isnt referencing the same object as the original
i dont know if java does that by default
it did work as intended tho, it got the values before correct and updated on the mysql
but that shouldnt be an issue if you only have primitives in your class
Hello why its like this and how i can solve this
e.setJoinMessage(joinmessage);
[21:37:32 ERROR]: Could not pass event PlayerJoinEvent to FoudreLobby vv0.0.1
java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getString(String)" is null
at com.tr.denizusta.foudrelobby.events.OnJoin.onJoin(OnJoin.java:17) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor30.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.5.jar:git-Paper-794]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PlayerList.postChunkLoadJoin(PlayerList.java:356) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PlayerList.lambda$a$1(PlayerList.java:303) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PlayerConnection.tick(PlayerConnection.java:316) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.NetworkManager.a(NetworkManager.java:408) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.ServerConnection.c(ServerConnection.java:168) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1520) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1347) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1135) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]
```Hello why its like this and how i can solve this
e.~~setJoinMessage~~(joinmessage);
when i join its give me this error
it literally tells you what's wrong
i can solve config but the e.setJoinMessage thing
FileConfiguration.getString(String)" is null
ik
its shows me e.setJoinMessage("Hello");
paper api is stupid and deprecates like anything that uses legacy text
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
:ı
how can i store a pig's instance so i have it after the server restarts
basically
there is pig
that is very important
it cant die
how do i store it
give him nametag (jk)
stop pinging me
ok.
setPersistent(true) or something
or just respawn on server start
sure
?jd-s
Well if you make it so it is immortal and make it persistent then it will never die unless some other plugin deletes it
@mighty pier you could handle the location two ways, you could do a player interaction event so if a player enters x amount of radius... then load mob or if you want it always there static you can do it in onEnable
what would be the best way of implementing mana (like hypixel skyblock)
my idea was to store all the players' max mana on a database and when they join, they get added to a hashmap, which is then used as a way to withdraw the mana as time goes on and add mana as time goes on
?pdc on each player object
What...
What did you do to think you need that
You don't need to
You can just git commit
what commands are you using
It's because the git histories have nothing in common they need to be pulled in
lets just use ij
yo
updated the nms tutorial to include a better explanation of NBT, as well as custom biomes
you are running git init on every commit ?
you realize you can just do git stuff on the ide directly
what are you using when you want to commit stuff
that is why i was asking for your commit commands
.
that is not ran on every commit..
Don't tell me
I would just do a scoreboard/boss bar - make your own mana system, /mana displays the bossbar or whatever
what is the best way to paste schematics without requiring WorldEdit or any other 3rd party plugin?
I have thought of structures but not quite sure if thats the best way
doubt there is one
Store any kinda data like that directly on the player. Using PDC
its probably because you dont have readme on your local repo and you are using -f flag
fetch origin first
I would just store everything in a config using a loadManaFromConfig() method
if you have alot of players a mysql
That sounds like a lot of work for something that PDC would make 100x easier
i do these kinds of things to get better at java/spigot, so i think pdc would be better
since i havent really gone into it
im new as well, can someone explain pdc ?
?pdc
ty
Don't use configs if you can avoid it
afaik what pdc does is store something in the player_uuid.json file?
Is posible to make automatize github merges? So i dont need to aprove the mergue request manually, so on every push to a secondary branch, compiles that code, make unit testing to it and finally merge the changes into main branch
And most weird thing, was created by the one who started the creation of Linux!
Oh wait
I was taking about Git
That why i answer tha
This might help https://github.com/features/actions
Oh but i depend on shity github 💀
I was looking if there is something else, like i dont wanna be limited by github
And i wont pay any $ to microsoft
Hahaha that why i asked if there where any alternatives
gitlab?
Probably nothing else, i would just have to build my own repo-action system
Oh Gitlab i will give a try i never use it
Tonnes of stuff
pretty sure a ton of them exist
thats sad
Can't pretend you're the only dev on the planet to have this issue lol
I guess ima end up with supporting multiple plugins
Yeah ik, but as far i couldnt find anything i asked here
But most of the time its diff to give confidecen to 3 rd party platforms which are not famous tho
so if I wanted a player to edit something getting stored by the PDC API how would I go about that?
woops
sorry wrong reply
I will recommend reading PDC api
?pdc
Would it be very heavy to run code executing each 50 server ticks that would display actionbar message to people if they are on X world?
thats every 2.5 seconds right?
correct
whats shitty about github?
Depending on what kind of data you're pulling to display it should be no problem
Their fkg limitations and specially when you dont want to pay them for something it should be cheaper. But as they are from Microsoft, prices go up, just because of the brand
?
just text component
what limitations?
Yeah that'd be fine.
Just make sure it necessary and optimize from there
Github actions are limited, you cannot do more than 4K of them per month
And like that you have many others
what actions lol
Github actions, the ones used for CI/CD
raspberry pi aaaah
Whenever player joins the game they're placed in a lobby. Now I have scheduleSyncRepeatingTask sending them actionbar message to "pick a gamemode", but whenever they exit the world it just keeps running... and I just realized I can add check just for the schedule 🤦♂️
wondering what these things are
dont use scheduleSyncRepeatingTask, use runTaskTimer
Use an arraylist or map and take them out of it when theh exit the world
Why? If i can use my 32 threads, 128gb and 2tb dedicated server
GitHub actions is only limited when you're not open source remember
Yeah i was needing it for my project i will do
Not a pi but you could use one
I've switched to almost exclusively using GitHub actions right now. I've used primarily teamcity in the past tho
i only have a damn pi
Ofc teamcity is paid and has limitations. 100 build configurations and I think 2 or 3 runners before u gotta pay and teamcity pricing jumps to full enterprise pricing immediately.
I do feel sorry for GitHub with all the storage I use on packages ☠️
It all started when a company divided the partners and auctioned much of their equipment. Specifically I paid $US 400 for the lot, I bought it just because they were 2 servers, network cable and some tp link routers. And then I bought it more than anything with the hope that the servers would work. Because if you want to buy them to a third party. Already in itself, used are not worth less than $US 1600-1700 each. And for the price it was profitable if they worked. And then after I bought them, the first thing I did was to plug them in, they didn't turn on and I got scared. But after I opened them, my eyes shined because they didn't have the battery and that was the reason why they didn't work.
How can I display the entire skin for NPCs (second layer). I tried some code in the spigot forum but none of them worked
The Code: ```java
public static void addNPCPacket(EntityPlayer npc){
DataWatcher watcher = npc.getDataWatcher();
watcher.set(new DataWatcherObject<>(16, DataWatcherRegistry.a), (byte)127);
for(Player players : Bukkit.getOnlinePlayers()){
PlayerConnection connection = ((CraftPlayer)players).getHandle().playerConnection;
connection.sendPacket(new PacketPlayOutEntityMetadata(npc.getId(), watcher, true));
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc));
connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
connection.sendPacket(new PacketPlayOutEntityHeadRotation(npc, (byte) (npc.yaw * 256 / 360)));
}
}
Why would you have more then 4k actions per month lmao
Remember that every remote push of code, its one less action
Why would you have action on every push of code
Maybe because of the CI/CD system?
pull request ?
HMn let me explain
You want to run tests on every commit
also on pull request
Many people also have test deployments, especially on websites
there is literally no excuse for you to do 4k actions with in 30 days
like you dont even do mvn verify 4k times
I think if it was more than me working on my projects I could hit it.
spawn before metadata
Sadly I can't see the usage stats coz my repos are all open SRC D:
basically send the metadata last
yeah but if its big company, you would have enterprise, not classic free account
I mean legit 2 people. Not an enterprise
The following happens we have a CI/CD system, with which in each thing that someone is going to add to the root project, creates a secondary branch where he makes the changes that he is going to do. Then another dev, wants to make other different changes so he creates another branch for those changes. Then when they finish and make a pull request to the main branch, the branches that contain changes are deployed to the testing server, compiled and executed. In case of failures, then the request is denied with the error occurred. And in case of success, the pull request is accepted and joins the changes of that branch to the project.
maybe on pull request sync, but definitely not on commit
My main cost no matter what would be packages tho. Packaging java makes those images chonky
It still does not work
500MB of package storage, maybe 2 docker images for me ☠️
yeah and that means you have over 4k prs per month ?
Depends on how many changes they make
if you have 4k prs per month, you are definitely not individual who is doing coding as hobby
I told its a project
💀
We are around 23 devs
so pay for github 💀
I wont pay for something that only is expensive just because of microsoft property mainly because of shity brand
i mean, you dont have right to complain then, use local git system
For real you cant complain
That why i asked if there was any free alternative for making continues integration without github
So that why we are planning to design our system for private usage so we dont need to complain
smh me not reading whole conversation
That why, if you are oing to argue, you need to read whole conversation
If not just talking for talk
right
if (playerTeams == null) {
// Initialize the map of player teams
playerTeams = new HashMap<>();
}
``` this should fix it
Why dont just, make a final map? 🤔
ah right
private final Map<Key, Value> teams = new HashMap<>();
I have seen that many ppl initialize them via the construcotrs i dont know if it have a reason but i always initialize them as final
bruh
nope
really?
has anyone good API for signs? cuz https://github.com/Cleymax/SignGUI doesnt work
yep got it
i want just open it for player and get text from line
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
?paste
Hello do you know why my action come 2 times when I click one time on player
here is my code: https://paste.md-5.net/ejaburudun.java
(That's send my message 2 times)
Its called one for each entity if im not wrong
The one who is interacting and the one who was interacted
Na dont worry man we are to help
1.12.2
Because you can use the docs which tell you everything about the api
In java exists something called javadocs, which is like the manual of products, but for coding
have you seen that when you bought a mouse they sent it with a manual, well on coding you have the same called docs/documentation, in Java specifc name is Javadocs
Okay Thx 😉
documentation basically
yeah
@weak bear 1.12.2 docs https://helpch.at/docs/1.12.2/
Your event docs: https://helpch.at/docs/1.12.2/org/bukkit/event/player/PlayerInteractEntityEvent.html
Does anyone have HEX Color Translation, that works with Components?
Kyori or mini message
They allow you to use hex colors, maybe can take the code from there
tysm
Your welcome
this is going to take a long time
im wondering for the min, cant i just do double min = ctx.get(0) too?
drank too much
cant think clear lol
im not drunk
Yeah he barelly didnt drunk anything
thats just me putting my pc on hibernation and that discord plugin bugging
But i can code for 12-13 hours, always taking some time for eating, going to toilet and some break
lol im here just re-programming the Annihilation plugin for 1.19.2
That why you shouldnt use legacy versions 😬
there isn't any good Annihilation plugins out there
u still need it
I found one but it lacks so many configurations
in the meanwhile looking at this shit lol
and it's not open-source, making my life hell
yes
ok hold on
Are you trying to say animations?
?paste
nope
Because i have seen many plugins for making animations
Hey please for general topic please use #general
Because we flood the help coding channel with none related things
Ah right
thats what happens when you change one line of code
It would be easier to use their API ig?
ig?
I guess
ohh ok
Yeah you can do that too
Most of ppl relationate ig for instagram tho that why you take me out from my position
ikr
but im too lazy to type out I guess
ig = {'I guess, 'Instagram", In-Game"}
or im gay 😳
|| not me tho ||
ingame is ing
some people refer to it as ig
roblox users specifically
lol
if i want to move from one nms mapping to another would i have to do it manually or is there a tool for it
roblox sucks anyways
Any way for me to select a random worldFile from plugin directory
plugins/MyPlugin/worlds/
And load it
So i'm trying to make it that a certain type of palyer(custom player type) can deal more damage with bows but for some reason it doesn't do that ive been trying to fix it and I think i'm not setting the damage output correctly
public void damagee(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Arrow) {
Arrow arrow = (Arrow) event.getDamager();
if (arrow.getShooter() instanceof Player) {
Player player = (Player) arrow.getShooter();
if (playerclass.containsKey(player.getUniqueId())) {
if (((customPlayerAttributes) playerclass.get(player.getUniqueId())).getPlayerclass().equals("ARCHER")) {
arrow.setDamage(arrow.getDamage() * 2);
}
}
}
}
}```
I tried 3 versions
all of them resulted in black color
EntityDamageByEntityEvent#setDamage
or something like that
setting the arrow damage won't do anything, the arrow has already dealt it's damage
the hell is the invokedynamic doing there
lol
md-5
i tried it with melee instead of arrows and it works even if i do event.setDamage
Because you have to do event.setDamage, NOT the arrow.setDamage
https://paste.md-5.net/wunoyusuzi.java
heres just the hex part
below is just other utilities
dont mind that legacyHex
whats the problem actually
this is supposed to be #AAFF00
oh ok
oh
the first black one
this is how it should be looking like
yep
1.19.2 to be exact
?paste
TextComponent#fromLegacyText works fine tho
just puts hex(preSetColor onto message
yep
brah
thought it would be same
cause their servers are dead 😄
well I could potentially have multiple HEX Codes in one String
never used Adventure API
So I'm making a plugin which loads a world on startup
/ WORLD MANAGER
public void loadRandomWorld() {
File worldsFolder = new File(getDataFolder(), "Worlds");
if (worldsFolder.isDirectory()) {
System.out.println("\u001B[32mWorlds folder is a Directory, Loading\u001B[0m");
// Get a list of the files in the "Worlds" folder
File[] worlds = worldsFolder.listFiles();
String worldsString = Arrays.toString(worlds);
System.out.println("\u001B[0m" + worldsString + "\u001B[0m");
// Generate a random index to select a random world from the list of files
Random random = new Random();
int index = random.nextInt(worlds.length);
// Load the selected world
String worldName = worlds[index].getName();
getServer().createWorld(new WorldCreator(worldName));
} else {
// The "Worlds" folder does not exist
}
}
However, It doesn't actually create a world. I can't see it under /mvlist (Multiverse Core)
are you sure getServer().createWorld(new WorldCreator(worldName)); is the only thing you have to do?
dont you have to load it manually using Bukkit.loadWorld if that even exists
does create this big red thing :D
hi i need help
I'll check
nah theres only unload
WorldCreator wc = new WorldCreator("world_name");
getServer().createWorld(wc);
very useful
I want to make a server in which several versions can be used, how can I do it?
ok thanks
seems to actually create the file https://paste.md-5.net/adehukusix.cs
CraftServer#createWorld btw
right
How can I play the chest open animation on a chest?
i hope readme is looking reasonable now https://github.com/FourteenBrush/MathExpressionParser
declaration: package: org.bukkit.block, interface: Lidded
any1 here any advice on how to best implement a data structure for kit editing?. my first thoughts are to map old slots from the default layout to a new slot. any thoughts?
ah right
what do you mean by kit editing
mvn reload
check the repo actually has the artifact you’re looking for
nope
that group ID doesn’t seem right
the version should only be in the version tag
is that really how they do it wow
removed && reloaded
are you sure the module and the version are the same
was gonna say
What's the module then? 🤔
it says to put module on artifact and group
The module should be in multiverse’s documentation’s or their GitHub probably
right
try multiverse-core
aight
module name’s probably whatever comes after the hyphen in the documentation’s module list
Same with artifact
Artifact isn’t lowercase
ill go on their discord
capital C
remove the hyphen in between multiverse and the module name for group ID
their documentation doesn’t include it
lmao
makes life so much easier
right so I need to make the plugin clone the world from the /Worlds/ directory and move it to the root directory
then MV will load it
(just talking to myself)
How come this prints out "Oh no" when I click a chest even though it should be an instanceof Lidded
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (block == null) return;
if (block instanceof Lidded lidded) {
Bukkit.broadcastMessage("Opened");
lidded.open();
} else {
Bukkit.broadcastMessage("Oh no");
}
}
sorry for the late response. what i mean is simply a data structure that allows me to easily save an "edited" version of an existing kit. meaning the player can only change the location of the already existing items.
a map with the edited items locations and then for the absent items of the kit just take the fallback location from the default one
so if you move your sword to 9 only save that and then for all other items that aren’t that sword use the fallback location
unless I understood that wrong
with that u mean a map mapping old slot ints to new ones then?
Nested ifs!
Heh?
since saving items in this case seems sub-optimal
are you looking to save on space or performance
both
how often do you check people’s kits’ item locations
quite often. as it will happen every time a player respawns with a kit they have edited
and dying is quite common in this gamemode
then I would use a mix of both suggested solutions.
store all items in a map to read in memory each time the player respawns
and if you want to save these slot changes to a database or a file just store the items they moved in their inventory to avoid saving unnecessary item locations, which are the default ones
yea those were pretty much my thoughts as well. tho i had not thought of just not saving default locations
I may be wrong but iirc you get the block state I think
thats a pretty good idea
yeah that saves on disk space
thanks
if blockstate instance of lidded
yes Chest has BlockState as a superinterface
Who is tagging me? My bad i see the tag
Disco bugs tho sorry zecken
ah right
Why using Player as Key? I would use their uuid instead
Stores Players
oh
Aight
But depends on what you will do then with the teams
there’s nothing wrong with it if it’s some sort of mini game
if people leave and are therefore removed the the game you could setup a cleanup task to evict them from the map
Player as Key is highly intensive, because you are looking in the map if every field equals to the player obj you give to search
Sorry for sound rude, but have you learnt java?
nope
I thought it only compared their uuids anyway
Nope, currently learning
oh no, my bad, it compare the name and uuid
oh ok, that makes sense
I get the logic, It's the syntax
I have experience with discord.py and Lua n such
if he uses UUIDs he then has to get the player corresponding to each uid anyway which is equally expensive since it loops through online users
and for a mini game I think it’s not needed tbh
ok, but lua and python are really diff from Java*
Yeah im drunk from yesterday hhaha
not entirely
at that point it’s just preference
I would said nothing related or similar, because they are not Highly typed langs
I know, I know
I'll split it into seperate classes
oh im stupid
I had an extra }
I would suggest reading about OOP (Object Oriented Programming) that will make you understand how to divide the things and not have one class with 10.000 lines where you can divide the logic
This is a mess, really needs to be split...
will do
I will!
I know what he has as issue, just suggesting that ina future
So?
Why you complain
you could also just make an EnumMap for relating TeamColor to a List of Player/UUID to avoid using players as keys
that also allows you to quickly get all players in a team without using streams or filters
I'm just used to doing everything into 1 script and using Ctrl F to navigate
+1
Right
Yeah that why i suggested reading about OOP
