#help-development
1 messages Β· Page 465 of 1
my bukkitrunnable "im going in" pulls out reflection
and then the server prob crashes
so its mean i cant spawn a mob on chat event ?
you can, but sync
Material material = Material.STICK;
int ammount = 1;
String name = "Stickman's arm";
ItemStack item = new ItemStack(material, ammount);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(name);
itemMeta.setLore(Arrays.asList("line1", "line2", "line3"));
item.setItemMeta(itemMeta);
this will work right
hmm
what r u trying to achieve
inserts itembuilder
are you good? mc for 11h?
i had my pc on for two days and the counter had an overflow
but player chat event is a async event ```
AsyncPlayerChatEvent
maybe i add player to a list when he chat and then execute a method for every player on that list ?
i got 23h so
or dont use BukkitScheduler and just run the spawn straight away
it dosent work if i spawn straight away , bc you cant call a bukkit method on a async event
anyway thx for info
@EvenHandler
void ...(... e)
BukkitScheduler.runTask(...){
//spawn here
}
void asyncChat(event) {
scheduler.runtask(plugin, () -> {
// back sync, spawn mob
})
}```
oh
got ninjad
bruh i hate myself , thx a lot
too late
nervous in Badlion
π
i used to use badlion but now im sticking with fabric and forge
why forge ?
more mods
but they arent client side
plus i can make my one ones if i please
yes they can be
Fixed my issue ^^
cgf
it took me 1h..
only 1h? pathetic
?paste
π
gradle is faster guys π€
im happy with my xml instead of 10 levels of indents
Now only need to find a way, that an event will only happen when the blockname is "SuperBlock" ;p
yes
if (type == Material.PURPUR_BLOCK)
Currently the code btw,
Need only a way to check if the displayname is "Super Block"
i know
@EventHandler
OnSuperDupeBlockUltraPlace(@NonNull @NotNull final BlockPlaceEvent event){
Preconditions.checkArgument(event, "Lol wtf even happened");
final ItemStack super_ultra_item = event.getItemInHand();
final ItemMeta super_ultra_item_meta = super_ultra_item.getItemMeta();
if(super_ultra_item.getItemMeta().hasDisplayName(){
if(super_ultra_item.getItemMeta().getDisplayName().equals("Super Block"){
// Do stuff here
}
}
}
may be what you are looking for
butr yeah spigot doesn't have custom blocks
so unsure exactly what you want
@NotNull final π
and that calls himself a java dev
I once wrote an entire uni project in annotations
I probably killed my professor
@While go brrrrrr
i once started to use annotations and a month later i looked at it and thought wtf have i done
I only use annotations as troll
my code legit looked like
private static int i = 10;
@While("functionName". condition = (i <= 0))
was horrid
π
wiriting a parser for that gotta be fun
When I want to report an issue on Jira, it asks for the output of /version. Is it okay if that's paper?
Not quite.
replicate on spigot otherwise you'll likely be turned away
Reproduce it on spigot first, otherwise report to paper
haha beat you to it nerd
Does anyone know where to find the compiled (i.e. as a ".class") gradle buildscript file?
Hm. Do you at least know the java gradle api equivalent of sourceSets.main.runtimeClasspath
I'm having 2 issues with this build.gradle file
- It won't compile unless I remove aggregateJavadocJar
- When I remove aggregateJavadocJar and try to depend on this project none of the classes show up in the depending project
https://paste.md-5.net/adudeqizat.cs
And they say gradle compiles faster :P
no :( I suck at gradle myself
How can I add custom trades to a villager?
gradle :(
Would try using version 8.0.1 of that plugin
how do I make Projectile go down?
NMS
I get this error now?
The aggregate-javadoc plugin should not be used on a java project
What is the project structure
Okay found it at /home/geolykt/.gradle/caches/8.0.2/scripts
Remove the java plugin for the root project
You may need to add it in that "core" project
Same with maven-publish and shadow
didn't seem to help anything could you show an example
I have never used that plugin - so I have no examples at hand
I'm just confused because I pretty much copied @remote swallow multi module project and his seems to be working fine lol
can someone tell me why it just Literally takes every item in the config for the drops list
instead of only taking the ones in the Barrel section
At worst just get rid of that javadoc aggregation plugin
first ss ccut of this one better
Heck - I'd not publish fat/aggregate/shadow jars over maven at all
looks like you didnt register the advancement
hmmm next issue is also really weird where now that its published none of my dependencies are there lol I guess I'll download and pop open that jar I publisehd
I create the advancement like this ( https://github.com/JEFF-Media-GbR/JeffLib/blob/master/spigot_1_19_4_R1/src/main/java/com/jeff_media/jefflib/internal/nms/v1_19_4_R1/NMSHandler.java#L377 ) using the AdvancementBuilder. Are you sure Bukkit.getAdvancement returns your custom one?
Avoid writing the same code over and over again - use JeffLib for your Spigot plugins! - JeffLib/NMSHandler.java at master Β· JEFF-Media-GbR/JeffLib
I already got it working. I dont want to register the advancement.
what was the issue?
Well if you copied my example you'd notice that I commented out the entire maven publishing logic
why didnt you want to register it?
Sadly Gradle is extremely painful when it comes to maven publishing
I didn't see your example
Because there is no need of the server knowing anything about the advancement.
The issue was that clearing the current advancements also cleared the progress that
was about to be added. I needed to clear the advancements one packet later.
Why doesn't it work? I have an EntityDamageByEntity event. And if the player hit another with an object, then continue the execution. According to logic, there should be one item, but it says that there is no necessary object in the hand.
!= Dont compare objects like that
Ah lol
you create a new itemstack every time
it will never be == to anything else
https://paste.md-5.net/izacuzitil.bash wanted to post it but forgot apparently π
Use isSimilar() or even better: Use the PDC to tag custom items
== checks if the memory location of two objects are the same.
So if the identity is the same
"new" always creates a new object on a new memory location
btw using equals will also not work once someone has used the sword
or renamed it
use PDC tags
it's the only proper solution
ok well it's unbreakable, so using it won't damage it. nonetheless, you should use PDC tags
as said, it could be renamed, or enchanted, or whatever
thanks, guys
only issue with commenting that out is how now do I know where to publish too
also I just removed the aggregate javadoc plugin
what I'm confused about though is this
I downloaded the jar
and everything is there
what's the issue?
Do you use the all classifier
the downloaded jar is the -all jar
(this is the reason why I don't like publishing shadowjars)
just tell the shadowjar plugin to not use the classifier
can't one set it to null or sth
bruh legit why does it do this I have it set too π
shadowJar {
archiveClassifier.set('')
}```
hm that's what I would have suggested lol
Ugh. Lemme bring out the big guns
well I can only repeat myself, shading in gradle sucks
yeah no totally agree
whoever said it doesn't lied
why can't gradle just do the bear minimum and have an official plugin like maven
Because there is an official way
but it's not properly explained in the docs
what π
Try doing classifier = "" too
In the shadowJar block
isn#t that deprecated since 5.1
It seems to work in a gradle 7.0.2 project
alright guys I got it working
same for the official docs for jar
using a little black magic
Alternatively we would need to define an output archive with a certain classifier
how?
Converted to maven?
shadowJar {
archiveClassifier.set('')
}``` so basically I converted to islam and prayed to allah and this randomly started working
huh but ealier you said that that didnt work
yeah apparently I lied
cuz it works now π€·
the classifier is gone so
worlds most well explained commit
Can I cancel player move event but allow them to rotate?
probably but it might take a little logic
teleport them to the same x,y,z, while keeping pitch and yaw
on playermoveevent:
x = from.getX();
y = from.getY();
z = from.getZ();
pitch = to.getPitch();
roll = to.getPitch();
event.setTo(new Location(...))
sth like that
Thanks!
if Scoreboard#registerNewObjective is deprecated whats the new version to do
what of all?
if use String for Criterial then yeah is deprecated for use the method with the Criteria enum.
ah got it thanks
Hey
when I mine spawners this pops up
It doubles my spawners
when I delete essentials its gone Idk if its economy shop gui or essentials
but its duping
?img
Not verified? Upload screenshots here: https://prnt.sc/
do i need to "replace" a barrel to update its pdc
wrong channel
just realized when looking at my last git commit it didn't work because that code wasn't their I actually copied somethin from one of my other projects and just didn't notice that it included the shadowJar archiveClassifier.set(''). π€¦ββοΈ
This PersistentDataHolder is only linked to the snapshot instance stored by the BlockState. When storing changes on the PersistentDataHolder, the updated content will only be applied to the actual tile entity after one of the BlockState.update() methods is called.
thx
What is a good way to handle translations for a plugin
i always make a langue.yml
depending on for example a applied language permmison it uses a different response
you could either make lots of langueenglish.yml languagegerman.yml ...
or you make it all in one
more internally speaking though I was just thinking best way to manage without it being messy. I know Locale exists I'm just not exactly sure how I could use that to manage languages
what do you mean by "messy"
resourcebundles
you dont want to have local files or what
declaration: package: org.bukkit.entity, interface: Player
This parameter accepts a String as a sound
Where can I find the default sound files
I tried unzipping the client jar
have a resourcebundle based on the Player#getLocale
hmmm explain more I've only ever used 1 language so I'm completely new to this or atleast point to resource
its just a bunch of files, each file is for one locale
thanks
isnt that basically this in fancy words
?stash
basically
kinda, but seems like Bundles also provide good API for managing this internally
which makes a big difference
How to put a head with a custom texture?
I'm currently serializing a Set<?> using set.toArray()
When I deserialize it
Do I deserialize as List<?> and then apply
new TreeSet<Text>(Deserialize list)
uh collections can be serialized immediately afaik
shouldve to try it
so, what i need to do?
Use the other import
ew why
?
Yup
Paper plugins yikes
Β―_(γ)_/Β―
for the setPlayerProfile
is it the same thing
or do they add like one feature instead of just pr'ing it
I have no idea
And I have no other options, only these 2
This is the right import
Their PlayerProfile extends bukkits
but it gives error now
what do they add
Go to the paper discord then
okay
I always wondered what those special .json/s is about
I know about item / block jsons
But GPU and fancy shet no clue
Isn't there vanilla shaders?
no
have your own threadpool thing
what dat
also how can i loop something inside of a bukkitrunnable
i noticed while loops don't work
is there anything else that might?
π
why wouldnt they work
Which entity is the lightest entity? i mean Which entity make less lag ?
its bat ?
or armor stand ?
nope bats move
armor stands also contain other datas
maybe area effect clouds
aren't mushrooms entities as well?
no
Does anyone know how to create a custom item that even shows up in the creative inventory?
the creative inventory is client side
What version
latest
The new display and marker entities are the lightest
wrong replay
i wanna spawn a invis entity to show text hologram
so i cant use marker
Use TextDisplay
I mean that itβs a completely new item and not just a changed version of an item
Plugins cannot add items to the creative inventory
i think its do the same thing , yeh ?
TextDisplay is basically designed for holograms
And offers some extra features like background color
ik but its also spawn a entity ?
Can only mods do this
Yes
Thanks
guys can i use
public void run() { task }
more than once a tick?
why do you want to run faster than a tick?
does it matter
yes
i'm trying to get a particle to move in a line, but currently it moves very slowly
i'm using that to move it
oh sorry
ok you are spawning the particle
anyways i tried updating 1 to 0.1 in runtasktimer
yeah
you can;t
to go faster than a tick you have to use a ScheduledExecutorService
how would i do that?
but you are then Async so spawning particles would nott be permitted
oh ok
if you use packets you can spawn them faster
how'd i do that?
I've not done particles by packets myself
could i just update the code to be a while loop instad?
no, that would crash yoru server
oh ok
you could increase the speed you are moving the particles
ie, moving them a greater distance each tick
i've tried that but i'm checking for entities near the particle so i'd have to make that collision box very large if i increased speed
what are you trying to simulate with the moving particle?
like a spell hit
moving particle hitting player
yk
I know there is no server component to particles but does it bypass the modifying the world async block?
It should
set.queryState(null, RPPhones.PHONE_ALLOW_FLAG == StateFlag.State.DENY)
Worldguard stuff
Would .equals work correctly?
Checking if a flag is denied
if (set.testState(null, RPPhones.PHONE_ALLOW_FLAG)) {
event.setCancelled(true);
Their docs is... questionable
But I got it
guys how would i get the server time?
It shouldnβt
i mean would using system time be an accurate way to do cooldowns?
Sure
ok nice π
You can do Instant.now()
what does that do?
Or System.currentTimeMillis
yeah thats what i was thinking of doing
Returns an object easy to manipulate with methods that are descriptive
ah ok
i looked at it and it seems to return a lot of information
does that mean i'd have to edit the string it returns to just get the time?
Hm?
To convert a Java Instant to a String, you can use the DateTimeFormatter class. Here's an example:
Instant instant = Instant.now();
DateTimeFormatter formatter = DateTimeFormatter.ISO_INSTANT;
String formattedInstant = formatter.format(instant);
To convert a String back to an Instant, you can use the Instant.parse() method. Here's an example:
String stringInstant = "2022-03-20T10:11:12Z";
Instant instant = Instant.parse(stringInstant);
I hope that helps! Let me know if you have any other questions.
Source: Conversation with Bing, 12/04/2023(1) Format Instant to String in Java | Baeldung. https://www.baeldung.com/java-instant-to-string Accessed 12/04/2023.
(2) Instant toString() method in Java with Examples - GeeksForGeeks. https://www.geeksforgeeks.org/instant-tostring-method-in-java-with-examples/ Accessed 12/04/2023.
(3) java - UnsupportedTemporalTypeException when formatting Instant to .... https://stackoverflow.com/questions/25229124/unsupportedtemporaltypeexception-when-formatting-instant-to-string Accessed 12/04/2023.
(4) Format Instant to String in Java | Baeldung. https://www.baeldung.com/java-instant-to-string Accessed 12/04/2023.
(5) java - UnsupportedTemporalTypeException when formatting Instant to .... https://stackoverflow.com/questions/25229124/unsupportedtemporaltypeexception-when-formatting-instant-to-string Accessed 12/04/2023.
(6) Instant toString() method in Java with Examples - GeeksForGeeks. https://www.geeksforgeeks.org/instant-tostring-method-in-java-with-examples/ Accessed 12/04/2023.
Learn two different ways to format an instant as a string - one using core Java and the other using the Joda-Time library.
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
What datatype should I use
To store something like UUID, UUID in a pair but where the keys don't need to be unique, so not a key system
I need to store a list of <playerUUID, objectUUID> but there can be many same playerUUID just not the exact same combination
Something like Pair<UUID,UUID> but in a list
So multiple objectuuid to one playeruuid?
Multiple playeruuid to multiple object UUID
But a playeruuid is unique yes?
Player1 -> 1, 2 or 10 object UUID
player2 -> 1 2 or 10 object UUID
No
Because they need to be stored as a pair
So
Player1 will always be player1 yes?
Player1 -> Object1
Player1 -> Object2
That's what it is
Jesus those datatype names
Player1 -> Object1
Player1 -> Object2
Player2 -> Object2 //same as above
And so on
Cool
Hey guys, getting this error in my PlayerDeathEvent:
NoSuchMethodError: event.getPlayer()
This is my code:
public class Events implements Listener {
@EventHandler
public static void onPlayerDeath(PlayerDeathEvent event){
Player killer = event.getPlayer().getKiller();
//---
}
And then I use ArrayListMultimap.containsEntry(UUID,UUID)
To get the pair combo and not just one or the other which will always be unique combo
Sick
So how then multiverse-core do it?
I tried to find it in the source code, but it looks like the unload should not work, because they use same functions from the same api, although it works
Multiverse also cannot unload the main world
?jd-s
What do you mean "main" world?
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
Default world.
Ok, then i mean how multiverse-core do unload overworld maps?
ah got it. should I use event.getEntity() instead?
No
Yes
why is method called getEntity when its explicitly returning Player
Cause itβs not the main one.
also true
Because it extends EntityDeathEvent
Cause itβs a subgroup.. ^
Api do not allow to unload overworld maps bruh
You can unload any worlds thatβs not the main one
public boolean unloadWorld(World world, boolean save) {
if (world == null) {
return false;
} else {
WorldServer handle = ((CraftWorld)world).getHandle();
if (!this.console.worlds.contains(handle)) {
return false;
} else if (handle.dimension == 0) {
return false;
} else if (handle.players.size() > 0) {
return false;
} else {
WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
//...
handle.dimension - overworld
Thatβs not the api
it's spigot api
Oh
or bukkit whatever
Well the overworld is usually the main one ye?
wdym
dimension is only 0 for the main world
iirc custom worlds made with the spigot api start with dimension id 10
whatsthis
Prolly from ?stash
ok, why it's returns false then i trying unload world with no players in it?
Which world
guys going for elif after return
Not "default" one
I have trouble believing you
Is there any good tools to format an entire project in IntelliJ?
Like, remove unecessary spaces, imports and auto-indent everything
gotta love placeholders
console.worlds π€
Not the built in
Using IJ?
The built in π
Or anything tbh
Why
Built in doesn't do it all correctly
just change the builtin settings
i always put "dick" or "fuck" but on russian
Right click the project and then reformat code.
Unless I don't know how to use it
Then configure it to your preferences
Click em all
Except the vcs one
Yeah seems like
There's still dumb spaces between fields and such
It just won't remove them
Yes it's ocd
There's 2 instead of 1
Oh wait
It's because it goes from field to methods
It did do it correctly
nvm it didn't
Does spigot have an event for when TNT ignites?
suka blyat
That space
cheeki breeki sponge squeaky
Probably some setting somewhere if you dislike it
How can I check dimension value of the world?
Isn't that the ExplosionPrimeEvent?
World#getEnvironment#getId
Ah
declaration: package: org.bukkit.event.block, class: BlockIgniteEvent
I don't think that fires but let's give it a shot
yeah like this
Nope
Only called for fire spreading
eclipse has the same funcitonality tho
It turned out that I didn't teleport all the players out of the world, and therefore it wasn't shipped, thanks to everyone who tried to help
unsolved issue in spigot jira
https://hub.spigotmc.org/jira/browse/SPIGOT-519
print(w.getName());
print(String.valueOf(world.getEnvironment().getId()));
print(String.valueOf(getServer().unloadWorld(w, true)));
output
[20:18:22 INFO]: [ChangeMapByTeleport] world
[20:18:22 INFO]: [ChangeMapByTeleport] 0
[20:18:22 INFO]: [ChangeMapByTeleport] false
[20:18:22 INFO]: [ChangeMapByTeleport] m_12_Rooms
[20:18:22 INFO]: [ChangeMapByTeleport] 0
[20:18:22 INFO]: [ChangeMapByTeleport] true
So dimension still 0 for not main world
Well you said it works so
I assume environment ID must not be the same as dimension ID
oh, ok
Thanks anyway
Looks like that issue got a PR
PR was marked as needs work
And then the person vanished
Sadge
@EventHandler
public void mobDeath(EntityDeathEvent event) {
LivingEntity e = event.getEntity();
if (e instanceof Pig) {
event.getDrops().clear();
event.setDroppedExp(10);
e.getLocation().getWorld().dropItem(e.getLocation(), new ItemStack(Material.DIAMOND_SWORD, 1));
}
}
What am i doing wrong
when mob killed, it doesnt drop the diamond sword
IS the code running
yeah
Add some debug prints
is it possible to make a relational placeholder that works in tab?
looks like you got some work to do :3
I think that i got a typo
i have the TAB plugin, the one by neznamy, and i've done a normal placeholder but iirc the relational ones need 2 players as arguments
idk if you can pass null into it
Yup fixed, was typo
Is their also a way to add like change of 2% of dropping the dia sword?
on this
yeah i just didnt even see it
Gonna be difficult to make right
Sure, just use ThreadLocalRandom#current
ty
int boundedRandomValue = ThreadLocalRandom.current().nextInt(1, 100);
if (boundedRandomValue <= 3){
e.getLocation().getWorld().dropItem(e.getLocation(), new ItemStack(Material.WOODEN_SWORD, 1));
}
Like this
Yes
conclure working on mythology
That if u know its always gonna be accessed on the same thread
ah that
what would be slightly above 2% chance
No, im sorry
Since when did I tell u
in pm probably
or was that the mod
And then let people help me with the mod loot balancing etc since im not at all educated in that but ye
I think?
What will happen if i dont store it?
ye
yes
thats not how cloning works
is cloning faster / better tahn just doing
new MyClass(MyClass)
well
the new class my class passed, is not defined the same as clone
i'm aware just curious which one is technically "better" per say or like a usecase of cloning vs just making another constructor
class ItemStack {
public: ItemStack(ItemStack& obj) : material(obj.material) {};
}```
lol
ew wtf is this
could it be "kotlin"
Entity mob = e.getEntity();
if(e.getEntityType() == EntityType.ZOMBIE) {
mob.setCustomName("bandiet");
}
How to add a chestplate to this mobspawm
nah
cant find any good tut on yt/google
look at sources, not the text. Well you can
According to a post on StackOverflow, cloning is slower than calling new but faster than calling java.lang.Class.newInstance()ΒΉ. Another post on StackOverflow suggests that cloning is rarely a good idea in Java and that other techniques such as copy constructors or factory methods should be used insteadΒ².
I hope this helps!
Source: Conversation with Bing, 12/04/2023(1) Java 'Prototype' pattern - new vs clone vs class.newInstance. https://stackoverflow.com/questions/2427317/java-prototype-pattern-new-vs-clone-vs-class-newinstance Accessed 12/04/2023.
(2) java - Cloning vs. Instantiating a new class - Stack Overflow. https://stackoverflow.com/questions/3707612/cloning-vs-instantiating-a-new-class Accessed 12/04/2023.
(3) new Operator vs newInstance() Method in Java - GeeksforGeeks. https://www.geeksforgeeks.org/new-operator-vs-newinstance-method-java/ Accessed 12/04/2023.
(4) Java Cloning: Copy Constructors vs. Cloning - DZone. https://dzone.com/articles/java-cloning-copy-constructor-vs-cloning Accessed 12/04/2023.
(5) performance - Java 'Prototype' pattern - new vs clone vs class .... https://stackoverflow.com/questions/2427317/java-prototype-pattern-new-vs-clone-vs-class-newinstance Accessed 12/04/2023.
(6) java - newInstance() vs new - Stack Overflow. https://stackoverflow.com/questions/647111/newinstance-vs-new Accessed 12/04/2023.
(7) java - clone() vs copy constructor vs factory method? - Stack Overflow. https://stackoverflow.com/questions/1106102/clone-vs-copy-constructor-vs-factory-method Accessed 12/04/2023.
oh actually that's C isn't it
c++
Cant add any item to it
was too lazy for the fields but whatever
bing says it's c++
thanks chat gpt <3
LivingEntity mob = e.getEntity();
if (e.getEntityType() == EntityType.ZOMBIE) {
mob.setCustomName("bandiet");
new ItemStack(Material.DIAMOND_SWORD, 1);
}
Like this
ohhh
Hello I wanna ask if it's possible to change texture of leather armor (and icons) with mcpatcher/optifine ?
π€·ββοΈ why not just use custom model data and good ol texture packs
why error
ItemMeta#setCustomModelData
I think he is joking
ah A cannot be casted to B π€
Because this is a pretty trivial ClassCastException
idk wanted to test smth stupid
ah ok, go ham π
Can someone pls help me with updating my plugin from 1.19.2 to 1.19.4?
This is how my poml looks currently.
`||<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
</dependencies>||`
When I change all occureances from 1.19 to 1.19.4 I get a dependency error.
Fixed my issue π
You need to change the version in the special sources plugin configuration as well.
And dont forget to run BuildTools for 1.19.4
To do what?
Just call ItemStack#clone() ...
Between cloning the meta and the ItemStack?
here?
<plugin> <groupId>net.md-5</groupId> <artifactId>specialsource-maven-plugin</artifactId> <version>1.2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>remap</goal> </goals> <id>remap-obf</id> <configuration> <srgIn>org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:txt:maps-mojang</srgIn> <reverse>true</reverse> <remappedDependencies>org.spigotmc:spigot:1.19-R0.1-SNAPSHOTπ«remapped-mojang</remappedDependencies> <remappedArtifactAttached>true</remappedArtifactAttached> <remappedClassifierName>remapped-obf</remappedClassifierName> </configuration> </execution> <execution> <phase>package</phase> <goals> <goal>remap</goal> </goals> <id>remap-spigot</id> <configuration> <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile> <srgIn>org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn> <remappedDependencies>org.spigotmc:spigot:1.19-R0.1-SNAPSHOTπ«remapped-obf</remappedDependencies> </configuration> </execution> </executions> </plugin>
I tried to change everything here to 1.19.4, but it doesnt work. Do I need to restart the computer after running the buildtools?
oh i havent used remapped
thats prolly the issue
Ive never used the copy constructor. I would assume that there is actually no difference.
World#getTime()
Thanks
I think he wants like 24 hour time
But crammed within the 10 minutes a Minecraft day takes place
Like those sleeping plugins that say what time it is
Or not
getTime returns an int from 0 - 24000
Thats just 24h in minecraft. Should be easy to format this.
Thank you very much. After I used buildtools with --remapped i get no more dependency errors.
What package would I need to use now here?
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
Let your IDE import that
Ide suggested v1_19_R3. Is that correct?
For 1.19.4 yes.
This is how i save a chest as something for my plugin, any idea how can i remove a location from this?
as you can see the chests are sorted by number, if i remove some chest like number 58 how i can rearrange all of the locations again?
public static void setLootBox(Location location) {
if (!isLootBox(location)) {
int count = lootboxes.getConfigurationSection("").getKeys(false).size() + 1;
lootboxes.set(count + ".world", location.getWorld().getName());
lootboxes.set(count + ".x", location.getX());
lootboxes.set(count + ".y", location.getY());
lootboxes.set(count + ".z", location.getZ());
FileManager.saveData(FileType.LOOTBOXES);
}
}
public static boolean isLootBox(Location location) {
List<Location> currentLootBoxes = new ArrayList<>();
for (String key : lootboxes.getConfigurationSection("").getKeys(false)) {
currentLootBoxes.add(new Location(
Bukkit.getWorld(lootboxes.getString(key + ".world")),
lootboxes.getInt(key + ".x"),
lootboxes.getInt(key + ".y"),
lootboxes.getInt(key + ".z")
));
}
return currentLootBoxes.contains(location);
}
whatsup all, anyone know the solution to player max health?
First of all: Dont tinker with configurations on runtime.
Server loads: Load everything from config into proper classes
Sever stops: Save data back into files
You can also use the livecycle of chunks and only load the chest data
when a chunk loads.
But whatever you do, dont randomly access configurations like that on runtime.
Kill every sheep on the server, twice
Doesnt matter
player.setHealthScale ig
thanks
thanks a bunch
Also: Your isLootBox() method is really really inefficient.
You should create a manager class which handles a
Map<Location, Lootbox>
and then call containsKey() on that.
Iterating through all lootboxes can get really expensive, really fast
And while you are at it: Remove the static keyword
Example of how to write a simple manager class:
public class LootboxManager {
// Never expose the map directly, as it is mutable.
private final Map<Location, Lootbox> lootboxMap;
public LootboxManager() {
this.lootboxMap = new HashMap<>();
}
public boolean isLootBoxAt(Location location) {
return lootboxMap.containsKey(location);
}
public void addLootBox(Location location, Lootbox lootbox) {
Preconditions.checkArgument(!isLootBoxAt(location), "There is already a lootbox at this location.");
lootboxMap.put(location, lootbox);
}
public Lootbox getLootBox(Location location) {
return lootboxMap.get(location);
}
public void removeLootBox(Location location) {
lootboxMap.remove(location);
}
}
actually my plugin won't be public or used for hundreds of players, it's for my personal server and maybe setting up loot boxes is one time at all, but it's better to have a standardized and optimized code, isn't it?
Yes you will see that this is going to speed up your programming process.
And its way easier to add new features like this.
As Bob Martin said: "The only way to go fast is to go well."
unfortunately this is how i do this stuff for my plugin, never tried "to go well"
int barrelhealth = barrel.getPersistentDataContainer().get(new NamespacedKey(plugin, "healthkey"), PersistentDataType.INTEGER); why doesnt it work
the pdc is there
i can read it with /data
but my plugin fails to do so
Show the data?
you can create class with static final NamespacedKey instead of creating always new, thats only tip
And reading?
cant check it rn but i know it works i read it before
I can see the problem already
Is a program like oracle better or a program like intelij idea better
personal opinion most spigot devs use intj tho ig
Quick question, can I just use the raw Event to detect any event in EventHandlers?
IntelliJ is great
no
Nop
well tell me
yeah but i dont have the paid version...
Double check your keys
Community is fine π€πΌ
@glossy wren it is possible, but not rlly supported or recommended, read about it here https://www.spigotmc.org/threads/listening-to-all-events-listing-all-events.337466/
I did tell him to send us his retrieval code to make sure it was the same as the thing he posted a second before
oh.
ty, will check it out
How is a custom rank plugin made? i have watched many tutorials on java and still havent figured it out.
Step 1) Use LuckPerms
which is?
a very nice plugin
Depends on what you define as "rank"
oh
name near chat
Well then LuckPerms is the status quoe for this
oh
thats just like rewriting the wheel
hell yeah it is but that means you'll learn finely
Its one of the less fun plugins to write
luckprems also has its own gui
perms plugins aren't fun to make apparently lol I wouldn't
thats what ive been saying!!
if you want to do it, go ahead
Yeah Iβd avoid trying to learn to make a permission plugin. Thereβs no reason to touch anything beyond hasPermission()
break down the plugin and take it step by step
There are some very specific cases where a custom permissions plugin
is viable. Im currently writing an implementation because i need multiple
profiles per player and LuckPerms has no sane support for that.
if you make 1 permission plugin thats all you will be made to do
okay thx
solution: PR to luckperms xD
actually do u have some knowledge of luckperms inner workings?
Why do i get this error?
https://pastebin.com/82XQ9uZE
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
if so i have a question
text wall
not anymore
Your json is botched
yea changed it quickly sorry :/
well looks like your JSON file is malformed
@lost matrix how the hell does it figure out the permission strings i use in my plugin (only using #hasPermission) and lets me autocomplete them
i dont get that
black magic
who knows maybe they do practice black magic
Do you register them in your plugin.yml?
Yea, I've noticed that LuckPerms can find them without them being registered.
You don't think it does code analysis?
what did i do wrong in that line?
IChatBaseComponent chatTitle = ChatSerializer.a("Β§cΒ§lEvent beginns");
Maybe it scans classes on the classpath for patterns like hasPermission("...")
that might be the case yea
That's not json
ChatSerializer takes JSON inputs.
π why do peolpe do this. Code without knowing what a syntax error is nor how to highlight over it and see what is wrong
Dont use raw nms. Setup mojang mappings. Then you can create simple components like this
Component text = Component.literal("Some text");
1.8
Well then he can go where the pepper grows
Wait that doesnt make sense in english
Or does it
no it doesn't
Not really. ;P
XD
More like he can go where the wind blows.
Yeah that makes more sense
I love you modern gui approach resource smile Its so much more useful to just send a link than explain proper design

any1 here well versed in pc hardware?
im tryna decide what cpu i want to buy
but all these numbers i cant figure out which ones better
how can i fix that error?
just grab the intel i5-12600k not biased or anything
Whats your budget range? 12500 is really decent currently
was thninking about the new amd one that got released few days ago
The latest? 7800x3d?
not rlly a budget, want high end
yea
Watch the LTT video on it first
but not a a thread ripper or epyc
The 7800x3d is actually somehow better than the 7900x3d in most cases.
Because of lacking CPU selection from most programs
Generally bigger number means better performance.
At least in CPUs
Memory can be tricky
yh but i also heard the 9 was actually worse due to it swiching between cores or something
something to do with v cache
I wouldn't get the latest 7900x3d because it's still bleeding edge.
Plus the new AM5 platform is still expensive as hell.
Worse in games where you won't need that many cores
Cheaper motherboards are starting to arrive
What resolution are you going to drive? High resolutions are way more
bottlenecked by your GPU
prolly just 1080p with 144hz refresh
Also what's your usecase? Gaming? Streaming? Programming?
Gaming and programming
i wanna be able to compile shit fast
but games gotta run good too
fair enough
Is anything done differently between creative and survival/adventure regarding EntityDamageByEntityEvent
I have a event that works perfect on creative but not on survival/adventure even tho the event still gets called
looks like /.idea/ did it
i always have to find a gitignore to use when creating a new project lol
ah found the issue
actually idk
as long as my project is on gh its good
tracking if a player places a amour stand would be a EntitySpawnEvent right
resourcebundles?
Wouldn't that be Player https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEntityEvent.html or player interact event
declaration: package: org.bukkit.event.player, class: PlayerInteractEntityEvent
a few events are probably fired
EntitySpawnEvent isn't one of them though
that doesnt happen
cap
never seen such clean code https://paste.md-5.net/efovicaguq.java
MockBukkit wouldn't lie to me
youl find a bug, trust me
ig ill have to play around before i dive into docs
I won't i guarentee it
the one possible bug I haven't covered is defaulting back to english if the spanish locale doesn't exist for a certain field
it literally worked again first try
use Fedora 
need windows for college
RIp
my friend in uni right now and he's gotten away with Linux Only somehow
he runs arch on his laptop and fedora on his desktop
is linux hard to get into when u have been using windows ur entire life?
hmm microsoft office will not like that
depends on the distro
when u gotta deal with nvidia drivers YES
Is anything done differently between creative and survival/adventure regarding EntityDamageByEntityEvent
I have a event that works perfect on creative but not on survival/adventure even tho the event still gets called
ive been using debian for a while
also used kde neon, classic ubuntu ofc, manjaro, kubuntu, fedora for a while and probably a few more
bruh where did git repo go
use Fedora
imma clone it again when my os is back lol
try it out
is that debian based?
never heard of
Come on - you have heard of Red Hat Enterprise Linux
oh god i have around 20 vms that i gotta clone
ah yes
i know where to find everything on debian so ill gotta stay with that for a while now
Fedora doesn't have telemetry π€·ββοΈ not a huge deal
its nice os
I am using Fedora π
lol
uh oh got a bit of files to transfer, not to talk about my 40 gigs iso folder
First and only linux distro I tried out.
But I did quite a lot of hopping between Fedora's flavours (or Spins as how they call it). Ultimately GNOME is the better choice
You mean maven repo?
Same thing different colour
Just wanted to be sure
I've tried, Ubuntu, Arch and Fedora honestly fedora seems like the best balance of what I want
The answer is no
Make sure you are using the spigot API
I'm quite sure I am
Well you are not using the spigot repo
It worked before
Because you had it in mavenLocal
No, I remember, I was using a proxy repo by a friend
Use https://hub.spigotmc.org/nexus/content/repositories/snapshots/
Okay I kinda lied: I am using Debian on my server - but I regret it.
atleast use ubuntu server
I am pretty sure it is vulnerable against hundreds if not thousands of exploits
:)
Debian is so outdated that I don't even bother updating it
uh shit
id rather not copy all this stuff over
hmm another spicy 40 gigs
i would be able to setup a whole server architecture XD
Files.newInputStream :)
tried that
The schematic you're using is in the wrong format
tried .schematic too
thats why I use SPONG_SCHEMATIC
you extracted it from your jar?
If it isn't a sponge schematic it's probably legacy
got the file from worldedit then put it im my jar
yep
you used filtering when including resources when packaging your jar
filtering breaks zip files
I will try this File file = new File("plugins/WorldEdit/schematics/jfg.schematic");File file = new File("plugins/WorldEdit/schematics/jfg.schematic");
<resources>
<!-- Include all resources -->
<resource>
<directory>resources</directory>
<filtering>true</filtering>
<includes>
<include>*.yml</include>
<include>*.txt</include>
<include>*.json</include>
<include>*.properties</include>
</includes>
</resource>
<resource>
<directory>resources</directory>
<filtering>false</filtering>
<includes>
<include>*.nbt</include>
</includes>
</resource>
</resources>```
guys I'm using:
if (System.currentTimeMillis() - cooldown.get(p.getName())) {
to try and minus the current time from the time stored in a hashmap.
whenever i do this it says:
Incompatible types. Found: 'long', required: 'boolean'
How can I fix this?
(I've already done the fixes I found on the internet however they just cause more errors)
an if() requires a boolean result not a value
Use a comparator like greater than or less than
It needs to evaluate to true or false
ohhhhhh OHHHH
Also why not use Instants?
Why do you like instants so much
Comparing stuff is easy using the date api
Instansts are great
use instants
theres an example on the cooldowns wiki
?cooldowns
?cooldown
@quaint mantle cooldowns wiki link command
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
But muh bytes
You can get an instant of epochmillis
Yeah but it's a class so it has more overhead
thank
So?
So muh bytes
People are feeding their server with way too much ram anyway
Itβs fine to use a bit of it for a bit
how to send messages to player with clickable content, not all message, like: Do you accept the trade [Yes] [No]?
Huh
guys I'm trying to check if a hashmap contains a player name.
How would I do this?
@tawny pine how does your hashmap look
Is it a key or a value
you should be using UUID's btw
UUIDs reign supreme
in terms of performance is it better to use PlayerMoveEvent or use a runTaskTimerAsynchronously(this,0,5L) to check for Player location if its bellow certin y level , do stuff
ArrayList<UUID> haveCooldowns = new ArrayList<UUID>();
That's how I define it.
if (!(cooldown.containsKey(p.getName()))) {
That is the code I'm using to check if it contains the player name.
My issue is that this if statement triggers when it isn't supposed to.
move event tbh
I think I am already.
Thatβs notba map
?
it doesn't even matter if you have a check every move event
i tested it , it was not working great .. allot of bugs ..
Do containts p.getUniqueId()
it was doing the method i added in it twice ..
How?
How can you mess it up
Wait
with the runnable it only , do it once
ok. Do I have to change other parts of the code to use that?
Did you register it twice on accident
@tawny pine show me the cooldown map
no
Are you sure?
How do I do that?
I showed you the define thing already?
