#help-development

1 messages Β· Page 1570 of 1

sharp bough
#

make them enter the text like a confirm message?

maiden briar
#

If I listen to PlayerLoginEvent

private Channel getChannel(Player player)
    {
        Channel channel = channelLookup.get(player.getName());

        if(channel == null)
        {
            NetworkManager networkManager = ((CraftPlayer) player).getHandle().b.a;
            channel = channelLookup.put(player.getName(), networkManager.k);
        }

        return channel;
    }

Caused by: java.lang.NullPointerException: Cannot read field "a" because "org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer.getHandle().b" is null

If I listen for PlayerJoinEvent

channel.pipeline().addBefore("packet_handler", handlerName, interceptor);

Caused by: java.util.NoSuchElementException: packet_handler at io.netty.channel.DefaultChannelPipeline.getContextOrDie(DefaultChannelPipeline.java:1119)~[Paper.jar:3162-Spigot-f773da8-b121d3b]

burnt current
#

@chrome beacon

#

There i have the Error Message

sharp bough
maiden briar
#

To the point pls

sharp bough
#

i saw that cuz i have no idea what "getHandle().b.a" is, "networkManager.k"

maiden briar
#

Those are nms methods

#

I can't change them

unreal quartz
#

it's their obfuscation

sharp bough
#

i thought it was a custom class sorry

maiden briar
#

Ok

shrewd solstice
#

i want to make a command who change a player name but i can juste put 1 argument... how can i do like all argument after the command is the name of the player?

#

player1.setPlayerListName(args[2].replace("&", "Β§"));

sharp bough
#

you need to make a list of the arguments

#

using args.lenght

shrewd solstice
#

can you put it in my code because im starting in java x)

unreal quartz
#

copying and pasting is not learning java x)

sharp bough
#

i can send you a link where you can read and understand what i mean

#

but i wont do the exact code for you

shrewd solstice
#

ok send it

sharp bough
#

you can use that string to set the name of the player

blissful saffron
#

How would I go about spawning custom mobs in certain worldguard regions?

shrewd solstice
#

isnt work... my name is changed by [Ljava.lang.String;@20f09b8e

ivory sleet
#

u're printing the array by invoking toString() on it

#

what r u trying to do?

#

Use print Arrays.toString(arr) if u want to print the elements

shrewd solstice
#

no i want to change player name with all argument

hasty prawn
fluid cypress
#

what does this mean? i sent stop via rcon, the server stops, everything works as it should, apparently, but i get this on the server console, before the server is stopped

[12:45:22 WARN]: Unexpected exception while parsing console command "stop"
java.lang.IllegalStateException: Asynchronous command dispatch!
        at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:15) ~[patched_1.17.1.jar:git-Paper-96]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:797) ~[patched_1.17.1.jar:git-Paper-96]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchServerCommand(CraftServer.java:784) ~[patched_1.17.1.jar:git-Paper-96]
        at net.minecraft.server.dedicated.DedicatedServer.lambda$runCommand$3(DedicatedServer.java:776) ~[patched_1.17.1.jar:git-Paper-96]
        at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1764) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:100) ~[?:?]
        at java.util.concurrent.CompletableFuture.asyncSupplyStage(CompletableFuture.java:1778) ~[?:?]
        at java.util.concurrent.CompletableFuture.supplyAsync(CompletableFuture.java:2001) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.submitAsync(BlockableEventLoop.java:58) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.executeBlocking(BlockableEventLoop.java:75) ~[?:?]
        at net.minecraft.server.dedicated.DedicatedServer.runCommand(DedicatedServer.java:755) ~[patched_1.17.1.jar:git-Paper-96]
        at net.minecraft.server.rcon.thread.RconClient.run(RconClient.java:81) ~[?:?]
        at java.lang.Thread.run(Thread.java:831) [?:?]
#

mm should i ask in the paper server?

lusty cipher
#

also getLeftSide and getRightSide can both be null. How?

quaint mantle
#

Hello what wrong here?

if ((event.getEntity() instanceof Player)) {
            Player player = event.getEntity();
            Player killer = player.getKiller();
            Bukkit.broadcastMessage(PVP.translate("&c" + player.getName() + " &7has been killed by &c" + killer.getName()));
            }

Error line 26:

Bukkit.broadcastMessage(PVP.translate("&c" + player.getName() + " &7has been killed by &c" + killer.getName()));
cinder timber
#

is there a built in world manager

#

instead of importing mv

lusty cipher
#

Bukkit.getServer.getWorld and all other world functionality in Server?

cinder timber
#

like creating worlds n shit

#

idk why the question mark i asked you

lusty cipher
cinder timber
#

thank

quaint mantle
#

Hello? Someone can helpme?

ivory sleet
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

quaint mantle
#

He did, some posts up

#

It's not enough information to determine what is wrong anyway

ivory sleet
#

oh right my bad lol

quaint mantle
ivory sleet
#

presumably he got a null pointer exception since getKiller may return null

granite stirrup
fluid cypress
#

is there any way to create a fake player? that can send chat messages, and make it appear in the list by pressing tab

quaint mantle
#

so how i can get the killer? :(

unreal quartz
#

check its not null?

#

whate event are u using

quaint mantle
#

PlayerDeath

unreal quartz
#

make sure they die to another player then

quaint mantle
#

and if not? How i do it will not throw error?

unreal quartz
#

check it aint null

quaint mantle
#

if(!getKiller)?

#

Ok thanks

unreal quartz
#

if killer == null

quaint mantle
#

yes yes

vivid temple
#

anyone here a free server provider where i can test my custom plugins on?

unreal quartz
#

yeh its called localhost

vivid temple
#

oh yeah forgot about it, good tutorial on how to set it up?

hasty prawn
#

Run the server jar

fluid cypress
#

im trying to spawn a fake player

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        Player player = (Player)sender;
        World world = player.getWorld();
        Entity fakePlayer = world.spawnEntity(player.getLocation(), EntityType.PLAYER);
        ((Player)fakePlayer).setDisplayName("fake_player");
        return true;
    }

i get this error

Caused by: java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.Player
        at org.bukkit.craftbukkit.v1_17_R1.CraftWorld.createEntity(CraftWorld.java:2008) ~[patched_1.17.1.jar:git-Paper-96]
        at org.bukkit.craftbukkit.v1_17_R1.CraftWorld.spawn(CraftWorld.java:2033) ~[patched_1.17.1.jar:git-Paper-96]
        at org.bukkit.craftbukkit.v1_17_R1.CraftWorld.spawn(CraftWorld.java:1594) ~[patched_1.17.1.jar:git-Paper-96]
        at org.bukkit.craftbukkit.v1_17_R1.CraftWorld.spawnEntity(CraftWorld.java:826) ~[patched_1.17.1.jar:git-Paper-96]
        at io.github.misdocumeno.sharedservers.commands.SharedServersCommands.onCommand(SharedServersCommands.java:17) ~[?:?]
hasty prawn
#

You can't spawn a Player

#

You have to use NMS for FakePlayers I'm pretty sure

#

And send them with Packets

ivory sleet
#

Idk but maybe citizens might be helpful here

fluid cypress
unreal quartz
#

need to implement ur own player

hasty prawn
#

Yeah your best bet is using Citizens API for it

ivory sleet
#

tbf idk if it ever was possible

hasty prawn
#

Doubt it tbh

fluid cypress
quaint mantle
#

Yeah I think it was always nms

#

Because of the packets

fluid cypress
#

well, maybe i dont need a fake player, i thought it would be easier, as in other games
what i want is a player in the tablist that isnt actually on the server
also send messages with this "fake player"

