#help-development

1 messages · Page 1662 of 1

ivory sleet
#

This channel is not meant for helping with google-able questions

grim ice
#

it's your personal opinion, it doesn't mean "should" it means "can"

ivory sleet
#

It says serious questions

hybrid spoke
#

main: com.thechemicalworkshop

quiet ice
#

such a pointless debate

grim ice
lost matrix
#

An ItemStack has an ItemMeta. Of this ItemMeta you can get the display name or the lore.
Someon also suggested to use the ItemStack#isSimilar(ItemStack) metod.

ivory sleet
#

And even if it is not in the channel description it’s common sense, even something discussed in the staff channels iirc

gaunt saffron
ivory sleet
#

Yes 2Hex but then he could point out what he didn’t understand

kindred valley
hybrid spoke
grim ice
lost matrix
#

main needs the full qualified path to your JavaPlugin class. Including the classes name.

ivory sleet
#

Anyways if you want to continue debating this go #general

lost matrix
quiet ice
#

dangerous, but given the circumstances better than nothing

lost matrix
#

I suggested PDC but he is a beginner.

quiet ice
#

The display name will be pretty reliable anyways

grim ice
gaunt saffron
# lost matrix main needs the full qualified path to your JavaPlugin class. Including the class...
package com.thechemicalworkshop;

import org.bukkit.plugin.java.JavaPlugin;

public class App extends JavaPlugin {
    @Override
    public void onEnable() {
        getLogger().info("Hello, SpigotMC!");
    }

    @Override
    public void onDisable() {
        getLogger().info("See you again, SpigotMC!");
    }
}
main: com.thechemicalworkshop.App
name: BlankPlugin
version: 0.1

sorry if im stupid, i never had to compile a language they all would compile at runtime...

grim ice
#

except if he joined today he would know how to use it, thats my opinion

lost matrix
grim ice
#

Dependency Injection

quiet ice
#

But why the hell would you want to use DI here

hybrid spoke
lost matrix
kindred valley
quiet ice
# hybrid spoke can you even compare this?

mosty, no. PDC is pretty complicated once you go into the path of custom date types, otherwise it is easy. The same thing applies to DI, there are instances of Dependency Injection that are far more complicated

kindred valley
grim ice
#

how tf is pdc complicated bro

#

