#help-development

1 messages · Page 1421 of 1

vast quest
#

I just want it to first give a response like yes or no

#

and then continue the best

#

rest

summer scroll
#

Will using CompletableFuture block the thread?

eternal oxide
#

You could do that but its not easy. You would basically have to allow the server to start and disable your plugin til the response comes back,. Then start it

vast quest
#

oh

rotund pond
#

Hello !
I'm wondering how I could do this without a deprecated method ...

I only have a player name (as a string), and this player can be online OR offline ! :/

vast quest
#

well eh

quaint mantle
#

anybody knows 😭

vast quest
#

I really dont need to stop the plugin

eternal oxide
vast quest
#

cuz rn it checks after the server starts

eternal oxide
#

You can start your check as the server is starting, then finish it after

#

You can not halt the server to wait for your update check

vast quest
#

how can I finish it before the server starts

eternal oxide
#

you can;t

vast quest
#

mhm

eternal oxide
#

well, you can kind of

vast quest
#

so even if it takes longer than the 2-3 seconds it takes

#

it needs to send it after

eternal oxide
#

the server will start but no one can join till you allow them

vast quest
#

eh

#

ig

eternal oxide
#

I have no idea what ig is

vast quest
minor garnet
#

does anyone know how i can solve this problem?

eternal oxide
#

You can NOT stop the server to wait

rotund pond
eternal oxide
rotund pond
vast quest
rotund pond
#

I'm going to give up my head idea, it's a shame ...
Wait, maybe I can use a header API?

#

🏆

sullen dome
#

what are you trying to do? if i get it right, just use the PluginLoadEvent

vast quest
#

me?

sullen dome
#

yeah

vast quest
#

Im trying to do check for updates and after everything is done

#

im trying to send a message that shows how long it took

#

but after everything is done

sullen dome
#

what does everything mean? the server-start-process?

#

or the plugin-check-process

vast quest
#

like

#

it checks for updates

#

and after that

sullen dome
#

update-check-process

my bad

vast quest
#

after everything in the ploogin

sullen dome
#

just start a runnable when starting the update-check
inside, do your update-stuff, and increment an int.

if it's done, you have the int in seconds, how long it took

#

nvm, don't do the update-check every second. only the increment

vast quest
#

I already have the thing ready

#

it just does not wait for update stuff to be done

#
package whyhax.particlemanager;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.text.DecimalFormat;
import java.util.logging.Logger;

public final class ParticleManager extends JavaPlugin {

    DecimalFormat df = new DecimalFormat("0.00");

    @Override
    public void onEnable() {
        Logger logger = this.getLogger();

        long start = System.currentTimeMillis();
        long fin = System.currentTimeMillis() - start;

        new UpdateChecker(this, 91846).getVersion(version -> {
            if (!this.getDescription().getVersion().equalsIgnoreCase(version)) {
                logger.warning("There is a new update available. Please install it as soon as possible from the spigot page!");
            }
        });


    }
}
sullen dome
#

ah you mean this

vast quest
#

oh wait

sullen dome
#

i guess this is choco's checker?

vast quest
#

by chocos checker you mean the first thing that comes on google when I search spigot update checker

#

Yes.

sullen dome
#

xd

vast quest
sullen dome
#
long fin = System.currentTimeMillis() - start;```
vast quest
#

and by used I mean heavily inspired

sullen dome
#

currentTimeMillis - currentTimeMillis?

#

lol

vast quest
#

uh

sullen dome
#

well nvm

vast quest
#

its

#

I think u got it

sullen dome
#

this is the one, i used for my plugin in past

vast quest
#

will this

#

wait for it to be finished

sullen dome
#

wdym? the update check should take like a second if i'm right

vast quest
#

yes

#

I want it to wait that second

#

and then send the msgh

sullen dome
#

well

vast quest
#

well?

sullen dome
#

so you could at the end, output your message

#

that's what you want i think

#

why waiting... for what? good weather?

vast quest
#

what?

#

yes

sullen dome
#

i mean

vast quest
#

im waiting for good weather

#

so I can let my plugin go outside

sullen dome
#

you only want to output a message after the update-check

vast quest
#

yes

#

well

#

not exactly

#

after everything is done

sullen dome
#

WHAT IS EVERYTHING

vast quest
#

EVERYTHING IN ONLOAD

sullen dome
#

then just put it at the end of onload

vast quest
#

I did

#

but it does not wait for update checker to be finished

sullen dome
#

it should

vast quest
#

it doesnt

sullen dome
#

except the update-checker takes like minutes

young knoll
#

The one you linked uses a future

vast quest
#
[20:54:48 INFO]: [ParticleManager] ParticleManager v1.1-TESTBUILD has been successfully enabled in 0.00 seconds (0ms)
[20:54:48 INFO]: CONSOLE: Reload complete.
[20:54:48 INFO]: Timings Reset
[20:54:48 INFO]: [ParticleManager] There is a new update available. Please install it as soon as possible from the spigot page!```
young knoll
#

So it won't wait

vast quest
#

more like a nano second

eternal oxide
#

You can not guarantee the update check will be finished when your onLoad finishes. Its impossible to send any message at that specific time

vast quest
#

aaaaaaaaaaa

#

ok!

sullen dome
#

isn't that enough for you? wtf.
just send that message in the onEnable, and you're good

#

what is the matter of a nanosecond

vast quest
#

it looks better

#

:D

sullen dome
#

tf

vast quest
#

maybe I can make it so it waits a tick

#

before sending thatr

sullen dome
#

nvm

#

I DIDNT WANT TO ANSWER

vast quest
#

:d

#

Ok so

#

from what I think.

#

It actually waits for it to finish but the message gets send too early

#

so imma just make it wait like a tick

sullen dome
#

or implement the message in the update-checker, so it sends it automatically

eternal oxide
#

I'm going to write a plugin that looks for yours and makes sure its outputs a message between your server start and your update message.

wispy fossil
#

haha

sullen dome
#

TF

#

what an complicated way

#

please don'T

wispy fossil
#

it's genius

sullen dome
#

no it's more 5head than genius

#

imagine then making a third plugin, to show when the second one loaded

wispy fossil
#

5head = 1.25x brain height
very genius

sullen dome
#

my brain is very high

#

really

wispy fossil
#

no

sullen dome
#

yes

#

definitely

#

100%

wispy fossil
#

SHUTUP

sullen dome
#

no

wispy fossil
#

i wonder if that can be built into spigot

vast quest
#

dumb question but how can I send a warning to console

#

I tried logger.warning

young knoll
#

getLogger.warn

vast quest
#

but it still sends a info

eternal oxide
#

.warning will not send an INFO

vast quest
#

logger.warning("There is a new update available. Please install it as soon as possible from the spigot page!");

#

send [20:54:48 INFO]: [ParticleManager] There is a new update available. Please install it as soon as possible from the spigot page!

eternal oxide
#

impossible

vast quest
#

Yeah prob I just changed it and forgot to updatre it in game

eternal oxide
#

🙂

vast quest
#

Yep

#

Im just a moron

#

as always :d

plain quest
#

is it better to use netty or protocolLib for packet listeners?

#

???

vast quest
#

I always go for protocolib since

#

well most of the plugins I saw used it

dense goblet
#

does a barrel's open/closed state persist upon restart?

young knoll
#

Doubt it

#

Well actually it is part of the block state

#

So maybe

dense goblet
#

hmm guess I'll have to try

plain quest
vast quest
#

idk

plain quest
#

anyone else?

dense goblet
#

okay, so barrel's open state persists but after a restart it can be closed by opening and closing its inventory (before restarting, this does not change the open state)

#

so blocking the interaction should make it effectively persist forever

wicked remnant
south onyx
#

