#help-development
1 messages ¡ Page 697 of 1
yeah you should be able to throw that json at the loadAdvancement method. does your json look like what I got here? https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/data/ToastMessage.java#L66C11-L66C11
Avoid writing the same code over and over again - use JeffLib for your Spigot plugins! - JEFF-Media-GbR/JeffLib
e.g.
{
"display": {
"icon": {
"item": "minecraft:acacia_boat"},
etc
Mine is
{
"display": {
"title": {
"text": "People Mover",
"color": "blue",
"bold": true
},
"description": {
"text": "Description"
},
"icon": {
"item": "minecraft:spruce_slab"
},
"frame": "task",
"show_toast": false,
"announce_to_chat": false,
"hidden": false
},
"criteria": {
"peoplemover": {
"trigger": "minecraft:impossible"
}
},
"parent": "riders:tomorrowland"
}
yeah so what happens if you just throw that into UnsafeValues#loadAdvancement? it'll give you back an Advancement object
NamespacedKey advKey = NamespacedKey.fromString("test:test");
Advancement adv = Bukkit.getUnsafe().loadAdvancement(advKey, "{\n" +
" \"display\": {\n" +
" \"title\": {\n" +
" \"text\": \"People Mover\",\n" +
" \"color\": \"blue\",\n" +
" \"bold\": true\n" +
" },\n" +
" \"description\": {\n" +
" \"text\": \"Description\"\n" +
" },\n" +
" \"icon\": {\n" +
" \"item\": \"minecraft:spruce_slab\"\n" +
" },\n" +
" \"frame\": \"task\",\n" +
" \"show_toast\": false,\n" +
" \"announce_to_chat\": false,\n" +
" \"hidden\": false\n" +
" },\n" +
" \"criteria\": {\n" +
" \"peoplemover\": {\n" +
" \"trigger\": \"minecraft:impossible\"\n" +
" }\n" +
" },\n" +
" \"parent\": \"riders:tomorrowland\"\n" +
"}");
should work just fine
it should even automatically update it to players according to NMS PlayerList
Alr, lets say I wanna add multiple would I just dupe it
Cause I had it create with a command but just having it in already would probably be easier
You need different namespacedkeys
cant you do this in steps?
like, add the first advancement, then the next, then the next?
alr
Wtf is that
an advancement
sad, this all prints "C" đĽ˛
interface A {
default void print() {
System.out.println("A");
}
}
abstract static class B {
void print() {
System.out.println("B");
}
}
public static class C extends B implements A {
@Override
public void print() {
System.out.println("C");
}
}
public static void main(String[] args) {
C c = new C();
c.<A>print();
c.<B>print();
c.<C>print();
}
Would this be correct
NamespacedKey parentKey = new NamespacedKey(this, "parent_advancement");
Advancement parentAdvancement = Bukkit.getUnsafe().loadAdvancement(parentKey, "{\n" +
" \"display\": {\n" +
" \"title\": {\n" +
" \"text\": \"Parent Advancement\",\n" +
" \"color\": \"green\",\n" +
" \"bold\": true\n" +
" },\n" +
" \"description\": {\n" +
" \"text\": \"Description for parent advancement\"\n" +
" },\n" +
" \"icon\": {\n" +
" \"item\": \"minecraft:emerald\"\n" +
" },\n" +
" \"frame\": \"task\",\n" +
" \"show_toast\": false,\n" +
" \"announce_to_chat\": false,\n" +
" \"hidden\": false\n" +
" },\n" +
" \"criteria\": {\n" +
" \"parentcriterion\": {\n" +
" \"trigger\": \"minecraft:impossible\"\n" +
" }\n" +
" }\n" +
"}");
Bukkit.getAdvancement(parentKey).addCriteria("parentcriterion", null);
Only thing is addCriteria says cannot find symbol
yeah well you cannot just add criterias, they are defined in the json
oh so I dont need that last line?
if you really want to change the criteria, you have to cast the Advancement to CraftAdvancement, call getHandle() to get an NMS Advancement, then you can get the criteria field through reflection, create a new Criteria map, and replace the old field's value
alternatively you can turn an NMS advancement back into an AdvancementBuilder with deconstruct(), change the criterias there, unregister the old advancement, then register it again
na I just want criteria to be impossible
well you already got that by using the impossible trigger
package com.techwithandrewdev;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.advancement.Advancement;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
createAdvancements();
}
private void createAdvancements() {
NamespacedKey parentKey = new NamespacedKey(this, "parent_advancement");
Advancement parentAdvancement = Bukkit.getUnsafe().loadAdvancement(parentKey, "{\n" +
" \"display\": {\n" +
" \"title\": {\n" +
" \"text\": \"Parent Advancement\",\n" +
" \"color\": \"green\",\n" +
" \"bold\": true\n" +
" },\n" +
" \"description\": {\n" +
" \"text\": \"Description for parent advancement\"\n" +
" },\n" +
" \"icon\": {\n" +
" \"item\": \"minecraft:emerald\"\n" +
" },\n" +
" \"frame\": \"task\",\n" +
" \"show_toast\": false,\n" +
" \"announce_to_chat\": false,\n" +
" \"hidden\": false\n" +
" },\n" +
" \"criteria\": {\n" +
" \"parentcriterion\": {\n" +
" \"trigger\": \"minecraft:impossible\"\n" +
" }\n" +
" }\n" +
"}");
NamespacedKey childKey = new NamespacedKey(this, "child_advancement");
Advancement childAdvancement = Bukkit.getUnsafe().loadAdvancement(childKey, "{\n" +
" \"display\": {\n" +
" \"title\": {\n" +
" \"text\": \"Child Advancement\",\n" +
" \"color\": \"blue\",\n" +
" \"bold\": true\n" +
" },\n" +
" \"description\": {\n" +
" \"text\": \"Description for child advancement\"\n" +
" },\n" +
" \"icon\": {\n" +
" \"item\": \"minecraft:diamond\"\n" +
" },\n" +
" \"frame\": \"goal\",\n" +
" \"show_toast\": false,\n" +
" \"announce_to_chat\": false,\n" +
" \"hidden\": false\n" +
" },\n" +
" \"criteria\": {\n" +
" \"childcriterion\": {\n" +
" \"trigger\": \"minecraft:impossible\"\n" +
" }\n" +
" },\n" +
" \"parent\": \"" + parentKey + "\"\n" +
"}");
}
}
Works besides child
how can I change the health of the ender dragon?
EntityAddToWorldEvent wont apply the health
@EventHandler
public void onSpawn(EntityAddToWorldEvent e) {
Entity mob = e.getEntity();
if(!mob.getType().equals(EntityType.ENDER_DRAGON))return;
EnderDragon dragon = (EnderDragon) mob;
dragon.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(2500);
dragon.setHealth(2500);
}```
there is no such event in spigt
why not just EntitySpawnEvent?
tried that
same problem
it prints a message
if i put a broadcast
but the health wont change
only the max health changes
some things take 1-2 ticks to update
try making a scheduler with 2 ticks and set the health then
i tried a delay too
it is better to use armor stand or holographic api?
im completely baffled
yea im out of ideas lol
neither. TextDisplays
its built into minecraft api now
ItemDisplay and TextDisplay
EnderDragons are ComplexLivingEntities, maybe it des the health thingy differently
hm
after all they can "recharge" themselves and stuff
is that I'm using spigot 1.8, and I want to make a hologram on top of a block
try to disable their AI, see if you can now change their health
i dont think thats part of complexlivingentit
then use armorstands
Idk whats going on but now its added somehow although says this
Error occurred while enabling simplelead v0.0.1 (Is it up to date?)
java.lang.IllegalArgumentException: Advancement simplelead:parent_advancement already exists
thanks :)))
maybe ill try delay again, i think i used 5 ticks last time
maybe 2 ticks will work
its very frustrating
no it wont
I'd try to disable their AI and als remove all pathfinder goals and see if that does anything
but like the max health actually updates is the strange part
yet the health wont
i wonder if instant health effect would work
what if you print out the health directly after setting it?
How hard would it be to integrate papi into the advancement thing
I think I found a way that will work, Im gonna use the instant health potion effect
have you tried to print it out right after setting it though?
or setting AI to false
or anything?
you should at least print it out after setting it
Ye I will do that, but if the instant health thing works Im giving up on directly setting the health
?paste
It won't set the descripton and says
Error occurred while enabling simplelead v0.0.1 (Is it up to date?)
java.lang.IllegalArgumentException: Advancement simplelead:parent_advancement already exists
I need some help getting some information. I'm coding a boss fight right now and I want to store the uuid of the player and the damage they've dealt to the boss. I'm using a HashMap for now, I sorted it and was able to get the top damager's name and damage. How do I get the 2nd and the 3rd element of the hashmap?
How did you get the top?
uuh... with stackoverflow's help I was able to get this:
FinalDamages = Damages
.entrySet()
.stream()
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
.collect(
toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2,
LinkedHashMap::new));
Optional<UUID> FIRSTNAME = FinalDamages.keySet().stream().findFirst();
UUID topname = FIRSTNAME.get();
Double topdamage = FinalDamages.get(topname);
personally what i would do is sort it
and put the Map.Entry into a list
that might be a naive way to do it though idk
No, that's how I'd do it as well
idk why it has you sort the entry set then put it back into a map
because a map is not guaranteed to be sorted
yeah firstname is NOT a constant
FIRSTNAME, FinalDamages, topname
and those variables are NOT camelcase
Don't ask me, it's stackoverlow and it works. Thats all that matters xD
literally using every style of casing besides properCamelCase lmfao
fix the casing
no stack overflow did not give you that answer with that casing
but yeah instead of collecting it into a map
just collect it to a list
since thats actually meant to preseve order
^ then you can do, finalDamages.get(0) = highest damager
.get(1) = second, etc.
it'd be get(x).getKey() == damager, get(x).getValue() == damage
anyone got a LINK To spigot downloading plugin api
i mean it is a linked list
so in theory it should stay sorted
but just being able to use index is better anyways
wuithout using spiget
Yeah. So all I have to do is just make 2 separate list and insert the values there?
no
a list of Map.Entry
literally just instead of .collect(toMap) collect it to an arraylist
oh I didn't see that it was specifically a LinkedHashMap
in any case though, what he wants is easier to solve with a List<Map.Entry<K, V>>
pretty sure theres either a .toList() you can call directly on the stream or .collect(Collectors.toList())
I just put the UUIDs and doubles into 2 separate arraylists
is there documnetation for the spigot ai
the website's apik
or a link to where I can read about it
im getting error while loading my data from file, does this mean World is not serializable?
thhe data im saving is a list of objects containing Locations
how do i change nametags of people
I think this means the world is null or does not currently exist
do you think i should deserialize it on world load and not on server startup?
yeah probably
Just use Spiget
or store a custom LazyLocation
which would store the world uuid
thus not needing it to be loaded to deserialize
i fixed it by loading the data in POST_WORLD
that works too
PacketPlayOutAdvancements packet = new PacketPlayOutAdvancements(true, advancements, RMTest, advancementDisplays);
can anyone help me with this packet
I need to reset player advancement with this
how can i get rid of ConcurrentModificationException error? When kicking from the server, the list is changed
The error itself would help
In the process of creating an automine plugin, I ran into a problem with the player - rank - mine connection. Is it a good idea to create 2 tables and link them ? player && rank + object mine
what is AfkManager 104
essentially i remove the player during "for" loop
and it gives this error, maybe there is some way to solve it?
Oooh
I see
You kick the player during iterating over the list
which calls remove from tasked
yea
oh you already explained that lul
im a bit slow today
well my best guess would be "kick the player a tick later" :D
How can I detect if a pressure plate is pressed and when it's pressed increment a variable each second? And when it is not pressed stop to increment the variabile?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/Action.html
With these you can detect if a player stepped on a pressure plate
(I think, never really tried it but the docs say that)
do i need to use hibernate to link 3 objects between each other?
I've already used it, but the variable won't stop
I had an issue previously with it. If server admin is using multiverse core, this might be an issue since post-world will continue once main world loaded but as far I remember it doesnât know multiverse core
Quick fix was using completable future, run a task timer and just check for a few seconds. If It never completes, then world is null
ive never used futures in java, can you give me an example please?
Sure
this is a solid introduction https://www.baeldung.com/java-future if ur interested.
Don't think the event triggers when you unstep from the pressure plate
https://github.com/anjoismysign/BlobLib/blob/async-objectmanager/src/main/java/us/mytheria/bloblib/utilities/SerializationLib.java
I used executors since my plugin is a library that allows calling the method, so if multiple plugins wish to call the method multiple times it will kind of queue the requests and not fail, else it would have issues with the futures since they some times be too many.
The method you are looking for is deserializeWorld(String, int)
I have to do that When the pressure is not pressed the task will stop
.
i feel like ive used this only once while using netty
though netty probably has its own implementation
does anyone know how to spawn models with AquaticModelEngine
help me how to link data between each other in the project if I still don't know what to link to what not
more precisely, I know but vaguely
I wanted to create business logic, but it's hard to know what must be connected and what not
are there any criteria?
but no all is well
what do you secifically means by that?
sometimes you need to link classes between each other, but I don't know how to do it well because it's hard to create a good plan
there is solution for that, Dependecy Injection Container library
Is this a theme or a library?
have you been ever using Spring framework for java?
for bukkit api - why?
you can find there "@Beans" it is one of the implementation of Dependecy Injection Container
just asking if you are famillar with the concept of automatic injecting dependecies to class
class UserRepository
{
}
class PlayerListener
{
private UserRepository repository;
PlayerListener(UserRepository repository)
{
repository = repository;
}
}
container.register<UserRepository>();
container.register<PlayerListener>();
PlayerListener instance = container.find<PlayerListener>();
``` This is example code how DI container might works. You are not forced to using Spring there are other implementaton of DI container
well, then I'll just create a class with a hashmap
In this way you can use in contructor any class that was register to container so it's easy to shader data between classes in project
well yes you can code it from scratch
it's just that the problem is not quite in this, but in what order should it be? object -> object2 -> object3
or you can just weave everything
order doens matter as long as you are avoiding cilcular dependecy
ok
{
UserRepository(PlayerListener lisener)
{
}
}
class PlayerListener
{
private UserRepository repository;
PlayerListener(UserRepository repository)
{
repository = repository;
}
}```
for example this is invalid
stackoverflow exception
oh
for this example UserRepository needs PlayerListener that needs UserRepository that needs PlayerListener .....
https://www.youtube.com/watch?v=NSVZa4JuTl8 here is nice video of guy explaiing how DI works under the hood and coding one from scrach
Become a Patreon and get source code access: https://www.patreon.com/nickchapsas
Check out my courses: https://dometrain.com
Hello everybody I'm Nick and in this video I will try to create a dependency injection or DI container from scratch. This is also known as an IoC container or an inversion of control container. I'm going to do that using ...
For example, a chessboard does not need to know what pieces are on it. I just want to create a convenient garbage-free dependency
how see this
there is simply no clear plan to understand what mandatory data the object needs to be given and which not
like you was talking about the buissness logic, so I've assume your plugin will deal a lot with databases, right?
I'm writing a plugin and it feels like I'm working on the backend for the site
yes
this is an automine plugin there is a user service class and so on
Then you can divide plugin code logic to 3 layers ```Layers:
[Spigot]
- commands listener
- events liseners
[Buissness]
- services
[Database]
- repositories```
ok
do you think it's a good idea to link it all and write it to the database in the form of tables? Hibernate use etc
I don't have a clear plan, so I wanted to link objects and display them in the database
what do you mean by link?
Hello, can someone help me? I'm working with Services Worker right now and it's just not working. Do I need to implement the class I want to load as a service in my plugin?
I'm using Gradle, so do I need to implement the other plugin's jar then?
Here is part of my code:
ServicesManager servicesManager = Bukkit.getServicesManager(); ErrorManagerService errorManagerService = servicesManager.load(ErrorManagerService.class); if(errorManagerService == null) { getComponentLogger().info("ErrorManagerService is null");
ok
I've never seen anything that isn't Vault use the service api
I did: ServicesManager services = Bukkit.getServicesManager(); // Plugin startup logic errorManager = new ErrorManager(); errorManager.setError(false); services.register(ErrorManagerService.class, errorManager, this, ServicePriority.Normal); instance = this; fileManager = new FileManager(this); services.register(FileManagerService.class, fileManager, this, ServicePriority.Normal);
What else should I use?
Someone knows a script so I can do /pay 1b instead of /pay 1000000000
I guess
implementation(files("C:/Users/*********/Desktop/MinecraftPlugins/BigBattle/UtilityPlugin/build/libs/UtilityPlugin-1.0-SNAPSHOT.jar"))
Wrong channel use #help-server
Why a jar dependency?
Can u help me tho?
No
...
Ask in the right place and have patience
change plugin code
i gess
What else was I supposed to do?
Install it to your local maven repo
I am using gradle...
Yes and?
Gradle does use maven dependencies and can publish to maven repos if you haven't noticed
How can I install something into my local maven repo?
Oh I came up with, I'll just make a HashMap and link the objects through their unique variables
Was just lost, sorry
Wow
are u compiling with gradle or maven
gradle
what is the name of the class type that binds a bunch of objects?
huh?
class
Could be many things
not list
what class
interfaces ?
ArrayList?
for example, there is a Model class, there is an event, and how to name a package that stores classes with links
don't such classes have specific types
this is the name of the class i am asking about the type
can you provide other "types" ?
you mean generics...?
Class patterns maybe?
example:
- model - container classes that store data and do not have business logic
- events - classes working with game events
bro what
So like mvc but for plugins
So, records?
okay, Iâll ask a simpler question - how to name the package where the classes responsible for dependencies will be stored
Itâs really up to you. Model is a fine name ig
object dependency
Are there no standards?
there are plenty of design patterns if that's what you mean
Reminds me of a meme :D
what ur describing sounds like interfaces but you still make no sense
u mean have an interface (the model) that other classes implement, and what you should call your interface?
Not really. Naming things is a hard thing to do.
There's conventions for casing, but not so much naming
just call it something
like i call classes that idk what to call
I heard somewhere that they are called deretory
// Todo: name
That's what I did. Now I just don't know how to implement my utility plugin in my other plugins
add mavenLocal() to your repositories
then
compileOnly("ur path")
in ur dependencies
refresh and you should have it
data
I personally do my best to avoid having two words in a package name
what would be wrong with this ?
I need some context.
I just checked and my utility plugin is not placed in C:/Users/***********/.m2/repository/de/lamacraft/
did you set up publishing in your build.gradle?
I also want to avoid that and I'm trying to find a category for such classes
like static with final? im not really knowledged in java but i know this is wrong... probably
it is not
that is fine
alr
you can have something like this
static always should be with final anyways
public boolean saveDataToPDC(PersistentDataContainer persistentDataContainer){
return true;
}```
will this actually modify the player's PDC if i put anything in there?
this will return true
yes i know
have u checked the docs?
but what if i do saveDataToPDC(e.getPlayer.getPersis...())
and then modify it there?
if you do pdc.set(whatever_belongs_here);
then yes, it will save
alr
why is it a boolean
Hi guys
@Builder
public static record PDCChangeResponse(boolean error1, boolean error2) {}
return PDCChangeResponse.builder().error1(true).build()
is what i like to do
Is there a way to throw the player back (without bug)?
yea get a knockback stick and hit them
without what bug ?
Hey, I shaded Guice to my bungee plugin and size increased almost by 4 MB. Is there something I can do about that?
Set velocity
not really
make a lib loader plugin
For example, if the player is facing the ground, they are thrown up.
Minimize will remove some
what Exception Should Be Used For Broken Data? in the Method's side not The Caller bcz that would be IllegalArgumentException i believe
Ah yes, got it working. Other question: Should I use the Services Manager now or just getter?
setVelocity
But I am asking about the bug
for what
For example, I have a PlayerAPI that I access from multiple plugins to ban players, etc.
I mean It does not detect the direction the player is going. It detects the direction the player is facing.
i would have a static instance getter, store it in the main class of the sub plugins and use dependency injection
can you show your code
event.getPlayer().setVelocity(event.getTo().toVector().subtract(event.getFrom().toVector()).multiply(-1));
(hey guys, random question but is this the XY problem ? )
does this not work ?
I think it should not do what is shown in the video...
When the player looks at the ground, he jumps to up, I want it to launch in the opposite direction it is going. So the player can run forward looking at the ground.
Iirc multiplying by a negative wouldnt return whats expected
or change the pitch in the calculation so you don't modify the player when you don't have to
what is normal? There are 4 directions
like north, east...
will 2 AutoMine objects be the same if their MineData.getID are not equal
a?
so I can safely shove an AutoMine object into a List?
if a class object implements equals, then the class itself will not be the same?
if we compare
== compares the memory location iirc
overriting anything will not change it in any way
bump
manually check if the players hitbox collides with that pressure plate
before you increase your variable
how
in the task you created, check if a plate is still at said location, if it is still powered and if a player is on top of it.
if not -> cancel task
Hello, is there "ChatEvent" but for console in bungeecord? I need to detect commands written by console (making alias plugin).
commands "written" by console?
wdym
@tender shard I liked your tutorials can you give a link to them
oh you work for a company?
hes a spy
that's my company
Location blockLocation = playerLocation.subtract(0, 1, 0);
Material blockType = blockLocation.getBlock().getType();
why ints, chars, doubles, floats, longs arent nullable
I looked at that repo but I don't see any listener in there.
We are full đĽ˛
cause they're primitive types
demm
Yeah it only loads the stuff, i never finished it because i found it pointless
Wdym with âwrite to consoleâ
I would like to get a team
I'm making simple command alias plugin for bungee and I can detect commands executed by players (using ChatEvent).
But for console, the ChatEvent is not triggered when it executes command.
will not work since pressure plates do not have collision boxes, only hit boxes.
also, if player's center is on a different block, the player can still have the pressure plate activated -> check the pressing of the plate with a players bounding box.
can you send me an example?
Then there probably is no event for that
no
thx
You probably have to change the actual commandâs aliases
I always wondered who came up with the name for spigot and its brand which is associated with a leaky faucet
Unboxing of 'persistentDataContainer.get(SkyMineCore.getInstance().getKeyManager().getLevel(), PersistentDataType...' may produce 'NullPointerException'
public void loadDataFromPDC(PersistentDataContainer persistentDataContainer){
if(!persistentDataContainer.has(SkyMineCore.getInstance().getKeyManager().getBlocksBroken(), PersistentDataType.INTEGER)) return;
level = persistentDataContainer.get(SkyMineCore.getInstance().getKeyManager().getLevel(), PersistentDataType.INTEGER);
}
oh my god
my eyess
hello is it possible to make an event do a command?
Bukkit.dispatchCommand();
thank you g
use getOrDefault, or use an Integer instead of int
since you do a has(...) check before, just use getOrDefault(..., 0); as you know it won't be null
Is there a way to listen for vanilla commands after theyve been processed/executed?
wdym? what would change after the command ran?
you'd still only get "player x issued command y"
I want to listen for the /team command and check the new team members after theyve been changed
ah, then I'd just wait a tick
In the preprocess event there are still the old members
Thats not consistent
why not? I don't think there's a better way except to disable the vanilla team command, and instead write your own
that's because there is no such class
there is also no such class, neithe rin mojang, nor spigot, nor yarn, nor searge, nor intermediary, nor obfsucated mappings
what do you need it for?
which component? NMS components, bungee components, adventure components?
in mojang: Component.literal("asdasd")
i think im doing something wrong here
???
you dont break
use case "something" -> { code }
you don't have to can't break if you return
cause ur not supposed to break what
break after return?
wait
what's the issue
@remote swallow You Wasted My Time A Little Bit
instead of "i have an idea", let's say "I just born a brainbaby" ok?
F
epicâŚ
mine isn't
but I dreamt that he was lost in a rocket or sth