#

the idea is sharing tablist and chat between two servers, nothing more

hasty prawn
#

Just send the chat? You don't need a fake player for that

#

Same with tablist, you can modify it directly I'm pretty sure

fluid cypress
#

but i read somewhere that i need nms for tablist stuff

stone sinew
fluid cypress
#

can i add a player to the tablist with just the spigot api? if so, how?

#

sharing the chat is the easy part, but idk how to do the tablist thing

sharp bough
#

how can i make it so onCommand a new gui opens, but when another player runs the same command the first gui doesnt stop working ?

quaint mantle
#

it should already work like that

#

because theyre different threads

sharp bough
#

is it possible that its braking because both users are on my pc

quaint mantle
#

no

sharp bough
#

?

oblique pike
#

Guys, anybody knows if getProxy().getPlayer(name) is case sensitive?

sharp bough
hasty prawn
#

You're overriding kitsInv for the old player

sharp bough
#

bro the bot kicked me

#

wtf

hasty prawn
#

Just create a new separate inventory for the new player, and have an Inventory instance for both players

sharp bough
#

anyways

quaint mantle
#

yeah stop telling people to use sites that host illegal jars

sharp bough
#

fine ig

sharp bough
#

am i not doing that? when i do the new KitCommandListener.open

#

thats creating a new instance of the class

hasty prawn
#

Make build() return an Inventory and open that

#

Right now you're setting a static Inventory variable

#

And then when you do this in the onInvClick if (event.getInventory() != kitsInv) return; it returns because the Old player's inventory isn't kitsInv anymore

pliant flame
#

Are you able to put custom unicodes you made in your textures in the lore?

eternal oxide
#

event.getClickedInventory()

sharp bough
#

hm still same thing

hasty prawn
#

Get rid of kitsInv

sharp bough
#

this is waht i mean

hasty prawn
#

Yeah it's because of kitsInv, get rid of it

proud basin
#
public Inventory mainMenu(Player player) {

        ArrayList<Player> playerList = new ArrayList<>(player.getPlayer().getServer().getOnlinePlayers());
        Inventory mainMenu = Bukkit.createInventory(null, 45, ChatUtil.color("&cPlayer List"));

        for (int i = 0; i < playerList.size(); i++) {
            ItemStack playerHead = new ItemStack(Material.SKULL_ITEM, i, (short) 3);
            SkullMeta meta = (SkullMeta) playerHead.getItemMeta();
            meta.setOwner(player.getName());
            meta.setDisplayName(playerList.get(i).getDisplayName());
            playerHead.setItemMeta(meta);
            mainMenu.addItem(playerHead);
        }
        return mainMenu;
    }
sharp bough
hasty prawn
sharp bough
#

how can i get rid of the inv thats showing

proud basin
#

right

hasty prawn
#

But if you have a static variable like that, only the last player that opened the inventory can use it because of if (event.getClickedInventory() != kitsInv) return;

#

You could also build the Inventory once, set it as kitsInv, and then just open kitsInv.

#

Don't rebuild it everytime the command is ran

sharp bough
#

but the kit list might change

hasty prawn
#

Is it player dependent or does it only change on server load

sharp bough
#

its the kit list in the config file

#

so if an admin changes the lsit

#

i want players to see the new list

#

wich works, if only 1 player opens the inv

#

lol

hasty prawn
#

Well, just rebuild the Inventory when the config changes then

#

But don't rebuild it everytime someone opens it

sharp bough
#

k i fixed it thx

fluid cypress
#

does anyone knows which one of these is the tablist showing connected players? it seems that Player_List_Item doesnt exist anymore, i see that everywhere on google searching for "add players to tablist"
https://wiki.vg/Protocol

fluid cypress
#

thanks

#

mm thats a lot of stuff

#

anyone knows whats the protocollib's PacketType.Play.Client.?? thing for that?

#

nvm its Server.PLAYERINFO, not client

burnt current
vivid temple
#

whats the gui InventoryType name of a double chest?

fluid cypress
#

if https://wiki.vg/Protocol#Player_Info has 2 int field types and 1 array, why i cant do packet.getIntegers?

        ProtocolManager manager = ProtocolLibrary.getProtocolManager();
        manager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.PLAYER_INFO) {
            @Override
            public void onPacketSending(PacketEvent event) {
                PacketContainer packet = event.getPacket();
                packet.getIntegers().read(0);
                // ...
            }
        });
[15:33:38 ERROR]: [SharedServers] Unhandled exception occured in onPacketSending(PacketEvent) for SharedServers
com.comphenix.protocol.reflect.FieldAccessException: No field with type int exists in class PacketPlayOutPlayerInfo.
        at com.comphenix.protocol.reflect.StructureModifier.readInternal(StructureModifier.java:218) ~[?:?]
        at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:197) ~[?:?]
        at io.github.misdocumeno.sharedservers.SharedServers$1.onPacketSending(SharedServers.java:25) ~[?:?]
        at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195) ~[?:?]
        at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149) ~[?:?]
        at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:535) ~[?:?]
        at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:516) ~[?:?]
        at com.comphenix.protocol.injector.netty.ProtocolInjector.packetQueued(ProtocolInjector.java:346) ~[?:?]
        at com.comphenix.protocol.injector.netty.ProtocolInjector.onPacketSending(ProtocolInjector.java:308) ~[?:?]
        at com.comphenix.protocol.injector.netty.ChannelInjector.processSending(ChannelInjector.java:433) ~[?:?]
        at com.comphenix.protocol.injector.netty.ChannelInjector.access$800(ChannelInjector.java:70) ~[?:?]
        at com.comphenix.protocol.injector.netty.ChannelInjector$3.handleScheduled(ChannelInjector.java:373) ~[?:?]
        at com.comphenix.protocol.injector.netty.ChannelInjector$3.onMessageScheduled(ChannelInjector.java:343) ~[?:?]
        at com.comphenix.protocol.injector.netty.ChannelProxy$2.schedulingRunnable(ChannelProxy.java:127) ~[?:?]
        at com.comphenix.protocol.injector.netty.EventLoopProxy.execute(EventLoopProxy.java:95) ~[?:?]
        at net.minecraft.network.Connection.sendPacket(Connection.java:294) ~[?:?]
        at net.minecraft.network.Connection.send(Connection.java:258) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.send(ServerGamePacketListenerImpl.java:1905) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.send(ServerGamePacketListenerImpl.java:1891) ~[?:?]
        at net.minecraft.server.players.PlayerList.tick(PlayerList.java:1017) ~[patched_1.17.1.jar:git-Paper-96]
        ...
[15:33:38 ERROR]: Parameters:
  net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo@28eb45fe[
    a=UPDATE_LATENCY
    b=[PlayerInfoData{latency=0, gameMode=SURVIVAL, profile=com.mojang.authlib.GameProfile@65a586e2[id=f62a41ae-4198-391b-ad68-6dbbc530da23,name=misdocumeno,properties={},legacy=false], displayName=null}]
  ]
chrome beacon
chrome beacon
#

I'm not expert with how they work so I'm not sure I can help more than that

rocky rampart
#

Send where you're executing the PreparedStatement please

quaint mantle
#

does anyone know what it does. What does that even mean?

#

Sets the localized name.

rocky rampart
#

ItemMeta#getLocalizedName() gets the localized name depending on the server's language settings.

#

So I would assume setLocalizedName sets it for the client?

fluid cypress
# chrome beacon I recommend you take a look at PacketWrapper because what you need to do is grab...

this is changing my name, instead of adding a new profile to the list, any idea why? also im now really sure what should i send to the 4th parameter of the PlayerInfoData constructor