it gave me a 404 not found

#

no wait

#

it said 403 forbidden

wicked remnant
#

I just can't find any docs about the spigot web api...

floral flare
#

I know where the error is, but what is causing it?

young knoll
#

Read the stacktrace

floral flare
#

Yes, but it doesn't make sense

#

Everything is correct

eternal oxide
#

clearly not

young knoll
glass sparrow
#

well its not

quiet ice
#

Java 15+ NPEs help

#

Before you say "but I'm on minecraft 1.8, modern versions of Java don't work on it" I have to say that you might want to use a proper minecraft version that at least does not prevent you from choosing more modern versions of java

floral flare
sage swift
#

what's on line 25, that might be a start

bitter mural
#

can you make a block invisible, while still retaining its properties (e.g. still can walk on it, interact with it, break it, etc.)?

eternal oxide
#

No

#

Well with a texture pack you could

young knoll
#

Or some jank with barriers

sage swift
#

sendBlockChange would be useful for that but it'd limit you to full blocks

severe night
#

anyone can help me to paste block by block in Fawe API

#

i already tried setBlock , rawSetBlock and smartSetBlock

#

none works

sage swift
#

worldedit has their own discord but the api is a nightmare

rotund pond
#

Hello !
Does anyone can help me a bit please ? :x

I have a problem with the FileConfiguration#getIntegerList method :/
It returns a null list.
If i use the FileConfiguration#getList, it returns a list (non null) so ... 🤷‍♂️

Here is my yml file:

eternal oxide
rotund pond
#

Yeah that's what i'm doing

eternal oxide
#

you showed getLIst not getIntegerList so I was wondering

rotund pond
#

Ah :x

#

Sorry

eternal oxide
#

line 37 slot should be slots

rotund pond
#

no, slot is right

in this loop, i try to check if there is a configurationsection "slots". if there's not, so i check for "slot"

eternal oxide
#

Also you shoudl be checking for .isEmpty() not == null

rotund pond
#

ah, didn't know that sorry

eternal oxide
#

if you are looking for a List you can check config.isList("path")

rotund pond
#

Mh, okay thank you 🤔
But that's not my real problem tbh ^^'

eternal oxide
#

you can also check if a section exists by config.isSet("path")

#

Your issue is a few factors. line 36 you are checking for null on a method return that can not be null

#

use isList(path) instead. It returns a boolean

#

line 37 you can;t get an int from that list directly from the config. you have to pull the IntegerList first

#

oh thats is there is no list, ok

#

yes, as before use config.isList(path) to see if the list exists.

#

line 42, you are missing a period before slots

#

same in line 44

rotund pond
#

I just found it ...

#

I f*** hate me

#

And here is my problem

#

Thank you for your time @eternal oxide, you're such a good guy

eternal oxide
#

np

autumn cave
wispy plume
#

Hey, how do I come back to main thread? I do some stuff async and I wanna do 1 thing not async. Is there an easy way?

wicked remnant
#

I am aware there is the scheduler stuff but I've stuck with BukkitRunnables and haven't run into any issues or limitations

wispy plume
#

Alright.

#

And is it possible to load a world in 1.8.8 async?

#