but then the rocket was found again
leave me alone
Mr amir will get my joke
my brain is off'
American Dad
Season 13 Episode 02
Census of the Lambs
Stan goes door-to-door as a enumerator, collecting a census on the neighbourhood. One house was a bit more annoying than it should have been.
Stan- How many people live here?
Kid - Me and my mom
Stan- So two
Kid- My dadâŚ
Stan- Three
Kid- âŚdied
Stan- Two, you wasted my time a little bit...
However why in the world
is that bro using string ids like that
literally use constants at that point, wtf
either constants to the message or to the string Iâd
yeah that was what i reffered to (did i spell it right?)
but like you donât even pass properties to the method so they should just be constants
Hey everyone, what is the best way to freeze player?
If you want complete frozen make them spectate an armorstand
I want like for 3 seconds
cancel move event
cancel move event, or set them as passenger to sth and cancel the unmount event, or give them potion effects, or make them spectate sth
Doesnt cancelling move event bug
or tell them they'll get cute anime girls if they don't move for 3 seconds
that's always the most efficient way
Is this good way to freeze?
private void cancelPlayerMovement(Player player, long ticks) {
player.setWalkSpeed(0);
new BukkitRunnable() {
@Override
public void run() {
player.setWalkSpeed(0.2f);
}
}.runTaskLater(this, ticks);
}
no
not it is not
easily bypassable
just cancel the move event
Okey, thanks
i'd set the walk speed AND cancel the events
oh fair
can you manipulate camera rotatino speed without affecting FOV?
nope
darn
?paste
Not sure whats wrong with this, it won't set the descripton and says
Error occurred while enabling simplelead v0.0.1 (Is it up to date?)
java.lang.IllegalArgumentException: Advancement simplelead:parent_advancement already exists
Server start and reload break it too
{
Bukkit.broadcastMessage("");
}``` Theres other solution to clear chat? which wont make mess in logs? I know about F3+D
Just send a component with a bunch of newlines to each player
"\n".repeat(256)
(if you're on like java 16)
I had to make this in order to change color of lore depending on the tropical fish color
is there any other way?
maybe..
what the fuck
ChatColor exists buddy
And ChatColor.of for rgb
yeah but there is no magenta, brown and other colors
it's easier to use hex code ._.
&x hex code
bet you could extend ChatColor and add your own colors there
Why would you want to use &x&r&r&g&g&b&b when you can use ChatColor.of(â#rrggbbâ)
i use &x&hex.. but i think it's the same..
one is readable
the other one is not
Is it not possible to set map entries on initializing the map?
It is
oh
Thereâs Map.of
oh really
Iirc though it can only do up to 10 entires
cool
i'm not very good at using hashmap
nah, it does have one with E...
(i forgot what that thing is called)
varargs
how i can get a player head per person
it cant
you can have 2 var args
List.of has E...
a head of a player?
Aaah
There is however a Map.ofEntries that uses a vararg of Map.entry
Like a mirror
oh ye lol
brain lag
You could make a janky one with ObjectâŚ
Then the other question.. Sooo if I have color in the variable then how to get this color from ChatColor?
wdym
like in an inventoy i add a head that displays the player head
Yeah thatâs easy
so just the player head as item
SkullMeta has a setOwningPlayer
Here
Make sure you're using the bungee chat color not the bukkit one.
it is only in the bungee ChatColor
oh
correct import will
Theres little reason to ever use the bukkit chatcolor anymore
bungee chat color wasnt always available
plus you can run craftbukkit
which doesnt include bungee chat api
!verify RunTellObama
A private message has been sent to your SpigotMC.org account for verification!
using 1.20.1 , what is the best way to get the sign attached above clicked block in the oppesite direction
so when i click on the door from behind it should do some stuff
get clicked location
get clicked face
move location on the opposite direction of the face
move up
check for block ?
you need nms for custom durability right?
So is this one better?
why do you need it to be string ?
how can i get the TPS of a server?
Also, IJ is yelling at you to not do new HashMap<String, String>
You can do just HashMap<>
technically it should be Map<String, String>> colors = Map.of(stuff);
I mean I would say "go for components"
But I guess Chocos PR has not been merged yet
or ```java
Map<String, String> colors = new HashMap<>(); {
put(key, value);
put(key, value);
}
I mean it would be if you had a put method
why would you use components here
why would you not use components
you just put the semi colon in the wrong place
for the chatcolor?
components in the lore
is what I mean
ah
So is this one better
@EventHandler
public void onDamage(EntityDamageEvent e){
if(!(e.getEntity() instanceof Player)) return;
if(e.getCause() == EntityDamageEvent.DamageCause.VOID){
World world = Bukkit.getWorld("world");
Location loc = new Location(world, -6, 67, 12);
e.getEntity().teleport(loc);
e.setCancelled(true);
}
}``` I coded this, but im still die after teleport
bc you have more than 10 entries, no
you have to reset the fallDistance
somehow
public class LeaveHandler_v1_20_R1 implements LeaveHandler {
private final Player toNull;
public LeaveHandler_v1_20_R1(Player toNull) {
this.toNull = toNull;
}
public void nullGameProfile() {
CraftPlayer player = (CraftPlayer) this.toNull;
EntityPlayer entityPlayer = player.getHandle();
try {
Field gameProfile = entityPlayer.getClass().getDeclaredField("gameProfile"); // Field adÄąnÄą gĂźncelleyin eÄer deÄiĹmiĹse
gameProfile.setAccessible(true);
gameProfile.set(entityPlayer, null);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
}
I cannot import craftplayer for spigot 1.20.1
Map.of creates an immutable map
this will error
static <K, V> Map<K, V> of(K k1, V v1) {
return new ImmutableCollections.Map1<>(k1, v1);
}
?nms
oh right
I bet IJ knows this and shows warning on putAll
if i set it to 1.20.1 will that support 1.18 too?
what you really should be doing in this case if you want these colors like this is to have a final static map and set it up in a static block
public class ColorClassExample {
private static final Map<String, ChatColor> colors
static {
colors = new HashMap<>();
colors.put("BLUE", ChatColor.BLUE);
}
}```
can you give example i dont understand what i need to do
i need support for 1.19.3+ including 1.20.1
I just want to use it in event..
one time
it doesn't matter
I mean theoretically its not a huge deal because you really should only ever instanciate the event once
but I'd reccomend properly structuring it as some form of Utility so it can be used elsewhere if you need it in the future
yeah but i don't really need it in the future
like i'm using it only once
if you don't really give a fuck just make a map like above but use the constructor instead of a static block
Like this?
I'm scared how many similar errors I missed while writing the rest of the code
I'm not really good at this, because i started learning java about month ago
I don't believe you changed anything
This will still throw an error
nope
no error
oh right, I see now
i changed to hashmap
It says CraftPlayer cannot be resolved to type in 1.19.4+
did you run nms for that version
I still dont understand how to import it
?nms
read that
can i add multiple versions with this for example 1.17 and 1.19
if i add multiple spigot versions
can you check the project https://www.spigotmc.org/resources/namer.59115/ its really small i think you can do this easily without any external library thank you
there is already 1.11 1.12 and 1.13 support using reflection
Dependency 'me.clip:placeholderapi:2.11.3' not found
why?
you dont need to use jefflib, that was an example of a multi module library
did you add the repo and reload maven
i did but its stuck on resolving dependecies
wait then
looking at that it either uses obsfucated nms and has it all in 1 module or is a multi module project
i actually decompiled it i can give source code if you want When they obfuscated the method names after 1.14+?
i already decompiled
you also have to obsfucated back anyway
otherwise servers wont understand it
its just way easier in higher versions
I'm not native speaker sorry if i cant understand you but did you check the LeaveHandler classes i dont see any obfuscation there import net.minecraft.server.v1_13_R1.EntityPlayer;
import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; for example
EntityPlayer is spigot mappings
and craftbukkit isnt obsfucated
in mojang mappings EntityPlayer is ServerPlayer
so i need to convert it to serverplayer in order to make it work or use jefflib?
no
you DO NOT need to use jefflib
that is an example of how multi module maven projects work
yet another example if you need https://github.com/Y2Kwastaken/Suketto
What do you even need NMS for?
should i copy their maven entirely and will be ready to go and import CraftPlayer?
I do mine slightly different from alex, but same idea
no
no configure maven as you need
use it as an example
don't just copy a configuration blindly
im pretty sure this stuff is in api now anyway
I also got a tutorial for multi module maven https://blog.jeff-media.com/maven-multi-module-setup-for-supporting-different-nms-versions/
Hi there! Today Iâm going to explain how to setup a multi-module project using maven to support different NMS versions. Important notes about this tutorial: Every step will have detailled screenshots using IntelliJ. I explicitly chose not to include everything as copy/pastable source code, but normal screenshots (you can click on them to show th...
yeah i will change name artifactid lol
not really what I mean but okay
@tender shard I've wondered why don't you use the versions-maven-plugin
Its on the todo list for ages now but i never really did it lol
can you do it for me i need to add 1.19.4+ support for this https://www.spigotmc.org/resources/namer.59115/ i really don't know where to even start i don't know much about maven i only did import libraries directly I can also pay you little (i dont have much budget)
I suppose its still easy enough to just do ctrl f replace lol
can you do it for me i need to add 1.19.4+ support for this https://www.spigotmc.org/resources/namer.59115/ i really don't know where to even start i don't know much about maven i only did import libraries directly I can also pay you little (i dont have much budget)
I charge 20 an hour if you're interested
setting up all the build files will only take around that
at most
Yeah but still my solution is annoying. This is one of the things where gradle is superior by using a java-conventions buildSrc
id do that for free probably
I did enjoy that about gradle too
lol
Let epic do it
i would appreciate that i can give 10$ though
thank you
@river oracle you got kofi or something
nah
smh
how do you do comissions with no paypal
they ship an envelope with cash
@bleak nacelle what versions do you want
đ
1.19.3+ 1.19.4 1.20.1
đ¤Ť
what the fook
this plugin is setting ping to null for somer eason
wait
wrong mapping
wait
yeah
they set ping to null
how can i send an ActionBar to a player?
Player#spigot().sendMessage
its supposed to change your tab name its working in 1.13-
i was using it
oh its auth me support for nms
do you need auth me support
no
To add NMS remapping i should replace by this something or just add it to the main information in pom.xml?
want this just to work or be made properly
wtf is a base component?
a component
i want it to made properly but why is the authme support for?
im guessing something to do with not figuring out whos who
bc thats all it uses nms for
setting ping to null if authme support is enabled
how can i create a base component
component builder
please add authme support then i want it to work
it will work, do you require authme support though
auth me support isnt required for the plugin to function
i don't need authme support for now
if it works without it
how tf is this even possible its my own project
all of the versions are the same
oh wrong groupId
fucking dumb
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new ComponentBuilder().append(ChatColor.DARK_AQUA + "Level " + account.getLevel() + " | XP " + account.getXp() + "/" + (account.getStarterXp() * account.getLevel())).getCurrentComponent());
im doing something wrong here
.build probably
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i never get it first try
.create()
ComponentBuilder#create
does blowing up tnt cauesse BlockBreak events
if i have an area and i need to make there not be destroyed blocks in any way and tnt is placed next to the area?? how am i supposed to prevent that happen
will playerKickEvent trigger PlayerLeaveEvent?
prevent destroying blocks inside the area
check teh explode event and remove any blocks you don;t want broken
PlayerQuitEvent*
yes
theres no way to gett all blocks affected by that tnt
check the area against tnt
just looked at implementation it is
BlockExplode is for things like beds in the nether
ohh ok
but theres no way to prevent it only for specific blocks?
as I already said
what is the code that give unmapped and mapped jars?
you get the blocks in teh event and check each one to remove the ones you want protected
remapper
so i cancel it, and that set every of them which is supposed to exploded to material air?
no
then how?
I already told you twice
you cant cancel it for a specific block
you remove the block from the list
oh my fucking god
@remote swallow are you doing it? Please tell me when you are done
yeah, ill tell you when im done
ive got the reflection done but quickly, why dont you just use something like essentials x, placeholder api and TAB?
instead of relying on outdated plugins
i need this plugin because TAB is not working for my server i couldn't change my nickname
did you enable unlimited name tag mode plus install teh correct placeholder api expansions
im not getting paid so i only changed the nms
you are getting paid in experiennce
all i did was go find my mcdeob file and just check some classes and then used chepx.dev to check obsfucated names
got to read some disgusting code too
hmmm my fav
thank you a lot bro i have website scripts i can give you one if you want
whats a website script
php and it is unique it has auction system
i'm selling it for 20$ 5 people bought it you might want to check the code
i dont own a server or know php
any1 knows what is ClientBoundPlayerInfoPacket but in newer version?
ok
its split into 2
which are?
ClientboundPlayerInfoRemovePacket and ClientboundPlayerInfoUpdatePacket
im trying to do that but it isnt working
packet.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
true
"how do i make skyblock plugin in spigot 1.19.3 do it for me"
@remote swallow
mfw
?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.
I got error Cannot interact with self when i use it
what
import java.util.UUID;
public class NpcCommand implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (sender instanceof Player player) {
String name = args[0];
CraftPlayer craftPlayer = (CraftPlayer) player;
ServerPlayer sp = craftPlayer.getHandle();
MinecraftServer server = sp.getServer();
ServerLevel level = sp.serverLevel();
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), name);
ServerPlayer npc = new ServerPlayer(server, level, gameProfile);
ServerGamePacketListenerImpl packet = sp.connection;
packet.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
packet.send(new ClientboundAddPlayerPacket(sp));
}
return false;
}
}
This is what one of my "friends" made:
package levis.murdermystery;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class a implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
if (sender instanceof Player) {
sender.sendMessage("Ezt a parancsot csak jĂĄtĂŠkosok hasznĂĄlhatjĂĄk");
} else {
Player p = (Player)sender;
if (p.hasPermission("mm.*")) {
sender.sendMessage("Nincs jogod");
} else {
sender.sendMessage("Teszt");
}
return false;
}
}
"Ezt a parancsot csak jĂĄtĂŠkosok hasznĂĄlhatjĂĄk" means that only players can use the command
"Nincs jogod" means "No permission"
"Teszt" means "Test"
I guess most of the advanced developers know what the issue is... đ
missing !, bad classname, no override, missing return statements
what the
me?
He is basically "censoring" the class names xD
The code is not mine
how do i fix
I just sent it in for y'all to suffer :]

