#help-development

1 messages · Page 1888 of 1

hardy swan
#

oh, that one prob since it is essentially a wrapper for mh, i think....

proud forum
#

okay, i'm pretty sure i have the main class setup right...

package me.mrhonbon.overpoweredmobs.overpoweredmobs;

import org.bukkit.plugin.java.JavaPlugin;

public final class Overpoweredmobs extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Over Powered Mobs has been loaded successfully.");

        getServer().getPluginManager().registerEvents(new Opmobs(),this);
    }
    @Override
    public void onDisable() {
        // Plugin shutdown logic
        System.out.println("Lol yo momma");
    }
    private boolean eventMode;

    public boolean toggleEventMode() {
        eventMode = !eventMode;
        return eventMode;
    }
    public boolean isEventMode() {
        return eventMode;
    }
}
#

now its the command part i am gonna struggle with

hardy swan
#

you want a command that toggles the listener?

proud forum
#

yeah, i want the over powered mobs to not spawn when i type /opmobs disable and vice verse for /opmobs enable

#
package me.mrhonbon.overpoweredmobs.overpoweredmobs;

import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.inventory.ItemStack;

public class Opmobs implements Listener {
    @EventHandler
    public void creatureSpawn(CreatureSpawnEvent event) {

        if(event.getEntityType() == EntityType.CREEPER) {
            Creeper creeper = (Creeper) event.getEntity();
            creeper.setPowered(true);
        }

        if(event.getEntityType() == EntityType.ZOMBIE) {
            Zombie zombie = (Zombie) event.getEntity();
            zombie.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
            zombie.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
            zombie.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
            zombie.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS));

            ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
            sword.addEnchantment(Enchantment.DAMAGE_ALL, 5);
            zombie.getEquipment().setItemInMainHand(sword);
        }
    }

}```
#

oh and here is my command class that has literally nothing in it so far

package me.mrhonbon.overpoweredmobs.overpoweredmobs;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class OpmobsOnAndOff implements CommandExecutor {
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {

    }
}
hardy swan
#

On the right track, if it is a toggle by command i think conclure's way is better

hardy swan
#

Opmobs can expose a method, say #setEnable(boolean) that OpmobsOnAndOff can call

#

OpmobsOnAndOff can accept a Opmobs instance in its constructor so it has a direct reference to the listener that it should enable/disable

proud forum
hardy swan
#

You familiar with OOP (Object Oriented Programming) paradigm?

proud forum
#

maybe a little? not to sure

#

ohh that has to do with what types of things are put in code respect to other things

outer sorrel
#

I keep getting this error from my plugin when starting it, not sure what it is

[14:01:28 ERROR]: [MMOUpgrades] [STDERR] An error occurred while loading this configuration: []: Unknown error occurred while loading
[14:01:28 WARN]: Nag author(s): '[JustDoom]' of 'CoolPlugin' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[14:01:28 WARN]: unacceptable code point '' (0x0) special characters are not allowed
[14:01:28 WARN]: in "'reader'", position 0

I mean more is there any way to find where it wants me to change the System.out/err.print thingy

proud forum
#

and where specifically in respect to other things^

young knoll
#

I mean

hardy swan
#

so programming consists of data and functions

young knoll
#

You made the plugin, you should be able to find where it is

hardy swan
#

while OOP basically segregates data (here we call fields) and functions (here we call methods) into classes

#

it doesn't really matter the order you specify these fields/methods in a class

proud forum
#

ahh i see

outer sorrel
#

ok got it

sick herald
#

im trying to cast a bukkit inventory to a custom inventory but im getting an error, how would i properly cast it?

hardy swan
#

It just means that the inventory isn't an instance of your custom inventory. And I don't think you can enforce a custom type of inventory

young knoll
#

You cannot

#

Use the inventory view returned from openInventory

#

Add it to a set and check that set in the event

proud forum
#

even with you telling me basically what to do i am still suck and i am sorry if this is bothersome to you

hardy swan
# proud forum

so a class can be

public class Test {
    int field1;
    String field2;

    void methodOne() {}
    void methodTwo() {}
}
#

it doesn't matter the order you specify the methods

proud forum
#

i feel like what would be easier for me is to use booleans in mix with if then statements, even tho it might be more to type and code, i feel like it would be easier to understand for me at least

#

if you get what i mean

echo basalt
#

Some ideas that I suggest for code cleanliness

#

don't repeat get... calls

hardy swan
#

so you can have:

public class Opmobs implements Listener {
    private boolean isEnabled;

    @EventHandler
    public void onCreatureSpawn(CreatureSpawnEvent evt) {
        if (!isEnabled) return;
        // Rest of the logic
    }

    public void setEnabled(boolean arg) {
        this.isEnabled = arg;
    }
}
proud forum
#

because i know if i can get this simple toggle on and off event, then i will be set for making basic plugins like this

#

like this right?

hardy swan
#

you cant have methods inside methods

kind hatch
# proud forum

You need to learn about scopes. You are trying to create a method inside a method, which you can't do.

proud forum
#

oops

#

i should've known that

hardy swan
#

OOP enforces that methods are members of class

sterile token
#

Who tag me? Please dm me the one who tag me please

hardy swan
#

unlike functional programming where you can declare functions wherever you like

sterile token
quaint mantle
#

but in methods, java will execute the functions inside it from the top

quasi patrol
#

Confusion?

sterile token
sterile token
#

Should be an async task?

quasi patrol
#

But I am still confused.

sterile token
#

I didnt see sorry

#

Why confused

#

Explain that so i can try helping you

hardy swan
#

ok LMF probably not, can't seem to find a way, or at least I think it is not meant for fields

quasi patrol
proud forum
#

am i dumb as in i just did the same thing again or did i do this right

hardy swan
#

careful of your brackets

sterile token
#

If not you will have many problems

#

I mean i dont wanna be rude. But when you dont know the basics its really difficult

vocal cloud
#

100% a learnjava moment

sterile token
hardy swan
#

?async

#

oh that's not a command

#

?scheduler

#

hmm

proud forum
#

nono i understand, i am learning python at my highschool and i know if u learn one language it is easier to learn another

sterile token
sterile token
#

There you have

hardy swan
#

nah that's not what I want

#

or what I intend

vocal cloud
sterile token
hardy swan
#

not much difference in grander scale of things

proud forum
#

so what would be a good place to learn java?

#

youtube? or is there something better

sterile token
#

I learned from there

vocal cloud
#

Starting with the basics. Anyway that helps you learn tbh. Java is very different from Python because it's statically typed

#

Among other things

hardy swan
proud forum
#

i wish they taught java at my school, they teach javascript for websites i believe

#

but not plain java

vocal cloud
#

Javascript is to java what car is to cargo

quaint mantle
#

if they teach it, i would probably die instantly

hardy swan
#

Java is easy

#

No joke

proud forum
#

where would you go to learn if you didn't know the basics solar?

quasi patrol
#

The only coding language that I was taught at my school was HTML.

vocal cloud
# hardy swan Java is easy

Easy to learn hard to master. It's easy to write code that works it's hard to write good code that works

quaint mantle
hardy swan
sterile token
#

I was tought full basic website development which included Html, Css and Js

sterile token
vocal cloud
#

School taught me 1% of my knowledge base but that 1% fundamentals helped me learn the rest

proud forum
#

i will give this a try for a little bit, hopefully will resolve some of the issues im having. the problems i was having before was more of not fully knowing the bukkit api while now it is more of me not knowing basic java, would you agree?

hardy swan
vocal cloud
quasi patrol
hasty prawn
#

On my first day of Java class on Monday, my professor wrote

public static void main(String args[])
{ system.out.println("hello"); 
}

And then proceeded to name a class compute_Area1.

#

I was dying.

proud forum
#

so i assume me reading java docs will help read and learn the bukkit api faster than i can right now?

hardy swan
waxen plinth
#

"javascript but not plain java"

#

Misunderstanding of what js and java are

#

Javascript has no relation to java

waxen plinth
#

It was named that to ride java's coattails

buoyant viper
#

sometimes i gotta humble myself

#

?learnjava

undone axleBOT
sterile token
#

I dont know why many people thought that Java And JavaScript are the same

quasi patrol
hardy swan
#

The last link is the best, but not a lot of people can make it through

sterile token
#

And they are completele different, Java is typed and oriented to Object programming

quasi patrol
#

Did you guys learn Java before JavaScript, or JavaScript before Java?

vocal cloud
vocal cloud
buoyant viper
#

im not too sure ive actually made it through oracles official java page

quasi patrol
buoyant viper
#

in all like 7 years now

sterile token
waxen plinth
hasty prawn
#

Harsh words

buoyant viper
hardy swan
#

js is not awful, but ts is chef kiss

waxen plinth
#

Dynamic weak typing and sloppy design all over

vocal cloud
waxen plinth
#

TS is great

#

JS 👎

proud forum
#

man you guys are really nice about this stuff, i tried getting help at the papermc discord a couple days back and man they were rude about it, you guys are giving advice to help me get to my goals faster and i really appreciate it ❤️

waxen plinth
buoyant viper
#

Ts literaly just Js but yells at u

waxen plinth
#

Weed is pretty great and it's not a gateway drug

quasi patrol
vocal cloud
waxen plinth
#

Have you tried it?

young knoll
#

Man this train derailed quickly

waxen plinth
#

Yes it did lol

sterile token
#

JS is fucking yeath its really difficult to understand the sintaxis, sometime it doesnt have relation. I hate high level sintaxis programming languages. That why before Java i will learn C# and nothing else. Because no other language has such amazing sintaxis

waxen plinth
#

sintaxis

buoyant viper
#

yeath?

sterile token
#

For me yes

buoyant viper
sterile token
buoyant viper
#

what is the english equiv of "yeath" tho

waxen plinth
# vocal cloud No and yes

Marijuana is proven to not be a gateway drug, and regardless of your personal opinion of it it's shown to be useful medically and harmless recreationally

proud forum
#

thank you guys for guiding me the right way and not being rude about it, as a beginner to everything i really appreciate it :)

waxen plinth
#

The only problems I have with it are when people stink up public spaces with it

vocal cloud
hasty prawn
waxen plinth
#

I don't really see much of that

young knoll
waxen plinth
#

People drive drunk much more than they drive high from what I have seen

hasty prawn
#

Well sure, but you can't say that it just isn't a problem that it causes

#

Anyways this is definitely off topic LOL

hardy swan
#

help-brain-development

buoyant viper
#

ill just have 1 quick smoke sesh with friends no biggie

3 yrs later
buying xans from local dealer

sterile token
#

People any recommendation how i can search on google: How to get the jar output from maven proejct via MavenProject dependency

buoyant viper
#

jk

young knoll
#

I injected 1 weed and now I smoke graphing calculators

sterile token
buoyant viper
#

i injected one weed and now i write JAVA

young knoll
#

Oh shit

proud forum
#

bro what happened LOL

buoyant viper
#

weed

sterile token
hardy swan
#

Did i just misunderstood your question

vocal cloud
#

Yeah it's harmless though unless you read the studies 😉

hardy swan
#

No idk

sterile token
young knoll
#

If it's harmless until you read.... that means reading is the harm!

#

Reading kills people! Wake up America

hasty prawn
buoyant viper
#

ezpz

vocal cloud
young knoll
#

Lol

proud forum
#

i got high one time on a kayak trip and my friend was asking me to steer the kayak and apparently, i was so f-ed up that i said "what the hell is a kayak" while i was laying down in one

sterile token
young knoll
#

Lol?

vocal cloud
# buoyant viper it is harmless until u become dependent on it to function
Similar to animal models of chronic THC exposure, chronic cannabis use has been shown to blunt DA response to DA-releasing stimulant drugs in the striatum with both [11C]-(+)-PHNO and [11C]raclopride PET imaging (Volkow et al. 2014c; Bloomfield et al. 2016; van de Giessen et al. 2017) and to decrease DA synthesis as assess with PET imaging with [18F]DOPA (Bloomfield et al. 2014) (Fig. ​(Fig.2).2). This pattern of decreased stimulant-induced DA release is also seen with chronic use of other drugs of abuse such as alcohol, cocaine, and nicotine

Naw it's actually really bad all around

buoyant viper
#

what the fuck is a kilometer

#

🇺🇸

young knoll
#

Eh yo fuck you

#

How many feet are in a mile

buoyant viper
#

eh? what r ya? fuckin canadian?

hardy swan
#

Wtf is miles

buoyant viper
young knoll
#

Gross

young knoll
hasty prawn
#

Wait you're supposed to be nice

buoyant viper
#

how many feet are in a mile lioterally the only thing i remember from units of measurement

young knoll
#

I remember it because of a stupid meme

hardy swan
#

How scalable is the use of miles

#

Often used with quantifier? Kilo, giga?

buoyant viper
#

its pure shit i do not know how long a mile really is

vocal cloud
young knoll
buoyant viper
#

like if u asked me to walk a mile i would not know where to end

#

id probably walk half a mile and be like K done

sterile token
#

Any page where i can search a specific javadocs for a class via package.className?

buoyant viper
#

?jd

buoyant viper
#

wait u need maven not spigot

young knoll
#

Any javadoc lets you do that

sterile token
#

But for general java

buoyant viper
waxen plinth
#

Far more harmful things are legal, the main risk of marijuana use is for people whose brains have not yet fully developed

buoyant viper
sterile token
proud forum
#

day 1 of reading java docs

hardy swan
proud forum
#

wish me luck gusy 👍

young knoll
#

Lol

waxen plinth
#

🤔

vocal cloud
#

Man reading documentation is soulless

waxen plinth
#

I'd believe it these days

#

Nah documentation is great

proud forum
#

should i do something else instead?

vocal cloud
#

For someone to learn how to program?

proud forum
#

is there a better alternative?

waxen plinth
#

It's not like you should just read through the whole thing for funsies

#

The better alternative is reading through a programming book

hardy swan
proud forum
#

oh hell no never going to college

young knoll
#

I'm in college- Don't

#

It sucks

vocal cloud
#

Lots of courses out there are free for learning Java and they're interactive so you're actually doing it

waxen plinth
#

Reading the javadocs will teach you about the standard library but it won't necessarily make you a better programmer

sterile token
#

Artifact on maven = the output jar right?

proud forum
#

not dealing with student loans and debt

#

fuck that

waxen plinth
sterile token
sterile token
hardy swan
vocal cloud
young knoll
#

Lol, college hasn't even spoonfed me well

vocal cloud
hardy swan
#

Udemy is pretty good

#

But those are more generally for libraries

quasi patrol
#

So uh...

sterile token
#

Cuz im running a server for debbugging spigot plugins without getting out from Intellij Idea. But i couldnt find a solution of exporting a my maven project jar directly the debug server. So i decide to code my own maven plugin for copying the artifact jar to my debug server

#

hahaha

hasty prawn
#

College hasn't spoonfed me either, last semester one of my first assignments had a trick question

proud forum
hardy swan
#

I think the biggest takeaways from college are things you wont know you need to learn outside like algorithms and data structures

#

And what most typical online course wont teach you

proud forum
#

14 dollars.... its tempting

vocal cloud
#

Yeeeesh Saying a lot while saying nothing at all

proud forum
vocal cloud
#

caveat emptor

#

I'd try something free first to see if it's for you. Buy if you feel the groove

proud forum
#

good point

vocal cloud
#

Those "sales" are always on to make you feel pressured to buy

proud forum
#

yeah i was wondering why a course priced at 84.99 would be that low of a price

sterile token
#

I am about to complete my first year in a computer-oriented institute. And there they don't teach you any specific language. They teach you the basic fundamentals, structures (Tree, etc). And many other things. In conclusion, nowhere do they teach you to program, you learn that by yourself

quasi patrol
#

So did yall forget about me or?

hardy swan
#

Hi

vocal cloud
vocal cloud
proud forum
#

oh

#

i did not know i had pro for sololearn

#

i think i forgot about a free trial LOL

buoyant viper
#

only platform i ever used to practice code was uhhhh

#

codekata or something

#

codewars?

quasi patrol
buoyant viper
#

codewars

hardy swan
#

codeforces

buoyant viper
#

when and why did i do fucking kotlin on codewars

vocal cloud
buoyant viper
#

i think he was using JDA

#

dunno if his code is still somewhere but his webhook was wrapped in like

#

a DiscordWebhook class

proud forum
#

WTF

#

I DID A CODEWARS THING and i got it right

#

it was missing a semi colon

buoyant viper
#

oh it isnt jda

#

hmm

#

wats that from

#

or is it urs

vocal cloud
#

Just use JDA

quasi patrol
sterile token
#

I will spoof ping the code

buoyant viper
quasi patrol
# sterile token Send how you don the request
Date date = new Date();
                SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy");
                String str = formatter.format(date);
                String reason = String.join(" ", temp);
                DiscordWebhook webhook = new DiscordWebhook(url);
                webhook.setUsername("Reports");
                webhook.setAvatarUrl("https://cdn.discordapp.com/avatars/686346249183690769/39490b1b0a67e892256b46fa57af29c9.webp?size=80");
                webhook.addEmbed(new DiscordWebhook.EmbedObject().setTitle("New Report [" + reportcount + "]").setDescription("Reporter: ``" + player.getName() + "``\nPlayer: ``" + reported.getName() + "``\nReason: " + reason).setFooter("Submitted \u2022 " + str, "").setColor(new Color(0,0,0)));
                try {
                    webhook.execute();
                }
                catch(java.io.IOException e) {
                    e.printStackTrace();
                }```