To not cause lag (WorldCreator#createWorld())

eternal oxide
#

no

thick tundra
#

Hey! how do I get the tracker of a minecraft world

eternal oxide
#

tracker?

thick tundra
#

yes i would like to change the players display name but in the code i found online they used a tracker

eternal oxide
#

There is nothing called a tracker in Spigot

sand vector
#

How does pitch and yaw work? Like does anyone have a useful way of knowing what values are where?

thick tundra
#

Note that this name will not be displayed in game, only in chat and places defined by plugins.

#

I want to change the name above the player 😄

eternal oxide
#

Well you did ask how to set teh display name.

#

name Tags are a whole different kettle of fish

sand vector
#

I found this tutorial. Might helphttps://www.spigotmc.org/threads/how-to-change-players-name-spigot-1-10-2.186778/

eternal oxide
#

What version of Spiot?

sand vector
#

1.10.2

thick tundra
#

Ill look into it Thanks!

eternal oxide
#

eww nms

#

I'd use Teams in the Scoreboard API

unreal quartz
#

Microsoft™️ Teams

digital plinth
#

so im trying to disable the usage of spawn eggs

#

any clever way to loop through all of them?

#

also is there any anti lag machine that works by limiting the number of entities in a chunk?

#

lag machines can be made with massive amounts of redstone and excesssive entity count

#

right?

#

like armor stands and boats

tepid willow
#

WELL

dusty herald
#

You'd probably want to look into dependency injection

tepid willow
#

When I first tried to throw the stuff I had from a previous tutorial into it's own class, I ran into an issue I just could not fix featuring this lovely statement:

NamespacedKey key = new NamespacedKey(this, "emerald_sword");

sage swift
#

if (material.toString().endsWith("SPAWN_EGG"))

dusty herald
#

I assume "this" requires a JavaPlugin instance?

paper viper
#

Yeah

#

it does

tepid willow
#

the this part specifically. I tried everything I could think of to link it to the JavaPlugin instance, but kept getting multiple instance error

paper viper
#

could you send the error?

dusty herald
#

You can't have two JavaPlugin instances in one plugin

paper viper
#

^

#

I was assuming you meant one

tepid willow
#

Right I figured that one out, but couldn't figure out how to refer to the JavaPlugin without getting the multiple instance error

digital plinth
paper viper
#

Use DI, static singleton, or the method getPlugin

#

or smthing

#

like that where you pass the main class

#

i forgot the method name

dusty herald
#

Use dependency injection to inject your JavaPlugin instance into your secondary class:
Main class:

new SpecialClass(this);

Secondary class:

public void SecondaryClass(Main plugin) {
   NamespacedKey key = new NamespacedKey(plugin, "emerald_sword");
}```
paper viper
#

🥲

dusty herald
#

😭

eternal night
#

best constructor euw xD

paper viper
#

Imposter

#

lol

dusty herald
#

u imposter

paper viper
#

"Why you shouldn't name your main plugin class Main"

dusty herald
#

I thought they said their main class's name was Main Sadge

tepid willow
#

nah was just talking about the "main" class

paper viper
#

:sadge:

tepid willow
#

the "first" one

#

lmao

paper viper
dusty herald
#

but yes that is a basic implementation of dependency injection, I suggest reading into it more DogKek

tepid willow
#

i come from a heavy javascript background so all of this multiple classes kinda stuff is new to me

dusty herald
#

they're both OOP languages so you've got yourself a good head start

paper viper
#

except

#

methods arent the same as objects

#

in Java

#

so please remember that

#

lmao

dusty herald
#

Javascript and java are the same /s

#

god i hate javascript sometimes

#

most of the time*

paper viper
#

time to write more documentation

#

in stupid rst format

#

its so weird

tepid willow
paper viper
#

ik

tepid willow
#

I spent at least 2 hours on it

#

could not figure out interfaces

#

everything I did failed, or if it did work, it would only work OUTSIDE of the @override onEnable() event

#

but when placed inside of that event, it just errored. Gave me the biggest headache ever

eternal night
#

why would you implement that interface o.O

tepid willow
#

i was just trying to mess around, learn stuff, that's all really

sullen marlin
#

Implementing interfaces. The Bukkit API is designed to only be implemented by server software. Unless a class/interface is obviously designed for extension (eg BukkitRunnable), or explicitly marked as such, it should not be implemented by plugins. Although this can sometimes work, it is not guaranteed to do so and resulting bugs will be disregarded.

eternal night
#

InventoryHolder :>

paper viper
#

lol

#

i always hated guis

#

with a burning passion

#

bro stop asking

#

and start learning

#

lmao

#

you are nowhere close

#

and yes you need to learn part 2

tepid willow
#

oh

#

OH you're talking to him

paper viper
#

yep

dusty herald
#

if i have to configure my shit through a gui im dropping that plugin

#

no questions asked

paper viper
#

also, I wish there was a way to define an Entity but be able to set the EntityType after it was made

#

In other words, for example

quaint mantle
#

I like the custom texture GUIs on origin and mineclub and etca

paper viper
#

Let's say you spawn an Entity an its an AreaEffectCloud (but the spawn method returns Entity). Maybe if you could set the type of the Entity to be something different and have Entity attributes carry over but idk

#

but it wouldn't be safe anyways

eternal night
#

what would that even allow you to do xD

#

keep nbt to some degree ?

paper viper
#

Well yes that. I remember that I had an issue or smthing

eternal night
#

you can already kinda do that if you want to deep dive into reflection

paper viper
#

I know it's possible via reflection, but in my case

eternal night
#

not with a single entitiy but transferring over the attributes etc isn't too hard

paper viper
#

that isn't ideal

quaint mantle
#

there are two things that are evil in this world

#

one of them is reflection

#

the other is NMS

paper viper
#

??

#

How is reflection evil

#

lol

#

I mean sure, avoid it when you can just use basic code

#

but like how is it evil?

quaint mantle
#

you like seeing yourself in the mirror?

paper viper
#

smh

#

lmao

#

ur so funny

eternal night
#

I mean, project jigsaw definitly agreed that reflection ain't it

paper viper
#

the main issue with that for me is the dependency loading

#

like urlclassloader

eternal night
#

Ah, yea the dang URLClassLoader#addURL

#

I feel your pain

#

spigot could just overwrite that method in the PluginClassLoader

#

and make it public

#

so you can "safely" access it using reflection

paper viper
#

do you think we could persuade choco or md to do that?

south onyx
#

i need to convert a block to an itemstack, how do i do this?

paper viper
#

Like I really dont want to do jarinjar or use a classloader

eternal night
#

ehhh

#

let me quote xD

paper viper
#

@worldly ingot I'm sorry for the ping, but regarding about the URLClassLoader#addURL method that is being blocked in Java 16, do you think that Spigot plans on any changes about this so plugin developers can load dependencies dynamically? Some other strategies include like jarinjar or making a separate ClassLoader but it seems tedious.

eternal night
#

"The thing is PluginClassLoader is not API, in fact the class itself is package private and can't be accessed without reflection...."

#

that was md_5's take on it last time

paper viper
#

Ah nevermind

#

Oops

#

I shouldn't have pinged lmao

#

Sorry

eternal night
#

I mean, it has been like 1 and a half years, maybe we can notch a little

paper viper
#

Yeah

eternal night
#

Especially with like, current bstat values regarding used java version

#

this was back in the mainly java 8 days

paper viper
#

Actually, Java 9-15 works with URLClassLoader

#

but Java 16

#

nope

eternal night
#

I mean, they already give you the warning

#

which is a yikes

paper viper
#

Yeah

#

I managed to get it to work for 9-15 using module hacks

#

but they blocked that in 16

#

lmao

eternal night
#

So yeah, concerning paper is forcing java 11 with the 1.17 release, this is gonna be an issue for anyone trying to achieve it

#

on the other hand tho, plugin class loader is its own entire mess

paper viper
#

Yeah

paper viper
#

then create a new ItemStack based from the material

south onyx
#

yeah

#

but what if that block had metadata

paper viper
#

hm

south onyx
#
@EventHandler
    public void onBreak(BlockBreakEvent e) {
        if (e.getBlock().getType().toString().endsWith("_PICAXE") && e.getBlock().getType() == Material.SPAWNER) {
            e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), e.getBlock());
        }
    }```
i cant put e.getBlock when i want to drop the item naturally
it needs an itemstack
dusty herald
#

new ItemStack(Block#getType());

paper viper
#

He's talking about the metadata of the block

#

and that isnt always just Material I think?

dusty herald
#

this is block break event, meta data is thrown out the window I thought?

paper viper
#

the interface implements the metadata interface thingy

dusty herald
#

and you're checking to see if the block type ends with PICAXE? 👀

south onyx
#

wait

#

can i do Block.getData()

#

and put that in the itemstack

paper viper
#

thats a byte of like the id

dusty herald
#

that's deprecated

south onyx
#

i meant to check if the material the players uses to mine

paper viper
#

when I think like colored stuff

#

used to be ids

#

i think

south onyx
tepid willow
#

Would you guys be willing to take a look at both my classes and help me just figure out a template that I can follow? I tried doing the constructor injection but I got more initialization errors.

Maybe just show me how you would do it? I'm finding it hard to get examples on this specific topic and i would appreciate it

#

Would you guys be willing to take a look at both my classes and help me just figure out a template that I can follow? I tried doing the constructor injection but I got more initialization errors.

Maybe just show me how you would do it? I'm finding it hard to get examples on this specific topic and i would appreciate it

wraith rapids
#

send codez

tepid willow
#

This is of course the first class. Trying to refer to this one from the second without getting the initialization error.

import org.bukkit.plugin.java.JavaPlugin;

public class TutorialPlugin extends JavaPlugin {

    @Override
    public void onEnable() {
        etLogger().info("onEnable is called!");
    }

    @Override
    public void onDisable() {
        getLogger().info("onDisable is called!");
    }
}
#
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;

public class EmeraldSword {


    public void EmeraldSword() {

        // Our custom variable which we will be changing around.
        ItemStack item = new ItemStack(Material.DIAMOND_SWORD);

        // The meta of the diamond sword where we can change the name, and properties of the item.
        ItemMeta meta = item.getItemMeta();

        // We will initialise the next variable after changing the properties of the sword

        // This sets the name of the item.
        // Instead of the § symbol, you can use ChatColor.<color>

        assert meta != null;
        meta.setDisplayName("§aEmerald Sword");

        // Set the meta of the sword to the edited meta.
        item.setItemMeta(meta);

        // Add the custom enchantment to make the emerald sword special
        // In this case, we're adding the permission that modifies the damage value on level 5
        // Level 5 is represented by the second parameter. You can change this to anything compatible with a sword
        item.addEnchantment(Enchantment.DAMAGE_ALL, 5);

        // create a Namespaced Key for your recipe
        NamespacedKey key = new NamespacedKey(this, "emerald_sword");

        // Create our custom recipe variable
        ShapedRecipe recipe = new ShapedRecipe(key, item);

       
        recipe.shape(" E ", " E ", " S ");

        // Set what the letters represent.
        // E = Emerald, S = Stick
        recipe.setIngredient('E', Material.EMERALD);
        recipe.setIngredient('S', Material.STICK);

>         // Finally, add the recipe to the bukkit recipes
        Bukkit.addRecipe(recipe);
    }
}

and the second one.

#

and the only error in this file is the "this" which I cannot figure out how to do the "DI" to link to the first file without getting init errors

dusty herald
#

You're still not doing it correctly, you need to pass the JavaPlugin instance through the Dependency Injection

tepid willow
#

yeah i removed that part because it wasn't working

#

just removed it so i could get ur guys example on how you do it

wraith rapids
#

call the constructor with this

#

new MyClassThatRequiresThisClass(this)

tepid willow
#

I'm getting this now, but at least im not getting the init anymore:

[19:03:50 INFO]: [TutorialPlugin] onEnable is called!
[19:03:50 ERROR]: Error occurred while enabling TutorialPlugin v1.0 (Is it up to date?)
java.lang.NullPointerException: null
    at io.github.desura72.TutorialPlugin.onEnable(TutorialPlugin.java:10) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot.jar:3059-Spigot-4225eac-7ea8b96]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) ~[spigot.jar:3059-Spigot-4225eac-7ea8b96]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot.jar:3059-Spigot-4225eac-7ea8b96]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:493) ~[spigot.jar:3059-Spigot-4225eac-7ea8b96]
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:407) ~[spigot.jar:3059-Spigot-4225eac-7ea8b96]
    at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:555) ~[spigot.jar:3059-Spigot-4225eac-7ea8b96]
    at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:257) ~[spigot.jar:3059-Spigot-4225eac-7ea8b96]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:928) ~[spigot.jar:3059-Spigot-4225eac-7ea8b96]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[spigot.jar:3059-Spigot-4225eac-7ea8b96]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282]
