#help-development

1 messages · Page 2074 of 1

torn shuttle
#

what they said is right but the even bigger brain way of doing it is via consumer

crisp steeple
#

vs doesnt suck that much i guess if its your only option but you should get the plugin at least

torn shuttle
#

consumers avoid issues like your armor stand being visible client-side on the first tick

left pine
#

where you give it

torn shuttle
#

I'm lazy and tired so here's just how I used consumers in this one class

LivingEntity livingEntity = (LivingEntity) spawnLocation.getWorld().spawn(spawnLocation,
                customBossesConfigFields.getEntityType().getEntityClass(),
                entity -> applyBossFeatures((LivingEntity) entity));
#

this makes sure that everything you set is set before the entity spawns, at least events-wise

crisp steeple
#

oh i didnt know spawn could be used like that

#

interesting

torn shuttle
#

it also avoid client desyncs

#

and avoids plugins messing with your baby before it's ready for prime time

#

because between the spawn line and the line where you set it as invisible the whole creature spawn event runs and your entity might get modified

crisp steeple
#

yea

torn shuttle
#

or yeeted and deleted as the kids say

crisp steeple
#

i always sort of just default to using spawnEntity

#

never really gave the other methods a chance

arctic pawn
#

Nice tip, thanks!

torn shuttle
#

tbf it took me like 4 fucking years of spawning quite literally millions of entities before I even learned about this

crisp steeple
#

lol

torn shuttle
#

actually probably closer to billions

arctic pawn
#

That's pretty much how it goes lol

#

You stick to what you know until you just happen to find something better

torn shuttle
#

yeah and it really sucks when you know nothing

twin obsidian
#

I am new to this, is there any way I can make a player use an item?

wispy bridge
#

Elaborate

arctic moth
#

how would i change an existing mob's ai?

#

trying to make certain mobs hostile

torn shuttle
twin obsidian
# wispy bridge Elaborate

I want to make a plugin that boosts an elytra when the player sneaks and I want it to force the player to use a firework.

wispy bridge
#

Ah, XY problem

torn shuttle
#

modifying AI is NMS territory, we don't go there

wispy bridge
#

You just want to add velocity to the player

arctic moth
wispy bridge
#

NMS is a thing

torn shuttle
arctic moth
#

ik

torn shuttle
#

also

#

not someone

#

several people have

twin obsidian
torn shuttle
#

and several people abandoned it too

wispy bridge
#

Set their velocity to their current velocity + Whatever offset

arctic moth
#

does deleting the world reset the maximumnodamageticks of a player?

twin obsidian
wispy bridge
#

No

young knoll
#

.multiply

torn shuttle
#

what's 1

#

in 3d space

#

get up from your chair and please move 1

wispy bridge
#

Use methods from the vector to do operations

twin obsidian
wispy bridge
#

If you want to use 1 value, multiply is the way to go, if you want to add it relative to 3d space, use add

wispy bridge
twin obsidian
#

Yeah, I was trying to make a joke of it

#

Thanks!

torn shuttle
#

1 != 1

twin obsidian
wispy bridge
shrewd solstice
#
        at org.bukkit.plugin.messaging.StandardMessenger.validatePluginMessage(StandardMessenger.java:535) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer.sendPluginMessage(CraftPlayer.java:1274) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at dcg.npplugin.com.commands.CommandHub.onCommand(CommandHub.java:37) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        ... 19 more```
wispy bridge
#

Just an FYI

twin obsidian
#

Yeah, 1 was just an example number

crisp steeple
shrewd solstice
#

theres no null il my commandhub.java

wispy bridge
crisp steeple
#

I suppose the only other option then is that the console is lying for no reason

wispy bridge
#

?di

undone axleBOT
wispy bridge
#

@shrewd solstice

shrewd solstice
#

player.sendPluginMessage(main, "BungeeCord", out.toByteArray());
the probleme is the main and in the first line of my Command there's
private main main;

wispy bridge
#

Your Main classname is lowercase?

#

Bad practice if so

delicate lynx
#

don't name your main class main

shrewd solstice
#

lol

wispy bridge
delicate lynx
#

it's bad practice in a plugin

wispy bridge
#

Thats fair, I think they should correct the capitalization issue though

delicate lynx
#

?main

crisp steeple
shrewd solstice
#

this is not the case... i juste want to fix my /hub problem

#

yes

wispy bridge
#

Where?

#

Can you send a code snippet?

shrewd solstice
#
    public static Main instance;```
delicate lynx
#

does instance ever get set

wispy bridge
#

Thats not setting the variable

#

Thats defining it

shrewd solstice
#

ok so how i do it

delicate lynx
#

....

wispy bridge
#

Your onEnable method

crisp steeple
#

instance = this;

shrewd solstice
#

my Main.java

package dcg.npplugin.com;

import org.bukkit.plugin.java.JavaPlugin;

import dcg.npplugin.com.commands.CommandFly;
import dcg.npplugin.com.commands.CommandHub;
import dcg.npplugin.com.commands.CommandNick;
import dcg.npplugin.com.commands.CommandSpeed;
import dcg.npplugin.com.commands.CommandUnnick;
import dcg.npplugin.com.commands.CommandVanish;

public class Main extends JavaPlugin{
    public static Main instance;
    
    @Override
    public void onEnable() {
        instance = this;
        getServer().getPluginManager().registerEvents(new Listener(), this);
        getCommand("nick").setExecutor(new CommandNick());
        getCommand("unnick").setExecutor(new CommandUnnick());
        getCommand("fly").setExecutor(new CommandFly());
        getCommand("speed").setExecutor(new CommandSpeed());
        getCommand("vanish").setExecutor(new CommandVanish());
        getCommand("hub").setExecutor(new CommandHub());
        getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
    }
    
}
crisp steeple
#

and in CommandHub?

shrewd solstice
#

i juste copy code ':)

#

import java.util.ArrayList;
import java.util.List;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;

import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;

import dcg.npplugin.com.Main;





public class CommandHub implements TabExecutor {
    private Main main;
    @Override
    public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
        