sterile token
#

Right

quasi patrol
#

The functions come from the Github I sent above.

buoyant viper
#

created 5 years ago,,, that might have something to do with it

#

tell me u dont know how to use java http without telling me u dont know how to use java http

vocal cloud
#

Well a 400 error is usually improper request which if you're using a lib means the lib might be a bit old

quasi patrol
#

😆

buoyant viper
#

jk its fucking aids trying to use it before java 11

#

HttpClient was a godsend

vocal cloud
#

OkHttp

#

Freakin no external emotes

buoyant viper
young knoll
#

boost

buoyant viper
#

if i can do it without a library haha why not?

buoyant viper
young knoll
vocal cloud
buoyant viper
#

whats the fun in using protection?

vocal cloud
#

My girl wants the kid so 🤷‍♂️

#

But I don't want any more kids from Java yknow

#

Kotlin is already well Kotlin

maiden thicket
#

how would I get the ServerboundInteractPacket.Action from the packet when i intercept it? i'm trying to check whether the hand is the main or off hand

quasi patrol
buoyant viper
#

u can add it as a dependency probably

quasi patrol
#

Yah I already found it. .-.

sterile token
#

Wait me please

sterile token
vocal cloud
#

Alright I can't stand not having external emotes.

young knoll
vocal cloud
quasi patrol
vocal cloud
#