public void onPacketSending(PacketEvent event) {
    List<PlayerInfoData> playerInfoDataList = event.getPacket().getPlayerInfoDataLists().read(0);
    WrappedGameProfile profile = playerInfoDataList.get(0).getProfile();
    profile.withName("duplicated");
    playerInfoDataList.add(new PlayerInfoData(profile, 10, EnumWrappers.NativeGameMode.SURVIVAL, WrappedChatComponent.fromText("duplicated")));
    event.getPacket().getPlayerInfoDataLists().write(0, playerInfoDataList);
}

is playerInfoDataList.get(0).getProfile() returning a reference maybe? idk how that works in java really, idk java

chrome beacon
fluid cypress
#

no, its passed as value, you need to return a new one and replace the old one, also you cant have a void and ItemStack return type at the same time

fluid cypress
chrome beacon
#

Adding yourself twice yes

#

Adding yourself to a list where you already are*

fluid cypress
#

why myself? isnt playerinfo...getProfile() duplicating my profile?

chrome beacon
#

You should create a new Profile with a new UUID

fluid cypress
#

mm right

#

so, a fake uuid

#

exactly where?

unreal quartz
#

depends what you do with it

sage swift
#

but for safety purposes i would return it and use it to set

fluid cypress
#

well yea, it depends on the data type, i guess

unreal quartz
#

itemstack is mutable

#

if you change the amount in the modify method, then the amount will be different for is

fluid cypress
#

right, its an object, its passed as reference

fluid cypress
chrome beacon
#

I've told you what to do

unreal quartz
#

not a copy

chrome beacon
#

You need a new Profile

fluid cypress
#

yes, thats why i add new PlayerInfoData(...) to the list, isnt it a new profile?

waxen plaza
#

?paste

undone axleBOT
waxen plaza
unreal quartz
fluid cypress
#

right

#

then

chrome beacon
fluid cypress
#

how do i clone that profile, and change the uuid and displayname?

unreal quartz
waxen plaza
#

I am creating new item stack with that material

chrome beacon
waxen plaza
#

I don't understand why

unreal quartz
#

if its cloneable then you can .clone, if not then you have to create a new one and figure it out

fluid cypress
unreal quartz
chrome beacon
waxen plaza
proud basin
#

What's the max inventory size you can have?

unreal quartz
#

well u cant with hardcoded material values

chrome beacon
#

54

chrome beacon
fluid cypress
somber hull
#

HOW AM I GETTING AN NPE ON THIS LINE!!! WTF if (args[1] == null) {

#

.isEmpty doesnt work either

sage swift
#

because the array is of length 1 lol

fluid cypress
sage swift
#

check the array.length before you try to access the element

#

no

chrome beacon
#

String is name

somber hull
#

wait

#

yes it is

#

sop i checking if its null

sage swift
#

primitive arrays will error if you try to access an element that's not in it

unreal quartz
#

would throw an out of bounds exception if it was length 1

sage swift
#

check that args.length > 2 before you try to access it, there will be no problems.

somber hull
#

holy fuck, thank you

#

im retarded

quaint mantle
sage swift
#

you are

somber hull
#

thank you gecko

sage swift
#

πŸ‘Ž

ivory sleet
#

Both look pretty meaningless

chrome beacon
#

I recommend the entire XSeries of plugins for best version compatability

quaint mantle
#

never heard of it until now

fluid cypress
# chrome beacon UUID, String

i get 2 duplicated

public void onPacketSending(PacketEvent event) {
    List<PlayerInfoData> playerInfoDataList = event.getPacket().getPlayerInfoDataLists().read(0);
    WrappedGameProfile profile = new WrappedGameProfile(UUID.randomUUID(), "duplicated");
    playerInfoDataList.add(new PlayerInfoData(profile, 10, EnumWrappers.NativeGameMode.SURVIVAL, WrappedChatComponent.fromText("duplicated")));
    event.getPacket().getPlayerInfoDataLists().write(0, playerInfoDataList);
}
waxen plaza
#

I never realised how many items minecraft has until now lol

fluid cypress
#

also im not sure what WrappedChatComponent.fromText("duplicated") is doing and if its correct

chrome beacon
fluid cypress
#

then i should check the list first

#

but, should it add a new one every 5 seconds or something? every ping update

#

im waiting and i still have 2

chrome beacon
#

I'm not sure what you're listening for

#

Is it just the Info packet

fluid cypress
#

new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.PLAYER_INFO)

#

you mean this?

chrome beacon
#

That might only be called when a new player is added to the tab

#

or so

#

I'm not entirely sure actually

fluid cypress
#

mm, i will join with another account

#

yea, i new one was added

#

so that list is persistent

chrome beacon
#

You will have to track what you add

fluid cypress
#

ok

somber hull
#

wait

#

nvm

fluid cypress
#

so, that event isnt called when a player press tab

chrome beacon
#

No that's client sided

#

Server has no idea

fluid cypress
#

then, do i need to call the event myself if i want to add or remove someone from the list?

chrome beacon
#

I wouldn't listen to that even if you want to add things

fluid cypress
#

yea, so i need to call those events

chrome beacon
#

You can do it anywhere you want. Just create a new packet

fluid cypress
#

not listen

chrome beacon
#

No need for that event

fluid cypress
#

mm no idea how to do that

#

let me check the wiki

chrome beacon
#

Hence why the first thing I recommended was looking at PacketWrapper

#

Which has a premade utillity class you can use

fluid cypress
#

the github wiki is pretty incomplete, what wiki are you using?

chrome beacon
#

Source code

#

Is my wiki

fluid cypress
#

mmm

#

im not good at that

#

i dont use java

chrome beacon
#

C# then?

fluid cypress
#

no

chrome beacon
#

Any programming language?

fluid cypress
#

python mostly, javascript with typescript

chrome beacon
#

I see you might want to read a bit of this:

#

?learnjava

undone axleBOT
proud basin
#

ew

chrome beacon
#

You can copy it in to your plugin and use it

#

Just make sure to leave credits

chrome beacon
proud basin
#

copy and pasta

hasty prawn
#

That's effectively what you're doing when you shade dependencies into your project πŸ€”

chrome beacon
#

Well you're using an API too aren't you. This is what it was designed for

proud basin
#

no?

quiet ice
#

recycling old code is the most usefull tool you have as a developer

chrome beacon
proud basin
#

I'm not talking about copy and pasting

fluid cypress
#

the setData method is what i need, right?

hasty prawn
#

LMAO I don't blame you

proud basin
#

I didn't say ew to that

burnt current
quiet ice
#

good

#

just wanted to make sure

quasi flint
#

U wanna See my Plugin. Jam packed with Code fein Others that Allow it

stiff topaz
#

on the edit resource page, how do I align text to the left but have it in a centred spoiler. I am going mental

burnt current
# rocky rampart Send where you're executing the `PreparedStatement` please

This is the complete class

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.UUID;

