#help-development

1 messages · Page 1178 of 1

river oracle
#

Don't use AI hire someone or find an alternative

#

As I said earlier some people in services would probably do it for very cheap or even free

simple sentinel
#

Well, a lot of people use AI today to fix it, even if they don't know about it :/
The problem is that I'm brazilian and it's kinda difficult to find people that could do that service for me (and if they did, it would not be cheap to me)

river oracle
#

You shouldn't use AI to fix a problem you know nothing about good way to fuck things up

simple sentinel
young knoll
#

He has experience

#

He’s also horrible at coding and the AI keeps making code that looks just like his

simple sentinel
#

lol

worthy yarrow
simple sentinel
#

i think i already know the problem

#

and its not the code lol

peak depot
#

what sound you guys thinks is good for an alarm

slender elbow
#

alarm sound

peak depot
slender elbow
#

why not?

worthy yarrow
simple sentinel
worthy yarrow
#

A dm works if you don’t mind

young knoll
#

Maybe a bell sound

#

Bells are basically alarms

#

Or you could basically create your own sound with noteblocks

peak depot
#

is my math not mathing or why isnt it a box but a rectangle(from the center)

eternal oxide
#

it is a box

young knoll
#

Because it’s probably centred on a block location

#

Which is in the corner of a block

#

You told it to be a 4x10x4 box and that’s what you got

peak depot
peak depot
eternal oxide
#

as coll said a block.getX is the corner of a block

#

you are just counting wrong

peak depot
eternal oxide
#

the white block is the first block top right

river oracle
#

@young knoll Try out InventoryView builders or I'll ban you form spigotMC

neat wolf
#

Hi can someone help me with this error happening when i send packet to the player : ```java
ServerPlayerConnection connection = ((CraftPlayer) player).getHandle().connection;
connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc)); //(LINE 264)
connection.send(new ClientboundAddEntityPacket(npc, serverEntity));

#

1.21.1

blazing ocean
#

If so

#

you need to set a dummy connection

#

.

neat wolf
blazing ocean
#

well

#

its connection is null

#

so you need to set it to a dummy one

#

this

#

but honestly just use citizens lmao

neat wolf
blazing ocean
#

no?

#

you just need to set the npc's connection to that

neat wolf
#

oh i see

#

i will try ty

chrome beacon
#

Everyone do be making NPCs

#

I swear it's the most commonly asked question here

rough drift
#

teleportation to a world adds the entity to that world, but you can omit it to just set the position, you can also just add the entity to a single player and then it will only show for that player as long as you don't add it to the world*

chrome beacon
rough drift
#

which is basically sitting at the same level as mine

chrome beacon
#

true

#

but still they'd rather write their "own" code by copy pasting what we give them

rough drift
#

kekw

#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

peak depot
neat wolf
chrome beacon
#

That wasn't entirely directed towards you

peak depot
#

yeah so basicly its I want to protect a certain area and it works arround 3 times (block the blocks from being placed) and after that I just stops blocking them even tho I place it on the same block as before

chrome beacon
peak depot
#

?

chrome beacon
#

in the code

#

are they being sent

peak depot
chrome beacon
#

Is the "In protected area" message being sent

peak depot
#

and it worked 3 times before it broke and thats every time

chrome beacon
#

I don't think the issue is in the snippet you sent

#

There's a problem in one of the methods you're calling

inner mulch
#

are there map implementations that use arrays.hashcode for arrays?

eternal night
#

fastutils can be tweaked for that

inner mulch
#

whats that?

eternal night
#

Object2ObjectOpenCustomHashMap

#

tho idk if spigot exposes those

blazing ocean
#

average fastutil class nam

#

e

eternal night
#

but if you are on paper, the api exposes those

inner mulch
#

okay, thank you :)

eternal night
#
final Map<int[], String> map = new Object2ObjectOpenCustomHashMap<>(new Hash.Strategy<>() {
    @Override
    public int hashCode(final int[] o) {
        return Arrays.hashCode(o);
    }

    @Override
    public boolean equals(final int[] a, final int[] b) {
        return Arrays.equals(a, b);
    }
});
#

would be an example usage

peak depot
slender elbow
eternal night
#

but then you don't have an excuse to use fastutil

#

checkmate

slender elbow
#

you mean highmemoryusageutil

eternal night
#

Memory is cheap

slender elbow
#

it would be really funny, like REALLY funny, if it was purposely slower

slender elbow
eternal night
#

Well but you are the exception

slender elbow
#

true

peak depot
blazing ocean
#

Why did bro ping oliver

chrome beacon
#

They were probably trying to ping me kekw

eternal oxide
#

His fault for having a name starting with O

peak depot
young knoll
#

Is @NotNull still here

#

Guess not

eternal oxide
#

I used to ping him a lot

#

Never saw him speak though

analog basin
#

if Crops is deprecated in favour of BlockData, how do we get crop growth status?

slender elbow
#

Ageable

#

in the .block.data package, not the entity one

analog basin
#

Ty

slender elbow
#

uhh

#

you really should do the check before casting

#

if it isn't ageable like stone or whatever it'll blow up

analog basin
#

my bad

#

I've been distracted trying to figure out how to get the damn age of the blocks without Crops, I didn't think about that.

young knoll
analog basin
#

Can you tell that I haven't touched the spigot api in a long time and want to do things propperly :p

analog basin
#

Block grow events aren't firing at all.

#

or am I dumb

remote swallow
#

did you register it

analog basin
#

yes

round finch
#

@EventHandler?

analog basin
#

yes

remote swallow
#

show ur code

analog basin
#

I'm capturing player chat events though

slender elbow
#

the block will be a Block, not a BlockType

round finch
#

question why not broadcastmessage?

analog basin
analog basin
#

When I use .getMaxAge() I get interesting results. Same with getAge()

#

When I bonemeal a wheat block, it says 3 / 5 at it's max growth. But F3 shows 7.

valid basin
#

Is this allowed in my plugin?

        PluginDescriptionFile descFile = plugin.getDescription();

        boolean nameMatches = EXPECTED_NAME.equals(descFile.getName());
        boolean authorMatches = descFile.getAuthors().contains(EXPECTED_AUTHOR);
        boolean descriptionMatches = EXPECTED_DESCRIPTION.equals(descFile.getDescription());

        if (!nameMatches || !authorMatches || !descriptionMatches) {
            logMessage("§c[SGReborn] Plugin.yml verification failed!");
            disablePlugin(plugin);
            return false;
        }
        return true;
    }```
#

Essentially I want to be sure nobody modifies the plugin.yml of my plugin

analog basin
#

weird

#

when I try and get the block age, I can, but it's never accurate

#

It's like the events fire too fast

#

Apparently others have run into this

#

Yea, blockAge doesn't seem to work?

young knoll
#

But who cares if the name and authors are changed

remote swallow
#

i mean if they want to modify it, they can just remove that from the code

valid basin
#

I mean that's true. But I'll use some obfuscation that's compliant with spigotmc rules

#

I'll open src all my projects anyway

#

So you're probably right

young knoll
#

Mmm yes obfuscating open source projects