Whatever the latest is is probably best

quasi patrol
vocal cloud
#

Yeah but that's dangerous if an update comes and breaks everything.

buoyant viper
#

be me, use '+'

vocal cloud
#

I would use the version they recommend tbh

#

0.7.5 is latest so

sterile token
# quasi patrol Yah I already found it. .-.
Example 1:

public Future<Void> postWebhook(WebHook webhook) {
  return Executors.newCachedThreadPool().submit(() -> webhook.execute()).get();
}

Example 2:

public CompletableFuture<Void> postWebhook(WebHook webhook) {
  return CompletableFuture.supplyAsync(() -> webhook.execute()).get();
}
#

There you have

quasi patrol
#

Well either I imported incorrectly, or it broken?

vocal cloud
#

Why not use the built in scheduler?

quasi patrol
sterile token
#

But if you can use with whatever you want

quasi patrol
#

@buoyant viper I am confused on how I set the title for this library.

buoyant viper
#

idk

quasi patrol
#

Cause it ain't a string even though description is. .-.

vocal cloud
#

Is it a component of sorts?

#

JDA loves their components

quasi patrol
#

Brain still spaghetti.

vocal cloud
#

Mmmmmm spaghetti

quasi patrol
young knoll
#

Brain is always spaghetti

vocal cloud
#

