#help-development
1 messages · Page 1874 of 1
OK
data.set(playerName, player.getLocation().toString());
player.teleport((Location) Objects.requireNonNull(data.get(playerName)));
This can't work
what's the return value of data.get()
yml file
File f = new File(whes1015.folder, "PlayerData.yml");
dataFile = f;
data = YamlConfiguration.loadConfiguration(f);
I should store each parameter separately?
you dont need to do that, just set(path, location)
and use getLocation(path) when you need
Thanks
I have another problem about Geyser floodgate can you help me?
That main looks nasty
😢
I use event.getPlayer().getUniqueId()
Get all bedrock player as the same UUID
What's the event for a grass block turning to dirt when a block is above it
I've tried BlockPhysicsEvent and BlockFadeEvent
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockFormEvent.html mayb @modern vigil ?
declaration: package: org.bukkit.event.block, class: BlockFormEvent
how can I add a list to a yaml file
By using set method?
that works?
Why not
so to get it ill just use get?
thought that wasnt a thing since setList isnt
listname:
- el1
- el2```
I mean, set can accept all types
get() method can return only one, fixed type
Thsts why there's getString, getStringList and such
SpawnEggMeta#getSpawnedType() is deprecated, what should is use as a replacement?
isnt the item-type equal to the entity spawned ?
Why is there no InventoryClickEvent#getInventory().getName method?
i newer versions ?
because the name is now in InventoryView
You mean the material? or am i misunderstanding?
yes
how would I go ahead and listen for InventoryClick event then, like when a player clicks an item inside the inventory
using an InventoryHelper like i did makes everything easier 😄
huh
example?
but you can use event.getView.getTitle ^^
i just coded it my self ... not perfect but it helps a lot with inventorys
Hello, I think that I'm trying to do an impossible thing, but why not ¯_(ツ)_/¯
I need send all messages to an endpoint and replace the chat text with the new one from the response(like a translator). I'm already caching responses for same messages but is there a way to not freeze the chat while the translation is in progress?
Someone has understood the usage of threads :)
can you make an example?
should I cancel the chat event then start the thread and send the message with player.sendMessage()?
Use a BukkitRunnable it's probably the easiest for you
Run it async and handle stuff there
like this but with the bukkit scheduler, right?
Yes
ok
I mean, you should never start threads that often.. It is expensive operation
google has a lot examples 😄
I know how to use a thread, I was referring to this specific case
isnt chat async, shouldnt it not affect main thread then? 😎
thats why you need to spawn an entity that is hidden from anything in the world and in its class you use Threads that only get cancelled if the server shuts down ... if you want to access that entity data u just use Reflection to set variables and change the way those threads work
yes but it blocks the chat thread until the web request is complete
what
What's the right priority to ignore an event if it's cancelled by worldguard?
i've set ignoreCancelled to true
then no priority is right
custom entitys dont lose their data on reloads ^^
you can also store plugin data in worlds or entitys as Lists and more ... you will never lose data on reload if you dont want to store it local in files
guys how to make a new .yml?
right click -> new -> create file and rename it
bruh
if you mean automatically, use the file class
if you just want to create the default cfg file, your main class inherits the methods to do so from Plugin/JavaPlugin
oh nvm i found the tutorial xD
ok so i have a question, how to setting only the head is visible(sorry my english kinda "BAD")
hey, i'm trying to make a permission that reads the last number and passes it to the code (example: "homes.4" i'd like to get the 4). Is that possible?
Sorry if it's phrased badly lol
wat
you know vanish plugin?
do you want a player to only have a floating head?
yea
you can equip him with its head and make him invisible
if you only want to show the head to some players you need packets
ah yes smart, but the first person...
doesn't have hand :l
Player is invisbile for eveyone exept themselves
This way the hand will show
how
packets
nms?
or spigot's method
I recommend Protocollib
both nms and protocollib are valid
ok but how ...
i don't but if you need cross version compatibility i do
They have a guide on how to use it
@chrome beacon do you have the protocollib docs?
ok
there are plenty tutorials
.
i'm pretty sure essentials does something similar
anyone know if theres a good tutorial for custom chunk generation? i wanna make a chunk generator that has vanilla stuff, and also custom stuff like patches of custom blocks, structures, etc - and all this in a method that can generate expandable chunks, so like if i use the method in one place, and then later i decide i want to add another chunk of terrain beside that original chunk, it will continue that chunk
World Generation is very complex
ok, but where do i start?
Start by looking at NMS
there are world gen apis that dont use nms
isnt it depracated?
But to add stuff you need to understand how things work
thats not possible without nms
It is
freesoccer i mean, you redirected me to terra which doesnt
unless you implement your own perlin noise etc i dont think it is
also chunkgenerator is deprecated now isnt it
I have no idea
its not possible to generate a chunk new with the ChunkGenerator API and modify it when called custom
no ... just the ChunkData thing where you do everyting at once
Either way you're not ready for custom chunk generation iDerpy. I don't know why you keep trying to do the hardest things possible first
so true
You need to lower the scope for your projects
^^^^^
i do not care if i "cant do it", i will learn with my own way and work my way up, however, i do not know what i need to know for worldgen so thats why im asking
You keep comming back here with how to questions of really complex things that not many can awnser and requires NMS. Your best option is to reference the exsisting code
you cant learn it in your own way if you ask everything here how to do it
^^
First, you need java and oop
asking people and watching tutorials is my way of learning
thats not the issue
i myself have started coding with tutorials
the issue is you wanna skip the hard part
that is the most important to get the basics
but do you, i couldn't care less
and i have told you multiple times already
ok, what should i learn now then
learn how to get gf
to work my way up for things like worldgen
it was rly pain to understand how the World creation system works and how the ChunkGenerator works too ^^ it is rly complicated and need a lot nms if you dont want to generate boring Worlds
Minecraft AI is quite easy to work with
At least in newer versions
The goals API is neat
in older ones the obfuscation kinda makes it painful
Well yeah old is pain
brb, if you want to really help: message me with stuff i should practice for spigot and java
you get to a point where you have object.a().d(something)
and go guess what tf it does
map it yourself 😄
just yesterday i needed to make a stand marker
guess what was the method name
n()
there is an api in spigot/bukkit for goals ??
Having a good enough understanding of Java to look and see how NMS works is a good start. Take a look through some classes and see if you understand it. If not google and try to understand and learn
i would start with how events and commands work ^^ then schedulars, configs and how to create an gamemode like BedWars
No. The goals system is part of NMS. I've seen that Citizens appears to have a wrapper for it which is very cool if you want custom mobs / npcs
Not sure if this would go in here but, how come I'm getting a unexpected value return when running this? (I'm working with loading slime region files)
ok .... was wondering about it since i never saw that ... also i try to avoid other apis where i can ... so no protocollib and citizens too 😄
its not that hard to code both things
The return isn't going where you think it is
The weird but is that if I make it sync it works fine.
But I don't want it to be sync (since it's loading a world).
And yes you can load async with slime.
Highly recommend using those two
i know they are good.... but i wouldnt learn stuff if i just use them ^^
protocollib makes stuff slower for me
If completable futures are confusing you make things async with the bukkit scheduler
?scheduling read this
i've just made a cancellable PacketEvent myself by injecting in the duplex channel and constructing nms packet classes is far better imo
same way for me
sending spawn entity packets is painful but nms you just pass the entity and it does it for you
i love it
NMS packets are arguably easier
Yes I know how the scheduler works that's not what I'm getting at. Where is it returning?
But I can be bothered to rewrite the code 10 times
guys what do you think of my nametag api
reflection
It's not
a bit too much stuff i think
So how can I make it return then?
Fine let's keep using the CompletableFuture
oh btw incase u didnt read yesterday it doesn't lag at all and follows me perfectly
not a frame drop too
and it's 4 entities per line
yeah i saw that post ... after scrolling through 10000 other msg
So your problem comes from the fact that your return statement points to the whenComplete and not your method declaration
wtf xD
I will not stop repeating: reflection based code is maintainer nightmare
you would have finish this in 1 day if you stop using 1.8 xD
i know lol
and also if i didn't keep wasting time
i need it for a project of mine and also for a commission for a server on 1.8
that won't update
so
Wrong channel also tells us nothing
Well nothing we can help you with then
So would I have to return the initial whenComplete?
I feel like that wouldn't work
i've tested different heights
but i can't find a good one i like
best one yet was bat with a -1 size slime on it
why not just use an armor stand and then set marker to true? That would give it no hitbox and also 0 height
i can't stack multiple ones on top of eachother
else the lines would clip into eachother
1.8
Oh oof
That's why
marker stands work the same way in 1.8 as 1.18
Not sure why you guys are adding laughing emojis though
Marker removes the hitbox
Does it work in 1.8?
because he is a poor innocent soul that doesn't know what i have been through yesterday
lol
exactly
i guess i'll stick with bats unless you got any ideas
hold on ill show how it looks like
also now pain 2 starts
listening for player join, leave, enter in render of another player and leave from render
yay
also compiling with 10 maven imports takes a year
Olivo any ideas on how I can return the async completable future?
Yeah return a CompletableFuture with a CompletableFuture in it
CompletableFuture<CompletableFuture<Void>> like that?
i'd just like to make it a bit lower
ah completable futures
that reminds me i need to setup a database 😭
Eh it's not that hard
i've had quite a bit of problems when i did it the first time
data deletion, desyncronization
and all that stuff
Still confused on how I can return a nested completable future
ok does the client remember an entity was spawned somewhere? even if i get out of render, the "name" comes back
Yeah might not work
ok nvm
Having multiple completable futures inside of eachother isn't something I've done before
tbf i don't even see why'd u need that
I know the problem I don't really know the awnser
To explain what I'm trying to do, I want to load a world file (first future) and then generate the world (nested future) and then return the CompletableFuture so I can do a whenComplete outside of the function.
nevermind
In theory I could just pass a BiConsumer into the function to get the same result (since then I can interact with the final whenComplete) but that seems kinda janky
Okay so instead of using whenComplete use a simple get
So futureSlimeWorld.get()
Wouldn't that halt the thread?
Or should I just run the first future async as well
Yes but it's in another CompletableFuture
So it blocks the async thread which is fine
I hope I'm understanding this right...
Actually you're right, it would block it regardless
Since the first thing would be running on the main thread
Ok I think I got this
PacketPlayOutNamedEntitySpawn is for players isn't it
Yeah
ty
Thanks Olivo
i guess the player despawn one is entitydestroy right
also this one?
I'd assume so
i guess i can check if Bukkit.getPlayer(uuid) is not null if it is a player
Yeah
There's thenCompose method for nested futures
Good to know
if I want to know a client's version, do i need to store data i got from the handshake?
I guess i can't get it after the handshake took place
Isnt it equavilent to the server version? If you use viaversion or such, look at their api
Yeah store it from handshake
They won't really be able to connect unless it matches the server version though
Now if you're using ViaVersion they have API to get the user version
o nice i'll look into it
i wanna do msgs to tell people not on 1.8 that the reccomended version is 1.8
Some body can tell me what is sound name of Gear Equips ?
armor_equipt_generic i found i nvm
probably in UnsafeValues
then you'd be able to see the name
URL url = new URL(jsonObject.get("assets").getAsJsonArray().get(0).getAsJsonObject().get("browser_download_url").getAsString());
File destination_file = new File(updateFolder+"/ExpTech-AutoUpdate.jar");
FileUtils.copyURLToFile(url, destination_file);
I dont remembrr now
Plugin didn't update
What
names on invisible entities can't be seen
yes the customnamevisible
i know that you can make upside down entities by naming them either drumm or dinnerbone
And that makes the entity look lower
aight, i'll have a look
Yes but so you don't change the name, you use a method that turns it upside down, I'll look it up for you
You can't really do it without changing the name. Only hide the name.
that's what i knew
As its client side not server side.
setRemoveWhenFarAway(false)
but still if i rename an entity it doesnt matter as invisible entities don't show their name
Paper spigot
what does this have to do with making upside down entities
hi I just got this error and I have noclue what is going on can someone help me? java.lang.NullPointerException: Cannot invoke "com.nerdxd.colorchatting.Main.getConfig()" because "this.plugin" is null at com.nerdxd.colorchatting.MenuListener.<init>(MenuListener.java:19) ~[?:?] at com.nerdxd.colorchatting.Main.onEnable(Main.java:21) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:514) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:428) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:619) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:266) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at java.lang.Thread.run(Thread.java:831) [?:?] this is my main class: https://paste.md-5.net/itaxidicut.java and this is the class using it: https://paste.md-5.net/jufoqomafu.cs
it's in spigot's api
and has nothing to do with what i'm doing
the entities i have are spawned in with packets
so using this method doesn't affect the entity at all
Hey. I have this command:
public class SpawnCubeCommand implements CommandExecutor {
public ArmorStand armorStand;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
armorStand = (ArmorStand) player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND);
ItemStack cubeHead = new ItemStack(Material.DIAMOND_BLOCK);
armorStand.getEquipment().setHelmet(cubeHead);
armorStand.setGravity(false);
}
return true;
}
}
How can i get this armor stand from other class?
SpawnCubeCommand spawnCubeCommand = new SpawnCubeCommand();
spawnCubeCommand.armorStand.teleport(e.getPlayer().getLocation());
this returns null
no that's now how it works
How can I disable another plugin using getServer().getPluginManager().disablePlugin();
this method is used for the server to deal with the entity
Aaaah
pass the instance of another plugin
boo
PluginManager#getPlugin(string)
dont make your armorstand public
Ohh, solved :) static worked
remember kids: don't static abuse
getInstance from command class goes brr too
remember kids: don't singleton abuse
Remember kids: Do not use singletones
how? :I
sorry, im new to java and spigot api
If I want to listen in one plugin for another plugin's variables, is this possible?
class Command {
@Getter
static final Command instance = new Command();
}```
too lazy to write an actual getter
no
I want to get other plugins version
What is the api for @Getter I forgot the name
Remember kids: Do not use lombok
Ok ty
lombok
Guys how can i change my plugin's logo
i upload the wrong png
i can't?
yes
is there a plugins logo?
If you make a fork spigot to see plugins logo you can
then how am I supposed to do it?
how can i delete my plugin
Report it and ask for deletion
PlayerLoginEvent
AsyncPlayerPreLoginEvent
isn't that deprecated?
No?
just disallow it
lmfao
ik
are that the silferfish?
marker armor stand riding upside down slimes riding baby pigs
ok i'm confused
but it looks nice
fr
i might be able to use this somehow
imagine animating it
i've made a packet riding entity builder just for this stuff lol
@young knoll how can i delete my plugin
just delete it smh
^
really?
why would he say it
idk for making fun of me
ah yes we do that in a help channel
Usage: !verify <forums username>
!verify AvatarAang
A private message has been sent to your SpigotMC.org account for verification!
He's wrong
This is #help-development sir
Hi is there some build in Java observer class that can track changes in whole object, i made own implementation for that task but i don't know if it is the rightt approach
Use setters and getters if you want to detect changes
name: Update-ExpTech
version: 22w03-pre1
author: whes1015
main: Update_ExpTech_whes1015.whes1015
depend:
- Spigot-ExpTech
loadbefore:
- Spigot-ExpTech
Why the plugin still loading before
Remove the loadbefore
vsc
I want this plugin loading before that one
Ah remove the depend
Yeah well using the observer design pattern is probably necessary here
Thanks,and how can I get that plugins version?
That plugin has public static String vername
Just access it normally
You would need to import that class yes
Unable to resolve symbol 'Spigot_ExpTech_whes1015'
I can't import different plugin's class
You need to add it to your project
add jar?
Are you using Maven or Gradle
Gradle
But that String will change after it update
Then you need to install the first project in to your local maven repo
@ivory sleet Gradle help
That's fine
!
is there an onReload() handler or something?
No
You will have no idea when it happens
One of the few ways to detect it is to check for players in your onEnable
but sounds stupid
Believe there’s an event also
why there is no handler
You sure?
There is no onReload
onLoad != onReload
You can check in onLoad for !Bukkit.getWorlds().isEmpty() indicating a reload condition
Yeah true but that’s probably to disambiguate
What
I need gradle help
there is no onReload
Mhm
These other load callbacks serve this purpose
?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!
how can I get that plugins version?
That plugin has public static String vername
Ok,
A project needs to be installed in to the local maven repo so it can be accessed from another one
declaration: package: org.bukkit.event.server, class: ServerLoadEvent
@quaint mantle
Oh
whes add the maven publish plugin
Thats still for load and reload
This is such a bless, thanks god
Yes but you have an Enum which represents startup and reload
add?
Ah missed that
Yeah it hasn’t been there for a long time I believe
Yep
publishing {
publications {
maven(MavenPublication) {
groupId = 'org.gradle.sample'
artifactId = 'library'
version = '1.1'
from components.java
}
}
}
this?
doesnt minecraft allow semi-opacity colors as item models ?
Ye
And the maven-publish plugin (is integral if you wanna publish)
Change groupId to your package. artifactId to plugin name and version to your plugin version
A problem occurred evaluating root project 'Spigot-ExpTech'.
>
> Could not find method publishing() for arguments [build_9stesvepz0uu6g11sddwzv00x$_run_closure1@7a4ad67f] on root project 'Spigot-ExpTech' of type org.gradle.api.Project.
I already add
😢
plugins {
id 'java'
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'org.exptech.spigot'
artifactId = 'library'
version = '22w02'
from components.java
}
}
}
group 'org.example'
version 'Release'
repositories {
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
content {
includeGroup 'org.spigotmc'
}
}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
mavenLocal()
mavenCentral()
}
dependencies {
implementation 'com.google.code.gson:gson:2.8.9'
compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT'
}
Ah yes did you miss the plugins block?
No
This
Run it and error
You still didn’t add the plugin
id 'maven-publish'
Idk why it’s so difficult to add that
Do this
import it in another plugin which I need?
What does the Z generic type parameter on PersistentDataType<T, Z> refer to
Isn't it the same as the T
So I just bought a server, and I'm trying to find some people to maybe help or playtest it. It's a guided adventure map with a "Dungeon Master" that controls mobs and encounters. Would anyone be interested in that? If someone is interested, please pm me and I'll send you the server ip, show you around and give you a rundown of what my plan is. VC is preferred
Wrong channel
So wheres the right one :^)
If not help-development
the place where you presumably go for help developing
it seems to be the same everywhere
?
Complex and primitive
Well
is the first a prediction or something and the second the actual value?
And another plugin how to go?
its the prrimitive and the complex type
So the best way would be a byte[],UUID
When you changed that. Start creating a jar with gradle
I believe so
Yes long[] is possible
I'm asking for second plugin
The library one is success build
Arguably shadow if you shade stuff
I know
I can handle the rest
i'm too stupid to understand...
Wait where did you put all the gradle stuff
The Maven publish
Comic to make it easy
If you have the class UserTransientDataManager
How would that be stored by a PDC type
Not so easy right
imagine storing that in a pdc 😳
So you might wanna serialize it into a byte array of a long array which can be turned back into an instance of UserTransientDataManager
But for numbers there is already an concretion so ideally they don’t need to be stored into byte arrays directly in spigot
You know how NMS is preferred to use Mojang mappings now, will CraftBukkit dev start using them too? It's pretty confusing having to use Mojang mappings in NMS but then when I go to make a PR it's still using old Spigot mappings
I guess you could PR to fix that
How can I pull an entity to a location
Pull or teleport
pull
You will need to get the vector between the location and entity
In first plugin
Velocity change
yes
I don't know how to edit second plugin's build.gradle
In the second build.gradle you need to add the first plugin as a dependency
Do you see the dependencies section?
implementation 'org.exptech.spigot:library:22w02'
how tho?
like this?
Yeah change implementation to compileOnly though
groupId = 'org.exptech.spigot'
artifactId = 'library'
version = '22w02'
compileOnly 'org.exptech.spigot:22w02'
Right?
Almost you need the library part
Cannot resolve constructor 'Vector(double, double, double)'
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Could not find org.exptech.spigot:library:22w02.
I am sure the first plugin build success
okay i got the vector
now how do i make it so the entity moves towards that
Instead of running gradle build could you try gradle publishToMavenLocal
i can add a velocity but that iwll give it once
how can i make it so it slowly goes to the location
i am really running out of ideas to space the lines correctly
baby horses almost worked
Success
But I still can't import
So it works
yes
Good now you can import the class and access your version info in plugin 2
Unable to resolve symbol 'Spigot_ExpTech_whes1015'
import Spigot_ExpTech_whes1015
because it is main class
Right?
Did gradle publishToMavenLocal work
Okay now reload the second project and see if it finds the dependency
I have a problem
I have made a custom fortune system
but now people can mine the blocks where fortune has already been applied on
and get more items
You will need to track every placed block
I found the problem
Change to implementation then all correct
but wait
Can you get the item data of the placed block before it was placed?
Like
u place a block with a persistent data key of "h"
set to 1
is there a way to retrieve that value on the BlockPlaceEvent
PDC is only available on Blocks with a TileEntity
tilestate?
If i use e.getItemInMainHand() the hand might be empty
I want to disable fortune from working on a block that has been mined and then placed again
i thought it was ((TileState) block.getState()).getPersistentDataContainer()
Yeah the block needs to have a tilestate
what's the best way to approach this?
if you store it yes
If mineresetlite places the blocks
is the placer console?
So then the player would be null
probably you'd check it with playerplaceevents
that means that its not called if the api modifies a block
ight imma try that
do i get the packet event when i send a packet (Protocolib)
?paste
put your code here
then use another method
go ask java
dont ask me
like append it, instead of overwrite the file?
it's an armorstand marker riding a slime with size -1 riding a baby pig riding a baby wolf
enjoy
❓
@primal loom stop asking in dm, i will block you next time if you do it.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I think deleting messages is not so good...
/**
* Gets a player object by the given username.
* <p>
* This method may not return objects for offline players.
*
* @param name the name to look up
* @return a player if one was found, null otherwise
*/
@Nullable
public Player getPlayer(@NotNull String name);
So... you are saying... there is a possibility it may return even if the player is offline?
well
where is that method?
like which class
Server
if you got it in offlineplayer, they even return a player even if they never join before
i think the server's method just only return the player that has joined.
so they might return offline players too
uhm...
Idk which method to use
That method definitely does not return a player instance for an offline player that never joined
Unless something is breaking the API contract, you won't be getting a non-null return from the player values for a name/uuid that isn't currently playing on your server
ok
thats not where you add a new recipe ^^
hey look my pain is over
Bukkit.addRecipe(Recipe) is the way to create a recipe
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i can see lagg is coming
it actually didn't
affter you add the recipe, you need to use the player.discoverRecipe
i stress tested with 300 lines
i can even decompile minecraft and then build it again using maven
i think they called it quiltflower?
ahh yea it is quiltflower
i thought decompiler cant do that?
like at least 1 or 2 errors
but no
there are none
cool
mc ver 1.8 or something
they dont need to discover/undiscover smth to use it
if they have the right amount of items or smth like that that will auto discover it anyway
you can use ItemCraftEvent and cancel it
or PrepareItemCraftEvent
and set the result to null if player is not jesus
I'm new to this and I'm having problems with the lore() method for ItemMeta. I don't know how to properly create the Component list, lol. Can someone please help?
you can ? i wrote that you can use PrepareItemCraftEvent ... check for player and try to guess what he is crafting and set the result to null then
List<String> lore = new ArrayList<>(); `
like this ?
and then itemmeta#setlore(lore)
?
you can try to use undiscoverRecipe on players too
but he can still craft it, if he puts them in the right place
and maybe they automatically learn the recipe if inventory has items
That would be right, but for me setLore() is deprecated in favour of lore(). I for some reason have Adventure Kyori. Don't know why I have it and some don't, though.
your using Paper ?
You are developing against paper API
Yea
Yea
ignore the depricated ^^
i mean youre possible gonna reach more people if its a public plugin and youre developing against spigot instead of paper
other way round 😄
Saw that falling blocks despawn after a while, what should I do to prevent this? any tags I can set that will make it permanent (no bukkit tasks)?
-1b
@woeful crescent Time
Time?
false??
dw bout it
How can i write a log in log4j daily to a new file and roll it when it reached a file size of 20MB, and that without log4j.properties?
no booleans involved
yeah
the other guy said -1b so i was pretty confused
But does that actually make it infinite?
wyvern probably mean 1 billion
oh
~3 years
should be enough
ye
Maybe use Integer.MAX_VALUE if u want largest int?
Oh
Hello Im making a join message event but i want to remove these backets and send the messages one by one each line.
join_message:
- "&a This Server is Using Plugin &9Hub Core"
- ""
- "&bThis Plugin Is Made by &fCOMPHACK"
- "Download at <Spigot Link>"
I want to send these messages in a line
Ugh hate that type of message
But they are coming like this
Don't send it as a list send it like multiple messages
Ok but it sends it like 1 message
let me send u the code
?paste
public class joinmessage implements Listener {
FileConfiguration config = HubCore.plugin.getConfig();
Boolean joinMessagesEnabled = config.getBoolean("join-messages", true);
String nonColoredText = (config.getString("join_message"));
String joinMsgColorCode = ChatColor.translateAlternateColorCodes('&', nonColoredText);
String coloredText = ChatColor.translateAlternateColorCodes('&', nonColoredText);
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerJoin(PlayerJoinEvent e) {
if(joinMessagesEnabled);
e.getPlayer().sendMessage(coloredText);
}
}
maybe like
getStringList
not getString
String.join("\n", coloredText)
oh not
lol
because of you set it already to String
Get it as a list then send it like multiple messages. If you want it to be one message do what Wyvern said
get it as a list
Ok
Thanks For the help
String nonColoredText = String.join("\n", config.getStringList("join_message"));
Ok
ok let me compile
?jd
didnt work
nono
this time try player.sendMessage(config.getStringList("join_message").toArray(new String[0]))
Ok
What no
That will just send it as an array again
It will look like the original
Get it as a list. Loop through it and send one message at a time
This worked
but the color codes are gone
lol
I'll fix it
thanks
i hope that advertisement is not shown to every player joining all the time 😄
Im making a Hub plugin its toggleable
xD
i couldnt think what to put there
so i put this
https://paste.md-5.net/egolerevud.xml
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
How do i add space to a string when a specific char was found for example &cChange some settings turn into &c Change some settings
i would guess "&c" + char <char> + "Change some settings" to "&c " + "Change some settings"
dont take my word for it tho cause i could be crazy
i just want to split the string when & was found and the following chat for example &cChange some settings turn into &c Change some settings yk?
based on my understanding tho, what youre describing would make it & c Change some settings
You could do .replace(“&c”, “&c “)
...
Damageable itemMeta = (Damageable)itemInHand.getItemMeta();
if (itemInHand.getEnchantments().containsKey(Enchantment.DURABILITY)) {
reduceDurability(player, itemInHand);
} else {
itemMeta.setDamage(itemMeta.getDamage()+1);
itemInHand.setItemMeta(itemMeta);
}
}```
why does this not remove durabilty from tools without unbreaking
yea but we don't know for sure if its c yk
String message = message
If message#contains()
Simple
its not simple cuz i bet there is an much easier way
Probably 😂, but it’s one solution
why would i check every existing colorcode in the universe to add a space lol
Well check for & then add a character after that.. So split it into an array, and then check it and boom add a space using the #replace()
there's replaceFirst
remember kids, blind casting is bad
I mean you could turn the string into a char array and just do it manually but toby's solution is somewhat easier for you
Luv u Conclure ❤️
any idea why this spams errors
https://paste.md-5.net/orivetatud.cs
sending the error alongside your "any idea why this spams errors" would be nice information
lol
"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.
huh
you should check if the meta is instanceof damageable
There is always an error
any idea why this spams errors
then what is spamming
Looks to me like the server stopped normally
Make sure you didn't call Bukkit#shutdown or smth
i didnt
Maybe your command was too powerful for server to handle :P
.../down
/stop will show your errors in-game!!
rip the color codes
Mans making Fortnite in Minecraft
lol i just made people crawl
idk why but i wanted to add different player mechanics
mfw sees "downed" and thinks fortnite
xD
How can I get lie player list?
Idk, try printing "got here" before where you think it fails. That is unless someone gives better answer
it gets to the part where it sends the message
when i restart the server its still running
and spams errors
but still works
try getServer().getOnlinePlayers()
Maybe /down?
Idk
Weird that there was no error
Check latest.log
please send full code.
that was all the code
um
Try putting return after this.cancel()
in which function do you call Bukkit.getOnlinePlayers()?
it seems to be something in PLayerDamageEvent
wdym
oh
in the downPlayer function
hmm, idk
is it just one and the same error, or different ones?
idk
i cant even find the beginning of the second error
theres so much traceback
the error spam after restarting the server seems to be with PlayerDamageEvent, but thats probably unrelated and another bug i have to fix
?paste teh error, its easier to read
send latest.log
a stackoverflow is generally a very bad loop
you are probably calling a method to damage a player in the event
This will run forever, over and over unless you set the PDC to 0 elsewhere
looping all online players every tick
Sorry out of time
It does
So ye I'll be back in about an hour I'll send it then
Lol what else am I supposed to do
Also it's every second
Because every 20 ticks it does it
that timer runs every tick, 20 times a second
at what point do you reset teh PDC?
PlayerDeathEvent
how to cast Block entity to Chest (i know it's chest for sure)
Wdym block entity
.CraftBlock cannot be cast to class org.bukkit.block.Chest (org.bukkit.craftbukkit.v1_18_R1.block.CraftBlock and org.bukkit.block.Chest are in unnamed module of loader java.net.URLClassLoader @7506e922)
at ttomek.mobarobot.ObaraTrait.openChest(ObaraTrait.java:164) ~[?:?]
you should not really loop all players in the timer. Only process teh player it was spawned for
Block myChest
Chest chest = (Chest) myChest;
Wdym
I think u imported nms chest
Spawned for
i want to somehow cast it like this or get Chest
else, when two players are downed you will have two timers running, one for each, but both spawnign particles on all downed players
Oh
in every case how to cast it to that?
No nvm ur using nms block
How can I change Bukkit.getOnlinePlayers() to Array
.toArray
Also I thought it does it only for the downed player
Like the for loop has plr and the person is player
It only damages the downed player, but it spawns particles on every player set to bleed in yoru config
Use myChest.getState()
This will turn it to object
[player,player1]
Can I just get like this?
then do toArray(new Player[0])
Lol
Works for me
I mean it's the intended solution for a typed toArray conversion.
Ik this sounds dumb, but I'm curious what would break do if it was inside 2 loops
Incompatible types. Actual org.bukkit.entity.Player[]', requires 'com.google.gson.JsonElement'
What the fuck are you doing
I feel like breaking a loop like that doesn’t look clean is there not another way?
The solution is not to use nested loops lol
Lol
how does that help, how to cast it to chest
What the differente between this mongo update statements?
@Override
public final <K> void updateModel(K... query) {
this.database.getCollection((String) query[0]).updateOne((Bson) query[1], new BasicDBObject("$set", query[2]));
}
@Override
public final <K> void updateModel(K... query) {
this.database.getCollection((String) query[0]).updateOne((Bson) query[1], (Bson) query[2], new UpdateOptions().upsert(true));
}
Im really confused now
Ig it could be a spigot bug, but those usually crash the server, not shut it down
have you actually posted your error?
