#help-development
1 messages · Page 1390 of 1
ok in land plugin how do i remove border its like sandstone
contact the dev?
wdym
not for you
oh sorry
what i do, is i download paperspigot purpur or tuinity, run the paperclip until server loads first time
then I go to the cache folder
and install patched_1.16.x.jar file in to maven local repo
but i think there's better way to do that
thats too smart for me
there's no other way to get fat jar of spigot on maven repo
if it would be
Mojang Studios would issue DMCA takedown on the spigot community
Since spigot is based around mojang studio's minecraft vanilla server code
and its technically their code, and the spigot is just flavour of the server
what are you talking about
im saying that you need to install into your own local repo
because there's not public one which you can copy paste like other dependencies
You only need to run buildtools if you are going to use nms
teh api is public
yes
i just use paperclip
but he's asking how can you put it inside maven dependencies
in intellij
can someone just give me the pom.xml i need to have to get BuildTools with Paper
He's asking about paper. This is spigot so I can;t help him with that
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
use this maven command to install private dependencies into your repo
Or just use spigot and you don;t need any of that
i cant change the plugin to spigot
rn
Paperspigot is Spigot
No its not
Its modified spigot fork which is fork of bukkit
Yes its a fork. It is not Spigot
If you need help with paper you need to ask in the paper discord. If you use Spigot we'll help you here.
its not working
Syntaxerror
create a new maven project and copy paste maven repo and dependency tags
in to your pom.xml
and reload maven project
and you're good to go
do you have maven installed
look in the guides section for your IDE
im not a teacher
hello i have a problem, i created bungeecord servers but i get a message after connecting. [I can't send the screenshot if someone wants to help me. I'll send on a private message, screen] what does that mean?
I am writing with a translator, please do not use the shortcut function because the translator does not translate them
i mean do you have maven installed on your pc separately
i think
input mvn into your command prompt
its not neccesary to install it, but i hate intellij maven integration of some kind of bullshit tasks
but it means error
@mortal hare please confirm the invitation to friends so I can send the screen
install maven
how
google "maven"
Or if you have, set the path variable into your maven install
yes
yep
download the maven binaries, extract it somewhere (i like to put it inside program files, just like normal program)
then search in start menu enviroment variables of system account
and in the "PATH" field add that directory you've just put your maven files in
after that reopen cmd.exe once again
and try running mvn
?paste
public Entity getClosestEntity(Location c, double r){
Entity centity = null; double cdistance = 0.0;
for(Entity e : c.getWorld().getEntities()) {
double distance = e.getLocation().distanceSquared(c);
if(centity == null || distance < cdistance) cdistance = distance; centity = e;
} return centity;
}```
i'm looking for a more efficient method of taking the nearest entity through only one location, I've been researching and ended up finding this method, but apparently it doesn't work very well, it's taking a right arm support
With that code centity is always null
right, so what would I have to do
My events are not registering for some reason
.
If yoru loadScoreboards throws any error your events will not be registered
It does not though
okay i changed the Project to Spigot
What is Fetch?
You have no field for your players you reference in yoru onEnable
Found the error log
It can't find the main class.
SaplingBoard is the main class though
you also have an index out of bounds error due to tryign to access players array thats nto initialized
you have so much broken yrou plugins not even recognised as a plugin
fuck
you main class path is not correct in your plugin.yml
InvalidPluginException: Cannot find main class com.synth.tns.SaplingBoard'`
Error occurred while enabling earthday v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "String.length()" because "name" is null
ugh
At least you use Java 15+
@eternal oxide Is there an easier way testing the plugin without having to manually drag and drop it inside the plugins folder everytime?
yes, add a copy command to yoru startup script of yoru server
NPEs can often be found by either using IntelliJ or changing a few settings of Eclipse to make it overly pedantic
ugh forgot
no images
I have a buildtools folder with the spigot jar
Where would the startup script be
where is the java jdk path?
its whatever cmd you use to start your server
I just double click the jar...
the jdk data is not in the C:\Program Files\Java\jdk1.8.0_281
mine is in C:\Program Files\Java\jdk-16
Did I not init it?
guys i'm needing a check to see if the direction that an entity the player is looking at and the opposite of his, how can i do this in a simple way? or if there is already a method for that, I hope that the translator does not disturb me
I'm not sure what you are asking
me either :/
the armor stand always when equipped with an item in his hands, always look in one direction, I need to check if the player is looking in the same direction as her
and because I'm creating a code to try to simulate as much as possible that the player clicked on that diamond breastplate
Yeah, I'm not following at all
You want code to check if they clicked the item?
What do you mean that it's not initialized?
You may need to understand class loader order
I wanted that if the player clicks on that region the code would work
you tried to access players[0] on an uninitialized array
Hmmm, maybe RayTracing
let me link ya it
my case and that I'm taking the nearest entity in that region and if it is an armor stand understand
i was using it
And why does it not work?
i will make two codes, one to see if where the player clicked and the location of the armor stand, and another through directions
But why can't you use raytrace?
Maybe it doesnt intersect when it hits the entity, no idea though
Also, make sure to use the correct raytracing method, not all are the same
I use this style of ray trace to pick up where the player clicked
Player[] activePlayers = Bukkit.getOnlinePlayers().toArray(new Player[0]);
Guessing you were talking about this, do you have an idea on how I could fix it?
@minor garnet spawn that item at armor stand head, and move whole armorstand to block corner
and even with the hitbox it wouldn't return the hand hitbox, right
im trying make this code work on older versions too
You can not instance Player
Why are you using an array in the first place here? Most often than not you will not need an array for this and you can operate on the collection in a raw matter
Because it is a Interface?
it is already a player object List, why do you need an aray?
I just want to put the active users to an array
For what reason?
@minor garnet Mmmmh, it's math.
If you don't care about where the player is clicking precisely you can do something like taking the player head pos, the item pos, substracting one to another to get the vector from the player head to the item. Check if the player is not too far, if it's ok normalize the newly made vector, and then check whether or not the look direction and this vector are similar using a cross product. Like, if the cross product is small, the player is roughly looking at the item.
If you need something more precise, I have made something similar recently, but idk if you really want it since it's real trigonometry x)
You still have to know where the item is placed precisely though
the bot is dogshit
If you want a player list
List<Player> activePlayers = new ArrayList<>(Bukkit.getOnlinePlayers());
idk why he would want it as a list tho lol