        List<String> list = new ArrayList<>();
        return list;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        Player player = (Player) sender;
        
        if (args.length == 0) {
            ByteArrayDataOutput out = ByteStreams.newDataOutput();
            out.writeUTF("Connect");
            out.writeUTF("hub");
            player.sendPluginMessage(main, "BungeeCord", out.toByteArray());
        }
        else {
            player.sendMessage("unknow args number");
        }
        return true;
    }
}
#

so idk what i did x)

wispy bridge
#

Oh, thats your first issue

delicate lynx
#

you need to pass the main instance to this class

wispy bridge
#

Learn Java first, so you can diagnose your own problems correctly

crisp steeple
#

?learnjava

undone axleBOT
wispy bridge
#

Copy pasting code will not get you anywhere, itll just make you more confused

arctic pawn
#

Well to be fair copy and pasting code and taking other code and learning from it are different

shrewd solstice
#

im alredy confused

arctic pawn
#

If he's just straight up copying and pasting without taking anything from it then that's an issue

wispy bridge
#

They seem to have just copy pasted and not looked into it at all

crisp steeple
#

also if you're making a lot of commands that involve bungeecord, you should really make it a bungee plugin instead

arctic pawn
shrewd solstice
#

when i copy i, in first place, try to understand x)

wispy bridge
shrewd solstice
#

i juste want to send my player to the hub

crisp steeple
#

well in that case, just add a dependency injection into the constructor and set the plugin there

shrewd solstice
#

????

#

how

delicate lynx
#

?di

undone axleBOT
delicate lynx
#

good luck!

wispy bridge
#

Again again, I highly recommend learning some more basic Java before tackling something like this, you seem confused about some common Java aspects as a language and not necessarily plugin development

young knoll
#

Which you can’t do

#

Spigot will say no

wispy bridge
wispy bridge
#

If you really do want to keep using the static reference, you can just do Main.instance

#

To get the instance of your plugin

#

Or at the very least make a getter, (If you know how to do that)

delicate lynx
#

he doesn't

wispy bridge
#

Yeahhhhh

wispy bridge
#

Thats how you can get the static instance of your plugin

shrewd solstice
#

my first language is not English

delicate lynx
#

create an instance of your plugin, pass it around to the other classes or use a getter

wispy bridge
delicate lynx
#

don't spoon feed him

wispy bridge
#

They clearly do not intend on learning basic Java at all

#

I mean, it doesnt make much difference

tender shard
#

to everyone having popular free plugins that rely on certain links containing spigotmc links to be present: You'll have to put the "https://" stuff into methods, otherwise aternos replaces those strings with "null" and you'll get NPEs......

wispy bridge
#

Haha thats ridiculous

tender shard
#

it is

wispy bridge
#

Aternos.....

tender shard
#

aternos sucks

shrewd solstice
#

HOLLY F***ing SH** IT WORK (srry for the caps im so happy all work thank you a lot)

wispy bridge
shrewd solstice
#

yeah for you i'll try

wispy bridge
#

I feel so special, thank you

shrewd solstice
#

😄 im so happy i lose like 2 hours in searching on google

#

but i think google dont want to be my friend x)

arctic moth
#

how do you paste a structure with the structure's nbt file from a structure block

wispy bridge
arctic moth
#

but ik this sounds dumb, but how do i get the file? do i put it in resources or smth

wispy bridge
#

getStructureFile()
#

?

arctic moth
wispy bridge
#

Im a bit confused as to what you're trying to do

arctic moth
#

i already have a structure file saved, i just want to know how to access it in any server

granite owl
#

wdym

arctic moth
#

do i put it in resources or smth?

wispy bridge
#

I mean, you can? Just get the file through your plugin

wispy bridge
#

The .nbt file already exists within your server in some directory?

#

Or are you trying to embed the nbt file into your jar

#

Ohhhh I see, okay you're gonna need some funky googling for that

#

You can put it in resources, you can get files in your jars resources via, a couple of ways

#

Googles your friend here

young knoll
#

If it’s in the plugin, you can just use Plugin.getResource

wispy bridge
#

Oh thats nice

crisp steeple
#

stuff like this really makes me regret making plugins on 1.8

#

i had to make an entire seperate strucutre system that was incredibly horrible to maintain

shrewd solstice
#

how can i detect the name of the server in the bungee?

crisp steeple
#

<serverinfo>.getName();

torn shuttle
#

what the fuck am I even looking at

        int time = (int) ((restockTime - Instant.now().getEpochSecond()) * 20);
        Developer.message("time = " + time);
        Developer.message("Restock time: " + restockTime);
        Developer.message("Instant: " + Instant.now().getEpochSecond());
        Developer.message("Formula: " + restockTime + " - " + Instant.now().getEpochSecond() + " * 20");

how is this value positive? does casting to int mess with it?

#

wait what's the int limit again

arctic moth
#

so i have my file at this directory but when i do endcrystalcage = this.getServer().getStructureManager().loadStructure(new File(getClass().getResource("endcrystalcage.nbt").getFile())); it can't find the file

young knoll
#

Just use Plugin.getResource

arctic moth
#

thx

stuck flax
#

what is the event for when a message is sent (bungeecord api)

sage dragon
#

Normally you have to wait for blocks like furnaces to finish.

Is there any way to manipulate the tick speed for one specific block? (Preferably without nms)

torn shuttle
#

yep it was me being dumb and using int when it should've been long

sage dragon
waxen plinth
#

I think I'm not understanding how CompletableFutures work correctly

