#help-development
1 messages · Page 1917 of 1
Which of course not everyone does, but I do it so for me it’s not very nice
sounds like unit tests need to be made better to cope with statics
That’s besides the point
Well, statics are part of the language, makes no sense to have a test that can't cope with a native function XD
That static is useful is already true
I use my users as a unit test
But that doesn’t mean every single usage of it is useful and properly implemented
Anyways, statics are not bad if what is being referenced isn't going to be GC'ed anyways
Wat
@wet breach do you know a solution. I still can't figure this out
They’re a part of the language but that shouldn’t inherently mean they are compatible with everything
statics prevent objects from being GC'ed but if the object being referenced was never going to be GC'ed anyways regardless then the usage of static doesn't really matter
That’s also besides the point
imagine..
Lul
It still doesn’t make it easier for us to unit test with static apis
Just be Bukkit
(Or well apis that provide static methods)
Well then I don't understand a test that isn't compatible with something unless you just have an odd strict standard of not using statics thus your test not handling it o.O
Because we can’t mock that method (unless you use sth like power mocks)
Unit tests is about testing an implementation of a unit
statics in Java were part of the language long before unit testing was a thing
Therefore you wanna isolate it from other units and components
one way to do that is by mocking the dependencies
statics were made for C programmers
Which can’t be done if static is used improperly
So they can move to java without re-learning
static is fine for constants and utility methods - anything that does not have state
Yeah static is state is horrible to every degree
Otherwise, thats global variables... 🤮
Like geez, what are you gonna do when you start multithreading your app
Okay for singletons maybe fine
(Lazy ones)
I have a static API class that holds an instance of my plugin 😈
☹️
Update your depenencies
😡
HELLP I keep getting [ERROR] /C:/Users/angel/IdeaProjects/Core.git/src/main/java/network/palace/core/utils/ErrorUtil.java:[50,124] cannot find symbol symbol: method getRankId() location: variable DEVELOPER of type network.palace.core.player.Rank and cannot find symbol
This isn't really true. Static was added for memory management purposes
Do you have a method getRankId() in the class Rank or any of it's superclasses?
Yea
I mean I guess people could just do Bukkit.getPlugin(“myPlugin”) instead
It only happens when using the maven compiler plugin and only that
Then make sure that {, }, ;, etc... are set up correct
There is a fucking. Service. Manger
I personally use a lot of static abuse in one of my projects because I inherited it's mess
But I'm slowly cleaning it up, just takes ages to do so since I don't like to break ABI
I am getting ```Compilation failure
Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider network.palace.core.plugin.processor.PluginInfoProcessor not found
Okay maybe like 3, but still
Is that an annotation processor failing or what?
Im newer to coding so not sure but I think so
(why do people use them anyways?)
No clue
This is an open source plugin I am updating to work again
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 214 source files to C:\Users\angel\IdeaProjects\Core.git\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider network.palace.core.plugin.processor.PluginInfoProcessor not found
[INFO] 1 error
[INFO] -------------------------------------------------------------
Hm, could you link it to me so I could try to figure out what is happening?
Yea, I will send you my version since it has all the updated dependencys
yes. The project they are trying to compile uses annotation as the project uses reflection. The reflection is necessary because it downloads the dependencies at runtime/injects them instead of having them shaded in.
Because the error message in itself is almost useless to me (which is rare)
Hm, so it could just be replaced with spigot's new library feature?
they forked the project in question
so they can literally change the code to instead shade the libs
Yeah, I'd get rid of it either way.
you are not the first to attempt to help but the problem is trying to figure out what annotation processor it is requiring
but I had already recommended in just removing the annotation stuff and removing the reflection code
But they have stated they don't know how to do that =/
I removed the annotation stuff and it errored everything
🤨
so...we are at this circular problem currently
Did you try prepending src/main/java to https://github.com/PalaceInteractiveArchive/Core/blob/master/pom.xml#L129?
yes, but we figured out what the annotation stuff was for, and its for the reflection code. Another person already looked at the reflection code and determined it downloaded dependencies and injects them at runtime. So overall what you could do is just remove all that instead and just shade the dependencies at compile time and thus the project doesn't need to do anything of that sort at runtime and shouldn't change the overall functionality of the plugin
This happens when I disable it https://gyazo.com/eb7eee7d3b131f5465cf78c8278a0ae0
oh no, lombok
Yikes
You are better off aborting your project of yours than working with lombok
Do I delete everything related to lombock for it to work?
you could
Or just run delombok
it originally isn't there's it is a project they forked and are attempting to compile
but ran into issues compiling
but they seem to be unwilling to do any modifications to the code
to get it to work
so we are this circular compiling problem XD
well they are anyways
I am you just wont tell me how
you need to know how to code
Thats the thing. I don't. And everyone I have tried to pay refused
while you can remove stuff, it doesn't mean some things won't be needing to be slightly changed
which requires knowing java coding
I could try to update it, but given that it uses lombok I am demotivated to do so
Using lombok is the perfect way of getting your project to end up in a graveyard
How does $20 👀
I don't have any infrastructure set up to accept any payments (laziness is pain), so money is irrelevant for me heh.
The main reason I want this to work is because another plugin I have needs this to work (I thinkk
This is the one I need to work
which requires a dependencie from core
there is no where you can download the compiled version already?
Nope it errors
Oh compiled
nope
they said it won't because the stuff was outdated.
So I put in to date
but now I can't get it to compile
I did once
but it crashed my server every time
Oh and it using mc 1.12.2 is not a good omen either
Not my choice
I have already tried updating smaller plugins but those are an extreme pain to get working
There is no such plugin that does firework/lazer shows syncronized to open audio MC besides the show plugin above
actually, I recall seeing one on this discord
Oh, but that is not synchronized to that
if you are willing to pay someone to update something that overall may not work anyways, why not instead pay someone to make you a plugin that does work with open audio
I tried. No one does anything in 1.12 anymore
yep one of the downsides of running outdated software
As it should be
is there a reason you need 1.12 specifically?
I just want this stupid show plugin to work
what if someone could make the plugin for the latest version?
there is events you can listen to where you don't need to do this
Guys, we need help. How to specify the desired potion in code in JSON format, I need for datapack
couldn't you just use the name of the potion?
I asked and nobody wants to do it because the project is so bgi
sounds like you need to advertise in some other areas as well as it might cost a bit more then $20. I have no clue since I don't really know what it will require in terms of syncing with open audio
Yes, that's the problem.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
or just download a datapack that does something with potions
and just look to see how they did it
Okay, I'll try
Hi. I Using Java MC Server Version 1.16.5 (Spigot). But if i using spigot plugin FAWE Version 1.16.5, i got no command proposal in command line prompt. Did you have any idea?
maybe they did not support it in 1.16.5
Version 1.16.5 should be supported. https://www.spigotmc.org/resources/fast-async-worldedit.13932/
Guys is there a way to change someone's name above their head without packets?
If not, is the "PLAYER_INFO" server packet the correct one that I should be using ?
teams?
The installation instruction did not working as described on https://ci.athion.net/job/FastAsyncWorldEdit/. If i start Server (1.16.5) with installed Java Version 17, the server can not start because of crashes. Failure Log (look last line): [mine-hoster Daemon]: ---------- Detected server process in a crashed state! ----------
[mine-hoster Daemon]: Exit code: 0
[mine-hoster Daemon]: Out of memory: false
[mine-hoster Daemon]: Checking server disk space usage, this could take a few seconds...
[mine-hoster Daemon]: Updating process configuration files...
[mine-hoster Daemon]: Ensuring file permissions are set correctly, this could take a few seconds...
container@mh-cloud~ Server markiert als starting...
[mine-hoster Daemon]: Pulling Docker container image, this could take a few minutes to complete...
[mine-hoster Daemon]: Finished pulling Docker container image
Picked up _JAVA_OPTIONS: -Dlog4j2.formatMsgNoLookups=true -Dcom.sun.jndi.rmi.object.trustURLCodebase=false -Dcom.sun.jndi.cosnaming.object.trustURLCodebase=false
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment AdoptOpenJDK-17+20-202105062337 (build 17+20-202105062337)
OpenJDK 64-Bit Server VM AdoptOpenJDK-17+20-202105062337 (build 17+20-202105062337, mixed mode, sharing)
:/home/container$ /usr/lib/jvm/java-17-openjdk/bin/java -Xms128M -Xmx3072M -Dterminal.jline=false -Dterminal.ansi=true -jar spigot-1.16.5.jar
Picked up _JAVA_OPTIONS: -Dlog4j2.formatMsgNoLookups=true -Dcom.sun.jndi.rmi.object.trustURLCodebase=false -Dcom.sun.jndi.cosnaming.object.trustURLCodebase=false
Unsupported Java detected (61.0). Only up to Java 16 is supported.
with player_info or editing profile you are limited to 16 characters
including color codes
Soooo, yes, teams
dont use java 17
But the instructions on Spigot Website shows "Java 17 is required - If you are unsure how to update your Java versions or run several versions alonside".
for 1.16.5 ?
The Server works with Java 16. But why i got no command proposal in command line prompt for (FAWE Version 2.0.2)?
maybe they did not add this feature there.
Yeah maybe
Just report this as a bug to their issue reporting site
many thx. i will do it!
how would I go abt spawning a armor stand behind a player, i’ve got the like world.spawn stuff but I don’t know how to use vectors or yaw and pitch
does anyone know how to call gradle tasks in sub modules sequentially
from another task in the root project
^ for more info
or programatically
i dont know what its called
Anyone in here that can explain me how to add .jar files from {project}/lib to maven ?
Thank you!
It is however best to find some random repository (or create one) to host the jars
? What do you mean host the jars
Ugh

push the jars to a github repo that you hijack as a maven repo
or use a more traditional approach, but not all people can do that
(Pssst. You got a tutorial for this?)
Simply publish the jar to the local maven repo
I think I misunderstood everything
I understood it as in add the jars in xyz/abc to the maven pom, where you could use the system scope but I'd advise against it as it damages the pom.
But if it is just installing some rando jar to maven local then yeah, that would be the correct approach
Damages the pom? I assume you mean makes it less likely to be sharable but at the end of the day I'm not the boss of what people decide to do. They want to make it difficult to make a project that's easy to work with 
Damages the pom as in transitive depends do not work anymore for anyone using the project as a depend
I don't fully care about that anyways given I always remove them manually but it is something you may want to know
If you shade it at the end of the day it's not going to matter
that is true
After the core plugin I made is closed, it will cause other plugins that depend on this plugin to crash. Is there any solution?
Emit some kind of event to signal a shutdown I guess
But this feels a bit wrong (but hey, I had this issue when I used minestom back in the days, could be that bukkit also has this whack plugin lifecycle)
Make a shutdown event that makes all other plugins shut down. Or have those plugins register to your main one and then when the main shuts down it can also do the same to them
How do I use this.bP.a(1, new PathfinderGoalFollowEntity());
??
I was trynna make a custom mob follow a specific entity
custom entity but not understanding how you use a pathfinder ?
Hey,
Does anyone know how the server sends the permission level to a player?
I want my admins to be able to use F3 + N to switch gamemode, without giving them op
if there is no permission for that or a method you need to touch nms probably ... if you know how you could check packets
Yeah, I already thought I have to use packets, but still couldn't find how the server actually sends the player the level
Can I retrieve tile entities from another thread?
not with the api
Is it technically doable to make a plugin that forces a player / the console to execute a command before the player logs off the server and is disconnected?
yes
Depends how they leave though and it'll most likely end up being a race condition
Hello, is there a way to cancel a task inside the task? I mean like this:
Bukkit.getScheduler().runTaskTimerAsynchronously(getPlugin(), () -> {
if(condition) {
//Cancel the task
return;
}
}, 0, time);
oops it's task timer not task later
you need a runnable for that
public void run() {
Player[] players = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
for(int i=0;i<players.length;i++)
{
System.out.println(players[i].getDisplayName()+ " is at " + players[i].getLocation());
}
}```
is this correct to send every player's location out to log?
ok so yeah kinda
but this is a learn java moment
Okay, but how am i supposed to cancel the task using a runnable? i don't see the cancel method
yes just started
Bukkit.getScheduler().runTaskTimerAsynchronously(getPlugin(), new Runnable() {
@Override
public void run() {
}
}, 0, time);
i have something like this
but i can't call the cancel method
Pretty sure dictionaries in Python are Maps in java
dict = {"a" : {"a1": 1, "a2": 2},
"b": {"b1": 3, "b2": 4}
}
Whats the java version of a python nested dictionary?
I am thinking of a HashMap but I cannot figure out how to set the values without making 400 put statements
i see there is a BukkitRunnable and with it i'm able to do this.cancel(); inside the run method, i'll try this
i also see it's deprecated to use it so idk if it would be the right way but if it's works then it's fine
Map.of() apparently
maybe something like this java Map<Float, Map<Float, Integer>> nestedmap = new HashMap<>(); nestedmap.put(.0F, new HashMap(){{put(.0F,0);}}); nestedmap.put(.1F, new HashMap(){{put(.1F,1);}}); nestedmap.get(.0F).get(.0F);
Nested maps
Map<String, Map<String, Something>>
or hashmaps
you could even nest an array in a map too
doesn't have to be another map
Apparently Double Brace Initialization has terrible performance. I want it to be final anyway so I think I'll try
private final Map<String, Map<String Object>> STUFF = Map.of("a", Map.of("a1", 1, "b1", 2), "b", Map.of("b1", 3, "b2", 4));
Map<String, Map<String, List>>
Map<String, List>
Gonna ask this again, since I got no response; I'm trying to write to a json file using the gson library. To write to a file I'm using a hashmap, I can easily create simple files using the put method for example:
map.put("name", "John Deo");
map.put("email", "john.doe@example.com");```
I'm having trouble with creating more complex files like this one though, could anyone give me some advice, example or reference? ```json
{
"groups": {
"group1": {
"owner": "UUID",
"members": [
"UUID1",
"UUID2",
"UUID3"
]
}
}
}```
if args[0] is a boolean ^^
it is not
but its mostly a string in that examle so No
how do i check whether a variable hold a value
maybe check if it's null
args.length
?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.
well if args[0] is possible it is set (null or the representive obj)
if (!(args[0])) System.out.println("Error");
Location x = player.getWorld().getChunkAt(10, 20).getBlock(8,320,8).getLocation();
player.teleport(x);
}```
does args[0] == null
work?
do args.length first
if there isn't a specific reason for using JSON in a file, then I suggest using a different format such as yaml because JSON was never designed for as a storage format
^ check for amount of arguments
if you do args[1000] but the args.length == 0 you have a big problem in your console
I've read json is a lot more efficient for holding larger files, I'm working on a group chat plugin which stores the chat name, owner and player, will yml not be slower?
i think yml is slower
why are people using equalsIgnoreCase for commands tho
json is just a little bit more work with syntax if you use it as config
so you can write capital or not capital whatever you like
capitalization?
It's not meant to be a config in my case, more of a database
or is the command name the text you type after / instead of the cmd name you actually registered?
tbh checking command name is the worst way to do commands either way
you should use a better storage for the database ^^
What do you have in mind? sql?
it depends on how big the project is ... json is a bad idea after a lot messages
mysql, h2?
SQLite
mongo ❤️
idk what the difference is between sqlite and h2
google it
h2 is faster
mongo is for noobs
mongo is the best
well it's not a big project and I'd like to learn how to use it for the future, that's why I asked the question :)
if you're learning it for the future, use databases
json is fine and easy, but i'd support both
Map<String, Map<String, Map<String, Object>>>
looks like to me lol
yikes lmao
Not using guava tables 🙄
seems very inefficient
so uh
i’m assume this very inner one is an object - so just make a Serialize method
which returns a Map<String, Object>
wtf is this
then shit all group into a list
that looks more like yaml
what he was tryna do, granted the last one is wrong
but i think json works the same way
yeah I think I'm gonna switch to sql haha

