#help-development
1 messages · Page 416 of 1
run maven package instead of just mvn
Hey guys
I am trying to implement that but modImplementation nor include are working in my build.gradle
its a mod not a plugin lib
they're making a mod
ah
modImplementation is a fabric thing iirc
do you have the required fabric plugin
omfg I can't read
Seams the simple way is to Bukkit.dispatchCommand(console, s.toString()); the summon command
Good alternative
that error is saying dont just run maven it needs a goal
so how do I change it
How can I make an unbreakable block mineable/breakable?
I'm running an intellij configuration
how do I chang eit
edit the config, then you should see a bar under the name, has Run above it add package or whatever goal you want to execute in there
How can I set block breaking animation level?
sendBlockDamage
aight thanks
you mean the pom.xml?
what do i edit there
you said you used an intellij config, i thought you meant run configuration
what are you using? I always used mushroom blocks and update suppression but that doesnt support transparent
Hello. I am trying to serialize a player's inventory. I registered a custom TypeAdapter for it, but I do get the Error: `
my code:
.registerTypeAdapter(Inventory.class, new PlayerInventorySerializer())
.create();
FileWriter fw;
try {
fw = new FileWriter(file);
gson.toJson(inventory, fw);
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
/**
* Black magic in
* @param stack
* @return
*/
private static byte[] stackToByte(ItemStack[] stack){
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
BukkitObjectOutputStream oos = new BukkitObjectOutputStream(bos);
oos.writeInt(stack.length);
for (ItemStack itemStack : stack) {oos.writeObject(itemStack);}
oos.close();
return bos.toByteArray();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* Black magic out
* @param data
* @return
*/
private static ItemStack[] byteToStack(byte[] data) {
try {
//TODO Test getBinaryStream insted of getBytes here.
//might need to replace/rework into byteArrayInputStream somehow
ByteArrayInputStream bis = new ByteArrayInputStream(data);
BukkitObjectInputStream ois = new BukkitObjectInputStream(bis);
int length = ois.readInt();
ItemStack[] stack = new ItemStack[length];
for (int i = 0; i < length; i++) {stack[i] = (ItemStack) ois.readObject();}
ois.close();
return stack;
} catch (IOException | ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
@remote swallow how can I do that?
Don't know what your PlayerInventorySerializer looks like but it seems like GSON is trying to serialize an Optional and not really knowing how to do that lol
ye what do i edit in the run configuration
the goal
how's that possible lol?
I dunno. No clue what your serializer looks like
public class PlayerInventorySerializer implements JsonSerializer<Inventory>, JsonDeserializer<Inventory> {
@Override
public JsonElement serialize(Inventory inventory, Type typeOfSrc, JsonSerializationContext context) {
JsonObject obj = new JsonObject();
String uuid = ((Player)inventory.getHolder()).getUniqueId().toString();
String invString = Base64.inventoryToBase64(inventory);
obj.addProperty("id", uuid);
obj.addProperty("inv", invString);
return obj;
}
@Override
public Inventory deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
JsonObject obj = json.getAsJsonObject();
String id = obj.get("id").getAsString();
String invString = obj.get("inv").getAsString();
if(Bukkit.getPlayer(UUID.fromString(id)) == null) throw new NullPointerException("Player must be online for this inventory to get serialized");
Inventory inventory = null;
try {
inventory = Base64.playerInventoryFromBase64(invString, Bukkit.getPlayer(UUID.fromString(id)));
} catch (IOException e) {
e.printStackTrace();
throw new IllegalArgumentException("Some Error occured while trying to deserialize a Player-Inventory", e);
}
if(inventory == null) throw new IllegalArgumentException("Some Error occured while trying to deserialize a Player-Inventory");
return inventory;
}
}
thats the Serializer
do what
nms "unit tests" lol
lmao
yes
"you need to pass a plugin instance"
you need an instance of your main class, use di, a static getter or MainClassName.getPlugin(MainClassName.class)
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
InventoryHolder doesnt have an uuid
any ideas whats wrong here? I cannot see anything what could rn
I mean none inventory contains a unique id
"jefflibtest"
getPlugin(Class) is static
How disappointing
Still a problem? Just looked here. You need to register your serializer as TypeHierarchyAdapter.
Also menu holders doesnt have uuids!!! 🤔
yes still a problem. But maybe I found the actual problem. An InventoryHolder does not contain an uud
Did you see my message on your lib and what all has API?
uhm now I gotta somehow pass args to the Serializer lol
Is what i told you 2 times exactly 🤣
<#general message>
oh yeah sorry I overread it because you linked it to the other guy's message lol
I didnt look at the serialisation method itself. You should ofc just serialize the content and not the InventoryHolder
ohh my bad i just realize that
well but its specificly a PlayerInventory. So it needs to be associated with a Player
So serialize the player uuid + extra data (idk what you saving that why, "extra data")
Not it really doesnt. You cant serialize a PlayerInventory anyways.
well how do I pass the Player as an argument?
why not?
Oh right, no you cant
Im encoding it to b64 and then writing it to a json with the needed extra-data
Because you cant instantiate it.
i mean just getPlugin()
You can save an inventory
Not a player Inventory
You should only serialize the content (ItemStack[])
well you can just create an inventory with the player object and the data
Do you want to serialize a PlayerInventory or a chest Inventory?
Player
Then -> You cant
(its a failsafe only dedicated to players)
but I can just get the Inventory with the deserializer and then write the contents to the player-inv
Why not just write content directly
Ok but why would you want to do that? You are just creating a dummy inventory which has no purpose and
gets discarded again
I could use just the Contents for sure, but that would complicate things for me lol
would need to split armorcontents, offhand and actual contents
Why?
anyways, im fine with the player-inventory as this code is just a failsafe getting executed on the absolute heaviest edge-case
because tbh I did not really learn about how Inventories work in depth
so, can I pass a player to the TypeAdapter?
No. A Player object contains a tremendous amount of data that cant be serialized easily.
The default ReflectiveTypeAdapterFactory wont be able to resolve at least half of the fields.
What are you trying to do?
uh oh gson
nono I do not wanna serialize a player
I just want to write the UUID of the player lol
Take another step back: What is your plan
Serialize a Player-Inventory with a bit of extra data to a JSON file
so serialize the itemstacks, and what extra data?
Their UUID it seems
Then create a class that looks like this:
public class PlayerData {
public PlayerData(Player player) {
this.inventoryContent = player.getInventory().getContents();
this.playerId = player.getUniqueId();
}
protected PlayerData() {
inventoryContent = null;
playerId = null;
}
private final ItemStack[] inventoryContent;
private final UUID playerId;
private double someVariable;
}
And register a serializer for ItemStack.class
Gson will handle the rest for you
It asked me to put a semicolon in, but now the ";>" is underlined red. Bukkit.getScheduler().runTaskTimer(Dialogue.getPlugin(Dialogue.class) -;>
Bukkit.getScheduler().runTaskTimer(Dialogue.getPluign(Dialouge.class) -> {
code
}, deley, interval);
Dont tinker with lambdas if you dont understand them.
Just create a class which implements Runnable and pass it to your runTaskTimer method.
Example
SomeTask task = new SomeTask();
Bukkit.getScheduler().runTaskTimer(Dialogue.getPlugin(Dialogue.class), task, 10L, 10L);
player has
public class SomeTask implements Runnable {
@Override
public void run() {
// Do something
}
}
This all runs in a command though.
Shouldnt be a problem
It says Cannot resolve method 'runTaskTimer(T, SomeTask, long, long)'
Just create a class which implements Runnable and pass it to your runTaskTimer method.
?learnjava this is more of a learn java moment
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.
getPlugin()? How would that work? I was referring to your "MyMainClass.getPlugin(MyMainClass.class)"
I did, and I get the same error.
wheni said static i meant a getter in the class, getPlugin/getInstance etc etc
just use dependency injection, way cleaner for this purpose
I am only talking about the "MyMainClass.getPlugin(MyMainClass.class)" part lol
public void makeEntityLookAtPlayer(Player player, LivingEntity entity) {
Location entityLoc = entity.getLocation();
Location playerLoc = player.getLocation();
double deltaX = playerLoc.getX() - entityLoc.getX();
double deltaY = playerLoc.getY() - entityLoc.getY();
double deltaZ = playerLoc.getZ() - entityLoc.getZ();
double yaw = Math.atan2(deltaZ, deltaX);
double pitch = Math.atan2(Math.sqrt(deltaX * deltaX + deltaZ * deltaZ), deltaY) + Math.PI;
int yawAngle = (int) Math.toDegrees(-yaw);
int pitchAngle = (int) Math.toDegrees(-pitch);
PacketPlayOutEntityHeadRotation headRotationPacket = new PacketPlayOutEntityHeadRotation(((CraftEntity) entity).getHandle(), (byte) yawAngle);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(headRotationPacket);
PacketPlayOutEntityLook lookPacket = new PacketPlayOutEntityLook(entity.getEntityId(), (byte) yawAngle, (byte) pitchAngle, true);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(lookPacket);
}
What is wrong with this code?
ah
it should return a Plugin instance right?
i thought thats what that did
Just set the direction of the entity and get the angle that way.
Also:
byte packetAngle = (byte) ((int) (mcAngle * (256F / 360F)))
all I wanted to say is that it's a static method declared in JavaPlugin, so you'd do JavaPlugin.getPlugin(MyMainClass.class) instead of MyMainClass.getPlugin(MyMainClass.class) 😛
You can set the direction vector of your entity and simply call
byte yRot = (byte) ((int) (location.getYaw() * (256.0F / 360.0F)));
byte xRot = (byte) ((int) (location.getPitch() * (256.0F / 360.0F)));
Vector direction = fromLocation.toVector().subtract(toLocation.toVector());
my math is working already, the issues is in: PacketPlayOutEntityHeadRotation headRotationPacket = new PacketPlayOutEntityHeadRotation(((CraftEntity) entity).getHandle(), (byte) yawAngle);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(headRotationPacket);
PacketPlayOutEntityLook lookPacket = new PacketPlayOutEntityLook(entity.getEntityId(), (byte) yawAngle, (byte) pitchAngle, true);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(lookPacket);
and what is the issue?
CraftPlayer cannot be resolved to a type
?nms
already using
can't be
We should start calling it NM
otherwise you wouldn't call it PacketPlayOutEntityLook
my other CraftPlayer references working
Did you import the class?
ofc
Maybe they are pre mojmap
Your math is not right. Angles are in 256 steps, not in 360
if you would be using remapped NMS, you would use "ClientboundMoveEntityPacket$Rot" instead of "PacketPlayOutEntity$PacketPlayOutEntityLook"
bingo tho, I forgot to save my code in VSC, I'm coding in VSC then building in Intellij, using same workspace
Umm

Okay
what the hell
most basic setup
Some people just love to spend time with build time problems. Like what?
also claiming "already using" when getting sent a link about remapped in maven while using neither maven nor remapped... lol
You see InteliJ is only a compiler
Write your code in Word and compile using javac. Will cause less problems probably,
I tot u were talking about mvn's lib
mvn's lib?
minevn
whut
not even
No it is
You mean maven?
Trust me
I sure hope you mean maven.
nah I don't
That delegates into JavaC
Shhh
looks like you didn't read previous conversation
don't spread misinformation
I didn't
I just parachuted here
noticed
IntelliJ is actually a 3D modelling software
fork of cad
have u found a solution?
spoon of cbd
if we think about it deeply enough
every single program
is just an assembly wrapper
no. False.
!True
not really, assembly is still a language that needs to be "compiled" into machine code
in python wouldnt it be not True?
its wrapper object for binary 1 with overloaded not operator
javascript
// This prints 10:
alert(++[[]][+[]]+[+[]]);
// And this "fail":
alert((![]+[])[+[]]+(![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]);
more javascript:
parseInt('06'); // 6
parseInt('08'); // 0
there is actually some kind of explanation for this
but tf is this
Ill send the explanation in 5 mins
Cant find it rn
Bit i still got it open on the other computer
It’s parsing it in base 8
I just learned the hard way that JavaScript thinks the leading zero indicates an octal integer, and since there is no "8" or "9" in base-8, the function returns zero. Like it or not, this is by design.
funny
Javascript is shit, it should throw an error instead of using 0
Well everything thats not strictly typed is shit imho lol
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
File heartsFile = new File(getDataFolder() + File.separator + HEARTS_FOLDER, uuid.toString() + ".json");
if (!heartsFile.exists()) {
JsonObject playerHearts = new JsonObject();
playerHearts.addProperty("hearts", 12);
try {
heartsFile.createNewFile();
FileWriter writer = new FileWriter(heartsFile);
writer.write(playerHearts.toString());
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
JsonParser parser = new JsonParser();
JsonObject playerHearts = parser.parse(new FileReader(heartsFile)).getAsJsonObject();
int hearts = playerHearts.get("hearts").getAsInt();
this.hearts.put(uuid, hearts);
if (hearts == 1 || hearts == 0) {
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', "&7Ahmak herif! Gerçekten hayatta kalmayı başaramadın mı? Ne yaptığımızın, neden burada olduğumuzun hiçbir önemi yok. Burada çok bekleme bence, seni aptal! Burada sessizlikten ve hiçlikten başka bir şey yok. Yaptın mı beğendiğini? Aman neyse, en azından cesedin kurtlara yem olduğunda bir bok başarmış olacaksın. Ahmaksın, ahmak!"));
} else
player.setMaxHealth(hearts * 2);
player.setHealth(hearts * 2);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}```
Should I just use YAMLConfiguration?
or stick to JSON still
first of all, you should use code tags
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
hardcoding translations hehe
omf
first and last part are insults, the inbetween is something about corpses being eaten plus stuff I don't undertsand, and another insult
Stupid bastard! Did you really not survive? It doesn't matter what you do. Don't wait too long here, you idiot! There is nothing here but silence and nothingness. Did you like it? Thank goodness, you'll have accomplished a piece of shit when you're baited by the worms of the deadliest. you're a fool
tf
Because it can be slow
I mean you’d have to block the thread for 60 seconds for server to go ded
But yeah
not ded because its me and my other 2 friends playing 😄
I don’t think I/O is quite that slow
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
File heartsFile = new File(getDataFolder() + File.separator + HEARTS_FOLDER, uuid.toString() + ".json");
if (!heartsFile.exists()) {
JsonObject playerHearts = new JsonObject();
playerHearts.addProperty("hearts", 12);
try {
heartsFile.createNewFile();
FileWriter writer = new FileWriter(heartsFile);
writer.write(playerHearts.toString());
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
JsonParser parser = new JsonParser();
JsonObject playerHearts = parser.parse(new FileReader(heartsFile)).getAsJsonObject();
int hearts = playerHearts.get("hearts").getAsInt();
Bukkit.getScheduler().runTask(this, () -> {
this.hearts.put(uuid, hearts);
if (hearts == 1 || hearts == 0) {
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', "&7Ahmak herif! Gerçekten hayatta kalmayı başaramadın mı? Ne yaptığımızın, neden burada olduğumuzun hiçbir önemi yok. Burada çok bekleme bence, seni aptal! Burada sessizlikten ve hiçlikten başka bir şey yok. Yaptın mı beğendiğini? Aman neyse, en azından cesedin kurtlara yem olduğunda bir bok başarmış olacaksın. Ahmaksın, ahmak!"));
} else {
player.setMaxHealth(hearts * 2);
player.setHealth(hearts * 2);
}
});
} catch (FileNotFoundException e) {
e.printStackTrace();
}
});
}```
what about this
grr I thought about this super nice code structure when I was at the gym and I'm too tired to remember it

it'd be able to hook into multiple code structures with a lil "transformer"
Hello friends, do you know any good "image map api"?
Currently i'm working on a coupon project, where players can interact with fancy looking Material.FILLED_MAP items.
I tried the built-in map api, but somehow after a server restart, the map gets empty and won't stack with the new "same maps".
are there any frameworks that make creating and working with inventory guis a bit easier? couldnt find anything and the ways i tried implementing them myself either end up in a lot of duplicate code or a lot of unneeded complexity
Is there a way to create an NPC without using NMS?
generally offline players don;t have permissions
I'd reccomend you use luck perms api cuz you'll beable to do that
use Vault as it supports many permission plugins
yo @echo basalt I got the random Animation working. Thanks for the idea!
Why needs a return statement?
🤔
Yeah me too, i always have issues with math - PD: sorry for pinging
let’s you handle the result of it properly
cause it’s running on a different thread
Yes i know its handle on other thread
But why the issue of the return statement?
So far voids dont return any value, you can just "return" in the way of stopping code block for being executed
Can you re eleaborate what you mean? Because i cant understand the reason
But if i add the "return" its gives another issue
because its using supplier interface ?
why using supplyAsync then ?
Voids dont return anything
if you doesn't need result of computation
Yes
And being executed async
just like you will done with normal completale future, but without handling any value let say
thenRun ig
thenRun is returning CompletableFuture<Void>
This is my code, i dont mean that
@Override
public CompletableFuture<Void> insert(String field, Object value) {
return CompletableFuture.supplyAsync((Void) -> {
try (Jedis jedis = redis.getClient().getResource()) {
jedis.hset(name, field, redis.getInfo().getGson().toJson(value));
}
}, redis.getInfo().getExecutor());
}
Thats on my RedisCache class, so when you run an insert
oh, just change suppyAsync to runAsync lol
ohh thanks
I was meaning that
I mean i didnt explain well what i was needing
🤦♂️
Im re writting my redis library from the scratch 💀
y2k bro, what happened with your lib?? I cant find it any more, not even the commands one. If you see this message dm me
https://www.spigotmc.org/threads/tutorial-data-storage-with-ndatabase-a-database-framework-for-minecraft.595340/ any thoughts on this resource anyone. I'm honestly a big fan :P Mostly cuz this is kinda what i used on the server I worked for. I'd be curious
Moved
i'll send you
i would advise hopping into completeablefutures javadoc before continuing
I read them but not taken the correct time
Just a fast view over them
Cuz i dont have time to spend and i must finish this lib
takes 5 minutes to make your life 20 times easier but you do you
i’m used to jooq but this looks wrapped hella nicely for minecraft
good shit
Finally glad this guy put the work in I was too lazy to do
always love me a db util that uses inheritance
mc wrapping is qol but if it runs well looks nice af
sus
What its sus?
no reason
I am working on a item exchange plugin. How can I order the strings in the autocomplete?
Cant u something like an index based?
Ok. Means the only way would be:
- _set amount
- 1
- 16
and so on
I think you can loop over the completations, sort them via index and collect back to list
But im not sure if that will work
@granite herald
no
the tab complete list is auto sorted alphabetically, you have no control over order
so shity, thats a bad api design
will it do like that. Not so beautiful but better and not in order. Most important is the first string
if you add a prefix that will be included IN your tab complete
what is wrong?
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
NickUtils.createTeams();
return true;
}
public static void createTeams() {
Team hracTeam = board.registerNewTeam("hrac");
Team adminTeam = board.registerNewTeam("admin");
hracTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OTHER_TEAMS);
adminTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.FOR_OWN_TEAM);
}
If I use command /team list it says "there are no teams.
not looks like
Hmm, re download it, maybe something was corrupted
I dont think so. Im trying to create classis MC team.
you should be able to just do createTeams()
but that's not the issue-
can you show surrounding code
?paste
command class: https://paste.md-5.net/osihoherib.java
NickUtils class: https://paste.md-5.net/umanesifup.java
Oh I get it working. I changed boar variable from manager.getNewScoreboard(); to manager.getMainScoreboard();
It’s not up to spigot, the client sorts them
Oh that males sense
The first method Will always return a new socoreboaed, so changes are not apply let Say
But, affter this change Im able to see team with /team list command thats what I needed. I dont need scoreboard it self. I need only team to hide player names and make toggle able for admin to see them.
So probably that changed something I guess?
is it possible to use hex colors in the scoreboard?
Text? Yes. Team colours? No
really?? i tried displaying hex colored text but i couldn't get it to work
What code and what didn't work
the code is deleted now because i tried it a while ago. i wanted to ask here if it works before i try to get it to work again
but if you say that it works i am gonna try
How can I make this work?
objective.getScore("&#CCCCFFtext").setScore(1);```
you absolutely do in commands?
yes, but the list you return is sent to the client
and then the client sorts it on their side
Soo there is no public-facing API that can be used to release plugin updates automatically. Am I correct?
is this the channel for plugin dev help?
im assuming it is
is it already possible to use spigot 1.19.4 R1 as a dependency in plugins?
because I've found this: https://github.com/Kir-Antipov/mc-publish
It supports other major websites that also host Bukkit plugins, but it doesn't support Spigot.
Hey guys I have a question about learning new things for coding plugins. I went straight into spigot never really sat down and learned everything in Java but I know other languages like C and Python pretty well which is how I got started and now im in a weird point where I know how to do things and dont really know how to improve to get better. At this point im just coding what I want to make is there any recommendations on what to do to get better at something like this? Are any of the spigot programs you have to pay for online good to do to improve skills?
I dont have that much spigot experience but i can say for sure that one of your best bet is to develop difficult things, stuff you'd avoid due to the sheer difficulty
Create a list of things you dont know and things you want to know more in java. Then you can devise possible plugins that either can make use of those things or you can just try those things out. Come here if you want some concepts explained or if you want some more in depth knowledge about something. Plenty of us here have a deep understanding of java and the associated jvm.
Most things are considered difficult to a person not because it actually is rather being inexperienced with that thing.
i completely agree
Is it possible/feasible to dispatch console commands without logging the output to the console using nms?
you might be able to make your own impl of ConsoleCommandSender and get results from that, i remember someone doing that for getting results of another plugins commands
?xy
Asking about your attempted solution rather than your actual problem
Why do you want to dispatch console commands is the real question
^
You can do everything a command would do just by using some code.
Thats preferable and also not logged on default.
WIth running commands my command calls an external API and does some processing. Sometimes the API runs a little slow as it processes. I just got this message in the Spigot server log:
Can't keep up! Is the server overloaded? Running 5817ms or 116 ticks behind
Do I need to be concerned about thread blocking for multiple commands running at once? Should I write the command in async fashion ("If that's possible not a Java engineer")
IO should never be done on the main thread. One tick has only 50ms of processing time. After that the next
tick is started. If you now request external API through http requests then that can take upwards of 100ms.
This means you are blocking the entire server (chunks, mobs, players etc) from being ticked with your request.
Gotcha thank you
Here are some things you should always do on a separate thread:
- Reading/Writing Files
- Accessing Databases
- Web requests of any type (like http)
I think I remember creating threads about 10 years ago for a different Java project. I'll take a look. Thanks again for the advice.
Is loading the Spigot config file something that should be done on the same thread? I need that loaded on Plugin enabled before other processes can run.
You can just use the BukkitScheduler. It has methods for that.
Ofc there is always the possibility of using your own thread, executor or CompletableFutures.
Highly recommend TaskChain by Aikar makes things clean
Not sure how maintained that is
It hasn't been updated in a while but I don't think it needs to be
In your OnEnable you dont want to do anything async. Its ok to block there with IO.
I'll take a look thank you!
is it possible to install nms on a project that is not even in maven? (Intellij)
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
You can but I don't recommend it
okay
Its possible but you need to depend on several different jars
is it bad
Or just the shaded one as stated in the bot message
That doesnt contain nms
After looking through the BuildTools folder it looks like this contains nms:
BuildTools\Spigot\Spigot-Server\target\spigot-1.19.4-R0.1-SNAPSHOT.jar
why don't you just turn it into a maven project?
btw you'll have to run the specialsource .jar manually to reobfuscate if you don't use any build tool
Honestly at some point you will have to learn using Maven or Gradle.
I would suggest Maven. Watch a tutorial and then use this Intellij plugin to generate
a clean maven project for Minecraft:
https://plugins.jetbrains.com/plugin/8327-minecraft-development
WOOOO MC DEV
whats Main.java 26
getCommand("social-media").setExecutor(new SocialMediaCommand(this));
calling the setupCommands method
setupCommands();
?paste
if its error on the set executor its not in plugin.yml
First main class since that is where the error is specified. Specifically in the onenable. Something is null
And instead of us guessing easier if we can see code to help you track down where it is at
Main.java:
paste plugin.yml too
plugin.yml:
Your update checker is flawed
commands are all correct in plugin.yml, nothing looks wrong in main class this error doesnt match the code
wait a minute...
inb4 the jar wasnt updated
i think i loaded wrong version
Alright. Well now i can explain the flaw in the update checker
Normally when you build spigot via buildtools the version will be correct. However if instead you build it manually it will say version git-unknown
https://github.com/The-Epic/EpicSpigotLib/blob/master/src/main/java/me/epic/spigotlib/SimpleSemVersion.java
https://github.com/The-Epic/EpicSpigotLib/blob/master/src/main/java/me/epic/spigotlib/UpdateChecker.java#L17-L39
private void initializeUpdateChecker() {
UpdateChecker checker = new UpdateChecker(this, PLUGIN_ID);
SimpleSemVersion current = SimpleSemVersion.fromString(this.getDescription().getVersion());
Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> checker.getVersion(version -> {
if (SimpleSemVersion.fromString(version).isNewerThan(current)) {
ConsoleCommandSender sender = Bukkit.getConsoleSender();
sender.sendMessage(ChatColor.GOLD + "=".repeat(70));
sender.sendMessage(
ChatColor.GOLD + "A new version of MineTweaks is available: " + ChatColor.DARK_AQUA + version);
sender.sendMessage(
ChatColor.GOLD + "Download it at https://www.spigotmc.org/resources/minetweaks.96757/");
sender.sendMessage(ChatColor.GOLD + "=".repeat(70));
}
}), 0, 20l * 60 * 60);
}
That is probably the better-ish update checker, checks for major.minor.patch updates so should notify people on any update
dont question if minetweaks is mine
Nvm ignore what i said read you update check wrong
Thought you were checking server version lol

the only thing this doesnt cover is snapshot builds
Anyways problem solved it seems
wait until i test it on **LocalHost Craft **
@wet breach
you know how to make actionbar stay?
nvm
Hmmmmm
lets assuming im trying to profile something that only takes a few milliseconds. How can i obtain the time it takes for System.getCurrentNanos() to... well, run?
Profiling should generally be done using a dedicated framework like jmh.
But if you just want to manually measure time then use System.nanoTime() (twice) because
it has a better relative accuracy. System.currentTimeMillis() has a better global accuracy.
see im asking cuz running a profiler on a remote spigot server is kinda difficult
Hm?
If we are speaking about something like VisualVM then remote profiling is not that hard (if you have root access)
Also Spark deploys a whole profiler itself.
It really depend on what it is you are trying to profile.
Why is the Main thread being blocked while doing:
ComoletableFuture<Repository<?>> getRepository() {
return CompletableFuture.supplyAsync((Repository<?>) -> return bla, executor);
}
Repository<UserModel> users = getStorage.getRepository("users").find().join();
.join() 
.join() joins the current thread... so
It can't block if i'm passing an executor
no
🤔
you understood futures wrong
join() will wait for the future to complete
what executor you pass does not matter
that executor is responsible for executing the future
This is executed by the executor. But if you call join() then your executor joins the thread join() was called on
join() waits for the executor to be done executing
Right, but how i would get the result without using andThen(), etc
not at all
it isn't available yet
that is the entire point of it
config.set("message", List.of("Hello", "World"))
Right thanks, so Will have to make an own future implementation 💀💀
what ?
no
you cannot get the value on the thread without blocking
like, just logically that does not make sense
You define a pipeline which describes what the object should be used for if it is finally available.
Everything you define in a CompletableFuture will be run in the future at some point. And you have no idea when this
point will come.
no matter what impl you write
cant you queue atomics outside of threads?

sure your future can mutate an Atomic
if that is what you mean
does not mean you have access to the value directly on the thread
what ?
no like
the atomic will be null until the future completes
how is your code gonna know when that happens ?
because before that, you just have null in your atomic reference
ah i was referring to running threads my bad
i was like 'isnt that what we have monitor locks for'
or whatever you call that to not do read/write operations on the same value in parallel
verano wants to use futures and obtain the result in the main thread without blocking
sounds counter-intuitive, that's not how future works
Well when we get time machines in java it might work
Oh ok, that makes sense and also i cluldnt find enogubt info about doing that
it kinda isn't possible
But what's an alternativa for it?
just using the thenAccept thenWhatever methods
You can use an executor to have the data on the main thread, later
An example?
What thats?
read
Ok, but i can't understand the texto You linked me
what java version are you on 
Yes you can
Arrays.asList I think
I mean
Uhh
create a list somehow
Yeah
tho Arrays.asList should exist in java 8
Exists
I think you are running Java -8 xD
Btw, how can I run a code when the player walks on a Bed?
e.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == Material.BED but it doesn't work
No problem!
when on a bed the getTo might just be the bed, since a bed is like half a block
ur prolly tryna get the block under the bed now
Oh
getTo
Oh yeah
not relative down
Okay i read what You link, but why Javascript allows You yo get directly the value? 🤔
because javascript doesn't really have a concept of a main thread
idfk I'm a java dev
Yes they use something like a thread pool but it's not exactly that
jokes on them
But thanks that info about completable future helped me a Lot
Sorry for disturbinh
is ok
multi-threading doesn't exist in javascript
closest you are going to get is asynchronous tasks
I see that
Bukkit.getOnlinePlayers();
returns
Collection<? extends Player>
Is this what I should be using to get all the players?
If I want to get all the players or players UUID connected to the server, specifically
it just returns a collection
if you want it in a List for example
you would just use the addAll method from the List
I dont think my NMS is working can anyone help?
Ohhhh right right
and reference the collection
Is it better to do that or use the collection directly?
You can use it directly, just depends what you are needing hence why it is a Collection and not some specific array of sorts
gives you freedom to have it anything you need it to be
Gotcha!
Thanks forst
List<Player> uuids = new ArrayList<>(Bukkit.getOnlinePlayers());
I want to merge 2 plots. How do I get the blocks of the road between the two plots to make them grass? (my own plugin)
List<Player> uuids = Bukkit.getOnlinePlayers().toArray();
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Both work correctly, is there a reason I should use that one instead?
man its not working what do i need to say
Alternatively you can use toList() as well
reason for using toArray is it will ensure the array its being copied to is exactly the same size as the number of elements it contains
also it is more performant as well and since it creates a copy the array instance has no referneces and safe to use anywhere
Ahhhh gotcha gotcha
all that from just one method
0
all arrays in Java start at 0
if you want to do it the way you had it
you would need one more line of code
that is, to size the array before hand which is less performant then toArray() to not lose performance when copying another array
💀
my life will never be the same
What's a good way to implement a network wide restart? Synced, example, all servers under the proxy restart together
With a timed countdown, that is
use a bash script or have them all as a service
yes it will
you can send messages from bash to in game 😛
tf
let me show you
That would be amazing, thanks
that is one of the service scripts I have, but that link shows the line where it sends a message in game 🙂
this is a bash script and not a service one but its for a ramdisk setup
make a small bungee plugin which just runs console command restart on 3am
for all servers 😉
i mean a plugin can just create a server socket
and listen to a specific port
for messages to display
I guess
but idk if bungee has /restart
I could make a bungee bukkit-brige
/end ig
I'm using pterodactyl
wouldn't need to do that, all of this can be done from a bash script even if the servers are not on the same host
That's the thing
They have cron tasks
But how can I edit that to send a countdown in game, even if it's basic
well with plugin you can basically send messages and do some stuff before restarting
and set the restart time to yml for example
do some stuff like what?
He's right tho, I can edit all server startup scripts
And that would do the trick I think
bukkit api stuff
such as
my service script I linked earlier, auto restarts servers if they die as well as lets you spin up as many servers as you want by using arbitrary names it doesn't know about before hand 😛
also, the service script locks the java processes as well
also known as jailing
But
so I don't see how a plugin would be more beneficial
Do you know if it's possible to use something like that with Pterodacyl
have no idea, never used pre-made panels like ptero
Have no use for them and they never provide what I want as well as taking up valuable resources for stuff I don't care about
They only offer a startup command by default. I'm sure I can change stuff inside tho
Fair
bash script, you can use ssh if need be and without passwords since you can have certs. Therefore, not hard to create a bash script for the purpose of restarting all servers
however, restarting servers shouldn't be a normal everyday thing
if you have decent plugins, typically most I have used were custom. You can have an MC network and servers running for months before restarting them
its not going to go beyond what you allocated it
if it does it dies anyways
and should be investigated at that point in why it tried to use more then you gave it
But but
If you leave it on for longer
Doesn't it tend to eventually go up and up until it can't cause allocation?
garbage collection goes brrrt
depends on the plugins ig
if you allow dynamic allocation sure. But I also set an upper limit which is the same as the lower limit so that the server already has ram pre-allocated to use even if it doesn't need to use it all
Oh!
That's actually a good idea
So straight up give it min and max
Same value
yes
That's smart
its better too
Gotcha gotcha, thanks both
?flags
Aikar's garbage collection flags: https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
but yeah, if you are having to restart your mc servers everyday then there is something wrong and it should be looked at in why you are needing to do that
freejavalessons
tho there is a skyrim mod
afair papyrus is a scripting language
and it can have recursions
Man I'm looking at these voting plugins
That are available
They are all outdated
I can make my own but
Something so common i'm surprised there isn't a decent alternative already
and this mod basically hooks to the script and searches for recursions stuck + disables them
is that possible in like c++ or java
@wet breach
afair you can link to an .exe process with some cpp magic
i want to write my own tree capitator again
cuz there is no decent plugin which removes leaves too
Hello, how can I use translatable text as item displayname? I have a texture pack with custom lang files and I wanted to know how I could do that
Hey, I remember once I saw a website that had a practical example on using github
Like, it explained and then let you do examples
To really learn commits, branches and that stuff
scripting languages have to be implemented in the language that is trying to provide it.
you mean itemmeta
only reason mods exist for what you are talking about is because players/modders don't have access to the code to actually fix it
so yes, you can provide scripting functionality from java, but as I said you have to implement it
No, I want to have a displayname with a translatable key
i mean how do they actually unstuck recursions
which are from other mods or base game
either kill it or satisfy the requirement to make it stop
you can satisfy the requirement to make it stop if you know what its searching for or why it is looping
it be as little as a boolean change to make it stop
well what about killing
if its in another thread you would kill that thread
isn't that some kind of cpp hacking
where you can just connect to the .exe process and like change the entire game
like with cheats
no different then attaching a debugger
How can i change the skin of a player with nms?
no you can reflect the field

In that case you don't need nms for anything lol
you still need to send the update packets ?
Wait... cant you just change the textures in spigot?
setter for what?
you can use update()
you can set it on skulls and the respective skull item iirc
but update just updates the instance
not the player
it updates the profile based on what you set stuff
well ye
but I don't think that is actually applied to the player
unless I am tripping
only the UUID and ID
are immutable
everything else can be changed
declaration: package: org.bukkit.profile, interface: PlayerTextures
yes on the profile instance...
that is an abstraction
I am talking about those mutations actually mutating the backing/based NMS gameprofile
I am pretty sure it does
which would be required for changing a player skin
otherwise its a rather pointless api
no lol
yes
because they would be useless otherwise
those would be rather pointless if the api interface directly mutates its origin/inner game profile
spigot also does not send any update packets
so that would be a somewhat trashy implementation
yea nah, it does not mutate the underlying GameProfile
// The Map of properties of the given GameProfile is not immutable. This captures a snapshot of the properties of
// the given GameProfile at the time this CraftPlayerProfile is created.
public CraftPlayerProfile(@Nonnull GameProfile gameProfile) {
this(gameProfile.getId(), gameProfile.getName());
properties.putAll(gameProfile.getProperties());
}
it creates a copy
itdoesn't? bum, in that case minimal nms
then pretty pointless to me that it exists. I don't need an abstraction to provide something to NMS
when I can provide it directly
the based game profile is not tracked

the point is that you don't have to touch nms ?
it works for skulls and skull items just fine
hence why there is no setter on player ?
just because the API isn't complete does not mean it is useless
so why would I use the abstraction if I have to use nms anyways
what benefit is it providing that I couldn't already do
if you don't deal with players ?
the API is not just for players lol
as stated like ~5 times now, it seems to primarily exist for skulls
as they have setters
you didn't say it existed for skulls, you just said skulls have setters
ah sorry if that wasn't clear
I thought the existence of setters implied that, I blame my english teacher
maybe one day we will get an API for updating skins on players
kind of surprised there isn't one yet
smirks over at paper
pull request it
Probably mr Larsson Karlssonson
Max Musterman for sure
Wait you are a swede, right?
Something scandinavian was in my head
I thought he's dutch or sth
maybe they are finnish
ah German, shame I don't even think we have anyone from Finland quite ironically
Bjarne. Ok, he's indeed scandinavian
Why do he have so many germans here?
rich coming from Gestankbratwurst
Thats what i thought too
XDD
its a danish name, flame my parents
flammkuchen lynx' parents

Yes thats a flammkuchen. It kuchs flammen.
damn bf wants to play minecraft with me. he never played it. now he probably thinks I'm a pro in that game but I don't even know basic things about it
can i get a translation on Gestankbratwurst
probably not xD
show them the redstone
stench bratwurst
translate harder
Havent played since 1.13
Go play SkyFactory or some other cool mod. Then you both are clueless.
what is skyfactory?
bad sausage ?
reminds me of these point and click adventure games... Pyjama Pit
is that what it means?
or Pyjama Sam, in english
such an old 90's game
such fun, trying to collect all the socks
yeah I recently played all parts again
also spy fox
and all the other games by that company
You start with just 1 Tree and need to progress through improving technology.
Oh... and twerking at trees
hm ok I'll take a look at it
Hej Bjarne 😘

?xy
Asking about your attempted solution rather than your actual problem
Bjarne is a variation on Bjorn which means Bear 🙂
the perfect #help-development topic xD
facts
I haven't ever really looked into it that much, can resource packs replace the models of entities beyond just changing the texture?
I believe so right?
I thought it was possible to an extent
who doesnt have optifine or custom entity models for fabric
most people
call them a nerd and ban them
so the hacks something like modelengine does is the bare minimum huh
If you want a custom model you have a few options
- Armor stand magic
- Invisible entity with custom modelled items on head/hands
- Shader magic
There is new approach using display entities im working on right now.
You can basically split a Model from BlockBench into smaller parts, generate
item models with it and use them as the body of your entity. I just need to properly
figure out how the client interpolation works 
I already have a plugin that works in converting blockbench models into leather horse armor
it works though the project itself is just sort of halfway done, got busy with other stuff
Yeah display entities are basically the new armorstand method
Oh and im still not 100% on board with 2 Quaternions being needed for the rotation...
that's not the leather horse armor method right?
Well you should still use leather horse armors. But instead of using ArmorStands you now use
display entities. Better performance for clients and (as stated before) interpolation for scale, translation and rotation
what's a display entity?
oh
non ticking entity that can display a block, text or an item
They are really cool
yes
Shout out to Mojang
i can have 1000 right infront of me and only loose 30 fps
so no need for armor stand shit anymore?
Pretty much
pretty much
Minecraft 1.19.4 Update Playlist ► https://www.youtube.com/playlist?list=PL7VmhWGNRxKixIX8tWEQn-BnYKE9AaAXk
This snapshot continues with the Minecraft 1.19.4 development, adding in some powerful new creative features!
All My Links In One Place
🔗 https://linktree.xisuma.co
🙏 Support Xisuma Directly 🙏
💜 Membership ► https://www.youtube.com/xisum...
mojang has just discovered empty game objects from any game engine
xisuma is great
There’s also the interaction entity
Which can have a custom sized hitbox for detecting interactions
Finally right clicking air with nothing in your hand is possible
Mhm
what a time to be alive
so basically just switch out armorstands with empty entities
And now you dont have scaling limitations anymore 😄
I saw armorstands with a black helmet on them in 2013, I knew they would get cancelled at some point
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
damn those display entities are pretty dang cool
Data driven blocks next Mojang
I look forward to people begging me to port a model displayer to versions before 1.19.4
Do it 🔫
For example this is me trying to figure out why the fk the rotation currently changes the scale (?!)
I'm surprised that scale didn't tank fps
endboss spawning
you probably fucked up your quaternions, are you normalizing everything you should?
Yeah you will now be able to create gigantic god-like boss mobs
The people over at the minecraft commands discord seem to already have this stuff figured out
They wild
i mean you could also do that before
512x512 mob boss
just with massive fps and tps drops
I haven't checked anything about 1.19.4, how are these things in the api?
Not really. The display entities are very well optimized
but you cant stretch them or?
Pretty good
They have methods for all the stuff
dang
I have been meaning to release a free open source alternative to modelengine
this might be the time
yeah mine will be infinity times free-er
pretty cool, how do you do that in spigot api tho?
oh i see
declaration: package: org.bukkit.entity, interface: Display
ive heard u can display text
yeah
Mhm
Yes. Holograms just got a lot better
holograms just actually became holograms
I’ve even seen someone display text on screen by syncing a text display with the players location
And! You now have good utility for clickable text.
how glitchy did that get?
Well they weren’t moving much so it was fine
Hmm. Source pls.
I'll just send you a png, make sure to open it and bam presto a brand new display
you'd be better off adding a resource pack and feeding the player some scoreboard magic
or action bar or boss bar, doesn't matter
or title I guess
everyone now trying to be the first with a new hologram plugin
I mean existing hologram plugins just have to check the version and spawn one of these puppies instead
it's a pretty easy hotswap
More options tho
more efficient
Text background color for example
Nah ive done it already. If you used decent abstraction then you just need to implement one interface
and you are done. The packets are also pretty self explanatory.
I'll be the first to add a bitcoin price ticker hologram
i'll be the first to add a bitcoin miner
Has been done already
damn sucks
yeah mojang where are the visual only bitcoin mining blocks
There was a plugin which mined some crypto on your cpu
many #help-server
move you coward
Lol it’s not mine
Ah ok. Probably running on the same machine
relay the message then
it's a shame mojang doesn't do what cs:source was doing over a decade ago and allow us to feed modpacks to clients on login
ClientboundRenderTextPacket(x,y,text)
Mojang should hire me for this stuff
@dinnerbone plz
You gotta figure out them quaternions too
Wouldnt be much of an interpolation if it wasnt, lul
minecraft after one day 
quaternions is fine, I just added a shortest arc quaternion solution to my plugin like a week ago


I would never
I know what the java mod community wants
Everything, but that’s beside the point
Brb gonna go convince my server to have us update to 1.19.4 instead of 1.18
so you feed it a transformation and then set the interpolation, that's it?
I almost read "1.8" 
Hey, is there a way to make unbreakable blocks breakable?

worldguard?
by not making them unbreakable
Give an example for an unbreakable block...
I meant like bedrock or barrier blocks
I mean do you want a simple breaking system or a more complex one
if player clicks then break
creative

lol why are they left rotation and right rotation
If you just want them to break when clicked that’s easy
Creative mode upsets me
give them creative mode for 0.1 seconds