#help-development
1 messages ยท Page 1831 of 1
lmao
wither
what a funny word
say it 10 times in a row
wither wither wither ...
I figured a free plugin that actually lets you make your own enchantments would be appreciated
Is there an official java CapesAPI ???
the problem is that own enchantments are basically not really flexible when only defined through yaml
like... how would you express telekinesis in a yaml?
or soulbound
or... get health for petting dogs
Haven't added those yet, but they will be supported
maybe people will answer faster when you add more question marks
one second of google: https://wiki.vg/Mojang_API#UUID_to_Profile_and_Skin.2FCape
hahaha
That should actually be achievable
But for java. I want to add player capes from a plugin
you can't
My man rewriting skript
Lol really?
the capes are rendered client side
Lol
either players need a client mod to see the capes you assign to other players, or forget about this idea
The benefit over skript is that it's not interpreted
And how you cam play lunar emojis to all servers players when someone use it?
its the same thing
wtf is lunar emojis
what's even the point of UtilityClass?
iirc all it does is add a private ctor
which throws an exception
it doesn't make sense for that class
I just add it to all utilityclasses
comestics*
what does it do?
Only other players with Lunar can see those
yeah but you need a plugin
I can literally do the same thing in 5 key presses without having to import Lombok both through Java imports and Gradle just via IDEA's live templates.
Except maybe some emojis, since vanilla does support a few emojis
fine, noone forces you to use it lol
Yeah, something has to communicate between the clients
it makes the class static, it creates a private constructor throwing an exception, it makes all members static
erm I mean
it makes the class final
So you can do it with capes btww
it makes it static when it's an inner class
Sure, if you have a client
as I said - WITH CLIENT MODS
I deem this kinda shit as a transforming utility
cuz capes are COOL and QUIRKY
sry I don't understand that sentence^^
It's a transformer
yeah but tbh you don't have to agree with their EULA and can freely violate it if you like to
of course they might however make other players not being able to join your server anymore
its fun
I once worked for a fairly large server that violated the EULA and they basically got "banned" by mojang, no players could connect anymore lol
Yeah but even that can be bypassed
they changed some stuff, messaged mojang and were free to go afterwards
yeah mojang has a small patch for Netty for its disallowed hosts
For Lombok to do the shit it does and be worth it, it needs to actually do useful shit.
So far:
- I can just add
finalmyself, it's a single keyword, and it doesn't take enough time out of my day. - I have a live template called
utilset up for that constructor and it would take less time to use it. - How often do you add new methods to your util class for an annotation that turns everything static to be worth using? Most of the time you'll add maybe 2-4 an hour?
that's your opinion. I like Lombok. I just add e.g. @Data to a class and instantly have getters, setters, constructors, equals, hashcode all done
it was getting bypassed using SRV records apparently but mojang patched? that too
What Lombok should be doing is making their extension methods system actually worth using :p
goddamn ClassNotFoundException i hate it
What java should be doing is adding useful shortcuts to reduce boiler plate
@Data is worth it
But then again I only use it like 3 times in one project
noone forces you to use lombok, feel free to do it manually ๐
Anddd I also use Kotlin over Lombok
they did with records
as a true programming masochist i will not use lombok
public class Genre
{
public string Name { get; set; }
}
``` Java plz
true
I'm fine with you not using lombok lol
im fine with not using it 2
Okay, nobody forces me to use Lombok, but that doesn't mean Lombok is actually useful for the people who do use it. How much out of Lombok do you use besides like, 3-4 annotations? It has like 8+.
And when the alternative is not hard to setup, what is the point?
worked on a project that used lombok only actual part i disliked was installing an extension to enable lombok processing
Well, that's not really a fault of Lombok. And it's just a one and done thing.
I'm using NonNull, Getter, Setter, ToString, EqualsAndHashCode, NoArgsConstructor, RequiredArgsConsturctor, AllArgsConstructor, Data, Builder, SneakyThrows, Value and UtilityClass
SneakyThrows is terrible
I don't think so
it's the same as throwing RuntimeExceptions
ik, just an extra step im too lazy for
it also would be one&done if i didnt uninstall it once i was done working on that project xd
@ToString?
Bomlok
mookbl
which is unconventional and overall the improper way to handle exceptions
Still couldn't find out the new Sound Enum Value for SUCCESSFUL_HIT. It's not something with villager somehow
I don't think so
what else would you do when you run out of memory? add OutOfMemoryError to EVERY single method you write?
sometimes it's just not very smart to add every single exception/error/throwable that could occur to the method sig
I thought this was for checked exceptions
yes it is
- OutOfMemoryError is not a RuntimeException
- It's not smart to throw or catch it
- It's almost never thrown by a method explicitly but instead the JVM itself
OOM is not a checked exception
and sometimes you shouldn't avoid IOExceptions bc you're too lazy to catch them
but sometimes you can be sure that a checked exception is never thrown if you do everything properly
I know, it was an example. maybe a bad one
It isn't but it also isn't RuntimeException, it's Error
I did not know there was a third category
yeah it's for unchecked exceptions typically thrown by the JVM that shouldn't be caught
AKA unrecoverable exceptions
e.g. check this
/**
* Reads a file from the resources directory and returns it as List of Strings
*
* @param plugin Plugin
* @param fileName File name
* @return A list of Strings of the file's contents
*/
@SneakyThrows
public static List<String> readFileFromResources(final Plugin plugin, final String fileName) {
final InputStream input = plugin.getResource(fileName);
if (input == null) {
throw new FileNotFoundException();
}
final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(input));
final List<String> lines = new ArrayList<>();
String line;
try {
while ((line = bufferedReader.readLine()) != null) {
lines.add(line);
}
bufferedReader.close();
} catch (final IOException exception) {
exception.printStackTrace();
}
return lines;
}
from my lib
would any developer ever try to read a file from their jar that does not exist?
yeah maybe sometimes by accident
but it doesn't make any sense to surround all the usages of that with try catch
Then just use try catch inside the lib
and then return null, so a NPE is thrown later on?
Optional
that's a fucking List
c#?
return Collections.emptyList()
Yes
OOM is not an exception, it's an error. Catching it is nonsense.
or: use Optional
but why? that would just make debugging harder
people WANT an exception if they do bad stuff
libs should use throws more tho
user needs to catch error and handle properly
not library
unless its a library issue, of course
but if the file name doesnt exist
because collection types should almost never be null as it causes problems
I do not see any reason to NOT pass on the FileNotFoundException in that case and I also see no reason to have to surround it with try/catch
iterating over a null collection causes an NPE
iterating over an empty collection does nothing
it's not in this case IMHO. If the file is not in the .jar, the dev fucked up
exactly
but it should cause problems in this case
yeah but if you expect something to happen, then it's still a glitch
Because you do not want to null check every collection before accessing it.
why is catching Errors nonsense?
it's a difference between everything breaking, and just the iteration returning no results
if it would be nonsense to catch errors, it would not be possible to do so
it's literally defined in the documentation for Error
it's possible bc it's not semantically validated by the compiler for whatever reason
An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch.
literally first line of docs
Because you cannot recover from OOM. The best thing to do from there is making the program terminate.
you're right about that, but that doesn't have anything to do with what we're actually talking about
(theoretically you could recover from OOM with SoftReferences, but that's a bad idea)
ez
anyway we are not talking about catching Errors here, but about whether or not FileNotFoundExc should be try/catched or simply passed on as SneakyThrows
Yeah you could, but I don't think we wanna push it that far
I don't want to include all my resource reading logic into try/catch blocks though because I KNOW that I included those files in my .jar
Agree
since lib consumers may want to handle it differently
its a friggin library
you have to use throws
its not your own plugin
you want the user to handle the error
not the lib
bruhh
and btw
the lib does not handle it
runtime exceptions are kind of terrible anyway
for stuff like invalid numbers during number parsing
you'd have to check the docs to see what is thrown
ah yes make the user catch runtime exception
very nice
no difference from just try and catching IOException
langs like Rust get around this via explicit error handling through Result and Option
well here's my opinion:
I think the java developers are not that stupid. If you all think that RuntimeExceptions are such a terrible idea, maybe ask the java devs why it was added. In my opinion, they are not terrible. But of course that's just my opinion
the Java devs aren't the smartest people, dude
I didn't say that, but I also don't think that they just made it up for fun
they're just a corporation who thinks they know what's best for their language
well no they probably made it up just for ease-of-use
but it's still a bad practice to leave errors unhandled within libraries
yeah in general, sure
as it makes the end error much more confusing for the user
but not in some conditions, thats my opinion
noone would ever use "readResource("blabla.yml")" if there's no blabla.yml
(another reason why @SneakyThrows can be bad is that you're unable to pass additional error information)
what if someone modified it then? i mean, thats the same mindset with any other io thing
Lol
there isn't really much more to tell in a FileNotFoundExc besides "the file wasnt found"
(e.g. logging exceptions/printing their stacktraces as opposed to letting them be unchecked for the duration of the program, making it crash)
and also what if
you are dealing with a configuration
user specifies file names
then a file name is invalid
while looping through
ah yeah
noone would load "USER SPECIFIC" files from INSIDE THE JAR
mhm
FileNotFound is not only exclusively thrown when the file doesn't exist
locale?
lmao
I think you are all missing the point that this method simply gets a file from inside the .jar
what could possibly the reason for it to be thrown except that the plugin dev did a typo? or forgot to "shade" the resource?
I think the best part of your example is how you already have a try/catch in that method yet you still use SneakyThrows
anybody else getting this? Cannot resolve org.spigotmc:spigot:1.18-R0.1-SNAPSHOT
you didnt compile it
?bt
yeah because I only want to throw FileNotFoundException and nothing else
why are you using 1.18 btw? instead of 1.18.1
the error is in my pom.xml
to anyone hating SneakyThrows, please just read this:
I can understand your opinions on MY usage of SneakyThrows, but I don't think that SneakyThrows is useless in general
if you think about it
most of Lombok's problems are just the fault of Java
Well I for myself really like Lombok and I won't stop using it, I see nothing wrong with using it, so please don't mock people for using it ๐
I also don't mock Kotlin users lol
Well the difference is that Kotlin is a full language with more than just a few utility features.
Brainfuck is a full language too with more than just a few utility features
(Which could've existed in Java had Java actually been decided nicely)
scala n kotlin takes lombok Getter and Setter and said hehe mine now
Well Brainfuck has 0 utility features
So improper comparison
Because I know you're comparing how Kotlin and Lombok have the same set of features.
Because, they do.
But Brainfuck doesn't.
No I don't
i dont get why you are comparing an actual language to a joke language
I just wanted to mention that different might prefer different things. I like Kotlin because it adds some nice things that make my life easier
Hey
"stack engineer, knows 1000 hours of brainfuck!"
Brainfuck is the highest grade enterprise language
Kotlin could do that too, but I just don't like Kotlin. That doesn't mean that I say it's bad
I like Kotlin because it actually fixes a lot of Java's problems.
brainfuck is no "joke" ๐ฟ
that's true, I don't like it anyway. It's just so ugly lmao
I know that's a bad reason not to use it
The US nuclear missile launch system uses Brainfuck
US' former president was the incarnation of Brainfuck
clinton?
the orange dude
my original point is how Lombok has bad implementations and a lot of seemingly useless or concerning features
ah, eisenhower
lets not discuss politics here ๐
are you a moderator?
u brought up the president first??
and you're the one who brought up politics first
anyway the word you're looking for is Trump
just wanted to make a joke
i was just naming off some prez's
Okay anyway - Lombok's @Data is awesome
but scala is cooler ๐
okay there is actually one big problem with @Data
which one?
using it makes it harder to individually customize the annotations it applies
since @Data is literally just like 6 annotations in a trenchcoat
last time I used it, you needed to either:
- use
@Data - apply every annotation anyways just to edit one of them
well if you want to NOT include a setter for everything, just make the fields final etc
Everyone can always decide on whether or not to use Data
I use it for simple stuff, like for example... let me look for it
package de.jeff_media.jefflib;
import com.google.common.base.Enums;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Locale;
/**
* Data class to wrap all information needed to play a particle
*/
@Data
@Builder
@RequiredArgsConstructor
@AllArgsConstructor
public final class ParticleData {
private Particle particle;
private int amount = 1;
private double offsetX;
private double offsetY;
private double offsetZ;
private double speed;
public static ParticleData fromConfigurationSection(@NotNull final ConfigurationSection config, @Nullable String prefix) {
if(prefix == null) prefix = "";
final String particleName = config.getString(prefix + "type");
if(particleName == null || particleName.isEmpty()) {
throw new IllegalArgumentException("No particle type defined");
}
final Particle particle = Enums.getIfPresent(Particle.class, particleName.toUpperCase(Locale.ROOT)).orNull();
if(particle == null) {
throw new IllegalArgumentException("Unknown particle type: " + particleName);
}
int amount = 1;
if(config.isInt(prefix + "amount")) {
amount = config.getInt(prefix+"amount");
}
double offsetX = 0;
if(config.isDouble(prefix + "offset-x")) {
offsetX = config.getDouble(prefix+"offset-x");
}
double offsetY = 0;
if(config.isDouble(prefix + "offset-y")) {
offsetY = config.getDouble(prefix+"offset-y");
}
double offsetZ = 0;
if(config.isDouble(prefix + "offset-z")) {
offsetZ = config.getDouble(prefix+"offset-z");
}
double speed = 0;
if(config.isDouble(prefix + "speed")) {
speed = config.getDouble(prefix + speed);
}
return new ParticleData(particle,amount,offsetX,offsetY,offsetZ,speed);
}
public void playToPlayer(@NotNull final Player player, @NotNull final Location location) {
player.spawnParticle(particle, location, amount, offsetX, offsetY, offsetZ, speed);
}
public void playToWorld(@NotNull final Location location) {
location.getWorld().spawnParticle(particle,location,amount, offsetX, offsetY, offsetZ, speed);
}
}
no need to overwrite anything there. Just add @Data, done
You don't have to be sorry. it saves me a ton of work everytime I need user-configured particles
feel free to just not use it ๐
this is one of those times I advocate for reflection
if you have a better method to read particle data from a ConfigurationSection, I'd be happy to see it and use that one instead
also what's wrong with that method?
the name
how would you call it?
It's the same as TextComponent.fromLegacyText
I like to stick to the names how Bukkit/Spigot does it
yeah but the parameter isn't LegacyText text
read
lmao
oh that works too
I prefer descriptive names even if they are overly verbose
something wrong with that too? >.<
I didnโt know it existed
Enums.getIfPresent is heaven sent
I always use valueOf
it's from Google, or Apache Commons? i dont remember
Guava
com.google.common.base
anyway, what we really need is some way to do quick enum reverse lookup
yes, that is Guava
might be, no idea^^
it's an awesome method
I wrote something similar myself until I found out this is already included in spigot
like uh
MyEnum.MY_VAL(0) and then
MyEnum.from(0) -> MY_VAL
I always have to do some boilerplate for that
/**
* Removes an item from the array at a given location, returning the remaining array
* @param arr Array to remove from
* @param index Index at which to remove from
* @param <T> Array type
* @return Array with the desired item removed
*/
public static <T> T[] removeAtIndex(final T[] arr, final int index) {
if(arr == null || index < 0 || index >= arr.length) {
return arr;
}
final List<T> list = new ArrayList<>(Arrays.asList(arr));
list.remove(index);
//noinspection unchecked
return list.toArray((T[]) Array.newInstance(arr.getClass().getComponentType(),0));
}
Generics + arrays are disgusting. Someone got any better idea for this one?
hold on
Two array copies
yeah
got any examples?
just do some shit with Arrays
well it's faster
Make new array with size - 1 length
Then system.arraycopy all ements before index
And another system.arraycopy with elements after
this has too much instantiation and also uses Array.newInstance which can't possibly be fast
(oh ye plus you haven't seen the shit that list.toArray goes through lmao)
I know that it's not fast, that's why I asked for your ideas ๐
public void removeElement(Object[] arr, int removedIdx) {
System.arraycopy(arr, removedIdx + 1, arr, removedIdx, arr.length - 1 - removedIdx);
}
Can be done in one line apparently
lmao
Stolen off stackoverflow
thanks ๐
oh wait
bc people smarter than you have figured it out already
but that changes the original array
My first one was prolly better
ArrayUtils.removeElement(array
Go see what that does
but that still requires Arrays.newIntance I assume ?
Apache so probably overengineered lol
It exposes a RCE
I love commons โค๏ธ
Wait no wrong Apache
in all fairness, Apache Commons is good
right Apache, wrong project
cant u call new ArrayList<>(arr) instead of having to call asList?
Well, yeah
nope
It has to be a collection
collections only take in other collections
because the stdlib is fucking atrocious sometimes
wtf why is java so bad
yes but it's the same:
@SafeVarargs
@SuppressWarnings("varargs")
public static <T> List<T> asList(T... a) {
return new ArrayList<>(a);
}
nope :3
that's a different ArrayList
that's Arrays.ArrayList
it is a private static inner class that presents a List view over an array
C# is what java shouldve been...
oh yeah true
new ArrayList<>(Arrays.asList(data))
Im using the remapped dependency, how come my NBT imports don't work?
but has the benefit of not having any performance downsides from adding a buncha shit
anyway this is why Kotlin is better
because you use the old names
listOf<T>(data)
you still use obfuscated names and/or spigot old mappings
ok javascript user
NBTBASE and NBTCOMPOUND are both invalid imports?
...who are you talking to??
did they change it all?
yes
yes
kotlin?
to @pearl spear
not you
yikes imma die
you won't lol
yes
you just need to update your code to use Mojang names @pearl spear
maybe create a thread, I might be able to help a bit
mutableListOf ๐
use both dependencies :stonks:
dev
you can do shit like
val string = listOf("Hello", "World!").joinToString(", ") (Hello, World!)
how does this man manage to come in whenever someone is talking about non api stuff
Uhh, I canโt register a new biome with the API
accessing data from itemstacks created in old versions
Lol
but yeah NBT sucks, PDC is heaven sent
because he cares that much about not caring
but for example, when I have to check whether some item made by some stupid enchantment plugins is soulbound, I need NBT
e.g. MMOItems uses NBT
NBT is nice if you're using an actually good API
Mojang is not an actually good API
and to check that, you need NBT
I once tried to implement an NBT reader but it was quite shit
I am uusing NBT to get enchantments on an item, rather than using ItemMeta which is bad on performance
I'll try so again in the future
bad on performance?
how many times per tick are you checking lol
i remember that when i was debuging some shit
i saw something cool in the itemmeta
something like unhandledTags
ItemMeta when being called lots is like hella bad on performance
how TF is using ItemMeta causing performance problems?
sorry but that's total bullshit IMHO
What makes you refuse to believe it
the fact that everyone uses it and noone ever had any problems with it
well afaik ItemMeta's probably just a wrapper
dont call the same methods over and over again, you can store the result in a variable
MEMOIZATION!!! โจ
yeah of course you should not use item.getItemMeta() 80 times in a row, I doubt anyone ever did that
Any enchantment plugin anywhere does not use ItemMeta
see that
yes, none of the API is going to be as fast as bypassing it; but you are almost never going to be in a situation where it is actually the cause of lag
I've seen at least 5 enchantment plugins that use ItemMeta. And they do so because it makes sense
and if for some reason some aspect is particularly bad, then bug reports exist
Even if you did lol
Just read memory directly
I remember using Spark Profiler like a year ago or some shit
I'm gonna make some patches for NMS that allow me to load plugins but nothing else
:3
well, probably not since I'm lazy
but it sounds fun
when I had like 30 people online, the ItemMeta method was wrecking the cpu
probably your fault tbh
then I switched to nbt
optimize your shit
no problems
probably you misinterpreted your spark report then
make a fork of spigot but its only nms
is that the argument here though
yes
or you did some very stupid stuff with your itemmetas
we need to save 400ms!
i thought we were talking about how ItemMeta is much more costly on performance than using NBT to get enchants
not my use of Itemmeta
tbf I do love saving 400ms
Just to get this straight: I once sold a plugin to a server with about 100-200 concurrent players 24/7. that plugin checked the ItemMeta of EVERY online player's getItemInMainHand, EVERY tick. No problem at all. Solid 20 TPS
for who you sold that? i need to save that server!!!!!!
Yikes
ElderCraft
im going to save them!
Ignorance is bliss I guess
lmao the only time when I'm an encouraging person is when I'm being an asshole
yeah sorry but
ItemMeta is no performance problem
loading chunks is, or serializing large itemstacks
and ?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I mean it may be slower the first time
maybe not insult people asking questions here
y'know if Mojang didn't store everything as NBT, stuff could be way faster
When the meta doesnโt exist and has to be created
but when it doesn't exist, it's basically empty
I'd say "well I was joking" but then again you're just gonna say "well it's still rude" so I'm not even gonna bother defending myself.
or does it get created from NBT then?
nah I know it was a joke, I just think people COULD be offended anyway ๐
well fuck 'em then
I thought you were talking about the dude who asked the NBT question
let 'em be offended
if you were talking about me: I'm fine with getting insulted lol
that's my job, I have an LGBT pic, I get insulted all the time on some discords lmao
it's not my duty to make sure everyone in this world goes a day without feeling slightly upset cuz someone they don't know jokingly insulted them
I just do what makes me happy :)
Windows
but I'm considering moving my laptop over to Ubuntu when I'm able to
ubuntu is a good choice for desktops / laptops imho because it has many third party drivers included
mint is cozy imo
yeah I'm running mint too
debian for servers, but debian is shitty to use as desktop OS
it just misses all the drivers
windows too, for gaming
and other non-Mint distros
well mint is just an ubuntu fork, isn't it?
it's ubuntu with a bunch of creature comforts
so not much different
except that mint doesn't look so ugly as ubuntu's default desktop env
if look and feel mattered, everyone would use Hannah Montana Linux
why not all 3?
best distro EVER
yeah I got mac on my macbooks (obviously), linux on all servers, and windows 11 (which sucks way more than windows 10) + mint on the desktop
and my router probably runs some BSD but I can't check that lol
got my mac for free basically, traded an old 3d printer for it
it's just an imac from 2015ish, nothing that great, just have it for testing c++ code
my newest mac is the first macbook pro that introcuded the touchbar. the touchbar is so useless lmao
I also had an iMac years ago but... then I wanted to play games again and yeah
it's one of the ones that's just a thicc monitor
MSFS2020 doesn't run that well with anything lower than an RTX2080
depends where you are and what you're flying
I have a friend with a 2080, still runs like shit for him too
A plane, duh
Mk so this is probably a really dumb question but Iโm new to this sorta thing:
I want to lower the time delay between each end crystal placement, for faster crystal pvp
Is the best way to detect the placement and respawn faster with the plugin?
What do I need to calculate to place panels only from row 27 - 35 in an inventory
what
Does anyone know how to make default explosions deal more damage?
for (int i = 27; i < 36; i++) {} ?
rip
How do I access the values of a map using reflections? I've never worked with them but I'm trying to get the bukkit commands
?xy
Asking about your attempted solution rather than your actual problem
use something i call "shape pattern"
declare a shape in a string
get its chars
check if the current char is equal what you want
set the item in the inventory based on the char index
That's a Field not a map
You have to actually get the map
But what are you trying to do here?
What's your end goal?
String shape = "#########" +
"#xxxxxxx#" +
"#########";
char[] chars = shape.toCharArray();
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if (c == '#')
inventory.setItem(i, BLACK_GLASS);
}```
Hm
because why
so
does it actually matter
yes
some server owners dont like to display their cracked plugins in /plugins
'cause we'd spend a lot less time doing support if we just didn't care about the plugins people made
in which case there's a permission
Map<String, Command> commandMap = (Map<String, Command>) bukkitKnownCommands.get(Bukkit.getPluginManager());```
why use permission if we can send a message saying "All of our plugins are custom!"
hMmMmMm
well then you can make a command, no reflection needed
Short answer: hiding all the commands from new users
short solution: permissions
Yeah you don't need to remove commands in order for them to not be shown
I'm not removing them
That's literally what you said you're trying to do
already did that
the other commands you listed are all hidden by default anyway
they cannot use or see commands they dont have permission for
They can see them in tab completion
taking away those two permissions will remove them completely for those users, including via /bukkit:version
not if you remove the permission
unless they are op
Why does it matter if they can see you have Bukkit anyway
we need to say that we use custom server software!
Clearly you didn't remove the permission
just use a permission plugin like luck perms
Have one
Because it 100% would not work without the permission
bukkit.commands.version
command isn't it?
"Discord Helper" ๐
๐
thinking about the dumb solution i had made for a server i was working on https://paste.md-5.net/imukotaduz.java
you know what. My apologies. I had revoked the "minecraft.command." and "bukkit.command." but forgot I cleared the permissions and forgot to revoke the "bukkit.command.*" again
Does anyone know how to make default explosions deal more damage?
Well there's an explode event isn't there
So just call the setter on that
Search docs for exolod
?jd
how can i set a permission to a command in my bungeecoord plugin?
val giveMessage = TranslatableComponent("commands.give.success")
val item = TranslatableComponent("item.swordDiamond.name")
item.color = ChatColor.GOLD
giveMessage.addWith(item)
giveMessage.addWith("32")
val username = TextComponent("Thinkofdeath")
username.color = ChatColor.AQUA
giveMessage.addWith(username)
sender.spigot().sendMessage(giveMessage)```
why does this work when sender is console, but not when sender is a player?
does the Chat Component API depend on BungeeCord?
No
in game I just get this
import net.md_5.bungee.api.ChatColor
import net.md_5.bungee.api.chat.TextComponent
import net.md_5.bungee.api.chat.TranslatableComponent```
these are my imports anyway
looks correct to me, according to the documentation on the website
?paste
anyone know why the command isnt spawning the entity? https://paste.md-5.net/nisumixore.java
Only one class can extend javaplugib
omg i thought i recognized md_5. ur the dude on spigotmc
anyway, I'm trying to get the config.yml, but I have a config embedded in my plugin. How do I get the config in the data folder, not the one embedded
wym?
the default config file can be gotten by calling getConfig() on your plugin
from your plugin's data directory
yea, thats what but in some spigot api page i found it says If there is a default config.yml embedded in this plugin, it will be provided as a default for this Configuration.
yes?
and i dont want the config embeded in the plugin, i want the one in the data folder
that's just default values for your plugin, that your plugin saves in it's data directory
but when you read from the config, it gets the one from the data directory
like this plugin for example
in onEnable() I call saveDefaultConifg(), which puts that config.yml file into the plugins data directory
does that override it tho?
it only saves if the file isn't already present afaik
ohhhh ok
@Override
public void saveDefaultConfig() {
if (!configFile.exists()) {
saveResource("config.yml", false);
}
}```
yeah, it saves if the file doesn't already exist
oh, you need to include the false
no
can i just ctrl+c v
this is the function definition for the function you're calling
no
saveDefaultConfig() is a function defined in JavaPlugin
which you're already extending
simply call the saveDefaultPlugin() in the onEnable()
?jd
public static ChatColor chatColorFromSkriptColor(Color color){
org.bukkit.Color col = color.asBukkitColor();
Bukkit.getServer().broadcastMessage(col + "hello");
if(col == org.bukkit.Color.AQUA) {
return ChatColor.AQUA;
}
}
I have a ton of else ifs below but I didn't want to spam. my last else is return null;. How am I supposed to compare that color?
what the hell are you doing
making a skript addon
and I'm trying to convert a skript color to a bukkit color and then to a chatcolor
this is all required because citizens requires it for glowcolor
I was debugging
is there a way to get the source of an explosion in an entity damage event
like which entity caused the explosion that damaged another entity
saveResource doesn't work even though it's in class Main extends JavaPlugin
so are you trying to get the TNT entity or the player that ignited the TNT?
the resource should be either in the resources folder or the root folder
weird circumstance i have since the player is actually the source of the explosion here, but i would be trying to get the player that caused the tnt to explode i guess @candid galleon
world.createExplosion(player.getLocation().add(0, 0.5, 0), 4f, false, false, player)
the parameters aren't the issue, it says there's no method saveResource
im trying to then later see how i could retrieve that player in another event
I'd probably save the location of the explosion and check if the damage reason is explosion
if it is, you can find which explosion was closest and go off that
what is the effective range of an explosion
depends on its power
pow blocks away in all directions?
watch this
I donโt think thereโs an easy formula
The entity's bounding box is divided into a [2รwidth+1] by [2รheight+1] by [2รdepth+1] grid of unequally spaced points.
A TNT explosion.
An explosion is a physical event, generally destructive, that can be caused by several different circumstances. It can destroy nearby blocks, propel and damage nearby players, entities, and their armor, and cause one or more fires under correct circumstances. Explosions produce a "shockwave" particle effect.
Multiple close...
1.3 * power/0.225 * 0.3
apparently
Huh, I stand corrected
hm?
How should I put color in my console prefix- the plugin.yml does not recognize ยงd as a color code
it's a string
"ยงd[yourplugin]" will print [yourplugin] in pink
you should not add ANY color codes in logs/console output
and why would you recommend that?
yes- i tried this, it doesn't work
you really really really should not do that
what about \u00A7d
Wonโt that like
because logs are text files. did you ever open a text file in an editor? they cannot display different colors. they aren't meant to do that
Destroy the color of the logging level
And just clutter my console with annoying colors
then it'll just show the character
warning for "yellow" output
and severe for "red" output
but you want your actual log files to be clean
and not be cluttered with ยงaThis is some green text
you're making it out to be more important than it is
the logger doesn'T care about MC color codes
No, I'm just sticking to the general unix convention, which is:
do ONE thing, and do that right
and in this case, the convetion is:
log files should contain INFORMATION
and nothing else
no uncessary colors etc
pog it worked @candid galleon
nice
how is that word spelled
unnecessary
unnecessary
thanks
log files should not contain any color codes
they really really really should not
Ok... But it's just that usually I find it a lot easier to look at console when it's color coded
then add color codes
it won't break your server
what an unneccessary amount of r's
wait fuck i still spelled it wrong
I'll try this... If it doesn't work then idk
you don't want any stupid things like colors in your logs
logs are meant to just tell you whatever is being logged
ah shit
I'm sure any reasonable person could see through two characters
had to delete the image, it had some stuff inside not meant be public
its a bit more jarring when its colored after every other character
well that's why you don't do every character haha
then just add your colors to your logs if you like, noone stops you from doing so
my point exactly
thank you sir
MY OPINION: logs are meant to be clean and only contain information that's relevant
whether you want to have something in green or purple or unicorn is not relevant
Most hosts just yeet color anyway
too late, i have already downloaded and saved your image and uploaded it to an untraceable darknet tor website
I donโt think color shows on my petro panel with bloom
Aye guys, I want to update the lore of an item with a cooldown timer. Is that something that is feasible / can handle client side somehow? Obv I can't be iterating through all inventories to find items and update em.
๐
since you're a color expert would you mind helping me with something?
Just keep reference to the item
.
and then update the lore each second? That seems inefficient. I was wondering if there was a way to get the clients to keep track of it on their end somehow
and just display it
this is how logfiles are supposed to look. no formatting, no fancy stuff, just information that'S needed. and noone needs colors there
Not without a mod on the client
Also- a quick question about item attributes... I'm 90% sure they are only supported in papermc... Which I do want to take advantage of, without ruining the plugin for spigot users... Does anyone know any workarounds/ways to disable the feature if it's spigot
Item Attributes are spigot
they're actually vanilla, with spigot having an API for them
Why does mythicmobs say they are only In paper?
this is literally the same screenshot as before
it might be inefficient if you have a billion players
Idk ask mythic mobs
what's your question?
ItemMeta has a whole bunch of methods for attributes
Ironically... I can't tell what the hell that means xD
and why do you think I'm a "color expert"? and what does that even mean lol
Hello there.
Does anyone know how to programming in Skript?
it's just a small excerpt of my webserver's log ^^
I think what im gonna do is not have the lore set each second but rather whenever they try to use the item before its cooldown is ready it will post a message to them in chat.
wut
Alright, thanks for the clarification. Should have done more research haha
Ask in their discord
you should go to their discord instead. this discord is about actually using the spigot api, not skripts api ๐
(Do they have a discord?)
but now that you're already here: think about just "FUCK SKRIPT" and do actual coding ๐
it's not even more complicated
i can't join to their discord lol
using actual java + spigot gives you 1000 times more possibilities
skript sucks and skript should have never be invented
(just my opinion)
python is totally fine for MANY things
ill take whatever ur using @tender shard that log looks so much more graceful than nginx lmao
the output I posted you mean?
what webserver r u using that it looks so much more graceful than nginx
I simply ran apache's log files through a tiny script I wrote to make it more readable
o
So just so I can get a little better understanding here. Where would the speed bottleneck be if I did decide to update the lore every second for a List of tracked items. I think the setting of ItemMetas as far as my server is concerned is just a bunch of setters, basically nothing. But then I imagine they have to recognize that them meta has changed and send a packet to the respective player to update that item on their end. Is there somewhere / someone I can read about performance deets?
what I posted is the output of this:
#!/bin/bash
EXT=""
if [[ "$1" == "yesterday" ]]; then
EXT=".1"
fi
cat /var/log/apache2/api.jeff-media.de-access.log$EXT | awk '{print $4 "\t" $1 "\t" $12 " " $13 " " $14 " " $15 " " $16 " " $17 " " $18 " " $19 " " $20}'
obviously you want to adjust the path and maybe the fields ($1, $2, etc...) ๐
I just wrote that SOME years ago to simply get all requests to my API
it's dirty and ugly but it gets the job done
cute api 
it's only used for update checks ๐
my actual api is located at api.jeff-media.com ๐
the update checker api at the .de domain is just a leftover from 2018
BTW
anyone here using nginx Proxy Manager?
I could need some help in setting it up
(I'd be willing to pay about ~20โฌ or sth)
so uhh, can someone help me with remapped spigot nms things?
I can ๐
are you using maven?
okay one second
read my blog post pls: https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/ @vestal dome
I know..
I just want to see if someone knows why this is like this, bc a tile Entity sign (SignBlockEntity.class) has 2 Component[] fields, which identify the "lines", and there's 2 components one with "messages" and the other one with "filteredMessages" and I want to know if someone knows what the "filteredMessages" mean.
ugh... what?
how can I make it more clear?
i thought you were talking about some field beig called "bc" lmao
bc it's 4:30 am and I have to go to bed..
so I just thought about asking this rather quick
bruh I'm quite drunk, please don't ask people whether they forgot your questions 1 minute after you posted it, otherwise noone will help you
ok I apologize.
no problem
but please, anyway
I would need some code
because you say "a tile Entity sign (SignBlockEntity.class) has 2 Component[] fields"
What are you doing with the NMS sign anyway
making it editable, and then the player can change the text of the sign again
you probably have some code that's not compiling, right?
What version
1.17
Ah, lame
no, I just want to uhh
1.18 got an API method for that
create a sign editing plugin, and I didn't do code, because I'm trying to understand what it means the filteredMessages and messages field.
I ask again: do you get ANY compiling errors? If not, please post the stack trace of your current code
They are asking about what a field does
No errors, no compiling involved at all
But Iโm not sure anyone here knows
well I tried looking at the minecraft wiki since sometimes they map these types of values and stuff....
I tried looking at the sign entity's code.....
result: got even more confused on why there's a second field for messages.
please answer my question: do you get any errors during compilation? or just "runtime" errors? or no erros at all?
Dude I'm not talking about coding, I'm talking about what a field in NMS's tile entity sign DOES, I'm not coding anything yet, I want to have this sorted out first.. and I am confused already about it.
yes you can or at least no one will sue you if you post it here
okay let's start again: what are you actually trying to do?
Why is it returning like this? https://imgur.com/MsHKJcF ```java
StringBuilder stringBuilder = new StringBuilder();
for (String rule : rules) {
stringBuilder.append(rule).append("\n");
sender.sendMessage(ChatUtil.color("&8&m-------------------------------"));
sender.sendMessage(ChatUtil.color(stringBuilder.toString()));
sender.sendMessage(ChatUtil.color("&8&m-------------------------------"));
}
what's the problem?
It's printing twice when its suppose to only print the bottom one
I'm trying to open a sign to edit for a player, but I want to know why is there 2 Arrays of components, one named "messages" and the other "filteredMessages", and they don't make any sense, because they don't have any difference, and I want to know if they have any difference OR not.
The one with 2 rules
its suppose to print that only
not sure why its printing the single one
seems like you're calling that whole code twice, or that your "rule" thing contais 2 strings instead of just one
It's only getting called once
it does contain 2 strings
This is how i'm storing them Lists.newArrayList(new String[] {"rule 1", "rule 2"}
then your "rules" var contains two Strings, so obviously your for { stuff } thing runs twice
What are you actually trying to do?
print out the rules that are stored in a config
okay
you want to do sth like this:
sender.sendMessage("========================");
for(String rule : rules) {
sender.sendMessage(rule);
}
sender.sendMessage("========================");
right?
show your current code please
?
How would I fix the getRank() method? cause i get this currently [18.12 22:10:36] [Server] [Async Chat Thread - #1/ERROR]: Could not pass event AsyncPlayerChatEvent to Kingdoms v1.0 [18.12 22:10:36] [Server] org.bukkit.event.EventExceptionnull [18.12 22:10:36] [Server] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487] [18.12 22:10:36] [Server] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487] [18.12 22:10:36] [Server] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) [spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487] [18.12 22:10:36] [Server] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) [spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487] [18.12 22:10:36] [Server] at net.minecraft.server.network.PlayerConnection.chat(PlayerConnection.java:1853) [spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487] [18.12 22:10:36] [Server] at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1787) [spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487] [18.12 22:10:36] [Server] at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1753) [spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487] [18.12 22:10:36] [Server] at net.minecraft.network.protocol.game.PacketPlayInChat$1.run(PacketPlayInChat.java:40) [spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487] [18.12 22:10:36] [Server] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] [18.12 22:10:36] [Server] at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?] [18.12 22:10:36] [Server] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?] [18.12 22:10:36] [Server] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?] [18.12 22:10:36] [Server] at java.lang.Thread.run(Thread.java:831) [?:?] [18.12 22:10:36] [Server] Caused byjava.lang.NullPointerException: Cannot invoke "games.kingdoms.kingdoms.Admin.ranks.PlayerHandler$Rank.getPrefix()" because "rank" is null [18.12 22:10:36] [Server] at games.kingdoms.kingdoms.Admin.ranks.Events.onPlayerChat(Events.java:36) ~[?:?] [18.12 22:10:36] [Server] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] [18.12 22:10:36] [Server] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] [18.12 22:10:36] [Server] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] [18.12 22:10:36] [Server] at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] [18.12 22:10:36] [Server] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487] [18.12 22:10:36] [Server] ... more
doing that would do something like ```
rule 1
rule 2
------```
cause i cant send any message whatsoever
no what I sent was exactly what you're looking for
or command
lol
lol?
I'm trying to do this https://imgur.com/Qh3a1n0
print them in the same thing
idk how to call it
fine
and ping when me from inside the thread ok
Lists
getRank()
Anyone got the tripple arrow symbol its like >>> but small
yea
Aww itโs so cute
Decimal: ⋙
Hex: ⋙```
what about double arrow?
hypothetically, what would be the best way of restoring a snapshot on a player? for example, in my plugin, I need to teleport a player back to a certain position when a snapshot was taken, but this wont happen on the event of a server crash (other things + teleporting). I'm thinking of making my own serializable file and just loading them when the server starts, restoring them and deleting them, but somehow that seems silly
does a PDC on a player get wiped when they die
no
then maybe u can use a pdc
oh, I'm using 1.8.8/1.8.9, I shouldve probably mentioned that
rip
big rip
ive been thinking of manually implementing a pdc thing for my plugins for 1.8 but for that I think I'd need to modify the server jar
you could also update to 1.14+
I need to stay on 1.8, that isn't really an option
ill just go with creating dat files to save it ig
"games.kingdoms.kingdoms.Admin.ranks.PlayerHandler$Rank.getPrefix()" because "rank" is null
bruh
How can I convert org.bukkit.Color to ChatColor?
what
what do you need clarified?
U just want to do ChatColor
I can't just do that
I have to convert it
because I'm getting it from somewhere and I can't control what's given (other than the org.bukkit.Color)
How would one clear the servers chat?
public static String translate(String message) {
return ChatColor.translateAlternateColorCodes('&', message);
}
god
no
that's not what I'm doing ๐ฉ
Yeah ik, but i guess this will help u
Spent yesterday working on some code for this. I got a quick implementation going using ProtocolLib and PacketWrapper.
THIS IS WORKING IN 1.7
I don't...
I'm getting an object from Skript which can be converted to org.bukkit.Color which I then need to convert to ChatColor so that I can use it for citizens glow color
(It solves ur thing)
how does that solve my problem
So I've been searching for how to change rgb to the closest ChatColor.
I've tried things with hex and got some weird colors, but not the closest ones....
Nvm
oh I see it now

I've just saw the guy having a similar question, i guess.
bump
spam the player's chat with blank messages
Any other more efficient way?
Yeah I have no clue how I would do this
basically
you can't directly convert a color to a chat color
so you could either check if the color has the same values as the chat color and return the corresponding color
okay okay hold on I can make this 40x easier on you guys
or find the color that is closest to the chat color
I have the following code...
public static ChatColor chatColorFromSkriptColor(Color color){
org.bukkit.Color col = color.asBukkitColor();
Bukkit.getServer().broadcastMessage(col + "hello" + "\n" + org.bukkit.Color.AQUA + "hello");
if(col == org.bukkit.Color.AQUA) {
return ChatColor.AQUA;
}
All I'm trying to do is match what's set in col to a color and then return a chatcolor based on that
but what's being broadcasted isn't even close to the colors
||and no I wasn't expecting it to color chat this was just for testing purposes||
this post specifically is what you probably want
it's the same one
again: there are only 16ish chat colors, so it's very unlikely for you to find an exact match
yeah, try reading it
okay but here's what I don't understand
Skript is able to convert their color and assign the correct color
but that method isn't doing the trick
how is skript displaying the color?
it can be anywhere
where do you need this color displayed?