figured id send it anyways
and it is a copy either way
Yep
He's only sending a scoreboard so he doesn;t need to store any player objects
but how would I get the location of the armor stand item hand
and exactly what I'm trying to do
You are storing it somewhere, no?
Will your item be placed on top of a block @minor garnet ?
I mean, whats this for exactly? You cant have that many armour stands, you could manually set the areas if its for personal use :/
although I rotated the hand item to make it lie on the block
Otherwise, World#getNearbyEntities
wait, what do you mean? @dense kestrel
are you saying it is bad to have many armor stands in the world?
Whats the plugin for? Is it for personal use or is it meant to be a public plugin
i intend to make it public
I was just saying it may be easier to just hard code the locations of the entities into the plugin
oh
then nvm
Because it gets all of the users that are online and get's their uuid. Am I oversimplifying this? I thought not storing it removes it on server restart
i would use a database for that
You want everyones UUID?
yes
you are overcomplicating it lol
for (var player : Bukkit.getOnlinePlayers()) {}
you know you can get the uuids with a stream or a loop
List<UUID> uuids = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers()) {
uuids.add(player.getUniqueId());
}
there
Bukkit.getOnlinePlayers().stream().map(Player::getUniqueId).collect(Collectors.toList);
works too XD
Yeah
i dont do much with stream, i probably should though
Same. I only use it for reducing broilerplate code
but its most useful feature is prolly like parallel streams
public static Map<UUID, Long> sortHashMap(ConcurrentHashMap<UUID, Long> map) {
return map.entrySet()
.stream()
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new));
}
This is one of the only times I ever used it XD
LinkedHashMap can be sorted
that method legit sorts it XD
I used to make the mistake where I sorted a normal HashMap
ahh
@minor garnet Well I see one easy way of doing what you want to do:
Use raytrace to get the exact location you are looking at on the block under the item
RayTraceResult r = p.rayTraceBlocks(distance);```
You can print in the chat the place you clicked, and the armor stand position, to know the offset between the armor stand and its hand.
And then, when a player will click a block, you will be able to check all nearby armorstands to know whether the player clicked an area near the armorstand pos + it's hand offset
https://paste.md-5.net/asagegilah.js
I also have this where it gets the user data from Essentials and grabs their sapling placement count
vinny was I clear, or not? x)
Use their API. Do not directly access the user files.
@sturdy patrol the problem i am using a 1.12.2 library
but it would be interesting for new versions
Bukkit had these methods since beta 1.8
Is there a Event if a player enters a chunk?
Only Chunkloadevent
Okay, a bit of an exageration, but I would not be surprised
Then how can I make this as simple as possible. I just want to add a point to the person on the scoreboard when they place a sapling
Why not just make your own sapling placement counter?
I mean you can use the move event
How could I do that
And just check if the getTo chunk is different from the getFrom chunk
Any Code?
Minecraft already keeps track of all block placement
Vinny even in 1.12.2, as long as you can find the offset between the hand and the armorstand, you can use the previous solution, the one with math. It's just a bit less convenient
Overly complicated but https://github.com/Geolykt/Presence/blob/main/src/main/java/de/geolykt/presence/PresenceBukkit.java#L349 is one of the instances I did something like that
You probably can store the old chunk position in a long (i. e. merge the chunk X and chunk Y into a single number via bit shifting) instead of using UUIDs like I do
NMS
how can i make that if a player is entering a chunk? Please send a Screenshot or something of the Code
public void sendMessage(Player player, String message) {
PlayerConnection con = ((CraftPlayer) player).getHandle().playerConnection;
IChatBaseComponent chat = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + message + "\"}");
PacketPlayOutChat packet = new PacketPlayOutChat(chat, (byte) 2);
con.sendPacket(packet);
}
this is for above the xp bar
??
i believe, its what i used in the past
that is overly done
change the pos
or use Player#sendMessage, lol
I think something with to and from
idk
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, component);
oh, my bad didnt know that existed (i only code on 1.8.8 lol)
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextCompontent("Text")) to send a text
You want something for when players enter a new chunk?
yes
not loading a new chunk
ok, one min
thx
PlayerMoveEvent has these methods
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent event) {
/*
* Abort if we havn't really moved
*/
if (event.getFrom().getWorld() == event.getTo().getWorld()
&& event.getFrom().getBlockX() == event.getTo().getBlockX()
&& event.getFrom().getBlockZ() == event.getTo().getBlockZ()
&& event.getFrom().getBlockY() == event.getTo().getBlockY())
return;
that will abort out if the player hasn;t moved a full block. Adjust that to check chunk
It is just a bit of maths (just a bit of bit shifting) to convert the block X/Z to Chunk positions
ok, im being stupid but, how do i call another class from main?
you a faster than @dense kestrel lmao
:/
xD
I was just gonna load up the Factions Fork i work on and send ya it from that XD
public class AOTE implements Listener{
@EventHandler
public void ballFiring(PlayerInteractEvent e){
System.out.println("Test");
Player p = e.getPlayer();
if (!(e.getAction() == Action.RIGHT_CLICK_AIR)) return;
if (!(e.getItem().getType() == Material.BLAZE_ROD)) return;
if(!p.hasPermission("example.example")) return;
Fireball s = e.getPlayer().launchProjectile(Fireball.class);
}
}
xD
I have this in a seperate class than main
nice
but it doesnt do anything
😮
where do i put my code in?
I'm not writing it for you, I just showed you how to do it.
public void onPlayerMove(PlayerMoveEvent event) {
/*
* Abort if we havn't really moved
*/
if (event.getFrom().getWorld() == event.getTo().getWorld()
&& event.getFrom().getBlockX() == event.getTo().getBlockX()
&& event.getFrom().getBlockZ() == event.getTo().getBlockZ()
&& event.getFrom().getBlockY() == event.getTo().getBlockY())
return;
// There?
}```
@EventHandler
public void ballFiring(PlayerInteractEvent e){
System.out.println("Test");
Player p = e.getPlayer();
if (!(e.getAction().equals(Action.RIGHT_CLICK_AIR))) return;
if (!(e.getItem().getType().equals(Material.BLAZE_ROD))) return;
if(!p.hasPermission("example.example")) return;
e.getPlayer().launchProjectile(Fireball.class);
}
there
@cedar hamlet
what did you do?
Why did you have Fireball ball = ?
@EventHandler annotated methods always belong in a class that implements Listener
it still does nothing
the thing is console doesnt say anything about "test"
Did you register the event?
have you register the event?>
:/
getServer().getPluginManager().registerEvents(new AOTE(), this);
Can someone else please explain me how to do this with the Chunks
ok
.
@dense kestrel maybe you?
ok, let me look again
np lol
if(event.getFrom().getChunk() != event.getTo().getChunk()){
}
maybe this?
Is there any way to properly replicate the way datapacks are able to change block/entity loot? This code works but has many, many loopholes and issues```java
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
if (event.isDropItems() && event.getPlayer().getGameMode() != GameMode.CREATIVE) {
event.setDropItems(false);
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(Material.ACACIA_BOAT));
}
}
@EventHandler
public void onEntityDeath(EntityDeathEvent event) {
event.getDrops().clear();
event.getDrops().add(new ItemStack(Material.ACACIA_BOAT));
}```
@dense kestrel
Yea, that should work
oh
use Object#equals() ffs
😛
what is that?
XD
ohhyeea
}```
why do i get an error there, i want to get the next int, and if its null then do something
should i use a try and check if i get null do something?
Can someone help me!
whats the error
if i put an int instead im fine
if((ChestDragonDrop.get().getConfig().getInt("tiers." + j + "items." + (itemsCount + 1))) == 1)
like that
#has?
but i dont want to do that
primitives can never be null
ints cant be null i dont think
that's the thing I love in them
try
if((ChestDragonDrop.get().getConfig().get("tiers." + j + "items." + (itemsCount + 1))) == null){
//Code!!!
}
@sharp bough
yea that works
😄
Just note that it will not do an int cast
I have this simple question. Its more a java question but here it is. Imagine i have a Class with an object inside the field. There's getter method which i use inside async task. if i get the object reference through the getter and the class changes the field's reference to another object i will still have the old object inside the exeution thread, right? I think so, since JVM garbage collection sleeps until the last reference of an object exists, and that reference is in local runnable variable.
Is there a Bukkit thing for like
Bukkit.getEveryPotionEffectType
for?
why would you want that
ummm
PotionEffectType.values()
thx
lol
enum classes have internal values() method to get all enums
wish i had an answer for ya lol
List<PotionEffectType[]> effectTypes = new ArrayList<>();
effectTypes.add(PotionEffectType.values());
for a random potioneffecttype
why are you adding array to the list
for a Challenge
you don't need array inside the list
you can generate random number
from 0 to array.length
for (PotionEffectType effect : PotionEffectType.values()) {
player.addPotionEffect(new PotionEffect(effect,time,amplifier));
}
I was wondering does anyone know how I could create a fileball to bounce a player? In the same way that if you are next to TNT it pushes you in a certain direction?
PotionEffectType[] effectTypes = PotionEffectType.values();
int random = ThreadLocalRandom.current().nextInt(0, effectType.length+1);
PotionEffectType randomSelectedEffect = effectTypes[random];
well, now he has both
also, i wouldnt use enhanced for loop for this. it uses iterator which can give small performance decrease instead of iterating with .get()
but its performance vs readability
it costs little to nothing
does anyone know how to do what I wrote?
for this
PaperSpigot has ProjectileCollideEvent
if it collides change its velocity vector by multiplying it to -1, it would invert the vector
Yea, set a new vector for their velocity ig
im smart ☺️ (omg this emoji is so shit who likes this emoji)
☺️
This emoji is disgusting

eww
sooo disgusting
I know this sounds stupid but what is paperspigot? Should I be using it over spigot?
Most servers use Paper, its a fork of Spigot
and better performance
paperspigot is better but don't mention it here because md_5 will be biggie maddie here
Ah
purpur is even better
ConsiderSpigot on top!
Purpur or Airplane is the best
But nowadays Purpur includes airplane's patches
so meh
i prefer stability of purpur
yes that's correct but you could remove else return; in the back since its not doing anything whatsover only eating your HDD or SSD size
if first statement fails it just exits out the outer statement, thus still returns void.
also use ThreadLocalRandom instead of new Random() since you don't need to create new object on heap, thus it saves you cycles, because your thread can generate your random number
its the splash potion effect which reduces specific amount of damage no matter what
idk the name but it exists ingame
check creative mode
yes i think its harm
why isnt it working
why im getting this kick message whenever i tried to send windowclick packet
How can I spawn a falling block with block data
How do I get the block data because it can't be instantiated
Cool tip for those who don't know: if you're wanna know if the number is odd, do bitwise AND and check if the result is 1
int number = 101;
boolean isOdd = number & 0x1 == 0x1;
Hey there, could anyone point me in the right direction as to where the ClassLoader for plugins is kept? (as in, in which class, and maybe even which Field :"D )
by using that you can load internal files from the plugin's jar file
@EventHandler
public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
if(event.getEntityType() == EntityType.COW);
event.setCancelled(true);
if(EntityDamageEvent.DamageCause instanceof Player) {
event.setCancelled(true);
}```
So Im trying to do is when and cow is killed by a player (Other Entitys can hurt cows) it is set to cancelled
umm
wait
@EventHandler
public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
if (event.getEntityType() == EntityType.COW) {
event.setCancelled(true);
}
}
What i need it for is to access a plugin's methods (same goes for Bukkits, but I can get that with Bukkit.getClass().getClassLoader() too :"D ), from native code
the JNIEnv pointer isn't sharable across threads,
its only used if the plugin is not loaded at all
I want to send message in the chat saying "you cannot hurt cows" after hurting the cow
and if I do let env = jvm.attach_current_thread().unwrap();, and then do env.findClass("org.bukkit.Bukkit"), thatll spit a ClassNotFound in my face :"D
(JavaVM object is sharable accross threads)
just add the plugin as dependency in plugin.yml and import it inside
@EventHandler
public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
if (event.getEntityType().equals(EntityType.COW))
event.setCancelled(true);
if (event.getDamager() instanceof Player) {
event.getDamager().sendMessage("")
}
}
Can't do that from Rust or C++ code 😄
i thought that was kotlin lol
Nope, it's rust 😄
what are you're doing anyways
Thanks man really appreciate that!
np
So I dont like Spring boot--at all
so I'm using Actix Web, which is a web server written in Rust
and why you're loading plugins via webserver
This is the project if you're interested :"D https://github.com/TheDutchMC/rConsole
I'm not loading plugins, no
I need to access a method in Bukkit or in my plugin, so I need it's classloader
then i can call findClass on that ClassLoader
so you wanna call method through the webserver of a plugins class
This was my little test, without the classloader:```rs
let jvm = env.get_java_vm().unwrap();
let env_test = jvm.attach_current_thread().unwrap();
let bukkit_jclass = env_test.find_class("org.bukkit.Bukkit").expect("Unable to find class org.bukkit.Bukkit");
let console_sender_jobject = env_test.call_static_method(bukkit_jclass, "getConsoleSender", "()Lorg/bukkit/command/ConsoleCommandSender;", &[]).expect("Unable to create org.bukkit.command.ConsoleCommandSender.");
let _ = env_test.call_static_method(bukkit_jclass, "dispatchCommand", "(Lorg/bukkit/command/ConsoleCommandSender;Ljava/lang/String)Z", &[console_sender_jobject, str_to_jvalue(&env_test, "tps")]);
Which does not work
yeah its a bit like JS in some ways
i should give rust a try sometime
But way more powerful :"D
Oh man it is amazing 😄
Even JNI (java's native interface) isnt bad!
your code is beyond my understanding i didn't knew you can access jvm by some vodoo magic of rust
im still stuck on this bounce player crap it's killin me
i've already told you how to do it
JNI is a piece of magic beyond my understanding of how it works, but I do know how to work with it
scroll
im on spigot tho not paperspigot
Is there a way to detect the blocks in front Of you? (I’m trying to make a teleporting Wand and I don’t want the player to teleport into a block)
there's no way to do that on spigot
unless you edit the spigot's code
or do some reflection magic
protected native static void startWebServer(String configFilePath, String databaseFilePath, String staticFilePath); this is one of my Javamethods. Using javac -h . <path to class>, I can generate a C header file from it, from which I can then construct the following Rust function: ```rs
pub extern "system" fn Java_nl_thedutchmc_rconsole_webserver_Native_startWebServer(env: JNIEnv, _class: JClass, config_file_path_jstring: JString, database_file_path_jstring: JString, static_files_path_jstring: JString) {
I mean, you could use PlayerMoveEvent to check whats in front of them :/
if you want this kind of feature be implemented easily then yes
if you want the hard way
The JNIEnv object provided there would grant me access to Java functions, but it is very much not sharable accross threads, so I can get the JVM from that, which is, but to then access the loaded classes I need the classloader, which is where my original question came from
then you can stick it and implement the event yourself
i have no idea wtf im looking, sorry 😂
Understandable :"D
Wdym
ray trace also can
because the things I'm doing rn in Java would be so much slower :"D
yea
(well, 'so much', we're talking mili, probably nanoseconds, but oh well)
@EventHandler
public void onMove(PlayerMoveEvent event) {
//Get the block in front of them
}
I might switch to Paper then sounds better ngl
Yo, is this a 5% spawn chance?
int spawnChance = new Random().nextInt(100) + 1;
if (spawnChance <= 5) {
System.out.println(spawnChance);
WorldServer world = ((CraftWorld) ev.getHitEntity().getLocation().getWorld()).getHandle();
world.addEntity(cbc);
}
comment?
i tried it, but cant tell
//Get the block in front of them
yes
Let me do some sudo
this is 5% out of 100%
🙃
aight, thanks.
if I switch the external archieve to Paper will it screw up my code?
if !block(x+5,y,z){
teleport();
}
sec
ok
@mortal hare I cannot seem to find the download for paper 1.8?
Too old! (Click the link to get the exact time)
why does that exist
@EventHandler
public void onTeleport(PlayerTeleportEvent event) {
if (!event.getTo().getBlock().getType().isTransparent()) {
event.setCancelled(true);
} else if (!event.getTo().getBlock().getLocation().add(0,1,0).getBlock().getType().isTransparent()) {
event.setCancelled(true);
}
}
Something like this should work just fine
so developing on there seems best lol
choosing to develop on old versions is not the best
i see why you do it but its not very smart
yeah I get that
but 1.8.8 got that good pvp 
that is the only pull factor
and cannons
Whole fucking nether update, armor, tools, blocks > clicking with epileptic fingers.
anything past 1.8.8 breaks Factions though
wow
people hate the 1.9+ fight mechanics
@dense kestrel that works flawlessly
😄
lol
umm, i dont think any do lol
ok
check entity velocity
if it stops changing
he's standing still
if you want jump event
there's statistic increase event
from which you can get jump count
if it has been increased
cancel the event and pull it down with velocity change
8% of servers are on 1.8.8
https://bstats.org/global/bukkit
I wonder what the player distribution is.
because most of those ones are random survival servers with 2 or 3 players
i don't get it why most of the servers use 1.16.5 but use java 8
Id love to port Factions, if only I had time :/
its a free real estate
There are actually no figures on that, 6-8% of servers are 1.8 but unknown player counts
15% performance increase for just upgrading
Ive dropped java 8 support on all my plugins, I get so many issues 'why doesnt it work on java 8!' lol
i've dropped it too
Switch to java 11 or get lost is my thought :"D
java 11 is also way better in terms of performance
I'll drop it when MC drops it
PaperSpigot already dropped it right?
its deprecated
on purpur
so i don't think so
only the warning message pops up
if you're running on java 8
Yeah fair enough
Might be dropped any time then 😄
Main reason I stopped doing java 8 is because my entire pipeline is java 11 now, Minecraft was the last and only java 8 thing
for it was the reason that i own the server and i running in better jvm is way more efficient than developing in older, slower jvm
I just didnt feel like switching JDKs every 2 hours 😂
On linux its fine, update-alternatives and you're done, but Windows you gotta go change the env var, and restart your IDE and terminals :/
if i had some plugins on spigotmc i would probably not support java 8 still
eh
you can always specify the javaw path
to the executable
🤔
Yup thats what Im doing
Or, drop java 8 alltogether 😇
In other terms, is there any chance anyone knows how to make a native panic not crash the JVM? I doubt anyone's got clues, but no harm in trying 😅
Hi is there any good multi world plugins for 1.16?
Hm yeah ill give that a go
Thank you
Because this is getting old, lol
Guys, I need to know in which version the TabCompleter was introduced. Where can I found by myself this info, so next time I won't ask
The TabCompleter was introduced in 9fd9767a4a55c90bf488e2077123be8a55aaa982 which dates back to 09/10/2021
so like
basically since conception
oh
Where can I found this info?
i misunderstood the question
The Bukkit git history
Ok thanks
Think you ment 2011 there? 😅
oh
YIKES
2012
commit 9fd9767a4a55c90bf488e2077123be8a55aaa982
Author: Score_Under <seejay.11@gmail.com>
Date: Tue Oct 9 14:54:12 2012 -0500
Add tab-completion API. Fixes BUKKIT-2181. Adds BUKKIT-2602
is the commit it was first introduced
or maybe it is in the future 🤔
Hm this is interesting, is class a field of a class?
I tried calling getClassLoader, which apparently isn't a static method.
What does || mean? is it like and or or?
.class it is syntactic sugar
so I cant do Bukkit.getClassLoader(), but I can do Bukkit.class.getClassLoader(), so does that makeclass a field?
Yeah, its or
well it is really a keyword
ah ok thx
Then how the hell do I call getClassLoader 🤔
is there something similar for and?
yep, &&
Bukkit.class.getClassLoader ?
well, from native code 😅
that might have been a great piece of information xD
Thanks! :)
This doent do it env.call_static_method(bukkit_jclass, "getClassLoader", "()Ljava/lang/ClassLoader;", &[]) lol
since, apparnently, getClassLoader isnt a static method
yet I can call it without having an instance of the Class
yeah you can, you can do e.g String.class
which doesnt create an instance of String, as far as I know
Yes, internally that is resolved to the managed class instance for the String class
your class loader maintains that instance
Issue: I dont have a classloader XD
well, to call findClass you need a classloader
get_object_class found this method, that might return this instance
question at some point really becomes, why the hell do you need a class loader inside a native function xD
to call functions in Java :"D
did that change it so much o.O I can't recall having to do that
^without a JNIEnv object, since that doesnt implement Send and Sync, so I cant send it across Thread boundries
I can send the JavaVM object across thread boundries, and then call jvm.attach_current_thread(), but that comes only with the bootstrap classloader, not even the system classloader
so I need to also ship a classloader around :"D
Hi so I have multiverse-core but how do i make it so where each world has a different inventory
....not sure how though, since Im not sure if _jobject implements Sync and Send 🤔
How do i remove an item from someone's inventory ?
setItem() call, and set it to air
removeItem() would work too
thanks
ayy, this works, cool ```rs
//Get the Bukkit class and it's classloader from the original JNIEnv
let bukkit_jclass = env.find_class("org/bukkit/Bukkit").expect("Unable to find class org.bukkit.Bukkit");
let bukkit_obj_class_jclass = env.get_object_class(bukkit_jclass).unwrap();
let bukkit_class_loader = env.call_method(bukkit_obj_class_jclass, "getClassLoader", "()Ljava/lang/ClassLoader;", &[]).expect("Unable to get org.bukkit.Bukkit's ClassLoader");
just wrap it all in unsafe next time :>
:pepechrist:
If I can avoid it, nope :"D
yeah please don't xD
I'd rather stick it in an Arc<Mutex<>> :"D
didn't know the rust bindings were that advanced already tho
mut static is a big no lol
neat
the JNI-rs bindings are absolutely fantastic
Including lifetime support too!
so I apparently also need to ship a JValue for java.lang.String around 🤔 the bootstrap classloader doesnt know where to find it
and without a string, you cant find other classes, since findClass takes a String
...nope that is not the issue, the classloader magically turned into a nullpointer, bollocks.
uh, probably, use jdgui and find the inventory view class
tried to find one but can't seem to find in a playerinventoryclass
anyways
there's API method
oh, even better :"D
I mean, reflection is only noticeably slow if its poorly thought out :"D
Like e.g getting the Fields and Methods every time, rather than doing it statically
Everything costs something of course :"D
Not sure how much, never measured it but
i wonder if its very intensive
This is how I do it when I need to do reflection:
private static Constructor<?> pluginCommandConstructor;
private static CommandMap commandMap;
private static SimplePluginManager pluginManager;
static {
Field commandMapField;
try {
commandMapField = Bukkit.getServer().getClass().getDeclaredField("commandMap");
commandMapField.setAccessible(true);
commandMap = (CommandMap) commandMapField.get(Bukkit.getServer());
pluginCommandConstructor = org.bukkit.command.PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
pluginCommandConstructor.setAccessible(true);
Field simplePluginManagerField = Bukkit.getServer().getClass().getDeclaredField("pluginManager");
simplePluginManagerField.setAccessible(true);
pluginManager = (SimplePluginManager) simplePluginManagerField.get(Bukkit.getServer());
another advantage, smaller methods (yes I know the exceptions handling needs to be done)
Ouch, Am I supposed to do reflection as you guys?
Its vodoo magic. Well i sometimes abuse craft classes since those are more performance friendly
but that breaks backwards compatibility
The reflection I'm doing in my project is kindof unneccessary actually
I dont want to have to declare commands and permissions in plugin.yml, so I do it with reflection 😂
ahahhaha
Lmao same
i have dedicated command system
yup same
which registers them via builders
and it enables to have realtime autocompletion
without having it to prebake it
like the second string can be replaced with plugin.getName()
although this dependant on purpur
i might sometime backport it to paperspigot
since paperspigot handles commands differently
it uses vanillacommand dispatcher instead of datapack command dispatcher
from brigadier
I dont use any dependencies, so if paperspigot does it differently, then my plugin probably doesnt work there :"D
uhh so annoying
why window items packets requires constructor of their dependant list implementation
and then copies the contents to normal list
instead of passing the reference to it
But my plugin doesnt work on ARM or mac either, so eh 😂
What it is brigadier? Is it like a commandManager?
oeh I should dig into that
it handles all the autocompletion and the parsing of command arguments
uhm i assume that my command Manager project can go into the trash
its very flexible
i mean
the thing is
spigot doesn't use brigadier properly
you need to create your own command dispatcher of brigadier
since spigot overrides the main one
as far as i know
How it handles subCommands?
like a nodes
its very expansive for sub commands
it can have autocompletion without you providing the prebaked arguments
yea my command manager does that too, but its very inefficient because it wraps around the bukkit command api instead of mapping the brigadier itself
Can you cancel a event from a different class?
and bukkit doesn't clean up brigadier nodes after itself
if you unregister command through the methods
it leaves the tab completion inside the brigadier
should I keep my command manager or should I switch to brigadier?
keep it
it would break backwards compatibility
and would require lots of work to get it working
ookk. I'm happy
Yes
I mean you just delegate the desired class to cancel the event instance
callback to the method from the listener
or listen to the event
through listener api
yes thx :)
i would like some feedback about this plugin page: https://www.spigotmc.org/resources/transparentheads.86404/
yeah
i was first in the world to make that OWO
i wonder what education edition features you can abuse?
images, gifs, and videos i think
I didnt even know education edition was a thing
So i'm new to coding plugins and i want to ask you how would make a entity move in a direction like a fireball
idk tho if you put an animated gif as head texture. will it work.
do you know java?
kinda
you just need basics at the end if you do simple stuff
well you can abuse this to create custom blocks via armor stands without any modpacks!
get the eye location of the player and set a velocity to that vector
would really lag the player since the textures are loaded client-side
wdym
just for this
how can you get access to this edition
i think only schools can give you this
y
lets go
O.o
you can either make a student one
I need to look into this
if you can load hd player heads
if you go to the plugin page the plugin is open source
you can load hd player skins!
so you can take a dive into the code
if you happen to optimize it please let me know so i can put it on the main plugin,
it must
If I find anything, Ill PR it 🙂
how would i make the entity fly in the straight direction
put comments for author so you can have credit
as i already said you can get the eyelocation of the player which i think returns a vector and then apply that vector with a force to the entity
I might do some work to get rid of ```kava
public static TransparentHeads getInstance() {
return instance;
}
actually that is needed
for Libs
Libs what?
like if i want to get the head with another plugin
ah like that
yeah
i just get the instance of theads and just get the methods
or use service API
Bukkit has services API which no one literally uses 😄
except me, worlguard and vault ;S
could always do some funny business with like e.g public static void apiHook(<forgot what the Function class looks like> callback)
that's outside bukkit conventions
Neither is JNI 😂
@kind coral Is there a reason you dont use something like Gson for serialization?
@lunar schooner cmon man, do a mineskin like api
for education edition
ik you can do it 😄
we need a farm of education edition accounts
was planning to use that someday, still gotta learn other stuff first.
Considering it's free
Its super easy! Let me show you
you don't even need premium account to upload normal skins anymore
mineskin should migrate to education edition accounts
Take part of my configuration class:
public class ConfigObject {
private boolean debugMode, useWebServer;
private int listenPort;
private TokenObject[] tokens;
You'd serialize this like new Gson().toJson(configObjectm ConfigObject.class);
and it returns a string or a map?
String
Deserialization is similar: new Gson().fromJson(String, ConfigObject.class)
snakeYAML somewhat exists
I do some hacky stuff for yaml
but snakeyaml is way harder to parse
final Yaml yaml = new Yaml();
final Gson gson = new Gson();
Object loadedYaml;
try {
loadedYaml = yaml.load(new FileReader(configFile));
} catch(FileNotFoundException e) {
return;
}
String json = gson.toJson(loadedYaml, java.util.LinkedHashMap.class);
this.configObj = gson.fromJson(json, ConfigObject.class);
Easy 😂
Yaml -> Object -> Json -> Object 😂
I much prefer the Rust way, it's got one cohesive system (known as serde) for doing (de)serialization
works with most things, like XML, JSON, Yaml etc
that's so hackkyyyy
but it works
But it works like a charm!
oh, i was also planning on adding heads via game giving it a proper syntax, sadly i can't get it to work without breaking the config
since using getConfig()#set() will actually break everything also when using saving the resource
so this is yaml deserialization in Rust, for comparison:
#[derive(Serialize, Deserialize, Clone)]
pub struct Config {
pub port: u32,
pub pepper: String,
}
...
let config = serde_yaml::from_str::<Config>(&config_file_content);
rust looks like c++ had a child with js
all you have to do for Serialization and deserialization is derive the Serialize and Deserialize traits respectively
I mean, it sortof has, more TS though
its a low level language, but as easy as a high level one like JS
I find it is also incredibly difficult to introduce bugs
things like race conditions are just basically not possible
nope, compiled
There's currently an RFC to allow Rust in the Linux kernel, which is currently only really C
Torvalds called it 'not terrible', which knowing him is damn good 😂
how bad is jni overhead when calling methods btw ? do you happen to know that
Its not that bad
like, bytecode methods
guys wanna see the devil?
I havent really looked at the bytecode of a method with a native modifier
no no like,
how much overhead from calling a java method from native
the stuff you were attempting to do before
I USE LIGHT THEEEEME
ah, basically as much as reflection
because essentially, that's what you're doing
I mean, you also move off of native stack onto jvm virtual stack for the call
which is what I expected to be the overhead
one dark pro theme on top #1
yeah true, but I've noticed that my commands basically return instantly, which includes db lookups and whatnot
I should run Flamegraph on it
one dark is bit blurry for my eyes ,idk why
with perf^^
i use one dark for every ide i have
So since we're also on the topic of themes etc, I can highly recommend you enable Night Light on windows
Your eyes will thank you
but that doesn't burn like I want it to
it really looks good
at least for me
i dont like reds and orange colors
unless they're pastel
For eclipse I use Darkest Dark, for Intellij i use whatever the default is
I use eclipse for Java, intellij for rust and then vscode for TS/SCSS/Html, so this is a project requiring 3 open editors, fun :"D
why don't you use intellij for java
Ever tried super bright white theme?
I tried intellij for java for a while, I didnt really like it
For rust too, Im not entirely happy
pro python coder
mans got python exams
intellij rust isn't there yet 😭
true
intellij for haskell when?