remote swallow
analog basin
#
public class CropGrowthListener implements Listener {

    
    @EventHandler(priority=EventPriority.HIGHEST)
    public void onBlockGrow(BlockGrowEvent event) {
        
        if(event.getBlock().getType() == Material.WHEAT) {

            Ageable blockAge = (Ageable) event.getBlock().getBlockData();
            Bukkit.broadcastMessage(blockAge.toString());
            
            if(blockAge.getAge() == 7) {
                Bukkit.broadcastMessage("block is fully grown, breaking");
                event.getBlock().breakNaturally();
            }

        }
    }
}```
eternal oxide
#

Unless you are writing commercial code don't bother with any protections or obfuscation.

analog basin
#

It never sees the block at it's full age.

eternal oxide
#

You are using teh Blockj so you are looking at teh OLD age

remote swallow
eternal oxide
#

You need to check the NewState

eternal oxide
analog basin
#

🙃

#

Ty

valid basin
# young knoll Uhh sure

One more question. Am I allowed to send user information about his server to me when he first installs the plugin for example? (If it's a premium resource) as a piracy counter-measure.

                                .addField("User: ", "https://spigotmc.org/members/" + ServerUtils.userID, true)
                                .addField("Unique Download Link:", ServerUtils.uniqueDLID, true)
                                .addField("Server IP: ", ServerUtils.getIPAddress(), true)
                                .addField("Server HWID:", ServerUtils.getHardwareId(), true)
                                .addField("Server Hostname:", ServerUtils.getHostName(), true)
                                .addField("Minecraft Version/Java Version:", ServerUtils.getMinecraftVersion() + "/" + ServerUtils.getJavaVersion(), true)
                                .addField("CurrentPlugins:", ServerUtils.getActivePluginsAsString(), true)
                                .addField("Server Operators:", ServerUtils.getServerOperators(), true));```
For example here
#

Or is that breach of ToS?

#

Just so I know

river oracle
#

just to show you how futile it is

valid basin
#

Sure

#

I'm aware it's futile

river oracle
#

and the futile struggles make it all that more satisfying to beat pepeLaugh

river oracle
#

so your fail safe would need to be the plugin booting as normal

valid basin
#

Point is people you don't directly know that when installing the plugin. I mean obviously it's easy to crack it. I was thinking of adding bytecode hash protection so I generate unique hash for an entire class and then if it's modified it doesn't load

#

But that doesn't work well with obfuscations

#

I've tried

river oracle
#

yeah I mean even if you add bytecode hash protect can just mixin to your classloader

remote swallow
#

idk what plugin ur trying to project here, but its probably not worth it

river oracle
#

or whatever protecting you use

valid basin
#

Yeah gl getting the hash right, because whatever you change inside the class will result in a different hash lol

#

But I gave up from that system anyways

#

It's too much work to perfect it

#

but for not much gain

river oracle
#

no matter the system you implement its probably not worth it 😉

#

you can use the actual productive counter measure of only offering support to those who have purchased your plugin, there are plenty of ways to do this.

#

want support? Buy the plugin

#

want to pirate? Don't expect support

valid basin
#

You think that'd be more beneficial than licensing system?

tardy pike
#

Hello everyone do you know where can i sell my services ?

valid basin
#

Or going into anti piracy measures

eternal night
#

Well, the people that wanna pirate will pirate, the people that wanna support you will

chrome beacon
#

^^

eternal night
#

The amount of people you'll manage to "convince" into buying something because you invest ttime into anti piracy matters is probably not that large

#

given they'll already be downloading the pirated jar from some scuffed forum

#

so there just need to be one guy that does the (somewhat) easy task of disabling whatever measure you dream up on

timid berry
#

is it possible for a spigot player to get the number of players online for another spigot server that is under the same bungeecord?

golden turret
#

hey guys, what is best: make docker download the files i want or have it already on the image?

eternal night
#

depends on the files

golden turret
eternal night
golden turret
#

makes sense

eternal night
#

The only files you generally don't wanna include in an image are those that are data or are so large/dynamic it doesn't make sense

eternal night
#

E.g. a Minecraft world or a llm model

golden turret
sly topaz
#