Cannot resolve net.md-5:bungeecord-chat:1.16-R0.4
how to fix it?
tha nk you though
now getting Cannot resolve com.google.guava:guava:21.0
which repo is it?
what the hell tho
well you need the guava repo ig
Too many elements
Map.of with the newer java version doesnt have a fixed size?
How did you achieve this LoL
iirc
I am new in java. so I don't have much knowledge about this👀
What the fucj
A map can only take 10 elements!? Whats the point
or wait its a map so probably
why not use an enum
I dont know what that is
?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.
no, the method takes a 10 times a K, V pair you cant make a method that takes an infinite amount of pairs
No, thats a convenience method limitation. You can use ImmutableMap.Builder from guava or Map.ofEntries
it would work with a list with just varargs but that isnt possible with a map
I was recommended to use nested maps
how to know what plugin folder name?
getDataFolder
What's involved in naming that folder
Does anyone have an idea how would I go about killing all entities in a certain area? (coords)
It doesnt seem applicable, I need to map my custom enchants to values
I want to read files in Datafolder but idk how to set datafolder's name
The only thing I can find in google is command block stuff which doesn't help me
DataFolder name is your plugins name iirc
location.getNearbyEntites(5, 5, 5).forEach(Entity::remove);
thank you!
enum with identifier and map inside?
you would use the constant's name instead of identifier tho
yes
yes
thanks ill try itt
You can't do a lot of things right away with the respawn event
yeahh thats what i was figuring
Please can you show me a brief example
Map<String, String> items = Map.ofEntries(
Map.entry("key-1", "value-1"),
Map.entry("key-2", "value-2"),
Map.entry("key-3", "value-3"),
Map.entry("key-4", "value-4"));
I've also seen this
is your CustomEnchants already an enum?
No its a normal class which inherits from Enchantment
I just followed a tutorial and it said it had to be done this way to work with things such as essentials
Learn how to create Custom enchants for Minecraft :)! I will "attempt" to teach y'all how to register custom enchants as Minecraft enchants! Hope y'all enjoy the video :D
----- Support me & more -----
Patreon:
https://www.patreon.com/codedred
Donate to me :)
https://www.paypal.me/CGMax
Join my discord:
https://discord.gg/zMzXSgk
------ Li...
hmm i dont like codedred for a reason
It is more compatible ootb that way
Could I perhaps add to the wrapper some attributes and make some getters for them
But it isn't supported
Instead of everyone telling me what not to do how about tell me what to do, constructive criticism please
..
i would do ```java
public enum CustomEnchant {
BLADEBEAN("bladebean", "Blade Bean", 2),
SWORDSDANCE("swordsdance", "Swords Dance", 5);
private final String namespace;
private final String name;
private final int maxLevel;
CustomEnchant(String namespace, String name, int maxLevel) {
this.namespace = namespace;
// ...
}
String getNamespace() { /* */ }
String getName() { /* */ }
}
however i dont understand an enchantment having a namespace and a name which contains spaces
gotta use a namespace to register them
in the same way make a static method to register them in that enum
oh right
and Enchantment is not an interface so that would cause problems
how about I just add
private final ItemStack item; and this.item = item and make a getItem()
Why are all the methods in the wrapper overriden
dont ask me where codedred got his idea from ._.
can someone help me?
I know exactly where he got it from
i guess multiple items can have that enchant?
All my custom enchants are one item only
i dont like his tutorials because he uses very bad and old techniques
But functionally this would work right?
then i would have an CustomItem enum tho as it's not the enchantment which decides where to apply itself on
Is there a way to set the perspective of a player to an npc? Would it be through a packet or is there a method for this if it’s possible?
Packets
Ive recently comverted a project to maven but when i try load plugin in server it says invlaid plugin.yml does it need to be in a different location when its loaded with maven or somthin
Does it really matter
should be in src/main/resources
Ok thanks
just a bit single responsibility principe but it wouldn't really matter, its your plugin
ok this is my first time using git inside intellij
is it possible to create branch from the intellij itself
without going into CLI
Like database normalisation?
wha- no
How everything should depend on the primary key and thats it
kinda..
why are these all overriden?
because you wrapper extends the abstract enchantment class?
unfortunately not an interface, sigh
Right
Enchantments used to be an enum iirc
Maybe, but spigot is finally moving away from those
Because enums are not expandable
yea..
Same reason most things are moving away from enums
Minecraft is becoming increasingly expandable
and declaring constant fields with objects inside is more expandable
declare enchantments in enums
use EnchantmentHolder
for storing dynamic data of enchantment
particular to the item itself
Everything should be registries
I thought they still are
i think by saying that, you mean runtime expandable
anyways what is a ProxiedCommandSender again? is that bungee?
iirc, yes
No
any gradle experts here?
anyone know how to change the compiler in gradle like I did with maven here? ^^
anyone?
yes sure
right click project -> git -> branches
Hello again, i have a list of blocks and i want to sort them. I want that block y from lowest to highest, and i want x and z to be closest to specific number. For the y thing it's okay, but for the x and z i don't know how to proceed. My current code is:
List<Block> sortedBlocks = blockList.stream().sorted(Comparator.comparing(Block::getY)).collect(Collectors.toList());
Does anyone know how to sort this list so that y is lowest to highest and x and z are closest to a certain number?
create new branch is grayed out
git checkout -b branchname
in CLI yes
create a custom comparator
Dun intellij have cli
Do you know which packet/s?
Show tree
okay
What branch are you on?
anyone?
I love how noone really fully understands gradle lol
@EventHandler
public void onClick(InventoryClickEvent e) {
if (e.getRawSlot() == 5) {
System.out.println("Here");
Player plr = (Player) e.getWhoClicked();
ItemStack helmet = plr.getInventory().getHelmet().clone();
ItemStack current = e.getCursor().clone();
plr.getInventory().setHelmet(current);
plr.setItemOnCursor(helmet);
}
}
``` Why doesn't this work?
yeah ive been using it for like half a year and all i know is how to include dependencies and make tasks
registered it?
?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.
technically no because even json is still readable text so both would be equal, sorry for taking so long to respond
also is the raw slot even 5
I am trying to make it so I can place a block on my head as a helmet. It doesn't call the event when trying to place it on the head
how do you know it doesn't call the event?
I debugged it
you don't have any debug statement to see if the event gets called in that code though
I had before
It calls when I place a helmet but when placing a block it doesn't call cuz it actually doesn't get placed there
i like gradle because it allows you to actually code the build system
but i have no idea how to use it
or code it
or do anything with it
when placing a block?
it is called
and it throws a huge console error
[16:33:31 INFO]: [Test] [STDOUT] Here
[16:33:31 ERROR]: Could not pass event InventoryClickEvent to Test v1.1.8
java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.clone()" because the return value of "org.bukkit.inventory.PlayerInventory.getHelmet()" is null
at de.jeff_media.test.Test.onClick(Test.java:35) ~[Test-1.1.8.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor18.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:git-Paper-68]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleContainerClick(ServerGamePacketListenerImpl.java:2817) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:58) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:13) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.1.jar:git-Paper-68]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1413) ~[paper-1.18.1.jar:git-Paper-68]
at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:189) ~[paper-1.18.1.jar:git-Paper-68]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1391) ~[paper-1.18.1.jar:git-Paper-68]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1384) ~[paper-1.18.1.jar:git-Paper-68]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1362) ~[paper-1.18.1.jar:git-Paper-68]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1268) ~[paper-1.18.1.jar:git-Paper-68]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-68]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
ofc that would cancel it
you cant place a block as helmet by default
Ik why that doesn't work but I do not get that error
you have to get it from somewhere in the inv
maybe set the priority to highest
Just check if it is null
and use getCursor() instead of getHelmet() because it obviously is null
if it doesnt place into the helmet slot
this is 100% the code you sent. it gets called, and it throws this error
I'm using both
if you try to set a block as helmet, isnt that blocked by vanilla?
Hmm I am on 1.8 probably makes a difference
sure it is, but that doesn't mean that no event is called
oh you should mention that you used 8 year old versions
oh
did you by any change try it in creative mode @modern fox ?
or did you try in survival?
There you go
no clickevents for that
sometimes my knowledge isnt enough 👀
Thank you
np 😄
Lmao
whenever I can help someone, it's just because I remember I did the same mistakes years ago lmao
same thing
also @modern fox
you also want to listen to InventoryDragEvent
e.g. check this
when you move the cursor a bit, it does NOT call clickevent, but only dragevent instead
even when you only move the mouse for a 1/20th second on the same slot by accident
another pain
damn i learned something new
that you can provide a method reference instead of passing this and extending an abstact class
wdym
i thought you had to implement CommandExecutor to make it work
ItemMeta
You still have to
not if you pass a method reference with the same signature
Then why are there red squiggles
that orange, npr
Ohh
kinda fancy
Ohh command executor is indeed a functional interface
It only has one abstract method lol
Ok learnt sth new
can I post picture to url here?
If you get verified you can even post pictures here
even videos 🤩
hmm ok
Has anyone received their hacktober fest shirt here
while (compute) {
try {
Socket socket = serverSocket.accept();
Bukkit.getScheduler().runTaskAsynchronously(plugin, new ArenaSocketTask(new InterceptedSocket(socket)));
} catch (IOException var2) {
var2.printStackTrace();
}
}
This keeps accepting sockets forever (I have a print statement in ArenaSocketTask)
Do you ever set compute to false
Yes, if the server shuts down
If the server is down
But all sockets have the same port
compute is not even there anymore
The problem is that it keeps accepting sockets from the same port
Then it runs 100+ tasks for the same socket
Or is this how it works? I have no idea about socket programming
The sockets are not all the same wdym
localport
Or is that how it works?
I will ask my friend how many servers he has on the same socket
I think you should getItemMeta after setting type
The type of meta depends on type
If you get
No you don't
I don't see a getItemMeta call in there
Oh you call getItemMeta each time
Before setting lore
You should settype
Then getItemMeta
And setlore on that meta
Then setItemMeta with that meta
Maybe ItemStack silently rejects incompatible meta
where did you get that ItemMeta from?
is it worth overriding both equals and hashcode?
yes
Depends
i mean if you override equals which does not use hashcode
you should always do that for custom objects
hashcode is e.g. used if you put your stuff in a HASH map
ah right
you don't need hashcode but it will be faster if you have a proper hashcode method
also lombok or intellij can create that automatically for you
ItemMeta
oh i manually overrid it everytime
just do this: 😄
What if you dont override hashcode
Wont it use that default method too
yes but that's bad because it will return the same hashcode everytime
who needs lombok
it will not
If only java had like super convenient data only class types now that implement all of that for you
Would be record breaking to just define them easily and not care about hashcode or equals
oh yeah right, it will however return different hashcodes for "equal" objects
Yea
yeah if only records would exist, smh
why has noone invented them
😔😔 java better hurry
yeah tbh they should have been added a long time.... e.g. in java 14 or sth like that
but fr; I'm still on java 8 for most things anyway so I can't use records anyway 😄 I just do Lombok's @ Data
if i'm like having 8 fields i would need to check for all of them in equals method
if they specify equality
Just press Alt+Insert and click on "equals & hashcode" lol
that looks like
return Objects.equals(getChatProfile(), user.getChatProfile()) && Objects.equals(getStatisticsProfile(), user.getStatisticsProfile()) && Objects.equals(getMembershipProfile(), user.getMembershipProfile());```lol
idk i clicked on it
Hey guys, does modern versions of Bungeecord support updated versions of Forge, such as 1.16.5? Looking at other proxies, I see they don't support Forge past 1.12.2. It'd be a project-saver if Bungee did!
hm no idea, but bungee 1.18 has an option called "forge_support" in its config
which is false by default
so just try it
forge_support
Default: false
Type: Boolean
Description: Choose if your BungeeCord instance supports Forge clients or not.
from what?
Im thinking about the library I will work
For sending and receiving data vía netty
I have already thought the protocol
But i dont know what use for sending and receiving. Im between ByteArray
i mean, every data you send across internet is byte array
Depends
But yes, given that it is just an input stream
the bigger question is whether it makes any sense to do so
Cuz
For example if you have a byte array that actually represents an array of integers, you should better use DataInputStream's readInt method
For sending data vía netty I will use a custom protocol. And the method for sending and receiving will be:
receive(String channel, byte[] data)
send(String channel, byte[] data)
The DataInputStream is a really powerfull tool and you don't want to waste it's potential with reading byte arrays, any input stream can do that (https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/io/InputStream.html#readNBytes(int))
But why people use DataInputStrean in plugin message channel?
Because it has #readInt, #readUTF, etc. methods
.
Then any input stream is sufficent
As long as it supports #readNBytes, which it should in modern java
Then don't work with byte arrays
I dont wanna fuck concerting bytes to string to int
bytes -> string is easy
But that its how netty send and receive data
doesnt netty support sending objects
all network related communications are binary
I will check
new String(bytes, offset, len, StandardCharsets.UTF_8)
so it isn't going to make a difference at the core of networking because it will be turned into bytes regardless
whether you choose to do it before hand or simply letting the hardware do it
better you do it before hand though
Because i read that netty send data using a ByteBuffer
And inside that buffer the Bytes[]
because all network communications are binary o.O
Yeja
So not sure what it is you are trying to ask here, you are not going to send a string as a string of characters without it first getting turned into bytes
But so i will use ByteArrayInputStrean + DataInputStrean
This is useless overhead imo
bytebuffer already offers getInt, etc. method
not sure how well netty's bytebuffer does it though
Im asking what InputStream use to "parse" data
depends on what you are wanting to do with the data
no, that isn't what I meant, for instance do you need to save the network data to a file for example? If so an input/output stream would become really handy for this
Frodt
You could serialize to JSON
Myeh
(I was summoned because someone said parse)
I dislike that overhead
I will use this system as plugin on both side bungee and spigot. So i can send data all around network
Thank you!
then just stick with bytebuffers
You can just treat them like commands
At that point it is better to go stream -> buffer -> bytes -> stream -> deserializer -> data
Send a command and its arguments separated by spaces
I dont use plugin message because you need 1 player
And each packet can be terminated by a newline or null
Redis
bruh
Omg no no
We've been through it with him
we are joking right
He can't use it because everyone involved in the project is a clown
I wouldn't even do this, I would just make use of Java's object serialization because then you can deserialize the object and it be useful immediately without converting to anything else
And thanks to every one who try to help
But really, just go the "stream -> deserializer -> data (object)" route
but not in the good way
stream -> buffer -> bytes -> stream -> deserializer -> data
why does it need to be human readable? o.O
Debugging probably
why huma redeable if it for sending and receiving data vía Packet class system
But that is about it
🤣
this is exactly my point, at least you get it
It can make your life easier as you can spot issues far better than with a tightly packed system
well debugging I understand
but if debugging at the network layer isn't needed then unnecessary for it to be human readable
not that it will be because it will just be bytes anyways
depending how you capture the data
yeah
Yeah debugging is much easier if your stuff is human readable
But again, the data it outputs is much larger than needed
You're wasting bandwidth if you use java serialization
Isn't it not recommended to use java serialization like, ever?
compression is a thing with packets
how much bytes you really think the object is going to take ?
you do know all packets have a minimum size they get padded to regardless?
think its like 64 bytes or something
You then do:
PacketObject packet = Packets.receive(PacketObject.class)
packet#Setters
packet#Getters
I was close, 60bytes is what it gets padded to
I will use ZLib
and that is for a TCP packet
Yeah I will be sending cross network packet using the netty server/Bungee isntance
you can make use of compression if you want, but I would only do so if the data being sent is averaging to be double or quadruple the size of a single packet
With a custom channel, wrapper, encryption
Why not use UDP
Well it would depend if they need the packets in order or not
if ordering isn't necessary I agree UDP is the way to go
We need order yes
but also there is no guarantee of the UDP packet of making it to destination and no way for either side to know it did or not
And udp not always came it can be lost
Hi, i need some help with this
LivingEntity Player = e.getEntity();
if (e.getEntity() instanceof Player) {
EntityDamageEvent DamagedEvent;
DamageCause cause = Player.getLastDamageCause().getCause();
String causeString = "Causa de daño: " + cause;
if (cause == DamageCause.ENTITY_ATTACK) {
if (DamagedEvent instanceof EntityDamageByEntityEvent ) {
EntityDamageByEntityEvent EDBEvent = (EntityDamageByEntityEvent) DamagedEvent;
if( EDBEvent.getDamager() instanceof LivingEntity) {
causeString= "Causa de daño: ("+EDBEvent.getDamager()+")";
}
}
}
if(((Player)e.getEntity()).getInventory().getItemInMainHand().getType() == Material.TOTEM_OF_UNDYING || ((Player)e.getEntity()).getInventory().getItemInOffHand().getType() == Material.TOTEM_OF_UNDYING){
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&4&l[Sudden Death II] &c"+Player.getName()+" &fha usado un totem | " + causeString));
for (Player OnlinePlayer : Bukkit.getOnlinePlayers()) {
OnlinePlayer.playSound(OnlinePlayer.getLocation(), Sound.ITEM_TOTEM_USE, 10.0F, 1.0F);
}
}
}
}```
I want the name of the Mob that hurt the player to come out
Frost really thanks!!
stream -> buffer -> bytes -> stream -> deserializer -> data
data -> serializer -> stream -> bytes -> buffer -> stream
?
I personally use code like
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
int readableBytes = in.readableBytes();
if (readableBytes < headerSize) { // Strict size limitation. Any packet smaller than that is most likely not a packet
return;
}
int readerIndex = in.readerIndex();
int size = in.getInt(readerIndex);
if (readableBytes < size) { // Packet not yet fully received (Stream-based transport problem)
return;
}
in.readerIndex(4 + readerIndex);
short packetId = in.readShort();
long sender = usingSide == Side.SERVER ? in.readLong() : -1;
byte[] payload = new byte[size - headerSize];
in.readBytes(payload);
out.add(new PacketStub(packetId, sender, payload));
to decode packets into stubs, which then are processed to actual objects
Please paste code on
?paste
@undone axle you good?
?paste
You speak Spanish?, I say it because it says "VERANO" in your nick
deep in their heart, verano is russian
Oh lord, I already live in the middle of nowhere, but this really must be nowhere
Seriously?
Yeah
optic will rant at you "English only!"
Not problem, I understand English xd.
It not allow to speak Spanish
not only optic
Why are all of my switch case statements executing?
String enchantName = args[0];
boolean success = false;
switch (enchantName.toLowerCase()) {
case "swordsdance":
sendMsg(player, "swordsdance");
success = ApplyEnchant.applyEnchant(item, (EnchantmentWrapper) CustomEnchants.SWORDSDANCE, level);
case "dragondance":
success = ApplyEnchant.applyEnchant(item, (EnchantmentWrapper) CustomEnchants.DRAGONDANCE, level);
case "iceaspect":
success = ApplyEnchant.applyEnchant(item, (EnchantmentWrapper) CustomEnchants.ICEASPECT, level);
case "bomberace":
success = ApplyEnchant.applyEnchant(item, (EnchantmentWrapper) CustomEnchants.BOMBERACE, level);
case "wingardiumleviosa":
success = ApplyEnchant.applyEnchant(item, (EnchantmentWrapper) CustomEnchants.WINGARDIUMLEVIOSA, level);
case "dash":
success = ApplyEnchant.applyEnchant(item, (EnchantmentWrapper) CustomEnchants.DASH, level);
case "sheercold":
sendMsg(player, "sheercold");
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED,
new AttributeModifier(UUID.randomUUID(), "attackSpeed", additionalSpeed, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND));
item.setItemMeta(meta);
}
Because you haven't put break
break
It'll also run all the ones after that if you don't break
this is called fall-through
ah right thank you both for the assistance
how can you stop ie a chest opening but allow for throwing a potion on it? right now im just allowing the interactevent if they are crouching
Event#setUseInteractedBlock
basically your case statements are labels and the JVM will jump to the respecive label based on the object put in the switch statement head. The JVM will keep executing stuff (even going over other labels) until it hits a statement that exists the scope (i. e. break or return)
@young knoll is there an article or something explaining that one?
See above
?jd
?jd
On spigot java docs you can find info
this was just not much
I think ive got it now though if I set that to Result.DENY then it will do what i would expect
useIteminHand = throw potion
useInteractedBlock = open chest
Ah ok it is clear now thank you guys
How can i simplify
Enchantment enchant = null;
switch (enchantName.toLowerCase()) {
case "swordsdance":
enchant = CustomEnchants.SWORDSDANCE;
break;
case "dragondance":
enchant = CustomEnchants.DRAGONDANCE;
break;
case "bladebeam":
enchant = CustomEnchants.BLADEBEAM;
break;
case "spinattack":
enchant = CustomEnchants.SPINATTACK;
break;
case "excalibur":
enchant = CustomEnchants.EXCALIBUR;
break;
case "devilsscythe":
enchant = CustomEnchants.DEVILSSCYTHE;
break;
case "iceaspect":
enchant = CustomEnchants.ICEASPECT;
break;
case "bomberace":
enchant = CustomEnchants.BOMBERACE;
break;
case "wingardiumleviosa":
enchant = CustomEnchants.WINGARDIUMLEVIOSA;
break;
case "dash":
enchant = CustomEnchants.DASH;
break;
case "sheercold":
enchant = CustomEnchants.SHEERCOLD;
break;
case "urbosasfury":
enchant = CustomEnchants.URBOSASFURY;
break;
case "swiftblade":
enchant = CustomEnchants.SWIFTBLADE;
}
I feel like im doing the old if "1" then 1 if "2" then 2
you could make this much easier by saving the enchantments in a map while registering
map<yournamespace,enchantment>
and then get the enchantment from there
Even better: change CustomEnchants to enum and do Enum#valueOf
Yeah that could be a smart idea
I had a dude telling me to do this earlier
I cant
I'm extending Enchantment
I personally use an intermediary enum which is assigned an enchantment
But I don't extend Enchantment in my plugin for one reason or another, so don't take my advice for granted
Right
The CustomEnchants.WHATEVER do have method .getKey() which is the same as the case
why does JavaPlugin implement TabExecutor 😐
Because that is the default tab executor
I put
private static Map<String, Enchantment> ENCHANT_KEYS;
//in register
if (registered) {
ENCHANT_KEYS.put(String.valueOf(enchantment.getKey()), enchantment);
}
I got java.lang.NullPointerException: Cannot invoke "java.util.Map.put(Object, Object)" because "me.jameslloyd.sleepyenchants.enchants.CustomEnchants.ENCHANT_KEYS" is null and
How do I assign it to an empty map?
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.
your map "ENCHANT_KEYS" will be null if you not set it to an Map ... like HashMap for example
HashMap is the same like Map
Map is the interface of an HashMap
you should use a Map for this yes
Why is it saying it may be final when i put later on?
but you should learn java and understand how maps, list and so on rly works xD
I'm trying right now
I'm used to python which is much simpler
Just slap [] wherever you feel
Or {} for dict which is what i understand a map to be
because you do so in your constructor
yeah python is simpler but gets so confusing after just creating a small program
so it could be final
python is like duct tape
you can use it to repair or get small things done but you wouldn't use it to construct a whole building
a Map in java and a dictionary in python are sort of the same
well they have the same abstract data structure specification in a sense
I'm horribly aware, I used it for my computer science programming project for my coursework to make an app and it is shocking. Thats why im learning java, but its a lot easier to learn with something im familiar with - minecraft.
I guess it is final? It is never going to be modified apart from when the enchants are registered
Yeah
HashMap seems to have worked thank you guys
spoke too soon
it's not final unless you declare it final
I mean I guess it should be
My command is no longer working and theres no errors 😦
Fun fact: MCEdit (now abandoned, but the most popular world editors for its time) was written in Python
https://github.com/mcedit/mcedit2
That wasn't a small project either. Had a full on editor window and whatnot, 3D view of the world, etc.
I do wish that project kept going though. I don't believe there are any more offline world editors in modern MC (excluding WorldPainter, but I don't think that counts. It didn't do what MCEdit did)
MCEdit was Great, and Still Great for Older Versions
yeah, I only know of in game mods that allow similar stuff but those don't come close
MCEdit has saved many of my broken modded worlds
Would be a fun attempt to bring that type of project back, I just can't be bothered lol
😅
Would be better in an OOP language
Or at least a far more standard one than Python
C#, C++, Java, whatever
Rip McEdit
ik this is not paper related discord server, but i know most of you here use paper or its derived forks here so here's my question:
any ways to import NMS classes into maven project (Intellij IDEA)? I've used java -Dpaperclip.install=true -jar paperclip.jar before to import patched jar into local repository, but it seems it's been removed (at least in 1.18 builds), any ideas?
just import spigot and paper-api
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Hi there, I have a question about BungeeCord.
How can I change the forwarded ip? I want to make feature, that users can host their own spigot servers and they can be added to the bungee network, but I don't want to leak ips of my players to them. I would also like to have ip forward to true, so they can still have the same uuid as on the normal server. Is it possible to just change the forwarded ip to some nonsense but keep the online uuid?
that makes no sense
Well yres
Just have a Map<String, String>
where the key is the nonsense, which corresponds to the actual ip
thus hiding the real ip
but why tf would you do that
also where's the problem in knowing the IP
users hosting their own server sounds like problems
That's basically minehut yeah?
personally I don't have any idea, but most players are scared from ip logging for some reason.
and what happened to minehut again 🙄
this is the part, that I know, but I don't have any idea how to forward this ip to the spigot instead of the actual ip
you either forward their real IP and get real UUIDs, or you don't and don't get real UUIDs
I have no idea what did happen to minehut?
i dont even know what minehut is lol
Free sever hosting
neither do i xd
minehut is trash
I'm fairly sure they're still going
all free hosters are trash, otherwise they wouldn't be free
Pretty sure Bungee has documents on how to send a player to a server
sure it has but it's about hiding their IP for whatever reason
I know how to send them to server, but not how to change the forwarded ip
hmm
IIRC ip forwarding in bungee is nothing different from normal NATing
the server will always either have the real IP address or it has the bungeecord IP
It's free hosting based on donations from users, iirc
They have different tiers of servers
👀
Then it was never down and you're a monkey
no
Yes
no
Did bungee-chat adopt lombok lately or am I just stupid?
hmm, but why can't I just send any ip when i can do exactly this with uuids, sorry for stupid questions but I don't know much details about how bungee work, I just know the basic concept, because most of the time I am working on spigot plugins
Search your feelings you know it to be true
I have bad news for you friend
Actually I'm not sure, cause it kinda seems like they did
Im confused, I casted to String[] and it still says its not the right data type
What is T?
what if I wanted Paper related internal methods in?
ask in paper discord
^
Oh wait ive got it i didnt need to convert anything
Right now you are using the desc (Ljava/lang/String;[Ljava/lang/String;)? but the actual desc is (Ljava/lang/String;Ljava/lang/Iterable;T)?
Use Arrays#toList() or something
a collection with the generic type parameter of the second parameter the method takes
CustomEnchants.getPossibleKeys() is Set<String>
public static <T extends Collection<? super String>> T copyPartialMatches(@NotNull String token, @NotNull Iterable<String> originals, @NotNull T collection)
I know what generics are, but I do not know what the datatype of T is
Hm, that is some intricate usage of generics
T is is a Collection<? super String>
It's not even 8pm and my brain is already halfway towards entirely shutting down
Help me
public class CustomEnchantTabComplete implements TabCompleter {
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
final List<String> completions = new ArrayList<String>();
StringUtil.copyPartialMatches(args[0], CustomEnchants.getPossibleKeys(), completions);
Collections.sort(completions);
return completions;
}
}
This tab complets for args[0] how do i make it for args[1]?
no idea, probably bungee either keeps track of the original IP or it doesn't. you could probably fork it and implement some IP spoofing if you care that much 😛
Have you solved this problem?
Generally you'd want args[args.length - 1]
what's the command you ran exactly?
My command is /ce {enchant} {level}
#general message
Do you know of any documentation i can read
well success
oh no
i used the maven plugin
i solved it in some way (i think by using linux terminal or getting the shaded jar, but it didn't obfuscate correctly)
Bungee has used it for a while
Ah then,
List<String> completions = new ArrayList<>();
switch (args.length) {
case 0:
return completions;
case 1:
complections.addAll(CustomEnchants.getPossibleKeys());
break;
case 2:
for (int i = 0; i < 5; i++) {
complections.add(Integer.toString(i));
}
break;
}
Collections.sort(completions);
return StringUtil.copyPartialMatches(args[args.length - 1], complections, new ArrayList<>());
something like that
this was also a nice one
hm, interesting that I did not spot it sooner
ty
even more thanks
Now i understand how it works too
bonus
if (args.length == 2) completions = Arrays.asList(1, 2, 3, 4, 5) lol
why complections.addAll(CustomEnchants.getPossibleKeys());
Because that should be all the arguments that could go there
You do the filtering later on
Just to reduce duplicate code
Shower thought: Does it make sense to code an entire plugin using JASM or would the performance difference be too low?
JASM?
.java is also a text file
didnt see that
because it isn't the right data type
myeh, a String is not a char array
toArray technically gives Object[] which is not the same as String[] as the Object[] is backed by List and not List<String>
therefore you can't merely cast it like they are doing
a wrapper 🙄
It is more a byte[] wrapper if anything
Is there any packet from client which will allow me to make check if fake entity is still spwned for them ?
or do I need to respawn it again
I mean
"if it is spawned for them" - if that person can see it you mean?
If they interact with it there will be a packet
technically not, but it is built on top of char array however
so for example I spawn armor stand on top of player but player which is out of range will not get that packet range is lie 40 block or something like that what I tested
it is spawned for them as long as it doesn't get deleted through a packet by the server
but that player which was out of range when armor stand was spawned will not see it
Or if they kill it
but I don't want to refresh it
for all players again because you got that flicker then
like for ones which are still seeing it
it will disappear and show again
@tender shard@young knoll
also char and byte are different as well. Byte is a signed primitive and char is unsigned. Byte is 8bits and char is 16bits. Byte has a range of -128 - 127 and char has a range of 0-65535
nice
you could just send the packet again for players who went out of a certain distance
Char is the only thing that’s unsigned isn’t it
but normally it shouldnt flicker at all if you e.g. send it every 10 seconds
it flickers because I need to use ClientboundAddMobPacket
and I got it hooked on command
you should be easily able to use CLientboundAddEntityPacket
I had never had problems with that stuff disappearing when going out of range
I use it for holograms with armorstands and area effect clouds
never had any problems with that
The String constructor will convert the char array to a byte array though
I use this to show fake entities to players:
@Override
public void showEntityToPlayer(@NotNull final Object entity, @NotNull final org.bukkit.entity.Player player) {
PacketUtils.sendPacket(player, new ClientboundAddEntityPacket((Entity) entity));
PacketUtils.sendPacket(player, new ClientboundSetEntityDataPacket(((Entity)entity).getId(), ((Entity)entity).getEntityData(), true));
}
It works fine even when players go out of range and then come back
Entity = NMS Entity
Why object
here
u see what I am talking about
it was a char array before though
so I can use it without importing NMS classes
