#help-development
1 messages · Page 2094 of 1
Hey there, has anyone worked with TinyProtocols previsouly? I want to cancel a few packets without protocollib and saw TinyProtocols as a good alternative
just ask your question
I can't help but maybe someone in an hour or two could help but you didn't really ask any question so they cannot answer 😄
dontasktoask
Well, the question is somehow asked, but I repeat it again, I want to cancel a few packets without the usage of protocollib, I saw TinyProtocol as a good alternative, but I would like to know other developers recommendations.
protocollib's presence is bigger than paper itself
tinyprotocol works fine
but it's a bit more barebones
True, I had a bit difficult time understanding it, so I just show my code snippet
if you're getting into packets you should be able to easily reverse-engineer most plugins
I used to only work with protocollib for a year, as it really made the work easier but I decided to work without it for some reasons, and thankfully was able to reverse it for the most part, except the listening/cancellation of the packets
odd
I have a basic ProtocolLib tutorial
let me know if this helps you understand it a little better
Should give you some basics on tinyprotocol
That's pretty good, I wish I had this one when I started, it will surely add some info
I'd probably use ProtocolLib since almost everyone has it anyway. I don't know how up 2 date TinyProtocol is, but probably it takes longer for a new TinyProtocol version to come out than it takes for ProtocolLib.
That's the point, especially with TinyProtocol, that's why I was considering other ways too
I just searched for TinyProtocol and all I found is a 2000 downloads plugin made for 1.8 and 1.9
tinyprotocol is a utility that should be shaded into plugins
made by protocollib guy
dmulloy or comphenix
oh yeah so that means you'll have to manually update your own plugin on every update anyway
not really a plugin
kinda making using it useless
thing is tinyprotocol is purely reflection-based so updates aren't that frequent
if you have to release an update for every version anyway, you could also just use NMS packets anyway imho
with the recent mapping changes, I doubt that it can easily avoid adjustments for every new MC version
so although I don't know much about TinyProtocol, i'd go with ProtocolLib. ALthough I truly hate ProtocolLib
Alternatively there must be a way to listen for packets like how it is possible to send it via nms, but people in the forum either didn't know what they are talking about, recommended protocollib or TinyPackets
of course you can listen to incoming packets without any lib
the best way to do it is to ditch spigot and make your own server impl
buuut it's quite complicated and "listening" to packets is the only thing where I'd recommend protocollib instead of not using it
why that lol
or was that a joke?
obviously a joke
seems like every 17 year old in this community is making their own server from scratch :p
yeah that's indeed true lol
there once was a nice graphic showing all the different server forks but I can't find it anymore
forks are one thing
I mean like full blown rewrites
heck I've even witnessed a 40k$ legal battle over 2 spigot forks
Well, I'll see how it's going to work out, ty
who sued whom?
I can't remember exactly
but stellarspigot sued litespigot
and litespigot won iirc
wow they both look like shit
Isn't StellarSpigot that StellarDev scam thing?
I doubt that anyone sued anyone
God how much fucking money does that group have to spend...?
I used to dev for litespigot guy
a few months ago
kinda learned it first-hand
how do i get a list[] kind of list in java
instead of the one that uses .add() and whatnot
Do you mean an array of lists...?
no like just a typical array
Or are you referring to just an array?
ye
list.toArray(new whateverobject[0]);
String[] arr = new String[5]; // example length
arr[0] = "...";
// or
String[] arr = new String[]{ "..." };
hm lemme restate my question in a better way
i feel like there's a million different ways doing this is easier
Although you should be careful about using var with generic types
mhm
Java would interpret that as a ArrayList<Object>
So you'd want new ArrayList<Placeholder>();
I despise var. It makes everything so ugly and look dynamic 
Honestly
Just get the fuck used to it
80% of all modern languages use var, let, or const
I'm not that big of a fan of var either
yay for not knowing what any variable type is
But you do though
do you really
You wrote the code, you wrote the instantiation of the variable
You know the type of the variable
if you're doing a mega fast read of someone else's code
You shouldn't do that anyways though
Reading code quickly is a good way to misinterpret it
Yeah but you have to know what returns what.
(And var is the least of your problems)
let me grab a cup of tea for each individual class I read
There's this invention they created pretty recently. Maybe you haven't heard of it, but it's called an "IDE."
Allows you to hover over method calls to view their descriptors.
Crazy, right?
So in other words I have to do more work to figure out what some code does rather than someone spending 1 extra second typing int
Besides, not like it's that much harder to interpret code with implicit left-hand types.
You can infer types from how the variable is used as well.
Same
python took that shit so far that no ide knows what to autocomplete with
That's because Python is a shit language
can I put a Map into a listener class or should I put it elsewhere?
okay thanks
But seriously, all you Java developers overestimate the cons of var.
I just interpret it as "I don't like it because it reminds me of JS"
all you java developers
you're advocating for non-boilerplate code
and that's the problem
I respect the self-awareness at least lmao
:)
only reason why I haven't moved to kotlin during these past 5 years is because I actually enjoy boilerplate
No it's not that I overestimate it. I don't like it because when I deal with it I get lost too easily
Boilerplate makes my brain go into autopilot so I can't really comment on it
my code comments itself
My code is never commented or documented lol
I can't really just
...well unless I'm crediting StackOverflow or making fun of some shit lines I wrote
FileConfiguration config = getConfiguration(); // Gets the configuration and assigns it to the config variable
var config = getConfiguration() omg it's so much harder to read I dunno what I'm ever gonna do
boilerplate just describes itself
BuT YOu cAN jUsT var config 
okay but is it a FileConfiguration, File or ConfigurationSection
Look at how it's used
or is it a wrapper class for a config
so if i have File f = new File(UltraKits.getInstance().getDataFolder(), name); if (!f.exists()) { f.getParentFile().mkdirs(); UltraKits.getInstance().saveResource(name, replace); } } to put a file that i created under resources in the plugin's directory (this works) how would i do this if i made a new folder in resources called lets say "kits" with a file in that directory called "options" how would i save that using something similar to this
name + File.separator + "kits"
This is why we use java.nio.Path :p
I mean for saveResource
what i have there "name" is the name of the file to save in just the resource file
using any generic file separator works for Files
so would it be "directory" + file.sep + "file name"?
but saveresource doesn't handle that internally
ye
I have never understood why those Bukkit resource methods exist
ight ty
What if you don't wanna use YAML or Bukkit's predefined paths? lol
(Which is honestly a travesty)
if you want to make a config file on the plugins folder you're quite special
it can easily break if the filename actually contains weird characters
the best solution is to always use new File(parent, "child.yml");
just like spigot, we can't always be perfect
How would I go about making a staff chat for bungeecord
I bet this will lead to problems when someone now hardcodes "test\folder"
if you specifically use the \ character, you will hardlock it to a specific operating system
isn't there ProxiedPlayer.sendMessage too?
yeah but how would i go about going through all the online players and checking if they have the right perms
erm well, loop through the online players and check if they have the right perms?
for(ProxiedPlayer player : getProxy().getOnlinePlayers()) if(player.hasPermission("staffChat")) ...
okay then just imagine the folder name contains a / instead of \
there's many file systems that support it
I remember writing it as / and people complaining it didn't work on windows or somethin
yeah that's why I wanted to say, never hardcode / or \ as file separator
in macos you can easily create a directory containing / in the name for example
What is the best way to add compatibility with items of all versions?
Hey guys, I remember some of you mentioning tools to force a resourcepack on the player on join. Some guidance on this would be appreciated, or at least a link to a project that makes it easier.
thanks!
XSeries
Anyone know a way to have structures to spawn in a custom map?
we have an earth server and want it to have villages, ruined portals etc
I'm currently working on a language system for my plugin and I am wondering if making the option to choose your language per player would be beneficial.
In my current setup, if players were to select a language,
- It would change any feedback sent to them from the plugin. (General plugin feedback)
- It would also change the text in the plugin's GUIs.
Now, the only problem I'm facing is, if a server's native language is, lets say italian, does it make sense for a player to use english language settings?
This plugin doesn't convert messages to other languages, nor does it manage chat. (That functionality is also out of scope for this plugin) This toggle is strictly for text provided by the plugin itself.
At the moment, I see this as a beneficial feature, however I think that it will be underused.
I know that there are plenty of multilingual people out there, but I'm wondering if I should keep it this way or just make a global language toggle.
What do you guys think?
If you are running 1.18.2, you can use the require-resource-pack setting in the server.properties file.
if i made 4 config sections in a config section would they be in order of which was added 1st or alphabetical?
thanks! ill keep this one in mind!
The order in which they are added.
Anyone have experience with mongodb?
I'm trying to connect with "mongoClient = MongoClients.create("mongodb://<user>:<password>@10.0.0.1:27017");"
But I am getting the error: java.lang.NoClassDefFoundError: com/mongodb/client/MongoClients
https://paste.helpch.at/jizamihewe.java
Some help me fix the errors
on line public void Fill(){
commands.add(command, percent);
dk where the mistake is
You need to either
(a) Shade MongoDB into your plugin with Maven Shade/Gradle Shadow
(b) Use the libraries option in your plugin.yml if MongoDB is hosted on central (which it likely is)
I'll research that out, thank you.
commands is a Map, not a Collection, so the method is put(), not add()
Central - meaning localhost If I'm not mistaken?
Also, the map is a Map<ArrayList, String> but you're putting in it a List and an int
No, central being Maven central
It is hosted on central so yes you can use the libraries option
1.17+ though iirc
libraries:
- "org.mongodb:mongodb-java-driver:3.12.10"```
The server will automatically download it and add it to the classpath for you
3.12.x is latest on Maven though? 
Oh they deploy to another repository (EDIT: wait no they don't. I'm confused lol)
Can't use libraries then
public void Fill(){ Expected ;
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.5.1</version>
</dependency>
Ah, changed artifact ids, that's why I couldn't find it
Then yeah you can use that instead in libraries
Alright cool thank you a lot 🙂
One of those things that you'd think would be straightforward, but I am struggling, lol. Spigot's player.sendMessage says it accepts a String....theoretically a JSON formatted string, but the documentation isn't clear. Also, Googling the issue provides a whole lot of clicking with conflicting answers, many of which seem to not work at all, or are even argued over. I just want to send a player a message in the form of a /tellraw command...can somebody just point me in the right direction? I'm having 0 success.
It doesn't accept a JSON string, no. Just a regular message
If you want to send a text component, you can do player.spigot().sendMessage() which accepts a BaseComponent
You then get into BungeeChat territory
is BungeeChat available on vanilla Spigot plugins?
(I've never even looked at Bungee stuff)
Hm, still getting this error: https://hastebin.de/qejudigijo.apache
BaseComponents and TextCompoents are part of the API. The caveat is that you need to use the #spigot() method.
https://hastebin.de/ififagiqac.xml - My pom.xml
that's fine, thank you so much for the clarification. Why isn't that document the first result on Google? No way to know 🙂
And your plugin.yml?
name: FFACore
main: xyz.praydev.FFACore
version: 1.0
description: Simple FFA Core
author: Pray
website: praydev.xyz
api-version: 1.18
softdepend: [Vault]
commands:
spawn:
setspawn:
kit:
createkit:
zonetp:
libraries:
- "org.mongodb:mongodb-driver-sync:4.5.1"
If you make your pom.xml dependency set to the provided scope it may work
(and you can remove shade)
Still looking for some feedback with this one.
Still getting the same error.
can someone help me here
What's your startup log look like?
What do you need to see in it? Not sure what I'm aloud/not aloud to share in it.
Mmm. Sec
You should see something pretty early on in the logs:
[YourPlugin] Loading 1 libraries... please wait
[YourPlugin] Loaded library C:\path\to\your\server\libraries\com\zaxxer\HikariCP\5.0.1\HikariCP-5.0.1.jar
(though for you it would be Mongo)
Or, you might see a download error. Either way, the server would recognize that you're trying to load a library
Ah I don't see that, also just realized Vault loads after and it's needed to load before.
Hm. Well, in that case, verify that you're actually running the plugin you've exported. Check the plugin.yml inside of the .jar file on your server to see if the libraries are in there
IntelliJ is not enjoying this tutorial at all. It keeps saying that the BaseCompoment type will not accept a new ComponentBuilder to be assigned to it. I'm just attempting the very first bit of code in the linked tutorial
Well, no, but a ComponentBuilder instance should have a .create() method iirc to get you a BaseComponent[] which player.spigot().sendMessage() does accept
BaseComponent component = new ComponentBuilder("Welcome!").color(ChatColor.AQUA);
...
Yeah, .create() on that, and it's an array of components
I see it, lol
I wish the tutorial brought a bit of attention to that tidbit, I just thought that tail was more formatting, lol
thank you
o/
Got mongo working, still says Vault isn't found which is weird.
It worked on my localhost
Pushed it to the host and now it's not working
Always works on one computer but not the other lol
Exactly haha
Any idea why that would be happening? I seem to have everything the same other than the fact that I switched it to the host
It's just Vault that isn't working as expected?
My plugin isn't recognizing Vault, but it's clearly there
I think it's because Vault's loading after my plugin
Which doesn't make sense because I have it as softdepend
Tried changing it to depend in my yaml
no change.
Yeah that doesn't make much sense to me. I guess maybe make sure there aren't two Vaults and that you have the latest version?
Looked around the forums, maybe because I didn't put essentials into my host it's not working properly
Oh, yea. Vault needs an economy provider for it to work properly.
Essentials has been the standard for a while, but I wouldn't be surprised if something else has come along to replace it.
I know that an alternative to Vault exists. It's called Treasury. Not sure if it got off the ground though.
Definitely didn't get adopted by developers
even if this is the case you should design your plugin in such a way so that order of loading doesn't matter 🙂
That's a shame. It looked promising.
Is there a way to get/set damage from an explosion before distance is calculated?
for example, a creeper deals 22.5 damage when stood right on top of in easy mode, but a few blocks away it is only 11.5
I wish to change the damage before distance is taken into account
what kind of articles?
Java & MySQL Tutorial, Java based application can connect to MySQL using JDBC API. JDBC works with Java on a variety of platforms, such as Windows, Mac OS, and the various versions of
no?
you didn't provide any context or anything else
mysql has its own documentation just like java does
might want to refer to it
well if you are not going to provide information then you can't really expect help
the only thing I can assume is the file is not utf encoded
are you using maven?
you need to use maven to set it and not within the IDE
intelliJ doesn't set the appropriate options if I recall in maven in regards to locale
however generally not necessary to set the locale unless you have character specific stuff
How can I override ender pearls and recreate their function https://youtu.be/YiInRcUa1FY, essentially allow ender pearls to do what’s being displayed in this video. I’m not sure where to begin.
I know I can set their event to cancelled on throw, and just remake what happens, but I’m not sure if that’s how you do it or not.
this exists at the bottom of jetbrains javadocs page @tropic idol
maybe it could help
looks like even jb knows their generators kinda fuckd
https://paste.helpch.at/ducekefixi.java
Error in commands.put(command, percent);
String
Provided:
int```
I have a map of armor and an associated number, I set a player with random armor from that map then sum all the armor the player has to see if it is too low or too high above a given level of gear, I do this with a do-while loop. Is that a passable approach? I don't find any other way to do it
you can use a if
I'll have to repeat it though
No, I want to make sure the gear they get is between a certain level
what's the maximum level that a player can reach?
16
the error says all, you made an HashMap with <ArrayList, String> and where there should be a string you put an integer (int percentage = ....)
you should also specify the type of ArrayList
so put ArrayList<String>
can't you use a switch?
What do you mean?
do {
clearPlayerArmor(player)
inventory.helmet = randomGearFromString("HELMET")
inventory.chestplate = randomGearFromString("CHESTPLATE")
inventory.leggings = randomGearFromString("LEGGINGS")
inventory.boots = randomGearFromString("BOOTS")
armorLevel = gearMap[inventory.helmet!!.type]!! + gearMap[inventory.chestplate!!.type]!! + gearMap[inventory.leggings!!.type]!! + gearMap[inventory.boots!!.type]!!
} while (
armorLevel < (gearLevel - 2) || armorLevel > (gearLevel + 2)
)
where
I haven't tested it, it should. I just want to know if there is a better way
replace this " HashMap<ArrayList, String> commands = new HashMap<>();" with this : HashMap<ArrayList<String>, String> commands = new HashMap<>();
Map<ArrayList<String>, String>
to link a player to an armor i use HashMaps
error still there
I don't need to do that
commands.put(command, percent);
yeah of course there is an error, you put an int where there should be a String
I just want to know if a do-while loop is an alright way of enforcing a level of gear
but I want to use int
cause its number value
try using this commands.put(command, percent.toString());
will be easy for me to calculate later
and then to get an int again Integer.parseInt(commands.get(command));
nvm this is right
also whys there error in public void Fill(){
.
because you put a method into a method
you put a public void into a public void
you have to write them separately into the same class
i think so
i never tried anything like that
try it and see?
How to get the corners of chunks in 1.18?
Not really sure with the new height limit situation
declaration: package: org.bukkit.generator, interface: WorldInfo
declaration: package: org.bukkit.generator, interface: WorldInfo
Ahh okay that's so much help, thank you!
Can I have a custom event which has listeners in multiple plugins?
Sure
How do I do it?
You can code up the event and other plugins can depend on your plugin to listen to it
how do you mean "depend on your plugin"
I know that plugins can depend on other plugins but how do I get the classes of other plugins?
if you learned java basics
you wouldn't be here so much asking for help
with every little thing you are doing
just include the "event plugin" as library? would it work?
sorry
no need to be sorry, just pointing out this is why we tell people to learn java
also most of what you need help with
a google search most likely could answer it for you
I have just made such a cool ability system
that's literally it
Before I was doing it in this functional manner
and then I'd have to make a new listener for every event
my new method just does it automatically $_$
I did notice one thing tho
when I override the method in the subclass, it doesn't automatically inherit the annotation
for @EventHandler
anyway can I make that happen?
as in this causes no issues
and then the ability doesn't trigger
function something() {
while (something) {
does something...
}
}
something()
print("T")
Will "T" print only once the while loop ends called from the method?
Um that's a very basic java question
Since it's on the same thread I'm assuming it'll only be done once it finishes the while loop, I just want confirmation
yes
Alright, thanks
np
anyone?
I think if the EventHandler annotation class was annotated with @Inherited it would do it automatically but it's not and I can't change that...
ok so i have this system for shaped crafting
but now how do i do unshaped crafting
i thought about sorting already but i dont know how to sort the matchers (Ingredients) in the same way the actual stacks would be sorted
That's a cool diagram
thanks
i might just register every permutation of an unshaped recipe to the tree
but idk if there is a better approach
if so ill use that
count the number of items at each stage
so in that example
1 dia, 1 purple crystal, 1 dia
then maybe put that into a hash map?
Is it important in which order the items are placed into the crafting station ?
Nvm, I just read the thread
if it's unshaped then surely not
yeah that could be possible but the only problem is that those things in the circles on the right arent only actual materials, they are like matchers, so i could for example do Ingredient.allWood() which should accept all wood types instead of one specific material
thats what makes it so difficult
otherwise i could just sort them using the Material enum ordinals
I was asuming dze to the diagram and the numbering of i0, i1, i2 that the inputs had to be in that order insterted into the crafting table
right
or something like that
yeah thats shaped
that was an example of how im doing shaped crafting
I think that was a diagram for their shaped crafting
For some reason that diagram gave me the idea of throwing items into a cauldron or smth, there where the order would matter in which the items would be put in.
But then I read the thread and noticed my mistake aswell
Ngl, the idea sounds sick though, might try it some time
probably adds a shapeless recipe for all different woods or some shit x_x
yeah lmao
but then i would have to get every permutation for every possible item per slot
how do you your matchers work?
i have the code on gh
one sec
you might be able to figure it out ill explain it simply too
what if you had something like this
class counter<T> {
int count;
T counted;
public void increment() {
count++;
}
}```
or just store an obj rather than a generic
oh and then do that for every item in the matrix
and then maybe sort it based on count
so for example for eveyr item
you try and pass it to ur matcher (if that's how it works)
so say if you make something with two wood logs
you make a counter for 2 wood matchers
store than in a hash map with the result
or rather a list of counters
well i could store it like
any wood x2
/ \
/ \
diamond iron ingot
and then anything with two logs and a diamond will match left
because ill sort it by amount'
that's true
but what if you have two things of the same amount?
I think a hash map is better here
make the class immutable
counter class that is
well
what you want to do is count how of many of each thing there is
combine it into a single object
pass that into a hash map
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
public class PlayerItemBreakEvent {
@EventHandler
public void onPlayerMine(BlockBreakEvent block){
Player player = block.getPlayer();
if (!player.hasPermission("lastsoul.mine.diamond")){
if(player.getInventory().contains(Material.DIAMOND,Material.DIAMOND_ORE,Material.DIAMOND_BLOCK)){
player.getInventory().remove(Material.DIAMOND,Material.DIAMOND_ORE,Material.DIAMOND_BLOCK);
}
}
if (!player.hasPermission("lastsoul.mine.netherite")){
if(player.getInventory().contains(Material.NETHERITE_INGOT)){
player.getInventory().remove(Material.NETHERITE_INGOT);
}
}
}
}```
is there any way to like get all blocks efficiently
or we do all blocks seperately
use 3x `
?paste
ty
.
trynna remove an item when accquired
maybe check if the name contains anything from a list
like
static List<String> bannedItems = new ArrayList<>();
static {
bannedItems.add("DIAMOND");
}
/* some function */ {
ItemStack item = ...;
// check banned
for (String banned : bannedItems) {
if (item.getName().contains(banned)) {
// remove item
break;
}
}
}
or somehting like that
yeah but i dont know what the matcher are
i think my best bet is to just skip empty slots and store every permutation
in one of those trees
heres the source of the matching tree btw
because i want the developer to be able to do like
// unshaped recipe
.ingredients(
Ingredient.ofItem(Material.DIAMOND, /* minumum amount */ 8),
Ingredient.allWoodTypes(/* minumum amount */ 8)
);
Is there a non-deprecated version of setSpawnedType?
for SpawnEggMeta
declaration: package: org.bukkit.inventory.meta, interface: SpawnEggMeta
No? Read what the deprecation reason is
Thats unfortunate, I want a way to spawn a boss mob or such from an egg, which can normally only be spawned with /summon
normally if something gets deprecated there is something else to replace it
which, there is
there is setType but it sets the item type
apply a PDC to that egg, listen to interact event
Then you change the type of the itemstack
Any javascript wizards in here?
How do I change the value href from an <a> element?
setAttribute didn't work
cancel it, then spawn the mob you want
would there just be a way to apply specific nbt to an item in an itemstack?
thats kind of what PDC is
its just spigot's own personal NBT container, but not the actual Minecraft NBT itself
oh okay, never used it before
?pdc
thanks
couldnt you just <thatAinstance>.href = "something";
but PDC would only apply to servers with that plugin right?
PDC is built into spigot itself
omfg this discord lag man
what I mean is, if I have an item which does something with PDC on spigot, will it do the same in singleplayer?
nope, your plugin handles the PDC itself unless you find a way to have spigot plugins on singleplayer lol
if you do lmk
saving the item to your inventory
Yea but why would anyone care for singleplayer 🤔
but, the PDC should stay when transferred to singleplayer, it just wont do any actions, hence the name persistant data container
^ you could just not use the item correctly
If I have a class that extends BukkitRunnable, and I want to make a callback like:
@Override
public void run() {
// Async stuff.
Bukkit.getScheduler.runTask(plugin, () -> { // Callback stuff });
}
This means that my BukkitRunnable extending class has to have a local JavaPlugin member that points to my plugin right? What's the general practice here if you want to implement a BukkitRunnable in its own class?
if you get it back from your creative save slot on the server, it should still work
okay thanks
pass the plugin instance to the constructor
make the constructor of your class take in a JavaPlugin
hehe, slightly faster lynx :p
okay i go now time to work on randomly generating islands
Thanks guys
:p
I want to create 2 clickable buttons in chat but I get the following error:
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
p.sendMessage("§8| §6Server §8► §7Der Server wird mit Freude durch dNodes.net betrieben!");
TextComponent dc = new TextComponent("[Zum Discord]");
dc.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://discord.com/invite/"));
TextComponent report = new TextComponent("[Missbrauch melden]");
report.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://support.dnodes.net/report.php"));
p.spigot().sendMessage(ChatMessageType.valueOf("&8| &7Hilfreiche Links: &2" + dc + " &c" + report));
}```
uhm
Are you actually using 1.8 R1?
so... how to change this? I never used this chat buttons think
wait 1.8...
bukkit api or spigot api?
spigot
Does the chatcomponent api even exist in 1.8? Im not sure
"Download buildtools and use it like java -jar BuildTools.jar --rev 1.8.8 and then wait and then you have a jar file spigot-1.8.8.jar. Just add the jar to your build path."
its built in afaik
In 1.8 you update to 1.18 that solves a lot of problems
I need to do it in 1.8 :/
Is this a plugin your releasing on spigot
its for a friend of mine
Lele you using maven or gradle?
gradle
yes
show me what it says
so I think you're using the 1.8.8 api
yes
so why did you send this if it's already on the 1.8.8 api?
player.spigot().sendMessage(BaseComponent…) is the method you need to use
I do
your string needs to be encapsulated in a TextComponent as well
and send them as varargs
(comp1, comp2, comp2);
the weird thing is lele is using &
ill change it soon :)
so even if it worked it would just look like &c in the chat, not blue
because that means the player is allowed to fly
so even if the player is standing, if he/she is able to fly so it would be true
now it works, tysm!
If !(player.isFlying()) ?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerToggleFlightEvent.html there is an event for it
declaration: package: org.bukkit.event.player, class: PlayerToggleFlightEvent
So just check on that event if player tries to fly and cancel the fly event or what every you try to do
if you want them to stop flying you have to setFlying as well as setAllowFlying
Why do I get the following error in my event?
p.sendMessage("§7[§eBuildFFA§7]§f Du wurdest von §e" + killer.getName() + " §7(§f" + (int) killer.getHealth() + "§c❤§7)" + "§f getötet!");
@EventHandler
public void onPlayerDeath(PlayerDeathEvent e) {
Player p = e.getEntity();
Player killer = e.getEntity().getKiller();
p.sendMessage("§7[§eBuildFFA§7]§f Du wurdest von §e" + killer.getName() + " §7(§f" + (int) killer.getHealth() + "§c❤§7)" + "§f getötet!");
killer.sendMessage("§7[§eBuildFFA§7]§f Du hast §e" + p.getName() + "§f getötet!");
killer.setHealth(20);
killer.playSound(killer.getLocation(), Sound.ORB_PICKUP, 1.0F, 1.0F);
}```
this is my whole event code
Did you die due to something that is not a player ?
I'm assuming the killer is null
wait a sec
Player p = e.getEntity();
Player killer = e.getEntity().getKiller();
if (killer != null) {
p.sendMessage("§7[§eBuildFFA§7]§f Du wurdest von §e" + killer.getName() + " §7(§f" + (int) killer.getHealth() + "§c❤§7)" + "§f getötet!");
killer.sendMessage("§7[§eBuildFFA§7]§f Du hast §e" + p.getName() + "§f getötet!");
killer.setHealth(20);
killer.playSound(killer.getLocation(), Sound.ORB_PICKUP, 1.0F, 1.0F);
} else {
p.sendMessage("§7[§eBuildFFA§7]§f Du bist gestorben!");
}```
Now it works, ty
1 more question:
Inventory kinv = killer.getInventory();
ItemStack pearl = new ItemStack(Material.ENDER_PEARL, 1);
ArrayList<Material> items = new ArrayList<>();
for (ItemStack itemStack : kinv) {
items.add(itemStack.getType());
}
if (!items.contains(Material.ENDER_PEARL)) {
kinv.setItem(8, pearl);
} else {
for (ItemStack i : kinv) {
int current = kinv.first(pearl);
int amount;
for (ItemStack i1 : kinv) {
if (i1.getType().equals(Material.ENDER_PEARL)) {
current += i1.getAmount();
}
}
ItemStack pearl1 = new ItemStack(Material.ENDER_PEARL, current + 1);
kinv.setItem(current, pearl);
}
}```
I got this crappy code, I want to add one enderpearl to the players inventory if he already has one and if not I want to give one to the player, but it does not work
so add a pearl if the inventory doesnt already contain one ?
yes, and if it already contains one add one more to the pearl
so basically just add a pearl to the inventory
there is a method called Inventory#addItem(), which will just add an item of that type to the inventory
WILD question
But when using Player#setMetadata
And you set the tag to disableKnockback would this by any chance in a million years manage to add the generic.knockback_resistance Attribute tag to the player? Asking this as im checking a bug where it seems the player is given this attribute when given this specific metadata tag
and how can I add it to the 9th slot if the player has no pearl atm
You can probably use what you had before, check if the inventory contains an enderpearl, if it doesnt set the 9th slot to an enderpearl.
If the inventory contains an enderpearl you can use Inventory#addItem().
I have been betrayed by what I thought was my closest ally
ItemStack pearl = new ItemStack(Material.ENDER_PEARL, 1);
ArrayList<Material> items = new ArrayList<>();
for (ItemStack itemStack : killer.getInventory()) {
items.add(itemStack.getType());
}
if (!items.contains(Material.ENDER_PEARL)) {
killer.getInventory().setItem(8, pearl);
} else {
killer.getInventory().addItem(pearl);
}```
just like this?
XD
sue them for damages to your reticles
this is unforgivable
should ¯_(ツ)_/¯
If anyone knows the answer to this that would be poggers
does anybody know what this error means?
There is Inventory#contains
you can use metadata to change certain things yes
however it has to be the correct metadata for it to work
So in this case, would having that meta data tag manage to trigger that attribute change?
I have a player who came to me with an issue and for some odd reason it added that Attribute tag when checking with /data command
its possible, I don't know the various attributes to use in regards to metadata just know you can change them with metadata
The end user is using paper too, so maybe paper might of modified the meta data value slightly
fuckin paper man
probably, but never know
Just add adding that metadata value did that hmm
this is the issue here
Have you tried changing the value
have not, let me test this myself first tbh, the user told me they didnt have any other plugins when trying this but maybe they could be lying
few minutes
yeah the value they get set is a double of 1.7<shitload of random numbers here>
if I got a penny for every time someone told me they don't have any plugins that might alter region behavior only to 5 minutes later say they have worldguard or something like that I could retire today

[CHAT] hotchilipepper has the following entity data: [{Name: "minecraft:generic.luck", Base: 0.0d}, {Name: "minecraft:generic.attack_damage", Base: 1.0d}, {Name: "minecraft:generic.armor_toughness", Base: 0.0d}, {Name: "minecraft:generic.armor", Base: 0.0d}, {Name: "minecraft:generic.movement_speed", Base: 0.10000000149011612d}, {Name: "minecraft:generic.max_health", Base: 20.0d}, {Name: "minecraft:generic.knockback_resistance", Base: 1.7976931348623157E308d}, {Name: "minecraft:generic.attack_speed", Base: 4.0d}]
This is the /data command the user sent me when i asked for it
absolute no knockback
even after uninstalling our plugin
check if the damage event is getting cancelled
Yeah we set the value on our plugin to be the millisecond left in no knockback, idk why the previous developer did this im likely going to change it here in a few minutes
im checking rn my pc just had to load in my alt
oh boy do you have a dank anime pic as the bg of your ide
What
damn right
degenerates I swear
AE has a feature where the attacker received no knockback
The issue is the user continues to receive no knockback even after uninstalling out plugin
our plugin removes this meta data tag after x seconds so i would have no idea how the user managed to
- Get that attribute tag added
- for it to persist after our plugin is unistalled
Why do the empty lines not appear?
public void setScoreBoard(Player player) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard scoreboard = manager.getNewScoreboard();
Objective obj = scoreboard.registerNewObjective("BuildFFA", "dummy");
obj.setDisplayName("§eBuildFFA");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score s8 = obj.getScore("");
Score s7 = obj.getScore("§6Kills:");
Score s6 = obj.getScore("%KILLS%");
Score s5 = obj.getScore("");
Score s4 = obj.getScore("");
Score s3 = obj.getScore("§6Deaths:");
Score s2 = obj.getScore("%DEATHS%");
Score s1 = obj.getScore("");
Score s0 = obj.getScore("");
s0.setScore(0);
s1.setScore(1);
s2.setScore(2);
s3.setScore(3);
s4.setScore(4);
s5.setScore(5);
s6.setScore(6);
s7.setScore(7);
s8.setScore(8);
player.setScoreboard(scoreboard);
}```
try using "&f " for empty lines
knockback is normal to have in the game, having no knockback is a problem. Also @noble lantern whoever did the milliseconds is quite dumb to put it into a double lol
you need to manually parse the placeholders
I beileve that was Inspirll's doing lmfao
you cant just set the lines and expect it to work
does not work
got the config from end user, testing now gimme a few moment
meanwhile I recently managed to cast a unix timestamp to an integer value
Precision of the decimal for floats and doubles is system dependent. Can't just arbitrarily stuff like 100 digits and think it won't just like cut off the extras 😛
that was a fun debug when I woke up the next day
idek why the previous dev set the timer in the players metadata...
just create a runnable and cancel it when times up lmfao
not only is that also dumb, but I mean using a double? lmao
lol
Dude ive ran into so much questionable shit since starting here lmfao, its so whack
okay fr brb testing this meta data value
why does it only set one empty line?
interesting i dont get a set value on my end
end user lied to me bois
Duplicate scoreboard lines don’t work afaik
You would have to make each empty line different with like, color codes
.
^
oh
is it left over data?
I mean hard for a plugin to remove some custom stuff if it wasn't allowed to remove it before the end user removes the plugin
i just tested it on theyre exact environment and that Attribute never even gets set past the default value minecraft sets
@EventHandler
public void onPlayerDeath(PlayerDeathEvent e) {
Player p = e.getEntity();
Player killer = e.getEntity().getKiller();
if (killer != null) {
p.sendMessage("§7[§eBuildFFA§7]§f Du wurdest von §e" + killer.getName() + " §7(§f" + (int) killer.getHealth() + "§c❤§7)" + "§f getötet!");
killer.sendMessage("§7[§eBuildFFA§7]§f Du hast §e" + p.getName() + "§f getötet!");
killer.setHealth(20);
killer.playSound(killer.getLocation(), Sound.ORB_PICKUP, 1.0F, 1.0F);
ItemStack pearl = new ItemStack(Material.ENDER_PEARL, 1);
ArrayList<Material> items = new ArrayList<>();
for (ItemStack itemStack : killer.getInventory()) {
items.add(itemStack.getType());
}
if (!items.contains(Material.ENDER_PEARL)) {
killer.getInventory().setItem(8, pearl);
} else {
killer.getInventory().addItem(pearl);
}
} else {
p.sendMessage("§7[§eBuildFFA§7]§f Du bist gestorben!");
}
}```
help xd
1.16.5, and cant replicate theyre issue which is very odd
you won't replicate it if its left over data from a plugin that was removed
which line is line 29
items.add(itemStack.getType());
Its its leftover data, it cant be from out enchantment plugin
as we never set that Attribute value, so weird that value get set in the first place
my best guess is its a external plugin dome some weird fuckery
this is most likely the case and they just attributed it to your plugin
the itemStack variable is null then since you get a NPE on that line (Or the items variable)
?paste
okay
They sent me a list of plugins they use but i dont see any that could cause that tbf besides a 1.8 pvp plugin AntiCooldown
be surprised
is there a way to disable achievements in 1.8.8 with the spigot api? there is no gamerule for it
Plugins (74): AdvancedEnchantments, AntiCooldown, antiRedstoneClock, AuthMe, BanItem, BeastWithdraw, BetterRTP, BetterShulkerBoxes, BlockLocker, BlowableObsidians, BungeeGuard, CannonFix*, ChatSentinel, CombatLogX, CommandScheduler, CoreProtect, CrazyAuctionsPlus, DeathMessages, DeluxeCoinflip, DeluxeSellwands, EnchantControl_Reforged, EnderContainers, Essentials, EssentialsChat, EssentialsSpawn, ExcellentCrates, Factions, FactionsBridge, FactionsTop, GenBuckets*, HolographicDisplays, Insights, InventoryRollbackPlus, ItemEdit, KOTH, LootChest, LuckPerms, Multiverse-Core, MyCommand, NexEngine, Outpost, OverleveledEnchanter, PearlFix*, PlaceholderAPI, PlayerKits, PlayerPoints, PlugManX (PlugMan), PotionStacker, PrefiX, ProtocolLib, Rankup, RoseLoot, RoseStacker, SafeFly, ShopGUIPlus, ShowItem, SignShop, SimplePortals, SimpleStaffChat2*, SirBlobmanCore (SirBlobmanAPI, XSeries), spark, SuperbVote, TAB, ThrowableCreeperEggs, TradeSystem, TubeTils, UltimateAutoRestart, Vault, Votifier, Vulcan, WildBuster, WorldEdit, WorldGuard, WorldGuardExtraFlags
CBA to go thorugh all these plugins and check though
Those are client sided iirc
https://paste.md-5.net/alolazomij.java Im making an invertory for a bank acount and im getting a strange thing where the title and the lore is the same. eventho on every item i set the meta again and i delete the lore (lorelist.clear()) so i dont understand why its doing this? could somebody help?
potionstacker might seem like one that would
there is some plugins in there I don't know of
like KOTH
sounds familiar though 🤔
yeah its the one premium KOTH plugin
are you editing these while the inventory is open
itemedit
could be a possibility especially if they add that attribute to a item
that might be it tbh
i dont think so bc in the file you can see i run the invertory create when the server starts
now you can claim all the credit with your client and make them think you found the offending plugin 😛
i see
you need to create a new ItemStack for every item in that gui
because your just setting that one items meta over and over again
and the final value is the one thats being set for ALL those items
hmmm not sure
I asked them "I never created an item that added knockback_resistance"
i already know its not an issue with us though i tested on a blank server
doesn't mean no one else did
typically when you do GUI's you want to make a new ItemStack for each item you want to have a different lore on
but as per usual everyone denies doing something wrong
even though it doesn't matter really
not like you or I care XD
okay ill try it
thanks for helping
oh wait holdup
So I was still right
I named both plugins that could be the problem 😛
ngl i didnt know KOTH had that feature and ive used that plugin so many times
I'm having a weird issue and I cant figure out why...
I'm adding an object to a list in a runable (scary ik) [image 1].
Now I want to get that list when an inventory is closed, but the list is aparently empty ? [image 2]
And yes the keys are the same and I've checked the SellGoods is added into the list within the runable
now you can charge them to give them the solution
for tech support
on a plugin that doesn't belong to you
🙂
what's wrong with it ?
Required type Provided particle: Particle Location location: Location Particle
does anyone know which packet accesses the player's absorption health?
uhm...
my scoreboard doesnt work anymore
public void setScoreBoard(Player player) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard scoreboard = manager.getNewScoreboard();
Objective obj = scoreboard.registerNewObjective("BuildFFA", "dummy");
obj.setDisplayName("§eBuildFFA");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
DatabaseTable table = new DatabaseTable("buildffa");
int deaths = 0;
int kills;
for (DatabaseEntry entry : table.getEntries()) {
if (entry.getString("player").equals(player.getName())) {
deaths = entry.getInteger("deaths");
}
}
Score s8 = obj.getScore("§8");
Score s7 = obj.getScore("§6Kills:");
Score s6 = obj.getScore("asda");
Score s5 = obj.getScore("§5");
Score s4 = obj.getScore("§4");
Score s3 = obj.getScore("§6Deaths:");
Score s2 = obj.getScore(String.valueOf(deaths));
Score s1 = obj.getScore("§1");
Score s0 = obj.getScore("§0");
s0.setScore(0);
s1.setScore(1);
s2.setScore(2);
s3.setScore(3);
s4.setScore(4);
s5.setScore(5);
s6.setScore(6);
s7.setScore(7);
s8.setScore(8);
player.setScoreboard(scoreboard);```
no errors
ill just ask the author of KOTH for compensation
i had another run-around with another plugin today too was so annoying
Can you give some more insight on this please
Did you try a full restart of the server
did you acidentaly forget to call the function ?
nope
Are you sure the version that server is running has the particle effect CLOUD
calling it in JoinEvent
ye I'm on 1.18
try testing without the config getter and just use Particle.CLOUD and see if you get the same error
nvm, looks like my sql connection is blocking everything, the events dont work too
sorry
had to do it
you could or wrap your sql events in a CompletableFuture
never used a CompletableFuture lol
how can I run a BukkitTask or Runnable without a delay?
runthe task later with 0 tick delay but iirc that still has a slight delay, not sure though
CompletableFuture is really easy though tbh
i just learned how to do it myself earlier this week, very nice
Yes it works
and likely a lot better than wrapping all your sql events in a async bukkit runnable
but if I use config getter
it gives error
java.lang.NullPointerException: Name is null
at java.lang.Enum.valueOf(Enum.java:271) ~[?:?]
at org.bukkit.Particle.valueOf(Particle.java:9) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at net.pyrobyte.percentageblocks.events.BlockBreak.onBlockBreak(BlockBreak.java:45) ~[PercentageBlocks-1.0.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor344.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[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-184]
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.level.ServerPlayerGameMode.destroyBlock(ServerPlayerGameMode.java:400) ~[?:?]
at net.minecraft.server.level.ServerPlayerGameMode.destroyAndAck(ServerPlayerGameMode.java:354) ~[?:?]
at net.minecraft.server.level.ServerPlayerGameMode.handleBlockBreakAction(ServerPlayerGameMode.java:238) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handlePlayerAction(ServerGamePacketListenerImpl.java:1768) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.handle(ServerboundPlayerActionPacket.java:34) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.handle(ServerboundPlayerActionPacket.java:8) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[?:?]```
events still do not work
Send the config you have
nvm it worked now, I entered the Key wrong
because thats not async, also a strongly reccomend CompletableFuture's for MySQL, trust me its just 2 lines to make them
okay, do you have docs for them? xd
any good tutorial for CompletableFuture ?
https://www.baeldung.com/java-completablefuture for both of you
its what i used
https://www.callicoder.com/java-8-completablefuture-tutorial/
This was also helpful when i was learning them
thanks
should I just use this?
I have a Manager class and it has a loadMaps() function, this function will cache the maps into a list for easy access. Would it be better for me to omit this function and just load the maps on the class initialization since the function will only ever be called once
you could yes, or just use my method 😛
better to use a callback than get() though as get() is blocking
And that one time is right after the class is initialized
that is the point of DB interactions usually
theyre just connecting to mysql so no data to get
you could use the callback method for CompletableFutures though to get the data
and do something in the callback once it completes
just cant use get() for that part
oh wait
my server isnt loading my plugin anymore
but there are no errors
ive just added the depend thing
Use the plugin's name in plugin.yml
what?
ie
the DataGetter plugin
you need to use its name in its own plugin.yml
not the name of the jar file
Example of this btw lynx
you can do stuff later when its complete (ignore red line)
You add that into your pom.xml then
and use its maven imports
ignore the warnings of the server telling you "getting class of something when its not soft depend of this plugin"
server dont know what its talking about 
CompletableFuture#supplyAsync is the thing
:o
it cant enable the plugin when I dont depend it
as that method doesnt have the Throwable option in it
set scope to compile
for my plugin though i use the get() method for completable futures
i think you mean #thenAccept
in my build.gradle?
thats the same as #whenComplete but without the throwable
use compileOnly for that then
I do
ahh yes
does not work
send gradle please
plugins {
id 'java'
}
group = 'de.leleedits'
version = '1.0'
apply plugin: 'java-library'
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
compileOnly(files('/libs/DataGetter-1.0.jar'))
api 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.google.guava:guava:31.1-jre'
testImplementation 'junit:junit:4.13.2'
implementation 'org.mariadb.jdbc:mariadb-java-client:3.0.4'
gradleApi()
}
def targetJavaVersion = 8
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
compileJava.options.encoding = 'UTF-8'
fuck fuck
im sorry
implementation or compile is the right option i beileve its implementation though
^^
sorry im the new sped kid on the block here, just got released from the special ed classroom today
still the same error, it cant find the classes of the library
did you refresh gradle after changing that
in intellij a button should of popped up on the rightish side of screen
hello. I have a small problem. My plugin is not being enabled because "getPluginCommand" is null, which means my plugin.yml is wrong. But it isnt. This is my code which throws the error.
Bukkit.getPluginCommand("pay").setExecutor(new CMD_Pay());
This is my plugin.yml:
`name: SurvivalSystem
author: Josh
version: 1.0
main: de.josh.paddysurvival.Main
api-version: 1.13
depend: [ProtocolLib]
commands:
pay:
description:`
It most certainly does exist as a method on the java plugin class
I do not know if i can ask my question here but can anyone help me getting another server tps from a spigot server?
you need to implement some kind of messaging
I already know that but i didnt find out 😉
ok ty
Why are you trying to do that
trying to give an admin and mod a command to modify that players inventory while theyre offline
why is there a legal issue with that?
i would love that feature, because atm when a player is offline we cant invsee them to check for illegal items
^^
viewing that players inv directly is dangerous as it can corrupt it though(with armor slots). so if u do that i suggest a psuedo inv anyway @upper dock
You'll have to dig through NMS yourself. I doubt many here know
i can do that but id be anoying
Well someone has to do it
xD
Probably is
CMI has that feature
CMI is a mess though
The only way to fetch the player's inventory while offline is to load the .dat file and parse the contents
so why would i bother to use someone elses where im not able to fix bugs
or you can store the player's inventory yourself
which is exactly
what i was asking for
which class is the player file
so i can deserialize it
you do need a HumanEntity to load it
no
is EntityDismountEvent#getDismounted() the entity that was dismounted, or the entity that dismounted?
it's nms
ur saying
¯_(ツ)_/¯
Ah your right. I was a bit confused, because I used "getPluginCommand" before and it always worked....
the file is serialized as HumanEntity?
well with NMS you do
and reserialize if player is still not online
kk
then parse the items yourself or just init them from the nbtcompound using nms
?
getEntity should return the topEntity
and getDismounted should return the entity that getEntity dismounted
but you can always just debug
mhm
each element is a tag list
containing the slot, the item type, how many
any extra data
sec
but it still doesn't work after I changed it
Is plugin.getConfig().getString("thing-from-config.yml") a "slow" operation / is it loading it from file?
Or are the values contained in FileConfiguration for the default config.yml stored on startup?
Why does world.getBlock() cause incredible lagg of 9400ms?
NPC isnt a word, its an abbreviation for a bunch of words
probably because you're doing it like 10k times per tick or something
when a FileConfiguration loads, all its values are parsed into memory
which is great because if you have a huge config, your server hangs for 5 minutes
No
Cheers guys
no only once
Just use it for persistency
you sure
yes
maybe you're calling getBlock for an unloaded chunk
yes that i do
It has to load the chunk in that case
unloaded seem to cause little lagg and ungenerated seem to be worst case
Eg why the delay is so long
Idk test timings on just loading the chunk
if you're running paper
chunk generation should be async
given you call the right method
which you probably aren't
how could u fly with an elytra then that make hundrets of chunks generated
That takes a huge toll on the server you can easily kill a server if you go fast enough there is also always a visible delay when doing this
yes but that are hundrets os one chunk shouldnt be that loong
it seems to do more than just one chunk generate
part of me thinks he's making an rtp plugin
yes
For rtp I always manually load the chunk then teleport
chunk#load
but then the code after that iss missing the values?
still doesnt tell why one chunk needs so much
Maybe crap hardware idk all I do is test around till I get the better performance doing some educated guess work
servers die for stupid reasons
can you provide your plugin yml in a pastebin
?paste
I woke up to 5tps on my test server because I was looping through every entity in the world, every tick
Very reccomend you manually load chunk though
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
PercentageBlocks.getInstance().reloadConfig();
sender.sendMessage(PercentageBlocks.getInstance().getConfig().getString("Messages.Reload"));
return true;
}
}```
Safer for the players teleport too
you have to reparse every value you're reading
i mean what does getblock do?
Yaml#loadConfigurationFile or something alone those lines
he's using the reloadconfig method on JavaPlugin
Oh ewww
man's reading once, reloading and then just not re-reading it
of course. give me a moment.
In that case, the /pay as well as the /claimfriend command throw errors, the other ones dont.
Well I'd have to read the source to actually know but I'd be pretty sure it loads the chunk than gets that specific block without code though I could have no clue why it's taking so long possibly your other code is whats causing the delay
Eg conditions for to can't be met
Slow performance elsewhere etc
Oh also bad hardware
is it possible only one chunk to generate? maybe even temp? like, i think it checks the surrounding chunks too
oh
Thanks I was too lazy
and yes it loads the chunk
if a chunk would take 9000ms to generate, the server would die if you move
what's the problem with hosting a server on a pentium 4
Idk what hardware he has
no i checked systemtime before and after the getblock method, my code just took 0,2ms
very confusing, looks okay ?
have you checked the jars content
This is so weird. I just made a new plugin with the same plugin.yml, except I removed the other commands and the commands works.
What do you mean by that?
no my question was why a normal chunk generate is fast but that isnt
because your code is garbo
open your jar with winrar
and check the plugin.yml
Probably above
gimme a sec
... its the getblock method causing the lagg
PercentageBlocks.getInstance().saveConfig();```
the plugin.yml in the exported jar is wrong.
this is how to reload config?
👍 👌
The two entries are missing.
What should I do now?
then you didn't compile properly
do a clean compile
mvn clean install
or gradlew clean build
whatever
how to reload config
at least I know where the problem is now. Thank you
how would i make it so i have an int that changes for each player? for example, im making a gold mining plugin. How would I make it so when a player breaks gold ore, their number goes up and only their number
wait, i may have found a solution using hasdmaos
*hasmaps
Can you get the entity an entity is riding?