#help-development

1 messages · Page 2094 of 1

tender shard
#

just try it 😛
spawn an entity in front of the player, go through a nether portal, come back, see if you can still see your custom entity

misty current
#

alright, i'll finish the boilerplate code and do some testing

#

thanks

wild cedar
#

Hey there, has anyone worked with TinyProtocols previsouly? I want to cancel a few packets without protocollib and saw TinyProtocols as a good alternative

tender shard
#

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 😄

echo basalt
#

dontasktoask

wild cedar
#

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.

echo basalt
#

protocollib's presence is bigger than paper itself

#

tinyprotocol works fine

#

but it's a bit more barebones

wild cedar
#

True, I had a bit difficult time understanding it, so I just show my code snippet

echo basalt
#

if you're getting into packets you should be able to easily reverse-engineer most plugins

wild cedar
#

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

echo basalt
#

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

wild cedar
tender shard
#

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.

wild cedar
#

That's the point, especially with TinyProtocol, that's why I was considering other ways too

tender shard
#

I just searched for TinyProtocol and all I found is a 2000 downloads plugin made for 1.8 and 1.9

echo basalt
#

tinyprotocol is a utility that should be shaded into plugins

#

made by protocollib guy

#

dmulloy or comphenix

tender shard
#

oh yeah so that means you'll have to manually update your own plugin on every update anyway

echo basalt
#

not really a plugin

tender shard
#

kinda making using it useless

echo basalt
#

thing is tinyprotocol is purely reflection-based so updates aren't that frequent

tender shard
#

if you have to release an update for every version anyway, you could also just use NMS packets anyway imho

tender shard
#

so although I don't know much about TinyProtocol, i'd go with ProtocolLib. ALthough I truly hate ProtocolLib

wild cedar
#

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

tender shard
echo basalt
#

the best way to do it is to ditch spigot and make your own server impl

tender shard
tender shard
#

or was that a joke?

echo basalt
#

obviously a joke

#

seems like every 17 year old in this community is making their own server from scratch :p

tender shard
#

there once was a nice graphic showing all the different server forks but I can't find it anymore

echo basalt
#

forks are one thing

#

I mean like full blown rewrites

#

heck I've even witnessed a 40k$ legal battle over 2 spigot forks

wild cedar
echo basalt
#

I can't remember exactly

#

but stellarspigot sued litespigot

#

and litespigot won iirc

tender shard
#

wow they both look like shit

lavish hemlock
#

Isn't StellarSpigot that StellarDev scam thing?

echo basalt
#

yessir

#

I kinda scammed that guy but tbf he also scammed many others

tender shard
#

I doubt that anyone sued anyone

lavish hemlock
#

God how much fucking money does that group have to spend...?

echo basalt
#

¯_(ツ)_/¯

#

the owner has a private gym

echo basalt
#

a few months ago

#

kinda learned it first-hand

patent horizon
#

how do i get a list[] kind of list in java

#

instead of the one that uses .add() and whatnot

lavish hemlock
#

Do you mean an array of lists...?

patent horizon
#

no like just a typical array

lavish hemlock
#

Or are you referring to just an array?

patent horizon
#

ye

echo basalt
#

list.toArray(new whateverobject[0]);

lavish hemlock
#
String[] arr = new String[5]; // example length
arr[0] = "...";

// or

String[] arr = new String[]{ "..." };
patent horizon
#

hm lemme restate my question in a better way

#

i feel like there's a million different ways doing this is easier

lavish hemlock
#

List.of or Arrays.asList

#

There's also uhh

#

ImmutableList.of from Guava iirc

lavish hemlock
patent horizon
#

mhm

lavish hemlock
#

Java would interpret that as a ArrayList<Object>

#

So you'd want new ArrayList<Placeholder>();

vocal cloud
#

I despise var. It makes everything so ugly and look dynamic sadman

lavish hemlock
#

Honestly

#

Just get the fuck used to it

#

80% of all modern languages use var, let, or const

echo basalt
#

I'm not that big of a fan of var either

#

yay for not knowing what any variable type is

lavish hemlock
#

But you do though

echo basalt
#

do you really

lavish hemlock
#

You wrote the code, you wrote the instantiation of the variable

#

You know the type of the variable

echo basalt
#

