#help-development
1 messages · Page 3 of 1
to get mobs to recognize fake blocks
ez async
and not phase through them
and I made sure to jam it all the slightly modified nms methods into 1 class
CompletableFuture.runAsync(() -> {
new MinecraftServer().start();
}, threadPoolExecutor);
because I don't care
Burch and what about queueing?
that sounds annoying asf
CompletableFuture.runAsync(() -> {
System.gc();
});
This works??
Put a while loop in there and freeze ur server :)
async gc clearing lets goooo
little more complex tho
Because i want to start learning socket
Async sockets are very annoying
taking my word for it
Okay
I was debugging stuff lol
Nio?
i do the same xD but never had that many debug logs at once
Nio non blocking IO
nbio
blocking IO is fun as long as you arent on main thread
That my issue I dont know how to manage correct ly Thread for sending and rexeivingb
So I don't need to educate people on how to install redis every time they want a multi-server synchronization plugin
Agree
because latency compensation
are you only running the socket on a mc server
I was planning to do something similar
I'd just make it operate as a mesh type of thing
adding a new node to the mesh would just do some handshake and the mesh would provide its own data
Ilusión my goal in the future was to built one
I really programming and connecting things like sockets, we sockets http
I just like bashing my head at the wall after promising my support discord server I'd add multi-proxy support to my skyblock plugin
Ilusión sockets?
I tried implementing it on my skyblock fork before working on master and made like 50 packets
but it still wasn't enough
I want to make a simple pub sub
But i dont understand multi Thread ing
Basically working without free ing the whole server
😂
the players can wait
I have a basic packet manager for communication
It's basically a shitty tcp implementation running on redis that runs on tcp
ikr it sso annoying when the player says nothing moves on the sever for 1-2 seconds
like get a life smh
imagine playing minecraft
and not opening the game to test a bug for 3 hours straight before going to bed
couldn't be me
can likely show you completably futures lately but its just a lot of work
especially if ur wanting it working with sockets
im just tired lmao
I really need a tutorial for completable futures relating spigot plugin dev
i can maybe make one
I've heard about it multiple times
I would even pay for it
Like, if any of you makes udemy courses
ive done a few guides already maybe it can be my next one
nah i just write them o nthe forums
In js is so fucking easy like this random example I remember:
const ws = require("websocket");
const packet = { name: alex} ;
let res = await ws.send("route", pscket);
Why isnt thst simple java
😬
I'll just provide a practical example
Just half ass a 10 minute video in Udemy explaining how to use it with spigot plugin dev and I will straight up pay $20 for it
Before we dive into it. How is it different than bukkit scheduler?
CompletableFuture<Boolean> future = CompletableFuture.supplyAsync(() -> {
... SOME HEAVY OPERATION ...
return true;
});
future.thenAccept(result -> {
... SOME OPERATION WITH RESULT
});
future.thenRun(() -> {
... SOME RUNNABLE WITHOUT THE RESULT ...
});
bukkit scheduler runs on ticks, completablefuture runs under the expectation that a value will be supplied to the future eventually
And when that eventually arises, you can do pre-defined operations with the value
That's so amazing
you can prematurely complete the operation by calling
future.complete(value)
But there's another thing
futures like to hide exceptions
You can catch exceptions by calling
future.exceptionally(exception -> {
... DO SOMETHING ...
return newValue;
});
runAsync is just a supplyAsync but for voids, there's no return value
futures catch it and stop executing
and call the exceptionally stuff
it's basically complete under an exceptional state
It gets catched as soon as an exception hits
Just like how u catch promises for unhandled rejection or errors in js
i still dont understand
Unsupported class file major version 61 how may i fix this?
have no idea what i've done
what java version are you using?
shouldn't it be just 17 instead of 1.17?
Another thing about futures btw
if your not using a custom Executor
And you need to manually block, the future will actually complete pre-maturely with an exception
to fix it use work stealing or a fixed thread pool Executor
Create new insttances in the Executors tab
is there an app / website that you can create items in? Like to preview name / lores ect
how can I set a player's spawn point?
When they respawn set it to whatever you want
How can i block a certain cmd in a certain server in bungee?
Cant seem to find a commandevent in javadocs
Or is it ChatEvent
Ok ima try chatevent
PlayerCommandPreprocessEvent
declaration: package: org.bukkit.event.player, class: PlayerCommandPreprocessEvent
Bungeecord api??
other than ChatEvent i dont think theres another way
doubt ChatEvent even sends commands aswell
I mean there is isCommand boolean
how to teleport entities in unloaded chunks
ok jk
I tried to load it, the entity spawned and did not teleport
nms perhaps
Why would you want to do this?
if ChatEvent in bungee api knows the player, why cant i get him as a proxied player?????????
Beehive hiveBlock = (Beehive) blockAtHiveLoc.getState();
org.bukkit.block.data.type.Beehive hiveData = (org.bukkit.block.data.type.Beehive) hiveBlock.getBlockData();
hiveData.setHoneyLevel(0);
blockAtHiveLoc.setBlockData(hiveData);
hiveBlock.update(true);
this isnt working.. any ideas?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
I mean it’s not setting the data idk how else to explain it.
Hive gets full of honey so I try to set it back to 0 and it doesn’t work
You are probably using bad classes, why does one have FQCN and the other does not?
Cause I am using the block state stuff and data both.
They have different methods
.
i dont think you apply the shulker color
yo spigot gang
i made my jar using buildtools, and imported it in IntelliJ
but when I try to do maven -> package it gives error
do i need to add the jar to the pom and if yes, how?
wow thats kinda cringe ngl use maven
you don't need to manually add the jar pal
then?
just add the maven repo !
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yea but i need NMS
when you use buildtools it adds it to ur m.2 repo anyways
oh did you run buildtools remapped
whats m.2
like ur repository on ur computer
oh
read mfnalex's blog
so how do i use that repo?
it goes over everything
.
u just add the dependency
and it will take it from that repo
whats the coords
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
u add this and it will take it from ur m.2
oou
my lord bro your insane
sorry man
you don't want mojang mapping xD
mojang mapping are nms
might as well shoot yourself in the foot
xd its from work so i cant really change stuff that much
I'm sure they understand if you improve readability
the mapping doesnt matter too much
its just what the name of fields and classes are
it doesnt affect the plugin functionality just how you code
its a huge server, but i dont really care since i m getting paid for it xd
it makes it way easier to produce code
accurate field and method names help
Mojang Mappings ain't incomplete
spigot mapping are more accurate but incomplete
eh as long as they prefer d, f, c etc compared to actual names doesn't matter to much
yea I use that when I need reflection
im trying to give it a certain glow color, not shulker color
can you send the 1.8 version
Now this msg triggets 90% of this server but im forced to use 1.8 cuz kids like spamming clicks and i need bread
just change 1.18 to 1.8
well i did do that
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
how so? i made the scoreboard groups and added the entity to them
yea but i think you need to give the shulker box a color
i m not sure cuz i never worked with it
do i need to register the m2 folder?
no
have you ran buildtools fully
what parameters did u use
try remove <classifier>remapped-mojang</classifier>
it says it cant find that
have you ran buildtools for 1.8?
Unresolved dependency: 'org.spigotmc:spigot:jar:1.8-R0.1-SNAPSHOT'
yez
you wanna see hell?
they name packages likeThisCasing
and THEY DONT USE MAVEN OR SHIT THEY USE INTELLIJ ARTIFACT
I spent 2 hours refactoring this code
who does
who does this
we best hope they never show up in this server
they'd get teared to pieces
- more iritating stuff
they have two packages
itemMenu and itemMenus
the classes are identical 100%
and it confuses me everytime which one to use
I'm currently fixing code which was all static abuse
It's so bad I wish I could share it
oh yea
dont even get me started with statis abuse here
its both static abuse and DI
like 70% its static and then toher part is DI
I'm slowly converting from static to DI but the static is so intertwined it'll take weeks to get it out of the eco system
How do i add velocity in visual bukkit? (like i want it when i sneak i get launched 10 blocks in the air)
NOONE here is usinng visual bukkit, except you
visual bukkit is just a big pile of garbage and you can do everything in java like 10 times faster and 12 times better
i See that the player has the setDisplayName now why doesn;t that change the actual gamertag when seeing it from person to person? it just changes the name for like chat and stuff..
any ideas on how to clear player's chat?
Can I somehow serialize and deserialize NBT data? (NMS v1_18_R2 mojang remapped)
spam it with blank lines probably
yes
that works i guess xd
it does
alr ill do that then xd
lemme show u smth cool af my friend made
TagParser and one of the save methods on an entity
yeah it's weird but that's how mojang decided to do it
If you only have a compound turn it to a string
just call "getAsString" on the root CompoundTag
nice
That's a lot of chat spam
and how do I deserialize?
TagParser
the string IS the serialized version?
Like I said
oh deserialize
well you can just do new CompoundTag().save(SomeString)
it's called "save" but it actually loads it
it's called "save" because it "saves" the string "into" the compoundtag lol
very weird name but yeah
I've always used the TagParser
probably works too, idk I never did any NBT stuff
it also "loads" the string "into" the compoundtag, yeah very strange
yeah kinda weird. I only used this once, dont remember why, but it definintely worked like that
indeed
if it won't work I'll just use TagParser.parse();
I assume that BlockPlaceEvent#getItemInHand gives the item used to place the block yeah?
Yeah
aight
oh wait, my bad. There is no TagCompound.save(String). That's a method on NMS' ItemStack/Meta to load NBT data "into" the itemstack
I only had this in mind. So yeah, do what @chrome beacon suggested and use the parsing thing
No.. item stack in to nbt
Which is why it's called save
Because it saves item stack to nbt
yes, as said, my bad, I confused things 😄
oh and yeah I also mis-explained the save method again
just ignore me already, okay?!?! lol
Will ItemStack#isSimilar ignore DisplayName and Lore?
makes zero sense, wouldn't it just be easier this way then making teams? lol
non
dont question it, they always do wreid things lol
Okay, so I should probably remove DisplayName and Lore before comparing.
That should be everything I need to ignore, right?
What are you comparing the items for?
I want to create Recipes with Custom Items.
Bukkit API doesn't account for that
you need to use Recipe Exact choice
Works with isSimilar, so it doesn't ignore Lore and DisplayName, which can happen to be different
Doesn't isSimilar check this too?
I use RecipeChoice exact choice I never have any problems with it.
isSimilar checks everything except the amount IIRC
Yes, just checked in source.
Pretty much everything
Except for amount
I also wanted to check the source but IntelliJ died while decompiling
Lombok ❤️
isnt the whole idea of lombok that it does that automatically when compiling?