drowsy helm
#

simple NPE

sudden elbow
#

How to set starter item when player successfully registered?

drowsy helm
#

registered what

dusty herald
#

I think they mean authme

sudden raft
#

how can I set the generateStructures property of a world to false?

#

for existing worlds (not necessarily loaded)

#

I think I should do something like listening to an event or setting my own world creator, but I don't find it

tepid willow
#

Alright, so I've got this so far. Did I at least get this part of the DI down?

public class EmeraldSword {
    
    private TutorialPlugin tutorialPlugin;

    public void EmeraldSwordFunc() {

        NamespacedKey key = new NamespacedKey(this.tutorialPlugin = new TutorialPlugin(), "emerald_sword");
}
#

(omitted everything here that doesn't have to do with me attempting to reference the main class without initializing it a second time lol)

#

I was actually told to do this instead:

NamespacedKey key = new NamespacedKey( new TutorialPlugin(), "emerald_sword");
cyan bluff
#

With commands, I can do
/give @s cookie{Godlike:1b}
Later, I can detect for this specific cookie using
/gamemode creative @a[nbt={SelectedItem:{tag:{Godlike:1b}}}]
How can I do the same in spigot? How can I set the item to have a specific tag, then later detect if they have said item in a specific slot?

tepid willow
#

Oh?

onyx shale
#

you will get a error about instantiating the plugin if you run it

tepid willow
#

Okay, so stick to ```java
NamespacedKey key = new NamespacedKey(this.tutorialPlugin = new TutorialPlugin(), "emerald_sword");

onyx shale
#

both are not good,as you call the new

tepid willow
#

Maaaan. How do I go about this then?

onyx shale
#

let me look up a good guide

#

so you can understand faster

#

well seems there arent any

paper viper
#

that is incorrect

#

lol

tepid willow
tepid willow
paper viper
#

For one thing though, you should probably cache your namespaced keys

tepid willow
#

At the moment i just want it to work 🥲

onyx shale
#
public class EmeraldSword {
    
    private final TutorialPlugin tutorialPlugin;

    public  EmeraldSword(TutorialPlugin plugin) {

        this.tutorialPlugin = plugin;
  }
}
``` this is di
#

now the IDE will say,you need a instance of tutorialplugin

#

so if you call new EmeraldSword() in the main,you give the class itself(this) new EmeraldSword(this);

paper viper
#

For caching, I mean storing it in some static form

#

if you are using it many times

#

you shouldn't redefine it a lot

onyx shale
#

meh i would just throw them in the main

paper viper
#

Well, just declare one instance

#

is the idea

onyx shale
#

as for some reason every god damn class i make has a reference to main

#

wich i guess its predictable as i tend to go the managers route

#

and pass managers around

tepid willow
#

aaa i can't post pics in here

#

well,

public class EmeraldSword {

    private final TutorialPlugin tutorialPlugin; //This gives me error: Variable 'tutorialPlugin' might not have been initialized

    public void EmeraldSwordFunc(TutorialPlugin plugin) {
        this.tutorialPlugin = plugin; //This gives me error: Cannot assign a value to final variable 'tutorialPlugin'

peep the comments

onyx shale
#

You place that in the constructor not a function

#

Didnt see that its a function when i copy pasted the code

paper viper
#

remove the void

onyx shale
#

Should be gokd now

paper viper
#

and it will turn into a constructor

#

constructors dont have any return types and you just dont specify at all

onyx shale
#

EmeraldSwordFunc...

#

Check the code i posted again

paper viper
#

and the name too

#

the name of the constructor must be the same

#

as the class name

cyan bluff
#

How can I add a specific piece of data to an item that a player is holding so I can detect if they hold the same item again?

onyx shale
#

What version?

cyan bluff
#

1.16.5

onyx shale
#

Then PDC should be the go to

quaint mantle
paper viper
#

using a constructor

quaint mantle
#

Yeah nvm I just noticed that

paper viper
#

he got some syntax wrong

#

yeah

quaint mantle
#

It's hard to read

tepid willow
#

It worked!

#

Wowzer

cyan bluff
#

Is it more complex?

eternal night
#

Mutating the items NBT tag is a lot more complex than using the PDC in my opinion

#

PDC was kinda made to be able to store custom values in the NBT of items/entities/tile entities without having to use reflection and calling the internal server code

cyan bluff
#

dang

eternal night
#

PDC isn't that hard. Especially since you already know how to throw NamespacedKeys around

hollow river
#

i just finished creating my first quest using my quest system, it's pretty neat and im using the method of making a separate class (with another new class per quest stage inside) for each quest so i can customize it with code to make every quest as unique as possible

eternal night
#

👀

#

.paste

#

?paste

queen dragonBOT
eternal night
#

😦

hollow river
#

the code might look a little messy like this but it isn't yet 100% optimized, this way i can create stages with custom code, different paths in the quest and much more (where quest stage 100 would automatically trigger the quest to finish, and with 0 being the first stage)

#

sorry i'll put it in a paste

tepid willow
#
public class TutorialPlugin extends JavaPlugin {

    EmeraldSword emeraldSword = new EmeraldSword(this);

    @Override
    public void onEnable() {
        getLogger().info("onEnable is called!");

    }```
Why does this work? I thought it wouldn't load in unless it was in the onEnable() or some sort of event to trigger it's load-in
hollow river
#

im pretty happy with the result, even though i'll have to create a new class for every quest, it's the most customizeable option i can think of

dusty herald
#

or at least should be null

hollow river
dusty herald
#

disco formatting is great Kek

hollow river
#

but im being told to put it in a paste D:

dusty herald
#

yes im just saying it's nice

hollow river
#

that's true, very easy and quick to use

dusty herald
hollow river
#

i'll try to next time ;)

tepid willow
hollow river
#

but for now i'll be expanding on the quest system, really loving the results. do you think my approach would result in too much code/classes eventually? i just dont think there is another reasonable way of doing it because quest files with settings wouldn't give me the ability to have every quest unique

young knoll
#

Any instance level stuff in the main class will be run before onEnable

livid tundra
#

ItemStack[] list_of_equipment = {someentity.getEquipment().getItem(EquipmentSlot.HEAD),
someentity.getEquipment().getItem(EquipmentSlot.CHEST),
someentitiy.getEquipment().getItem(EquipmentSlot.LEGS),
someentity.getEquipment().getItem(EquipmentSlot.FEET)};
for (int x = 0; x <=4; ++x){
if (list_of_equipment[x] == null)//intellj says this will always be false, is that true?(sorry for the pun)

cyan bluff
#

@eternal night Thanks, I'm starting to understand its usage.

young knoll
#

It’s possible those methods are annotated nonnull

#

Which means they would probably return air

livid tundra
#

ok

quaint mantle
#

hello people :)

livid tundra
drowsy helm
#

itemstack can be air

livid tundra
#

so an itemstack of one air?

drowsy helm
#

yep

#

but it shouldn't always be false

#

correct me if im wrong but you can just get armour contents

young knoll
#

Yes

livid tundra
#

but I need to change the armor after I get if it is empty or not

#

does
list_of_equipment[x] = new Itemstack(armor)
just change the list pointer, or the actuall armor

lofty mulch
#

check item type is air or not

cyan bluff
#

@eternal night JUst to let you know, I perfected it, and I can even read the values in game, ur right this was pretty easy 🙂

#

I'm pretty happy that it lets me read the specified data by using /data get entity @s SelectedItem in game

deft geode
#

Where are the docs for accessing the plugin folder?

#

Forgot the location

worldly ingot
#

should be just JavaPlugin#getDataFolder() and get its parent

#

plugin.getDataFolder().getParent()

livid tundra
#

does
list_of_equipment[x] = new Itemstack(armor)
just change the list pointer, or the actuall armor

worldly ingot
#

if you're talking about the getArmorContents() or whatever it is, just the value in the array

#

it returns a copy. it's not reflected on the player

#

you have to setArmorContents() again

dense goblet
#

in a PlayerInteractEvent, is it possible to check if the block has a right-click function or if it's a standard block?

#

i.e. if it has an inventory, is a trapdoor/lever, etc

worldly ingot
#

Material#isInteractable() or something like that. was added recently

dense goblet
#

oooo nice

worldly ingot
#

yeah. 1.16.1 i think

dense goblet
#

works like a charm ty 🙂

young knoll
#

That reminds me, ability to damage entity with specific cause when?

#

At least I don’t think there is a way to currently

sage swift
#

why does BlockPistonEvent not have an abstract getBlocks method

topaz cape
#

this happens whenever i try to install buildtools```
$ java -jar -Xmx1024 BuildTools.jar --rev 1.8.8
Error occurred during initialization of VM
Too small initial heap

eternal oxide
#

take off the xmx

topaz cape
#
BuildTools requires at least 512M of memory to run (1024M recommended), but has only detected 247M.
eternal oxide
#

you should not need any additional switches unless you have some wierd ass java setup

topaz cape
#
$  java -Xmx1024M -jar BuildTools.jar --rev 1.8.8 -Xmx1024
Loading BuildTools version: git-BuildTools-36c11e9-126 (#126)
Java Version: Java 8
Current Path: C:\Users\Ahmed Waleed\Downloads\.
Exception in thread "main" joptsimple.UnrecognizedOptionException: X is not a recognized option
        at joptsimple.OptionException.unrecognizedOption(OptionException.java:108)
        at joptsimple.OptionParser.validateOptionCharacters(OptionParser.java:633)
        at joptsimple.OptionParser.handleShortOptionCluster(OptionParser.java:528)
        at joptsimple.OptionParser.handleShortOptionToken(OptionParser.java:523)
        at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:59)
        at joptsimple.OptionParser.parse(OptionParser.java:396)
        at org.spigotmc.builder.Builder.main(Builder.java:161)
        at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
#

my brain cells

eternal oxide
#

why two xmx now?

#

What system are you running this on?

topaz cape
#

windows 10?

#
This can often occur if you are running a 32-bit system, or one with low RAM.
Please re-run BuildTools with manually specified memory, e.g: java -Xmx1024M -jar BuildTools.jar --rev 1.8.8 -Xmx1024
#

thats why i put 2

eternal oxide
#

try using Xms instead of Xmx

topaz cape
#
$  java -Xms1024M -jar BuildTools.jar --rev 1.8.8 -Xms1024
Loading BuildTools version: git-BuildTools-36c11e9-126 (#126)
Java Version: Java 8
Current Path: C:\Users\Ahmed Waleed\Downloads\.
Exception in thread "main" joptsimple.UnrecognizedOptionException: X is not a recognized option
        at joptsimple.OptionException.unrecognizedOption(OptionException.java:108)
        at joptsimple.OptionParser.validateOptionCharacters(OptionParser.java:633)
        at joptsimple.OptionParser.handleShortOptionCluster(OptionParser.java:528)
        at joptsimple.OptionParser.handleShortOptionToken(OptionParser.java:523)
        at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:59)
        at joptsimple.OptionParser.parse(OptionParser.java:396)
        at org.spigotmc.builder.Builder.main(Builder.java:161)
        at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27```
#

bruh

eternal oxide
#

take off the extra switch and run in cmd prompt not bash

wicked remnant
#

Don't put any JVM arguments after -jar

#

Also, the spigot wiki says to not use heap arguments if youre on windows

#

    On Linux run git config --global --unset core.autocrlf, then run java -jar BuildTools.jar in bash or another appropriate shell.
    On Windows run the below command inside the git bash window that opened:
        java -jar BuildTools.jar
        Please be aware that it is required that you have BuildTools #35 or later, older versions will not work.
    On Mac run the below commands,
        export MAVEN_OPTS="-Xmx2G"
        java -Xmx2G -jar BuildTools.jar
    Options (all OS's) :
        The --rev option can be used to get specific 1.8/1.9 versions of CraftBukkit / Spigot
        See Versions below for available options
topaz cape
#
C:\Users\Ahmed Waleed\Downloads>java -jar BuildTools.jar
BuildTools requires at least 512M of memory to run (1024M recommended), but has only detected 247M.
This can often occur if you are running a 32-bit system, or one with low RAM.
Please re-run BuildTools with manually specified memory, e.g: java -Xmx1024M -jar BuildTools.jar```
#

WAIT

eternal oxide
#

try the command exactly was it says, in cmd prompt. Bash can be iffy.

topaz cape
#

"java -Xmx1024M -jar BuildTools.jar" worked

#

LETS GOO

#

Thanks @eternal oxide & @wicked remnant

wicked remnant
#

np

tepid willow
#

Hey, I made a shovel and gave it this enchantment:
item.addEnchantment(Enchantment.DIG_SPEED, 3);
the enchantment is on the item, it works for the most part -- except for on GRASS blocks?

The shovel digs super fast with dirt, sand, etc...but with grass blocks it just digs at the normal speed that a shovel with no enchantment would dig at. is this normal?

drowsy helm
#

thats a minecraft related thing not spigot

#

just means that's regular miencraft behaviour

young knoll
#

I don’t believe it is

#

Last I recall grass breaks a bit slower, but nothing dramatic

rigid otter
#

Hello! Any way to run own java program or lib the same time of running server software?

#

Can we add some lib to spigot.jar?

drowsy helm
#

as in simultaneously

#

whats the context

rigid otter
#

I just want to add my own lib run the same time with server

#

So, plugins can access to it any time as it access to spigot lib.

wicked remnant
#

what about just wrapping the lib in a plugin?

#

then you can make your plugins that require it depend on it

rigid otter
#

Because it a little bit un-reliable. If another plugin run before lib, then it doesn't work

young knoll
#

Then that plugin should depend on your lib

#

Or you should shade said lib

rigid otter
#

Can I combine that into spigot.jar? Like spigot combine some of google lib to.

young knoll
#

I mean

#

Technically, if you modify the jar itself with buildtools

#

But that doesn’t seem worth the effort

rigid otter
#

image in link

wicked remnant
#

Would probably be better to modify spigot to let you force your lib plugin to load first...

rigid otter
#

So, can I do that? Please check the picture in link

pine crystal
#

hey this is my first time using java, what am i doing wrong here?

#

oh i cant send images

#

ill just send the code

dense goblet
#

?paste

#

bot dead

rigid otter
pine crystal
#
public void onEnable() {
    getServer().getPluginManager().registerEvents(new EventListener(this), this);
    }

the error eclipse shows is The method registerEvents(Listener, Plugin) in the type PluginManager is not applicable for the arguments (EventListener, Main)

dense goblet
rigid otter
#

Ahh

quaint mantle
pine crystal
#

it does

#
package core;

import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    
    public static Main instance;
    
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new EventListener(this), this);
    }
    
    public static Main getInstance() {
        return instance;
    }

}
rigid otter
summer scroll
#

and EventListener must implements Listener

pine crystal
#

it does too

young knoll
#

You cannot edit the jar in an ide

pine crystal
#
package core;

import org.bukkit.event.Listener;

public class EventListener implements Listener {
    
    Main main;
    
    public EventListener(Main main) {
        this.main = main;
    }

}
rigid otter
#

I do not edit

young knoll
#

You have to download and modify the source, then compile it into a jar

dense goblet
#

are your args in the right order?

young knoll
#

Or

#

You could just add depend: [YouLibPlugin] to any plugin that requires it

#

Or you can shade the lib with maven/gradle

#

There is no reason to modify the spigot jar to add a library

rigid otter
#

But, can still I modify it(and as legally)? I have tried, it makes much cool.

wicked remnant
#

the legality of the minecraft ecosystem is F'd

young knoll
#

I mean

#

Sure you can

#

It’s LGPL and open source

pine crystal
rigid otter
#

Ohh thanks, but other person I have asked to, they say it's bad practice, it's dumb, and they warn me don't do that. Idk why so, even I do not edit any thing in original jar, but just add some lib to. The way it goes is look like While compiling my lib, it extract server.jar, then complier in result together.

#

It looks the same as spigot compile some of google lib in its jar

pine crystal
#

any difference between doing function() and this.function()?

young knoll
#

Generally, no

pine crystal
#

ty

young knoll
#

And obviously won’t work for a public plugin

rigid otter
#

Orr yes🤔

young knoll
#

I mean sure you can offer a custom jar for your plugin

#

But no one will want to download it

rigid otter
#

Yes! It's just for my server.

young knoll
#

And you’ll need to provide it in an uncompiled state to comply with minecraft copyright

rigid otter
#

Ohh, what's that mean?

young knoll
#

It means you can’t share any of the minecraft source directly

#

There is a reason spigot uses buildtools

rigid otter
#

Ohh🤔

young knoll
#

Just run your lib as a plugin or shade it into the plugins that use it, there is no reason to overcomplicate this

rigid otter
#

So, what happen different when spigot uses buildtools and not?

#

But why paper fork top of spigot and can not-necessary to use buildtool?

pine crystal
#

is it possible to assign a class to a static property as a default value?

#

ik its not possible in php

young knoll
#

It just compiles the jar at runtime

rigid otter
#

Ahh...
And why doesn't spigot have its own version and run bukkit at runtime too?

eternal oxide
#

Because Spigot came first

rigid otter
#

Hmm..., it looks complicated vs just see from out side.

wicked remnant
#

spigot makes you run buildtools to get the patched jar

#

paper downloads the vanilla jar, makes the patches and then launches the patched jar

somber trench
#

is there a way of fetching a Player object from someones username?

eternal oxide
#

How did you get the players name in the first place?

somber trench
#

through an argument

summer scroll
#

Bukkit.getPlayer()

somber trench
#

ok thanks

plain quest
#

how does hypixel handle fireballs and the smooth overall experience they provide? i mean they do enough damage, they destroy specific blocks and cause them to ignite, and finally the provide somehow the ability to fireball jump. I’ve tried adding fireballs to my server with the player launching the by right clicking and listened on projectilehit to create the explosion but the result wasn’t EVEN CLOSE

#

any ideas?

quaint mantle
#

I'm planning to add multi language support into my plugin, What would be the best option to do this ? I would use the YamlConfiguration

plain quest
#

maybe an online dictionary api would be better

vast quest
plain quest
#

so a fireball would go faster if it were to attack a player 50 blocks away compared to another 10 blocks away right?

patent ice
#

No

sinful kelp
#

Anyone use Maven?

#

I'm having hella trouble

vast quest
#

?

quiet ice
#

maven is nice, you are lying

patent ice
#

?ask

queen dragonBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

sinful kelp
#

I get a java.lang.ClassNotFoundException: com.mongodb.client.MongoClients

#

When running my plugin

quiet ice
#

Did you shade?

sinful kelp
#

Not sure what that is, this is my first Maven plugin

#

@patent ice Unnecessary, but thanks!

vast quest
#

Don't ask to ask. Just ask

patent ice
#

What about asking to ask about asking

quiet ice
sinful kelp
#

Why do you keep saying that, I didn't ask to ask. I asked if anyone uses Maven

vast quest
#

can I ask to ask somethning about how to ask something properly

patent ice
#

Can I ask how to ask about asking to ask

sinful kelp
#

@quiet ice Just putting the plugin in should compile my project correctly?

vast quest
sinful kelp
#

Ok?

vast quest
sinful kelp
#

Thanks geol for the help. Appreciate it, unlike the other 2 comedians here

vast quest
#

Cool.

patent ice
#

No worries jordie

#

I appreciate helping you

sinful kelp
#

@quiet ice You're a life saver. I've been stuck on this for hours!!

maiden thicket
#

and yes, it was unnecessary to keep putting that ?ask bs

vast quest
#

he wont

#

we all know that he wont

patent ice
#

Oof

sinful kelp
#

...

maiden thicket
#

just

#

shut

#

leave him alone

#

lol

#

not everyone is know it all like you

#

some people are still learning

#

some people are new to the community

queen dragonBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

sinful kelp
#

legit my first message ever in this server was me asking a question without asking to ask lol

vast quest
#

can u checc this link thanks for future

maiden thicket
sinful kelp
#

and i literally just got a bunch of "comedians" like these 2 giving me meaningless shit

patent ice
#

Why are we discussing about the rights of asking to ask, this is meant for development

vast quest
#

I really cant care but just read it for once

sinful kelp
#

no

maiden thicket
#

he already got the memo

#

drop it

vast quest
#

he didnt but ok

#

idc

maiden thicket
#

he obviously did?

#

but okay

patent ice
sinful kelp
#

i obv did lol

maiden thicket
#

y'all are just acting like dicks at this point

patent ice
#

Woah

#

Using the d word rude.

maiden thicket
#

what you guys are doing isn't rude?

patent ice
#

Anyways peace

maiden thicket
#

✌️

vast quest
#

✌️

patent ice
#

Well I'm not saying that, just using the d word isn't very nice.

sage swift
#

deez nuts

quaint mantle
#

Hello, spigot how can I deal mob not true damage

#

((Damageable)entity).damage(int); deals true dmg 😦

sage swift
#

well LivingEntity has attack

quiet ice
#

what's that

sage swift
#

(ignores armor)

sage swift
quaint mantle
#

okay 🙂

quaint mantle
sage swift
#

look for nms methods then i guess

quaint mantle
#

its not nms btw, I used LivingEntity#damage . cuz LivingEntity#attack doesn't exists

quaint mantle
sage swift
#

LivingEntity#attack definitely does exist

quaint mantle
#

hmm

#

its 1.15.2

#

:0

sage swift
#

outdated bersion no subort

#

but yeah like i said nms

quaint mantle
#

waittt

#

1.15.2 has attack in javadoc

#

But i can't find in my intelliJ

#

((LivingEntity) entity).attack(1); it says "not exists"

sage swift
#

because it doesnt take an integer

quaint mantle
#

nop

sage swift
#

attack is from one entity to another

quaint mantle
#

it says "attack" method doesn't exsits

#

"Cannot resolve symbal"

quaint mantle
sage swift
#

again, it needs an entity to attack

#

you would do something like player.attack(entity)

quaint mantle
#

nop, I dont want player 😉

#

I want mob

sage swift
#

without a living entity as the source i don't know if you'll be able to deal armor-affected damage without nms.

quaint mantle
#

hmm

#

how to do with nms?

quiet ice
#

let me see

quaint mantle
#

Btw, this mob is nms

#

but it's skill dmg

quaint mantle
sage swift
#

look at EntityLiving

quaint mantle
#

((EntityLiving) entity).attack() it says

#

cannot resolve symbal "attack"

#

It means, attack method deosn't exists

sage swift
#

that's because nms is obfuscated

#

again, you need to look for the method to damage an entity in the minecraft code

quaint mantle
#

yaaaaaaaaaaaaa

#

I think you understood wrong

#

wait

#

It says the method itself doesn't exist.

sage swift
#

yeah not in EntityLiving

quaint mantle
#

hmm

#

ya

sage swift
#

try EntityLiving#damageEntity

quiet ice
#

ya idk

quaint mantle
#

okay A:)

#

what is DamageSource.a() ?

sage swift
#

damagesource is a class

quaint mantle
#

yapppp

sage swift
#
    public static final DamageSource FIRE = (new DamageSource("inFire")).setIgnoreArmor().setFire();
    public static final DamageSource LIGHTNING = new DamageSource("lightningBolt");
    public static final DamageSource BURN = (new DamageSource("onFire")).setIgnoreArmor().setFire();
    public static final DamageSource LAVA = (new DamageSource("lava")).setFire();
    public static final DamageSource HOT_FLOOR = (new DamageSource("hotFloor")).setFire();
    public static final DamageSource STUCK = (new DamageSource("inWall")).setIgnoreArmor();
    public static final DamageSource CRAMMING = (new DamageSource("cramming")).setIgnoreArmor();
    public static final DamageSource DROWN = (new DamageSource("drown")).setIgnoreArmor();
    public static final DamageSource STARVE = (new DamageSource("starve")).setIgnoreArmor().setStarvation();
    public static final DamageSource CACTUS = new DamageSource("cactus");
    public static final DamageSource FALL = (new DamageSource("fall")).setIgnoreArmor();
    public static final DamageSource FLY_INTO_WALL = (new DamageSource("flyIntoWall")).setIgnoreArmor();
    public static final DamageSource OUT_OF_WORLD = (new DamageSource("outOfWorld")).setIgnoreArmor().setIgnoresInvulnerability();
    public static final DamageSource GENERIC = (new DamageSource("generic")).setIgnoreArmor();
    public static final DamageSource MAGIC = (new DamageSource("magic")).setIgnoreArmor().setMagic();
    public static final DamageSource WITHER = (new DamageSource("wither")).setIgnoreArmor();
    public static final DamageSource ANVIL = new DamageSource("anvil");
    public static final DamageSource FALLING_BLOCK = new DamageSource("fallingBlock");
    public static final DamageSource DRAGON_BREATH = (new DamageSource("dragonBreath")).setIgnoreArmor();
    public static final DamageSource DRYOUT = new DamageSource("dryout");
    public static final DamageSource SWEET_BERRY_BUSH = new DamageSource("sweetBerryBush");```
quaint mantle
#

yao

#

but I curioused what is a()

sage swift
#
    public static DamageSource a() {
        return new DamageSourceNetherBed();
    }```
quaint mantle
#

ahhh lol, only damageSourceNetherBad ofused

quiet ice
#

you do realise that you can decompile yourself

quaint mantle
#

yaa and I already known

sage swift
#

no i cant decompile myself, im not a program!

quaint mantle
#

Thanks i'm trying

#

java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer cannot be cast to class net.minecraft.server.v1_15_R1.EntityLiving (org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer and net.minecraft.server.v1_15_R1.EntityLiving are in unnamed module of loader 'app')

#

uh It says

#

CraftPlayer cannot cast to EntityLiving

#

Full Error:

[17:05:59 WARN]: [Plugin] Task #597174 for Plugin v1.0 generated an exception
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer cannot be cast to class net.minecraft.server.v1_15_R1.EntityLiving (org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer and net.minecraft.server.v1_15_R1.EntityLiving are in unnamed module of loader 'app')
        at me.toto.rpgCore.mob.hardCore.SmarletListener$4.run(SmarletListener.java:174) ~[?:?]
        at org.bukkit.craftbukkit.v1_15_R1.scheduler.CraftTask.run(CraftTask.java:99) ~[patched_1.15.2.jar:git-Paper-391]
        at org.bukkit.craftbukkit.v1_15_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.15.2.jar:git-Paper-391]
        at net.minecraft.server.v1_15_R1.MinecraftServer.b(MinecraftServer.java:1265) ~[patched_1.15.2.jar:git-Paper-391]
        at net.minecraft.server.v1_15_R1.DedicatedServer.b(DedicatedServer.java:431) ~[patched_1.15.2.jar:git-Paper-391]
        at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:1182) ~[patched_1.15.2.jar:git-Paper-391]
        at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:971) ~[patched_1.15.2.jar:git-Paper-391]
        at java.lang.Thread.run(Thread.java:834) [?:?]```
sage swift
#

you're using the craftbukkit player as the nms one

#

need to getHandle first

quaint mantle
#

okay 😉

sage swift
#

when did i learn all this

#

let us know if it works btw

vast quest
#

Im trying to make a plugin which has ProtoclLib as a soft-dependancy I dont want the features that come with ProtocolLib to be enabled if ProtocolLib doesnt eixst I added a check for that but when I try to run my plugin on a server withyout protocollib it sends this error https://paste.md-5.net/cepozunuvu.sql

#

any clues?

#

I call this method on load so

sage swift
#

well... how is protocolManager already initialized?

vast quest
#

?

#

Wdym

quaint mantle
#

protocollib classes are not found

sage swift
#

you do stuff with the protocolManager outside of this check

vast quest
#

oh

#

so I would need to move this to the check?

#

private ProtocolManager protocolManager;

#

and fthis

#

protocolManager = ProtocolLibrary.getProtocolManager();

sage swift
#

don't really need to define it as private but yeah and it may make accessing it elsewhere difficult

vast quest
#

I dont need protocollib its jsut for 1 feature

quaint mantle
vast quest
#

thats why I dont want it to be a dependancy

quaint mantle
#

((EntityLiving) ((CraftPlayer) entity).getHandle()).damageEntity(DamageSource.GENERIC, 5F);

sage swift
#

if you're making it a soft depend I'd give it its own class that you either instantiate or don't based on whether it's enabled

vast quest
#

this is my whole code

sage swift
#

that damages the player, toto

quaint mantle
#

Its 5F

sage swift
#

don't need to cast it to entityliving either

quaint mantle
#

hmm

sage swift
#

what doesn't work

quaint mantle
#

so, I want damage to Player (Entity -> Player)

sage swift
#

any errors?

quaint mantle
#

nop

quaint mantle
# sage swift any errors?

((EntityLiving) ((CraftPlayer) entity).getHandle()).damageEntity(DamageSource.GENERIC, 5F); It deals true dmg

#

2.5<3

sage swift
#

not for one feature, whyhax

vast quest
#

maybe its cuz of the imports?

quaint mantle
sage swift
quaint mantle
sage swift
quaint mantle
#

you meant javadoc?

sage swift
#

...

quaint mantle
#

okay

#

ah sorry

sage swift
#

No the imports don't matter

#

Just where you use them

#

so yeah, toto choose a damage source that doesn't ignore armor

vast quest
#

so maybe I should try to register the variables on the method

sage swift
#

you don't need any variable really

vast quest
#

fields*

sage swift
#

just call new PacketManager().add

#

etc

#

after the check

vast quest
#

so

#

uh

#
    private void protocolLibCheck() {
        Plugin pl = Bukkit.getPluginManager().getPlugin("ProtocolLib");
        if (pl == null || !pl.isEnabled()) return;
        ProtocolManager protocolManager;
        protocolManager = ProtocolLibrary.getProtocolManager();
        protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.HIGHEST, PacketType.Play.Server.WORLD_PARTICLES) {
            @Override
            public void onPacketSending(PacketEvent event) {
                PacketContainer packet = event.getPacket();
                if (packet.getNewParticles().read(0).getParticle() != Particle.DAMAGE_INDICATOR) return;
                if (getCustomConfig().getBoolean("status") && getCustomConfig().getBoolean("disable-damage-indicator")) event.setCancelled(true);
            }
        });
        logger.info("ProtocolLib was found and its features are enabled!");
    }```