I'm like a zombie except I feed on peoples inability to read documentation

quasi patrol
#

It is saying EmbedTitle​(@NotNull String text, @Nullable String url) in the docs, but it is saying the second argument cannot be string in the IDE.

vocal cloud
#

ctrl+b

quasi patrol
#

On what?

vocal cloud
#

On the EmbedTitle

#

Show the raw constructor

quasi patrol
#
            this.text = Objects.requireNonNull(text);
            this.url = url;
        }```
vocal cloud
#

So it does take in a string and a string then?

#

Whats your code

quasi patrol
# vocal cloud Whats your code
                WebhookEmbed embed = new WebhookEmbedBuilder()
                        .setColor(0xFF00EE)
                        .setTitle(new WebhookEmbed.EmbedTitle("E"));
                        .setDescription("Hello World")
                        .build();```
vocal cloud
#

Ummm why is there a semi after settitle?

quasi patrol
#

Shh.

vocal cloud
#

and you're missing an argument for the EmbedTitle constructor

#
        WebhookEmbed embed = new WebhookEmbedBuilder()
                .setColor(0xFF00EE)
                .setTitle(new WebhookEmbed.EmbedTitle("E","https://readthedocs.io"))
                .setDescription("Hello World")
                .build();
quasi patrol
#

The ; was the one that caused the problem lol.

vocal cloud
#

indeed

#

It's okay we've all been there

quasi patrol
#

XD.

#

What do you do when you encounter the least helpful documentation in the word? (Not this doc ofc some other doc I attempted to deal with a month ago).

young knoll
#

Cry

vocal cloud
#

I use ctrl+b and figure it out for myself. Or I stop using the garbo lib in the first place

waxen plinth
#

I need help with api design

#

I have my config library which currently can map objects to and from config

#

But it doesn't do polymorphism

#

I'm making it do polymorphism, so it will be able to serialize subclasses of mappable types

vocal cloud
#

Is this a custom config or yml or?

waxen plinth
#

Currently, to denote that a type may be mapped to config, it requires the @ConfigMappable annotation

#

Should I require this annotation for the subclasses too, to make it very explicit?

#

Or should it be inherited for simplicity?

buoyant viper
#

time to make myself cry by seeing solutions for a code challenge and comparing them to mine

vocal cloud
#

No. Java, for example, has the Serializable class which indicates a class that can be converted into some sort of storable data and back. You could make an interface to declare something as being storable

quasi patrol
#

I just have 1 simple question. How can I make it so the offline player type, and the regular player type can be in the same variable?

waxen plinth
#

Unhelpful

waxen plinth
#

Player extends OfflinePlayer

buoyant viper
#

this is cursed

#

never saw someone that didnt put something after the decimal

quasi patrol
#

Wait.

buoyant viper
#

no question is inherently dumb

quasi patrol
#

.-.

buoyant viper
#

but yeah its like what redempt said store it as an OfflinePlayer

#

so like OfflinePlayer thePlayer = (ur player)

quasi patrol
#

Ye Ik that part.

vocal cloud
buoyant viper
#

u can use thePlayer like u would a player (for the most part)

quasi patrol
#

OfflinePlayer supports online players?

buoyant viper
#

Player extends OfflinePlayer

#

but to use methods from Player you will need to 1. ensure thePlayer is originally of type Player, and 2. cast thePlayer to Player

#

so like java if (thePlayer instanceof Player player) { player.doStuff(); }

young knoll
buoyant viper
#

neither did I

#

i hate doing codewar challenges bc some of the solutions make me question 1. my sanity, and 2. my knowledge of the language im using

young knoll
#

Lol

#

At least it gives you a chance to learn

buoyant viper
#

but god is it rewarding to get one right

#

yeah

quasi patrol
#

So OfflinePlayer supports online players and don't have to do anything fancy except detect if the instance is Player?

young knoll
#

Yes

buoyant viper
#

yeah

quasi patrol
#

Dang I wish I knew this lol.

young knoll
#

Woo subtypes

buoyant viper
#

wouldntve known if u hadnt asked

vocal cloud
young knoll
#

Sadly the API for offline player is fairly limited

hardy swan
#

bad naming

buoyant viper
#

not terrible

hardy swan
#

OfflinePlayer -> Player
Player -> OnlinePlayer

young knoll
#

I’d love to add ways to access their inventory and such when offline

buoyant viper
#

hmm

quasi patrol
young knoll
#

But that’d require loading data from a file, and idk how I’d organize that

buoyant viper
#

load fake copy of their player into world ezpz

vocal cloud
#

I mean just do it on join.

young knoll
#

No no

quasi patrol
#

I get kind of upset when a plugin doesn't support offline players for the placeholders cause I have to go hook into the API and all that and makes my job harder lol.

young knoll
#

In the spigot API itself

vocal cloud
blazing rune
#

Hello

buoyant viper
#

he wants to manipulate an offline inventory

#

oh i see what ur suggesting

blazing rune
#

I've been trying to give players perms without using a perm plugin

#

Anyone care to help?

young knoll
#

Use vault

vocal cloud
vocal cloud
young knoll
#

But then it isn’t for an offline player

vocal cloud
blazing rune
#

K

buoyant viper
#

if they never join the server again then rip modifying inv

young knoll
#

Meh

#

No reason to wait for them to join, you can load their data with them offline

vocal cloud
young knoll
#

But that would be blocking, so I don’t know how I would expose that nicely in the API

buoyant viper
#

async load and have a completablefuture for when its ready?

#

idk

young knoll
#

Yeah that would work well

#

Not sure how MD would feel about introducing futures into the API though

blazing rune
# vocal cloud Send us the code that's having the issue.

@SuppressWarnings("deprecation")
@EventHandler
public void onPlayerJoinAgain(PlayerJoinEvent e) {
Player p = e.getPlayer();
if (p.hasPermission("tdkmembers.moderator")) {
moderator.getTeam("moderator").addPlayer(p);
}else if (p.isOp()) {
admin.getTeam("admin").addPlayer(p);
}
}

public void thisHealthBar() {
    if (moderator.getObjective("health") != null) {
        moderator.getObjective("health").unregister();
    }
    Objective obj = moderator.registerNewObjective("health", "health");

    obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
    obj.setDisplayName(ChatColor.RED + "/20");
}