He made another shit đ
Required type:
Collection
<net.minecraft.server.level.ServerPlayer>
Provided:
ServerPlayer
package hu.deshy.tesztplugin;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin implements Listener, CommandExecutor {
public void onEnable() {
this.getServer().getPluginManager().registerEvents(this, (this));
getCommand("teszt").setExecutor((CommandExecutor)this);
getLogger().info("plugin sikeresen elindult!");
getLogger().info("Developed by DeShy");
getLogger().info("Helped by Roland882");
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if ((sender instanceof Player)) {
Player p = (Player)sender;
p.sendMessage("Ezt a parancsot csak jĂĄtĂŠkos hasznĂĄlhatja");
} else {
Player p = (Player)sender;
if (p.hasPermission("teszt.admin")) {
p.sendMessage("Nincs jogod ehhez!");
return true;
}else {
p.sendMessage("Ădv"+ p.getName());
return true;
}
}
return false;
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
Bukkit.broadcastMessage(p.getName() +"csatlakozott");
p.sendMessage("ĂdvĂśzĂśllek a szerveren"+ p.getName());
}
public void onDisable() {
getLogger().info("plugin leĂĄllt");
}
}
I swear this guy can't even make plugins đ
He just claims he can, but in reality, he can't. đ
Permissions are yet again fucked up, missing seprators, and why would you put a command into the loader itself?!
Try to just give Collections.singletonList(player)
Didnt work
i have a question if java is consuming this much memory why mojand didn't rewrite minecraft in c++ so even older pcs can run it?
or others
notch chose java because that was the language he was best in
@tender shard ```java
public class NpcCommand implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (sender instanceof Player player) {
String name = args[0];
CraftPlayer craftPlayer = (CraftPlayer) player;
ServerPlayer sp = craftPlayer.getHandle();
MinecraftServer server = sp.getServer();
ServerLevel level = sp.serverLevel();
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), name);
ServerPlayer npc = new ServerPlayer(server, level, gameProfile);
ServerGamePacketListenerImpl packet = sp.connection;
packet.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
packet.send(new ClientboundAddPlayerPacket(sp));
}
return false;
}
}```
please help me to fix
but it shouldn't be too hard for him to recreate it in c++ since both are oop
Notch is not even in Mojang anymore.
what's the point of recreating it in c++
If you want a more optimalized Minecraft, use Minecraft: Bedrock Edition
plugins wont work
Minecraft: Bedrock Edition itself is written in C++.
You recreate them. Easy. There are simlar APIs to Spigot, so it will be easier to do in Java, and you don't have to use PHP.
any1?
what is the bug?
oh i fixed
ServerLevel level = sp.serverLevel(); what is this btw i never see this before(was coding when 1.13-)
1.20 maybe
It's NMS
how i can send packets to every players
That sounds like a question for Google to me
Loop?
Idk if spigot has audiences built in but maybe you can do it through that
((CraftPlayer) p).handle.connection.send
I donât remember what the obfuscated version is
You can use that mappings website
Hey, I have a question, if I post a paid plugin on SpigotMC, am I allowed to make the customer go into my Discord server to get a license key for it after they get it?
no
the plugin has to work without any intervention
what happens if someone buys and you're not there for 2-3 days?
he can't use the plugin
Hello everyone, what's the best way to make a sheep follow a player? Because setTarget not working on friendly animals
Operator '==' cannot be applied to 'int', 'null'
why?
a primitive can;t be null
Good idea!
or atleast if youre just prototyping you can but not for actuall plugins used on public servers
oh sorry
read the rules and you'll see the answer is "no"
i'm just asking it about java syntax/logic/math
So is there any way to simplify this code?
P.S. this one is changeHookedEntity func
or to make your logic use int
very rarely you'll need Integer anyway
private static final Map<Material, EntityType> ALLOWED_MATERIALS = new HashMap<>() {
{
put(Material.COD, EntityType.COD);
// ...
// or get them automatically by name
for(Material mat: Material.values()) {
try {
EntityType entity = EntityType.valueOf(mat.name());
put(mat, entity);
} catch (IllegalArgumentExceptionignored) { }
}
};
//...
if(ALLOWED_MATERIALS.containsKey(material)) {
changeHookedEntity(event.getHook(), caught, ALLOWED_MATERIALS.get(material));
Isn't it easier to do HashMap<Material, EntityType> = new HashMap(Map.of(...))?
that's why you can use putAll too
usually you wouldnt stack that
the way alex did it would be the prefered way
yeah?
why not already do Map.of
oh ok thx
because it's immutable
oh well
I've been trying for the past half an hour to figure this out - is there a (not NMS) way to trigger code when a player blocks damage? I can't just use a runnable that checks shield cooldown/damage blocked statistic because i need the attacking player to check the item they attacked with
It doesn't trigger any kind of InteractEvent afaik aside from the right click on the shield after the fact
I'm trying to stop the shield disabeling under certain circumstances
block damage event
BlockDamageEvent is for damage done to blocks
just check if the player.isBlocking() in EntityDamageEvent?
or what exactly do you want to do
seeee heres the thing, far as i can tell that doesnt get triggered
oh i read player blocks damage and player damage blocks
why mongo gotta be so different
anyone here good at googling
does it not count as a EntityDamageByEntity event?
find me a hibernate dialect class for mongodb
fuck off and use jdbc
i'm a god at duckduckgo
is there anything you need duckling?
get a yellow error
see, im using jdbc
is it possible to query the current log level?
of what
If I smelt two IronOres in a Furnace with a coal and listen to the FurnaceSmeltEvent - For the fist ore there is no recipe if I try to get it with this code:
@EventHandler
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
Furnace furnace = (Furnace) event.getBlock().getState();
if (furnace.getRecipesUsed().isEmpty()) {
logger.log("FurnaceSmeltEvent No Recipe");
}
}
The same applies if I listen to the FurnaceBurnEvent
Dose anyone know why and how do I fix it ?
the level the console logs at
like the part that's usually INFO
i want to print stuff to chat if the log level's set to fine
wait a tick, the recipe is probably only used after the event because you could have cancelled it
whyd it only appear as import after i enabled remapped then
It exists regardless the use of remapled or obfuscated
okay - I want to cancel the FurnaceBurnEvent if a certain recipe is used so how do I get the recipe for which the fuel is burend?
CraftPlayer is the nms implementation of player
??
Its the implementation of Player so not API
this import only exists if i enable mojang-remapped
it should work with plain spigot too
:/
I forgot how can I get flags from config.yml and add to region?
no, you are using Spigot instead of spigot-api
it should even work with craftbukkit
well its just be like 'this doesnt exist'
show your pom
god no
have you actually ran buildtools no --remapped
uh
use spigot, not spigot-api
no
you need to learn what is API, what is implementation and what is NMS
why the hell do you need to check if the damaged entity is a CraftPlayer?
spigot-api only cony contains the spigot/bukkit API.
spigot contains everything, API, inplementation and NMS
you are still using spigot-api
entityDamageEvent isnt player
CraftPlayer implements Player?!
its LivingEntity probably
if something is instanceof CraftPlayer is ALWAYS will be instanceof Player too
hm
or just Entity
hm wat it's not wrong
Do not use anythign that starts "Craft" unless you are heading to NMS
?jd-s
jar?
the javadoc jar for the javadoc dependency
if you are using spigot-api as a dependency just click the download button for javadocs in Intelij/maven tab
you are not using spigot
It's an implementation of bukkits player?
Not sure the confusing
yes but it's not NMS
Yeah kinda meant its implemented with nms regardless