guys how do i use guice in my single module project? i wanna do real dependency injection
guice :X it's such a weird thing
what exactly is the question though
did you read any tutorial on how to use this junk? E.g. this https://riptutorial.com/guice
well you'd do it like all other guice projects except you probably wanna instance inject your plugin instance with guice
this is a double whammy - not only is it lombok, it’s inline lombok
Exception in thread "main" java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
String ts = "2022-07-22 21:30:17.293";
Timstamp.valueof(ts);
i know this has no touch about spigot but im trying to create plugin. it will be great if someone helps me anyways.
I think my plugin has a bug 🤔
Is there a way to fix corrupted plugins?
i agree
Depends
wdym corrupted
all my plugins became 6.8mb
does the decimal places need to be longer? idk
I just don't understand why 🤔
Delete them and reinstall
what is teh SimpleDateFormat you are using?
some of them were custom made by someone I paid and he stopped responded a month ago
Looks like you used the wrong format in your date. mm is minutes and you used it in your month. Change mm to MM in your month section
if I could fix those ones only thats the only ones I care about
im not using any format
im just trying to convert string to timestamp
yes you are. Thats what that error eays
Hope you have backups
so there is no way to fix them?
i have another idea
what if i convert string to instant first and then to timestamp?
you do, but you dont want to
and is it posibble to have a custom player class to avoid player data class
Not really
by not really that means there is a way?
You might be able to recover some of it
Will take a lot of time and isn't worth it
You need to set target/source version in your pom
You are building for too high Java version for your server
Exception in thread "main" java.time.format.DateTimeParseException: Text '2022-07-22 21:30:17.293' could not be parsed at index 10
Does anyone know why a bunch of plugins would corrupt to all be the same memory?
Explain better. Your query makes no sense
my whole server freezes until the code catches an exception or allows the player to go
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
final boolean[] status = {false};
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
@Override
public void run() {
String ip = "ip";
int port = 00000;
try {
Socket sock = new Socket();
sock.connect(new InetSocketAddress(ip, port), 400);
DataOutputStream out = new DataOutputStream(sock.getOutputStream());
DataInputStream in = new DataInputStream(sock.getInputStream());
out.write(0xFE);
StringBuffer str = new StringBuffer();
int b;
while ((b = in.read()) != -1) {
if (b != 0 && b > 16 && b != 255 && b != 23 && b != 24) {
str.append((char) b);
}
}
String[] data = str.toString().split("§");
int onlinePlayers = Integer.parseInt(data[1]);
System.out.println(onlinePlayers);
status[0] = true;
} catch (Exception e) {
System.out.println("Under maintenance");
TextComponent tc = new TextComponent("[NOTIF] Server is under maintenance. You will be kicked out in 60s.");
tc.setColor(ChatColor.RED);
player.spigot().sendMessage(tc);
status[0] = false;
}
}
}, 0L);
I guess you did somethign wrong when you downloaded them
Tf
second part of the code
Bukkit.getScheduler().runTaskLater(this, () -> {
if (!status[0]) {
player.kickPlayer("Under Maintenance");
}
}, 60L * 20L);
Bukkit.getScheduler().runTaskLater(this, () -> {
if (status[0]) {
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("Connect");
out.writeUTF("survival");
} catch (IOException ex) {
System.out.println("Failed whilst connecting to SMP. Error log: " + ex.getCause());
player.kickPlayer("Failed whilst connecting. Try again later.");
}
player.sendPluginMessage(this, "BungeeCord", b.toByteArray());
}
}, 40L);
}```
Can I use different ports with spigot?
Only one server can run on one port
I know
But like
Can I change the port
I want to have multiple servers on one lan
guys is it not possible to use protocol lib in mc v19?
version 61 is Java 17. Spigot requires 16 on later version
im trying to make npcs teleport users
or is 16? I forget
when they click on them using right click
its giving me a bunch of errors
16 is required
for me?
None of that requires ProtocolLib
[15:05:24 INFO]: Error Unable to intercept a read client packet. (java.lang.IllegalArgumentException: Unable to find a field null with the type com.mojang.authlib.GameProfile in net.minecraft.network.protocol.login.PacketLoginInStart) occured in com.comphenix.protocol.injector.netty.ChannelInjector@92bf135.
[15:05:24 ERROR]: [ProtocolLib] INTERNAL ERROR: Unable to intercept a read client packet.
If this problem hasn't already been reported, please open a ticket
at https://github.com/dmulloy2/ProtocolLib/issues with the following data:
Stack Trace:
java.lang.IllegalArgumentException: Unable to find a field null with the type com.mojang.authlib.GameProfile in net.minecraft.network.protocol.login.PacketLoginInStart
``` i get this error multiple errors
Unless your NPC's are fake
i tried checking online and they said its used for it
im trying to merge 2 plugins
Hey, I have the following 2 methods. My goal is to prevent all destruction by overlaying block and player, but allow normal destruction (player left click) in some cases.
However, I have the problem that when I left click, both methods are called. And the 2nd method cancelled the event. Does anyone have an idea how I can prevent this?
@EventHandler
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
System.out.println("HangingBreakByEntityEvent");
Entity remover = event.getRemover();
if (!(remover instanceof Player)) {
return;
}
for (final Team team : Team.teams) {
if (!team.getGame().hasStarted() || !team.getPlayers().contains(remover)) {
continue;
}
Location minPoint = null;
Location maxPoint = null;
if (team.getType() == TeamType.NAVY) {
minPoint = team.getGame().getArena().getLocation("navy.area.min_point");
maxPoint = team.getGame().getArena().getLocation("navy.area.max_point");
}else if (team.getType() == TeamType.PIRATES) {
minPoint = team.getGame().getArena().getLocation("pirates.area.min_point");
maxPoint = team.getGame().getArena().getLocation("pirates.area.max_point");
}
if (!Utils.isInArea(event.getEntity().getLocation(), team.getGame().getArena().getWorld(), minPoint, maxPoint))
event.setCancelled(true);
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onHangingBreak(HangingBreakEvent event){
System.out.println("HangingBreakEvent");
event.setCancelled(true);
}
i downloaded the npc maker plugin from online
and i want my plugin
to just override
the other plugin
like use the npcs from the other plugin
and teleport the user
what if they are real? how can i proceed?
they are player entities
Not at Runtime
If they are player entities then you shoudl recieve normal interact events
Use bungee stuff or smth
i tried doing that with PlayerInteractEntityEvent
doesnt work tho
does it fire at all for your NPC's?
it doesnt log the entity as PLAYER, as for other mobs it says CAT etc
no, the npcs are from the other plugin
so im not sure how they are made
If no event fires when you click on them, they don;t realy exist. your other plugin is doing everything with packets and faking them on the client
Hello, I have a question about Bungeecord Message Channels. Can you only register the channels in a bungee cord plugin at the beginning, i.e. when you start the plugin, or can you also register them later in the code because I have problems registering channels afterwards. Thanks
you can register them anytime
ah i see
so it should
log the entity
if they were real
yes
It will log it*
but wouldnt making real entities, show them when u do tab
No you can send a remove Packet after adding their info to delete them from Tab
i see
Anyone know how I can prevent this from happening?
the text being cut off?
java.lang.IllegalStateException: Asynchronous player kick!
is sqlite good for storing various amount of serialized itemstacks
Or do i even have to serialize it
I mean ideally you'd store it accordingly with rows and columns
but sure you could blobify it also
Aight thanks
Thinking of making a block that can do multi page inventory
For storing some stuffs
Or maybe an item instead of a block since I can attach a pdc to it as an primary key
Where can I get help with Java and not spigot
Depends. If it could be Spigot related at all you may get help here
No purely java
you can still ask java questions
We do discus Java things at times
but like.. you may or may not receive a pertinent answer
How can I choose within the JFrame where JButton and JLabels will be located
Apply a layout
This Swing Java Tutorial describes developing graphical user interfaces (GUIs) for applications and applets using Swing components
I've only ever known it as an Instance reference
I mean this (where "this" is the parameter name and you can call the method without actually passing a reference)
I wouldn;t have thought you could have a variable named "this". I would expect it to be a protected name
you can't, this "this" is a special case lol
that's also why you can do "something()" without passing anything
my skript wont work and my only skript plugins are skbee skript and skript-gui
fix it
We don't generally do Skript here. I believe they have a discord
ah I found it @eternal oxide. It's called "receiver parameter"
Never heard that term
choco showed it to me once and I found it fascinating
... that is valid code?
Ah I see. I don't really see the usecase of that (or better said the usecase presented there isn't really that useful), even though it makes sense
im currently trying to use item sterialization using the spigot page https://www.spigotmc.org/wiki/itemstack-serialization/
im trying to edit a diamond swords default damage value to 4
my approach was to somehow follow the config shown in the spigot page but im getting an error in which org.bukkit.attribute.attributemodifier was not found
any suggestions?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Well my first comment is, that UUID is not a valid UUID, so it will be unable to find an AttributeModifier constructor to create that
Yes. and this is also valid
new ArrayList<>().<String>clone();
Well that is something I already know
I use that quite often to tell eclipse than something can actually be null (which is not the case, but whatever) when it is annotated as notNull
It's no where near as bad as JavaScript though... 🙃
it's also funny how the last one only works in java 8 and older
class Test {
private int __; // Works
private int äöüß; // Works
private int _; // Works only in Java 8 and older
}
i wonder why did they even make it a reserved keyword? 🤔
no idea lol
I'm glad that using two is okay
I always do stuff like this
someMap.computeIfAbsent("asd", __ -> something());
lambdas I have to assume
// Counting down to 0
while(countdown --> 0) {
System.out.println(countdown);
}
this is also funnny. looks like a new --> operator
especially with ligatures enabled
no
oh well yeah
but the if doesnt contain the sout
anyway, randomly inserting links also works
class Test {
public static void main(String[] args) {
https://blog.jeff-media.com
System.out.println("Visit my website");
}
}
wdym
that compiles fine
// \u000a\u007d\u007b
```
This is a newline, closing bracket, openinng bracket
class Main{
public static void main(String[] args){
https://blog.jeff-media.com
if (true == false){
System.out.println("hello world!");
}
}
}```
```java
Compiled from "Main.java"
class Main {
Main();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
Code:
0: return
}
you of course have to add the comment
ye
// \u000a\u007d\u007b
cool how it removes the unreachable code tho
how can i add custom enchantments into the enchantment table?
You have to use the enchant event
Or inject them into registries with a bunch of NMS
I want to add it as an offer, but when it apperes (without name btw) its not clickable
well it's not needed to add it to the actual offer since it's not visible anyway
just add it in the enchant event
I recommend using an existing custom enchant plugin
Yeah you can’t add them as an offer
The client doesn’t have a matching enchantment
LootTables.FISHING.getLootTable
just populate a random new inventory and then get the first non empty item
You need to pass a tool to the context
Huh the builder doesn’t have a method for that
Me thinks you need to open a big report
Unless I’m missing something
show the full stacktrace
Go back to main thread for the actual kicking
as said, just try to use the default loot context
There isn’t one
^
nvm i put it inside of a separate scheduler which is not async and it works now
This is an int
Try setting the killer
Even though you aren’t killing anything
Hence the try setting one
Yes
Maybe it’ll use their held item for the tool
Still would be nice if you could set the item directly
Maybe open a request for that
?jira
how can i make three fishing hooks line up infront of the player?
like in this example: https://imgur.com/a/Oi7JROx
i know how to spawn them but i want to line them relatively to the player
uuuuugh I accidentally changed my intellij theme and now it looks like some toy or candy or similar lol
quite a stupid question, is it worth to do my own world manager for my plugin or should I just assume all servers have multiverse core and use their api?
?
That's alot of utils
Unless you need some MVC feature teh Spigot API doesn;t offer I'd not use it
It really depends on what you are doing.
Hi i'm new on the plugin making, i'm trying to make this plugin which makes you're max health 40 instead of 20, on level 30, but seems like i made it everytime the player level up
anyone care to help? 😅
I mean, I would do my own but the concerns I have is compatibility since if I use my own and the user has MV for example, wouldn't it cause issues?
again, depends on what you are doing
A world is a world. There is nothign different between a world you gen and a MV world
yeah, that's the idea of it lol
world management via a gui
but it has docs lol http://hub.jeff-media.com/javadocs/jefflib/
Management?
depends. if I generate a world via the api, mv could not load it, from what I saw, MV has it's own "cache" of worlds
Fun
yes, creation, editing, etc. (Gamerules, etc)
The underlying world is no different
yes but if someone creates a world with my plugin and tries to use mv stuff on it, it won't work.
So you are aiming to create a UI for Multiverse instead of using commands
I don;t really see a use case
some see it, others don't ¯_(ツ)_/¯
World creation/management is really down to the Server owner. They are not going to pick your UI over Multiverse
and the number of times they are going to use a World UI is so scarce they will just use commands
once worlds are initially setup you never use MV again
depends but sure
a UI seems a waste of time.
Well yes its exactly what you asked
You clarified your idea, I gave advice
Sure use their API, assume everyone uses MV
ok thanks
Its there in the first place
Please i need help
You save a lot of headaches using an existing api for your needs but it depends on what you really want to achieve
how can i make a damaged custom item work as a normal custom item
when i damage the item it stops working
is there a way to run this command with a plugin?
/tp ^ ^ ^10
I want to teleport a player 10 blocks away from a armor stands face
Mark its PDC to identify it
don;t issue commends. Use the API correctly. Player#teleport
yes, but how do i do it in a direction
player.teleport(stand.getLocation().add(stand.getLocation().getDirection().multiply(10));```
ah thank you
use PDC to identify items as custom
what is PDC?
?pdc
its NBT API
im doing it 1.8
Good luck then
😦
The only advice I can give for 1.8 is, don;t compare ItemStacks with == or .equals(). Use is Similar()
try it and see?
Not here
Ask purpur
why doesn't this work :c
?paste
= 30
^
That would do it each level past 30
I'm smort
is getLevel() an int?
I assume so
setMaxHealt() it's deprecated
I guess so
^ use attributes
Hi! how could I open minecraft with java -jar 1.12.2.jar? Throws me this error: Error: Could not find or load main class net.minecraft.client.Main
how can you let a player look at a entity?
Wdym?
i have a armor stand, the player turns around it and the player should look at the armorstand
So you want to force the player to look at it?
yes, exactly
one more thing about this event.getPlayer().sendMessage("text") it only sends to player right and not the entire server? 😄
yes.
bump
i guess you need to use {...} .getLevel().equals(30) {...} @charred pollen
this would work aswell right?
i guess it should
bump @harsh totem
why do you store the player, and then not use it lol
idk then. never tried to do this
java.lang.IllegalArgumentException: Missing required parameters: [<parameter minecraft:tool>]
didnt someone else have this error when trying to generate loot results? Because I have the same probblem lmao
setMaxHealth() it's deprecated, use attributes instead
how?
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(double max health);```
You need to specify the tool they're using
You can use the held item
thanks, it's just i'm working on every third level so each third level player get, they earn an extra heart.
bump
nah, that's not possible
I found the solution, you just have to use the player as "killer" in the LootContext.Builder
could i use player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(40); ?
even if there is no "killed entity", the player has to be set as "killer"
why does it throw javassist classes error?
Ah ok
setBaseValue(player.getMaxHealth() + extra hearts (2 = 1 heart))
I would argue it's better to add a modifier than it is to set the base value, but yeah
why did you cut out 99% of the stacktrace?
Why are you using Javaassist??
I've only seen people do bad stuff with it
i dont even use it
yes
What is MainL10.a()
i have no idea
huh did you obfsucate your plugin
no
lol okay ?paste your full main class pls
some functions are just called a or b or smth
I think you have malware on that server
I've seen malware with JavaAssist inject itself in to other plugins
Which might be the case here
you have malware lol
you definitely have javassist in your .jar
send your pom.xml or build.gradle pls
but pleaaase ?paste it
dont send the file
xD
nvm
You have malware I'm petty sure lmao
just press Expand?
congrats, you have malware
why are you shading all this stuff?
Can't do that on mobile
e.g. you are shading lombok
well you could just send your .jar and then someone looks at it lol
xd
yeah, file and stacktrace don't match up
but the fact that its obfuscated and doing some javaassist stuff bears an uncanny resemblance to client mod malware
so
probably malware 😬
im a bit confused on how to read/write variables from wiki.vg
if i wanted to edit the team name of a packet and the two fields under "add entities to a team", how would i do that
Are you sending the packet yourself as binary data?
Then there are no “fields” as such, that’s the order of the binary data
The structure of the packet determines what type of data is expecting to be read where
And that determines how many bytes get read
so i would just tally up the amount of integers leading up to the one i want as the fieldIndex?
You have to write all the bytes of the packet in the order provided by wikivg yeah
i have to write all of them or just in the order the wiki says?
i dont plan on creating a new team when an existing one is already there
there is no there is no net.minecraft.server.v1_19_R0 ? im sure im using build tools version
so how do i send a PacketPlayOutTitle to a 1.18+ server ?
Why not use the api?
player.sendTitle()?
I wonder
why would you want to use packets for this?
there is almost no difference between spigots api
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I have a method that fetches data from a large text file, but because the action takes a while, the server freezes and the TPS drops. How can I make this method multithreaded?
public static MultiBlockStructure getMap(String mapName) {
File file = new File(mapName + ".txt");
if (!file.exists() || !file.canRead()) {
return null;
}
MultiBlockStructure list = null;
try {
Scanner reader = new Scanner(file);
while (reader.hasNextLine()) {
String data = reader.nextLine();
list = MultiBlockStructure.create(data, mapName);
}
reader.close();
return list;
} catch (FileNotFoundException e) {
System.out.println("An error occurred.");
e.printStackTrace();
return null;
}
}
run it async, then use a CompleteableFuture or similar to retrieve the result
what is AWE?
Never had any problems with it
Oh wait
I only used FAWE
and normal WE
what's best way to remove only 1 item from a player itemstack, like the player has 16 snowballs and i want remove only 1
nvm i found the way
I got a method for that somewwhere
How do I read a file asynchronously?
using the scheduler
if it works, it works
how would i make a fake (packet) entity invisible?
because HashMap is the return value?!
Int2ObjectMap :)
good luck returning a Map from a method that claims to return a HashMap
FastUtil go brr
Ah I see. So something like:
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
MultiBlockStructure list = null;
try {
Scanner reader = new Scanner(file);
while (reader.hasNextLine()) {
String data = reader.nextLine();
list = MultiBlockStructure.create(data, mapName);
}
reader.close();
} catch (FileNotFoundException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
});
and then it again gets removed and I have to refactor lol
a HashMap is totally fine for this
remember when in 1.17, some library got removed? that was annoying. since then I don't use any included libs anymore
I even rewrote Validate class so I dont have to use the builtin apache commons
Just add it to the libraries section of the plugin.yml?
That would fix it
only works in latest 1.16.5+
when 1.17 came out, many people were still on "dated" 1.16.5 versions or even 1.16.3 or similar
Well the lib exists in older versions
I just rewrote everything I needed from apache commons and called it "cherokee" instead of "apache"
yeah but
not at the same package location
guys will EntityDamageEvent get called with EntityDamageByEntityEvent ?
org.apache.commons != org.bukkit.craftbukkit.libs.org.apache.commons 🙂 @chrome beacon
Ouch didn't know they relocated it
yeah and then I had anonther idea
I thought I just do a library plugin to make it compatible with newer versions
bbuuut
the plugin nclass loader doesnt allow to load stuff from "org.bukkit"
so that didnt work
I thought I just make a plugin that simply provides apache commons at the old, relocated package but yeah, the classloader was like "nope!"
and since then I just decided to not rely on any included libs anymore
that will break in 1.17+
since 1.17, the NMS package doesnt include the version anymore
😨
I fear the only "proper" way is modules 😦
how do I make an entity rotate around a player, kinda like hypixel watchdog
🥲
math 😛
yea the thing is
can you explain it a bit more detailled? no idea what a hypixel watchdog is
i am so good at math, god nerfed my math power
have u ever been BHopped on?
look into cylindrical vectors
theres an NPC that rotates around you in a fast motion
I dont think so?
basically you just rotate a vector in a circle and tp something by the vectors offset
ty guys
how do i make a citizens npc take damage?
Is this also for help with Maven/Java?
Java? Not really but go ahead
Alright, I need to make an HTTP Request in my plugin, but I also need to parse the json so I added org.json to the dependencies in pom.xml
Greetings everyone,
I have come to seek assistance on the topic of NBT tags. I cannot for the life of me find how to apply them to items, as the ItemStack and ItemMeta classes do not seem to possess NBT related methods. I am looking to implement things such as spawning tipped arrows with a specific potion effect. If anyone could help it would be appreciated.
But it just goes: Dependency 'org.json:json:20090211' not found
oh
Id suggest you use JSON Simple
Okay
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
Yes sir
Spigot already includes Gson
o
Thank you @eternal oxide !
lil bumpy bumpy
I got ignored :(
arrows are already covered in the API,. You don't need NBT
just set the arrow a long random name and if the arrow hit someone apply the effect
the easy way
I always wonder why the heck people still use NBT tags
PersistentDataContainer has been around for like 4 years now
there is literally no reason at all to use NBT
prob for 1.8 servers
How can I achieve it, that one player for example can join on 1.8.9 and the other one on 1.19?
is this a coding question?
If yes, hook into netty and translate all incoming and outgoing packets
if no, use ViaVersion
Yes i mean like it is made on hypixel
look at ViaVersion's source code
i mean code it vy my self
as said - hook into netty and translate all packets incoming or outgoing from/to players who use a fucked up version
or just use viaversion because it already does exactly this perfectly
?paste
tbh
i never did it
but thats annoying
just make a copy of minecraft at that point
imo servers should just have
many servers
for each supported version
e.g
one for 1.8 to 1.12
well but then all servers would be way emptier
hm
tbh
i cant use any version
above 1.17
i have some weird issue
where on any version >= 1.18
every around
1 or 2 seconds
i get 1 fps
so my fps is like dis
144 fps -> 1 fps -> 144 fps -> 2 fps -> 144 fps -> 1 fps
💀
and the thing is, this happen even in the main screen
like when u start mc
i dont need to be in a server or a world
weird, maybe message mojang support lol
Do you have the fabric mod suite from caffeinemc ?
idk who plays minecraft without it but that might help your FPS issues xD
Sounds like the ram is being all used. Check f3
com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonPrimitive
???
I don't understand what's going on now
String returnString;
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
Gson gson = new Gson();
JsonObject jsonObject = gson.fromJson(response.toString(), JsonObject.class);
returnString = jsonObject.get("extract").getAsString();
How to check if inventory is player survival or creative inventory (only the one where you have the armor and stuff)
nevermind i had a smoothbrain moment
does anyone know how to make maven generate the jar in some other folder
So I was looking at some files and came across command.yml I was wanting to know more about it so I copy the website address and led me to the bukkit wiki. Instead of showing me the actual wiki part of command.yml it shows me random text from a language I do not understand. I was just wanting to know about the command.yml.
Something like this and it keeps on going having more to it
Lórum ipse talán a körös, völő a legkevésbé aggod
doesn't sodium like, absolutely trash optifine in terms of performance gains ?
bumpz
I couldnt play without xaero's minimap and world map
yes
it boosts my fps tho
reads this on macOS
also did I miss something? because last time I checked, minecraft itself also wasnt open source 😛
ultra bump
spyyyglasss
bruh
not like there isn't a fabric plugin for that zoom xD
I get 1 quadrillion fps on vanilla
I get -1 FPS due to integer overflow ?
brah
I get Double.POSITIVE_INFINITY fps on vanilla
I mean, these days it is pretty much it is like, not open but like shared source
i get NEGATIVE_INFINITY
boooon

I have a very stupid question which should be really easy yet I'm stuck on this for some reason...
Code: https://mystb.in/PersistentExceedMillions.php
Error: https://mystb.in/AdamsViennaDeutschland.markdown
line 37 is scanner = new Scanner(nameListFile); btw
the site doesnt load for me
did you create the datafolder?
yes
the folder saves but theres no surnames.txt inside it
why dont you just do new File(getDataFolder(), "surnames.txt")
instead of hardcoding the path
i did not know getDataFolder was a thing lmao
now you know 😄
getDataFolder() returns the folder at plugins/YourPluginName/
its part of JavaPlugin class
hm but the saving part doesnt throw an error?
what does the saving error say?
is that the full error?
[22:33:03 ERROR]: Could not load 'plugins\AnnihilationCore-1.0-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `Main.AnnihilationMain'
So this is the error I get, even tho I do have the file in com.annihilation.core.main
yes the yaml has that path as well
btw instead of using Class#getResourceAsStream, you can just do saveResource
YourPlugin.saveResource("surnames.txt")
then it automatically saves it
oh really
really 🙂
declaration: package: org.bukkit.plugin.java, class: JavaPlugin
com.annihilation.core.main is not Main
it has a replace param too
yeah but
so i didn't even need to check if it exists and all that