if you're doing a mega fast read of someone else's code

lavish hemlock
#

You shouldn't do that anyways though

#

Reading code quickly is a good way to misinterpret it

vocal cloud
#

Yeah but you have to know what returns what.

lavish hemlock
#

(And var is the least of your problems)

echo basalt
#

let me grab a cup of tea for each individual class I read

lavish hemlock
#

Allows you to hover over method calls to view their descriptors.

#

Crazy, right?

echo basalt
#

rip pastebins

#

we'll all share code through our ides

vocal cloud
#

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

lavish hemlock
#

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.

echo basalt
#

I mean

#

it's pretty much why I hate python

vocal cloud
#

Same

echo basalt
#

python took that shit so far that no ide knows what to autocomplete with

lavish hemlock
#

That's because Python is a shit language

spring pike
#

can I put a Map into a listener class or should I put it elsewhere?

spring pike
#

okay thanks

lavish hemlock
#

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"

echo basalt
#

all you java developers

#

you're advocating for non-boilerplate code

#

and that's the problem

lavish hemlock
#

I respect the self-awareness at least lmao

echo basalt
#

:)

#

only reason why I haven't moved to kotlin during these past 5 years is because I actually enjoy boilerplate

vocal cloud
#

No it's not that I overestimate it. I don't like it because when I deal with it I get lost too easily

lavish hemlock
#

Boilerplate makes my brain go into autopilot so I can't really comment on it

echo basalt
#

my code comments itself

lavish hemlock
#

My code is never commented or documented lol

echo basalt
#

I can't really just

lavish hemlock
#

...well unless I'm crediting StackOverflow or making fun of some shit lines I wrote

echo basalt
#

FileConfiguration config = getConfiguration(); // Gets the configuration and assigns it to the config variable

lavish hemlock
#

var config = getConfiguration() omg it's so much harder to read I dunno what I'm ever gonna do

echo basalt
#

boilerplate just describes itself

vocal cloud
#

BuT YOu cAN jUsT var config dogekek

echo basalt
lavish hemlock
#

Look at how it's used

echo basalt
#

or is it a wrapper class for a config

dry forum
#

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

echo basalt
#

name + File.separator + "kits"

lavish hemlock
#

This is why we use java.nio.Path :p

echo basalt
#

I mean for saveResource

dry forum
#

what i have there "name" is the name of the file to save in just the resource file

echo basalt
#

using any generic file separator works for Files

dry forum
#

so would it be "directory" + file.sep + "file name"?

echo basalt
#

but saveresource doesn't handle that internally

lavish hemlock
#

I have never understood why those Bukkit resource methods exist

dry forum
#

ight ty

lavish hemlock
#

What if you don't wanna use YAML or Bukkit's predefined paths? lol

echo basalt
#

well

#

handle it yourself

#

95% plugins use yml

lavish hemlock
#

(Which is honestly a travesty)

echo basalt
#

if you want to make a config file on the plugins folder you're quite special

tender shard
echo basalt
#

:)

#

I can also break if you present me weird characters in my life

tender shard
#

the best solution is to always use new File(parent, "child.yml");

echo basalt
#

just like spigot, we can't always be perfect

stuck flax
#

How would I go about making a staff chat for bungeecord

tender shard
#

I bet this will lead to problems when someone now hardcodes "test\folder"

echo basalt
tender shard
stuck flax
tender shard
#

for(ProxiedPlayer player : getProxy().getOnlinePlayers()) if(player.hasPermission("staffChat")) ...

tender shard
#

there's many file systems that support it

echo basalt
#

I remember writing it as / and people complaining it didn't work on windows or somethin

tender shard
#

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

quaint cave
#

What is the best way to add compatibility with items of all versions?

rugged cargo
#

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!

gritty basin
#

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

kind hatch
#

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?

kind hatch
dry forum
#

if i made 4 config sections in a config section would they be in order of which was added 1st or alphabetical?

rugged cargo
kind hatch
tranquil viper
#

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

last ledge
#