#
        CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            return "abc";
        });
        future.thenRun(System.out::println).get();
        future.thenApply(String::toUpperCase).thenRun(System.out::println).get();```
#

I thought this would wait 1 second, then print abc followed by ABC

#

But there is no output when running this

#

There is output if I do System.out.println(future.get());

young knoll
#

Doing future.get is dumb though

waxen plinth
#

I know, since it makes it blocking

young knoll
#

Mhm

waxen plinth
#

Defeats the purpose of having it run async

#

But that's not what I was testing here

#

I added .get() to both because when I saw no output without using it, I figured maybe it was lazy and would only be run if get was called

#

What is going on here? Why is nothing printed?

young knoll
#

No idea

#

I’ve only ever really used thenAccept

waxen plinth
#

Oh

#

Wait yeah I'm dumb

#

Nothing is being printed because I'm doing thenRun instead of thenAccept

#

I'm passing a runnable

#

It takes no args and just prints a newline

#

🤦

#

So they do work how I expected

#

Then the issue I'm having makes no sense

arctic moth
#

I'm trying to put a structure on each end pillar, but how do I get the location for the top of each one?

tender shard
#

@waxen plinth have you ever used minimessage/adventure?

waxen plinth
#

No

tender shard
waxen plinth
#

Why

tender shard
#

oh I was just wondering because you like to do library stuff

#

and minimessage is a damn fine api

wet breach
pastel wraith
#

once generated it is not findable simple. you must scan

#

u can do gen tho

wet breach
#

there is another method

#

assuming the end dragon hasn't been defeated and what not, just locate the ender crystals

#

or just locate the obsidian

arctic moth
wet breach
#

ender crystals sit on top of those, but they don't go away like ender crystals also ender crystals are entities just fyi

arctic moth
#

Cuz I'm pretty sure the middle is 64

wet breach
#

grab a chunksnapshot

#

interate it for the one bedrock block

#

once found, that is one pillar

#

if it further helps

#

10 pillars generate

#

and in 43-block radius circle around the exit portal

#
    A 3-block radius pillar ending at y=76 (total of 1596 blocks of obsidian);
    A 3-block radius pillar with iron bars ending at y=79 (total of 1659 blocks of obsidian);
    A 3-block radius pillar with iron bars ending at y=82 (total of 1722 blocks of obsidian);
    A 4-block radius pillar ending at y=85 (total of 3145 blocks of obsidian);
    A 4-block radius pillar ending at y=88 (total of 3256 blocks of obsidian);
    A 4-block radius pillar ending at y=91 (total of 3367 blocks of obsidian);
    A 5-block radius pillar ending at y=94 (total of 5358 blocks of obsidian);
    A 5-block radius pillar ending at y=97 (total of 5529 blocks of obsidian);
    A 5-block radius pillar ending at y=100 (total of 5700 blocks of obsidian);
    A 6-block radius pillar ending at y=103 (total of 9167 blocks of obsidian).
#

there is all your heights 🙂

#

now just have to look between those ranges in a 43 block radius 😄

young knoll
#

Or something like that

noble lantern
#

You can also iterate over blocks in a chunk snapshot

#

oh

#

frost said that

true agate
#

Hello, how do I get this working in bungeecord? ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion();

#

Tried casting to ProxiedPlayer, but there's no such methods

chrome beacon
#

Yeah those are NMS methods they won't work on Bungee

true agate
#

Ah

#

Any other way to do it? except for using protocollib

chrome beacon
#

Protocollib doesn't work on Bungeecord

true agate
#

😦

chrome beacon
#

I recommend using Protocolize

#

Also why are you getting the version like that?

true agate
#

I want it for minimessages, to determine whether to send RGB formatting to player or legacy

chrome beacon
#

Why not use MiniMOTD?

true agate
#

It's not for MOTD

chrome beacon
#

Then ViaVersion and such should handle this

true agate
#

Oh, ok, thanks!

eternal needle
chrome beacon
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

noble lantern
#

also

#

?conventions

undone axleBOT
chrome beacon
#

Yeah was about to say

noble lantern
#

:p

lavish hemlock
#

Damn didn't know we had a command for that

chrome beacon
#

Which one?

vocal cloud
#

Conventions. I like. Some people name their classes coollistener

hybrid spoke
#

main

vocal cloud
#

main main = new main()

lavish hemlock
#

Name all of the main

vocal cloud
#

Next class name it main2

#

main3

lavish hemlock
#

maine

chrome beacon
#

pain

vocal cloud
#

Who needs an obfuscation plugin if you make your code unreadable

hybrid spoke
#

im an obfuscator myself

lavish hemlock
#

manual obfuscation go brrr

jade perch
#

Avoids all the hassle

vocal cloud
#

Yeah like the plugins you get from those plugin groups that crowdsource teenagers to write "plugins"

hybrid spoke
#

community project: everyone is allowed to PR 5 lines of code

jade perch
#

My five lines will be 0 width spaces

hybrid spoke
#

would be interesting to see what kind of project this would be

noble lantern
#

see what bullshit the spigot community comes up with

#

time to make this idea before someone else does

jade perch
#

I would probably make a maven library and import it

#

Then I could make an arbitrary amount of code with one line

hybrid spoke
modern vigil
#

Imagine it just installs a Trojan that mines bitcoin on ur server

noble lantern
#

well certain rules would have to be applied ofc

#

like declaration of classes construcors and methods dont count as lines, no libaries other than spigot

jade perch
#

Oh God

#

No acf

#

I'm out

hybrid spoke
#

lol, community project: you are allowed to write 20 lines of code, but deleting lines restores them.

noble lantern
#

we need to write out like a specific ruleset tbh

hybrid spoke
#

but arbitrariness is prohibited

noble lantern
#

and end goal in mind

modern vigil
#

Just delete all the contents of 20 files and you got 2k lines more

noble lantern
#

and prevent things like that ^

hybrid spoke
#

imagine a simple plugin as goal but it turns into minecraft2

hybrid spoke
noble lantern
#

ngl im really curious what people would create

#

would the plugin be a new essentials? skyblock plugin? no one knows

chrome beacon
#

Just write everything on one line and skip the line limit 🧠

jade perch
noble lantern
#

sec imma make like a ruleset rq bc this idea is good asf cipher

#
You are allowed to only commit {x} amount of lines of code in your lifetime
 - removing lines of code will restore the amount your able to commit
 - you cannot remove random code to restore your lines, there has to be valid reason for removal
 - You cannot put multiple lines of code onto one line (IE multiple if statements on one line, but having returns and variable declarations on one line is fine)
 - Class, Constructor, Variable, Method & brackets do not count torwards you total code count line
 - You cannot import any external libraries other than the Spigot API itself (NMS is fine)
 - You can endlessly replace lines of code, as long as there is valid reason the previous code there wasnt needed

quasi flint
#

🚨

hybrid spoke
#

remove those

 - You cannot put multiple lines of code onto one line (IE multiple if statements on one line, but having returns and variable declarations on one line is fine)
 - Class, Constructor, Variable, Method & brackets do not count torwards you total code count line
 - You cannot import any external libraries other than the Spigot API itself (NMS is fine)
#

i wanna die of boilerplate

#

see how creative people get

noble lantern
#

You really want people to add 200 lines of code on one singular line lmfao

#

the last two can prolly be removed but gonna make people mad lmao

#

specifically brackets and declarations counting as lines 🤣

#

You are allowed to only commit {x} amount of lines of code in your lifetime
 - removing lines of code will restore the amount your able to commit
 - you cannot remove random code to restore your lines, there has to be valid reason for removal
 - You can put multiple lines of code onto one line
 - Class, Constructor, Variable, Method & brackets DO count torwards your total line count
 - Imported libraries must be open source and linked in the readme.md
 - You can endlessly replace lines of code, as long as there is valid reason the previous code there wasnt needed
#

there

hybrid spoke
#

it is a project for cohesion

#

someone can make the methods

#

others can implement it

glossy venture
#

everyone writes one line per method

noble lantern
#

codebase would be aids

#

but thats a good idea

glossy venture
#

true

noble lantern
#

people could colaborate

glossy venture
#

or they could not

noble lantern
#

someone makes methods while others actually use them in logic

glossy venture
#

yeah

noble lantern
#

i feel bad for the person who makes the main class

#

there goes like 40% of your line count just doing that

#

okay cipher make the repo xd

#

see what plugin people make

hybrid spoke
#

i think we wouldnt find much contribution

noble lantern
#

constantly advertise it in here

#

"Hey {name} i see you havent contributed to {repo} you should commit something!"

hybrid spoke
#

randomly dropping "just changed something, fuck just got 3 lines left!"

noble lantern
#

only thing is

hybrid spoke
#

imagine someone wasting their lines on insulting people in a comment

noble lantern
#

managing peoples lines would be aids

#

LMAO

#

not sure how managing lines you go, maybe make people comment theyre github username next to said line

hybrid spoke
#

PR is a thing

noble lantern
#

yes but if someone removes someone elses code

hybrid spoke
#

that would be in a commit then

noble lantern
#

hmm fair enough

hybrid spoke
#

"Cipher" would even be a good name

#

since you won't understand the code anymore after 20 people commit

noble lantern
#

thats the point right?

lavish hemlock
glass mauve
#

how can I store a custom datatype in a persistent data container

chrome beacon
glass mauve
#

thanks, is it possible to create a data type, that can store any instance of a class? For example I have a class like Party and then store it inside a Player

chrome beacon
tardy delta
#

if i would have a Gun class with the methods canShoot and shoot, should i check in the shoot method that i actually can should or should i check that manually so the shoot method only has to handle the shooting self and not the checking?

hybrid spoke
tardy delta
#

probably a gun that needs to be charged

#

with bullets

#

not with a phone charger ._.

hybrid spoke
#

so how would it shoot if it's out of bullets

tardy delta
#

not

hybrid spoke
#

there you have your answer

tardy delta
#

;-;

#

i probably have to make two different methods

noble lantern
#

couldnt you just check canShoot inside shoot and return if canShoot is false

#

that way you only need to call shoot()

outer sorrel
#

is it safe to do config file reading/writing async? heard some bukkit/spigot stuff isnt safe to do async

chrome beacon
#

As far as I'm aware it's fine

outer sorrel
#

cool

sage dragon
#

Hey,

Is there a way to force tick a block without nms?

Like furnaces and crops

hybrid spoke
#

you can set the cooktime

buoyant viper
#

cooking crops

sage dragon
grim oak
#

How do I use PAPI with my (custom lang) config yml file, so if the text in one of the fields contains %vault_eco_balance% it uses PAPI to replace it when it sends the message to the user

dense geyser
#

is this the correct way to delete a world?

Bukkit.unloadWorld(world, false);
FileUtil.deleteRecursively(world.getWorldFolder());

(imagine FileUtil#deleteRecursively is a recursive directory deletion method) Is there anything else I need to be doing?

noble lantern
dense geyser
#

good point, thank you

noble lantern
#

you want to extract the placeholder from the config.yml too btw

#

split by strings and check if the arg[int] begins and ends with %

#

oh

#

you can just parse the whole string

grim oak
#

oh alright thanks!

noble lantern
#

PlaceholderAPI.setPlaceholders(player, string);

#

returns a string

gritty urchin
#

How to detect premium player on cracked server

noble lantern
#

hmmm

#

sec

#

you might need to use mojangs api

gritty urchin
#

to do what

noble lantern
#

IIRC there was a API endpoint for mojang that checked if a users name was paid, but it might of changed now with the recent migration to microsoft

#

here this plugin does it

#

you can check its source

gritty urchin
#

yeah I have looked at that plugin

#

can't find the part specifically

#

where it differentiates between cracked and premium

#

doesn't it run the server in a semi-online mode

gritty urchin
#

between cracked and premium

#

because a cracked player

noble lantern
#

servers either run in online mode or not

gritty urchin
#

can have a premium username

noble lantern
#

i forgot about that

#

in that case

#

there likely isnt a good way to do this

#

as mc clients dont send that data to the server

#

what are you trying to achieve?

gritty urchin
#

just differentiating between the two

#

so certain conditions apply to cracked

#

and premium players

#

on the server

noble lantern
#

yeah i dont beileve there is a way to do that tbh

#

maybe someone else may have an answer here though

vocal cloud
#

I mean the solution is to not allow cracked players on your server

noble lantern
#

^

gritty urchin
#

yeah not an option

#

not my server anyway

#

its for someone else

vocal cloud
#

Totally is an option.

gritty urchin
#

what about sending a player to a small premium server on join

#

via bungeecord or something

#

and if they connect

#

then register as premium and send to main server

#

and if they dont

#

register as cracked

#

would that work

noble lantern
#

it would require running your proxy in offline mode but honestly i dont really see a reason to do this

vocal cloud
#

When you're in offline mode you're in offline mode end of story

gritty urchin
#

i cant connect online and offline servers

#

?

noble lantern
#

nope

#

proxy decides that

#

if you really need this

gritty urchin
#

is there not some packet i can send

noble lantern
#

have a seperate server

gritty urchin
#

on a cracked server to differentiate

noble lantern
#

that in online

#

and when the player joins that server have a redis cache setup tht the cracked server has access to

#

well

#

nah

#

wouldnt work

#

security issue

gritty urchin
#

manually authenticate?

vocal cloud
#

You can't because there is no feasible way to tell if the person actually owns the account

noble lantern
#

^

vocal cloud
#

Unless you literally get them to sign in with their official MC account

gritty urchin
#

yeah but i mean cant i just immitate a premium server's authentication

vocal cloud
#

I'm sure if you wrote a huge spigot patch you could

gritty urchin
#

plugin based

#

on login

vocal cloud
#

This would be something that you'd have to change within spigot itself

noble lantern
#

you can setup a third party authentication where players can prove they have a premium account by joining a premium server but you would need to manually check each and every players request via a ticket on say, discord

gritty urchin
#

yeah that will take too long

vocal cloud
#

This is voided by the fact someone can just join the server with a random name that is an actual name of another player. Then when the official owner joins their account is taken

#

You can't fix this

#

you can't

#

So stop trying

gritty urchin
#

nah not rlly

#

can only accept cracked players who have unique names

vocal cloud
#

Yes exactly

#

So if someone cracked joins with TechnoBlade then the actual TechnoBlade can't join

gritty urchin
#

yeah but I can check before they join if their username is taken by a premium player

#

using mojang api

#

if so deny login

vocal cloud
#

You could. But that's a lot of usernames

gritty urchin
#

so theres no way i can differentiate

#

between cracked and premium

#

on cracked server

vocal cloud
#

You'd need a server with auth aka either write your own auth into spigot or make an auth server

noble lantern
#

not via a plugin no

#

auth server is your best bet

#

you can set it up to a discord bot too to automate authentication if you really needed that

gritty urchin
#

so can I not have a premium server feed into a cracked server

vocal cloud
#

No

#

The authentication doesn't translate

noble lantern
#

why not like

#

run the server in online mode?

#

and make people actually support the official release

vocal cloud
#

^

noble lantern
#

offline-mode is mainly for dev testing

gritty urchin
#

because this guy wants cracked

vocal cloud
#

Yeah well he's cracked

#

Honestly whenever someone comes to my server asking if it's cracked me and the gang start laughing at them. Tell them to buy MC.

gritty urchin
#

yeah im not asking whether server should run in online or offline mode

#

im asking if its possible

vocal cloud
#

You'd need a server that's online which would be it's own thing to authenticate them

gritty urchin
#

and communicate with the cracked server

#

to tell them they're premium

#

ok

vocal cloud
#

Using a database yes. However, this still doesn't solve your issue

#

People would still be able to take legit players names

noble lantern
#

Auth server -> Have player join -> on player join generate a code for them to use -> have a command to /link discord -> have a discord bot inside your plugin that sends them a DM if theyre in your server

Cracked server received code + username -> player authenticates with code from auth server -> have that player be able to overwrite the /login password set in case someone previously joined on theyre account

#

voila

#

youll need to link the auth codes with a database like mike said

vocal cloud
#

This still doesn't solve the issue that offline can steal online names

gritty urchin
#

yeah cant i just check as i said

#

on the cracked server

#

not that hard

noble lantern
#

it does because if someone tried to use that account they cant /login anymore

#

technically with this method

#

online player would steal cracked players accounts

#

which is fine

#

iirc AuthMeReloaded has an API to reset /login passwords

vocal cloud
gritty urchin
#

i dont have to authenticate

#

i can just check if a premium account

#

with the same name exists

#

if so deny entry

noble lantern
#

so if i join your server with the name notch

#

and you request notch to mojang api

#

its gonna come back as premium

gritty urchin
#

yes

noble lantern
#

you dont see the issue here?

gritty urchin
#

no

#

if your premium

noble lantern
#

but im cracked

#

and im setting my name to notch

gritty urchin
#

thats what im saying cracked players with premium names

#

are just not allowed

#

in the server

#

many other names to choose from

noble lantern
#

so you would need auth server like i explained above

vocal cloud
#

You'd have to get offline player every time someone joins which people could use to effectively DDoS the server

gritty urchin
#

i know

vocal cloud
#

they just need to pretend to join with hundreds of accounts and boom server offline

noble lantern
#

OfflinePlayer is pretty resource intensive

vocal cloud
#

And it still doesn't solve the problem

noble lantern
#

you could send the players name to mojang and if the account comes back as premium just kick them saying to change name

#

wait

#

no

gritty urchin
#

thats what i just said

noble lantern
#

theres really just not a good way to handle it

#

only way to do this is via using a auth server

hybrid spoke
#

just send in your login

vocal cloud
#

But how do you know it's a premium user unless they authenticate on a legit server

#

Which is just so much work

gritty urchin
#

thats what im saying

noble lantern
vocal cloud
#

Can you imagine joining hypixel and seeing some nonsense like that?

gritty urchin
#

if they join the cracked server

#

and their premium

#

or using a premium name

noble lantern
vocal cloud
#

You're going to kill interest in the server

gritty urchin
#

it will kick them

noble lantern
#

any other way simply isnt going to work

gritty urchin
#

and tell them to join the auth server if they're actually premium or change name

vocal cloud
#

I can't imagine the amount of players who'd hate to do the authentication game

#

Imagine needing to change name -> attempt to join -> name taken -> repeat

#

I'd just give up and not play your server

noble lantern
#

^

gritty urchin
#

not my server

vocal cloud
#

Yeah no shit

noble lantern
#

So tell the server owner this

#

have him come in here, well tell him the same thing

vocal cloud
#

You'd basically have to guess and check until you find a name that works

gritty urchin
#

yeah

noble lantern
#

:gunSelf:

#

i need that emoji

gritty urchin
#

you would

vocal cloud
hybrid spoke
noble lantern
#

pog ty

#

okay naw

#

yall hiding a server

#

invite

vocal cloud
#

Sometimes server owners don't know what's best for themselves shrug1

hybrid spoke
noble lantern
hybrid spoke
noble lantern
noble lantern
#

btw

#

check your thread

hybrid spoke
#

wait

noble lantern
vocal cloud
#

I have the best sticker

noble lantern
#

time to get a working discord rich presence for intellij too

vocal cloud
#

The server owner doesn't use the sticker slots so I stole them and they're mine

noble lantern
#

what plugin?

#

One i use just works either way

golden turret
#

if it is the rich presence

noble lantern
golden turret
#

you can simply ask to it to reload

noble lantern
golden turret
#

tools -> discord -> something related to reload

noble lantern
#

ah it loaded for him now

#

yes it does

golden turret
#

maybe you simply did not allowed that

noble lantern
golden turret
#

or

hybrid spoke
#

adjust it

golden turret
#

misconfig

hybrid spoke
#

in the settings

noble lantern
#

your not in the main class?

#

oh wait

#

i see now

vocal cloud
#

Name your class something that isn't main please

noble lantern
#

Main main = new Main();

vocal cloud
#

main main = new main();

noble lantern
#

no no

#

thats so much worse

#

noice

#

ahhh

hybrid spoke
golden turret
#

aaaaa

noble lantern
#

okay was about to say

golden turret
#

better

noble lantern
golden turret
#

main main = new main();
main.main(main);

vocal cloud
#

Should've built a base project at least

#

So that it's easier to contribute

noble lantern
#

im using up part of my 35 lines for this

#

better be grateful

golden turret
#

imagine

#

you setup a maven project

#

you lost your 35 lines

noble lantern
#

wym

#

that plugins godsend

golden turret
#

i prefer to use the intellij template thing

vocal cloud
#

if it didn't crash all the time that'd be great

golden turret
#

it is better

noble lantern
#

mine never crashes wtf

#

ive never had it crash in the years ive used it

golden turret
#

intellij template be like

noble lantern
#

i generated mine in between sending messages

hybrid spoke
noble lantern
#

^

hybrid spoke
#

or does it?

noble lantern
#

only actual lines of code

#

nah

hybrid spoke
#

technically its also lines of code

noble lantern
#

pom shouldnt count

#

because if it did

#

im already waaaay over

#

and i havent even written anything yet

#

this is already aids

#

wait

vocal cloud
#

final class

#

you scared of someone extending it kekw

noble lantern
#

wait

#

minecraft plugin did that

#

weird

#

not really you just remove final lmao

#

hell yeah 4 lines

#

31 more to work with

#

look

#

im saving lines

#

i gotta do what i gotta do

#

yes

#

thats the point kek

#

were likely gonna make some type of rule for that

#

something along the lines of no more than 200 or so chars per line

#

if someone wants to use 3 lines to create a class thats on them

#

not hard just name them what they do

#

seems fine to be but uh

#

DoubleOrNothing lmao

#

funny name

#

ohhh

#

i thought it was like a class for checking if something is a Double

#

can be useful so your not always parsing and catching NumberFormatException

#

tbh i thought it was a class that would return a parsed double or nothing (null)

#

seemed clever to me

#

i just saw something funny and focused on that lmao

noble lantern
#

Question about records: I know they cant extend classes but is there any other limitations of using record classes?

Is there any other "disadvantages" to using record classes?

golden turret
#

you cant create variables outside the constructor

#

you can only create static final variables

#

actually, not final

#

but it must be static

noble lantern
#

oh oof

#

okay thats kinda aids then

vocal cloud
#

They're immutable so you only use them as a record not as a mutable type

golden turret
#
public record MyClass(int var1) {
    private static int myVar;
}```
noble lantern
#