its like 2 lines of code (they should be more if you don't want to have bad practice)

lost matrix
# kindred valley i just have one

I mean. Check the display name of one ItemStack. I just assumed there that you created one prototype ItemStack that you can give to people and that you can use for checks.

quiet ice
#

Lines of code != complicateness

grim ice
#

theey can get away just with copy pasting as 7smile7 said in a conversation yesterday

grim ice
gaunt saffron
#

let's hope the spigot docks are well written... not beeing able to run and debug = rip

quiet ice
grim ice
#

some times if the code is huge, it might overwhelm people

#

especially beginners

paper viper
#

just add comments lol

grim ice
#

if it's 2 lines you probably would figure it out soonly

paper viper
#

its like reading a textbook

quiet ice
#

Then dice the code up

paper viper
#

if its 1000 pages

#

sure

#

it overwhelms

ivory sleet
#

Code shouldn’t be made for beginners, it should be made for the readers who knows how to code

paper viper
#

but add some info and divide it

grim ice
#

that's my opinion

paper viper
#

No it doesnt

#

lol

hybrid spoke
paper viper
#

that is completely false 2Hex

hybrid spoke
#

dont care about the receiver/reader

grim ice
#

Most beginners find it as I stated

ivory sleet
#

Indeed luzifer

grim ice
#

i agree with luzifer too

grim ice
quiet ice
ivory sleet
#

But if the code is big and complicated but offers future proof and extendability then let it be that way

quiet ice
#

Spigot docs are pretty good though

grim ice
#

you will figure it out in a way shorter time if it's small code

#

if it's huge, you will take long to even read it

#

easy

quiet ice
#

Not always

grim ice
#

Yes always, except if you're coding nms lol

hybrid spoke
#

to understand extracted code which is splitted into several methods also takes its time. most of the time goes in just clicking through the methods

gaunt saffron
quiet ice
ivory sleet
gaunt saffron
lost matrix
# grim ice Most beginners find it as I stated

Short != trivial
Example:

OptionalDouble av = IntStream.rangeClosed(-100, 100).boxed().mapToInt(Integer::intValue).limit(20).mapToDouble(i -> i / 2.0).average();

or

    public static int rangeBitwiseAnd(int m, int n) {
        return m < n ? rangeBitwiseAnd(m, n & n-1) : n;
    }

Most beginners would have literally 0 idea what any of this means.

grim ice
grim ice
lost matrix
grim ice
#

1 letter variables

#

smile himself doesnt like them

ivory sleet
#

Complicated != code length

quiet ice
#

1 letter variables are fine in 80% of cases

grim ice
paper viper
#

Do you really have to name exception as exception?

#

or e

#

e is fine

paper viper
#

that is one example

ivory sleet
#

Also you’re incorrect, 2Hex a variable only has to be meaningful in the scope they live in

paper viper
#

unless you are ignoring it

#

you should name it ignored

grim ice
lost matrix
gaunt saffron
ivory sleet
#

It might

#

Assume a function like Math::max

regal lake
#

I know this is just a warning, but i don't understand why i don't get that kind of warning for e.g. the TAB Plugin (https://github.com/NEZNAMY/TAB) which also use the channels

ivory sleet
#

You don’t need anything like numberParameter1

#

n is enough

grim ice
#

imo, no

lost matrix
grim ice
#

numParam would be also good

lost matrix
#

hm

grim ice
ivory sleet
#

no first of all it’s conspicuous it’s already a param

#

?scheduling

undone axleBOT
grim ice
#

another F

ivory sleet
#

so maybe num

grim ice
quiet ice
grim ice
#

you brought the example first, I edited it

#

easy

lost matrix
gaunt saffron
lost matrix
#

ofc its a number and ofc its a param. This is worse than m

regal lake
paper viper
#

2Hex, you really shouldn't be arguing here. You are still learning Java...

grim ice
ivory sleet
#

it’s not

paper viper
#

these arent opinions

#

they are conventions

lost matrix
quiet ice
paper viper
#

conventions != opinions

ivory sleet
#

A variable should only be meaningful in the scope they live in

grim ice
#

conventions are opinions that you have to go with

quiet ice
#

90% of people here are against you

ivory sleet
#

No

#

It’s not conventions

grim ice
#

either way, it's getting unnecessarily toxic so ill take my leave

#

@ivory sleet it was a fun argument :D

quiet ice
#

A pointless one too

ivory sleet
#

It’s principles and theories (arguably theorems)

kindred valley
#

no

quartz pike
#

saving stuff (multiple times)in config file in runtime is also a convention ?

paper viper
#

cause they refuse to learn

#

lol

grim ice
ivory sleet
paper viper
#

You arent if you are already arguing about your own opinions without even learning proper conventions and usages first

grim ice
#

I actually learn more stuff everyday I use the spigot api, so I consider my self learning

ivory sleet
#

Because writings and reading to the disk can be resource taking

paper viper
#

You don't learn Java specific usages

ivory sleet
#

Maybe teach that skill to every beginner that tends to drop in here

grim ice
paper viper
#

conventions arent opninions tho

grim ice
#

if your opinion isn't same as mine no need to force it into me

paper viper
#

even oracle has a naming convention

#

you call that an opinion?

gaunt saffron
grim ice
#

Yes, and it's the opinion of the devs lol

quiet ice
#

It's not?

quartz pike
# quiet ice Could you specify further?

i'm not gonna name names but an expert here was saving temporary stuff in the config file multiple times in runtime (so always opening/closing the file to save and load information) instead of using a data structure

hybrid spoke
#

you should follow the conventions

paper viper
#

Then you can go up to your first interview and show them "your opinion" and see how they react

#

Lol

lost matrix
#

They will break your code indirectly by introducing hard to track bugs

paper viper
#

they;re gonna kick you out

grim ice
paper viper
#

instantly

ivory sleet
#

Java calls them out as java naming specifications also

quiet ice
grim ice
#

but what I meant is, they won't break your code, so they're not 100% necessary, I would say it's 99.99% :P

quiet ice
#

The config itself is just a Hashmap, so it isn't that big of an issue

paper viper
grim ice
#

"certain"

paper viper
#

like what if you name your package native

#

lol

#

or int

grim ice
#

We work with most not certain ;)

paper viper
#

Lol

kindred valley
#

how can i equal player.getItemInHand() to a custom item

grim ice
quaint mantle
paper viper
quiet ice
paper viper
#

so the IDE is an opinion

kindred valley
paper viper
#

right?

grim ice
#

except if you're using vsc or something, lol

kindred valley
paper viper
#

ig applications have opinions now?

quaint mantle
lost matrix
quiet ice
#

The thing is that the official sun java conventions date from 1997. Even though many have different opinions nowadays.

grim ice
lost matrix
#

And dont use .equals

#

or ==

quartz pike
quiet ice
#

Prime example are space vs tab conventions

ivory sleet
#

Anyways Pulse, geol and 2Hex let’s just stop with this nonsensical opinion claim

hybrid spoke
#

#isSimilar

hybrid spoke
#

oh well my messages arent sending

lost matrix
paper viper
#

dont use tab please

gaunt saffron
#

32 gigs of ram isn't enough to dev... rip, need a 2nd pc

quiet ice
paper viper
#

like the key

#

(the character)

ivory sleet
#

Pulse how’s emc

paper viper
#

sure you can use it for indents as long as it gets converted to spaces lol

paper viper
ivory sleet
quaint mantle
lost matrix
quiet ice
quaint mantle
#

7smile7 recommending checking custom items by name PU_PepeStare

quiet ice
#

The only thing is that the bukkit config wrapper imposes some overhead, but it isn't too drastic

quartz pike
lost matrix
quaint mantle
#

better to start off the beginners with some knowledge imo then let them start easy

#

imo

kindred valley
quiet ice
quaint mantle
#

isSimilar ignores the item amount @kindred valley

quiet ice
#

And both have inefficent bukkit impls

#

Md, pls fix

kindred valley
#

alright how to identify the custom item class to the event

undone axleBOT
quiet ice
#

custom item class?

lost matrix
kindred valley
quiet ice
#

like, do you extend ItemStack

ivory sleet
#

imagine is it fine if I edit DI?

lost matrix
quaint mantle
#

rack wrote most of it

ivory sleet
#

Loov yo

grim ice
#

cant u just change the item name

#

and that will break the whole thing

#

??

quiet ice
#

if you just use new ItemStack, there is nothing to worry about you "custom" item class (though that class would be more of a storage class)

next stratus
lost matrix
quiet ice
#

^

#

And I doubt that changing the name plays a significant role here

quaint mantle
#
public class CustomItemListener implements Listener {
    private final ItemStack customItem;

    public CustomItemListener(ItemStack customItem) {
        this.customItem = customItem;
    }
}

@kindred valley this code can work in many different ways

quiet ice
#

If so, the asker will notice it and ask us later for how to better identify the stack

grim ice
#

i can get a wooden stick, change its name to the custom item name

quiet ice
#

Not if it contains a color char

grim ice
#

then i get the stuff of the custom item

quaint mantle
next stratus
#

@lost matrix How did you manage to get the code to work so easily on your system but on mine it causes issues non stop? 🙂

quaint mantle
#

thats why you use PDC

grim ice
quaint mantle
#

how not

grim ice
#

if u change a wooden stick to a custom item name

quiet ice
#

Fucking hell

quaint mantle
#

ok

grim ice
#

u wont get the abilities of the custom item

lost matrix
grim ice
#

if ur using isSimilar

#

if ur using names

#

u would get them

quaint mantle
#

you make no sense

next stratus
#

I mean, I'm barely doing anything else from what you did and It won't work.

quiet ice
#

yes, but right now we are discussing equals vs isSimilar

lost matrix
next stratus
#

I got nothing else in the plugin to affect it I don't think.

#

It works fine in survival mode but in creative no luck.

lost matrix
grim ice
#

"you make no sense" replace that with "I did not understand you"

quaint mantle
grim ice
next stratus
#

I'm copying the survival code which works into the creative to see if that fixes anything.

lost matrix
grim ice
#

or if 2 items have the same name

next stratus
#

Should I only test in survival?

grim ice
#

its basically the same as comparing inventories with their title, isn't it?

quaint mantle
#

yeah

grim ice
lost matrix
grim ice
#

it would completely break the thing

#

isSimilar way better imo

next stratus
#

yep creative messes it up survival doesn't. great !

quaint mantle
#

thats why plugins should always use PDCs, its like SQL injection for minecraft plugins

next stratus
#

thanks for the help by the way

quaint mantle
#

update bozosLETSFUUUUUGOOOO

lost matrix
grim ice
quiet ice
quaint mantle
quiet ice
#

Anyways, gotta compile it with Java 16 and noone will complain

quaint mantle
#

Ooh!!! we should call it
"Item Injection"

grim ice
#

devs r prob gonna follow what server owners want

quiet ice
#

nah, I'm following what I want

#

You need to be egoistic in life and not follow the sheeple

#

And I want the latest java version

grim ice
lost matrix
grim ice
#

jk

#

egoistic wont get u money

quaint mantle
lost matrix
#

Maybe NBTInjection

quiet ice
#

you usually wont care about money anyways if PDC is your issue

grim ice
#

na we call it "injectdataintostuff"

lost matrix
#

Because the PDC is just stored in the PersistentDataHolders NBT data.

grim ice
#

ez

quiet ice
#

Because if you were to care, then you could use libraries

grim ice
#

pdc tbh speaks for itself, so u might as well just use that name

#

PersistentDataContainers 2.0

#

ez

quiet ice
#

mno

kindred valley
#

i created a class for identify the custom item and i created an event class and i want to use that custom item on event class

quiet ice
lost matrix
gaunt saffron
#
package com.thechemicalworkshop;

import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.EventHandler;

public class App extends JavaPlugin {
    @Override
    public void onEnable() {
        getLogger().info("Hello, SpigotMC!");
    }

    @Override
    public void onDisable() {
        getLogger().info("See you again, SpigotMC!");
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent e) {
    e.getPlayer();
    getLogger().info("See you again, SpigotMC! " + e);
    }

}


the eventhandler does not do anything... no errors compiling....

quaint mantle
#

Hello so i'm asking for how to set speed potion time
my code:

     Potion p = new Potion(PotionType.SPEED, 2);
        ItemStack item = p.toItemStack(1);```
it's show as Sped II (1:30)
how to set it as Speed I (8:00)
#

and thanks

gaunt saffron
quiet ice
lost matrix
quaint mantle
#

meta.addCustomEffect(arg0, arg1); ? @lost matrix

quaint mantle
digital kettle
vague oracle
#

Anyone know what causes this: java.util.FormatFlagsConversionMismatchException: Conversion = c, Flags = In ASyncPlayerChatEvent.setFormat?

digital kettle
gaunt saffron
lost matrix
# quaint mantle meta.addCustomEffect(arg0, arg1); ? <@!220605553368498176>

Example (didnt test)

  public ItemStack createCustomPotion(final PotionEffectType type, final Color color, final int tier, final int duration) {
    final ItemStack potion = new ItemStack(Material.POTION);
    final PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
    potionMeta.setColor(color);
    final PotionEffect customEffect = new PotionEffect(type, duration, tier);
    potionMeta.addCustomEffect(customEffect, true);
    return potion;
  }
quaint mantle
#

i can't meta.setcolor @lost matrix

#

Is this important?

lost matrix
#

Not important.

quaint mantle
#

yes

#

1.8.8

lost matrix
#

Ah...

quaint mantle
#

for pvp servers btw xd

lost matrix
#

I figured...

quaint mantle
#

or are you making the plugin for someone else

quaint mantle
#

only 1.8 - 1.8.8

quaint mantle
#

i'm dev on other server i don't want to adv

#

and he using 1.8

#

oh right

#

i forgot

quiet ice
#

Quick (and potentially dumb) question: is it "safe (ignoring the recommendation status)" to extend ItemClass to store data on an itemstack?

timber imp
#

version: spigot 1.8.8

tacit drift
#

Change start args

lost matrix
#

1.8.9 was a client only update

tacit drift
#

Forgot how it was called

timber imp
tacit drift
#

-Dfile.encoding="UTF-8

#

add that

lost matrix
timber imp
#

just add that and it will fix

quaint mantle
quiet ice
quaint mantle
#

best not be "§cString"

quiet ice
#

my brain is starting to rot I see

tacit drift
timber imp
#

its &like : &a&lname

quaint mantle
#

ok

timber imp
#

dont u think u must have added another " at the end

#

:|

lost matrix
# quiet ice oh lol, yes, I meant ItemStack

Because it wont persist in any way. Spigot completely throws the ItemStack away when interacting with the NMS backend.
So everything you do to that interface will just be discarded.

tacit drift
#

Is the vps on windows server?

timber imp
#

yes

tacit drift
#

cause I had this issue on windows

#

:))

timber imp
#

and it was on linux before :|

#

:|

tacit drift
#

Yeah if u add that in server start args it should be fine 👍 👍

timber imp
#

ok

lost matrix
# quiet ice oh lol, yes, I meant ItemStack

So you cant implement ItemStack nor extend CraftItemStack (which is final anyways) to make any changes to an ItemStack or persist any data in it.
Best you can do is wrap the ItemStack in a custom class and use the PDC underneath.

quaint mantle
quiet ice
#

k. I didn't want to store data persistently anyways, but if CraftItemStack exists then yea

tacit drift
quaint mantle
#

ItemStack item = new ItemStack(ItemsAPI.createCustomPotion(PotionEffectType.SPEED, Color.RED, 2, 30));

tacit drift
#

ooh

#

read that wrong

lost matrix
quaint mantle
#

ooh

quiet ice
#

what hte fucc

timber imp
#

:|

#

tell him it didnt work

#

why removed :(

quiet ice
#

spam, most likely

timber imp
#

its not spam

quiet ice
#

?paste use that instead

undone axleBOT
timber imp
#

its the error

#

ok

lost matrix
#

-D options go before the executed jar and after the -jar command. @quaint mantle

quiet ice
#

It is, it took an entire screen. Even if the intentions were noble

quaint mantle
#

thx btw

timber imp
lost matrix
timber imp
#

ok

#

thanks

#

worked

quaint mantle
#

it's still waterbottle i set the itemmeta @lost matrix

lost matrix
quaint mantle
#

okay sir

#

take your time

#

it's give me the speed effect when i'm drinking it .. but the item show as water @lost matrix

grim ice
#

how to get the player seeing a placeholder

#

offline player doesnt seem to work

lost matrix
#

Works great for me.

lost matrix
quaint mantle
#

yes maybe , btw thank you so much for helping me @lost matrix

sullen dome
#

is it actually possible to kick a player if he has a certain fabric-mod installed? i see people using the absolutely dumb coded mod Tweakeroo mod on my server

lost matrix
sullen dome
#

it's so insanely dumb that people publish mods that are not made to hack, but allow stuff like freecam on servers

#

i'll ask on their dc tho

quiet ice
#

I dont think that fabric published the mod list in any way

#

I know that quilt will allow this, but fabric does not. Or at least it used to be like that not long ago

lost matrix
#

I know that forge does it. Fabric should be the same, no?

quiet ice
#

Nope, fabric is not.

lost matrix
#

How does fabric then check if the client has the proper mods installed to join a server?
Surely the client does not decide that.

quiet ice
#

apparently it does it based on the registry

#

I. e. it connects and hopes that all stars align well

lost matrix
#

There must be some communication happening. Ill go ask on the fabric discord.

still wing
#

who will help with the chat event i'm newbie

#

possibly for a fee

reef wind
#

first of all what?

#

second of all

#

?ask

undone axleBOT
#

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.

reef wind
#

@still wing

still wing
#

second

still wing
#

sanks

#

how to do when writing for example "q" it was displayed "*"

quiet ice
#

do keep in mind that if you intent to stay paper-only this event might not be a good option for you given paper's absurd component refractor

quiet ice
#

Use getMessage() and set it via setMessage()

#

The javadoc should help there

still wing
#

what exactly?

reef wind
#

wdym?

quiet ice
still wing
reef wind
#

what do you mean?

reef wind
#

you have been given everything you need

still wing
#

translation may not be correct due to the fact that I use google translator

unkempt peak
#

String.replace

reef wind
unkempt peak
#

Yeah

still wing
reef wind
#

🤨

unkempt peak
#

?

reef wind
still wing
#

just started teaching today

unkempt peak
still wing
reef wind
#

don't make a plugin the first day you start learning

unkempt peak
candid galleon
#

you’re teaching Java?

unkempt peak
#

Spigot != java

#

Learn Java first

reef wind
still wing
stone sinew
stone sinew
still wing
#

sorry

reef wind
#

you should learn the language first, not make shit the first day.

still wing
#

sorry

reef wind
#

no problem, but you are going to have problems upon problems if you don't learn it properly first.

grim ice
#

what proud desk is saying is 100% the truth

#

but

#

personally, i find java really boring so im learning both spigot api and java atm

#

but i cant go so far in spigot api until i learn more java

#

but its better to learn both at the same time if u can :P its also fun

#

ANYWAYS

#

how to get the player seeing a placeholder
offline player doesnt seem to work

quiet ice
#
public class PresencePlaceholders extends PlaceholderExpansion {
  /* *** SNIP *** */
 @Override
    public String onPlaceholderRequest(Player player, @NotNull String value) {
        // Code ...

worked brilliantly for me in the past

feral lodge
#

i might be a little stupid here but why can my yaw be anything between around -870 and +870

lost matrix
grim ice
#

i have

#
@Override
    public String onRequest(OfflinePlayer player, @NotNull String params) {
        // Compute and return your placeholder here
        UUID uuid = UUID.fromString("");
        for (UUID key : BaseCommand.leaders.keySet()) {
            if (BaseCommand.leaders.get(key).contains(player.getUniqueId()))
                uuid = key;
            }
        return getTeamIndex(uuid);
    }```
quiet ice
#

hmh, this plugin is a bit strange

grim ice
#
    public String getTeamIndex(UUID leader) {

        Set<UUID> keySet = BaseCommand.leaders.keySet();
        ArrayList<UUID> list = new ArrayList<>(keySet);

        return String.valueOf(list.indexOf(leader));
    }```
#
public abstract class BaseCommand implements CommandExecutor {
    protected static JavaPlugin plugin;
    protected static LinkedHashMap<UUID, List<UUID>> leaders = new LinkedHashMap<>();
    protected static List<UUID> toggledChat = new ArrayList<>();
}```
quiet ice
feral lodge
kindred valley
#

can someone help me

feral lodge
hasty prawn
#

Wait hang on

#

It should just wrap

hasty prawn
#

Like 870, 570, 150 are all the same yaw I'm pretty sure.

feral lodge
#

i get these kinda numbers

#

meaning my character either doesnt have a functioning neck, im stupid or im being given weird numbers

quiet ice
#

You can safely clamp them down into your desired range afaik

#

The protocol accepts out-of-bounds yaw/pitch wouldn't be surprised if it wasn't different with the bukkit api

hasty prawn
#

Does the protocol clamp them if they're out of bounds?

quiet ice
#

actually, no.

#

They are a byte in the range of 0 - 255

grim ice
#

?paste

undone axleBOT
grim ice
#

help

quiet ice
#

I swear I read something about out-of-bounds rotation somewhere.

grim ice
#

idk how to get the player viewing

#

the placeholder

feral lodge
#

how would i clamp the yaw?

quiet ice
#

that is the player parameter

hasty prawn
quiet ice
#

I do not see what the issue is

hasty prawn
#

870 % 180 in your case gives 150, and -870 gives 30

grim ice
quiet ice
#

yea

feral lodge
grim ice
#

im extending PlaceholderExpansion

feral lodge
#

im assuming % 90 on the pitch to keep it fixed?

quiet ice
#

Then according to the javadocs it should be Player player, but if it compiles ¯_(ツ)_/¯

hasty prawn
#

Well if you want it fixed you should just set it to whatever the fixed amount is

#

Otherwise, yes % 90

feral lodge
#

but thanks

kindred valley
#

getCommand("kelepce").setExecutor(new Kelepceler());

#

`'Kelepceler(org.bukkit.inventory.ItemStack)' in 'com.limpeex.Items.Kelepceler' cannot be applied to '()'

#

what can i do

hasty prawn
#

It wants you to give it an ItemStack

grim ice
#

there is no Player

#

i said im extending PlaceholderExpansion

kindred valley
hasty prawn
#

I bet it does. Try

chrome beacon
#

With itemstack

kindred valley
#

import com.limpeex.Plugin;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.ArrayList;



public  class Kelepceler implements CommandExecutor {



    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {

        if (commandSender instanceof Player) {
            Player player = (Player) commandSender;

            ItemStack kelepce = new ItemStack(Material.TRIPWIRE);
            ItemMeta meta_kelepce = kelepce.getItemMeta();
            meta_kelepce.setDisplayName(ChatColor.GRAY + "Kelepçeler");
            ArrayList<String> lore = new ArrayList<>();
            lore.add(ChatColor.DARK_BLUE + "Polislere Özgüdür");
            lore.add(ChatColor.DARK_BLUE + "Kişileri Kelepçeleyip Soymaya Yarayabilir.");
            meta_kelepce.setLore(lore);
            meta_kelepce.addEnchant(Enchantment.PROTECTION_FALL, 1, true);
            player.getInventory().addItem(kelepce);
            player.getInventory().addItem(getKelepce());




        }
        return true;
    }

    private ItemStack kelepce;

    public Kelepceler(ItemStack kelepce) {
        this.kelepce = kelepce;
    }

    public ItemStack getKelepce() {
        return kelepce;
    }

    public void setKelepce(ItemStack kelepce) {
        this.kelepce = kelepce;
    }

}
#

sorry

hollow river
#

im trying to do something really wild here for fun, but i first want to know how and if it'd be possible

hasty prawn
eternal oxide
#

there is no empty constructor so you can;t instance it without an ItemStack

hollow river
#

id'd like to make kind of an eloquent system like the laravel php framework has, would it be possible to create a custom collection class where i could iterate through and instance of it? like Collection users = User.getAll(); and then be able to put users straight into a for loop for example

gaunt saffron
#

i suck so please don't beat at me
my friend gave me this:

package com.thechemicalworkshop;

import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;


public class App extends JavaPlugin {
    @Override
    public void onEnable() {
        getLogger().info("Hello, SpigotMC!");
        getServer().getPluginManager().registerEvents(new MyEvents(), this);
    }

    @Override
    public void onDisable() {
        getLogger().info("See you again, SpigotMC!");
    }

}


public class MyEvents implements Listener {
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent e){
        Player player = e.getPlayer();
        e.setJoinMessage(ChatColor.AQUA + player.getName() + " joined the server!" );

    }
}

i assume i should put the public class MyEvents into a file, should it be next to app.java or where?

kindred valley
#
    public void onEnable() {

        getServer().getPluginManager().registerEvents(new XPBottleBreakEvent(),this);
        getServer().getPluginManager().registerEvents(new EggThrowEvent(),this);
        getCommand("god").setExecutor(new GodMode());
        getCommand("feed").setExecutor(new Feed());
        getServer().getPluginManager().registerEvents(new PoliceBlockBreakEventAnnonation(), this);
        getCommand("911").setExecutor(new NineNineOneCommand());
        getCommand("vault").setExecutor(new vault());
        getCommand("flymode").setExecutor(new FlyCommand(this));
        getConfig().options().copyDefaults();
        saveDefaultConfig();
        getCommand("tpbow").setExecutor(new TeleportBowCommand());
        getServer().getPluginManager().registerEvents(new TeleportBowEvent(), this);
        getCommand("kelepce").setExecutor(new Kelepceler(this, this));

    }



}
quiet ice
kindred valley
#

but ingame command doesnt work

eternal oxide
#

no, because you are trying to create a new instance without an ItemStack

kindred valley
#

what should i do

eternal oxide
#

Sorry to say, but learn java

#

Your method constructor requires an ItemStack so you can;t create it without one.

kindred valley
#

and you are telling me that i need to create a constructor with itemstack

eternal oxide
#

no

#

you already have one of those

#

but you are not using it

kindred valley
#

to use i need to use the reference right?

grim ice
#

elgar is telling ppl to learn java

#

this is a special case

#

bro ur case is really bad if elgar tells u to learn java

kindred valley
kindred valley
eternal oxide
#

look at your register command line

lost matrix
#

try adding "" to your entries

kindred valley
#

should be like this?

eternal oxide
#

no

kindred valley
#

i cant use itemstack constructor

eternal oxide
#

where you are callign new Kelepceler

grim ice
#

show code

eternal oxide
#

you are trying to use an empty constructor

#

but you don;t have a no args constructor

grim ice
#

hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

#

sure

kindred valley
grim ice
#
  1. why do you have this itemstack shit in ur command class
#

it looks ugly

#

move it to a itemstacks class

eternal oxide
#

if you want to instance it with no args, yes

kindred valley
#

should be like that right

grim ice
#

what

#

why do u have a constructor with no param

#

s

eternal oxide
#

yes

kindred valley
#

im saying

eternal oxide
#

because he has one that takes an Itemstack so he has ot have an empty one to use a no args

grim ice
#

?paste

undone axleBOT
grim ice
#

help

#

idk how to make papi work

lost matrix
# grim ice help

Has nothing to do with papi.
UUID.fromString("")
Just doesnt work because... an empty String is no UUID.

grim ice
#

i changed it tho

#

UUID uuid = UUID.fromString("");
for (UUID key : BaseCommand.leaders.keySet()) {
if (BaseCommand.leaders.get(key).contains(player.getUniqueId()))
uuid = key;
}

#

holy fuck bro

kindred valley
#

errors this @eternal oxide

grim ice
#

delete that

#

and put it in

#

?paste

undone axleBOT
quaint mantle
#

do you guys know why falling blocks spawned via packed do not show? I can see the particle when it lands but the block itself isn't there

lost matrix
grim ice
#

i see

grim ice
quaint mantle
#

PacketPlayOutSpawnEntity

lost matrix
quaint mantle
#

yes

grim ice
#
@Override
    public String onPlaceholderRequest(Player player, @NotNull String params) {
        // Compute and return your placeholder here

        for (UUID key : BaseCommand.leaders.keySet()) {
            if (BaseCommand.leaders.get(key).contains(player.getUniqueId())) {
                return getTeamIndex(key);
            }
        }
        return "";
    }```
#

smile u think dis will work

lost matrix
# quaint mantle yes

This is how i do it with my class which extends EntityFallingBlock

  public void showTo(final Player player) {
    final PlayerConnection connection = ((CraftPlayer) player).getHandle().b;
    connection.sendPacket(this.getPacket());
    connection.sendPacket(new PacketPlayOutEntityMetadata(this.getId(), this.getDataWatcher(), true));
  }
#

Because i remember having the same problem

#

So i just grabbed the packet from the EntityFallingBlock

quaint mantle
#

I send the entity directly to the client don't create a new class that extends it

toxic crypt
#

i need help

lost matrix
quaint mantle
#

so no spawn entity?

#

will try

lost matrix
#

It is a spawn entity packet. Its just prepared by the class.

lost matrix
undone axleBOT
#

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.

tired spoke
#

i need to code with Spigot 1.12.2 for addong Paper support?

#

adding*

lost matrix
grim ice
#

7smile7, do you think this is better?

  @Override
   public String onPlaceholderRequest(Player player, @NotNull String params) {
       // Compute and return your placeholder here

       for (UUID key : BaseCommand.leaders.keySet()) {
           if (BaseCommand.leaders.get(key).contains(player.getUniqueId())) {
               return getTeamIndex(key);
           }
       }
       return ChatColor.translateAlternateColorCodes('&', "&cNONE");
   }```
tired spoke
grim ice
#

pog

lost matrix
# tired spoke i code using spigot?

You code with whatever you want. If you want to to write a spigot plugin, write with spigot.
If you want to write a paper plugin then write using paper. But spigot plugins will run on both.

lost matrix
quaint mantle
tired spoke
#

ok

quaint mantle
#

can't find it

lost matrix
#

What version?

quaint mantle
#

1.16.5

lost matrix
quaint mantle
#

okay

young knoll
#

Might not even return packet if it’s obfuscated

quaint mantle
#

it's there P()

#

okay will see

toxic crypt
#

I cant open spigot 1.17.1.jar

lost matrix
young knoll
#

Yeah I forgot class names were never obfuscated

lost matrix
toxic crypt
#

oh

young knoll
#

But it has cookies inside!

quaint mantle
#

the block is still is invisible sadly

toxic crypt
#

where do i put it then

quaint mantle
#

idk why it would be tho

lost matrix
lost matrix
toxic crypt
#

cod of the jar

quaint mantle
#

yeah one sec

young knoll
#

Get a decompiler

quaint mantle
lost matrix
#

The proper way would be to generate the mojang mapped jar via BuildTools. Then you can just traverse it with your IDE

#

Why do you want to see the code?

toxic crypt
#

i dont want to see the code

#

i want help to open spigot 1.17.jar

young knoll
#

Open or launch

toxic crypt
#

launch

lost matrix
#

Ah.

young knoll
#

?install

#

Dangit

lost matrix
gaunt saffron
#

Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "say hi");

what do i need to import to be able to use this/is there a better way?
i just wanna send a message to a player..

young knoll
#

player.sendMessage

gaunt saffron
#

oh

#

and if i wanted to run a command?

lost matrix
#

Or if you want to tell it to everyone on the server:
Bukkit.broadcast("hi")

gaunt saffron
#

if i do bukkit. i get error, what do i need to import?

lost matrix
#

org.bukkit

kindred valley
#

getCommand("kelepce").setExecutor(new Kelepceler()); empty constructor doesnt work for execute the command

#

can someone help me

gaunt saffron
lost matrix
gaunt saffron
#

dont have that option, at least dont see it

young knoll
#

...

#

What ide

gaunt saffron
#

VS Code

young knoll
#

Oh no

gaunt saffron
#

yes im not gonna switch IDE due to 1 language

young knoll
#

I mean there might be a plugin for it

prime birch
#

I've just added bungecord to my server. And the bungecord has to be running in online mode and the subservers in offline for the proxy to connect. But the thing is.
My SMP has been running in Online mode all this time
So me turning it to offline has reset everyones stats claims
like evreything
Help ahah
Anyway for the proxy to run with online mode?

I have 3 instances, proxy, smp and lobby. in the spigot.yml bungecoord is true

young knoll
#

But dedicated java ides exist for a reason

lost matrix
gaunt saffron
#

well, my efficiency would go too much down

lost matrix
#

C# -> raider, C++ -> CLion, Python ->PyCharm, Js -> WebStorm, Java -> IntelliJ

knotty ruin
#

same

#

i use those exact ides

#

cause JetBrains on top

gaunt saffron
#

yeah, i did try eclipse and it was tererible

lost matrix
gaunt saffron
#

did try arduino ide, also terrible

lost matrix
#

But CLion honestly needs some more time

knotty ruin
#

I sometimes use IntelliJ for web dev if I'm doing a java webserver

gaunt saffron
lost matrix
gaunt saffron
lost matrix
young knoll
lost matrix
young knoll
#

Ideally you should use the ChatColor class

gaunt saffron
young knoll
#

Can get a bit clunky though

gaunt saffron
#

well do if i want red-blue in 1 line..

#

oh jeez

#

lets see if java supports painless multiline..

young knoll
#

CharColor.RED + text1 + ChatColor.BLUE + text2

or TranslateAlternateColorCodes with &aText 1&9Text 2

toxic crypt
#

can you help

lost matrix
toxic crypt
#

this

lost matrix
gaunt saffron
young knoll
#

The top one with “”” is probably the easiest

toxic crypt
#

can you go on discord call

#

with me

young knoll
#

Also TIL you can do that in modern java, nice

toxic crypt
#

to explain and show me the steps

lost matrix
young knoll
#

Heh

toxic crypt
#

7smile

gaunt saffron
lost matrix
# toxic crypt to explain and show me the steps

The website describes the steps pretty meticulously. If you know how to do
the basic things with your computer like writing a text file then you should
be able to do this. There are also a million videos for this.

young knoll
#
  • will concat strings in java
lost matrix
young knoll
#

concat = concatenate = connect two strings together

#

IE: "Hello" + "World" = "HelloWorld"

gaunt saffron
#

yeah

#
        player.sendMessage(
            ChatColor.RED + "aghh you died !\n" + 
            ChatColor.RED + "you can spectate others or use" + 
            ChatColor.GREEN + "/lobby " + 
            ChatColor.RED + "to go back");

how do i make it red AND bold?

quaint mantle
#

ChatColor.BOLD

young knoll
#

ChatColor.RED + ChatColor.BOLD

#

You probably have to toString one

gaunt saffron
#
The operator + is undefined for the argument type(s) org.bukkit.ChatColor, org.bukkit.ChatColorJava(536871072)
#

🙄

young knoll
#

Yeah

#

ChatColor.RED.toString() + ChatColor.BOLD

gaunt saffron
#

okay, this is weird, then i might just add it for all tbh

#

oh yeah i remember it like 8 years ago you had to add tostring ot EVERYTHING

young knoll
#

Java doesn't like implicitly calling toString on both sides of the + I guess

eternal oxide
#

it has to start with a String or it can;t work out what it is adding

#

eg you can do ""+ ChatColor.RED + " strings"

gaunt saffron
#

are there tools to make a plugin more lightweight? im very conserned about size/performance usage

eternal oxide
#

get what you want to do working, then worry about size

young knoll
#

Size is generally not an issue

#

Unless you shade a ton of stuff

gaunt saffron
#

okay, the stuff works, it tells the message but then it tells me i died... i assume i need to wait a bit? how long/how?

gaunt saffron
#

would it be possible, to run a command as a player on a spigot server, beeing a bungee command?

gaunt saffron
#

this has to go on like 3 servers (for now) which get indefinetly scaled

#

basically they get replicated and destroyed, depends on number of users...

gaunt saffron
#

yupp

#

i wrote a lot of logic and people from docker and ptero argued with me for hours saying this aint possible....

#

i have a system, indefinetly scalable, just need to call orcale and it's indefinetly, indefinetly scalable

#

i'll leave last step since im broke and limit to like 8 cores 48 gigs of ram

lost matrix
gaunt saffron
#

nah i can't do that, because they are handles by another plugin

#

so PlayerDeathEvents it is

lost matrix
gaunt saffron
#

even tho another plugin has the custom message? i can delay it?

lost matrix
#

You could even delay it. But not recommended.

gaunt saffron
#

well yeah, not gonna do

gaunt saffron
#

and i'm done with one plugin, like few more togo

lost matrix
#

Why would you ever import an enum statically?

gaunt saffron
# gaunt saffron and this

well, i found this somwehere
Anytime you use wait, you're going to cause the whole server to wait. You need to learn runnables/threads. The delayed task might be useful in your case.

young knoll
#

?scheduler

#

I'm bad

lost matrix
#

?scheduling

undone axleBOT
lost matrix
#

Ive learned ^^

burnt current
gaunt saffron
#

oh jeez... this is complicated

burnt current
#

so i have imported
import org.bukkit.block.data.type.Stairs;
and
import static org.bukkit.Material.BRICK_STAIRS;
so far

gaunt saffron
#

i wish there was await wait(10)...

quiet ice
#

the await keyword is pretty strange imo

lost matrix
lost matrix
quiet ice
#

If people would replace sync/async with off-thread/on-thread and blocking/non-blocking it would be much easier to understand

gaunt saffron
#

python has similar thing...

quiet ice
#

and I never got around to python

lost matrix
#

Something can run async but still be executed on the main thread.

quiet ice
#

Correct, which is why I implied that async could have two meanings that look the same at the surfact but are radically different

gaunt saffron
#

well but async is huge step forward...

lost matrix
#

Yeah. I still remember when i tried to wrap my head around that

quiet ice
#

For example it is impossible to write anything multithreaded in python because of the global interpreter lock yet they have this???

gaunt saffron
quiet ice
#

You can't say there is threading if the language can only compute one instruction at a time, huge waste of processing time given that nowadays we have multicore

#

Sure, it does fit the definition of threading

#

but I do not really like it

lost matrix
gaunt saffron
#

okay is easy way to make this python stuff be delayed?

lost matrix
gaunt saffron
#


package com.thechemicalworkshop;

import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.entity.HumanEntity;
import org.bukkit.GameMode;
import org.bukkit.Bukkit;

public class MyEvents implements Listener {
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e) {
        Player player = e.getEntity();
        // System.out.println(player.getName());
        player.setGameMode(GameMode.SPECTATOR);
        player.sendMessage(ChatColor.RED.toString() + ChatColor.BOLD.toString() + "aghh you died !\n"
                + ChatColor.RED.toString() + ChatColor.BOLD.toString() + "you can spectate others or use "
                + ChatColor.GREEN.toString() + ChatColor.BOLD.toString() + "/lobby " + ChatColor.RED.toString()
                + ChatColor.BOLD.toString() + "to go back");
        // Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "say hi");
    }
}


so far im here, thought of doing it like as title or smth but eh

lost matrix
gaunt saffron
#

oh?

#

lemme try, what do i need to import?

quiet ice
#

nothing

lost matrix
#

Nothing

gaunt saffron
#

okay

#

the compiling... jeez

#

like 1min wasted to test the code 🙄

#

plus i dont have mc on my machine

#

so i need to cp..

gaunt saffron
#

i think delay?

quiet ice
#

maven compiles everything in under 10 seconds max in my experience

gaunt saffron
#

yeah but server restart

lost matrix
gaunt saffron
#

and copying over

gaunt saffron
quiet ice
#

You can try hotswapping (most use /reload though)

gaunt saffron
#

eh

#

could but never had luck

#

always smth else breaks

lost matrix
next stratus
#

Honestly, spigot is so unstable with their api :/

gaunt saffron
#

becuase MC and Maven are on different machines

#

i have all my coding on a VM

#

sometimes i do debugging of malware and yeah....
also weird imports and weird stuff

quiet ice
#
        Bukkit.getScheduler().runTaskTimer(this, () -> {
             // COde
        }, 1, 1);

That runs it every tick, but the system will be similar

lost matrix
gaunt saffron
#

plus when i stream i prefer not to show my stuff

gaunt saffron
next stratus
gaunt saffron
lost matrix
quaint mantle
lost matrix
quiet ice
next stratus
#

But I don't know how I'm making it go wrong :/

gaunt saffron
quaint mantle
#

what errors?

somber hull
#

Lol

#

You have to do

quaint mantle
#

bc ur not doing it right

gaunt saffron
#

then tell me pls?

next stratus
quaint mantle
#

ChatColor.RED + "string"

somber hull
#

Chatcolor.COLOR + “” + ChatColor.BOLD + “message”

lost matrix
quiet ice
somber hull
quiet ice
#

ah dang it, you beat me

unreal quartz
next stratus
#

ye it should be

gaunt saffron
quaint mantle
#

very sussY

next stratus
#

I'm on 1.17

unreal quartz
#

well it either is or isn’t

unreal quartz
#

spigot can still have versions past that

next stratus
#

Want me to download the latest on the site?

lost matrix
unreal quartz
#

run /version and it will tell you

somber hull
gaunt saffron
next stratus
#

1.17

quiet ice
lost matrix
gaunt saffron
next stratus
somber hull
#

I used to use it with to string

unreal quartz
#

yes but it will say how many versions you are behind

somber hull
#

Man why hasn’t spigot enabled threads

next stratus
#

but i didn't think it would cause this issue even if i'm a bit behind tho

lost matrix
#

Its just unnecessary. toString() gets called implicitly.

next stratus
unreal quartz
lost matrix
quaint mantle
#

jesus christ

next stratus
#

But I legit can't work out where I'm going wrong

gaunt saffron
# somber hull Do you have the right import?
package com.thechemicalworkshop;

import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.entity.HumanEntity;
import org.bukkit.GameMode;
import org.bukkit.Bukkit;

public class MyEvents implements Listener {
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e) {
        Player player = e.getEntity();
        // System.out.println(player.getName());
        int delay = 1;
        Bukkit.getScheduler().runTaskLater(this.plugin, () -> {

            player.setGameMode(GameMode.SPECTATOR);
            player.sendMessage(
                    ChatColor.RED + "" + ChatColor.BOLD + "" + "aghh you died !\n"
                    + ChatColor.RED + "" + ChatColor.BOLD + "" + "you can spectate others or use "
                    + ChatColor.GREEN + "" + ChatColor.BOLD + "" + "/lobby " + ChatColor.RED + ""
                    + ChatColor.BOLD + "" + "to go back");
            player.spigot().respawn();
            // Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "say hi");
        }, delay);
    }
}

is this correct? yeah i know i can remove some ""...

next stratus
#

Survival it works absolutely fine

#

But when it comes to creative, it fucks up using the exact same code

lost matrix
next stratus
#

I find it weird how survival it works, but creative it breaks.

lost matrix
next stratus
#

So only test in survival and drop creative mode support?

#

that's perfectly fine with me only testing in survival

gaunt saffron
#

source level? how do i even change this i only could choose upto 1.4

lost matrix
gaunt saffron
#

happyly if you tell me how

#

and what it does

quaint mantle
#

*16 actually, 17 didn't realease smh

gaunt saffron
#

whats thhe difference? also, where

quaint mantle
#

That is as Long as you have a JDK 16 installed (which you shouldve)

#

In your pom

gaunt saffron
#

i do

lost matrix
#

Change it to 16

quaint mantle
#

The difference IS a decade of development

gaunt saffron
#
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
  </properties>```
#

question is, if i load this plugin into 1.12will it still work?

#

just changing the stuff from latest to 1.12

#

wherever it is

quaint mantle
#

No, for that you need to use Java 8 (I. E. 1.8)

gaunt saffron
#

so i need to recompile just to use one for 1.12?

quaint mantle
#

1.12 is Dum and can't handle Java 9+

gaunt saffron
#

jeez

#

well i found nice plugin in 1.12 i wanna use... so

#

idk

#

okay compalingf for 16..

quaint mantle
#

But you need to recompile anyways for 1.12 use due to the mat refractors

gaunt saffron
#

yeah screw 1.12 for now then

#
[23:27:43 ERROR]: Could not pass event PlayerDeathEvent to BlankPlugin v0.1
java.lang.Error: Unresolved compilation problem:
        plugin cannot be resolved or is not a field

        at com.thechemicalworkshop.MyEvents.onPlayerDeath(MyEvents.java:19) ~[?:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.17.1.jar:git-Paper-85]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.17.1.jar:git-Paper-85]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.17.1.jar:git-Paper-85]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.17.1.jar:git-Paper-85]