on line public void Fill(){

#

commands.add(command, percent);

#

dk where the mistake is

worldly ingot
tranquil viper
#

I'll research that out, thank you.

worldly ingot
tranquil viper
worldly ingot
#

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
tranquil viper
#

I’m using 4.3

#

Thanks for the help

worldly ingot
#

3.12.x is latest on Maven though? PES_Think

#

Oh they deploy to another repository (EDIT: wait no they don't. I'm confused lol)

#

Can't use libraries then

last ledge
#

public void Fill(){ Expected ;

tranquil viper
worldly ingot
#

Ah, changed artifact ids, that's why I couldn't find it

#

Then yeah you can use that instead in libraries

tranquil viper
#

Alright cool thank you a lot 🙂

cinder karma
#

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.

worldly ingot
#

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

cinder karma
#

is BungeeChat available on vanilla Spigot plugins?

#

(I've never even looked at Bungee stuff)

worldly ingot
#

Yes

#

It's shaded into Spigot

kind hatch
#

BaseComponents and TextCompoents are part of the API. The caveat is that you need to use the #spigot() method.

tranquil viper
cinder karma
#

that's fine, thank you so much for the clarification. Why isn't that document the first result on Google? No way to know 🙂

worldly ingot
#

And your plugin.yml?

tranquil viper
#
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"

last ledge
worldly ingot
#

If you make your pom.xml dependency set to the provided scope it may work

#

(and you can remove shade)

kind hatch
tranquil viper
#

Still getting the same error.

last ledge
worldly ingot
#

aPES_Think What's your startup log look like?

tranquil viper
#

What do you need to see in it? Not sure what I'm aloud/not aloud to share in it.

worldly ingot
#

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

tranquil viper
#

Ah I don't see that, also just realized Vault loads after and it's needed to load before.

worldly ingot
#

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

cinder karma
worldly ingot
#

Well, no, but a ComponentBuilder instance should have a .create() method iirc to get you a BaseComponent[] which player.spigot().sendMessage() does accept

cinder karma
#

BaseComponent component = new ComponentBuilder("Welcome!").color(ChatColor.AQUA);

#

...

worldly ingot
#

Yeah, .create() on that, and it's an array of components

cinder karma
#

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

worldly ingot
#

o/

tranquil viper
#

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

worldly ingot
#

Always works on one computer but not the other lol

tranquil viper
#

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

worldly ingot
#

It's just Vault that isn't working as expected?

tranquil viper
#

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.

worldly ingot
#

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?

tranquil viper
#

Looked around the forums, maybe because I didn't put essentials into my host it's not working properly

kind hatch
#

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.

worldly ingot
#

Definitely didn't get adopted by developers

wet breach
kind hatch
#

That's a shame. It looked promising.

lean lynx
#

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

wet breach
#

what kind of articles?

#

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

flat olive
#

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.

flat olive
buoyant viper
#

this exists at the bottom of jetbrains javadocs page @tropic idol

#

maybe it could help

#

looks like even jb knows their generators kinda fuckd

last ledge
#
String
Provided:
int```
restive tangle
#

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

plain helm
#

you can use a if

restive tangle
#

I'll have to repeat it though

plain helm
#

why?

#

don't you just check the level

restive tangle
#

No, I want to make sure the gear they get is between a certain level

plain helm
#

what's the maximum level that a player can reach?

restive tangle
#

16

plain helm
#

you should also specify the type of ArrayList

#

so put ArrayList<String>

plain helm
restive tangle
#

What do you mean?

plain helm
#

switch between all the 16 cases

#

there is an armor for each level, right?

restive tangle
#
            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)
            )
plain helm
#

oh

#

does this code work?

last ledge
restive tangle
#

I haven't tested it, it should. I just want to know if there is a better way

plain helm
#

replace this " HashMap<ArrayList, String> commands = new HashMap<>();" with this : HashMap<ArrayList<String>, String> commands = new HashMap<>();

midnight shore
#

Map<ArrayList<String>, String>

plain helm
restive tangle
#

I don't need to do that

last ledge
#

commands.put(command, percent);

plain helm
restive tangle
#

I just want to know if a do-while loop is an alright way of enforcing a level of gear

last ledge
#

cause its number value

plain helm
last ledge
#

will be easy for me to calculate later

plain helm
#

and then to get an int again Integer.parseInt(commands.get(command));

last ledge
#

also whys there error in public void Fill(){

plain helm
#

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

plain helm
#

i never tried anything like that

vocal cloud
#

try it and see?

ebon coral
#

How to get the corners of chunks in 1.18?

#

Not really sure with the new height limit situation

ebon coral
#

Ahh okay that's so much help, thank you!

simple silo
#

Can I have a custom event which has listeners in multiple plugins?

eternal night
#

Sure

simple silo
#

How do I do it?

eternal night
#

You can code up the event and other plugins can depend on your plugin to listen to it

simple silo
#

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?

wet breach
#

if you learned java basics

#

you wouldn't be here so much asking for help

#

with every little thing you are doing

simple silo
#

just include the "event plugin" as library? would it work?

simple silo
wet breach
#

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

supple elk
#

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

restive tangle
#
function something() {
  while (something) {
    does something...
  }
}
something()
print("T")

Will "T" print only once the while loop ends called from the method?

vocal cloud
#

Um that's a very basic java question

restive tangle
#

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

restive tangle
#

Alright, thanks

supple elk
#

np

supple elk
#

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...

glossy venture
#

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

zealous osprey
#

That's a cool diagram

glossy venture
#

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

supple elk
#

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?

zealous osprey
#

Is it important in which order the items are placed into the crafting station ?
Nvm, I just read the thread

supple elk
glossy venture
#

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

zealous osprey
supple elk
#

right

glossy venture
#

or something like that

glossy venture
#

that was an example of how im doing shaped crafting

supple elk
glossy venture
#

but now i want shapeless

#

yeah

#

i might just look into how minecraft does it rq

zealous osprey
supple elk
#

probably adds a shapeless recipe for all different woods or some shit x_x

glossy venture
#

but then i would have to get every permutation for every possible item per slot

supple elk
#

how do you your matchers work?

glossy venture
#

i have the code on gh

#

one sec

#

you might be able to figure it out ill explain it simply too

supple elk
#

what if you had something like this

supple elk
#
class counter<T> {
    int count;
    T counted;

    public void increment() {
      count++;
    }
}```
#

or just store an obj rather than a generic

glossy venture
#

oh and then do that for every item in the matrix

supple elk
#

yeah

#

or count ur matcher

glossy venture
#

and then maybe sort it based on count

supple elk
#

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

glossy venture
#

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'

supple elk
#

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

glossy venture
#

true

supple elk
#

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

rapid rock
#
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

supple elk
#

use 3x `

glossy venture
#

?paste

undone axleBOT
supple elk
rapid rock
rapid rock
#

trynna remove an item when accquired

glossy venture
#

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

rapid rock
#

o

#

lmc

glossy venture
#

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)
  );
upper dock
#

Is there a non-deprecated version of setSpawnedType?

#

for SpawnEggMeta

vocal cloud
#

No? Read what the deprecation reason is

upper dock
#

Thats unfortunate, I want a way to spawn a boss mob or such from an egg, which can normally only be spawned with /summon

noble lantern
#

normally if something gets deprecated there is something else to replace it

eternal night
#

which, there is

upper dock
#

there is setType but it sets the item type

eternal night
#

there is no single spawn egg item anymore

#

they all have their individual material

upper dock
#

not what i mean

#

lets say i wanted to make a zombie spawn egg have a giant instead

noble lantern
#

apply a PDC to that egg, listen to interact event

eternal night
#

Then you change the type of the itemstack

tacit drift
#

Any javascript wizards in here?
How do I change the value href from an <a> element?
setAttribute didn't work

eternal night
#

oh

#

that never worked before did it

noble lantern
#

cancel it, then spawn the mob you want

upper dock
#

would there just be a way to apply specific nbt to an item in an itemstack?

noble lantern
#

thats kind of what PDC is

#

its just spigot's own personal NBT container, but not the actual Minecraft NBT itself

upper dock
#

oh okay, never used it before

noble lantern
#

?pdc

upper dock
#

thanks

noble lantern
#

its relatively simple tbh

#

just takes some understanding the first run-through

noble lantern
upper dock
#

but PDC would only apply to servers with that plugin right?

noble lantern
#

omfg this discord lag man

upper dock
#

what I mean is, if I have an item which does something with PDC on spigot, will it do the same in singleplayer?

eternal night
#

🤔

#

singleplayer ?

noble lantern
#

nope, your plugin handles the PDC itself unless you find a way to have spigot plugins on singleplayer lol

#

if you do lmk

upper dock
eternal night
#

Yea but why would anyone care for singleplayer 🤔

noble lantern
#

but, the PDC should stay when transferred to singleplayer, it just wont do any actions, hence the name persistant data container

eternal night
#

^ you could just not use the item correctly

faint cypress
#

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?

eternal night
#

if you get it back from your creative save slot on the server, it should still work

upper dock
#

okay thanks

eternal night
#

pass the plugin instance to the constructor

noble lantern
#

hehe, slightly faster lynx :p

#

okay i go now time to work on randomly generating islands

faint cypress
#

Thanks guys

eternal night
#

:p

torn vale
#

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));
    }```
upper dock
#

The enum isn't a constant

#

Or else there isn't an enum from what i can read

torn vale
#

uhm

tender shard
#

Are you actually using 1.8 R1?

torn vale
#

so... how to change this? I never used this chat buttons think

upper dock
#

wait 1.8...

tender shard
#

It says 1_8_R1

#

Which would mean 1.8.3 or ealier iirc

torn vale
#

oh wait

#

I used the 1.12 api (i need the 1.8.8 api) now I get the following error:

upper dock
#

bukkit api or spigot api?

torn vale
#

spigot

tender shard
#

Does the chatcomponent api even exist in 1.8? Im not sure

noble lantern
#

i dont think so

#

in 1.8 you needed to use packets/nms

upper dock
#

"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."

torn vale
vocal cloud
#

In 1.8 you update to 1.18 that solves a lot of problems

torn vale
#

I need to do it in 1.8 :/

noble lantern
#

Is this a plugin your releasing on spigot

torn vale
#

its for a friend of mine

upper dock
#

Lele you using maven or gradle?

torn vale
#

gradle

upper dock
#

go to build.gradle

#

and dependincies

torn vale
#

yes

upper dock
#

show me what it says

torn vale
upper dock
#

so I think you're using the 1.8.8 api

torn vale
#

yes

upper dock
tender shard
#

player.spigot().sendMessage(BaseComponent…) is the method you need to use

torn vale
noble lantern
#

your string needs to be encapsulated in a TextComponent as well

#

and send them as varargs

#

(comp1, comp2, comp2);

upper dock
#

wait shouldnt it be ChatColor.Blue?

#

or was that changed

noble lantern
#

translateAlternateColorCodes is a lot nicer

#

rather than sending the double s

upper dock
#

the weird thing is lele is using &

torn vale
upper dock
#

so even if it worked it would just look like &c in the chat, not blue

torn vale
noble lantern
noble lantern
#

(comp1, comp2, comp3)

#

not comp1 + comp2 + comp3

upper dock
#

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

torn vale
#

now it works, tysm!

quaint mantle
#

If !(player.isFlying()) ?

#

So just check on that event if player tries to fly and cancel the fly event or what every you try to do

eternal oxide
#

if you want them to stop flying you have to setFlying as well as setAllowFlying

torn vale
#

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
zealous osprey
#

Did you die due to something that is not a player ?

#

I'm assuming the killer is null

torn vale
#

wait a sec

zealous osprey
torn vale
#
        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
zealous osprey
#

so add a pearl if the inventory doesnt already contain one ?

torn vale
#

yes, and if it already contains one add one more to the pearl

#

so basically just add a pearl to the inventory

zealous osprey
#

there is a method called Inventory#addItem(), which will just add an item of that type to the inventory

noble lantern
#

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

torn vale
zealous osprey
#

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().

torn shuttle
#

I have been betrayed by what I thought was my closest ally

torn vale
torn shuttle
#

intellij just launched ignoring my dark theme preferences

#

rip eyes

zealous osprey
#

XD

noble lantern
torn shuttle
#

this is unforgivable

zealous osprey
noble lantern
frigid rock
#

does anybody know what this error means?

summer scroll
wet breach
#

however it has to be the correct metadata for it to work

noble lantern
#

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

wet breach
#

its possible, I don't know the various attributes to use in regards to metadata just know you can change them with metadata

noble lantern
#

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

young knoll
#

Have you tried changing the value

noble lantern
#

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>

torn shuttle
#

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

noble lantern
#
[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

young knoll
#

That’s a massive number

#

It has e308 on the end

torn shuttle
noble lantern
# young knoll That’s a massive number

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

torn shuttle
#

oh boy do you have a dank anime pic as the bg of your ide

young knoll
#

What

noble lantern
#

damn right

torn shuttle
#

degenerates I swear

noble lantern
#

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

  1. Get that attribute tag added
  2. for it to persist after our plugin is unistalled
torn vale
#

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);
    }```
noble lantern
wet breach
#

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

glossy venture
#

you need to manually parse the placeholders

noble lantern
glossy venture
#

you cant just set the lines and expect it to work

torn vale
noble lantern
#

got the config from end user, testing now gimme a few moment

torn shuttle
wet breach
#

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 😛

torn shuttle
#

that was a fun debug when I woke up the next day

noble lantern
#

just create a runnable and cancel it when times up lmfao

wet breach
noble lantern
#

okay fr brb testing this meta data value

torn vale
#

why does it only set one empty line?

noble lantern
#

end user lied to me bois

young knoll
#

Duplicate scoreboard lines don’t work afaik

#

You would have to make each empty line different with like, color codes

noble lantern
#

me rn

torn vale
torn vale
#

oh

wet breach
#

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

noble lantern
#

i just tested it on theyre exact environment and that Attribute never even gets set past the default value minecraft sets

torn vale
#
@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
noble lantern
#

1.16.5, and cant replicate theyre issue which is very odd

wet breach
noble lantern
torn vale
#
                items.add(itemStack.getType());
noble lantern
torn vale
#

bruh nvm

#

oh nope

#

okay, idk xd

#

im kinda confused rn

noble lantern
#

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

wet breach
noble lantern
exotic jetty
#

?paste

undone axleBOT
torn vale
#

okay

noble lantern
torn vale
#

is there a way to disable achievements in 1.8.8 with the spigot api? there is no gamerule for it

noble lantern
#
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

noble lantern
exotic jetty
#

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?

wet breach
#

there is some plugins in there I don't know of

#

like KOTH

#

sounds familiar though 🤔

noble lantern
#

yeah its the one premium KOTH plugin

noble lantern
wet breach
noble lantern
#

could be a possibility especially if they add that attribute to a item

#

that might be it tbh

exotic jetty
#

i dont think so bc in the file you can see i run the invertory create when the server starts

wet breach
noble lantern
#

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

exotic jetty
#

hmmm not sure

noble lantern
noble lantern
wet breach
#

but as per usual everyone denies doing something wrong

#

even though it doesn't matter really

#

not like you or I care XD

exotic jetty
#

thanks for helping

wet breach
noble lantern
#

blaming it on koth as they said it had an error earlier

#

indeed 😛

wet breach
#

I named both plugins that could be the problem 😛

noble lantern
#

ngl i didnt know KOTH had that feature and ive used that plugin so many times

zealous osprey
#

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

wet breach
#

for tech support

#

on a plugin that doesn't belong to you

#

🙂

last ledge
#

How to fix this

zealous osprey
#

what's wrong with it ?

last ledge
#

Required type Provided particle: Particle Location location: Location Particle

mighty pier
#

does anyone know which packet accesses the player's absorption health?

torn vale
#

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

noble lantern
#

i had another run-around with another plugin today too was so annoying

noble lantern
noble lantern
torn vale
#

yes, I restart it everytime

#

my scoreboard doesnt even appear anymore :/

zealous osprey
#

did you acidentaly forget to call the function ?

torn vale
#

nope

noble lantern
torn vale
#

calling it in JoinEvent

noble lantern
torn vale
#

nvm, looks like my sql connection is blocking everything, the events dont work too

torn vale
#

xd

#

BukkitTask?

noble lantern
#

you could or wrap your sql events in a CompletableFuture

torn vale
#

never used a CompletableFuture lol

#

how can I run a BukkitTask or Runnable without a delay?

noble lantern
#

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

noble lantern
#

and likely a lot better than wrapping all your sql events in a async bukkit runnable

last ledge
#

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) ~[?:?]```
last ledge
noble lantern
torn vale
#

okay, do you have docs for them? xd

wary harness
#

any good tutorial for CompletableFuture ?

noble lantern
torn vale
#

uhm

#

thats not just 2 lines lol

wary harness
#

thanks

torn vale
#

should I just use this?

restive tangle
#

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

noble lantern
#

you could yes, or just use my method 😛

#

better to use a callback than get() though as get() is blocking

eternal night
#

runAsync is not really useful

#

you want to return data

restive tangle
#

And that one time is right after the class is initialized

eternal night
#

that is the point of DB interactions usually

noble lantern
#

theyre just connecting to mysql so no data to get

eternal night
#

ah

#

Well then I guess

noble lantern
#

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

torn vale
#

oh wait

#

my server isnt loading my plugin anymore

#

but there are no errors

#

ive just added the depend thing

noble lantern
#

Use the plugin's name in plugin.yml

torn vale
#

what?

noble lantern
#

ie

#

the DataGetter plugin

#

you need to use its name in its own plugin.yml

#

not the name of the jar file

noble lantern
#

you can do stuff later when its complete (ignore red line)

torn vale
#

its a MySQL library

noble lantern
#

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 think

tardy delta
#

CompletableFuture#supplyAsync is the thing

noble lantern
#

yeah i know frost told me the right method to use i couldnt remember it

#

ty bush

tardy delta
#

:o

torn vale
#

it cant enable the plugin when I dont depend it

noble lantern
#

as that method doesnt have the Throwable option in it

noble lantern
#

for my plugin though i use the get() method for completable futures

tardy delta
torn vale
tardy delta
#

thats the same as #whenComplete but without the throwable

noble lantern
torn vale
#

I do

noble lantern
torn vale
#

does not work

noble lantern
torn vale
#
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'

noble lantern
#

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

torn vale
#

still the same error, it cant find the classes of the library

noble lantern
#

did you refresh gradle after changing that

#

in intellij a button should of popped up on the rightish side of screen

torn vale
#

any solutions?

raven ravine
#

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:`

eternal night
#

you generally want to use getCommand(name)

#

instead of Bukkit.getPluginCommand

raven ravine
#

getCommand(name) doesnt exist anymore

#

in spigot 1.18.2

eternal night
#

It most certainly does exist as a method on the java plugin class

silk sentinel
#

I do not know if i can ask my question here but can anyone help me getting another server tps from a spigot server?

echo basalt
silk sentinel
echo basalt
#

I often use redis

#

just google "redis pubsub" or something

silk sentinel
#

ok ty

granite owl
#

which class do the player files are from?

#

trying to deserialize the whole thing

chrome beacon
#

Why are you trying to do that

granite owl
#

why is there a legal issue with that?

upper dock
#

i would love that feature, because atm when a player is offline we cant invsee them to check for illegal items

granite owl
#

which is obv not possible in its serialized state

#

while the player is offline

granite owl
#

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

chrome beacon
#

You'll have to dig through NMS yourself. I doubt many here know

granite owl
chrome beacon
#

Well someone has to do it

granite owl
#

xD

chrome beacon
#

Probably is

echo basalt
#

CMI has that feature

chrome beacon
#

CMI is a mess though

granite owl
#

i dont want to use other ppls plugins

#

im well capable to write my own

echo basalt
#

The only way to fetch the player's inventory while offline is to load the .dat file and parse the contents

granite owl
#

so why would i bother to use someone elses where im not able to fix bugs

echo basalt
#

or you can store the player's inventory yourself

granite owl
#

what i was asking for

#

which class is the player file

#

so i can deserialize it

echo basalt
#

PlayerInventory

#

a(NBTTagList) saves it

#

b(NBTTagList) loads it

granite owl
#

nvm

echo basalt
#

you do need a HumanEntity to load it

granite owl
#

no

rough drift
#

is EntityDismountEvent#getDismounted() the entity that was dismounted, or the entity that dismounted?

granite owl
#

why

#

so

echo basalt
#

it's nms

granite owl
#

ur saying

echo basalt
#

¯_(ツ)_/¯

raven ravine
granite owl
#

the file is serialized as HumanEntity?

echo basalt
#

nope

#

the PlayerInventory class contains the HumanEntity the inventory belongs to

granite owl
#

doesnt help

#

u dont need to load the player as if he was online

echo basalt
#

well with NMS you do

granite owl
#

only create a new instance

#

alterate it as you please

echo basalt
granite owl
#

and reserialize if player is still not online

echo basalt
#

ugh ffs

#

read the .dat file yourself

#

you can use NBTAPI to read nbt files

granite owl
#

kk

echo basalt
#

then parse the items yourself or just init them from the nbtcompound using nms

echo basalt
#

getEntity should return the topEntity

#

and getDismounted should return the entity that getEntity dismounted

#

but you can always just debug

rough drift
#

mhm

echo basalt
#

containing the slot, the item type, how many

#

any extra data

granite owl
#

sec

raven ravine
grim ice
#

Yes

#

its a bunch of existing words

faint cypress
#

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?

coral pilot
#

Why does world.getBlock() cause incredible lagg of 9400ms?

grim ice
#

NPC isnt a word, its an abbreviation for a bunch of words

echo basalt
echo basalt
#

which is great because if you have a huge config, your server hangs for 5 minutes

faint cypress
#

Cheers guys

grim ice
#

but u shouldnt use config stuff as a database

#

store ur stuff somewhere on enable

grim ice
#

Just use it for persistency

echo basalt
coral pilot
#

yes

echo basalt
#

maybe you're calling getBlock for an unloaded chunk

coral pilot
#

yes that i do

river oracle
#

It has to load the chunk in that case

coral pilot
#

unloaded seem to cause little lagg and ungenerated seem to be worst case

river oracle
#

Eg why the delay is so long

coral pilot
#

a chunk generate should not need 9000ms

#

maybe 10? or 20

echo basalt
#

you overestimate your server's performance

#

fun fact

river oracle
#

Idk test timings on just loading the chunk

echo basalt
#

if you're running paper

#

chunk generation should be async

#

given you call the right method

#

which you probably aren't

coral pilot
river oracle
coral pilot
#

yes but that are hundrets os one chunk shouldnt be that loong

#

it seems to do more than just one chunk generate

echo basalt
#

part of me thinks he's making an rtp plugin

coral pilot
#

yes

river oracle
#

For rtp I always manually load the chunk then teleport

echo basalt
#

chunk#load

coral pilot
#

but then the code after that iss missing the values?

#

still doesnt tell why one chunk needs so much

river oracle
#

Maybe crap hardware idk all I do is test around till I get the better performance doing some educated guess work

echo basalt
#

servers die for stupid reasons

eternal night
#

?paste

undone axleBOT
echo basalt
#

I woke up to 5tps on my test server because I was looping through every entity in the world, every tick

river oracle
#

Very reccomend you manually load chunk though

last ledge
#
    @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;
    }
}```
river oracle
#

Safer for the players teleport too

last ledge
#

I'm trying to reload config

#

but its not working

echo basalt
#

you have to reparse every value you're reading

coral pilot
river oracle
#

Yaml#loadConfigurationFile or something alone those lines

echo basalt
river oracle
#

Oh ewww

echo basalt
#

man's reading once, reloading and then just not re-reading it

raven ravine
raven ravine
river oracle
# coral pilot i mean what does getblock do?

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

coral pilot
#

is it possible only one chunk to generate? maybe even temp? like, i think it checks the surrounding chunks too

echo basalt
coral pilot
#

oh

river oracle
echo basalt
#

and yes it loads the chunk

coral pilot
#

if a chunk would take 9000ms to generate, the server would die if you move

echo basalt
river oracle
#

Why it's probably your code

#

Or hardware

echo basalt
#

what's the problem with hosting a server on a pentium 4

river oracle
#

Idk what hardware he has

coral pilot
eternal night
#

have you checked the jars content

raven ravine
raven ravine
coral pilot
echo basalt
#

because your code is garbo

echo basalt
#

and check the plugin.yml

river oracle
raven ravine
coral pilot
last ledge
#
        PercentageBlocks.getInstance().saveConfig();```
raven ravine
last ledge
#

this is how to reload config?

river oracle
raven ravine
#

What should I do now?

echo basalt
#

do a clean compile

#

mvn clean install

#

or gradlew clean build

#

whatever

last ledge
#

how to reload config

raven ravine
#

at least I know where the problem is now. Thank you

night torrent
#

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

rough drift
#

Can you get the entity an entity is riding?