yeah no ty on both of those thens damn

#

@hybrid spoke my idea, its gone 😦

golden turret
#

records are pretty useful

noble lantern
#

Yeah i use them for api things currently rn, i was just wondering if i could use them so i didnt have to manually create constructors

hybrid spoke
noble lantern
#

indeed it would

#

btw guys

#

please consider contributing to Cipher project 🙂

hybrid spoke
#

good way of making the project attractive

dense geyser
#

how do I make console output colors? some other plugins do it but mine it just outputs §dName: instead of a colored 'Name:'. I'm concatenating the string using ChatColor.x + "Name:"

tardy delta
#

Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "No");

#

instead of using the logger

molten hearth
#

right so are we SURE there's no timed dialogue api cause this scheduling is kinda disgusting

golden turret
#

§ supremacy

dense geyser
#

only doing it to make variables look more obvious, so things like "yes"/"no"/"live" etc are coloured, nothing else

shrewd solstice
#

Dm07

golden turret
#

WizarldyBump17

dense geyser
#

u look bad :<

#

i prefer men

noble lantern
dense geyser
#

I have more men then u ❤️

noble lantern
#

and your string can just use &6hi

dense geyser
#

thank ❤️

#

not when you're a bottom

#

I accept being the beta

#

it is

#

I am the bitches 😎