maybe give the option to download the full JDK too, since some plugins do expect the full thing to be there (even though, they shouldn't but shrug)

left jay
#

hey so I just updated my spigot build and my listeners broke
the listeners were to make the custom items immovable, and everything else works as intended, but everything related to the custom item listener isnt working, but the listeners from everything else in separate plugins are working fine, what did i do wrong here?

earnest girder
#

is it possible to spawn a snowball projectile and then change its texture to something like with customModelData?

#

including net.minecraft solutions

worldly ingot
#

Yes. ThrowableProjectile has a #setItem() method that accepts an ItemStack, which can hold custom model data

#

(and snowballs are throwable projectiles)

earnest girder
#

wow

#

that's amazing

worldly ingot
timid berry
#

why wont it print out online players even tho im on?

#

im trying to get it to print out every couple of secs the players that are online in that specific world

remote swallow
#

okay show how you are sending the message

timid berry
#

how do i send the msg?

remote swallow
#

show where you send the plugin message

timid berry
#

oh this

#

i sent the same ss twice mb

remote swallow
#

add debug messages

#

figure out what triggers and whats being sent

timid berry
remote swallow
#

okay so add a message to the listener

timid berry
remote swallow
#

maybe, sounds crazy

#

add it before your if statement

#

see if its recieveing anything, if it is what

left jay
#

why cant i paste in screenshots?

#
@EventHandler
    public void onPlayerDropAbilityItem(PlayerDropItemEvent event) {
        if (AbilityItems.isImmovable(event.getItemDrop().getItemStack())) {
            event.setCancelled(true);
        }
    }

    @EventHandler
    public void onInventoryClickAbilityItem(InventoryClickEvent event) {
        if (event.getClickedInventory() instanceof PlayerInventory) {
            ItemStack clickedItem = event.getCurrentItem();

            if (clickedItem != null && AbilityItems.isImmovable(clickedItem)) {
                if (event.getClick() == ClickType.SHIFT_LEFT ||
                        event.getClick() == ClickType.SHIFT_RIGHT ||
                        event.getClick() == ClickType.DOUBLE_CLICK ||
                        event.getClick() == ClickType.NUMBER_KEY ||
                        event.getClick() == ClickType.SWAP_OFFHAND) {

                    event.setCancelled(true);
                }

                if (event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY ||
                        event.getAction() == InventoryAction.PICKUP_ALL ||
                        event.getAction() == InventoryAction.PICKUP_HALF ||
                        event.getAction() == InventoryAction.PICKUP_SOME ||
                        event.getAction() == InventoryAction.PICKUP_ONE ||
                        event.getAction() == InventoryAction.PLACE_ALL ||
                        event.getAction() == InventoryAction.PLACE_SOME ||
                        event.getAction() == InventoryAction.PLACE_ONE ||
                        event.getAction() == InventoryAction.SWAP_WITH_CURSOR) {

                    event.setCancelled(true);
                }

                if (isContainer(event.getClickedInventory().getType())) {
                    event.setCancelled(true);
                }
            }
        }
    }
#

    @EventHandler
    public void onPlayerSwapHandAbilityItem(PlayerSwapHandItemsEvent event) {
        if (AbilityItems.isImmovable(Objects.requireNonNull(event.getOffHandItem()))) {
            event.setCancelled(true);
        }
    }

    @EventHandler
    public void onInventoryDrag(InventoryDragEvent event) {
        for (int slot : event.getRawSlots()) {
            Inventory inventory = event.getView().getInventory(slot);

            if (inventory != null && isContainer(inventory.getType())) {
                event.setCancelled(true);
                return;
            }
        }
    }

    @EventHandler
    public void onHotkeyAbilityItemIntoContainers(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked();

        if (event.getClick() == ClickType.NUMBER_KEY) {
            ItemStack item = player.getInventory().getItem(event.getHotbarButton());

            assert item != null;
            if (AbilityItems.isImmovable(item)) {
                event.setCancelled(true);
            }
        }
    }

    @EventHandler
    public void onAbilityItemInHeldHand(PlayerItemHeldEvent event) {
        int newSlot = event.getNewSlot();
        ItemStack item = event.getPlayer().getInventory().getItem(newSlot);

        assert item != null;
        if (AbilityItems.isImmovable(item)) {
            event.setCancelled(true);
        }
    }

    private boolean isContainer(InventoryType type) {
        return type == InventoryType.CHEST ||
                type == InventoryType.HOPPER ||
                type == InventoryType.BARREL ||
                type == InventoryType.SHULKER_BOX ||
                type == InventoryType.DISPENSER ||
                type == InventoryType.DROPPER ||
                type == InventoryType.FURNACE ||
                type == InventoryType.BLAST_FURNACE ||
                type == InventoryType.SMOKER;
    }
#

whatever this works ig

timid berry
remote swallow
#

do you register it

#

and by magical chance, are you trying to go spigot -> spigot

timid berry
remote swallow
#

plugin messaging goes spigot -> bungee or vice versa

#

you need to forward the message from bungee

timid berry
remote swallow
#

listen for it on bungee, figure out where to send it and there you go

timid berry
remote swallow
#

yes

#

sounds crazy, you can see how many people are on a server from bungee

timid berry
#

society

#

wait im just better off making a bungee plugin instead

remote swallow
#

yeah

thorny salmon
#

how to update the worlds in the server to the new version guys?
I have worlds in the server 1.19. I want to update to 1.21 but the worlds are not compatible. how to update the worlds to match the server version?

#

Can anyone help me please?

sullen marlin
#

They update automatically

#

What do you mean they're not compatible

buoyant viper
# timid berry

it seems a little counter intuitive to be checking if the player list is not empty only to then let ur supplier potentially return null

#

i see no reason to not just do Bukkit.getOnlinePlayers().get(0)

lilac dagger
#

There's an iterables that has a get first method?

#

That's nice

#

I assume the null is the default value

#

If it's not empty then it'll never return

hushed spindle
#

if the list is empty and you use get(0) it'll throw an IndexOutOfBoundsException, getFirst() will throw a NoSuchElementException if the list is empty

#

but if you stream the list you can use List#stream.findFirst().orElse(null) to make it return null (or some other default value) if the list is empty

lilac dagger
#

but he does the check for that

#

there's at least 1 element, get first will work in this case

wet breach
#

Makes no sense to make value null

lilac dagger
#

i assume there's no way to get first without a default value?

tribal quarry
lilac dagger
#

let me see

wet breach
lilac dagger
wet breach
#

But i guess making the default null is fine though because the method only runs if there is players

#

Therefore the default should not be used

lilac dagger
#

indeed

#

also, so sad that my plugins support 1.18+

#

this shows as a warning for beta to me

tribal quarry
# timid berry

could you try registering a new channel with different name? (rather than BungeeCord), and try sending the message through it?

#

wait

lilac dagger
#

i'm not sure why this first line is like this

#

shouldn't it be BungeeCord if you're using Bungeecord?

timid berry
tribal quarry
#

just do this

out.writeUTF("PlayerCount");
out.writeUTF("pvp");
sly topaz
#

not really

timid berry
sly topaz
#

if you are using bungeecord built-in channels, then you can use bungeecord, however you can pass anything you want there

wet breach
#

And javier beat me to it

tribal quarry
lilac dagger
#

nah, the output should be just
out.writeUTF("PlayerList");
out.writeUTF("pvp");

tribal quarry
#

but it seems like there is no output of "subchannel" when he tried to print

tribal quarry
lilac dagger
#

did he tried to print the subchannel without the check?

timid berry
#

It’s okay

#

The problem is

#

That I don’t have a bungee plug-in

#

Or something like that

tribal quarry
lilac dagger
#

you don't need a bungee plugin for this

tribal quarry
#

you dont need

timid berry
tribal quarry
# timid berry That I don’t have a bungee plug-in
  @Override
  public void onEnable() {
    this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
    this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
  }

  @Override
  public void onDisable() {
    //make sure to unregister the registered channels in case of a reload
    this.getServer().getMessenger().unregisterOutgoingPluginChannel(this);
    this.getServer().getMessenger().unregisterIncomingPluginChannel(this);
  }

You have to get them both registered, both input and output message channels

lilac dagger
timid berry
tribal quarry
lilac dagger
#

and the subchannel should be PlayerCount

tribal quarry
tribal quarry
lilac dagger
#

yup this is it

timid berry
#


public final class OnlineCounter extends JavaPlugin implements Listener, PluginMessageListener {

    @Override
    public void onEnable() {
        this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
        this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);

        this.saveDefaultConfig();
        // Plugin startup logic
        System.out.println("DiscordBot-counter by Zarif enabled");
        this.getServer().getPluginManager().registerEvents(this, this);


        new BukkitRunnable() {
            public void run() {

                if(Bukkit.getOnlinePlayers().size() > 0) {
                    System.out.println("more then 1 online");
                    ByteArrayDataOutput out = ByteStreams.newDataOutput();
                    out.writeUTF("Zarifsigmachannel");
                   out.writeUTF("PlayerCount");
                    out.writeUTF("lobby");
                    Player player = Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
                    System.out.println(player.getName());
                    player.sendPluginMessage(OnlineCounter.this, "BungeeCord", out.toByteArray());                }







       }
        }.runTaskTimer(OnlineCounter.this, 0, 20);
    }



    @Override
    public void onDisable() {
        System.out.println("Goodbye! -Zarif");

    }

    @Override
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {

        ByteArrayDataInput in = ByteStreams.newDataInput(message);
        String subchannel = in.readUTF();
        System.out.println(subchannel + " " + channel );
        if (!channel.equals("BungeeCord")) {
            return;
        }

        if (subchannel.equals("Zarifsigmachannel")){
            String server = in.readUTF(); // Name of server, as given in the arguments
            int playercount = in.readInt();
                System.out.println(playercount);

        }
    }
}



#

this is my full code

lilac dagger
#

Zarifsigmachannel replace it with PlayerCount

#

move subchannel bellow the bungeecord channel

timid berry
#

it is below?

lilac dagger
#

you'll get an error if it's not a utf

#

subchannel should be below the !channel.equals BungeeCord

timid berry
#

u mean inside that if statement?

lilac dagger
#

no

timid berry
lilac dagger
#

System.out.println(subchannel + " " + channel );
if (!channel.equals("BungeeCord")) {
return;
}
String subchannel = in.readUTF();
like this

timid berry
#

oh so just remove it?

tribal quarry
#
String subchannel = in.readUTF();

dont call this before checking the channel equals to BungeeCord, if you do that, and another type of message is sent that doesn't have UTF in its first element, it throws an exception

lilac dagger
#

just move it below

timid berry
#

like this?

lilac dagger
#

wait a sec

timid berry
#

@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {

    ByteArrayDataInput in = ByteStreams.newDataInput(message);
    String subchannel = in.readUTF();
    System.out.println(subchannel + " " + channel );
    if (!channel.equals("BungeeCord")) {
        return;
    }

        String server = in.readUTF(); // Name of server, as given in the arguments
        int playercount = in.readInt();
            System.out.println(playercount);

}

}

tribal quarry
# timid berry
        String subchannel = in.readUTF();
        System.out.println(subchannel + " " + channel );