public void thisTag() {
    if (moderator.getTeam("moderator") != null) {
        moderator.getTeam("moderator").unregister();
    }
    Team t = moderator.registerNewTeam("moderator");
    
    t.setPrefix(ChatColor.DARK_GREEN + ""+ ChatColor.BOLD + "MODERATOR §8» " + ChatColor.WHITE);
}
buoyant viper
#

lets add it to piping

#

piping-players

undone axleBOT
blazing rune
#

I'm trynna give perms

young knoll
#

I would use the vault API to give perms

buoyant viper
#

groupmanager 4 life

young knoll
#

Maybe I’ll open an issue about it on stash to get a bit of input from MD

blazing rune
young knoll
#

Save it and send the link

vocal cloud
#

Yeah then send the link to it

blazing rune
#

Oh-

buoyant viper
#

hit ctrl+s or the save button on the page

#

and then send url

blazing rune
vocal cloud
#

0.o it sees it as java. It's a miracle lul

buoyant viper
#

lol

blazing rune
vocal cloud
#

It's an inside joke dw about it

blazing rune
#

Ok

hardy swan
#

it always recognise it as other weird languages

buoyant viper
#

those language identifiers paste services use normally cant detect crap

vocal cloud
#

md-5s paste has some issues with code recognition

blazing rune
#

O

hardy swan
#

hastebin in general

buoyant viper
#

its a hastebin thing in general

worldly cedar
#

I want to help with two-factor authentication problem, I changed my phone but Spigot login requires me to use two-factor authentication

young knoll
#

?support

undone axleBOT
young knoll
#

Do you have your backup codes

vocal cloud
buoyant viper
#

this is why we save recovery codes or temporarily turn off 2FA and then turn it back on when u get new device

hardy swan
#

Authy apps are great

buoyant viper
#

i prefer non-syncing 2fa

hardy swan
#

idek my password no more

quasi patrol
#

"Yay." My favorite! Errors. ;-;

worldly cedar
young knoll
#

Then you’ll need to email support

buoyant viper
blazing rune
young knoll
#

Again, I would advise the vault API

blazing rune
young knoll
#

Pretty much

#

Either that or you hook each permission plugin individually

buoyant viper
#

best option would just be to use a permissions plugin like LP AiSmug

quasi patrol
buoyant viper
#

u didnt shade webhooks in

young knoll
#

Did ya forget to shade

quasi patrol
#

Uh...

vocal cloud
#

Sometimes it's hard to remember to step into the shade hes_UwU

hardy swan
#

?

young knoll
#

You can also use the library feature since you are on 1.17

#

Assuming the resource is on maven central

buoyant viper
#

it is

hardy swan
#

just enforce download vault jar

#

ez

buoyant viper
#

grrr no cross platform 2fa app besides gauth or authy and i dont want to use either of them

quasi patrol
young knoll
#

I would advise the library feature then

#

Unless you feel like learning about shading

vocal cloud
quasi patrol
#

D:

hardy swan
#

i use authy for heroku too

quasi patrol
#

So, what do I do? .-.

young knoll
#

Do you want to shade or library

hardy swan
#

you wanna use vault api?

#

XD

quasi patrol
vocal cloud
#

Shade you must. Become wiser you will

quasi patrol
#

Ik.

buoyant viper
#

authy closed source

#

closed source no bueno

quasi patrol
#

So, what is shade?

hardy swan
#

shade you don't, download jar you enforce

young knoll
#

Shading

vocal cloud
young knoll
#

(1st comment)

hardy swan
#

what is the gradle equivalent

#

oh shadow

young knoll
quasi patrol
#

I need shadow then cause I use gradle. .-.

vocal cloud
#

Mannnn just use maven

hardy swan
#

i just solved your problem unintentionally

quasi patrol
#

XD.

young knoll
buoyant viper
#

shadow plugin or write ur own mini-shadow with configurations {} and jar {}

young knoll
#

That’s the user guide for shadowjar

quasi patrol
#

Hippity hoppity, my brain is no longer my property.

hardy swan
#

why not

young knoll
#

It’s mine now

buoyant viper
#

i solte it

hardy swan
#

use as library

quasi patrol
young knoll
#

I gain knowledge by consuming smart peoples brains

vocal cloud
hardy swan
#

Coll implements Consumer<Brain>

young knoll
#

Exactly

quaint mantle
#

any idea anyone? is there a way

buoyant viper
#

be me peepoCoolSunglasses

hardy swan
young knoll
buoyant viper
#

in contrast i should just use shadow plugin in case i ever need to use relocate

vocal cloud
#

Whattttt you don't enjoy the 30+ lines needed to shade in maven

blazing rune
#

Ah I also have another question

#

How do you make a tempban command

young knoll
#

You should always relocate with plugins

quasi patrol
buoyant viper
#

nahhhh

#

if another plugin conflicts, thats their fault

hardy swan
#

resource plugin best

buoyant viper
#

dont use the same libraries i use

young knoll
#

Ah you right

quasi patrol
#

Yo, can you change a plugin from gradle to maven after it has already been made?

buoyant viper
#

yeah

young knoll
#

Ye

quasi patrol
#

How?

vocal cloud
#

By not using gradle in the first place

quasi patrol
#

-.-

buoyant viper
hardy swan
#

i only know pom.xml -> gradle

#

never heard of reverse

young knoll
#

I’d rather not look at massive XML files

hardy swan
#

xml is pretty hot

buoyant viper
#

i write HTML, i dont need MORE of that kind of shit

young knoll
#

I’ve seen XML files that are thousands of lines long

#

The horror

hardy swan
#

i cant groovy

vocal cloud
buoyant viper
#

exactly

#

its never my fault something doesnt work as intended

young knoll
vocal cloud
buoyant viper
young knoll
#

Why are you like this

buoyant viper
#

dont ask me to use SBT tho, idk how

hardy swan
#

I can mathematica

quaint mantle
vocal cloud
#

Jython sound smore like a dance than a programming language

hardy swan
#

Ever heard of 6th generation language

vocal cloud
buoyant viper
#

lool

quasi patrol
#

Ok, I changed to maven. You guys happy now?

hardy swan
#

most are not even languages, other then the pokemons

hardy swan
young knoll
#

Ditto, sawk, vulpix, feebas, onyx, ekans, metapod

#

Do I get a cookie

buoyant viper
#

wtf is neo4j, the matrix?

hardy swan
#

dms

young knoll
#

Log4j but matrix

vocal cloud
young knoll
#

I saw that

#

You can’t hide the programmer socks

quaint mantle
#

🧦

buoyant viper
#

🧦

vocal cloud
buoyant viper
#

so like

#

how do plugins made in kotlin export

#

do they shadow & relocate the kotlin runtime?

young knoll
#

They shade it

#

Idk if they can relocate it

buoyant viper
#