tardy delta
#

so you consider yourself as being multiple people?

molten hearth
#

uhm I resorted to using this instead ```java
List<String> messages = new ArrayList<>();

        messages.add("Hey!");
        messages.add("You there, " + player.getName() + "!");
        messages.add("You're new around here, aren't you?");
        messages.add("Come here so that I can show you some jobs");

        scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
            @Override
            public void run() {
                if(messages.size() == 0) return;
                player.sendMessage(messages.get(0));
                messages.remove(0);

                Runnable r = this;

                scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
                    @Override
                    public void run() {
                        r.run();
                    }
                }, 20L);

            }
        }, 20L);```
tardy delta
#

lambda brrrr

molten hearth
#

sir we don't associate with lamas around here

tardy delta
#

😶

molten hearth
#

actually after seeing some lambdas in python two years ago I decided to never learn about lambdas

tardy delta
#

You're new around here, aren't you?

molten hearth
#

yeah

tardy delta
#

Come here so that I can show you some jobs

molten hearth
#

say no more

#

well

#

the player is gonna get kidnapped while picking a job hehe

tardy delta
#

ah i forgot the you there player.getName

#

what are you trying to do lol

#

that code looks weird

molten hearth
#

I just wanted delayed messages man

#

that dont look like this

tardy delta
#