move these two, under channel.equals(BungeeCord) statement

lilac dagger
#

@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {

    ByteArrayDataInput in = ByteStreams.newDataInput(message);
    if (!channel.equals("BungeeCord")) {
        return;
    }
    String subchannel = in.readUTF();
    System.out.println(subchannel + " " + channel );

    if (subchannel.equals("PlayerCount")){
        String server = in.readUTF(); // Name of server, as given in the arguments
        int playercount = in.readInt();
            System.out.println(playercount);

    }
}
#

like this

timid berry
#

i see

#

okay

lilac dagger
#

nvm, you did it

timid berry
#

public final class OnlineCounter extends JavaPlugin implements Listener, PluginMessageListener {

@Override
public void onEnable() {
    this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
    this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);

    this.saveDefaultConfig();
    // Plugin startup logic
    System.out.println("DiscordBot-counter by Zarif enabled");
    this.getServer().getPluginManager().registerEvents(this, this);


    new BukkitRunnable() {
        public void run() {

            if(Bukkit.getOnlinePlayers().size() > 0) {
                System.out.println("more then 1 online");
                ByteArrayDataOutput out = ByteStreams.newDataOutput();
                out.writeUTF("PlayerCount");
                out.writeUTF("lobby");
                Player player = Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
                System.out.println(player.getName());
                player.sendPluginMessage(OnlineCounter.this, "BungeeCord", out.toByteArray());                }
        }
    }.runTaskTimer(OnlineCounter.this, 0, 20);
}



@Override
public void onDisable() {
    System.out.println("Goodbye! -Zarif");

}

@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {

    ByteArrayDataInput in = ByteStreams.newDataInput(message);
    if (!channel.equals("BungeeCord")) {
        return;
    }
    String subchannel = in.readUTF();
    System.out.println(subchannel + " " + channel );

    if (subchannel.equals("PlayerCount")){
        String server = in.readUTF(); // Name of server, as given in the arguments
        int playercount = in.readInt();
        System.out.println(playercount);

    }
}

}

lilac dagger
#

try it out

#

make sure you're online for this to work

timid berry
#

yah one sec

#

oh it works thanks!

lilac dagger
#

there you go 😄

#

enjoy programming

timid berry
#

thank you!!!!

#

time to sleep

lilac dagger
#

no problem

timid berry
#

i shall get a good nights rest

#

thanks agian

lilac dagger
#

take care

#

there's one more improvement that i really like

#

@timid berry this looks a bit more clean

#

i think bukkit runnable has been superseeded since the introduction of functional programming

#

this looks a lot cleaner to me

rough drift
#

Hey chat I got a question for you

if I edit an item in a player's inventory it will update right?

#

I'm not crazy

pseudo hazel
#

yes?

#

why wouldnt it

#

there is no need to call updateInventory or whatever

rough drift
pseudo hazel
#

wdym

#

well yeah

#

but its synced dont worry

rough drift
#

👍

#

did it

thorny salmon
# sullen marlin What do you mean they're not compatible

I mean when I put worlds from lower version into Servers from higher version they usually crash the Server or some other problem that I don't know. I don't know how to say it but some chunks have display errors or something like that.

#

sorry if my english is not good. i am learning and will try harder to improve

umbral ridge
#

Yeah

#

try to use multiverse plugin to import worlds

thorny salmon
umbral ridge
#

Maaybe

thorny salmon
#

I did some research and found --force update.
I'm not sure if it's okay to apply.

smoky anchor
quaint mantle
#

Anyone familiar with shading a plugin?

#

With this one, I get the unsupported Unsupported class file major version 65 error

young knoll
#

Lower the java version

quaint mantle
#

I've tried that as well

#

Similar error

young knoll
#

What version did you try

#

And what minecraft version is the server

quaint mantle
#

17

#

And 1.21

young knoll
#

17 should work

quaint mantle
#

Unsupported class file major version 61 That's the error

young knoll
#

Where are you getting the error, on the server or when building

chrome beacon
#

Update your shade plugin

quaint mantle
#

What's the latest version?

chrome beacon
#

3.6.0

quaint mantle
#

That seems to have fixed the error

#

How do I know if I am shading the plugin in the right way?

chrome beacon
#

A jar file is just a zip

#

So you can open it like one and see the files inside

#

You might need to rename it to get windows to detect it as such

quaint mantle
#

Am I supposed to be looking for a class?

chrome beacon
#

Yeah look for the classes

young knoll
#

Can windows just open jars as zips?

#

I’ve been using 7zip

chrome beacon
#

It can

#

but you need to rename them to zip first

young knoll
#

Ah, lame

quaint mantle
#

I use an online decompiler 😭

lilac dagger
#

just install 7zip 😦

quaint mantle
quaint mantle
lilac dagger
#

yeah but with 7zip you can modify the jar file

chrome beacon
#

tbh I just rename it to a zip if I need to do so

#

Not that often

young knoll
#

That’s like 4 extra buttons

quaint mantle
#

^

chrome beacon
#

If I just want to look at the contents I can do so in Intellij

pliant topaz
#

I use winrar personally

sly topaz
#

7zip is faster so I use that

sly topaz
#

maybe I just notice it since I have a shit pc lol

chrome beacon
#

It's slow

blazing ocean
#

jar xf be like

pliant topaz
chrome beacon
#

I believe it tries extract the entire thing to temp

#

before opening it

pliant topaz
chrome beacon
#

For plugins though it works good enough

blazing ocean
#

unzip be like

spice oasis
#

is it allowed to upload a paper plugin to spigotmc, or do i need to change the code so that it's compatible?

chrome beacon
#

It needs to be compatible with Spigot

spice oasis
#

ok thanks

sly topaz
# blazing ocean `jar xf` be like

too bad eza doesn't support piping non-existing paths, otherwise you could just do jar tf jar.jar | eza --icons --tree --sort=type -L5

#

there was a pr to support inspecting archives but it got nowhere it seems

blazing ocean
#

jar tf lol

sly topaz
#

it does sound funny though now that you mention it lol

spice oasis
#

do i need to use the meta of the item to access the PDC?

valid basin
# eternal night The amount of people you'll manage to "convince" into buying something because y...