so if u have multiple kotlin plugins..

vocal cloud
#

Yeah I've had to deal with that

quasi patrol
#

Do I just made the build thing into this: ```<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>

            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <createDependencyReducedPom>false</createDependencyReducedPom>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>```?
buoyant viper
#

why is it there twice

vocal cloud
#
            <exclusions>
                <exclusion>
                    <groupId>org.jetbrains.kotlin</groupId>
                    <artifactId>kotlin-stdlib</artifactId>
                </exclusion>
            </exclusions>
#

from every lib cause I couldnt find the offender

buoyant viper
#

yeah but if another plugin also uses kotlin

#

wtf do u do lol

quasi patrol
vocal cloud
#

Oh it can ruin your day that's for sure

quasi patrol
#

Anyways, what do I do now?

buoyant viper
#

idk i use gradle

young knoll
#

You’ve already answered this

quasi patrol
young knoll
vocal cloud
#

Probably exclude it from your compile and use theirs I imagine

buoyant viper
#

bleh, this is why i dont use other JVM langs unless its a standalone project

#

conflicting runtimes is not something i want to have to deal with

young knoll
#

But do you actually use scala

buoyant viper
#

yes

young knoll
#

You are

#

A special one

buoyant viper
#

god.

young knoll
#

Uhh

#

Sure

buoyant viper
#

the runtimes only a few MB larger than kotlin its fine

young knoll
#

God my head hurts

#

I choose to blame you lot

buoyant viper
#

kotlin adds what like ~2MB? scala adds like ~6MB

vocal cloud
#

Kotlin was a bunch of veteran java nerds working for jetbrains who wanted to fix everything they thought was wrong with java and they made kotlin which is basically java but python edition

quasi patrol
#

So uh, what do I do after I have my build thing like this? m <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <createDependencyReducedPom>false</createDependencyReducedPom> </configuration> </execution> </executions> </plugin> </plugins> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </build>

buoyant viper
#

i feel like u dont need to specify the resources folder unless mavens weird

vocal cloud
#

I wonder if someone at JB HQ said it as a joke "we should make a better JVM language" and then they did

quaint mantle
#

then just click the button

#

on the top right i think

buoyant viper
quaint mantle
#

the green thing

vocal cloud
buoyant viper
#

but we already had perfection

#

but now we have kotlin

#

the language for coomers

vocal cloud
#

You're thinking of python

buoyant viper
#

who want to write Java but dont want to deal with its bullshit and dont want to learn the superior Scala

maiden thicket
#

how do i check in the serverboundinteractpacket which hand it is using?

vocal cloud
#

Alright I can't english anymore I'm going to bed. I'll be up tomorrow to help people for a few hours then devolve into useless banter

worldly cedar
#

I need help, my Spigot account needs a second verification, but I lost my backup code, I got a new phone, so I don't know how to verify it..., it's very annoying

buoyant viper
#

we literally told u to contact support

#

?support

undone axleBOT
worldly cedar
#

ok, sorry just didn't see any news, thank you

buoyant viper
#

np

analog prairie
#
[14:53:34] [Timer-15/WARN]: Exception in thread "Timer-15" java.lang.IllegalStateException: Asynchronous player kick!
[14:53:34] [Timer-15/WARN]:     at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:14)
[14:53:34] [Timer-15/WARN]:     at org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer.kickPlayer(CraftPlayer.java:346)
[14:53:34] [Timer-15/WARN]:     at handler.player.check(player.java:43)
[14:53:34] [Timer-15/WARN]:     at handler.timer.run(timer.java:9)
[14:53:34] [Timer-15/WARN]:     at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
[14:53:34] [Timer-15/WARN]:     at java.base/java.util.TimerThread.run(Timer.java:516)
#
Bukkit.getPlayer(PostData.get("addition").getAsJsonObject().get("name").getAsString()).kickPlayer(MessageFormat.format(ChatColor.AQUA+"\u96f2\u7aef\u9632\u8b77\u7cfb\u7d71\n"+ChatColor.RED+"\u5c01\u7981\u539f\u56e0 >> {0}\n"+ChatColor.GOLD+"\u5c01\u7981\u6642\u9593 >> \u6c38\u4e45",decode.Decode(jsonObject.get("reason").getAsInt())));
#

Is this Async?

worldly ingot
#

lmao what in the absolute fuck is that

#

but that snippet alone doesn't tell the full story. You're probably doing it in an event that was called async or in an async task

midnight quarry
#

when I try to get a player head with the player's skin on it using SkullMeta, the server faces a TPS loss

#

is there any solution to this?

#

I searched on the forums and it seems the lag is very common

vital leaf
#

it's very common for lag to occur

midnight quarry
#

hmm

#

then I think I should cache it

vital leaf
#

probably

midnight quarry
#

but it seems that the head loading process occurs in main thread

#

can I get it off the main thread

analog prairie
midnight quarry
#

just had to run the task async

worn tundra
#

In your case, apparently, kicking a player

analog prairie
# worn tundra Encase the thing you're doing in that event into a bukkit runnable
Bukkit.getScheduler().runTask(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("ExpTech_BanSystem")), Objects.requireNonNull(kick(PostData.get("addition").getAsJsonObject().get("name").getAsString(), MessageFormat.format(ChatColor.AQUA + "\u96f2\u7aef\u9632\u8b77\u7cfb\u7d71\n" + ChatColor.RED + "\u5c01\u7981\u539f\u56e0 >> {0}\n" + ChatColor.GOLD + "\u5c01\u7981\u6642\u9593 >> \u6c38\u4e45", decode.Decode(jsonObject.get("reason").getAsInt())))));
#
public static BukkitRunnable kick(String name, String reason){
            Objects.requireNonNull(Bukkit.getPlayer(name)).kickPlayer(reason);
        return null;
    }
#

Still error

worn tundra
#

What error

#

what line

analog prairie
# worn tundra What error
[15:37:47] [Timer-23/WARN]: Exception in thread "Timer-23" java.lang.IllegalStateException: Asynchronous player kick!
[15:37:47] [Timer-23/WARN]:     at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:14)
[15:37:47] [Timer-23/WARN]:     at org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer.kickPlayer(CraftPlayer.java:346)
[15:37:47] [Timer-23/WARN]:     at handler.player.kick(player.java:56)
[15:37:47] [Timer-23/WARN]:     at handler.player.check(player.java:46)
[15:37:47] [Timer-23/WARN]:     at handler.timer.run(timer.java:9)
[15:37:47] [Timer-23/WARN]:     at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
[15:37:47] [Timer-23/WARN]:     at java.base/java.util.TimerThread.run(Timer.java:516)
#

Still Async

granite burrow
#

how can I get a GUI title from Inventory data type