why two runnables then?

molten hearth
#

well I was planning on using recursion but the issue with that is that whenever I called itself it didnt re-schedule itself it just executed itself immediately

jade grove
#

what in the flying flippety fuck are you trying to do, mister?

tardy delta
#

i guess you want to send all those messages with a one second delay in between them

molten hearth
#

yeah

tardy delta
#

Bukkit.getScheduler().runTaskTimer

#

take a look at that

molten hearth
#

will do ty

tardy delta
#

iirc that is the name

#

?scheduling

undone axleBOT
tardy delta
#

yesh

molten hearth
#

oh yeah thats much better

#

that is indeed less cursed

noble lantern
#

hey guys

#
package we.are.project.cipher;import org.bukkit.entity.Damageable;import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;import org.bukkit.event.entity.EntitySpawnEvent;import org.bukkit.plugin.java.JavaPlugin;
public class ProjectCipher extends JavaPlugin implements Listener {
    @Override public void onEnable() {this.saveDefaultConfig(); this.getServer().getPluginManager().registerEvents(this, this);}@Override public void onDisable() {}
    @EventHandler public void onSpawn(final EntitySpawnEvent event) {
        if (!this.getConfig().getStringList("DoubleHealthMobs").contains(event.getEntityType().name()) && !(event.getEntity() instanceof Damageable)) return;((Damageable) event.getEntity()).setHealth(((Damageable) event.getEntity()).getHealth() * 2);}}