public class addPlayer {
    public static boolean addPlayer(String username, UUID uuid, int coins) {
        try (PreparedStatement stmt = MySQL.getConnection().prepareStatement(
                "INSERT INTO playerdata(username, uuid, coins) VALUES(?, ?, ?)")) {
            stmt.setString(1, username);
            stmt.setString(2,  uuid.toString());
            stmt.setInt(3, coins);
            stmt.execute();
            return true;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;
    }
}
fluid cypress
#

what happen if that wrapper stops being updated? i dont like relying on protocol lib, tho it seems to be pretty active, but adding something more to depend doesnt sound very good to me, but idk

chrome beacon
#

It's already slightly out of date

fluid cypress
#

also cant i add that with maven?

chrome beacon
#

Wrapper that is

chrome beacon
fluid cypress
#

how

unreal quartz
chrome beacon
fluid cypress
#

mmm

#

i only know to edit the pom.xml file

#

where should i put the PacketWraper folder and where should i run that command?

chrome beacon
#

You should run the command in the same directory as the pom.xml of PacketWrapper

fluid cypress
#

wait

#

there is a pom.xml inside PacketWraper

#

and a src folder

#

where do i have to put those 2 things?

quiet ice
#

ignore them

unreal quartz
#

u can just install it to ur local repository if u want to use it

quiet ice
#

I have no idea where the issue lies, but from what you said, it sounds wrong

rocky rampart
#

Second point isn't guaranteed to work but it's worth a shot.

fluid cypress
#

i dont get it, really, should i combine my src folder with that src folder? should i put PacketWrapper at the same level as my src folder?? or what, i dont get it

#

why couldnt the author just do the thing to add a dependency and a repository in my pom.xml and thats it

limber mica
#

How can you loop through a specific inventory slot like slot 45 to 52? I know you have to do a for loop but I mean like the equation I guess you could say

unreal quartz
#

clone the project, navigate to it and run mvn install

#

it will effectively do what you want it do it, except the repository is your own local one

fluid cypress
#

i get it, but to where do i have to clone it...

unreal quartz
#

anywhere

fluid cypress
#

how does it know what to do then?

unreal quartz
#

well anywhere outside your project then

fluid cypress
#

nvm ill just do it

unreal quartz
#

you have a folder on your system called .m2 which is a maven repository

fluid cypress
#

wait, maven is a global thing?

unreal quartz
#

is it like the remote ones just on ur pc

#

i suppose?

fluid cypress
#

i thought it installed everything in my project folder somewhere

#

well now it makes sense

unreal quartz
#

no

fluid cypress
#

so, everything i install with maven will be available to all projects?

unreal quartz
#

yes

fluid cypress
#

why do i have to add spigot to pom.xml in every plugin project i make then?

unreal quartz
#

it is like having your own repository

#

because you're fetching spigot from a remote repository

#

you haven't actually installed it to your own

fluid cypress
#

ok

#
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:00 min
[INFO] Finished at: 2021-07-12T16:52:50-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project PacketWrapper: Could not resolve dependencies for project com.comphenix.packetwrapper:PacketWrapper:jar:1.15.2-R0.1-SNAPSHOT: Could not find artifact com.comphenix.protocol:ProtocolLib:jar:4.5.1-SNAPSHOT in spigot-repo (http
s://hub.spigotmc.org/nexus/content/groups/public/) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
unreal quartz
#

it is different from stuff like npm where it is mainly per project and all dumpted to node_modules

fluid cypress
#

yea

unreal quartz
#

did you actually install it

unreal quartz
#

for (i = start; i <= end; i++)

#

that is a for loop

fluid cypress
unreal quartz
#

everything in it will be executed for each int i within the obunds

#

it looks like it on protocollib

fluid cypress
#

well, i didnt use mvn, i did "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.2\plugins\maven\lib\maven3\bin\mvn.cmd" install

#

i think that pom.xml is outdated

unreal quartz
#

no

#

maven dependencies are transitive

#

meaning it will try to resolve the dependencies of your dependencies

#

it appears to have failed to find ProtocolLib

fluid cypress
#

in the PacketWrapper pom.xml i replaced version 4.5.1-snapshot with 4.7.0 and now i get a different error

burnt current
fluid cypress
#

i guess i will just copypaste

unreal quartz
#

looks like the tests failed, you’ll have to skip them

#

it’s a command line flag, forgot what it is though

burnt current
#

Oh maybe the error is output because the column "Language" is not null, but I do not write anything into this column.

rocky rampart
burnt current
#

Yes I will try immediately

#

Yes, it works now. Thanks for your help

fluid cypress
#

using -Dmaven.test.skip=true

[ERROR] Failed to execute goal on project PacketWrapper: Could not resolve dependencies for project com.comphenix.packetwrapper:PacketWrapper:jar:1.15.2-R0.1-SNAPSHOT: Could not find artifact com.comphenix.protocol:ProtocolLib:jar:4.5.1-SNAPSHOT in spigot-repo (http
s://hub.spigotmc.org/nexus/content/groups/public/) -> [Help 1]
unreal quartz
#

still need protocollib

fluid cypress
#

fuck it ill copypaste

unreal quartz
#

lol

fluid cypress
#

wasnt protocollib installed when i added it to my pom.xml?

unreal quartz
#

what is your full pom

fluid cypress
#

im already using protocollib, so, it has to be installed

#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.github.misdocumeno</groupId>
    <artifactId>SharedServers</artifactId>
    <version>1.0-SNAPSHOT</version>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <outputDirectory>../Server/plugins</outputDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <maven.compiler.source>16</maven.compiler.source>
        <maven.compiler.target>16</maven.compiler.target>
    </properties>

    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>dmulloy2-repo</id>
            <url>https://repo.dmulloy2.net/repository/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.16.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>3.36.0.1</version>
        </dependency>
        <!-- ProtocolLib -->
        <dependency>
            <groupId>com.comphenix.protocol</groupId>
            <artifactId>ProtocolLib</artifactId>
            <version>4.7.0</version>
        </dependency>
    </dependencies>
</project>```
slow badge
#

How can I get all the new methods/changes of 1.16 ?

unreal quartz
#

packetwrapper is available on that repo

#

https://repo.dmulloy2.net/repository/public/

#

you can freely browse it

sharp bough
#

wait i just realized the maven is in Js thats why theres the / closing LOL

unreal quartz
#

what

sharp bough
#

im quinda sad it took me this long to realize

unreal quartz
#

maven is not in js?

sharp bough
#

yea

#

look it even has the same comments

unreal quartz
#

xml...

sharp bough
#

its the same structore

unreal quartz
#

no it does not

#

maven config files are written in xml, not js

sharp bough
#

wait no

#

its html

fluid cypress
unreal quartz
#

pom.>>>>>>>>>>>>xml<<<<<<<<<<

sharp bough
#

html has those comments

unreal quartz
fluid cypress
#

yes

#

how do i declare that dependency

#

you said thats included in the protocollib repo im using

unreal quartz
#

looks like com.cophenix.packetwrapper:PacketWrapper

#

you can browse it yourself

fluid cypress
#

what is that?

unreal quartz
#

the repository browser

fluid cypress
#

whats the location of the local maven repo again?

unreal quartz
#

it depends on your OS

fluid cypress
#

windows

unreal quartz
#

no idea

#

it's in ~/.m2 for linux, so whatever the windows equivalent of that is

lethal knoll
#

Guys is buildtools broken????

quasi flint
#

Google

fluid cypress
#

1.13.R0.1-SNAPSHOT is the latest version?

quasi flint
#

So no

#

I guess

unreal quartz
#

thats the latest one on that repository

lethal knoll
#

I tried so many things, clearing all the files, downloading all files manually, nothing works

quasi flint
#

Try an older version

lethal knoll
#

I tried

quasi flint
#

:v

#

Wut

lethal knoll
#

you mean from buildtools?

quasi flint
#

Yes

lethal knoll
#

then I cannot build 1.17

quasi flint
#

Right

#

My 1.17 buildtools works without flaws

#

Does it throw errors?

lethal knoll
#

yes

hasty prawn
#

What are the errors

#

I'm guessing you don't have Java 16 installed πŸ€”

lethal knoll
#

I just tried manually installing gitportable

#

yea well

#

I do

#

also installed it

hasty prawn
#

Send the errors then

lethal knoll
#

maybe system restart required

quasi flint
#

Run it in administrator

#

Maybe it welps

lethal knoll
#

I'll try

fluid cypress
lethal knoll
#

what kinda black magic is this ...

fluid cypress
#

why is it trying to download it from the spigot repo, instead of the dmulloy2 repo

quasi flint
hasty prawn
#

^

#

lol

lethal knoll
#

what do you mean wrong directory?

hasty prawn
#

You're in the system32 dir

quasi flint
#

U in sys32

lethal knoll
#

oh god -_-

hasty prawn
#

Go back to the BuildTools directory

lethal knoll
#

running system adminstrator won't work then that way okay hold on

#

it just doesn't work ....

unreal quartz
hasty prawn
quasi flint
#

Weird

shrewd solstice
#

how can i hide a player from the tab

#

?

quasi flint
#

May u restart ur pc and clean all the files and redownload

quasi flint
fluid cypress
unreal quartz
#

maven will try all repositories

#

it does not know which dependency belongs to where

lethal knoll
#

it just doesn't work

#

it's broken

#

never had this

#

ever

shrewd solstice
hasty prawn
#

Weird. Maybe for some reason it can't modify anything in your Documents folder? Try running in a folder on your Desktop

shrewd solstice
#

it didnt work xDDDD

fluid cypress
quasi flint
#

Protocollib

fluid cypress
#

well, nvm, what now?

quasi flint
#

Use it

unreal quartz
#

idk tbh, it seems rather abandoned but if you really want it via maven then you're gonna have to install it locally

fluid cypress
#

do i really need to use this wrapper just to fire a protocollib event?

unreal quartz
#

i have no idea

quasi flint
#

Y would u need a wrapper for an protocollib event?

#

That's not making sense in my smooth brain

ivory sleet
fluid cypress
#

AbstractPacket doesnt even exists

#

AbstractPacketInjector does

chrome beacon
robust crypt
#

how do i change the name tag of a player

#

i did this but it doesnt change the name tag

fluid cypress
#

can i just literally combine that src folder with my src folder?

#

and change some package names and stuff

chrome beacon
#

Yes

unreal quartz
fluid cypress
#

well, ill do that

unreal quartz
#

You can use PacketWrapper as a dependency if you wish, although it is highly recommended that plugin authors simply copy and paste the classes they need into their project. This helps guard against future changes in PacketWrapper and makes it easier on the end user.

fluid cypress
#

i dont read readmes

#

well

#

thanks

#

ill do that

robust crypt
quiet ice
robust crypt
#

...

#

then how do i do it

quiet ice
#

packets 🌈

robust crypt
#

wtf

quiet ice
#

... or just enslave another plugin to do the heavy lifting

rocky rampart
#

NametagAPI is working on being updated to 1.17, which is my go-to for that.

#

Or sorry, NametagEdit

#

It's 1.16.x right now

fluid cypress
#

i guess this wrapper will work as long as protocollib keeps being updated?

rocky rampart
#

I bet a lot of projects like this will struggle to update a little bit thanks to the mapping changes.

quiet ice
#

I don't like protocollib tbh, it has been wonky with updates in the past

ivory sleet
#

Β―_(ツ)_/Β―

quiet ice
#

stuff like breaking with java releases or fully releasing a working release only after a few months after it went into testing

kind coral
#

if by myself i recode a plugin that is already existing and its paid and i make it free is against TOS?

#

like if i like code a plugin like litebans and make it free

hasty prawn
#

As long as you're not using any of Liteban's code

chrome beacon
#

^^

kind coral
#

nono ofc not

chrome beacon
#

Then it's fine

unreal quartz
#

all plugins should be open source anyway

ivory sleet
kind coral
#

wdym

robust crypt
chrome beacon
#

._.

robust crypt
#

?

chrome beacon
#

I know how to do it I just can't be botherd to explain it for the third time today

#

All I can say is scroll up a bit and you will find what you're looking for

quiet ice
#

basically, use libraries or plugins that are not official bukkit apis

robust crypt
#

how do i decompile a jar file :)

quiet ice
#

There are many ways

robust crypt
#

do i see the full code?

chrome beacon
#

No

robust crypt
#

bruh

chrome beacon
#

?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.

quiet ice
#

Just use a decompiler like quiltflower, CFR or procyon

robust crypt
#

k

chrome beacon
#

You're not making the plugin if we write the code

robust crypt
#

:(

quiet ice
#

Of course you can be lazy and use a proper tool such as bytecode viewer or recaf

chrome beacon
#

Recaf is great

quiet ice
#

It is, as long as you don't join their discord server

robust crypt
#

why

chrome beacon
#

Never been there

hasty prawn
#

What's wrong with their Discord

robust crypt
#

ye

quiet ice
#

Bunch of kids trolling and meming

chrome beacon
#

Ow

#

Stealing other peoples code are they?

robust crypt
#

no im stealing them and then changing them so i can troll my friend

#

not selling them tho

quiet ice
#

no, but you will see frequently things like "haha, I skidded a minecraft client. I must be cool"

robust crypt
#

lmao wat

chrome beacon
#

sounds annoying indeed

robust crypt
#

yes

ivory sleet
#

sounds like me 2018

kind coral
pallid arrow
#

eclipse govno??))

quiet ice
#

No eclipse here

pallid arrow
#

ok

quiet ice
#

The eclipse government is at the other door

pallid arrow
#

yes

left swift
#

hi, recently i started trying to create my own world generator. I'd like to get an effect very similar to a standard minecraft vanilla world generator, but I'm currently not doing it. Anyone know how I can adjust the shapes to get this similar? My code:

    int currentHeight = 50;

    @Override
    public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
        ChunkData chunk = createChunkData(world);
        SimplexOctaveGenerator generator = new SimplexOctaveGenerator(new Random(world.getSeed()), 8);
        generator.setScale(0.005D);
        int r = random.nextInt(21) + 3;

        for (int x = 0; x < 16; x++) {
            for (int z = 0; z < 16; z++) {
                currentHeight = (int) ((generator.noise(chunkX * 16 + x, chunkZ * 16 + z, 0.5D, 0.5D, true) +1 ) *15D + 50D);
                chunk.setBlock(x, currentHeight, z, Material.GRASS_BLOCK);
                chunk.setBlock(x, currentHeight - 1, z, Material.DIRT);

                for (int i = currentHeight - 2; i > 0; i--) {
                    chunk.setBlock(x, i, z, Material.STONE);
                }

                chunk.setBlock(x, 0, z, Material.BEDROCK);
                biome.setBiome(x, currentHeight, z, Biome.PLAINS);
            }
        }
        return chunk;
    }```
#

result:

kind coral
left swift
ornate patio
#

will player.getUniqueId remain the same forever for each account?

eternal oxide
#

yes, so long as its online mode

ornate patio
#

wdym online mode

eternal oxide
#

not offline mode server

ornate patio
#

what even is that

eternal oxide
#

have you played MC before?

ornate patio
#

lmao perhaps so yes

#

oh you mean like

#

if the server can't reach mojang's servers or something? idk

eternal oxide
#

yes, kinda. You can configure it to never authenticate

vital ridge
#

Is it possible to get a column from mysql depending on row

eternal oxide
#

which is bad, but some do

ornate patio
#

ok well my servers not doing that so

#

πŸ‘

#

thanks

solemn shoal
#

how can i restore the vanilla socreboard back?

#

claims sidebar is already showing it

#

it seems to get reset by my plugin

opal juniper
quaint mantle
# solemn shoal

it could be a client side thing. Looks like your using a hack client so that could be it

manic phoenix
#

What is in Forge 1.16.5 the name for the onRightClick event?

manic phoenix
#

Just 1.16.5

quaint mantle
manic phoenix
#

kk

solemn shoal
#

afaik

young knoll
#

Forge

quaint mantle
#

or something like that

ivory sleet
#

usually onUse

#

or onInteract

#

like if you're deriving a custom registerable

manic phoenix
#

Its onInteract ty

quaint mantle
solemn shoal
#

its not my client

#

nobody else on the server can see it

quaint mantle
solemn shoal
#

here's my code

#

yes gitlab

ivory sleet
#

gitlab πŸ₯²

#

honestly I don't even blame you

unreal quartz
#

ye fuck github

#

fuck that octocat

ivory sleet
#

now with this copilot thing

solemn shoal
#

github overrated ngl

#

regardless, can anyone figure out why you cant set scoreboards in vanilla if scoreboards are disabled in my config?

young knoll
#

Because they are disabled?

solemn shoal
#

no i mean, you cant use the vanilla scoreboards at all if you disable my custom scoreboard

opal juniper
#

Nah I ❀️ GitHub

solemn shoal
#

thing is, i dont see what i did wrong in my code

young knoll
#

Are you setting the players scoreboard to something other than the main scoreboard

left swift
solemn shoal
#

when enabled, yeah

opal juniper
slow oyster
#

Hmm, BuildTools is giving me this error when trying to compile 1.17 now: [INFO] --- specialsource-maven-plugin:1.2.2:remap (remap-fields) @ craftbukkit --- org.apache.maven.artifact.resolver.ArtifactNotFoundException: Could not find artifact org.spigotmc:minecraft-server:csrg:maps-spigot-fields:1.17-R0.1-SNAPSHOT

#

And this is what I'm running with java -jar BuildTools.jar --rev 1.17 --compile craftbukkit --remapped

#

Seems like a 1.17 issue hmm, seems to work with 1.17.1

fluid cypress
#

my project (maven) doesnt get build bc "nothing to compile, all classes are up to date" despite being modified, a lot of times, why? it was working fine and suddenly this happens, and its not the first time it happens

eternal oxide
shut field
fluid cypress
#

how can i config this thing to compile artifacts when using maven? the spigot guide uses lifecycle > package

eternal oxide
#

You don;t use artifacts. Thats InteliJ compile, not maven

#

use teh Maven menu right hand side

fluid cypress
#

im using that

#

PluginName > Lifecycle > package

eternal oxide
#

correct. Then it shoudl be building.

fluid cypress
#

but its not

eternal oxide
#

Do you get an error? or is there a jar built in the target folder?

fluid cypress
#

no errors, just "nothing to compile", im compiling directly to the server/plugins folder, not to target, while the server is still running, but ive been doing this since 2 days ago, and it works fine

#

also, it literally says "nothing to compile, everything up to date" so... idk

eternal oxide
#

using some plugin to redirect the jar?

fluid cypress
#

yes, i think

eternal oxide
#

Run a clean then package

fluid cypress
#
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <outputDirectory>../Server/plugins</outputDirectory>
                </configuration>
                <version>3.2.0</version>
            </plugin>
nimble loom
#

im trying to create a shop plugin where a player can place down a block and when someone clicks on it, it opens an inventory. How do I uniquely identify each block (shop)?

fluid cypress
eternal oxide
#

?paste

undone axleBOT
shut field
#

and ofc interact events

fluid cypress
#

idk why it thinks its sql

nimble loom
shut field
eternal oxide
#

Yep, clearly thinks everything is upto date

fluid cypress
#

im editing the onCommand method inside a class that implenets CommandExecutor

#

im doing this inside onEnable on the "main" class this.getCommand("addplayer").setExecutor(new SharedServersCommands());

#

so i dont see the problem, also i didnt change anything besides code inside the command callback

eternal oxide
#

actually, it claims your compile was fine, it was your test compile that had no changes

fluid cypress
#

the entry point class for the plugin, the one that extends JavaPlugin, is unused according to intellij, is that normal?

eternal oxide
#

yes

fluid cypress
#

its kind of annoying

nimble loom
eternal oxide
#

I don;t use a hand holding IDE like Intelij

nimble loom
#

Ok, so how do I tell if the block that the player places down is the shop block? Like where do I store that data?

fluid cypress
shut field
eternal oxide
#
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ SharedServers ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 5 source files to D:\Documentos\Java programming\Minecraft Plugins\SharedServers\target\classes```
fluid cypress
#

its compiling to target instead of plugins mmm i see

#

let me check

nimble loom
eternal oxide
# fluid cypress let me check

Your server needs to be stopped when you build txt [INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ SharedServers --- [INFO] Building jar: D:\Documentos\Java programming\Minecraft Plugins\Server\plugins\SharedServers-1.0-SNAPSHOT.jar

shut field
fluid cypress
#

well, no, i only see .class files, no .jar

shut field
eternal oxide
#

Its building to Building jar: D:\Documentos\Java programming\Minecraft Plugins\Server\plugins\SharedServers-1.0-SNAPSHOT.jar

nimble loom
quaint mantle
#

hey, how should i check if an OfflinePlayer DOES exist..?

PS: i HAVE the offlineplayer set, however i get an error when i try to set the OfflinePlayer

&&&i know how to get offline players, and this way /does/ normally work

fluid cypress
#

wait, it may be my that script broke

#

or the rcon connection

fluid cypress
#

yea, the server is not receiving the stop command for some reason

eternal oxide
crude charm
crude charm
#

It's safer then names / lores

fluid cypress
#

i just restarted the script and now it works, idk

#

well

#

anyways

#

this isnt working

#

how do i actually update the list?

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        WrapperPlayServerPlayerInfo wrapper = new WrapperPlayServerPlayerInfo();
        // get the current tab list
        List<PlayerInfoData> playerInfoData = wrapper.getData();
        // create a new player profile
        WrappedGameProfile profile = new WrappedGameProfile(UUID.randomUUID(), args[0]);
        // add it to the tab list
        playerInfoData.add(new PlayerInfoData(profile, 10, EnumWrappers.NativeGameMode.SURVIVAL, WrappedChatComponent.fromText(args[0])));
        // set the new tab list
        wrapper.setData(playerInfoData);
        return true;
    }
#

do i need to "set an action" or something like that?

quaint mantle
eternal oxide
quaint mantle
eternal oxide
#

if they are not online you will not have a player object to get the UUID from

quaint mantle
#

is player.isOnline() a thing..?

eternal oxide
#

You can NOT use player

quaint mantle
#

thats what i thought

eternal oxide
#

Player will not exist unless they are online

quaint mantle
#

alr

#

so should i check player.isValid() ?

eternal oxide
#

where are you getting player from?

quaint mantle
#

args[0]

eternal oxide
#

so not a player but a String of their name

quaint mantle
#

Bukkit.getServer().getPlayer(args[0]);

#

Player p = ⬆️

nimble loom
eternal oxide
quaint mantle
#

😍 ty

untold rover
#

Hey I am working on an EventDebugger, we have a project with 14 different Modules, and it happens a few times where 2 plugins have the same listener, and one plugin cancels the event but the other sets cancelled to false, which breaks our code. So I wanted to make a Plugin which detects specific Events and when certain methods are changed. There is this Plugin: https://www.spigotmc.org/resources/eventdebugger.82055/ it does exactly what I wanted but its missing functionality which we need. so I wanted to recreate it, its written in Kotlin so the Code is 0 help because I have never used Kotlin before.

My Quesion: How can I make a Listener which listens to specific Events and when something changes

eternal oxide
#

Thats ignoring the Event contract with other plugins

untold rover
#

we are multiple developers so sometimes mistakes happen, and using that solution we don't need 20000 hours to find the wrong Event.

untold rover
eternal oxide
untold rover
#

thats not what I want to achive, I want a Universal solution like the plugin linked above, its only a config

#

I want the same thing, but there are some information missing which makes the plugin above a little useless

#

they use reflections to get the Handlerlist and go from there, but how can I constantly check if there is any change

ivory sleet
#

hmm let me take a look

eternal oxide
#

They simply refect and re-register all executors to pass though executeAndCheckChanges

#

it compares the map of Fields

granite stirrup
#

its not even a old cpu

#

;-;

#

and i have tpm 2.0

untold rover
granite stirrup
#

everything is fucking minimum requirements

untold rover
#

how is this related to Spigot development?

granite stirrup
#

bUT they SaY it DOesnT FUcKing SuppPOrt IT

granite stirrup
untold rover
#

then delete it ...

granite stirrup
#

nah

ivory sleet
#

yeah idkidk, not the best channel

granite stirrup
#

:(

restive burrow
#

hey gamers, is it possible to inject code into the base mc server?

#

like a mixin but for spigot?

granite stirrup
#

pretty sure you can even inject cpp dll

ivory sleet
#

you want bytecode manipulation/injection?

restive burrow
#

yeah

#

but from the plugin

#

no java agents for the server or anythin

ivory sleet
#

uh thats hard to do then

restive burrow
#

or any tweaker classes

quaint mantle
#

wrong person

restive burrow
granite stirrup
#

i found a thing in cpp to inject java code lol

#

pretty sure

young knoll
#

If only we had mixins

untold rover
#

Conclure you have somthing for my Problem above? I want to make the cleanest solution possible

ivory sleet
#

Ik not the best thing

ivory sleet
#

let me jump to the event impl

untold rover
#

Take your time, I am glad you want to help πŸ™‚

desert lichen
#

Conclure, sorry to bother you, but do you have an idea on this subject ?
Conclure, or anybody

ivory sleet
#

there's no best way to do that

untold rover
#

afaik you can just delete it in onLoad? aren't the plugins loading first

ivory sleet
#

yeah but its quite unsafe

#

okay Johni

desert lichen
#

I often run into some errors (due to world saving) doing whatever way. Even deleting the world by hand while the server is off is causing errors

stone sinew
#

Could just unload the world and delete it.

#

That way you know its not gonna reload

hasty prawn
#

^ provided it isn't the main one

desert lichen
#

It is the main one

stone sinew
#

Oh I read nether and end

#

Create a new world set that as the main, then unload the old world πŸ˜‰

hasty prawn
#

Was just about to say that lmao

#

But yeah, have a placeholder world so you can load/unload world

desert lichen
#

Why not after all

#

Will try that, thanks !

ivory sleet
#

so like the debugger thing goes like this:

I will avoid design pattern names just in case you dont know them

it gets the HandlerList instance of a specific derived Event class,
it invokes HandlerList#getRegisteredListeners and loops it,
then for each RegisteredListener it reflects the EventExecutor field named executor,
it then sets a custom EventExecutor for the executor field,
the custom executor delegates the original executor instance but it maps the old values before invocation, then it maps the new values after invocation and compare

untold rover
#

So Reflection, Reflection and more Reflection?

ivory sleet
#

yup

untold rover
#

so everything sounds pretty straight forward until the last point with the custom executor

ivory sleet
#

you could use MethodHandles or Unsafe if you want to increase speed I guess

#

right

#
public class RegisteredListener {
    private final Listener listener;
    private final EventPriority priority;
    private final Plugin plugin;
    private final EventExecutor executor;
// more
granite stirrup
#

discord changed the boosted on a server badge?

#

pretty sure never looked like this

desert lichen
#

I still have the diamond. But that's not the place to discuss about that, is it ?

untold rover
granite stirrup
#

i would put it in general but i dont feel like moving

untold rover
#

we don't care this is a channel for development not random nonsense

granite stirrup
ivory sleet
#

it gets the already existing executor,
...getDeclaredField("executor")
setAccessible and so on,

then it creates a new executor:

class AdapterEventExecutor implements EventExecutor {
  private final EventExecutor delegate;

  AdapterEventExecutor(EventExecutor delegate) {
    this.delegate = delegate;
  }

  public void execute(Listener listener, Event event) {
    //get current values of event
    delegate.execute(listener,event);
    //get the new values of event (after invoking execute)
    //then check differences between current values and new values
  }
}```
then it sets the field `executor` to one of those adapter event executor instances where it essentially wraps the old/existing executor
solemn shoal
#

how can i make this not throw ConcurrentModificationExceptions

ivory sleet
#

iterator maybe

untold rover
#

sorry 4 ping

solemn shoal
ivory sleet
#

reflection Johni

solemn shoal
ivory sleet
#

o

solemn shoal
untold rover
#

Are you still here in like 40 - 50 min Conclure?

solemn shoal
#

maybe i should make it a while loop instead?

ivory sleet
#

maybe

#

no spacedash, no difference

drowsy helm
#

interesting why that throws one

solemn shoal
#

yeah

ivory sleet
#

also what is rse

drowsy helm
#

red stone event i assume

solemn shoal
#

yeah

ivory sleet
#

still dont know what that is

solemn shoal
#

RedstoneEvents is a HashMap<Long, ArrayList<Integer[]>>

ivory sleet
#

rse += item.size()

solemn shoal
#

im trying to get the size of the Integer[]s

#

the code where im counting things is async

ivory sleet
#

you're getting the size if that list tho

nova mirage
#

How does Bukkit.getScheduler().runTaskAsynchronously work, does it create a new thread for each task given or is it a separate thread that just has all the asynchronous tasks running on it?

drowsy helm
#

separate thread for each task iirc

ivory sleet
#

it uses a scheduled single thread event executor to dispatch a scheduled task which is then delegated to a cached thread pool iirc

solemn shoal
#

how can i lock something?

#

not so familiar with threading in java as i am in C#

ivory sleet
#

synchronized or ReentrantLock

ivory sleet
nova mirage
granite stirrup
#

its been so long since the minecraft migration was said and its still hasnt started yet

solemn shoal
#

even if i lock it, still throws that error

ivory sleet
#

the point of cached thread pool is to have reusable threads

drowsy helm
#

what do you want to use threads for?

ivory sleet
#

but it may grow to achieve concurrency

ivory sleet
#

or entire class

solemn shoal
#

imma test something real quick

#

int rse = RuntimeStore.RedstoneEvents.values().stream().mapToInt(ArrayList::size).sum();

nova mirage
# drowsy helm what do you want to use threads for?

I'm trying to play noteblock music (without the use of NoteBlockAPI since it seems to be broken in 1.17), each thread = one player's music so multiple people can listen to different music at the same time
if this method is inefficient I'm open to other ideas!

drowsy helm
#

you should be able to do that on a single thread

ivory sleet
#

sounds horrible

drowsy helm
#

async is better for stuff like databases and large calculations

ivory sleet
#

a per player thread design is more performance taking than gaining

untold rover
#

Quick side question: Whats the best way to make certain tasks MultiThread? for example we are planning on making a custom miniture version of towny, and the current plan we had required some methods which might take longer to execute, like calculating surrounding plots. or when claiming town chunks take the surrounding x chunks and add them to the town. And doing that on the Main Thread sound very unhealthy.

solemn shoal
#

nope still the same error

#

let me push the current code real fast

drowsy helm
ivory sleet
#

but even a single thread executor would do the job

#

unless you're like hypixel or something

ivory sleet
drowsy helm
#

i mean, hypixel doesnt have 1000 people one one server so even they wouldnt need it

untold rover
ivory sleet
#

I believe a minecraft server is capable of using more than one core right?

nova mirage
solemn shoal
#

not really @ivory sleet

#

anyways links posted to code

drowsy helm
#

so either way you would have to wait for main thread to catchup

untold rover
# ivory sleet its hard to tell unless you'd come out an disclose the exact project

well for example when we first claim the town we go into the center type lets say /town claimnearby 150, and it will take the nearest 150 chunks around the player, process them (which means, save data to file, save data to sql database, get the center of all plots and add the Townblock, modify a bunch of caches and push the changes to files)

#

ffs sorry for the ping

#

I hate the reply system

ivory sleet
#

using the runTaskTimerAsync would definitely lead to some unsynced issues

#

or "rythm ruining issues"

solemn shoal
#

not sure if you saw it

drowsy helm
#

I recently made a factions plugin which needed a chunk claiming system. I used a separate thread to calculate chunk neighbours etc but even then it was fully necessary

ivory sleet
#

spacedash and RedstoneEvents is a Map<K,List<V[]>> essentially?

quaint mantle
ivory sleet
#

and you wanted the summed length of each list?

solemn shoal
#

i want the summed length of each array within each list

untold rover
# drowsy helm so either way you would have to wait for main thread to catchup

yea but also database intense stuff, that loads lots of information from database would be great in a extra thread. for example Invoices, once we oben the Invoice menu for lets say the Police it needs to load 1000+ Invoices from the Database, (even tho they are not displayed at the same time, it loads the first 100, once the player reaches the end of the 100 invoices aka gets to the last page, it starts to load the next 100) but we are experiencing serverwide tps drops if multiple players open the invoice system at the same time, that is caused by a design flaw but also because 14 plugins work on the main thread and do like 100 different tasks per like 10 secs

ivory sleet
dusty sphinx
#

Is there any documentation about how the ip-foward packet works with BungeeCord? Trying to get TyphoonLimbo to work with BungeeCord but I can't seem to figure out the packet.

thorn glade
#

Hello good night, could someone recommend me a good blinder? That it is compatible with bungeecord, I couldn't use ProGuard

ivory sleet
#

@solemn shoal first of all switch to a ConcurrentHashMap<Long, CopyOnWriteArrayList<Integer[]>> for thread safety.

#

or well you could use a lock I guess

#

might be easier that way yeah

solemn shoal
#

i tried using a lock as you can see in the commented out code below what i linked, still threw that error

ivory sleet
#

and you only use RedstoneEvents there?

solemn shoal
#

yep

ivory sleet
#

(like nowhere else)

solemn shoal
#

and in another thing but there it runs sync

ivory sleet
#

idm

#

its async also then

solemn shoal
#

in this command everyhthing runs sync

ivory sleet
#

well its seen as async also

#

to the async runnable timer

#

anyways

quaint mantle
#

i check if args aren't set, by having an if statement with args.length() == 0?

#

im just confused

granite stirrup
#

args.length?

#

without ()

quaint mantle
#

a

#

thanks T-T

ivory sleet
#
class RuntimeStore {
    static final Lock lock = new ReentrantLock();
    public static final HashMap<Long, ArrayList<Integer[]>> RedstoneEvents = new HashMap<>();

    public static int computeTotalArrayLength() {
      int result;
      lock.lock();
      try {
        result = RedstoneEvents.values().stream().mapToInt(ArrayList::size).sum();
      } finally {
        lock.unlock();
      }
      return result;
    }
}
``` @solemn shoal maybe try this
#

then call the method instead

solemn shoal
#

well i just implemented the thing with the concurrent hashmap

ivory sleet
#

uh undo that

solemn shoal
#

well it seems to work

ivory sleet
#

the snippet I sent you should be more perfomant

#

CopyOnWriteArrayList and ConcurrentHashMap are slower compared to the non thread safe collections

solemn shoal
#

wouldnt that lock the server until its finished?

ivory sleet
#

yes but ConcurrentHashMap also do that

solemn shoal
#

right.

ivory sleet
#

it locks to ensure thread safety when mutating

#

copy on write arraylist provides copies of itself when u want to mutate, then the changes of the copies gets reflected to the list

solemn shoal
#

right

ivory sleet
#

so yeah I mean choose which one you want but yeah I have spoken I guess

solemn shoal
#

i mean the version with copy on write arraylists doesnt seem to throw errors

#

i guess ill see which one is faster

ivory sleet
#

yeah thats the gist of copyonwritearraylist

#

every change is just done on a copy of the original list

#

but then that change is safely reflected to the original list

solemn shoal
#

yeah

#

somehow that last thing seems slower

ivory sleet
#

alrighty

solemn shoal
#

not sure

#

could just be mc being mc with its unstable tps

#

(im watching the mspt)

ivory sleet
#

hmm yeah

#

well actually its plausible

solemn shoal
#

since that call is being made on every tick

ivory sleet
#

the former allows the runtasktimerasync to do compute concurrently

glass sparrow
#

is player#openInventory always super slow?

opaque quail
#

Is spigot for bedrock?

ivory sleet
#

No

ivory sleet
desert lichen
#

I'm back again ! One little thing, I changed the default world to A. It generated nether and end for A. However, for the world that I want to delete and recreate (let say B), the nether and the end are those of the default world A. Is there a way I can have nether and end for B and only for B ?

glass sparrow
shut field
ivory sleet
#

Hmm I mean could be ping also and the client

shut field
#

can someone tell me what is causing this error?

opaque quail
#

Could anybody direct me to a bedrock plug-in that allows for custom generation and structures?

ivory sleet
#

Altho yes it’s slightly slow, well in fact you could argue for that the entire spigot api is slow because of the delegation it goes through thus more bytecode instructions

hasty prawn
ivory sleet
#

But it’s negligibly

shut field
worldly ingot
quaint mantle
#

so i know its possible to WRITE to a file, but is it possible to edit specifically one line? all of the java resources i see only write to the file (i think)

hasty prawn
glass sparrow
solemn shoal
#

uh @ivory sleet small update

#

its throwing the errors once again

ivory sleet
#

uh lol

shut field
worldly ingot
#

MOB(list, string)

hasty prawn
#

On that line... when you define MOB...

shut field
#

thanks, makes sense

hasty prawn
#

An Enum is all static, you have to supply everything when you make it

worldly ingot
#

It's like doing YourEnum MOB = new YourEnum(list, string)

#

only enums take out the boilerplate of that

ivory sleet
#

did u use the former or latter?

hushed garnet
#

What's the 1.17 code to make this work?

import net.minecraft.server.v1_16_R3.PacketPlayOutOpenBook;
cobalt lagoon
#

What are you trying to do spacedash?

solemn shoal
#

thats the latter one

solemn shoal
#

im trying to monitor redstone events as a bossbar

ivory sleet
#

use the former one then 🀣 spacedash

cobalt lagoon
#

Which line generated the error though?

solemn shoal
#

fun

ivory sleet
solemn shoal
ivory sleet
#

uses mojang mappings now

hasty prawn
#

Doesn't it only use Mojang Mappings if you explicitly tell it to

ivory sleet
#

uh yeah

hasty prawn
#

Otherwise it's obfuscated, right?

ivory sleet
#

yup

ivory sleet
hasty prawn
#

Easier to use, a pain to setup πŸ˜†

ivory sleet
cobalt lagoon
#

Well, it’s a concurrent error.