#help-development

1 messages · Page 267 of 1

terse ocean
#

can someone give me an idea to code a plugin(I am very new to java like 2months so not something very hard I just want to practice it!)

tardy delta
molten hearth
#

gh is quite common

#

I think jsdelivr's endpoint for github links is also gh

#

It makes sense since its shorter than git and git is the tool and not the platform

misty ingot
#
        File configFile = new File(getDataFolder(), "config.yml");
        YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);

        if (config.getDouble("config-version") != 1.3) {
            config.set("config-version", 1.3);
            try {
                ConfigUpdater.update(this, "config.yml", configFile, Arrays.asList("none"));
            } catch (IOException e) {
                e.printStackTrace();
            }
            // save changes
            try {
                config.save(configFile);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            // reload config
            reloadConfig();
            getLogger().info("Updated config file to latest version");
        }

I am using this library - https://github.com/tchristofferson/Config-Updater
it updates config-version in plugins/MyPluginName/config.yml
but It does not enter any new values which I put in the resources/config.yml file

#

like for ex I added settings.check-for-updates = true to my resources/config.yml it will update config version but wont add the field to settings.

tardy delta
#

create a plugin that broadcast a message to everyone on the server when a player joins and make it configurable in the config.yml

terse ocean
#

ok!

rotund ravine
# terse ocean can someone give me an idea to code a plugin(I am very new to java like 2months ...

Sure! Here are 15 spigot plugin ideas for beginner developers with small descriptions and catchy names:

"CraftyChests" - a plugin that adds custom chest designs and functionality to the game.
"MobArena" - a plugin that allows players to compete against waves of mobs in a custom arena.
"IslandLife" - a plugin that adds the ability to create and customize your own island, complete with fun minigames and challenges.
"WeatherWizard" - a plugin that allows players to control the weather in their worlds.
"EcoSurvival" - a plugin that adds a more realistic survival experience, with features like hunger and thirst mechanics.
"BlockParty" - a plugin that allows players to host their own block party events, with custom games and decorations.
"QuestsPlus" - a plugin that adds a quest system to the game, with various objectives and rewards for players to complete.
"MineMania" - a plugin that adds various minigames and challenges to the game, including parkour courses and treasure hunts.
"ChatCharms" - a plugin that allows players to customize their chat messages with different colors, symbols, and effects.
"PowerTools" - a plugin that adds special abilities and functionality to certain tools, such as a pickaxe that can break blocks faster or a sword that can ignite mobs.
"Skyblock Plus" - a plugin that expands upon the popular game mode Skyblock, adding new features and challenges.
"BuildBattle" - a plugin that allows players to compete against each other in building contests, with various themes and judges.
"CratesPlus" - a plugin that adds customizable crate rewards to the game, allowing players to earn special items and bonuses.
"GriefProtection" - a plugin that allows players to protect their builds from being destroyed by other players.
"MagicSpells" - a plugin that adds magical abilities and spells for players to use, including fireballs and teleportation.

rotund ravine
#

Yes

#

@terse ocean If you make a github, feel free to post your projects here from time to time for a review. Sadly we will definitely pick on what you have written and suggest changes forever. So only if you can handle it

river oracle
terse ocean
#

yes i really want to improve my code/java skills and for that I do need reviews to what ever i code

rotund ravine
misty ingot
#

?paste

undone axleBOT
misty ingot
river oracle
rotund ravine
river oracle
#

Damn

#

I wanted some savage beast to insult me

quaint mantle
#

Can you explain what tf this does

rotund ravine
#

@river oracle find another savage beast

rotund ravine
river oracle
#

What

quaint mantle
#

His project

river oracle
#

It's just my lib lol

quaint mantle
#

For what

river oracle
#

So it does everything I need

misty ingot
#
        // if config version is old, update it to current version
        File configFile = new File(getDataFolder(), "config.yml");
        Configuration config = YamlConfiguration.loadConfiguration(configFile);

        if (config.getDouble("config-version") != 1.3) {
            config.set("config-version", 1.3);
            try {
                ConfigUpdater.update(this, "config.yml", configFile, Arrays.asList("none"));
            } catch (IOException e) {
                e.printStackTrace();
            }
            // save changes
            saveConfig();

            // reload config
            reloadConfig();
            getLogger().info("Updated config file to latest version");
        }

everything updates successfully except "config-version" to 1.3

river oracle
#

Granted I haven't pushed fixes

snow walrus
#

Has anyone been able to build the new PacketPlayOutEntityMetadata in Spigot 1.19.3 ? They changed the constructor from (entityId, dataWatcher, true) to: (int var0, List<DataWatcher.b<?>> var1) {

quaint mantle
#

Tasks seems kind of redundant

snow walrus
#

I guess var0 is the entity id but. What's that list?

quaint mantle
#

Since you could make 1 class and just do Tasks.sync and pass in a lambda

river oracle
quaint mantle
#

Which is what you have

river oracle
#

It's nice

quaint mantle
#

But still

#

Bukkit tasks are like 1 line

river oracle
#

But it's annoying to do conversions and such which is handled by the builder

river oracle
#

Time conversions from ticks to other time units

quaint mantle
#

Oh

#

TimeUtils.MINUTES.toTicks()

#

Smh

#

Jk

vocal mirage
#

i'm softdepending it in plugin.yml

tardy delta
#

do the saveDefaultConfig in your onEnable

#

might wanna use PlayerJoinEvent#setJoinMessage too but ye i said broadcast

terse ocean
#

ok got it

terse ocean
#

hey i have a question what is better eclipse or intellij?

eternal night
#

Intellij is probably used by the majority

#

What you prefer is, as always, subjective

vapid grove
#

personally i perfer intellij over eclipse

#

but as lync said its what you pefer

tardy delta
#

ij

#

im glad ElgarL isnt here

#

he will bonk me

sterile breach
#

if(inv.getName().equalsIgnoreCase("§8Mon Menu")){ send cannot find symbol i forget a package?

chrome beacon
#

Don't detect inventories by their name

#

Use the inventory instance in a Set/List or use a InventoryHolder

chrome beacon
#

Yeah using an InventoryHolder isn't ideal but it's better than using the inventory name

radiant cedar
#

I have a world for each rank and extra worlds for other modes so around 20 wolrds. How should I be loading and unloading these and creating these

#

Whats the best way to manage

#

How

sterile breach
radiant cedar
#

How do i make it not auto load

#

Ok so my plan is if someone decides to teleport to a world that is not loaded i will do Bukkit.create and trleport them. But if they leave and there r 0 ppl i will unload it so i would have to create again if someone decided to teleport

#

And i would save the world everytime i would unload it

#

@last temple would this work

chrome beacon
radiant cedar
#

Yes but what i said is for loading and unloading depending on players

#

Oh ur saying j wouldnt bave to load or deload if it just doesnt auto load

radiant cedar
#

for what in whuch yml

#

should i also create every world using worldcreater on enable

#

or what

#

do i do

#

but then how am i supposed to make locations

#

cus like i used /warp worldname and teleport the player to the world and the spawn loation

#

but if i dont create a world on launch

#

like if i dont do createworld(WORLDNAME)

#

then i cant teleport to WORLDNAME world

terse ocean
#

guys whats so special about a custom config file?

chrome beacon
#

Nothing really

terse ocean
#

oh ok

lethal knoll
#

Hey all, giving it a shot here as on the forums there is no reply. Does anyone have experience here with using "Populators". My goal is to somehow add additional mobs (with different equipent, commands, etc) to the natural spawning behavior of the world

chrome beacon
#

oh hello

#

It's been a while since I last saw you here

lethal knoll
#

Who? Me?

chrome beacon
#

Yeah you

#

as for your question the easiest approach is to replace a spawned mob with your own

lethal knoll
#

First of all, yea, true, It's been while 🙂

#

Had surgery 😦

#

Very major, several months of revalidation to go, but hey, can't leave it to start looking into development again

#

As for your proposed solution, that is what I did initially, but it would have been much nicer if I could add my own mob the spawn mechanics. I heard that you can control even conditions when they need to spawn which would be ideal

chrome beacon
#

I don't think the api supports that

#

but you can use NMS

lethal knoll
#

Yea, I've always avoided NMS so far

#

I prefer to stick with the spigot API

river oracle
#

Remapped makes it super nice tbh with you

#

?nms

chrome beacon
#

It's gotten a lot easier to use on modern version

lethal knoll
#

will check that @river oracle , it's worth a shot

#

But I saw that it's possible to add populators

#

it would be nicer if I didn't had to replace existing mobs

#

but if it' really the best way

#

I just want to avoid to include logic where certain mobs don't have to be replaced etc, that makes it difficult

chrome beacon
#

Spigot only has block populators

lethal knoll
#

That is why I'm looking for a way where I just (add) a new mob (type) or mob loadout

river oracle
#

I'd assume the nms isn't too complex for that but I may be wrong

dawn plover
#

little question, i wanted to make a click event that does something in the code itself, welp, turns out i cant. is there some way i can do this?

lethal knoll
#

Yea, I'm more or less open to anything, as long as it's a durable solution 🙂

#

@dawn plover , the way I approached that is by having a command do the logic

#

with possible arguments in the command to pass along data

dawn plover
#

oh thats bigbrain

#

yea true, but what is the permission rule with that

#

the clicker?

#

aha, okay

#

yea, just the same, but a little shortcut

chrome beacon
#

Everything is pretty much hardcoded

vernal sky
#

I`m blacklisted for no reason and for 2 h i have been loosing my mind trying to log in. Can i get un-blacklisted please?

chrome beacon
#

blacklisted from what?

#

The Spigotmc site?

vernal sky
#

from middlecraft

chrome beacon
#

This is the Spigotmc discord

vernal sky
#

oh wrong chat

quiet ice
#

-.-

jovial grotto
#

Hello

radiant cedar
#

Cys i cant create location without an instance of World and I cant get an instanxe of World without creating first

#

Or do u know a way

rotund ravine
#

Are. you running your plugin pre-world init?

radiant cedar
#

So all worlds should be created when i launch server

rotund ravine
#

Well

#

If you plugin is set to PostWorld as default all worlds should be.

lethal knoll
radiant cedar
#

So if i did nothing

#

And did player.teleport(new Location(Bukkit.getWorld(“hub), 0,0,0,0,0)

#

This would teleport

#

But in this case hub should have been loaded

#

Beforehand

#

Cus otherwise it says world doesnt exist

#

what does POSTWORLD do

rotund ravine
#

force loading all worlds seems like a bad idea

glossy venture
#

actually i do it with 2 worlds and one is not void ~600 ms

rotund ravine
glossy venture
#

you could do it in a PluginEnableEvent or schedule a task to run when the server is done loading

atomic swift
#

How do i get NMS

onyx fjord
#

i have a weird issue in gradle, so basically i have my own Lib thing that I shade into my projects. That Lib itself shades a bunch of stuff (for example color api). However when I add my Lib to a project it demands that I add one dependency even tho Lib already provides it.

Anybody knows whats up with that?

atomic swift
#

now how do i add it as a depend

tender shard
atomic swift
tender shard
#

with build tool, I meant maven, gradle, ant, ... ?

atomic swift
#

mav

tender shard
atomic swift
tender shard
#

obviously the <dependency> thing belongs inside the <dependencies> thing

atomic swift
tender shard
#

your whole pom is messed up

atomic swift
#

ik

tender shard
#

?paste it pls

undone axleBOT
atomic swift
#

kk

tender shard
#

that actually looks correct

atomic swift
#

want me to redo buildtools

tender shard
#

do you get another error message now after you fixed the </dependencies> thing?

#

the pom you sent should be working fine

tardy delta
#

💀

tender shard
#

oh damn

#

I totally misread your screenshot

#

have you actually ran buildtools for 1.19 with the remapped option?

tardy delta
#

lmao i did too

tender shard
#

looks like you haven't

#

as the blog post says, you gotta run java -jar buildtools.jar --rev 1.19 --remapped

tender shard
atomic swift
#

if thats all i might die

tender shard
#

🙂

atomic swift
#

where do i have to but the files tho

tender shard
#

in your case, 1.19 ofc

tender shard
#

buildtools automatically installs them to your local maven repo

#

that's why maven is so awesome

#

you don't have to worry about stuff like that

atomic swift
#

kinda do lol

tender shard
#

you just run buildtools and then it should work

atomic swift
tender shard
#

the spigot .jar is only like 20mb or sth

atomic swift
#

ye

round finch
#

is that your only disk?

atomic swift
#

i have an ext

#

too

round finch
#

i would feel bad for you
if you only had disk

#

bruh you got 4.54 tb external

#

laptop?

atomic swift
round finch
#

hmmmmm interesting

wise ember
# atomic swift

Whenever you download something, especially programs, reroute it to your D drive. You can also change where your downloads, desktop, and documents folder is in by right clicking it and clicking "Properties"

round finch
#

i would like to make a visual map of spigot jar

#

🤔

#

flowchart

tender shard
subtle folio
#

apache or nginx for proxy

regal lake
#

nginx

subtle folio
#

Why?

wet breach
subtle folio
regal lake
#

For web based applications i use apache, but for rev proxies i prefer nginx

wary kettle
#

can the luck attribute not be added onto itemstacks in 1.12.2

subtle folio
#

i think apache is capable of both?

regal lake
#

both are capable for web apps and rev proxies 😉

wary kettle
#

nvm was missing the name

tender shard
#

apache is just way easier to configure and it can do much more

#

nginx is faster if you serve 200 thousand static files per second

orchid gazelle
#

I use nginx because it sounds cooler

subtle folio
#

nope small 25 file web server

#

apache jt js

regal lake
#

apache can more ?
I dont think so, but yea it's easier to configure

tender shard
#

first thing that comes to my mind:

#

.htaccess

orchid gazelle
#

Jägermeister?

#

Alles klar? Wunderbar!

regal lake
#

You can do anything in nginx which is possible in the .htaccess file.
There is a reason why nginx don't use that -> performance.

wet breach
regal lake
#

I said that already @wet breach 😉

tender shard
subtle folio
#

I think i’ll go with apache for my api, thanks !

tender shard
#

you should use whatever you are more comfortable with

subtle folio
#

I have no experience in either

tender shard
#

then take a look at both config syntaxes and decide what you like more

subtle folio
#

but both are very popular so I was unsure of what to use

regal lake
tender shard
#

apache is kinda "xml like", nginx looks more like build.gradle files lol

wet breach
tender shard
#

I'd say that maven users probably like the apache syntax and gradle users will like the nginx syntax more

subtle folio
wet breach
#

also, apache allows for installing custom modules too

tender shard
#

and ant users... idk... they can use lightppd or sth lmao

atomic swift
#

does anyone know a good playerlist library

subtle folio
#

what i was thinking exactly

subtle folio
remote swallow
subtle folio
#

there’s your player list

atomic swift
#

so i can create a player list

subtle folio
#

a tab list?

atomic swift
#

or should i say tablist

subtle folio
#

you can use the spigot api for that

tender shard
wet breach
tender shard
#

oh

#

wrong reply

subtle folio
#

kinda silly

#

lol

tender shard
#

I like it

atomic swift
#

kool

subtle folio
#

it’s cute

orchid gazelle
tender shard
#

it's better than just printing "Please wait..." and then people think it crashed after 5 minutes

subtle folio
#

mhm mhm

mellow pebble
#

how do i get name of inventory where item was clicked (1.19.2) because i cant use e.getInventory().getName()

wet breach
#

you should probably get the inventory holder instead

#

since the name of an inventory isn't really all that reliable

tender shard
#

getTitle() not getName() sorry

mellow pebble
tender shard
mellow pebble
#

for example full string that i gave to inventory is ApexCore.themeColor + "Available tags:"

#

so should i put

#

ApexCore.themeColor + "Available tags:"

#

or just Available tags:

tender shard
#

why would you ever need to get a view's title anyway?

#

that sounds like a shitty idea

#

remember that people could just rename their shulker box / chests to "Available tags:" to mess with you lol

wet breach
#

people love doing things the wrong way too

tender shard
#

you should keep a Collection<Inventory> or Map<...,Inventory> instead

#

or create your own custom InventoryHolder, although that's a bit hacky

mellow pebble
tender shard
#

one could argue about that tbh

#

the docs say that the API is designed to only be implemented by plugins if the class is "obviously designed for extension". I don't see any reason why this shouldn't be true for InventoryHolder

#

wasn't that added in java 17?

river oracle
#

final

#

legit

#

a final class

tender shard
#

makes sense

river oracle
#

oh

tender shard
#

lol

river oracle
#

its an interface I forget

#

lol

mellow pebble
#

@tender shard do you need those cases and skins in csgo 😂

river oracle
#

does anyone know of a nice way to get mob heads for each type of mob, or am I just going to have to cry a lot here while implementing the hard annoying scuffed way

tender shard
#

it's called "Sealed classes"

#
public abstract sealed class Shape
    permits Circle, Rectangle, Square {...}
mellow pebble
#

if we are going to talk abt money

tender shard
#

yes

mellow pebble
# tender shard nah

well okay i wanted to say that i could help you flip twice more value than you have rn if you would give me those skins and cases

tender shard
#

e.g. you could do "public interface Inventory permits Container, Entity {"

#

then only containers and entities can implement InventoryHolder

#

but bukkit is still on java 8 sooo

#

won't happen anytime soon

orchid gazelle
#

Good that I still use Java 8 Syntax in Java 17

#

I hate all the new shit tbh lol

#

Ugly

tender shard
#

it was added in java 17, and as preview feature in java 15 btw

#

the sealed stuff

tender shard
remote swallow
orchid gazelle
#

I use J17, but I basicly just use J8 syntax at all

river oracle
#

I love all the new LTS stuff idk if this was j17 or 11 or neither,but honestly

if(!(sender instanceof Player player)){
  return;
}
player.sendMessage("Playa");
tender shard
#

that's pattern matching, it's java 16

remote swallow
#

Does that work?

river oracle
#

yes

#

it does

tender shard
#

sure

#

this also works:

public String test(Object obj) {

    return switch(obj) {

    case Integer i -> "An integer";

    case String s -> "A string";

    case Cat c -> "A Cat named " + c.getName();

    default -> "I don't know what it is";

    };

}
orchid gazelle
tender shard
#

note the "cat" line

remote swallow
#

That will hella usef

orchid gazelle
#

I used lambda 1 time yesterday, because it was needed

river oracle
#

Lambda's are java 8

#

they are amazing

#

and I love them

rotund ravine
#

Kotlin did it better

river oracle
#

wait

#

nvm they aren't

#

I'm just an idiot

tender shard
#

java 8 was definitely the best update ever, everything that came after that is... "nice to have", but that's it

rotund ravine
#

They are @river oracle

remote swallow
#

You use bukkit runnables dont you

river oracle
#

ok I panic when I say stuff and I'm not sure

orchid gazelle
river oracle
#

this

rotund ravine
#

@orchid gazelle weird

tender shard
#

I don't like kotlin either, it's kinda ugly and has weird priorities

orchid gazelle
#

No.

tender shard
#

e.g.

#

name: String

#

wtf

orchid gazelle
#

I think its just Java in Ugly

tender shard
#

why does the String come after the variable name

orchid gazelle
#

lol

tender shard
#

the type is way more important than the variable name

river oracle
orchid gazelle
#

Kotlin = Java + Ugly

tender shard
#

and then do Material.valueOf or sth

echo basalt
#

no :)

#

there are only like 5 mobs with native heads

#

rest is MHF_whatev

river oracle
echo basalt
#

there are more than a few

river oracle
#

I saw a list somewhere, and only saw like 10

river oracle
tender shard
#

oh well yeah there's 18 builtin heads

#

the other ones are ofc not native

#

they are just random textures someone once uploaded

#

so yeah you would have to hardcode that

#

hm I could add that to JeffLib's SkullUtils class

#

SkullUtils#getHead(EntityType, boolean wall)

river oracle
#

I suffer not using jeff lib

tender shard
#

however using those MHF heads is still kinda weird

#

if you have a texture pack that changes creeper's heads, but then you use the MHF_CREEPER head, it would look like a vanilla creeper

tender shard
#

I just explained it

#

imagine you do this:

orchid gazelle
#

BIER

#

Lets go

tender shard
#

creeperHead = new ItemStack(Material.CREEPER_HEAD)
someMobThatDoesntHaveDefaultHead = someMHFHead;

#

now creeperHead always looks like your player's resource pack

#

but the other mob always looks like the default one

echo basalt
#

kotlin mfs when they discover a new keyword cry_laugh

#

10% shorter code, "less verbose" and they just pack 70 keywords in

tender shard
#

"less verbose" is one of the reasons why kotlin is shitty

echo basalt
#

we all love java because of its verbosity

tender shard
#

I mean, if they really hate typing 2 extra letters, why didn't kotlin rename String to s?

tender shard
#

and because it has the priorities right

echo basalt
#

because everything is so specific that there's no way to fuck it up

orchid gazelle
#

Yeah

tender shard
#

e.g. type BEFORE variable name

#

and not other way around

echo basalt
#

modifiers before the type, which is before the name

river oracle
echo basalt
#

because it's ordered by importance

orchid gazelle
#

Verbosity imo is a good point for programming languages

tender shard
#
var someObjectAndYouHaveToCheckTheEndOfTheLineToKnowWhatTypeItHas: String
orchid gazelle
#

Wtf

tender shard
#

I'd rather know instantly that it's a string

echo basalt
#

sure sometimes it sucks that we have to engineer a whole backend structure to make a basic plugin

#

but if you argue around that, use skript and fuck off

rotund ravine
#

We don’t even type String most of the time

#

val str = “some string”

tender shard
#

yeah ik you use "var" and "val" and then nobody knows whether it's a string or a CharSequence

echo basalt
#

mans can't type function so they make it fun

orchid gazelle
#

lol

rotund ravine
#

Just infer it smh

echo basalt
#

yet then they decide to do a companion fun object

rotund ravine
#

companion stuff is weird

orchid gazelle
#

Why not just type int in the first place????

hazy parrot
echo basalt
#

the var and val stuff just makes code 10x more ambiguous

tender shard
#

yeah

#

you have no clue what type anything has

rotund ravine
#

You do

orchid gazelle
#

Thats what im saying

rotund ravine
#

Just read the code context or hover over it easy

tender shard
#
val myThing = StringUtils.reverse("asd")
#

what type does myThing have?

rotund ravine
#

Most likely string

orchid gazelle
tender shard
#

no, it's a CharSequence

rotund ravine
#

Well doesn’t matter much

orchid gazelle
echo basalt
#

most likely

eternal oxide
#

Java is unambiguous, Kotlin is poo

tender shard
#

e.g. Player#setDisplayName

echo basalt
#

the elder has spoken

tender shard
#

doesn't work for a ChestSequence

#

so it does matter

echo basalt
#

jan needs to respect his elders

tender shard
#

CharSequence*

echo basalt
#

alex I haven't seen your upvote on the nms tutorial, you lackin too 😠

tender shard
#
val reversedName = StringUtils.reverse(player.getName())
player.setDisplayName(reversedName)

wouldnt compile

echo basalt
#

kotlin automatically converts getters

tender shard
#

yeah but that's not the reason why it wouldnt work

orchid gazelle
#

Cringe

tender shard
#

the reason is that reverse(CharSequence) returns a CharSequence

#

in java you would do it like this:

orchid gazelle
#

If I see "val" 1 more time I need some Jägermeister

tender shard
#
String reversedName = StringUtils.reverse(player.getName());

and then you would instantly see that it's not a String

echo basalt
#

imagine using utils for that

tender shard
#

java is less headache

hazy parrot
echo basalt
#

why do that

#

when you can convert the string to a char[]

hazy parrot
echo basalt
#

convert that char[] to a list

#

sort that list

#

and revert the process

#

:)

orchid gazelle
#

TLDR: Kotlin is making things worse by simplifying them

echo basalt
#

TL;DR - Kotlin's concepts are different to java's concepts, but they're both based on the same platform, so arguing that one is better than the other is worthless because it's a personal matter

orchid gazelle
#

=(

tender shard
#

another reason why kotlin makes stuff more complicated:

orchid gazelle
#

Nah man I just need a doctor when I see that somebody uses kotlin

tender shard
#

oh no wait

orchid gazelle
#

That was Java

#

lol

tender shard
#

yeah ik

#

that's my point

#

one sec and you'll see

orchid gazelle
#

Ok

echo basalt
#

I should pull a mineacademy move and make my own programming course

#

with my sexy voice and 480p webcam

orchid gazelle
#

Lmao

echo basalt
#

but instead of a german accent it's a weird shitty slavic accent

#

mixed with west european

orchid gazelle
#

Me and alex gotcha

#

With german accent

tender shard
#
// IMagine this is from java lib
public class Person {
    protected int age;
    public void setAge(int newAge) {
        if(age >= 100) {
            throw new IllegalArgumentException("Age cannot be greater than 100");
        }
        age = newAge;
    }
}

And now you use it in kotlin to create a class that extends Person, like this:

class Mfnalex : Person()  {
    init {
        this.age = 101;
    }
}
#

does this throw an exception, or not?

hazy parrot
#

it does

#

it will always use setter from java if present

echo basalt
#

even though we have a protected variable

tender shard
#

how "useful"

hazy parrot
#

why would your var be "visible" if you have condition for it ?

tender shard
#

because it's protected and it's a subclass

#

sometimes you want outside classes to only use the setter while you want full control from subclasses

#

also wtf is this

#

I mean, that's not a kotlin problem, but intellij's fault

echo basalt
#

white theme

#

my eyes

orchid gazelle
#

eye cancer

tender shard
#

why can I not run a simple kotlin project from within intellij

shadow rune
#

Hi, license system on premium plugins is acceptable?

tender shard
echo basalt
#

alex I still haven't seen your upvotes on the nms tutorial

#

I am very angy

tender shard
#

upvotes?

echo basalt
#

yes

tender shard
#

which nms tutorial

echo basalt
#

bio

tender shard
#

I will not upvote anything that encourages to use paper api tbh 😄

echo basalt
#

I literally copypasted your pom.xml from your blog

echo basalt
tender shard
#

paper should contribute upstream instead of inventing their own weird API, and then complain when spigot adds it too because now it breaks their bytecode compatibility

#

looking at you, ADvancementInfo class

#

everything with a String is deprecated lmao

#

as if anyone would like to use Components

eternal oxide
#

Components have their use, just not in place of EVERY String

tender shard
#

"Hey, I want to rename this player. Thank god the string method is deprecated, I'll rather just use a BaseComponent[] to rename "mfnalex" to "Alex"

tender shard
#

it's fine to offer both. It's a jerk move to not offer a string method or to deprecate them

shadow rune
tender shard
round finch
#

wut the heck you must use paided obfuscator?

tender shard
#

not even rockstar games can protect their games from being cracked, why do you think you could do that?

shadow rune
round finch
#

i mean obfuscator

tender shard
echo basalt
tender shard
#

the reason why DRM is not allowed is this:

shadow rune
tender shard
#

ok send me your .jar and I'll get it working

vocal cloud
#

Lmfao

echo basalt
#

post it here, I want a challenge too

orchid gazelle
#

Illusion if you would have written the guide 2 months earlier, you would have saved me like 10 hours literally

round finch
echo basalt
tender shard
#

also what does your "licensing" do?

echo basalt
#

I've provided drafts here and there

tender shard
#

query some license server that returns "yes" or "no"?

orchid gazelle
#

But now I already learned about nms lol

echo basalt
#

I still have a lot of work to do on that guide in order for it to be the mammoth I wanted it to be

#

still, give me upvotes I need validation

frank kettle
#

@echo basalt Just wanted to come back here to thank you so much for your help yesterday. everything is working fine now. ty a lot

#

🤗

echo basalt
#

I helped you yesterday?

frank kettle
#

lots of ifs code and not using ConfigurationSection

echo basalt
#

I spend upwards of like 6 hours on this server, every day

tender shard
#

Also drm is not prohibited in the rules

frank kettle
#

well, im grateful either way

echo basalt
#

cheers then

vocal cloud
#

Any plugin worth stealing has been stolen

round finch
#

sell 0 mb plugin

tender shard
#

I do it a bit tricker

#

I let leakers leak using versions, but they crash the server after 12-24 hours with an internal jdk error

#

People never realize that

#

They think they cracked it and then the 13 year olds wonder why their world got corrupted after a week

echo basalt
#

I forgot how to play apex

tender shard
#

You don‘t

#

Ez

echo basalt
#

sure

#

It's more that I've already worked today

#

and am lonely n shit

jade perch
#

Why is general chat in help development

round finch
#

movement

echo basalt
#

I could just watch a scary movie, that way I won't be lonely anymore

round finch
#

position

tender shard
eternal oxide
#

Happens when there are no questions

orchid gazelle
echo basalt
tender shard
orchid gazelle
#

Not the normal one

tender shard
orchid gazelle
#

How do u know who pirated then?

echo basalt
#

just use unsafe#setMemory

#

run a for loop

tender shard
#

by a ton of different things

orchid gazelle
#

Uhm

round finch
#

imagine using time to crack a plugin

#

then missing out on next update

tender shard
#

for example, the user placeholder. the license internet check whether this is actually a user who paid for this on paypal. by checking the file size. by checking the method names. there's a check for this in most classes

round finch
#

cus of alteration

tender shard
#

by checking how many different IPs have used this exact NONCE within the last 7 days

#

and more stuff

orchid gazelle
tender shard
#

a very easy measurement for example is to check the number of methods a certain class has

#

if it's off, then obviously it's not a valid version

#

if AngelChestPlugin has 27 methods but this version has 28 -> Unsafe#putAddress(0,0) after 12-24 hours

orchid gazelle
#

Then they just remove the check

tender shard
#

the stacktrace doesn't even show the method where the crash comes from, the JVM just dies

orchid gazelle
#

They can see where checks happen in your src

round finch
#

ey nothing is gonna be perfect

tender shard
#

Sure, if one has 300 months to do that, they can do that

#

but it's not worth the effort

rotund ravine
#

Just write a script.

orchid gazelle
#

^

tender shard
#

and how is that script able to detect that method?

rotund ravine
#

You can easily find specific methods etc. If all your checks are similar they can find that too

tender shard
#

okay let me show you sth

#

this is one of those methods in angelchest 9.8.0

#

this is the same thing (exact same source code) in 9.8.1

orchid gazelle
#

Uhm

rotund ravine
#

Looks fun

orchid gazelle
#

I personally think thats not easy code lol

round finch
#

makes the plugin so it needs to connected to web for scripts

tender shard
#

and now remember, that such a method exists in nearly every class, but it looks different every time, has different method signatures, gets called in different places, different names etc

#

and everything will change with every new version again

#

so yeah, if someone wants to spend XXX hours for one specific version, they can crack that

echo basalt
#

sounds like a waste of performance

tender shard
#

but once they cracked that, I already released 5 new versions meanwhile

echo basalt
#

why do that when you can just live off commissions

proud basin
#

Has anyone figured out this issue Access to XMLHttpRequest at 'http://localhost:8000/login' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute. I've tried searching for answers but i've tried most of the solutions online that I can find and still hasn't fixed it.

tender shard
tender shard
#

when someone messages me "yo I cannot afford plugin X, can I get a discount / get it for free?" then I say "sure no problem"

orchid gazelle
#

Even if they don't

round finch
#

you can block outgoing packets 😂

tender shard
#

but when "leaker XYZ" makes 300€ per months by selling MY SHIT on leaking sites, then... no

echo basalt
#

there are like 2 sides to this argument

tender shard
echo basalt
#

one is like

#

make it open-source and let the community benefit

#

sure leakers can leak or the user can just pull from git and build

tender shard
#

but all those leaking websites also automatically add their own methods so the method count is off for at least the main class

echo basalt
#

or do what citizens does, and have a jenkins page

tender shard
#

there is a ton of ways to detect whether this is an original .jar or not. asking some website is just one of those

echo basalt
#

just don't forget that if you one day randomly decide to stop posting updates, you're making it harder for people to pick it up after you

tender shard
jade perch
#

Yeah seems like a lot of work, I just make my plugins open source and stop caring about leaks

tender shard
echo basalt
#

I'm feeling like making a public plugin

#

that's like gui-based or something

#

I just don't know what it should be about tho

tender shard
#

but my drm stuff is already done, I just let it run through Stepsister.jar after packaging and that's it

ancient plank
#

Stepbro 😳

round finch
#

StepDancer

round finch
tender shard
#

Stepsister has very interesting code. that's the unobfuscated, original code lol

tender shard
jade perch
tender shard
#

I used to do stuff like

if(Daddy.allows(PremiumFeatures.SOME_PREMIUM_FEATURE)) ...
echo basalt
#

"Run it through HR"

proud basin
round finch
#

damm bruh mfnalex making family code

#

must be family friendly

#

😁

jade perch
proud basin
#

Always worth a try

jade perch
#

If you say so

tender shard
#

I also wrote this weird string encryption recently but haven't used it so far in any uploaded plugins

#

ofc it returns sth different every time

round finch
#

nice :O!

tender shard
#

and no you cannot just open recaf and let it "optimize" this stuff, it depends on the class and package names that called the decrypt that whether it works or not

#

and most leakers are stupid and replace the user placeholder with sth different in every string

atomic swift
#

i think theres something wrong with mc i have this but i get an error abt IndexOutOfBoundsException

                    if (p.getMetadata("scoreboard").isEmpty() || p.getMetadata("scoreboard")==null || p.getMetadata("scoreboard").size() == 0) {
                        p.setMetadata("Scoreboard", new FixedMetadataValue(plugin, true));
                        p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
                    }
                    
                    if (!p.getMetadata("scoreboard").get(0).asBoolean() || !p.getMetadata("scoreboard").isEmpty()) {

                        p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
                        continue;
                    } else {
                        p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
                    }
remote swallow
#

?paste

undone axleBOT
dreamy hull
#

Hello guys ! I have a question does anyone know if it is possible to intercept the packet (with Protocolib) that sends the text over the hotbar? I have tested the Server.CHAT and Client.CHAT packets, neither of them is triggered.

tender shard
#

what's Main line 127

jade perch
atomic swift
tender shard
tender shard
atomic swift
#

it shouldnt be

tender shard
#

check if it's empty BEFORE calling get(0)

atomic swift
#
if (p.getMetadata("scoreboard").isEmpty() || p.getMetadata("scoreboard")==null || p.getMetadata("scoreboard").size() == 0) {
                        p.setMetadata("Scoreboard", new FixedMetadataValue(plugin, true));
                        p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
                    }

tender shard
#

please use code tags

#

?codetags

#

?code

#

idk the command

remote swallow
#

?codeblocks

jade perch
#

You capitalized the S in scoreboard

tender shard
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
atomic swift
#

ik

remote swallow
#

There we go

atomic swift
#
if (p.getMetadata("scoreboard").isEmpty() || p.getMetadata("scoreboard")==null || p.getMetadata("scoreboard").size() == 0) {
                        p.setMetadata("Scoreboard", new FixedMetadataValue(plugin, true));
                        p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
                    }
#

i check 3 times

tender shard
#

yeah you set the Scoreboard meta

wet breach
tender shard
#

but you get the scoreboard meta

wet breach
#

so assume first it is something wrong with your code and not the other way around 😉

tender shard
#

change "0" to "0.1" and I agree 😄

wet breach
#

lol

tender shard
#

there have been so many spigot bugs I tried hours to fix

atomic swift
tender shard
#

@wet breach e.g. try to save a PDC tag like this: {"name":"mfnalex"} into an ItemMeta's PDC, then save that item in a config, and read it again.

#

you'll be fucked

wet breach
tender shard
#

s != S

atomic swift
#

yes

tender shard
sterile axle
#

I prefer to blame the server

tender shard
#

i only do that when people send me stacktraces of their weird mohist / catserver servers

sterile axle
eternal oxide
#

Not sure that needed to be a gif

tender shard
#

I have started to just check this in onEnable(), and when it returns true, I disable the plugin and print an angry message

sterile axle
#

I just say "Here's the software I support: ...

If you're not using that/one of those, then fuck off from my DMs"

#

💃

tender shard
#

yeah but that doesn't help from getting tickets anyway

#

then I ask "what server software do you use"

#

and they answer "latest"

#

and before they finally tell me they use "mohist", they already wasted 15 minutes of my time

sterile axle
#

That's when I smash the close button. Call me an asshole but I don't care

fading spindle
#

anyone know why this is happened ?

i setup building the artificat and build it and then i put it in a server like minehut and run the /plugin command and my plugin isn't there and my plugin's functionallity isn't there either i tried server hosters like minehut and server.pro

eternal oxide
#

?paste latest.log and your plugins name

undone axleBOT
fading spindle
#

what do you mean latest log

tender shard
#

you go to your server's "logs" folder

fading spindle
#

oh ok

tender shard
#

then you copy/paste the contents of the file called "latest.log"

#

and paste it into that website

#

then you click the save button and send us the link

fading spindle
#

ok doing that

quaint mantle
atomic swift
#

i changed it to coreboard

remote swallow
#

Didnt 2 people tell them that over 30min ago

fading spindle
#

plugin name shrek_plugin

remote swallow
#

Api version 1.19 not 1.19.2 in plugin.yml

fading spindle
#

what?

remote swallow
#

It just needs 1.version not the minor

fading spindle
#

but in the yml file its 1.19.2

remote swallow
#

Change it to 1.19

fading spindle
fading spindle
#

why so?

remote swallow
#

It doesnt need the 3rd number

fading spindle
#

ok

#

well

#

my pom

#

has

jagged monolith
#

The api-version only goes off the major versions, not minor

fading spindle
remote swallow
#

That can stay as that

fading spindle
fading spindle
jagged monolith
#

The pom file needs just 1.19 for the api-version for it to work

fading spindle
#

so like if 1.20 comes out ill do 1.20 but if 1.20.1 comes out ill still do 1.20

jagged monolith
#

Yes

fading spindle
#

thanks!!

quaint mantle
#

anyway i can just remove fishing drops all together?

remote swallow
#

?jd-s check the fish event or something like that, i would guess it has a set drops method

undone axleBOT
sterile axle
#

cancel it, i guess. then do what you want to do instead

tender shard
#

it's probably EntityDropItemEvent

quaint mantle
sterile axle
quaint mantle
#

xd

sterile axle
#

well...

#

what is your goal? lol...

tender shard
#

they want to stop drops from fishing

quaint mantle
#

^

tender shard
#

so cancel EntityDropItemEvent when the entity is a fish

quaint mantle
#

but what about the random item drops that can occur? like leather and stuff?

tender shard
#

they will be gone too

#

I thought that's what you wanted

sterile axle
#

that's handled there, you check the fish state and see what it is. caught fish, caught item, etc

#

check and cancel appropriately

tender shard
#

oh wait

#

what exactly do you want to do

quaint mantle
tender shard
#

then try the EntityDropItemEvent and cancel that

#

I am not sure whether it works

#

you'll have to try it

quaint mantle
#

what does the "EntityDropItemEvent" even do? Does that do all item drop events?

#

cuz i kinda just need it only for fishing

sterile axle
#

i think you can use that fish event, but dont cancel. instead get the hook and just set the hooked entity to null

tender shard
#

it gets called whenever an entity spawns a "drop"

sterile axle
#

it will unhook whatever it is

tender shard
sterile axle
#

no it doesnt

#

it literally has getHook()

#

so get it, then call setHookedEntity(null)

tender shard
#

ah ok

#

yeah that might work

#

I thought you meant that the event itself has a setHooked method or sth

sterile axle
#

however, that might not despawn the hooked entity if that's what you want 🤔

#

but yeah try it

quaint mantle
#

ah its not clearing the caught item when you reel it in

tender shard
#

they could just do getHook().getHookedEntity().remove()

sterile axle
#

get the hooked entity and manually delete it then

quaint mantle
tender shard
#

idk, you have to try it

quaint mantle
#

and so i will

tender shard
#

probably it'll work

sterile axle
#

yes that seems like it would work

quaint mantle
#

Also for chances i use the Math.random() function right?

tender shard
#

I'd rather use ThreadLocalRandom().nextDouble()

sterile axle
#

you can make some type of chance that way but computers can't do true randomness so it'll be pseudorandom and probably somewhat predictable

quaint mantle
#

hm ok

sterile axle
#

not a whole lot you can do about that though

quaint mantle
#

So lets say if i wanted to do a chance of 5% what can i do to make it efficent?

#

efficient*

sterile axle
#

what

tender shard
#
public class Something {
    
    private static final double CHANCE_TO_GET_DROPS = 0.2;
    
    public static boolean shouldGetDropNow() {
        return ThreadLocalRandom.current().nextDouble() < CHANCE_TO_GET_DROPS;
    }
}
#

this would return true in 20% of cases, and false in 80% of cases

sterile axle
#

except for that fact that it's not truly random so that's not the true probability

#

but, yes sure

quaint mantle
tender shard
quaint mantle
#

uh but back to our other issue,

sterile axle
#

lmao ok

#

when they come back and say its not really 20% i will give you a ping

quaint mantle
#

For some reason "getHook().getHookedEntity().remove();" isn't removing the caught item...

sterile axle
#

and you can explain it to them

tender shard
#

show your whole eventhandler code pls

quaint mantle
#

it wont let me make a .txt file on here for some reason

tender shard
#

because you are not verified

#

!verify

undone axleBOT
#

Usage: !verify <forums username>

quaint mantle
#

!verify MusicalCode

undone axleBOT
#

This account is already verified!

quaint mantle
#

ah other acc has it

#

forgot

#

and idk the details to that acc

tender shard
#

did you register the event? also line 5 will probably throw many errors

quaint mantle
#

yes i registered the event

tender shard
#

everytime you do a fishing related thing that's NOT "reeling in" or "caught fish", it will throw a NPE

#

but it should still work though

quaint mantle
#
if (e.getState() == PlayerFishEvent.State.REEL_IN){
            e.getHook().getHookedEntity().remove();
        }

Do you think this would possibly fix it?

tender shard
#

nah

sterile axle
#

remove() only marks it for removal, it doesn't process the removal. I am not sure how to force despawn it though

tender shard
#

it would fix the exception, but if the current thing doesn't work at all, this also wouldn't work at all

tender shard
sterile axle
#

ok

#

docs say it marks for removal

tender shard
#

yeah that's what they mean with that

sterile axle
#

k

tender shard
#

at least that's how I always understood it

#

hm well lemme start intellij in 10 minutes, then I'll try a bit

quaint mantle
#

like i never been stuck on something this weird before,

sterile axle
#

are you still setting the hooked entity to null on the fish hook so that it unhooks? try unhooking it and also marking for removal

quaint mantle
#

but that doesnt work

sterile axle
#

unhook it and then remove it

#

idk if that will work but try it

quaint mantle
#

ok give me a sec

#

nope i still get an item

fading spindle
#

if you're making a custom GUI is there any method that can instantly close it after the person using it does a particular action

quaint mantle
#

p.closeInventory() should work

fading spindle
#

cause i tried p.close inventory

#

didn't work

quaint mantle
tender shard
#

„p“ is a variable name

#

Player is the class that declares that method (actually HumanEntity but…)

quaint mantle
fading spindle
#

should work now 😅

sterile axle
#

don't know, sorry.

tender shard
tender shard
#

have you tried event.getCaught().remove(); yet?

tender shard
#

kk lets start IJ

quaint mantle
#

i just find it weird how i tried everything and the items arent being removed.

quaint mantle
#

but no i haven't not till now

#

and that removed it..

#

xD

tender shard
#

it works fine for me

#

oh yeah

#

that's what I thought lol

quaint mantle
#

I read it wrong

#

thats my bad

#

lol

tender shard
#

np

quaint mantle
#

okay now chances...

#

because for some reason i suck with them..

tender shard
#
    private static final double CHANCE_TO_GET_DROPS = 0.2;

    public static boolean shouldGetDropNow() {
        return ThreadLocalRandom.current().nextDouble() < CHANCE_TO_GET_DROPS;
    }

    @EventHandler
    public void onFish(PlayerFishEvent event) {
        if(event.getCaught() != null) {
            if(shouldGetDropNow()) {
                event.getCaught().remove();
            }
        }
    }
#

now you'd get only drops in 20% of cases

#

I always use this utility stuff from my lib for chances @quaint mantle

#

e.g. "chance(0.5)" returns true in 50% of cases

#

chance(0.2) returns true in 20% of cases

#

basically: just create a random double between 0 and 1. 0.5 is 50%, 0.2 is 20%, etc. and when the random is <= the "chance", then the chance is "successful"

#

and you should use ThreadLocalRandom.current().nextDouble(), that returns a number between 0 and 1

quaint mantle
#

well i gotta see wat i can do, for now in terms of another trick then if that fails ill just resort to what u sent

tender shard
#

that will 100% work and it's only like 10 lines

#

the general idea is:

1. create random double between 0 and 1
2. check if that double is lower than your desired chance (0.2 = 20%, 0.4 = 40%, etc)
3. if yes, then do your stuff, otherwise don't do it
quaint mantle
#

the trick i tried just rn, seems to be working fine

tender shard
#

nice

quaint mantle
#

ty btw for ur help

tender shard
#

np

#

don't forget to check whether getCaught() is null before calling remove() though

#

otherwise you'll get a ton of console errors

quaint mantle
#

i have it in the REEL IN fish event part,

sterile axle
tender shard
#

sorry but "p" and "e" really are fucked up names for variables 😄 😛

quaint mantle
#

thank you ig

#

xd

tender shard
#

I used those single letter variables myself for 3 years, so I know that it's bad 😄

remote swallow
#

Personally i just call all my methods and vars letters of the alphabet

sterile axle
#

I use the greek alphabet

tender shard
#

I love how copilot instantly knew what I'm up to

quaint mantle
#

I need help I can,t connet to my server

tender shard
remote swallow
tender shard
remote swallow
tender shard
#

have you written your own server software in java?

quaint mantle
#

like I start up my server and then i can,t coonet

sterile axle
#

dog

remote swallow
#

^^

quaint mantle
#

oh

radiant cedar
#

new WorldCreator("arena").createWorld()
should I use this to load all my worlds onEnable() (I have around 20)

tender shard
#

yes

radiant cedar
#

woudlnt that take long everytime

remote swallow
#

Why would you need to load 20 worlds on startup

tender shard
#

loading 20 worlds always takes long

radiant cedar
tender shard
#

why do you even have 20 worlds

radiant cedar
#

like a prison server

sterile axle
#

just lazy load them instead. when they use warp check if its loaded. if not, load it.

#

then warp them when its done

radiant cedar
#

how do u lazy load

sterile axle
#

i just explained it

tender shard
#

the real solution would be to have 20 different servers using a proxy like bungee/waterfall/velocity

remote swallow
#

Just have a void world and spread them appart by a couple thoussnd blocks?

radiant cedar
#

ye idk how to lazy load tho

sterile axle
#

i literally just explained it

#

when they use /warp, check if the world is loaded.

#

if not, load it.

tender shard
#

oh and another solution would be not split up your player base between 20 worlds / ranks. how many players do you even have

sterile axle
#

then warp them.

radiant cedar
#

new WorldCreator("arena").createWorld() this is loading right

tender shard
sterile axle
#

you'd block it on startup anyway

#

lol

remote swallow
#

There is not a valid reason for 20 worlds that you can gi e

tender shard
radiant cedar
#

but i dont want it to matter

#

how many

remote swallow
#

A rank per world is pointless aswell

sterile axle
#

k whatever, then load the shit on enable. pretty sure yall aint gonna convince the lad to run a network

tender shard
#

if you really want to have 20 worlds where players can teleport to anyway, you want those worlds to be loaded already

sterile axle
#

besides his wallet probably isnt fat enough

tender shard
#

so load them in onEnable or sth

wet breach
quaint mantle
#

do you know which 1.19.3 method can turn an entity invisible?

tender shard
quaint mantle
#

nms

radiant cedar
#

ok instead then would i be able to make 1 world that has likethe prison mine for each rank

#

but different environments

#

like its night at some part and raining

#

and some part is sunny

#

in same world

tender shard
#

you are on 1.19.3

#

not 1.8

quaint mantle
#

I need to turn a horse invisible

remote swallow
#

Worldguard can do that, you could prob check source

eternal oxide
#

each player can have their own time/weather I bleieve

quaint mantle
#

can I do that without nms?

remote swallow
#

Yes

quaint mantle
#

ok thx

radiant cedar
wet breach
remote swallow
radiant cedar
#

so i can have different weather and time in different parts of world

#

ok ill see ty