So you think it's just best to completely get rid of any way to do anti-piracy? Also is this system compliant with spigotmc rules? If someone can tell me since I'm not actively shutting down server. I'm just sending info to myself.

                                .addField("User: ", "https://spigotmc.org/members/" + ServerUtils.userID, true)
                                .addField("Unique Download Link:", ServerUtils.uniqueDLID, true)
                                .addField("Server IP: ", ServerUtils.getIPAddress(), true)
                                .addField("Server HWID:", ServerUtils.getHardwareId(), true)
                                .addField("Server Hostname:", ServerUtils.getHostName(), true)
                                .addField("Minecraft Version/Java Version:", ServerUtils.getMinecraftVersion() + "/" + ServerUtils.getJavaVersion(), true)
                                .addField("CurrentPlugins:", ServerUtils.getActivePluginsAsString(), true)
                                .addField("Server Operators:", ServerUtils.getServerOperators(), true));```
eternal night
#

Tho to note, I don't moderate that forum not a forum staff lol

valid basin
#

so I removed that entirely

quaint mantle
#

guys

mortal vortex
quaint mantle
#

im newbie on plugins develop

valid basin
quaint mantle
#

who can fix for me? (1 bug i think so easy with u)

valid basin
#

actually I'll just surround it in try catch block

#

and make it execute even if it fails

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

quaint mantle
smoky anchor
#

bruh-

quaint mantle
smoky anchor
#

what

quaint mantle
smoky anchor
mortal vortex
#

@quaint mantle I don't do DMs, sorry.

  1. I can't see a bug. That squiggle could be a number of things, such as an unused import (though that's normally grey).
  2. I don't see how ImageIO is in any way related to Spigot.
smoky anchor
#

ye, those are just warnings that you have unused import

smoky anchor
#

hover over it with cursor and you'll see what it tells you

#

tip: do that whenever you see a squigly line

mortal vortex
quaint mantle
smoky anchor
#

sometimes ppl don't come here with spigot questions, its fine if this chat is dead I say

quaint mantle
#

i join to server for find 1 person can help me

mortal vortex
quaint mantle
#

;-;;

#

ya

smoky anchor
#

OH-

mortal vortex
#

How do you write enough code to have that many dependencies, yet not know what that squiggle means?

#

Do you know Java? Or is this copied?

quaint mantle
#

that is code of file src from my friend;-;;

#

and i stole it

smoky anchor
#

🚓

quaint mantle
#

thanks for advice bro;-;;

mortal vortex
#

All good.

valid basin
#

I recommend you trying to rewrite that code yourself instead just copying pasting if you want to learn. That's my advice

mortal hare
#

i love oracle

worthy yarrow
#

Or learn the language before an api

mortal hare
#

no, really i love when my university tries to push an ORACLE APEX as a solution

#

its shit really

#

probably they've got a good offer from oracle to advertise their products

valid basin
eternal oxide
#

I stopped recomending Oracle when they tried to copyright an API

wet breach
#

not sure what you are on about

spice oasis
#

alternatives for PlayerArmorChangeEvent?

wet breach
#

The contention it came down to was the naming of some api methods where it was too generic of a name

wet breach
#

it is protected by copyright

#

just the generic method names are not

#

If you are that confident that it is indeed not at all protected, then lets see you copy it and freely distribute it?

eternal oxide
#

By a 6-2 vote, the nation's highest court held that Google's copying of Oracle's Java API was fair use.

wet breach
#

the naming

#

read the court docs

#

otherwise don't throw some news article at me

#

I actually followed that case

eternal oxide
#

Try reading it instead of being rude

wet breach
#

it came down to the names

wet breach
#

news articles are not what define the case, the court documents out lines specifically what was at issue and what was not. And really it came down to naming conventions specifically the date utility methods.

#

anyways, Oracle owns the API and their rights over the api were not stripped

eternal oxide
#

There were two questions put before teh court but they only chose to answer teh second (not the copyright part but fair use).

#

So my original statement stands "I stopped recomending Oracle when they tried to copyright an API"

wet breach
#

right fair use means were you allowed to use it the way you were using it, not that the owner doesn't have copyright

slender elbow
#

they have always held copyright over the API

#

(well, after sun that is)

eternal oxide
#

Well thats debatable as the court refused to rule on copyright

wet breach
#

fair use is not the same as copyright. Fair use has to do with copyright and whether or not your usage of copyrighted material was legal

eternal oxide
#

Google and Microsoft argued that you should not be able to copyright an API, only the implementation

wet breach
#

you can't have fair use without copyright

#

if there is no copyright over the thing in question, then there is no case over fair use because all usage would be allowed

lilac dagger
#

what api are we talking about?

eternal oxide
#

In other words, the Supreme Court didn't provide any guidance on whether an API can be copyrighted—the main question everyone expected the court to answer. Instead, the court ruled that even if APIs can be copyrighted, Google's copying was protected by fair use.

#

The copyright has yet to be answered by a court

wet breach
#

that is how it works in the US

#

just because the supreme court ignored the question doesn't mean they lost copyright over it or that you are free to do whatever you want with it

eternal oxide
#

Even going by your logic I still don;t see how my original stament is in anyway invalid

wet breach
#

it is just the supreme court didn't address that topic and therefore whatever laws that govern such things still apply until supreme court gives an actual answer

#

That means, API's are copyrightable until supreme court says they are not

#

maybe in your country you can't copyright them, but in the US you can

eternal oxide
#

The moment Oracle attempted to sue Google for copyright infringement of their (claimed) API copyright I stopped recommending Oracle.

slender elbow
#

holds copyright of work
attempts to protect copyright of owned work
mfw

eternal oxide
#

If you are in the camp that an API can be copyright then you are correct. I'm in the other camp

#

I do not believe any API shoudl be under any copyright protections

wet breach
#

you may not like that a business fights for their copyrights and other stuff but the majority don't really have a choice on the matter

wet breach
river oracle
#

Copyright really needs to be reworked honestly

#

I'm no lawyer but I think it's a bit bonk that companies can hold copyrights for 94-95 years

eternal oxide
#

It does. Even Oracle lost on ALL 4 factors for fair use, the first being that it is unlikely to be copyrightable

lilac dagger
#

what's the point of having an api if you're gonna copyright it?

eternal oxide
#

exactly

river oracle
#

Like the entire point of copyright is to reward advancement or good ideas, but they end up damaging stuff if they can be held for a very long time. Also copyrights on public software is so weird

#

Just use a license or something 💀

eternal oxide
#

Blame Disney for the crazy length of Copyright

river oracle
lilac dagger
#

did you see what disney did with mikey?

river oracle
lilac dagger
#

they kinda let it expire, but they've modernized old mikey and basically they keep the copyright over it

river oracle
#

They like split his IP the "old" and "new"

eternal oxide
#

If I remember copyright was originally 10 years or somethign similary short

lilac dagger
#

i'm not sure if it'll hold if attacked

#

i hope not

wet breach
river oracle
wet breach
#

if copyight didn't apply to api's then why does every api have a license for its use?

lilac dagger
#

just use an api key to license it no?

eternal oxide
#

Just because you slap a label on it doesn;t mean its true or legal

wet breach
#

even bukkit/spigot has a license for the api and even paper

wet breach
eternal oxide
#

because they are hoping

wet breach
#

no, its more illegal to go against a court order

#

just fyi

eternal oxide
#

I've yet to see a court order upholding a copyright on an API. But I havn't looked

lilac dagger
#

but binding to an api doesn't really infringe on copyright no?

#

or am i wrong

wet breach
#

it depends on the license in question and what it says

lilac dagger
#

if i put a new frame on a painting it won't break on copyright no?

wet breach
#

going against the license is copyright infringement

lilac dagger
#

some people even modify the painting as long as it's the original it's fine no?

eternal oxide
wet breach
#

the only way a modification does not is if said modification could stand on its own

lilac dagger
#

if i mention a famous modern painting is it part of copyright?

wet breach
#

well no, speech is not the same thing

eternal oxide
#

it can be, depending on circumstances

#

I saw someone get sued for copyright when they use a picture of a building as a background when they were talkijng about the building in a news report

#

The building wasn;t copyright btu that specific image was. It didn;t even qualify for fair use

lilac dagger
#

hmm

wet breach
#

now, if you were wanting to talk about said picture

#

you would be allowed to show said picture to those you were talking to

#

that is called fair use

eternal oxide
#

yep

lilac dagger
#

this is what i think too, an api is a mention

wet breach
#

also one of the major factors in infringment is whether or not were you making any monetary value off of it as well

lilac dagger
#

unless you compile it into your own project 🤔

neat jetty
#

some1 help me compile a plugin?

lilac dagger
#

but if we're speaking about http get/post it should be fine no?

lilac dagger
wet breach
#

http is a standard

lilac dagger
#

ik it's a protocol

fair rock
#

A protocol with trust issues😂

wet breach
#

the writing for the standard is protected by copyright, not the thing it conveys

lilac dagger
wet breach
#

this is where you start getting into patents

#

however unlike copyright, patents are very short lived and once they expire you can't renew them

eternal oxide
#

patents are a nightmarte. SO corrupt

wet breach
#

I really don't like patents, mainly because the Patent office in the US tends to not do any research to see if a patent already exists as well as ignores some obvious rules in regards to what can and can't be patented

#

I would much rather have patent laws reworked and changed as opposed to copyright

#

for example, software can meet the requirements to be patented and I don't believe software should be patentable

lilac dagger
#

afaik you need to do the research yourself and more precise, you have to hire lawyers to do it for you

wet breach
#

at all

wet breach
#

and can do the searching if not better, where as they let you search their database

lilac dagger
#

but isn't the patent library public?

wet breach
#

but it seems dumb that you pay an a large fee for them to tell you did you look in our database

wet breach
#

they could have searched considering they are paid

#

they are government employees

lilac dagger
#

i think you forget people being spammy

#

no human work force can account for that

wet breach
#

its not like its some private business that manages the database and forces you to pay them money to apply for a patent and then they decide whether or not you can have one. Since they have to decide if you meet the criterias you would think part of the decision making process is if there was a duplicate patent

lilac dagger
#

unless they use some sort of ai

wet breach
eternal oxide
#

unless you are Nintendo

wet breach
#

lol

lilac dagger
#

i'm happy that nintendo didn't try to take palword for all they have in court for the bs patent

eternal oxide
#

Their "patent" is SO broad it covers way too many possibilities.

lilac dagger
#

the patents are for throwing some thing and catching something and another is for flying on a mount?

shadow night
#

how did they even get that approved

eternal oxide
#

also in record time and AFTER palworld released

lilac dagger
#

they really want to corner the market for themselves

wet breach
lilac dagger
#

no ball throwing game for you or me

wet breach
#

they do verifications on random no name's when it comes to patents and approve for big brands and companies without even looking

lilac dagger
#

nintendo has the authority to rush things too

#

pretty sure same applies in the us

young knoll
#

Me OMW to patent plumbers

lilac dagger
#

you can't tell me google waits 3 years for a patent to apply in order to sell the idea

shadow night
#

what if I patented maths

wet breach
#

with a patent number still listed

blazing ocean
#

I particularly like the number 7, gonna patent it

lilac dagger
wet breach
#

technically you could copy or make a similar product, but only until the patent is approved

shadow night
wet breach
#

then you would have to stop making such things XD

shadow night
#

sine waves are quite unique

#

if I patented sine waves, would the world break down?

lilac dagger
#

but you know what to expect at sin (3.14159/2)

wet breach
#

personally I wish patents would go away

eternal oxide
#

The sun woudl stop sunning

wet breach
#

because I have yet to see any data or research actually prove its beneficial to competition and research

shadow night
wet breach
#

like some claim

#

I think I have seen more data that proves the opposite

shadow night
#

you don't want your business to die because some asshole did the same thing as your with -200% quality and +500% advertizements

wet breach
#

its called competition for a reason

#

you have to constantly develop and make stuff not ildly sit by because you made something

shadow night
wet breach
#

it is

#

without it, you have no innovation

#

patents stop competition sometimes completely due to the penalties of just even slightly encrouching on someones patent lmao

shadow night
wet breach
#

not really because I have yet to see any patent cause innovation

#

I have not once seen, heard, found anything where a business saw a patent and said I am going to compete with that. If there is a patent on something businesses don't go near it

shadow night
#

Without patents, you'll have a lot of people doing the same thing, theoretically reducing innovation, but maybe people will try to be better than others so more people buy their product, so they innovate
With patens, people can't do the same thing, so they'll try doing it better and more different initially, which is also causing innovative

wet breach
#

ok

#

show me the proof of that

shadow night
#

This is theory

wet breach
#

right, but the there is already research and data that proves patents being harmful, but not the other way around

shadow night
wet breach
#

I am all for theory if there was actually any evidence of it =/

#

even inventors who have made things if you read their autobiographies they didn't invent or make stuff because they could patent it

#

or that because they could patent it was the reason they did

#

maybe a select few might have?

#

but for the most part people don't invent stuff because of patents, they invent stuff because they want to solve some kind of problem or improve something

lilac dagger
#

patent troll is a thing too no?

wet breach
#

it is

#

however, it is also easy to lose your patent that way too

#

patent trolls lose their patents when you can prove they have no intention on capitalising on their patent

shadow night
#

I believe patents might promote smaller companies? Idk tho
Cuz smaller companies can probably grow bigger by patenting something and doing that, but it will be hard with no patent, as a big company will be able to steal their invention easily and do it on a bigger scale

wet breach
#

IE, they are not trying to setup anything in order to actually create said thing or offer it etc

#

the purpose of a patent is to allow an inventor time to reap the rewards of their creation, however if you don't attempt to do this after a few years you can actually lose your patent

#

however, in regards to the whole its suppose to let the inventor reap the rewards, everyone just sells their patents if they manage to get one to some company since its very cost prohibitive to an individual to try and actually do the thing you invented

#

so the reality is, very few individuals actually make so called millions unless you manage to sell the patent for millions which is not common

wet breach
#

generally you would try to sell your patent to a company that would most likely benefit from it because it is either in the industry where they operate already or closely related

#

so for example, you invented something and it has to do with vehicles, you are better off getting a car manufacturer to buy the patent

shadow night
#

In this case the inventor still profits from the patent tho

wet breach
#

then it would be to try and get the manufacturer to buy your product or for you to try to become a car manufacturer that has that feature

shadow night
wet breach
shadow night
#

If they don't, you still own a patent somebody might want

wet breach
#

if they don't like your thing they won't buy it and even if they do like it they are not going to shell out millions for it unless you came up with something revolutionary which as I said is actually not common

wet breach
#

that does not get extended just because you sold it

shadow night
wet breach
#

idk, you will have to try. but don't be surprised if you don't make money or invent the thing for quite a few years

#

its also not uncommon that inventors break even as well

#

when they sell a patent or just come out slightly ahead

#

an example is, lets say it cost you $10k to invent something but it took 5 years, and the most you can get for your patent that someone is willing to pay is $15k

#

then you made $1k/yr

sly topaz
#

10 years away

lilac dagger
#

i heard hydrogen is not really efficient

#

like it takes a lot of energy to create the fuel, transport and so on

near furnace
#

any way to remove this Bungee text?

vast ledge
#

Don't use Bungeecord?

near furnace
#

what???

vast ledge
#

Then you won't have the bungee text

near furnace
#

isnt there any work around

vast ledge
#

Idk, maybe stop the packet with the server software from sending and replace it with smth else?

near furnace
#

how can i do that

vast ledge
#

By preventing the server packet from sending it and sending another one in it's place

near furnace
#

will using velocity fix it?

rough drift
#

no

vast ledge
#

Velocity will say velocity

rough drift
#

^

near furnace
vast ledge
#

For some one that know how to

near furnace
vast ledge
vast ledge
#

You could maybe fork the bungee jar change the message and recompile, don't quote me on that tho

#

Tldr: There's no point in changing the name and it isn't easy

blazing ocean
blazing ocean
#

You can even make animations with that

#

one sec

#

see this

rough drift
#

neat

near furnace
blazing ocean
#

Why would you even want to change that?

#

After all you're giving credit to the contributors of Bungee by naming it in the server brand

near furnace
blazing ocean
#

I mean are people really going to care?

#

Probably not

near furnace
#

can this fix it? or can I just make my own little plugin that lets me configure the f3 info

blazing ocean
#

there are several plugins doing that already

pseudo hazel
#

that plugin doesnt look like what you want

pure dagger
#

how to check if block is in world guards region

pure dagger
#

i think i found

blazing ocean
#

it's literally

#

the second result on google

pure dagger
blazing ocean
#

have you considered

#

asking in the worldguard discord

pure dagger
#

no

uneven marlin
#

Hello, i cant get and damage entity with raycasting, what could be the problem?

RayTraceResult raycastResult = player.rayTraceBlocks(30);

Entity raycastEntity = raycastResult.getHitEntity();

if (raycastEntity != null && raycastEntity instanceof Damageable) {
  ((Damageable) raycastEntity).damage(10);
}
eternal night
#

rayTraceBlocks

sly topaz
uneven marlin
clear elm
pure dagger
#

what does this ==: mean? (i dont know what plguin is this from

clear elm
#

That’s a config

pure dagger
#

==:

#

what does this mean

clear elm
#

Ah

#

Idk

chrome beacon
pure dagger
#

oh......

sly topaz
#

it is the key spigot uses to determine the class of the serialized object, as Olivo said

#

if you don't want that key, you may make your own serialization format that doesn't depend on bukkit's

upper hazel
#

Is it possible to create a fake player that plugins can not distinguish from the real one?

candid galleon
#

yes

upper hazel
#

and will interact with him

#

like real

candid galleon
#

get a new computer

upper hazel
#

lol

candid galleon
#

buy microsoft account

upper hazel
#

fr

candid galleon
#

log in

#

tadah

upper hazel
#

fr

#

i need more easly option

sly topaz
#

what do you need this for

nova notch
#

can't you just use offline mode?

lilac dagger
#

i'm pretty sure you can code them any way you want

fading drift
#

on my local environment I can run CompletableFuture.runAsync and it works fine and logs fine

#

but on my pterodactyl panel it wont actually do anything

#

im so confused

upper hazel
lilac dagger
#

you can code them to

eternal oxide
#

Vault for permissions? yes they can be recognised

#

you should fake a login event though

upper hazel
lilac dagger
#

well, of course there's a lot of work ahead

#

you're asking for a bot to act natural as a player

fading drift
#

pterodactyl:

[22:06:04 INFO]: [xincraft-lobby] 1 Test logging on thread Server thread
[22:06:04 INFO]: [xincraft-lobby] 4 Test logging on thread Server thread
[22:06:04 INFO]: [xincraft-lobby] 5 Test logging on thread Craft Scheduler Thread - 1```
eternal oxide
#