i assume this line...
Bukkit.getScheduler().runTaskLater(this.plugin, () -> {

quaint mantle
#

Ah

#

And use this

gaunt saffron
#

just this?

quaint mantle
#

Instead of this.plugin

gaunt saffron
#

ok

#

he method runTaskLater(Plugin, Runnable, long) in the type BukkitScheduler is not applicable for the arguments (MyEvents, Runnable, int)
you sure?

quaint mantle
#

That being said, this is as Long as it is in the Main class, otherwise you need to do DI

next stratus
#

thanks for your help @lost matrix I think i got it all working

quaint mantle
#

Dependency injection it is then

gaunt saffron
quaint mantle
#

You basically needd to give it you plugininstance

gaunt saffron
#

oh yeah, can you help? i assume i need to import the main file?

#

how?

quaint mantle
#

No, No need to Import anything. Imports in Java dont so anything

#

They even get removed after you compile it

gaunt saffron
opal juniper
#

Or you could just make a static field in ur main class

quaint mantle
#

No really

opal juniper
#

if dependency injection is not an option

gaunt saffron
#
package com.thechemicalworkshop;

import org.bukkit.plugin.java.JavaPlugin;

public class App extends JavaPlugin {
    @Override
    public void onEnable() {
        getLogger().info("Hello, SpigotMC!");
        getServer().getPluginManager().registerEvents(new MyEvents(), this);
    }

    @Override
    public void onDisable() {
        getLogger().info("See you again, SpigotMC!");
    }

}

this is my main file

opal juniper
#

Why do you need your main class instance? Runnables?

gaunt saffron
#

my friend told me to split it like this

#

but sadly he went sleep

quaint mantle
#

Change the constructor of MyEvents to MyEvents(JavaPlugin) and Pass this into the constructor

gaunt saffron
#

getServer().getPluginManager().registerEvents(new MyEvents(JavaPlugin), this);

#

i assume

opal juniper
#
private JavaPlugin plugin

public MyEvents(JavaPlugin plugin) {
  this.plugin = plugin;
}
quaint mantle
#

Then use that instance you passend through the constructor to Set a field, which you will use

opal juniper
gaunt saffron
#

now idk whom to listen

opal juniper
#

we are saying the same thing xD

gaunt saffron
#

woh..

quaint mantle
opal juniper
#

I simply posted the constructor required for that class

gaunt saffron
#

getServer().getPluginManager().registerEvents(new MyEvents(JavaPlugin), MyEvents(this));