Any ideas on how to make my code cleaner

tardy delta
#

auto formatting

#

smh

noble lantern
#

but less lines = faster?

#

brrrt

tardy delta
#

no

noble lantern
#

dont doubt project cipher

#

best plugin 2022 incoming

tardy delta
#

🥴

#

wait wha

noble lantern
#

yep

#

:))

tardy delta
noble lantern
#

to prevent people from putting 200 lines of code on one line

#

could use lambdas though

fading lake
#

is that it MUST have 3 semi colons, or <.3

#

fuck

noble lantern
#

oh wait

tardy delta
noble lantern
#

@hybrid spoke

tardy delta
#

nice begin

fading lake
#

must have 3 semi colons sounds so much better

#

String hello = "hi";;;

noble lantern
#

Its allowed to have up to 3 semicolons

fading lake
#

darn

noble lantern
#

so you can have one two or three haha

fading lake
#

what even is it lol

noble lantern
fading lake
#

im still confused lol, too many messages

noble lantern
#

i sent the repo check the readme.md for full description

#

basically each contributor can only have 35 lines of code

#

you can steal lines from people if you find a mistake they made in a sense

#

and let yourself have more lines to work with

fading lake
#

interesting

#

I shall commit soonTM

noble lantern
#

awesome! the more people involved i feel the more fun it will be :p

#

i wanna see devs get mad at each other for managing to steal lines from them lmfao

#

essentially all out war, and theres no end goal so you can essentially add into the plugin whatever you like

hybrid spoke
noble lantern
#

hahaha

#

String string = "";;;

#

omg you could be a dick

fading lake
#

I could

#

that is my intention

noble lantern
#

and just add extra semicolons on the end of your line

hybrid spoke
#

LOL

noble lantern
#

and force people to use a new line LMAO

fading lake
#

YES

#

OMG

#

YES

noble lantern
#

im so doing that

hybrid spoke
#

i mean

#

that brings in a little formatting

noble lantern
#

if the persons smart they could remove it

hybrid spoke
#

but thats fucking hilarious

noble lantern
#

but people may not think of it

hybrid spoke
#

oh yeah

fading lake
#

yea but is it a "reasonable change"

hybrid spoke
#

my dumbass would've just created a new line

noble lantern
fading lake
#

mmmmmmmm

#

x doubt

noble lantern
#

just dont remove peoples code all out like removing theyre whole system

hybrid spoke
#

i would accept it if it has anything to do with your change

fading lake
#

;-;

hybrid spoke
#

but we somehow have to count the lines

noble lantern
#

we should make contributers keep count of theyre own lines tbh

#

there can be a section for it

#

until we make some type of bot

tardy delta
#

i just read that whole thread lmao

noble lantern
#

its hilarious

hybrid spoke
#

or like a discord bot

#

after a commit "@X has X lines left"

noble lantern
#

not it for making that

hybrid spoke
#

with an epic voice

#

reminds me of the hungergames

noble lantern
#

HungerGit

#

GitGames

hybrid spoke
#

"KABOOM - 10 players left"

noble lantern
hybrid spoke
noble lantern
#

also changing entity max health is changed by using attributes smh

#

thats more lines to add

golden turret
#

you can use the deprecated method

noble lantern
#

i couullld

tardy delta
#

reject oop

noble lantern
#

hold on im creating a really aids way to do this without deprecated methods

#

also @hybrid spoke that could be a decent rule to spice things up

#

no deprecated methods

hybrid spoke
#

generify it more

#

"performance is a thing"

tardy delta
#

reflections 💀

hybrid spoke
#

feels like code golf

noble lantern
#