for other plugins to think your NPC is an actual player you only need to fire a login and join event before spawning them

inner mulch
#

ive never used gradle, whats better kotlin dsl or groovy?

fading drift
#

local

[09:06:47 INFO]: [xincraft-lobby] 1 Test logging on thread Server thread
[09:06:47 INFO]: [xincraft-lobby] 2 Test logging on thread ForkJoinPool.commonPool-worker-6
[09:06:47 INFO]: [xincraft-lobby] 3 Test logging on thread ForkJoinPool.commonPool-worker-6
[09:06:47 INFO]: [xincraft-lobby] 4 Test logging on thread Server thread
[09:06:47 INFO]: [xincraft-lobby] 5 Test logging on thread Craft Scheduler Thread - 4
eternal oxide
#

looks like ptera is only listening to the main thread

fading drift
#

however I dont think the code is actually executing on the completable futures at all

#

whats a good way to test

eternal oxide
#

do a Bukkit.broadcastMessage

upper hazel
#

I don't think plugins will interacting with npc like they players

#

But if this so

lilac dagger
#

they do

fading drift
eternal oxide
#

yes

lilac dagger
#

you need to trigger the player events

upper hazel
#

What if I not has citizes?

lilac dagger
#

and i think you can use the player as the command sender

fading drift
#