worn tundra
midnight quarry
#

if you listen to InventoryClickEvent

#

you can get it by InventoryClickEvent#getView().getTitle()

analog prairie
#

?paste

undone axleBOT
granite burrow
#

alr, dam ill set it up diffrently then

worn tundra
#

What the hell

#

Sorry

#

I mean

#

There must be a better, cleaner way to do all that

#

Your method "kick" is returning null, when you supposedly intended it to return a BukkitRunnable

#

Oh wait yeah, was just confused by the code

analog prairie
#

?

worn tundra
#

Are you sure you're compiling it right?

#

The plugin is getting updated?

analog prairie
analog prairie
worn tundra
#

Can you show handler.timer.run?

analog prairie
# worn tundra Can you show handler.timer.run?
package handler;

import java.util.Timer;
import java.util.TimerTask;

public class timer extends TimerTask {

    public void run() {
        player.check();
    }

    public static void main() {
        Timer timer = new Timer();
        timer.schedule(new timer(), 1000, 10000);
    }

}
hollow beacon
#

just run it on the main thread?

stone sinew
hybrid ledge
#

I have found my code from 8 years ago. Why learning OOP when you can HashMap, right? uwu

#

(everything was inside class Main)

drowsy helm
#

my eyes

young knoll
#

They are all concurrent too

hybrid ledge
#

Yeah, there is no optionals/futures anywhere... so I just created callback hell and accessed hashmaps everywhere. lol

#

Best is countdown - instead of saving target datetime, I saved amount of seconds till target time and scheduled task which decreases by 1 every second. 🤡
I had so much fun reading this

hardy swan
#

did you only have one java file

hybrid ledge
#

Nope I had listeners and commands classes, at least something.

hardy swan
#

i mean, they can be inner classes

hybrid ledge
#

If I had known, I would probably made them inner that time 🙂

hardy swan
#

or .java can have many non-public classes anyways

hybrid ledge
#

This is why I love programming, you see how you progress through life and you have unlimited ways, how to approach something and reach your goal.

young knoll
#

Don’t encourage them

hardy swan
#

it is true, idek why that's allowed

hollow beacon
quaint mantle
#

LOL

maiden thicket
#

getting this on 1.18.1

maiden thicket
#

doing a setCustomName btw

limber dust
#

well the error states it all

spiral light
solid cargo
#

why dafaq isnt my placed blocks listener increasing by one?
This is the way i try to increase my placed blocks in the config.yml

maiden thicket
spiral light
quaint berry
#

Quick question...
When you craft an item and it gives you the item, where would the script be located?
Would it be in the Event class, command class or main class?

#

Please help

young knoll
#

What?

quaint berry
#

Where would the script be located?

chrome beacon
#

The prepare event? Or are you talking about when they actually craft

quaint berry
#

When they actually craft

young knoll
#

Well CraftItemEvent is an event

#

So is the prepare one

quaint berry
#

Oh thanks

maiden thicket
spiral light
#

only problem is some more expense and sadly name based and not uuid based feature

young knoll
#

It’s still weird that scoreboards aren’t UUID based

spiral light
#

and they wont change it ^^

young knoll
#

Eh

#

They might

spiral light
young knoll
#

Dangit mojang

#

It’s not like it would hurt to have UUIDs work

quaint berry
#

Uughhh I can't find it

young knoll
#

Can’t find what

chrome beacon
#

The event I assume

young knoll
#

CraftItemEvent

#

Your ide should handle the import from there

quaint berry
#

On snowgears grapple plugin, I want to add a custom model data tag but I cant find the part of the recipes

#

Where I can add it

young knoll
#

Find where they register the recipes

#

Bukkit.addRecipe

quaint berry
#

I'm trying that

#

Ok

#

It's still not there?

#

Whhat?

#

Bukkit.addRecipe(recipe); ++loadedCount;

chrome beacon
#

Did you forget to import spigot

quaint berry
#

Does this shorten it?

quaint berry
#

I'm just editing it

young knoll
#

Yes that is the recipe being added

#

Modify the item passed to the recipe constructor

quaint berry
chrome beacon
#

There is a result item. Add the model data tag to it

#

.setModelData or smth like that

young knoll
#

ItemMeta#setCustomModelData

chrome beacon
#

Ah

quaint berry
#

Could I just send you a paste bin because this is going right over my head

#

?paste

undone axleBOT
quaint berry
#

I swear it's not there

chrome beacon
#

So quick question do you know java

quaint berry
#

Yes

#

But I haven't got round to recipes

lost matrix
#