Objects.requireNonNull(((LivingEntity) event.getEntity()).getAttribute(Attribute.GENERIC_MAX_HEALTH)).setBaseValue(((LivingEntity) event.getEntity()).getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() * 2)

#

💀

#

even null checks too lets go

#

this is fuckin aids

#

but funny

hybrid spoke
#

imagine someone just requests a feature

#

and you have to do it with less lines as possible

#

lol giving away a certain amount of lines for successful implemented feature requests

#

as motivation

#

or more like salary

tardy delta
#

lines of code giveaway

#

the winner gets five lines

noble lantern
#

?giveaway run 3d 10 lines of code

React to enter

hybrid spoke
#

"follow us on instagram and like our latest picture to get a chance of winning 100 lines of code!"

tardy delta
#

kek

golden turret
last ledge
#

How do I make a region

#

similar to world edit

#

things

rough drift
#

yes

noble lantern
#

Why not use world edit api?

hybrid spoke
#

if we ever release this plugin

"idk exactly what this plugin does, my current stand is something in the direction of factions"

noble lantern
#

wait i thought this was an essentials remake

rough drift
#

I am speedrunning

#

remaking my LS plugin

hybrid spoke
#

literally speedrun the cipher project

rough drift
#

so far i spend 2 hours working on a single package of my core

#

so then i can start working on it

rough drift
hybrid spoke
granite owl
#

is the information if a player is an admin stored in the player file?

#

the actual info

noble lantern
noble lantern
#

just Player.isOp()

golden turret
#

i dont think so

noble lantern
#

ops are stored in ops.json

golden turret
#

at least there is the ops.yml

#

.jaon

noble lantern
#

oh is it yml

hybrid spoke
#

ah

golden turret
#

idk

tardy delta
#

json

granite owl
#

i use my own op system to set ops, and the server works fine with it

#

but its not written to the ops.json

hybrid spoke
#

so like your own permission system basically

tardy delta
#

reflections kek

granite owl
#

ya

#

but .setOp(...) works fine

#

also beyond server restarts

#

but the ops.json isnt touched

#

so the actual info must be stored somewhere welse

#

else

golden turret
#

then see the code of craftbukit

granite owl
#

its stored in the ops json and .setOp() accesses the api

#

to write to the ops file

#

however setting an offline player op seems to work by the api but to store the player incorrectly in said file

#

and then breaks the /deop autocomplete returning a null error

#

because the player name doesnt get stored

#

apparently

tardy delta
#

💀

granite owl
#
[
  {
    "uuid": "...",
    "name": "TheTimeee",
    "level": 4,
    "bypassesPlayerLimit": false
  },
  {
    "uuid": "...",
    "level": 4,
    "bypassesPlayerLimit": false
  }
]
``` The First is what happens when you .setOp(true) an OfflinePlayer instance who is on the player, the second if you do it to a player who is offline
#

then when the parser tries to read it again, it breaks

tardy delta
#

💀

granite owl
#

great answer

tardy delta
#

i know

magic raptor
#

I need some help bungeecord side, i need to check if player is banned in an specified subserver, how i'm supposed to check that?

granite owl
#

so how can i set a player op from an OfflinePlayer instance who is actually offline?

golden turret
#

store the bans in a global storage?

#

get the offline player and set op?

granite owl
golden turret
#

or save his uuid

granite owl
#

and it breaks the servers parser

golden turret
#

and when he joins, set the op

granite owl
#

hm

magic raptor
eternal oxide
#

Your second entry is missing the players name

golden turret
#

if a player tries to join in a server where he is banned

#

he not even see the login screen

#

so maybe there is something for that

granite owl
#

otherwise fills certain fields with null?

grim ice
#

z

#

anyways

hybrid spoke
#

z

grim ice
#
            assert worldName != null;
            World world = getServer().getWorld(worldName);
#

world is null

#

even though worldname aint null and it exists

#

is it cuz im importing static getServer() from Bukkit

tardy delta
#

right name?

grim ice
#

ye

crisp steeple
#

try printing out all of bukkit.getWorlds

#

see if your world name is on there

grim ice
#

well

#

intellij screams a lot

#

yea

#

i do that lol

#

it still screams

hybrid spoke
grim ice
#

i dont really care

#

fine i removed it

hybrid spoke
#

its not about the string

#

getWorld is insulting him

grim ice
#

lol

#

its insulting my honor

#

it told me to fuck my mother

hybrid spoke
grim ice
#

bro u seen this

#

ill do the same

#

LOL

#

@hybrid spoke lines of code can easily be abused

#

LOL

glossy venture
#

ok so i have

public class RecipeMatchTree implements NodeLike {

  // ...
  public interface NodeLike { 
    // ...
  }

  public static class Node implements NodeLike {
    // ...
  }

}
``` why is this giving me some weird `cyclic inheritance` error
granite owl
#

is there an onUnload() callback?

#

didnt find anything in the docs

last ledge
#

how do I make cuboid region

glossy venture
#

no its implementing NodeLike not itself

grim ice
#

NodeLike is a prt of "itself"

#

part*

grim ice
glossy venture
#

its static tho

grim ice
last ledge
glossy venture
grim ice
granite owl
#

or in this case after they've been unhooked

hybrid spoke
molten hearth
#

can I cancel a task from within itself?

#

I was originally gonna do java BukkitTask t = scheduler.runTaskTimer(plugin, () -> { t.cancel(); }, 20L, 20L); but that throws variable t might not have been initialized and I dont seem to have access to this.cancel() so is there another way or I should just call an external function to handle that

hybrid spoke
#

use BukkitRunnable

molten hearth
#

well that still has the same issue

#

oh I also get incompatible types: org.bukkit.scheduler.BukkitTask cannot be converted to int

#

guess I gotta use BukkitRunnable

#

rip

granite owl
#

okay so i store the offline players in ram now using a hashmap

#

ive calculated that per 10k accounts i use 0.85MB ram

#

i doubt thats gonna be a problem anytime soon

grim ice
#

ram is cool and all but its not persistent

granite owl
#

thats about yesterday