okay will get back to u

upper hazel
#

Citizes not free 😦

eternal oxide
#

Citizens is free to build yourself

#

Pay to get support

upper hazel
#

Oh

#

Lol

fading drift
#

@eternal oxide its genuinelt just not executing it

#

what the ufck

upper hazel
#

So npc not have only join event?

eternal oxide
#

join event is a Bukkit event

fading drift
#

but I run this at the start of my plugin:

#

which is literally the same thing

upper hazel
#

I need start login and join event in nms before create npc right?

eternal oxide
#

no

#

its a Bukkit event

#

just fire one for your NPC

upper hazel
#

What the "fire one"

eternal oxide
#

pluginManager.callEvent(new BlahEvent

upper hazel
#

Oh

eternal oxide
#

all you are doing is telling other plugins that xxx player joined

upper hazel
#

Just call event before spawn

#

Alr

eternal oxide
#

well you need the Player instance

#

so fire it whenever you want, once you have teh Player instance

upper hazel
#

I need nms ye?

eternal oxide
#

no

#

well craftbukkit to get teh bukkit entity from your ServerPlayer

upper hazel
#

I don't can get him from citizes API?

#

Oh wait

#

You mean

#

Craft player or like this?

eternal oxide
#

probably, npc.getEntity()

#

"Should" return you an Bukkit entity

upper hazel
#

Alr I will try

upper hazel
#

And sending packets for the player to see the fake player in tab is not enough ?there is a huge amount of data packets to simulate ?

eternal oxide
#

not if you want other plugins to see it as a player

#

to be a player other plugins have to see it join

upper hazel
#

Connection process? Or just event call?

eternal oxide
#

just the event call

upper hazel
#

Uhh

#

I was think I need somehow register player data in server list

#

Bypassing the connection

#

Or citizes already do this?

eternal oxide
#

server lilst? Do you mean in tab?

upper hazel
eternal oxide
#

No idea what you mean

upper hazel
#

I imagined the process of creating a player as follows: when connecting to the server craftbukkit creates a player profile and adds it to some container on which it calls events

eternal oxide
#

it does, but you are not doing any of that., You are creating fake players/NPC and want it to be recognised by Vault and other plugins

#

all you have to do for it to be seen as a player by other plugins is fire a join event

#

events do not pass beyond the server. its literally just a message all plugins will see

upper hazel
#

That doesn't mean I have to call every single event related to an player

eternal oxide
#

no

upper hazel
#

So this mean join even do all this process? I need not only for vault

eternal oxide
#

no

#

all the join event does is tell all plugins that xxx player joined

upper hazel
#

Yes but how plugins will get this fake players from others events

eternal oxide
#

all other events are handled by craftbukkit IF your NPC is spawned correctly

upper hazel
#

Hm

#

Alr

#

I think I see how this work

young knoll
#

Does citizens actually handle the NPC server side?

#

I figured it was all packets

eternal oxide
#

No clue

#

it has a Bukkit entity so I assume it is fully spawned

#

If so it shoudl trigger events

young knoll
#

Fair

upper hazel
#

I was think this hard but...

eternal oxide
#

Only way to know is try it

upper hazel
#

Oh my fingers

wraith delta
young knoll
#

Ah so the internal entity isn’t a player?

#

Idk I’ve not really looked at it

wraith delta
young knoll
#

Yes but they’re a bit more complicated than your average entity

sly topaz
#

eh, not really

#

the major difference is that they require a connection, however you can just provide a fake one if you want to replicate a player

#

usually that isn't efficient nor recommendable, so people instead go for manipulating the type of the entity in the spawn packets instead

mortal vortex
fading drift
#

how the fuck is this possible

#

if therye running the same code

#

how tf is code running inside competablefuture runasync running on the server thread

slender elbow
#

it depends on how you're using it

#

CF isn't all that intuitive after all

fading drift
#

one sec I'll shwo code

#

wait could it be that I think locally I'm running java 8

#

but on my panel I'm running java 17

#

I got this test logging method

#
    public static void testLogging() {
        XinCraftCore.get().getLogger().info("1 Test logging on thread " + Thread.currentThread().getName());
        Bukkit.broadcastMessage("1 Test logging on thread " + Thread.currentThread().getName());

        CompletableFuture.runAsync(() -> {
            XinCraftCore.get().getLogger().info("2 Test logging on thread " + Thread.currentThread().getName());
            Bukkit.broadcastMessage("2 Test logging on thread " + Thread.currentThread().getName());
        }).thenAccept(a -> {
            XinCraftCore.get().getLogger().info("3 Test logging on thread " + Thread.currentThread().getName());
            Bukkit.broadcastMessage("3 Test logging on thread " + Thread.currentThread().getName());
        });


        Bukkit.getScheduler().runTask(XinCraftCore.get(), () -> {
            XinCraftCore.get().getLogger().info("4 Test logging on thread " + Thread.currentThread().getName());
            Bukkit.broadcastMessage("4 Test logging on thread " + Thread.currentThread().getName());
        });

        Bukkit.getScheduler().runTaskAsynchronously(XinCraftCore.get(), () -> {
            XinCraftCore.get().getLogger().info("5 Test logging on thread " + Thread.currentThread().getName());
            Bukkit.broadcastMessage("5 Test logging on thread " + Thread.currentThread().getName());
        });

        CompletableFuture.supplyAsync(() -> {
            try {
                XinCraftCore.get().getLogger().info("6 Test logging on thread " + Thread.currentThread().getName());
                Bukkit.broadcastMessage("6 Test logging on thread " + Thread.currentThread().getName());
                return true;
            } catch(Throwable th) {
                th.printStackTrace();
                return null;
            }
        });
    }```
#

run on onEnable

#

and now it doesn't even run the code inside the CompletableFuture blocks

#

however I use CompletableFuture.runAsync somewhere else in my plugin

#

and it works

#

above is called inside the ctor of my plugin

fading drift
#

except I've just tried my logging method inside the ctor and it still doesnt run

slender elbow
slender elbow
fading drift
#

which is called in the ctor

#

of my lobby plugin

#

wait I got somewhere

#

these log fine

#

this one doesnt

#

it works up to before new MatchCommunicator

#

the code that runs there is the following

#
  • mongo stuff that doesn't touch completablefuture
        CompletableFuture.runAsync(() -> {
            try (Jedis jedis = new XinCraftJedis()) {
                XinCraftCore.get().getLogger().info("Subscribing to " + channel + " on thread: " + Thread.currentThread().getName());
                jedis.subscribe(getSub(), channel);
            }
        });```
and then
```java
        CompletableFuture.runAsync(() -> {
            try (Jedis jedis = new XinCraftJedis()) {
                XinCraftCore.get().getLogger().info("Subscribing to " + channel + " on thread: " + Thread.currentThread().getName());
                jedis.subscribe(getSub(), channel);
            }
        });```
#

for 2 different subscribers for jedis pub/sub

#

I'm going to try move these subscribers to new Thread instead of completable future

#

it fucking worked

#

I want to know why though

slender elbow
#

it sounds like you are exhausting the common fjp by blocking in it

#

by default CF will use the common pool, if you push enough tasks and all of them block, no new tasks can be push there

#

you can pass your own Executor so that doesn't happen, such as CF.runAsync(() -> { blah blah }, task -> bukkitscheduler.runTaskAsync(task)) or whatever

fading drift
#

for this jedis operation, what would you recommend is best

#

having its own thread per subsribe channel, or running completable future on a different executor

#

considering it runs in the ctor I believe I can't use bukkit's schedular because it relies on the plugin being loaded

fading drift
slender elbow
#

you can have your own ExecutorService as well, such as a Executors.newCachedThreadPool or something
I'm not all that familiar with jedis, but if a single jedis instance can subscribe to multiple channels then it should probably be kept in one thread, otherwise one thread per channel but that sounds yucky

fading drift
#

I had so many issues when using a single jedis instance for multiple channels as I was subscriving to 3 different channels and it would just get them all mixed up

#

whats the difference in using my own thread pool than just creating a new thread

#

if its blocking it will never change threads so it doesnt make sense to use a pool right

young knoll
#

Is the difference in common pool size due to a command line arg or something

fading drift
#

maybe the panel just had less allocated cpu power?

#

thats my guess

left jay
vagrant stratus
#

Updating a plugin to 1.21.1, tf's Particle.REDSTONE been replaced with?

slender elbow
#

DUST

#

it's the vanilla names

vagrant stratus
slender elbow
#

Runtime.getRuntime().getProcessorCount() * 2 iirc

slender elbow
vagrant stratus
#

POG

young knoll
timid berry
#

how can i get the amount of players online in a spigot server from a bungee plugin?

#

this.getProxy().getServerInfo("onlinecounter").getPlayers();

#

i wonder if it is this

#

try it and see

#

i will

mortal vortex
young knoll
#

That’s not gonna work on a proxy :p

timid berry
#

what is server?

timid berry
young knoll
#

No idea

timid berry
#

okay

young knoll
#

Tbh I’ve never worked with proxies

timid berry
#

?tse

#

i will

mortal vortex
#
for (ServerInfo server : getProxy().getServers().values()) {
            int playerCount = server.getPlayers().size();
// somethn
        }
timid berry
#

new BukkitRunnable() {
public void run() {
//something
}
}
}.runTaskTimer(OnlineCounter.this, 0, 20);