#

I removed the ProtocolManager protocolManager;
protocolManager = ProtocolLibrary.getProtocolManager(); from on load

#

and added it in the check

sage swift
#

just do ProtocolLibrary.getManager().addPacketListener(...

#

no need for the variable initialization and declaration

vast quest
#

Ok

#

still

#

thats the code ^^

sage swift
#

anywhere else on the code are you using PL

vast quest
#

I dont think osd

#

Nope im not

vast quest
#

so I removed the method

quaint mantle
#

Hmm

#

also, lightning

vast quest
#

it doesnt give errors

quaint mantle
#

also, it doesn't give dmg 😦

sullen marlin
#

also its not spigot

vast quest
#

WAIT md are you the orange slime itself!!!!#

quaint mantle
#

Is there a way to get true speed? Not the half velocity half acceleration .getVelocity?

plain quest
#

What can cause this? [INFO] ------------------------------------------------------------- [ERROR] /C:/Users/Dennis Gyftakis/iCloudDrive/JavaProjects/SkinChanger/src/main/java/net/unpluggedmc/skinchanger/Listeners/JoinListener.java:[7,61] cannot access net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo.PlayerInfoData bad class file: C:\Users\Dennis Gyftakis\.m2\repository\org\spigotmc\spigot\1.16.5-R0.1-SNAPSHOT\spigot-1.16.5-R0.1-SNAPSHOT.jar(net/minecraft/server/v1_16_R3/PacketPlayOutPlayerInfo$PlayerInfoData.class) bad RuntimeInvisibleParameterAnnotations attribute: PlayerInfoData(com.mojang.authlib.GameProfile,int,net.minecraft.server.v1_16_R3.EnumGamemode,net.minecraft.server.v1_16_R3.IChatBaseComponent) Please remove or make sure it appears in the correct subdirectory of the classpath. [INFO] 1 error [INFO] -------------------------------------------------------------

vast quest
quaint mantle
#

Hallo here! How can I deal no true dmg(Armor affact) to player? (Entity -> Player) I've tried a few ways, but I've failed.

plain quest
quaint mantle
#

yes

#

but armor affact

#

default dmg (armor affacted), true damage(no armor affected)

#

I want default dmg

plain quest
#

oh ok so you want them to wear armor but not have their damage getting decreased right?

quaint mantle
#

nop, that's true dmg

#

I want -> for example, if i wear diamond set, I miss 1 heart. but if i not wear armors, i miss 5 heart -> Default damage ( I want)

#

and I dont want -> for example, if i wear diamond set, I miss 5 heart. but if i not wear armors, i miss 5 heart -> True damage ( I dont want)

plain quest
#

then you want to customize this numbers...

quaint mantle
#

yea, how to do this? Like : player.damage(5);

#

btw, it deals true dmg

plain quest
#

listen to the PlayerDamageEvent and customize the damaged the player deals depending on his armor contents that you can access using Player#getArmorContents()

quaint mantle
#

sorry, but I dont want to make mob attack

#

It's skill 🙂

plain quest
#

wait let me check some docs..

plain quest
# quaint mantle sorry, but I dont want to make mob attack

alright so to sum up what you can do is make a listener for the EntityDamageByEntityEvent and then check the damager using event.getDamager() and if the damager is a mob you can cancel the event if it's not you can do event.setDamage(DAMAGE_AMOUNT) and also listen to EntityDamageEvent for things like fall damage and stuff and again depending on their armor contents (event.getEntity.getArmorContents) set the damage using event.setDamage(DAMAGE_AMOUNT)

plain quest
#

you're smart enough to figure it out : D

vast quest
#

im not

#

what made you think that I have more than 1 braincell

#

:D

plain quest
#

1 is good enough i have 0

vast quest
#

PROGRESS

#

I got a new error

#

:D

tribal holly
#

Can we use ExactChoice to shapelessRecipe ? because it don't work for me all custom item are the same for the shapelessRecipe. But all my ShapedRecipe Works fine with exact choice

tribal holly
#

i already check the doc but it don't work

plain quest
#

for some reason it has no info about that method and the doc of RecipeChoice says no more so maybe someone else who has experienced something like that

quaint mantle
plain quest
#

same thing just check his armor contents and deal different damage levels

quaint mantle
#

This will be a very cumbersome task. Is there any other way? 😉

#

even then, I have many custom armors

plain quest
maiden briar
#

Is it possible to generate a file at compile? I want to auto generate plugin.yml

plain quest
#

automatically?

plain quest
#

when you compile the jar it gets auto generated isn't it?

maiden briar
#

Yes exactly

plain quest
#

then what's ur problem?

maiden briar
#

I mean, generate it without creating the file

#

If you click on compile it will add a new file

sullen marlin
#

The readme explains it

maiden briar
#

Ok thanks

vast phoenix
#

Does anyone know how EntityDismountEvent works?

#

There is no method description in the java doc

#

I'm talking about getEntity() and getDismounted()

plain quest
#

getEntity is the player and getDismounted is the boat if i'm not mistaken

sullen marlin
#

Hmm there should be a description, but that’s self explanatory

vast phoenix
#

so is the getDismounted() the entity?

sullen marlin
#

As the name suggests it is the entity being dismounted

vast phoenix
#

Okay thanks

drowsy helm
#

Someone sort out an argument i'm having with someone

#

is it necessary to make plugins configurable for a network that has multiple devs

#

always available

vast phoenix
#

I work on a network with over a lot of people and I never make my plugins configurable.

sullen marlin
#

Keep yourself in work

drowsy helm
#

lmao

#

My argument is that configuration is only necessary when the plugin is first installed and is basically not necessary once it is correctly set up

sullen marlin
#

Some things like database info should always be configurable

drowsy helm
#

and thus is a waste of time to implement

#

yes db stuff, but they want inventories, messages etc etc

sullen marlin
#

Gameplay params etc would ideally be configured but often they aren’t

drowsy helm
#

I just don't see the necessity when I can change it in 5 mins

vast phoenix
#

I usually just have database info in my config nothing else.

drowsy helm
#

yeah, that's currently how i have it setup. Db info and that's it

sullen marlin
#

You might not be around forever or always available or maybe they want to experiment

#

Or maybe they want to pay you now not later

drowsy helm
#

That's true, but for a network with 3 other devs pretty much on around the clock

sullen marlin
#

Ultimately it’s what they want

drowsy helm
#

I don't think it's a hard thing to solve

#

guess It's time for a meeting lol

vast quest
#

How can I activate smth if another plugin is enabled but not prevent the plugin from starting

#

Im trying to make it so packetlisteners only get activated if protocolib is enabledf

onyx shale
#

Wut

#

How you expect to make the code function without the plugin starting?

vast quest
#

???

#

no like just dont try to use that packetlistener if the plugin isnt enabled

#

so it does noit give a erorr

sullen marlin
#

If getPlugin(protocollib) != null new PacketListener

vast quest
#

I tried this

vast quest
#

it gives a error

#

and doesnt start the plugin if protocolib isnt there