#help-development
1 messages · Page 708 of 1
From a few hundered kilobytes in those big floppy disks to 1tb in a microSD
for loop or lambda, and why?
shape.forEach(e->world.spawnParticle(type,e,1));
for(Vector v : shape) world.spawnParticle(type,v,1);
Yea, custom plugins
yeah tx i ve found
k
is it a best plugin ?
was more asking along 'which is faster' lol
lambda for readability
for loop for performance
Yw, if tou news something else with IJ Let us know. Thank
That's a micro optimization
dont care
But the standard loop will be faster
Lambda >>>
pretty sure a for loop with one line of code is just as readable as a lambda
stream api generally slow af
just write basic code
no need to be fancy and use optionals and streams everywhere
they're useful in some cases
nah i dont say to avoid them
but in terms of performance they are worse
but ideally you shouldnt care
is there some bunch of 'this basically does the same but this is faster'
like i do remember that collection overwiew
i dont like @Nullable
also you can optimize optional tho
not really
most performance issues are stupidity
stream works great in other languages so
for what
just do it yourself
im specialized on performance and can tell you that it spikes on your performance
@echo basalt is your cubig arc ting just a complicated way of saying 'multiple chained beizer arcs'? i cant make heads or tails off your math
sorry to reask something, how can i see the workspaces files ?
yes
click on project on the left
tx
but again, not enough to care
👍
now i have intellij how can i start coding ?
i mean how can i downlaod spigot api
tx
s it only for minecraft plugins ?
of course, this is Spigot dev
okay
what plugin are you wanting to write?
but in the link u send me there is nothing about minecraft
? i dont udernstand
Spigot plugins are for Spigot Minecraft servers
but i have not downoad anything for intellij
do you know what maven is
must i downlaod spigot or not ?
no
what ??
stop jumping the gun
ok
but i m not english native ...
i dont really understand the tuto
there is not a french version ?
Sorry thats a you issue
yeah i know haha but i ve the time before become a really dev
im only 16
i learnt it in kindergarten
ive found a french tuto but it s for eclipse and not intellij
really ? youre lucky
lower is better, broadly speaking they're basically the same in terms of throughput, ever so slightly slower but it is not going to be the cause your plugin decimates the server unless you are using them in really hot spots
Kotlin collections not feeling too good on the big collections
what?
how do i spawn a dust transition particle
hey what must i change in the pom.xml file ?
first is Particle
dust shit comes later
yeah well, they are the opposite of streams, each operation is evaluated eagerly, so something like list.map(idk).filter(idk).map() will create a new collection for the first map, then a new collection for the filter, then a new collection for the last map, you can see how that isn't great on large collections with many operations
bUt ClEaN 💀
@echo basalt apologies for annoying you again but do you by chance know why putting this through your code only results in a three-quarter circle?
List.of(
new Vector(0,0,1),
new Vector(1,0,0),
new Vector(0,0,-1),
new Vector(-1,0,0),
new Vector(0,0,1)
)
You could try replacing the i += 3 to i++ in the cubic bezier method
that aint it chief
its a parabola now
what is the best way te safely restart server with plugin?
Plugin that restarts the server ? Seems a bit odd
why?
What's it for?
i need to make autorestarts every 6 hours for my server with info for players, like after 5 min server will be restarted
start the server with a looping script. Call system.exit in ur plugin
Go to the church and ask God to forgive you
no
me when Bukkit.shutdown exists
Who here is good with Gradle?
alex
lol yeah just have a looping start script and use Bukkit.shutdown
Or you can make use of the restart script but meh, looping start is easier
whats necssecery for a good authentication plugin?
I'm getting this error when I try to build a plugin I'm changing something in
:classes
\--- :compileJava
\--- :jar
\--- :classes (*)```
Multiple hashing methods
Security
you are using multi module?
The problem is most likely in the build.gradle, but I don't know
I did it already with jBCrypt library
which methods?
@proven jay
#pw(password, genSalt())
I don't know what that is
final String hashedPassword = BCrypt.hashpw(password, BCrypt.gensalt());
its not enough?
This (https://hastebin.com/share/voqidimumu.typescript) is my build.gradle
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
how many modules you got
which hashes does your auth support
I'm adding an addition into the WildLoaders plugin
md5, sha256 and ...
i don't know
Well support multiple hashing methods like sha256 and md5
you know what a module is?
I don't use Gradle
a module exist in maven too
Isn't md5 outdated
can you give me a toturial or something?
I use Maven, but the plugin I'm editing uses Gradle
That’s bcrypt lol
I hope you’re not suggesting md5 for passwords
thats bad?
No bcrypt is good
i suggest sha256
Do you see a problem in the build.gradle above?
you shouldn't generate a new salt for every single time you want to hash a password, but rather generate one for each user and store it, then use that every time you want to get the user's password hash
What you modified
whats better?
sha512
I use bcrypt
Go big or go home
I added this
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.20.1-R0.1-SNAPSHOT")
compileOnly project(":API")
compileOnly rootProject
}```
```if (project.hasProperty('nms.compile_v1_20') && !Boolean.valueOf(project.findProperty("nms.compile_v1_20").toString())) {
project.tasks.all { task -> task.enabled = false }
}```
You are circulating depends
i mean, that jar task configuration is stinky af
search the error
No duh lol
That's what the error says
I don't know how to fix it lol
search it
I have
And that's why I'm here
Because I don't know how to fix it
It's using Gradle
?whereami
i mean it isn't anything to do with paper specifically, that gradle script makes me wanna unalive
Do you know how to fix it?
@proven jay circulating depends means that Task A depends on Task B, and Task B depends on Task A creating a cycle
you need to restructure your build script
so they both dont depend on each other
I know what it means and I've tried to move somethings around in it, but I get the same problem in it
Do you know what do I have to move around in it?
compileOnly project(":API")
you added this right?
Yes
i guess the rootProject
has the same issue too
you need to restructure your code too i guess
Do I remove this too in it?
md5 is not secure
poor md5
:( why booly md5
Small recompense for Material being allowed to live for so long 🤣
because it's a reserved name
so what do it do?
i want a package named enum
:(
Just name it enums if you want it to be called that
enum is a keyword so you can't use it
good suggestion
In java source code that is. Just write an ASM Transformer in your gradle buildscript to have enum in the bytecode. In the source code you can then use something like p015268b in the meantime
because package names are hierarchical identifiers, § 6 JSL, and identifiers (§ 3.8 JSL) cannot be keywords, § 3.9 JSL
and enum is a keyword as of java 1.5+
i understand
there is little sense to have a package for enums anyway
but all of my packages are singular named
I mean you also don't have one for "classes" or "interfaces" and for "abstract classes" or "records" right?
so why is there one for enums
i want everything to be orgnaized
im very neat
what is the purpose of having a separate package only for enum classes
Best to organize by concept, not by types
have any of you already integrated websocket react to link a site to a minecraft server?
those are words
you mean connecting a plugin to the web server or ..?
the most popular example of doing that with ws is probably a discord bot
but like for discord you're most likely gonna use a library than handle the connection yourself
another dev has developed a plugin to set up a websocket server on the game side, and I have to connect to it on the web side to retrieve IG data in real time
but I can't find a tutorial that explains how to establish the react connection
It's just like any websocket connection
You don't have to find a Minecraft specific tutorial
i'm not looking for a minecraft tuto i'm looking for an understandable react websocket tuto
How do i set a skull in the center of a end portal frame in 1.8?
I've never used websocket
Is overflow considered a feature or a bug?
I'm considering doing int = 1 i ++ if int = 0 return
Donate via PayPal - https://www.paypal.me/thenetninja
Donate via Patreon - https://www.patreon.com/thenetninja
----- COURSE LINKS:
- Repo - https://github.com/iamshaunjp/websockets-playlist
- Atom editor - https://atom.io/a
- Download Node - https://nodejs.org/en/
- Socket.io - https://socket.io
-------------------------------------------------...
Learn the fundamentals of WebSockets in 100 seconds, then build a simple group chat app with Socket.io. https://fireship.io
Sponsor me on Github for $1.00 https://github.com/codediodeio
Source Code https://github.com/fireship-io/socketio-minimal-demo.git
- WebSockets https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
- socket.io htt...
anyone?
like the skull and the frame occupying the same space? invisible armor stands
and for the Java side you can use Javalin: https://javalin.io/documentation#websockets
feat
- Get the center location
- Set the block to SKULL
- ???
- Profit
Ye
guys, i need mathematical help since my brain sucks ass atm
public static long convertDurationToMs(String durationString) {
if ("permanent".equalsIgnoreCase(durationString)) {
return -1;
}
long milliseconds = 0;
Pattern pattern = Pattern.compile("(\\d+)\\s*(\\w+)");
Matcher matcher = pattern.matcher(durationString);
while (matcher.find()) {
int value = Integer.parseInt(matcher.group(1));
String unit = matcher.group(2).toLowerCase();
switch (unit) {
case "y":
case "year":
case "years":
milliseconds += TimeUnit.DAYS.toMillis((long) 365 * value);
break;
case "m":
case "month":
case "months":
milliseconds += TimeUnit.DAYS.toMillis(30L * value);
break;
case "d":
case "day":
case "days":
milliseconds += TimeUnit.DAYS.toMillis(value);
break;
case "h":
case "hour":
case "hours":
milliseconds += TimeUnit.HOURS.toMillis(value);
break;
case "s":
case "second":
case "seconds":
milliseconds += TimeUnit.SECONDS.toMillis(value);
break;
default:
throw new IllegalArgumentException("Invalid time unit: " + unit);
}
}
return milliseconds;
}```
I use this to convert the value "1y" to milliseconds
```java
public static String calculateTimeLeft(long timeLeftMs) {
if (timeLeftMs == -1) {
return "Permanent";
}
if (timeLeftMs < 1000) { // Less than a second
return "Now";
}
long years = TimeUnit.MILLISECONDS.toDays(timeLeftMs) / 365;
long months = (TimeUnit.MILLISECONDS.toDays(timeLeftMs) % 365) / 30;
long days = TimeUnit.MILLISECONDS.toDays(timeLeftMs) % 30;
long hours = TimeUnit.MILLISECONDS.toHours(timeLeftMs) % 24;
long minutes = TimeUnit.MILLISECONDS.toMinutes(timeLeftMs) % 60;
long seconds = TimeUnit.MILLISECONDS.toSeconds(timeLeftMs) % 60;
StringBuilder result = new StringBuilder();
if (years > 0) {
result.append(years).append(" year");
if (years > 1) {
result.append("s");
}
}
if (months > 0) {
if (!result.toString().isEmpty()) {
result.append(", ");
}
result.append(months).append(" month");
if (months > 1) {
result.append("s");
}
}
if (days > 0) {
if (!result.toString().isEmpty()) {
result.append(", ");
}
result.append(days).append(" day");
if (days > 1) {
result.append("s");
}
}
if (hours > 0) {
if (!result.toString().isEmpty()) {
result.append(", ");
}
result.append(hours).append(" hour");
if (hours > 1) {
result.append("s");
}
}
if (minutes > 0) {
if (!result.toString().isEmpty()) {
result.append(", ");
}
result.append(minutes).append(" minute");
if (minutes > 1) {
result.append("s");
}
}
if (seconds > 0) {
if (!result.toString().isEmpty()) {
result.append(", ");
}
result.append(seconds).append(" second");
if (seconds > 1) {
result.append("s");
}
}
return result.toString();
}```
And im using this to make it return back "1 year" but instead it returns "1 year, 5 days"
do you know what could have caused it?
because you don't return after the years part?
wdym
I mean, you don't return after the "if(years > 0)" part and hence obviously it does the following logic too
better idea? xd
DateTimeFormatter lol
I'm trying to add custom tag to item but there is an error
DateTimeFormatter? wait let me GOOGLE DAT
i can't understand how to solve it
basically the constructor of that class is private
so u cant invoke/call it
valueOf
But how to do it
why does my IJ freeze when i try to f4 Material?
lmao material enum?
I need help
disable auto decompiler in IJ
i mean that class isnt that big
- Get the center location
- Set the block to SKULL
- ???
- Profit
maybe go to stash instead and look there
isnt the stash just a bunch of patches?
not for the material enum
the api source is still there
It's part of bukkit
and material enum is api
Make sure to update your IDE. There where some versions which had problems with large enums
material isnt an enum anymore though
*Decompiled ones
wait it still is
mhm

for now ™️
Any eclipse + gradle fanatics out there? Probably not as this is a ridiculous combination, but I'll ask anyways: How do I make the gradle classpath container modular? That is how can I have following piece of code in my .classpath:
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
Doing
eclipse {
classpath {
file {
whenMerged {
entries.each {
if (it.kind == 'con') {
it.entryAttributes['module'] = 'true'
}
}
}
}
}
}
only marks the JRE as modular, but not the gradle classpath.
fun fact
you can middle click instead of f4
Lets see if we have any masochists here
What’s the Item name for an Netherite Chefplaner with prot 4 and mending in shopguiplus
Chefplaner? You mean Chestplate?
Yeah
I mean... you can always just edit the .classpath file if thats fine for you
I could, at which point I could just get rid of my Java 9 source set which is probably the better approach
or ctrl+b/cmd+b
no clue why the default settings have 3 buttons for one thing
I need help.
i have this function:
List<String> lines = plugin.getConfig().getStringList("scoreboard.fields");
int size = lines.size()+1;
for (String linestring : lines) {
size--;
objective.getScore(plugin.getKotlUtils().translate(linestring, plugin)).setScore(size);
}
but the empty strings are not showed in sb.
how can I fix it?
here the translate function:
public String translate(String message, KOTL plugin) {
Pattern pattern = Pattern.compile("#[a-fA-F0-9]{6}");
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
String color = message.substring(matcher.start(), matcher.end());
message = message.replace(color, net.md_5.bungee.api.ChatColor.of(color) + "");
matcher = pattern.matcher(message);
}
return ChatColor.translateAlternateColorCodes('&', message);
}
Attributes?
maximum hearts or health?
ok
concretely whats the probleme ?
https://paste.md-5.net/jejajifase.java - do you think it will do for rank api?
what should be in the config so config.getColor wont return null
a serialized color
wow i didnt know that!!!!
how should it be
how is a serialized color
is there a way to get the color object with the name?
only with reflection
idk I'd just write something like this, then keep it around somewhere
/**
* A simple cache to access class constants by name for "pseudo-enums" like {@link org.bukkit.Color}
* @param <T> The type of the constants
*/
public class PseudoEnum<T> {
@NotNull
private final Map<@NotNull String, @NotNull T> elements;
private PseudoEnum(@NotNull Map<@NotNull String, @NotNull T> elements) {
this.elements = elements;
}
/**
* Creates a new {@link PseudoEnum} for the given class
* @param clazz The class
* @return The {@link PseudoEnum}
* @param <T> The type of the constants
*/
@SuppressWarnings("unchecked")
@NotNull
public static <T> PseudoEnum<T> of(@NotNull final Class<T> clazz) {
notNull(clazz, "clazz");
final Map<String,T> elements = new HashMap<>();
for (Field field : clazz.getDeclaredFields()) {
if (clazz.isAssignableFrom(field.getType())) {
if (Modifier.isStatic(field.getModifiers())
&& Modifier.isPublic(field.getModifiers())) {
try {
final String name = field.getName();
T element = (T) field.get(null);
if(element != null) {
elements.put(name,element);
}
} catch (ReflectiveOperationException exception) {
throw new RuntimeException(exception);
}
}
}
}
return new PseudoEnum<>(Collections.unmodifiableMap(elements));
}
/**
* Returns the constant with the given name or null if it doesn't exist
* @param name The name
* @return The constant or null
*/
@Nullable
public T valueOf(@NotNull String name) {
notNull(name, "name");
return elements.get(name);
}
/**
* Returns an unmodifiable map of all constants
* @return The map
*/
@NotNull
public Map<@NotNull String, @NotNull T> getElements() {
return elements;
}
}
yeah it works fine
bump
doesnt seem to be as helpful
bump
how to get name of the barrel/chest/other using InventoryOpenEvent?
how would it do the logic? what if its 1 year 5months?
that doesnt make sense
im just trying with 1 year
if i enter 5 years it gives me 5years 25 days
getInventory() -> getHolder()
and how to get name of the barrel using this?
declaration: package: org.bukkit, interface: Nameable
Sorry i can't understand how to connect inventoryHolder and Nameable
cool
but a question
armor-color:
RED: 0
GREEN: 0
BLUE: 0
shouldnt this work ?
(alpha is not here in 1.12.2)
you check if it's isntanceof Nameable
or just directly check if the inventoryholder is a barrel or container (which both extend Nameable)
InventoryHolder could be instanceof Nameable???
I need help
sure
every Container is Nameable
Where did you get it???
intellij
how to do it??
Oh thanks! I didn't know about that
intellij ultimate feature
let's suppose I have a class with a Map<String,T> and this class implements Iterable<Constant<T>> where Constant is just a class that has a name() and a value().
Which would be better, returning a new Iterator() { ... } or just return a stream().map(...).iterator() of the underlying map? In this example, I'm using a new Iterator for the Iterator and the mapped stream for the spliterator, I wonder which is smarter/better?
@NotNull
@Override
public Iterator<Constant<T>> iterator() {
return new Iterator<Constant<T>>() {
private final Iterator<Map.Entry<String, T>> iterator = elements.entrySet().iterator();
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public Constant<T> next() {
final Map.Entry<String, T> entry = iterator.next();
return Constant.<T>of(entry.getKey(), entry.getValue());
}
};
}
@Override
public Spliterator<Constant<T>> spliterator() {
return elements.entrySet().stream().map(entry -> Constant.<T>of(entry.getKey(), entry.getValue())).spliterator();
}
@tender shard
armor-color:
RED: 0
GREEN: 0
BLUE: 0
why this is still null
(alpha doesnt exist)
Color
org.bukkit.Color
bukkit conifg serialization, saves a value with the class it gets serialized as, eg for item stack it looks like this
it uses ==: org.bukkit.inventory.ItemStack to use that to deserialize it
without it, its just a map<String, Object>
==: org.bukkit.Color
if thats its path yeah
that's not a valid serialized color, it's missing the SERIALIZED_TYPE value
why don't you just write your own method to get RGB and turn that into a color
public static Color ofSection(ConfigurationSection section) {
return Color.fromRGB(section.getInt("RED"), section.getInt("GREEN"), section.getInt("BLUE"));
}
a : in the key?
using mockbukkit?
nop
then print out get("pdc").getClass()
this is a config section, so its not that
without "cool:key": 0b it won;t be a valid entry
this souts true on isConfigurationSetion
its a map for some reason
tf
this probably explains it
i would've thought that would just become a config section
if it says it's a map that means you only just inserted it and have not save/load
serializing PDC is nasty btw, why don't you use my PDC serializer? https://github.com/mfnalex/PersistentDataSerializer
whats the format look like
When using set to insert a Map into a config it does not get converted to a ConfigurationSection until it's saved/loaded
hello something can help with ((CraftWorld)b.getWorld()).getHandle().playBlockAction(new BlockPosition(b.getX(), b.getY(), b.getZ()), CraftMagicNumbers.getBlock((MaterialData) b), 1, this.open ? 0 : 1);
but its been saved, the write is setting it then its saved directly after and ive restarted a few times too
pdc:
- key: "myplugin:somekey"
type: BYTE
value: 1
- key: "myplugin:something_else"
type: TAG_CONTAINER_ARRAY
value:
- key: "myplugin:something_else2"
type: TAG_CONTAINER
value:
- key: ...
it can't be a Map if it's been saved/reloaded. It would be a MemorySection
ah, works for me
it's basically a list of maps, or json
no more nms, for this atleast 
guys quick question why tf when i set the spawn location of a player in PlayerSpawnLocationEvent (1.12.2)
the player gets hardcore hearts?
alex ur docs are outdated
ok what i've asked is probably a ?whereami situation
Guys what happens to a thread when it's not stored anywhere
its still saying #fromMapList(context, map) while its #fromMapList(map, context)
how to get block of inventory?
how do i put the container back on the item
Oops
You manually gotta loop and set. Or use CustomBlockData#copy
Its a static method there
how do i loop over a pdc container values, it only has key set
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
but its not a block
Check out the static copy method ^
Its static
Unrelated to blocks
You can use it or copy it
mfnalex
oh it takes a block. well but you can see the logic and copy that lol
You set the message to include the player name
Ideally you'd use the message format. By default the message format is <%s> %s, so if you want your message to look like the one you have, you probably want your format to look like yourRankInfo &f%s: %s
String rank = rank.getRankData().getColor() + rank.getRankData().getName();
event.setFormat(TextUtil.getColorText(rank + " &f%s: %s"));```
That's probably what you want
oh thenks
private static final PersistentDataType<?, ?>[] PRIMITIVE_DATA_TYPES = new PersistentDataType<?, ?>[]{
PersistentDataType.BYTE,
PersistentDataType.SHORT,
PersistentDataType.INTEGER,
PersistentDataType.LONG,
PersistentDataType.FLOAT,
PersistentDataType.DOUBLE,
PersistentDataType.STRING,
PersistentDataType.BYTE_ARRAY,
PersistentDataType.INTEGER_ARRAY,
PersistentDataType.LONG_ARRAY,
PersistentDataType.TAG_CONTAINER_ARRAY,
PersistentDataType.TAG_CONTAINER};
public static PersistentDataType<?, ?> getDataType(PersistentDataContainer pdc, NamespacedKey key) {
for (PersistentDataType<?, ?> dataType : PRIMITIVE_DATA_TYPES) {
if (pdc.has(key, dataType)) return dataType;
}
return null;
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static void copyFromTo(PersistentDataContainer source, PersistentDataContainer target) {
source.getKeys().forEach(key -> {
PersistentDataType dataType = getDataType(source, key);
if (dataType == null) return;
target.set(key, dataType, Objects.requireNonNull(source.get(key, dataType)));
});
}
The first %s is the player's display name, the second one is the message. It's just a formatted string
too complicated choco :(:(
no u
what the %f
wh
and i need to get this barrel
I put &f because you had a white colour in your original string. You can edit that if you'd like
That's all I was doing there was using a text color
BlockInventoryHolder#getBlock()
oh yes
thx
always useful to check the diagrams for stuff like this ^
What's TextDisplay?
it's a text display
like a hologram with text
es
funi
displays are like an invisible armor stand without the armor stand + extra features
Can I make it rotate for each player? Or I would have to setup a customName for that?
you can use a Billboard e.g. to make it always face each player
For example Billboard#CENTER?
yes
Uhm
Very, very interesting
Guess it's time to make my plugins only work for +1.19
displays were added in 1.19.4 btw
anyone know how i can change the archive name on build time, i want a dynamically changing version lol
(in gradle)
in the jar task you can change basically anything
archiveFileName is the exact filename
otherwise there's appendix, which is added between basename and classifier/version
this code looks crazy!! 😮
eg like this
tasks.jar {
val currentDate = Date()
val dateFormat = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss")
archiveAppendix.set(dateFormat.format(currentDate))
}
then youd have myproject-2023-09-05-21-32-07-1.0-SNAPSHOT.jar
you could also just use archiveFilename.set("myproject-" + version + "-" + myTimestamp + ".jar") or whatever
no, that's IJ's builtin diagram feature
right click on any class name -> diagrams
some say it's only available in IJ ultimate, idk
more fancy version to get the data types
private static final PersistentDataType<?, ?>[] PRIMITIVE_DATA_TYPES = ConstantsCache.of(PersistentDataType.class)
.getElements()
.values()
.stream()
.filter(type -> type instanceof PersistentDataType.PrimitivePersistentDataType)
.toArray(PersistentDataType<?, ?>[]::new);
in case they ever add new primitive types lmao
me 😵
i dont think it works tho
i have this
tasks.jar {
val currentDate = Date()
val dateFormat = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss")
archiveAppendix.set(dateFormat.format(currentDate))
println("Archives name: ${this.archiveFileName.get()}")
}```
however it doesnt actually change the file name
man if you told me this was java when i started out
i wouldn't believe you
it is insane
Are you using shadow?
uh
If so you‘d have to change it in the shadow task
Otherwise paste your whole build file
val currentDate = Date()
val dateFormat = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss")
tasks.withType<AbstractArchiveTask>().configureEach {
archiveAppendix.set(dateFormat.format(currentDate))
}``` works lol
disgusting
the much more disgusting thing is that they chose to set the archive name for every single archive task instead of the one they need lol
What's that language btw? Is it kotlin?
yeah
gradle kotlin dsl
Ugh
Ugly
no you
why kotlin?
yeah kotlin really is ugly, I agree
also whats so ugly?
well im just discussed u used SDF
but kotlin dsl is better than groovy dsl at least
which is all that matters
because it has proper types
groovy is dynamic typed
yeah that sucks
gross
wdym?
ever seen the groovy runtime?
I don't like kotlin myself but it's definitely better than groovy
i love kotlin
anyone remember this person here who used make instead of maven or gradle?
make
for java
No, I'm writing minecraft
AssemblyCraft
My idea still exists
I can tell you.
it's a long list of imports
Just finding someone to make it
there is many ideas
like using magic, but who is gonna do it tho
If I manage to learn assembly, I swear, I will make a playable version of minecraft
Now hopefully, I won't never learn assembly
i mean it has prob alr been done, tho Id assume not fully
https://github.com/Overv/MineAssemble
twitter: @sahajsarup
Instagram: @ric_96
My Gaming Channel: https://www.youtube.com/channel/UC9ybuwuWuMGnEzDLH3Qc77A
blog: geektillithertz.com/wordpress
Is there any good way to update the items in an invetory for the player on a different thread?
You don't want to do things asynchronously
Not on bukkit
Even when I create the Inventory object in that thread client still doesn't see
you need to first learn how memory at all works and then learn cpu, like how it handles shit, and then you can learn architecture like x86 or arm64 or any other architecture you want
I know how CPU works
And ram
Like, it's pretty easy tho
learn memory then
Maybe a bit confusing at the first? But is still easy
I do know
I mean, the only thing its stopping me from doing it, is that assembly works directly with memory
ok now learn whole math to operate on raw pointers https://cdn.discordapp.com/emojis/1045365302516518962.webp?size=48&name=Peblo&quality=lossless
And for so, I must write everything by myself
Which is like, bruh
Yeah, no
but it is sooooo fun learning how matrix works
This gives me some Roller Coaster Tycoon 2 vibes
and then making it work on memory pointers in assembly
No, I already discarded the idea, it already exists 😔
also assembly is kinda the simplest language you can get imo, it just list of instractions which goes up to down, and jump and shit
It's not simple, but native, like, it's the "most close" language to the hardware
why is there ThreadLocalRandom#nextBoolean() but not previousBoolean()? What if I forget the last "next" boolean
oh no
should have saved it
Then go to your doctor and ask him a receipt for alzheimer
for alzheimer, or against alzheimer?
wtf is going on in general btw?
both 🗿
?paste
I get a Operation not allowed after ResultSet closed on this code https://paste.md-5.net/iselanokup.java
the result set is closed before the runnable runs
Yeah ik why just dont know how to fix it
alright thx
yeah, open the resultset with winrar
💀
TRUE
premium, free or free with pay for me notifs removeds
i wonder how many ppl actually pay for winrar
corps
cant be more than 1% of users
imagine paying 30€ for winrar to extract the cracked MC version you downloaded
real
i decided to remove the premium scream bc i was bored
i didnt pay for it either
glad my language doesn't have gender like germen
@worldly ingot what gender is discord in france
mfnalex can approve germen have gender
Idk. But the actual adjective (noun?) is probably “discorde” which would be feminine
It’s discordance. So yeah, I’d say feminine most likely
femboys can be programmers
with there programmer socks
choco do you have programmer socks
i bet
choco seems like the person to have a maid outfit too
I mean I have socks. I am a programmer. So by definition…
thigh highs are real programmer socks
No thigh highs but I’d bet they’re comfy af
@young knoll buy choco some thigh highs for christmas
yeah I got a ton of those
got the meme from vedal987 stream
Wtf did I just walk into XD
What the fuck is programming socks
new villager change
not suprising at all
chat teasing him with tellin him... he is a femboy
Who
Because they're slave
all they do is breed, eat, sleep and trade
probably realism or something
wonder how long itl take before someone makes a jar to undo all these changes
they could add more life to villagers
the reverse mod 🙂
like give them functional hands?
sure if they dont have fingers
but just pixels art
Imagine dying by a villager
i mean like a server jar so people could still use plugins
i have seen pillager to villager texture pack
so you trade with pillagers lmao
When you are new to a group, sometimes it's hard to fit in. New-to-Linux users often find that it is hard for them to fit in with longtime Linux users. So here are some tips on how you can start acting like a longtime Linux user...so you can fit in.
MUSIC :
► Adrift by ELPHNT (from YouTube Audio Library)
IMAGES:
► https://en.wikipedia.org/wi...
So basically a delayed method call?
yeah but i can't replace bukkit Runnable with method
Lambdas and Method references can be used to make your code way shorter, and (sometimes) more readable by getting rid of anonymous classes. What are Anonymous Classes? Anonymous classes are like local classes without a name. Imagine you have the following code: We hereby declare and instantiate a class implementing java.lang.Runnable that just p...
you can also use an anonymous class or directly extend Runnable
it's all the same, more or less
oh ok
anonymous classes look icky
Ur blog has everything
lets make alexs blog the new forums
not sure about forums
but it could be used as the place for tutorials or more info
be cool if some of us here created articles for the blog too 🙂
sure, if someone wants to write a post, just send it to me
nevermind. I stared at the code long enough and found the solution. It's literally just containers 'org.eclipse.buildship.core.gradleclasspathcontainer' in eclipse.classpath {}
bump
I'm trying to get barrel block using it's inventory but i have problems with it, when i'm trying to do like
BlockInventoryHolder barrelBlockHolder = (BlockInventoryHolder) event.getInventory().getHolder();
Barrel barrel = (Barrel) barrelBlockHolder.getBlock();
but i'm getting an error
class org.bukkit.craftbukkit.v1_19_R3.block.CraftBlock cannot be cast to class org.bukkit.block.Barrel
i think you should get the block state
But how???
Barrel b = (Barrel) Block.GetState();
I don't have block i have only inventory event.getInventory()
yes you do
doenst barrelBlockHolder.getBlock() returns the block?
oh
yeah
oh god i can't do this, all this time i'm trying to get when player adds an item to barrel
but how
i cannn't
How in Brewery it works???
Wtf i was scrolling from up and just saw a bunch of guys in skirts and knee sock pics...
programmer socks
you better have yours on
InventoryInteractEvent
Hmm i will try it tomorrow thx
What does this event do?
listens to inventory drag / click event
i did simple test
public class events implements Listener {
private WarCustomItems plugin;
public events (WarCustomItems plugin){
this.plugin = plugin;
}
@EventHandler
public void onBarrelClick(InventoryInteractEvent event){
System.out.println("A");
}
public final class WarCustomItems extends JavaPlugin {
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(new events(this), this);
}
But nothing happened
something strange is going on
oh lol
InventoryInteractEvent is abstract class
._.
i still don't know how to track adding items to the barrel
I tried to use InventoryClickEvent
But i couldn't do this
Because of swap item, on swap item action i can't change the item in cursor
And because of removing item
I need to track removing item too
Oh shit it too hard for me
Its abstract class ._.
I need help.
i have this function:
List<String> lines = plugin.getConfig().getStringList("scoreboard.fields");
int size = lines.size()+1;
for (String linestring : lines) {
size--;
objective.getScore(plugin.getKotlUtils().translate(linestring, plugin)).setScore(size);
}
but the empty strings are not showed in sb.
how can I fix it?
here the translate function:
public String translate(String message, KOTL plugin) {
Pattern pattern = Pattern.compile("#[a-fA-F0-9]{6}");
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
String color = message.substring(matcher.start(), matcher.end());
message = message.replace(color, net.md_5.bungee.api.ChatColor.of(color) + "");
matcher = pattern.matcher(message);
}
return ChatColor.translateAlternateColorCodes('&', message);
}
InventoryClickEvent and InventoryDragEvent
https://paste.md-5.net/iyimutenog.java
Here's a simple helper class that handles scoreboards
SimpleBoard board = new SimpleBoard();
board.display(player);
board.displayList(List.of(
"One"
"Two"
" "
"Three!"
));
gl have fun
I tried, and i can track adding item to the barrel, but i need to track removing item from barrel and chang the item, but if action is swap items i can't change item in cursor
keep track of the block then
Like what??
map or something
No. Intellij is a development environment for mainly java projects.
It can be used for any type of java project, not just spigot.
But if I am doing a spigot project
For a plug-in would I need it?
No you can also write spigot plugins in notepad if you feel like it.
You dont need intellij for spigot or java development
You mean notes?
I feel like you mean something else
what version of netty does minecraft use?
you can even write a spigot plugin using emacs
But if I used IntelliJ to make a spigot plug-in would I need the spigot api?
Anyone know any resources to make more complicated particles?
Depends on the version of Minecraft....
Anyone knows cocoa's material block name? I tried using COCOA COCOA_SEEDS COCOA_TREE COCOAPLANT, so my plugin prevents you from breaking or placing Cocoa without a permission.
For COCOA_SEEDS, cocoa placement prevention works, but the break event doesn't.
COCOA_BEANS is the item. and COCOA is the block
how can you have tried "COCOAPLANT" and or "COCOA_TREE" or "COCOA_SEEDS"? That wouldn'T even compile?
why didnt you just look at the javadocs
COCOA is working now properly, and I stupidly forgot to reload my plugin.
🤦
Thank you
why when i tried to prefix the player name it doesn't show up in the game
you gotta do it with a scoreboard team
this tutorial dont think so https://www.spigotmc.org/wiki/how-to-make-custom-rank-system/ lol
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
this will not worked
player.setDisplayName(prefix.get(rank) + player.getName());
player.setPlayerListName(prefix.get(rank) + player.getName());
?
what is the way to go about when "respawning an entity"
i want to remove an entity and make it appear later on from gui
alot of mns?
storing its metadata and spawning the same type with the same data
so not exactly respawning but removing the old and spawning a new
pr it
what options is there?
to store the entities relevant data and apply it to the new one?
what do you need nms for
i see
its only the health, name, effects or shit
i want all the info
for pets and animals + monsters
then you know what you gotta do
copy entity data?
and I spent a whole day on this
I m tring to make a custom item plugin and I have a question can I store 2 different keys in the same item's PersistentDataContainer
i think i will do that
thank you so much!!
yes
I don't know if I m stupid or not because I ve spent more than 4 hours trying to store a second key and I get only null value for the second value
While the first works
ItemStack item = CustomItemManager.getCustomItemById("test").toItemStack().clone();
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName("worked
");
PersistentDataContainer pdc = itemMeta.getPersistentDataContainer();
pdc.set(new NamespacedKey(Plugin.getPlugin(Plugin.class), "test2"), PersistentDataType.STRING, "test");
item.setItemMeta(itemMeta);
player.getInventory().addItem(item);
I get the item it works, but when I try to get the pdc I get only null
When I get the custom item it already has a pdc key (ItemStack item = CustomItemManager.getCustomItemById("test").toItemStack().clone();)
How do you read the PDC
itemStack.getItemMeta().getPersistentDataContainer().get(new NamespacedKey(Plugin.getPlugin(Plugin.class), "test2"), PersistentDataType.STRING)
Well, quick check would be holding the item in game and running /data get entity @s SelectedItem
(I think)
to print the SNBT of the item
wait
but generally, if I had to guess, your itemStack when you read is just wrong
I checked it like 50 times and I rewrote it 4 times
I mean, the PDC certainly works with multiple keys 😅
so something is wrong in your code
the write to the PDC looks fine, so I presume your read logic is incorrect somewhere
you are right the second key is stored
but for some reason I only get the first one
well, share the read logic
like, the context around the read
where does itemStack come from
I think there's a problem with my listener
yea, hence why I asked for its code 😅
I think I fixed
I deleted this line and rewrote them and is work
if (pdc.has(new NamespacedKey(Plugin.getPlugin(Plugin.class), "test2"), PersistentDataType.STRING)) {
If I want to register a FurnaceRecipe I have the choice between RecipeChoice.ExactChoice or RecipeChoice.MaterialChoice
If I chose RecipeChoice.MaterialChoice I only have limited options for possible recipes so I looked into RecipeChoice.ExactChoice but It dose only work as it says with exact Items, but I want that all Items of a type with a specific CustomModelData, ignoring the Displayname and Lore.
Is there a way to do that?
The Events of a Furnace are not helpful since the FurnaceStartSmeltEvent can not be canceled and if I would cancel the FurnaceSmeltEvent it would lead to the non stop burning of the fuel in the furnace.
If you reply pls tag me 🙂
Hmm sounds hard, I can think of 1 wat which would be to use nms
But not sure u wanna go to such lengths
okay what would be the nms way ?
how connect my api with another my plugin in maven?
declaration: package: org.bukkit.inventory, class: FurnaceRecipe
https://jitpack.io/ should work
probably didn't see that there was another method for creating a furnace recipe that avoids needing to make a choice between the type of recipe for the constructor
and then once you have a Furnace recipe you can then use addRecipe method to register it with the server
so that should solve that first part
That dose not help since it dose not solve the problem
then for cancelling you probably could use the BlockCookEvent instead since Furnace smelt extends that
The Problem is that If I use FurnaceRecipe(NamespacedKey key, ItemStack result, Material source, float experience, int cookingTime) it is the same as FurnaceRecipe(NamespacedKey key, ItemStack result, RecipeChoice input, float experience, int cookingTime)with RecipeChoice.MaterialChoice
and for resolving the fuel continiously burning you could just remove the fuel and add data to the block PDC how much fuel its suppose to have
then when re-accessed re add the fuel back
the first doesn't require a RecipeChoice
FurnaceRecipe(NamespacedKey key, ItemStack result, RecipeChoice input, float experience, int cookingTime)FurnaceRecipe(NamespacedKey key, ItemStack result, Material source, float experience, int cookingTime)
The rest is@Deprecated
just fyi, deprecated doesn't always mean unusable or can't be used
I could make a work around like that but it would be to many Events that neded Checking and modifying
not sure what the issue with the amount of events, but really its like just 1 event
yes that may be right but I dose not solve my problem
Nope it is the FurnaceSmeltEvent and FurnaceBurnEvent
there is interact event to click on the block, then there is an inventory event for opening the inventory of the block
and those two events one of them you would use for removing and adding fuel
Also there is a Thread that that showes a posible workaround https://www.spigotmc.org/threads/furnace-start-smelting-event.374563/
declaration: package: org.bukkit.inventory, interface: ComplexRecipe
also complexrecipes exist too
if you didn't know
It dose not solve my Problem
My Problem is that I do not know how to register a FurnaceRecipe where only the Type and CustomModelData are checked.
If I register a Material I could do that only once, since the overwrite each other
then use the inventory event for when they are placing the item, if it matches reset the item stack to match the recipe
the itemstack doesn't matter since it will be destroyed anyways after the smelting proces so all you have to do is just make it match if it matches your conditions you are wanting
okay that could work
is there any way to make neutral mobs hostile?
yea
just change their goals
how would I go about doing this
you get the NMS entity and then you get the goalselector and add whatever existing vanilla goal you wanna add
e.g. look at the decompiled NMS zombie class, then you'll see which goals those use
just note if I recall on some neutral mobs I believe it causes them to glitch out.
on some of them that is, or at least that is what I remembered just don't know which ones that would be so make sure to test your stuff lol
Can't recall or find in the search bar the answer to this question; someome (I think Illusion) mentioned you can tell a client to 'render this particle even though its further than 31 blocks away'. How do you do that again?
wait theres apparantly a method with a bool in there
but its not showing up
ah yes arg cutoff of course
bleh
Never said anything about the beyond 31 block
you might be able to do it with offsets
In https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html it is listed
spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force)
Maybe worng version ?
declaration: package: org.bukkit, interface: World
force – allows the particle to be seen further away from the player and shows to players using any vanilla client particle settings
no
its the very long method at the bottom
which refuses to display the force arg
im on latest
okay than sorry I have no Idea
What does IntelliJ not giving you all the args have anything to do with what the method actually does
It sounds to me like that's exactly what you want.
the argument names are weird too
using spigot instead of spigot-api
then idk why you don't have javadocs in IJ
you don't have to add the javadocs to maven, and <type> is also not needed
press shift twice quickly and enter "download documentation"
nope
do you have the mcdev plugin installed/enabled?
of course i dont
dont you need sources
?
for var names, im pretty sure you need sources
thats possible
whats that import?
Shift+Shift + Download sources
but why would you need sources? the javadocs include that
do i need to restart or smth
cuz its still v v1 v2 v3
huh you cant loop with a for loop over an empty list
If !list.isEmpty() 😮
not this one
for(Location l : vertexList)
works my ass
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?]
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?]
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) ~[?:?]
at java.util.Objects.checkIndex(Objects.java:359) ~[?:?]
at java.util.ArrayList.get(ArrayList.java:427) ~[?:?]
at io.github.moterius.VectorParticleLib.Shape.SimpleShape.project(SimpleShape.java:57) ~[?:?]
Yea
its empty
show code
for(Location l : vertexList)
more code

specifically line 57 of SimpleShape
you are 100% not running that code
^^
pls make sure you are running the latest version of your source code
im pretty sure i am
I am pretty sure you are not
clean package it
so apparantly i lost a line somewhere
the poor line
naming convention straight from hell
pretty sure for small loops its fine
no I was reffering to alex with the loop_empty_line xD
better? D:
Yes, perfect 🙏
tbh who cares how a test is called if it doesn't fail lol
oh by the way, can you build a remapped server?
at net.minecraft.network.EnumProtocol$a.a(SourceFile:458) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3859-Spigot-94e187b-f70a7b6]
at net.minecraft.network.EnumProtocol.a(SourceFile:522) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3859-Spigot-94e187b-f70a7b6]
this doesnt exactly tell you anything
oh, I mean sure, it just will explode with any third party NMS plugin
just run the specialsource plugin over the server .jar lol
also you cant obsfucate ur plugin
?paste the full thing then
well probably because it's only 2 lines
na i meant the method names
does proguard not have a stacktrace translator? allatori does have one but mojang only gives us a proguard file
im not running that, is it an external thing?
I unfortunately wasn't able to find it
it does
stack retrace
I fucking hate how ClientboundBlockChangedAckPacket now exists....
How do I create a config reload plugin? I think I have it all right but I don't actually reload all the data there.
Btw ping me when you answer please
how to turn off the water from falling or flowing
is there an in-game command block or command?
cancel blockPhysicsEvent if its from water