#

what is the bungee equivilent of this?

#

i want to do something every x seconds

young knoll
#

Huh I didn’t know the proxy had that data

#

I guess it makes sense though, since it handles connecting players to that proxy

timid berry
#

but

#

this is for spigot plugins only

summer scroll
#

I'm developing a plugin to random spawn mobs in the survival world but I got a performance problem. Is World#getHighestBlockAt is just a heavy task or it's because I'm trying to random spawn in an unloaded chunk so it has to be loaded first?

Code: https://paste.md-5.net/zudigowaxi.cs (line 28)

young knoll
#

It’s loading the chunk

mortal vortex
summer scroll
young knoll
#

Yes

summer scroll
#

Thank you!

mortal vortex
#
getProxy().getScheduler().schedule(this, () -> {
    //something
}, 0, 1);
fading drift
#

do you use velocity?

timid berry
#

@mortal vortex

young knoll
#

Gotta give it a TimeUnit I guess

timid berry
young knoll
#

It literally just wants a TimeUnit

#

So TimeUnit.SECONDS

#

or milliseconds or whatever

timid berry
#

yes

#

but how do i set the number?

#

getProxy().getScheduler().schedule(this, () -> {
//something
}, 0, TimeUnit.SECONDS);

#

oh is 0 the secs?

#

every 0 secs

young knoll
#

Mhm

mortal vortex
timid berry
#

i see

#

whats the point of doing things every 20 ticks? like i know the client does that but since we control the server why would we go by 20's

#

?