while(true) { <- PES_Cry

chrome beacon
young knoll
#

I see hookItemMeta

#

You can add the data to that

chrome beacon
#

^ use that

lost matrix
quaint berry
#

The jar file

chrome beacon
#

Wait it's open souece

quaint berry
#

Yeah

chrome beacon
#

No need to decompile it

quaint berry
young knoll
#

Me thinks you should get someone to do this for you

quaint berry
chrome beacon
#

?services You could put a request here

undone axleBOT
quaint berry
#

How long do you think this would this take until it's found and edited by who every is willing to try this hell hole

#

Nvm

#

Oh I cant

#

I don't have enough posts and time

#

Oof

chrome beacon
quaint berry
#

But I'm stupid and I want a different model id for each different grapple gun

chrome beacon
#

That would require more work

young knoll
#

Shame the plugin doesn’t support that already

quaint berry
#

Nevermind

#

Well sorry for harassing you guys (or girls)

static ingot
#

Anybody familiar with ACF able to tell me why context.hasFlag("selected") doesn't return true for an argument annotated @Flags("selected=VALUE")?

#

Am I using the wrong method?

jagged monolith
#

Why would I be getting this error? https://paste.md-5.net/gukerutabi.sql

Code: https://i.imgur.com/rKlErzi.png

Note: The message is getting set to "" because it's getting changed in the setMessage. I am also changing it all to %% as i thought that would help fix it, but didn't. I have also tried printing out the message a few times, and the format works fine, it does show the prefixes etc.. when the user has prefixes of course, but even with defaultchatformat the error still shows. (ping when replying)

spiral light
#

i will make a guess and say tablist is sorted by name ?

young knoll
#

Alphabetically

spiral light
#

hmm

young knoll
#

You can mess with it by using color codes

#

And teams iirc

spiral light
#

yeah and again mojang missed to support custom stuff easy with uuid

young knoll
#

How would that help

#

Sorting by uuid would be weird

spiral light
#

sorting by uuid ^^

#

not if you define uuid based on position ^^

eternal oxide
jagged monolith
#

It can't be though, because if I add a debug message that returns the string from applyFormat method, it returns it fine. it has to be something with the setFormat method

eternal oxide
#

the error is saying its empty

#

oh no its not

jagged monolith
#

It can't be empty as i'm able to get the string from the applyformat method, when using a debug message placed just above the appyFormat method

eternal oxide
#

can you show the returned format string, before parsing?

jagged monolith
#

Sure, give me a sec to startup server again 😛

eternal oxide
#

also after passing it through yoru applyFormat

jagged monolith
eternal oxide
#

it can;t understand % space is my guess

jagged monolith
#

This is, the %1$s should be getting converted to the playername

eternal oxide
#

it expecting something after the %

jagged monolith
#

So the issue, must be with the configFormat string then, with the .replace methods

eternal oxide
#

the resultign string you get after all yoru replace is broken

eternal oxide
#

you have a % on its own which is erroring when it gets to be parsed by bukkit

#

you are removing the message in teh format?

jagged monolith
#

Because it's getting set in the setMessage.

#

Which is how md says you're suppose to be doing it

eternal oxide
#

message and format are seperate

#

teh format tells the parser where to put the message

#

like "blah blah, message"

#

you don;t actually put the message in there, but if memory serves you haev to tell it when to add it

jagged monolith
#

%1$s Should be the player name
%2$s should be the message.

Then they should get replaced by the setFormat to the actual values

copper scaffold
#

What was the list where nothing can be double like i hast 3 times my name in a list i want it only one time

spiral light
#

why do you can add it 3 times is the question

jagged monolith
copper scaffold
eternal oxide
#

sysout the value of configFormat

spiral light
jagged monolith
young knoll
#

Sets do not allow duplicates

copper scaffold
#

how can i make a set

eternal oxide
jagged monolith
#

Neither do I...

spiral light
shadow night
#

I'm not sure

#

how to check if the player is on the server or not

#

and if the first argument is passed

icy beacon
#

Bukkit.getPlayer(name)

#

if is null then is not online

shadow night
#

and if I do args[0].equals("") would it return true if theres no args[0]?

icy beacon
#

ideally check for args length as well

#

not sure but i think it will throw arrayindexoutofbounds

#

so check if arrays length is 1 or whatever one you want

shadow night
#

<=*

icy beacon
#

can't be lower than 0, just check for 0

shadow night
#

ok

shadow night
icy beacon
#

nice

lost matrix
icy beacon
#

i thought that was obvious?

lost matrix
#

His question implies that it was not

icy beacon
lost matrix
icy beacon
#

possibly, though if args[0] is not present, then checking if it is equal to "" is still technically checking for null equality

#

it's getting confusing because my phrasing skills are bad

shadow night
#

it just gives me level 101 eh

lost matrix
shadow night
#

it should give me effects from level 0 (no effect) to level 11 but why is it giving me level 101

lost matrix
#

0 is not no effect but an effect with no amplification (Tier 0)

simple cloud
#

Hey, I got a question about cancelling damage events; If I disable player attacks against tamed wolves so that they don't attack my friends, should I cancel the damage event or set the damage to 0 or both?

young knoll
#

For a potion 0 is level 1

#

Because 0-indexed

simple cloud
#

what does damage 0 do?

lost matrix
shadow night
young knoll
#

If you just set the damage they will still get knockback

simple cloud
#

ive seen a similar plugin do both

young knoll
#

And doing both is pointless

simple cloud
#
public class HeckListener implements Listener {
    @EventHandler
    public void onAttack(EntityDamageByEntityEvent e) {
        Entity entity = e.getEntity();
        Entity damager = e.getDamager();
        if (entity instanceof Tameable) {
            if (damager instanceof Projectile) {
                damager = (Entity) ((Projectile) damager).getShooter();
            }
            Tameable pet = (Tameable) entity;
            if (pet.isTamed() && damager instanceof Player) {
                e.setDamage(0);
                e.setCancelled(true);
            }
        }
    }
}
#

heres what i currently have

#

i found it funny that the arrows bounced striaght back at me when i shot the wolve

lost matrix
simple cloud
#

is setting the damage to 0 unnecessary here?

icy beacon
#

hecklistener

young knoll
shadow night
simple cloud
#

and thats a result of cancelling the projectile?

young knoll
#

The damage

#

Yes

simple cloud
#

sorry yeah the damage event

young knoll
#

You can remove the projectile if you don’t want that

simple cloud
#

maybe i should just trash the projectile?

simple cloud
#

how can i check what else is counted as a projectile?

#

cuz idk what other projectiles a player can attack a tamed pet with

young knoll
#

Damager instanceof Projectile

shadow night
# shadow night oof

it doesn't happens with positive effects. Seems like my arrays have something to do with it?

simple cloud
#
            if (damager instanceof Projectile) {
                Projectile proj = (Projectile) damager;
                damager = (Entity) proj.getShooter();
                proj.remove();
            }
#

so this should remove the projectile?

young knoll
#

That’ll remove the shooter

#

Or throw an error if the shooter is a dispenser

lost matrix
# shadow night I don't see it

Some more comments on your code:

  1. If you want a random binary outcome then you should use ThreadLocalRandom#nextBoolean() instead of checking for 0 vs 1.
  2. You should rename your variables and give them more meaningful names like "potionTier" instead of "rng2" or "potionIndex" instead of "rng"
simple cloud
young knoll
#

Oh wait I’m blind

#

Yes that’ll remove the projectile

shadow night
simple cloud
#

dw all good, this is my first time with this stuff so i couldnt tell any better

young knoll
simple cloud
#

oh?

#

because a dispenser isnt an entity?

young knoll
#

You can’t just cast the shooter to an entity

#

Correct

simple cloud
#

hm

young knoll
#

Check if the shooter is instanceof Entity first

simple cloud
#

try catch?

#

oh ok

#

sure

#

oh god im getting too many if statements

#

i dont like this

lost matrix
#

Probably because its expected to be in gzip fromat. Try to search for methods that specify the file extension when importing.

shadow night
lost matrix
simple cloud
#

hm gotta remember how java switches work

young knoll
#

Switch doesn’t really work here

simple cloud
#

if (damager instanceof Projectile && ((Projectile) damager).getShooter() instanceof Player) this is what i have currently

#

after adding that check

young knoll
#

Well actually you can switch on variable type in java 17 can’t you

simple cloud
#

only three if statements but still

#

maybe i negate them all and make them early returns

quaint mantle
#

I have made Spigot Jar using buildtools, now there are two folders Spigot-API and Spigot-Server API has 1 jar in it, Server has 3, which one should I use if I want to use NMS

young knoll
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

glossy venture
#

is there a way to add items to a shulker box ItemStack

simple cloud
#

by the way, could anyone explain the priority for event handler? is normal fine for what im doing or should this be lower down (or higher!??!)

young knoll
glossy venture
#

what is it called