#help-archived

1 messages · Page 58 of 1

frigid ember
golden vault
#

is if(!getConnection().isClosed()) { what is actually at line 66?

keen moth
#

Also don't run your sql queries on the main thread. You're going to experience issues very soon if you haven't yet.

frigid ember
#

Is WorldServer the same as MinecraftServer?

nimble sage
#

Remember to always run your SQL queries in the Main Thread and definitely not Async!

wooden harness
#

WorldServer isn't a server

#

a more fitting name for it is ServerWorld, as it's a subclass of the World class in the MC code, specifically for server-related worlds

frigid ember
#

Anyone mind givin me a hand, I'm having an issue with GSON

#
        MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();

Yeah I got it

kind berry
#

so know the give command /give <player name> <object> <number>, well I am trying to make the part were it searches for the players and uses them for the command does anyone know how I should do that?

upper hearth
#

args[0]

frigid ember
#

What do you mean? Like run the give command to give every single player something?

upper hearth
#

Or the Player object from the string?

frigid ember
#

Whats the difference between EnumProtocolDirection.CLIENTBOUND and EnumProtocolDirection.SERVERBOUND? I'm having trouble spawning an npc and I don't know which one to use

#

If you just want to give everyone something use @a instead of a player name lmao

upper hearth
#

Or make the command /giveall

wanton delta
#

yo is there a way to get blockdata from a material

#

nvm

#

Material#createBlockData

kind berry
#

@frigid ember no I'm not giving I'm making a command that when I type in the arg it will set a variable to that arg that arg will get player names tho

frigid ember
#
        PlayerList playerList = ((CraftServer) Bukkit.getServer()).getHandle();
        GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "jim");
        WorldServer world = ((CraftWorld) p.getWorld()).getHandle();
        MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();

    EntityPlayer pl = new EntityPlayer(server, world, gameProfile, new PlayerInteractManager(world));
    
    DummyPlayerConnection con = new DummyPlayerConnection(server, new DummyNetworkManager(EnumProtocolDirection.CLIENTBOUND), pl);
    
        pl.spawnIn(world);
        pl.playerInteractManager.a((WorldServer) pl.world);
        pl.playerInteractManager.b(world.getWorldData().getGameType());
        pl.setPosition(p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
        world.addEntity(pl);
    }

Hey guys, when I spawn in a player I have to rejoin to see it, how do I fix it so it spawns when I type the command instead?

upper hearth
#

Bukkit.getPlayer(args[0]) will get the Player Object and you can use that to give them the item @kind berry

frigid ember
#

If you just want it to get all player names just run through a for loop and stick them in an arraylist?

kind berry
#

I'm new to java coding what does a for loop do?

#

btw how would I do that?

frigid ember
#

You should probably learn the basics first

fading owl
#

^

frigid ember
#

He just said hes new and is trying to learn, how do those comments help him at all?

fading owl
#

Telling someone to learn the basics is helpful.

frigid ember
#

This isn't a place for us to spoon feed the basics for people, if someone wants to do that then that's on them, but we're not teachers

fading owl
#

Gotta walk before you can run.

frigid ember
#

He's asking for help on the basics

#

There's hundreds of guides and free learning material out there

#

Yes there is, and he choose this place to come for help

#

You can sit here and explain it if you want

wooden harness
#

or just do a simple google search 😅

frigid ember
#

My advice is to go away and use the available meterial to learn the basics. A for loop is used in almost every language, and is pretty much day one

crimson cairn
#

for loop repeats the code until a condition is met

#

is it that hard to explain

frigid ember
#

No, thats a while

kind berry
#

I have tried google and youtube searches none have showed what I need

crimson cairn
#

that is a while too

wooden harness
crimson cairn
#

although my reply was supposed to be right to the point

kind berry
#

@wooden harness sorry I mean not for the for loop

frigid ember
#

A for loop is meant to be used if you have a set amount of times you wish to run. A while should be used if you intend to loop for an unknown amount of times

crimson cairn
#

yes

upper hearth
#

I rarely use while loops tbh

frigid ember
#

Yeah

#

They have their uses but eh, they don't come up all too often

crimson cairn
#

user input or game loop

#

but thats about it

upper hearth
#
while(user entered something dumb) {
  askIdiotAgain();
}
frigid ember
#

While loops are also great for never ending loops lmao

crimson cairn
#

who uses do while

#

legit question

upper hearth
#

I've never ONCE used do while

#

I could never even really understand why they're a thing

kind berry
#

ok thanks I get what a for loop is but idk how to do the thing @frigid ember sed to do with the arraylist

frigid ember
#

While(true){
Spam.spam();
}

#

Ez inf loop

fading owl
#

I find the most common use for a while-loop is generally when using a Queue or some Iterator implementation.

crimson cairn
#

yea

upper hearth
#

Oh yeah Iterator.next()

kind berry
#

for (Player target : Bukkit.getOnlinePlayers()) {
if (args[0].equalsIgnoreCase(target.getDisplayName())) {

upper hearth
#

I forgot that existed

crimson cairn
#

never seen anyone use a do while

#

what about labels

kind berry
#

would that work?

crimson cairn
#

thats an enhanced for loop

fading owl
#

labels have their usage

crimson cairn
#

yea

fading owl
#

nested for-loops

frigid ember
#

Java docs are your best friend

fading owl
#

are a batch though

crimson cairn
#

goto is a keyword in java

#

although not used by the JVM

frigid ember
#

Wait hold up, why are you using a for loop to check if an argument is a players name?

fading owl
#

what

#

goto is not supported in java

crimson cairn
#

oh thats display name

fading owl
#

okay whew

upper hearth
#

Just use Bukkit.getPlayer(args[0]) @kind berry, no reason to loop through the players

kind berry
#

@upper hearth ok but where?

#

would I put it

crimson cairn
#

eliminate the loop @kind berry

fading owl
#
Player target = Bukkit.getOnlinePlayers().stream().filter(o -> o.getDisplayName().equals(args[0])).findAny().orElseThrow(IllegalStateException::new);
crimson cairn
#

and replace it with that

#

lambdas

#

lol

upper hearth
#

Seems a bit complicated for what he's trying to do lmao

fading owl
#

welll does getPlayer

#

use display name

crimson cairn
#

dont think so

fading owl
#

so there u go

crimson cairn
#

UUID or name

#

not display name

upper hearth
#

He shouldn't be using getDisplayName anyways, the argument is the player name

fading owl
#

im a monkey ok

#

i do what im told

#

and eat my bananas

upper hearth
#

lmao

fading owl
#

XD

crimson cairn
#

i could never figure out how lambdas work

fading owl
#

what confuses u young one

crimson cairn
#

wtf is a
o -> o.getB....

#

->

fading owl
#

o is a reference to the object in the stream

crimson cairn
#

yea

fading owl
#

-> indicates the usage of a functional interface

upper hearth
#

It's kinda like for each I think

crimson cairn
#

but the whole lambda notation

#

pretty much replaces new Runnable() {...}

#

huh

fading owl
#

ehhh

#

in the context of an annonymous inner class?

crimson cairn
#

yeah

fading owl
#

sure

#

thats one way to think of it

crimson cairn
#

screw it

#

id rather type out new Runnable() {...}

upper hearth
#

I mainly use them because IntelliJ yells at me if I don't :(

fading owl
#

aint nobody got time for that

crimson cairn
#

intellij autocompletion is OP

upper hearth
#

Tis

#

Although if I try doing List<String> strings = new ArrayList<>(); without importing ArrayList it will autocomplete to ArrayListOutOfBoundsException... So I end up typing List<String> strings = new ArrayListOutOfBoundsException() all the time

frigid ember
#

Rip

fading owl
#

rip wut

frigid ember
#

Dess and his autocomplete

fading owl
#

poor lad

upper hearth
#

It's sad yes

crimson cairn
#

lol

#

odd

fading owl
#

regardling lambdas though, they're pretty helpful day to day

#

especially since the collection api is so broadly used and inherity supports them

#

definitely worth learning

willow topaz
#

anyone else have a slime spawner? does it spawn slimes?

frigid ember
#

Hey guys, when I try spawning an entity it crashes my server
https://hastebin.com/jabugohove.shell

    PlayerList playerList = ((CraftServer) Bukkit.getServer()).getHandle();
    GameProfile gameprofile = new GameProfile(UUID.randomUUID(), "hithere");
        WorldServer world = ((CraftWorld) p.getLocation().getWorld()).getHandle();

    EntityPlayer entity = new NPCEntity(playerList.getServer(), world, gameprofile, new PlayerInteractManager(world));
        world.addEntity(entity);
        world.players.remove(entity);

        PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, entity);
        
        for (Player online : Bukkit.getOnlinePlayers()) {
            ((CraftPlayer) online).getHandle().playerConnection.sendPacket(packet);
        }

        entity.getBukkitEntity().setMetadata("NPC", new FixedMetadataValue(main, true));

    
    msg(p, "Entity spawned");
devout sierra
#

I need a plugin that can disble gravity, is anyone aware of one that does that?

#

I only found one that costs money which I rather keep for myself right now because of corona

agile rock
#

I created a coinflip plugin and whenever someone does a coinflip, the tps drops

#

Any reasons on why this is happening?

#

It seems that whenever a coinflip game is active, the server tps drops a little

keen moth
#

We can't tell without some code 😛

chrome edge
#

@frigid ember world.addEntity(entity); world.players.remove(entity);

#

Delete those

#

I don't know NPCEntity class so I cannot say exactly what problem is causing

#
NPC.getBukkitEntity().setRemoveWhenFarAway(false);
NPC.setLocation(this.location.getX(), this.location.getY(), this.location.getZ(), this.location.getYaw(), this.location.getPitch());``` for creating nms player
#

@frigid ember which java version do you use? I guess it's 1.8 if so try to use new java method to get and set datas

#

You can use it in thread for doing on background

cobalt folio
#

hello i need some help

chrome edge
#
    try (ResultSet result = statement.executeQuery("SELECT * FROM x WHERE y = '" + cc + "'")) {
        //code
    }
}).start();```
cobalt folio
#

so basically i have essentials plugin downloaded and i have kits but when i put my sign down everything works fine and i can get the kits but the people without op cant get the kits its says " you dont have access to this kit" anyone plz help

chrome edge
#

@cobalt folio it's not essentials plugin help discord. You've to ask to owner of essentials or its community.

cobalt folio
#

this is help section ?

keen moth
#

Because they need the permission

#

Look up essentials permissions

cobalt folio
#

yea ik but it didnt work

#

i gave them perms

chrome edge
#

This is help section not about the spigot plugins...

cobalt folio
#

yes it is

chrome edge
#

...

cobalt folio
#

....

agile rock
#

@cobalt folio This is not the essentials support discord

cobalt folio
#

ok fine thanks for the help

agile rock
#

yeah cya

frigid ember
#

how to check if their last block was ice so that the anticheat knows that they are not speed hacking

chrome edge
#

@frigid ember For anti cheats I usually use PacketPlayInFlying packet for checking their movement. You may save their last location that is acceptable for return and if the anti cheat detect something teleport them to the location.

#

Minecraft getBlock method is broken

#

If you stay on edge of block it gives you air or other blocks instead of you staying on

#

You can check under block with basic math.

frigid ember
#

i have tried most of those things and for some reason just cant get it

chrome edge
#
    for (double z = -0.3; z <= 0.3; z += 0.3) {
    if (location.clone().add(x, -0.5001, z).getBlock().getType() != Material.AIR) {
        return location.clone().add(x, -0.5001, z).getBlock();
        }
    }
}```
#

try to use it and feedback to me

frigid ember
#

isnt it p.getLocation()

#

not location i dont have a variable called location

chrome edge
#

yeah you can change as player location

#

but it's just example of what I meant to say. After try it, make your own method based on this method.

frigid ember
#

where should i put this?

chrome edge
#

just make a method for getting block

#

like public static Block getUnderBlock(Location location)

frigid ember
#

hmm weird it wants me to change it to void even tho its returning a block

#

oh wait

#

i the big dumb

chrome edge
#

put return null end of the code

frigid ember
#

yea

chrome edge
#

-_-

frigid ember
#

lmfao

chrome edge
#

Okay. Try to understand what you did then make your own method for getting block. You may also make another method based on it.

#

Good luck

frigid ember
#

i am still confused i get on the method works but i dont get what i do next to see if it is Ice, or Packed ice so i cant false flag

chrome edge
#

if (getUnderBlock(location)).getType() == Material.ICE)

#

Why don't you know that?....

frigid ember
#

cause i am new to checking blocks and stuff i did more of the designing wanted to get into making plugins and ik a bit of java but searching thru docs i cant find anything

gentle socket
#

I have two servers:
Main dedi server for spigot (1.1.1.1)
Vps for bungeecord (2.2.2.2)

I have got dns records:
A hub.example.net to 2.2.2.2
A pvp.example.net to 2.2.2.2

Bungeecord config:
1st listener:
host: hub.example.net:25565
forced_hosts:
unconfiguredhost: unconfiguredserver
force_default_server: true

2nd listener:
host: pvp.example.com:25565
forced_hosts:
pvp.example.net: pvp
force_default_server: false

Connecting to hub.example.net brings to hub and is all good. Connecting to pvp.example.net brings to the hub as well though? If I change 2nd listener port to 25566 and use pvp.example.net:25566 to connect then it brings to pvp. Is it not possible to make it with default port to bring it to pvp server?

chrome edge
#

If you make an iptunnel for connection both server machine, it probably bridge together.

frigid ember
#

So after having a method that is a boolean to check if the player is on ice with the other method i would do what now to save it then remove after sometime i did a Map and it just errored alot earlier

chrome edge
#

try and find it. @frigid ember

#

do debug

frigid ember
#

I dont really get it tho how do i remove after sometime because last thing i did was runLater and it would error for it trying to remove stuff when it wasnt in it

gentle socket
#

@chrome edge do i need to use srv record to get rid of port numbers for ppl? Or that wouldnt work?

chrome edge
#

Firstly if you connect both server with iptunnel you should use 0.0.0.0:port

#

but if you want to get rid of port you can do it with srv record as you said

#

I'm not experienced with that. That's all I know.

gentle socket
#

on vps bungeecord i have:
servers:
hub:
address: 1.1.1.1:3001

And on dedi server spigot i have:
server-port=3001
server-ip=
empty ^^

#

is this wrong way?

chrome edge
#

Have you try use 0.0.0.0 both dedicated?

#

like hub:0.0.0.0:3001

#

and change it server.properties also

#

@gentle socket if you're using OVH or hetzner it'll be problem for you. There's DDOS protection that blocks iptunnel. You have to know how to setup up this things.

gentle socket
#

yeah im pretty new to this. I use OVH for bungeecord vps and local server center for spigot dedi

#

so if bungeecord vps gets ddosed, its only gonna reach that vps

#

thats the idea

chrome edge
#

I knew that was the idea well I've little experience what you talking about xD

#

If you under the dos attack it'll break the bridge and your players will fall.

#

due to ovh protection.

gentle socket
#

If I understood correctly, the ip address that you put into bungeecord to connect spigot server together goes through proxy and nobody can see spigot server's ip

#

only the ip bungeecord runs on

#

ooh

#

hmm

#

guess ill need to wait for someone to ddos us to see if its setup correctly xD

chrome edge
#

yep good luck xD

quaint folio
#

Hello. I just wanna ask a question. So my other owner might have my plugins, if he leak it, I worried I would get ban on Spigot. If that happens, will I get unban? I am just worried.

chrome edge
#

You are the responsible one. You may be banned from spigot.

quaint folio
#

Yes but I had no choice. I got betrayed by a friend I known for a long time. He just stole all of the server money. So I am worried if he is thinking to get me ban on Spigot. Does Spigot strict about this? :l

chrome edge
#

As I know unfortunately it makes you ban. When you buy/download the plugin, you accept to TOS.

quaint folio
#

My day can't get anymore worse surely. Thank you for answering my question. I really hope I am not getting ban anytime soon. I am sure this situation had happened before, just I don't know what will happen.

steep acorn
#

Can someone tell my why this always crashs when i go in creative Inventory?:

    public void handleNavigatorGUIClick(InventoryClickEvent event) {
        if(!(event.getWhoClicked() instanceof Player)) return;
        Player player = (Player) event.getWhoClicked();
        if(event.getClickedInventory().getTitle().equals(GUI_NAME)) {
            
            FileConfiguration config = Main.getPlugin().getConfig();
            String i = "0";
            
            switch(event.getCurrentItem().getType()) {
                
            case GOLDEN_APPLE:
                i = "Spawn";
                break;
            
            case BED:
                i = "1";
                break;
                
            default:
                break;
            
            }
            
            World world = Bukkit.getWorld(config.getString(i + ".World"));
            double x = config.getDouble(i + ".X");
            double y = config.getDouble(i + ".Y");
            double z = config.getDouble(i + ".Z");
            float yaw = (float) config.getDouble(i + ".Yaw");
            float pitch = (float) config.getDouble(i + ".Pitch");
            
            Location loc = new Location(world, x, y, z, yaw, pitch);
            
            player.teleport(loc);
        }
    }```
frigid ember
#
**[03:35:11 ERROR]: Could not pass event PlayerMoveEvent to AntiGamingPhone vHOT PATCH 1.01
org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:296) ~[server.jar:git-GenericSpigot-5728a59]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[server.jar:git-GenericSpigot-5728a59]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[server.jar:git-GenericSpigot-5728a59]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:497) [server.jar:git-GenericSpigot-5728a59]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:482) [server.jar:git-GenericSpigot-5728a59]
        at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:270) [server.jar:git-GenericSpigot-5728a59]
        at net.minecraft.server.v1_7_R4.PacketPlayInFlying.a(SourceFile:137) [server.jar:git-GenericSpigot-5728a59]
        at net.minecraft.server.v1_7_R4.PacketPlayInPosition.handle(PacketPlayInPosition.java:35) [server.jar:git-GenericSpigot-5728a59]
        at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:204) [server.jar:git-GenericSpigot-5728a59]
        at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [server.jar:git-GenericSpigot-5728a59]
        at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:801) [server.jar:git-GenericSpigot-5728a59]
        at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:309) [server.jar:git-GenericSpigot-5728a59]
        at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:650) [server.jar:git-GenericSpigot-5728a59]
#
        at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:555) [server.jar:git-GenericSpigot-5728a59]
        at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [server.jar:git-GenericSpigot-5728a59]
Caused by: java.lang.NullPointerException
        at me.l3ilkojr.gamingphone.util.BlockUtils.onIce(BlockUtils.java:34) ~[?:?]
        at me.l3ilkojr.gamingphone.checks.movement.SpeedA.onPlayerMove(SpeedA.java:38) ~[?:?]
        at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_251]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_251]
        at org.bukkit.plugin.java.```
chrome edge
#

@frigid ember make sure chunk is loaded.

frigid ember
#

how would i do that?

#

Also, you should create an inventory and check if the inventory is an instance of it, better than checking for the name

steep acorn
#

is that a solution for me or for rbuh? 😅

frigid ember
#

you

#

Oh not same person

steep acorn
#

thx i'll try

frigid ember
#

anyone know how to check if the chunk is loaded tho?

#

check what hawk does

#

So @steep acorn you should do that, as it might conflict with other plugins (inventories with the same name).
You should post the stack trace, because “it crashes” is pretty generic

#

FatalPacket was that to me?

#

yes

#

Well where do they do that because i not searching 20 files to find one thing

#

Block.getWorld().isChunkLoaded(Block.getX() >> 4, Block.getZ() >> 4)
but I dont think its because of chunk loaded

#

thats what i think too

#

what is line 34 in block utils

#

        if (getUnderBlock(location).getType() == Material.PACKED_ICE || getUnderBlock(location).getType() == Material.ICE) {
            return true;
        }


    public static Block getUnderBlock(Location location) {
        for (double x = -0.3; x <= 0.3; x += 0.3) {
            for (double z = -0.3; z <= 0.3; z += 0.3) {
                if (location.clone().add(x, -0.5001, z).getBlock().getType() != Material.AIR) {
                    return location.clone().add(x, -0.5001, z).getBlock();
                }
            }
        }
        return null;
    }```
steep acorn
#

@frigid ember there is no stack trace, it just stops working until i die and respawn

frigid ember
#

What stops working? The server?

steep acorn
#

no, the plugin.

#

its like its not on the server anymore

#

there are other cmds that stop working

#
        Player player = (Player) event.getWhoClicked();
        if(invent == null) return;
        if(event.getClickedInventory() instanceof invent) {```
like that?
#

cause this isn't working

chrome edge
#

@frigid ember did you check if there're not an air block?

#

'cause if there's no blocks under the player it returns null

#
            return true;
        }```
#

and don't use method more...

#

Just save as data start of the code.

#

Block underBlock = getUnderBlock(location);

#

As I know, PlayerMoveEvent is controlling chunk before the its call. If you're using packets, make sure chunks are loaded.

frigid ember
#

One last time, is player.isFlying() meant to be updated when they stop flying without double tapping space?

#

If I am sure yes

chrome edge
#

@frigid ember if you're flying, it returns true

#

double space active and deactive

#

or player.setFlying(true)

frigid ember
#

but if they collide with ground rather than toggling it, isFlying() isnt updated?

chrome edge
#

yes

frigid ember
#

but thats.. kinda cringe

chrome edge
#

It's not for checking if player is using hack or not...

#

why is it cringe?

frigid ember
#

isFlying() would suggest the player is flying

chrome edge
#

That's correct. So what's wrong?

#

flying method in spigot means that player flying using default minecraft features.

#

double space

manic raptor
#

Hi all, I'm making a Plugin where Players can interact with NPC Players (EntityPlayers).
They are made visible to the Player via sending them a Packet to spawn an EntityPlayer. This all works well, but I now wish for Players to be able to interact with these NPC's by clicking on them.

I've also managed to get this working, by using the tradional way of injecting/removing Players and making use of the ChannelDuplexHandler and ChannelPipeline classes from a mix of different tutorials online.
For this simple task, I have chosen to not use ProtocolLib as a learning experience.

Now whilst the following works, I understand that it may not be thread safe or efficient.
For simplicities sake I've reduced everything down to one class, to what would be in a basic tutorial.

Could someone please let me know why the following wouldn't be thread safe / is inefficient?
And by extension how could I do something complicated like Packet Listening on another thread to make this more efficient?

#
public class PacketCancel extends JavaPlugin implements Listener {
    
    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(this, this);
    }
    
    @Override
    public void onDisable() {
        
    }
    
    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        injectPlayer(event.getPlayer());
    }
    
    @EventHandler
    public void onLeave(PlayerQuitEvent event) {
        removePlayer(event.getPlayer());
    }
    
    private void removePlayer(Player player) {
        Channel channel = ((CraftPlayer)player).getHandle().playerConnection.networkManager.channel;
        channel.eventLoop().submit(()->{
            channel.pipeline().remove(player.getName());
            return null;
        });
    }
    

    private void injectPlayer(Player player) {

        ChannelDuplexHandler channelDuplexHandler = new ChannelDuplexHandler() {
            
            @Override
            public void channelRead(ChannelHandlerContext channelHandlerContext, Object packet) throws Exception {
                if (packet instanceof PacketPlayInUseEntity) {
                    // do stuff
                }
                
                super.channelRead(channelHandlerContext, packet);
                
            }
            
            @Override
            public void write(ChannelHandlerContext channelHandlerContext, Object packet, ChannelPromise channelPromise) throws Exception {
                super.write(channelHandlerContext, packet, channelPromise);
            }
            
        };
        
        ChannelPipeline pipeline = ((CraftPlayer)player).getHandle().playerConnection.networkManager.channel.pipeline();
        pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
    }
    
frigid ember
#

whats the method to check if someone is jumping?

bronze marten
#

PlayerMoveEvent?

#

then just check y diff

lament wolf
frigid ember
#

Ok so, i need to fix the problem with someone getting hit and them jumping making them go further then normal speed my AC Flags so anyway to fix this?

#

i have it stopping when taking Velocity but it just doesnt work after them getting hit and jumping

rocky canopy
#

hey guys, not sure if this is the best place to ask, I'm looking for a good grappling hook plugin and a weapons plugin that lets you use crossbows as block-destroying weapons

green hornet
rocky canopy
#

the search bar has worked only so-so for me so far, wondering if anyone has some recommendations

#

(open source would be great!)

fleet crane
#

Entity.remove() lol

sharp dew
#

@lament wolf There is an action value and it can range from 0-4 and it does differnte things

fleet crane
#

Make sure you dont call it async

green hornet
#

i removed all entity.remove() and moved them to a single place where i wrap it in a scheduleSyncDelayedTask

#

that should have been fine right?

fleet crane
#

looks reasonable

#

and yes, idk about that crash specifically

#

could be a 1.14 bug

frigid ember
#

Would i just check if someone is Taking Velocity and there Y is changing should i then dont flag?

sharp dew
#

@lament wolf and for each action value you need to send different data, that is specified at the right of the action column

rocky canopy
#

also, how much performance do you loose by running a server inside a docker container?

#

i've heard networking can take a hit

lament wolf
#

@sharp dew So where I should insert these value ?

agile flare
#

Hello

#

Is anybody there?

sharp dew
#

you should use a dataWatcher

agile flare
#

?

sharp dew
#

or you should use reflection to access the private fields of the packet

#

can i ask you what you need to do

#

@lament wolf you can also construct the packet by writing
new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.(ACTION), playerAffected)

lament wolf
#

new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.(3), playerAffected) should work ? @sharp dew

sharp dew
#

@lament wolf for the action you can chose between ADD_PLAYER, UPDATE_GAME_MODE, UPDATE_LATENCY, UPDATE_DISPLAY_NAME, REMOVE_PLAYER;

#

but yes it should work

lament wolf
#

So

#

If I wann set the player gamemode to 2

#

How I'll do that?

sharp dew
#

you should change the gamemode of the EntityPlayer and set the action to update gamemode

lament wolf
#

Something like that:

#
EntityPlayer entity;
...
entity.setGamemode(2);
packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, entity);
aPlayerConnection.sendPacket(packet);```
#

?

sharp dew
#

yes

#

but

#

to set the gamemode you have to use player.playerInteractManager.setGameMode();

lament wolf
#

Yeah okay :relieved:

#

Ty

#

Another question:

If I want to move an entity, should I use Entity Position and Rotation or Entity Velocity ? I saw Entity Move but it doesn't do much good from what I understand

sharp dew
#

i know the the varius different packet are used to reduce data consumption and so if you don't move but only rotate you don't send the position data

#

but i think you should send Entity Position and Rotation

#

because normaly the client sends those packets

lament wolf
#

Okay,

#

well

#

something's bothering me in their fields:

#

For example the X

sharp dew
#

yes

lament wolf
#

Look at the parenthesis

frigid ember
#

hi

#

how are you all

sharp dew
#

Hi

lament wolf
#

What does that mean ? If I want to take 3 steps forward the X of the entity, I should do

frigid ember
#

hoo wana play minecraft

lament wolf
#

Such as (10* 32 - 7* 32) * 128

frigid ember
#

wat are you taking about

lament wolf
#

packet Entity Position and Rotation

sharp dew
#

i think the coordinates should be modulo 8 becuse that is the maximum ammount of blocks you can move with this packet. but i'm not really sure how to use it

#

maybe it's easier with the Entity Teleport packet

lament wolf
#

rather between 8 and -8 than module 8, no?

sharp dew
#

yes my bad

lament wolf
#

np

#

so

#

this is relative coordonate ?

#

Cuz

vale slate
#

try to look into other mobs like zombies, there should be the correct implementation somewhere

sharp dew
#

now i get it if you do (curr * 32 - prev * 32) * 128 it should work with any coordinates

lament wolf
#

let us assume that my entity is located at (30, 40, 30), I want to move it up three

sharp dew
#

because the formula calculates the delta of the coordinates

#

you should do (43 * 32 - 40 * 32) * 128

lament wolf
#

Okayy

#

Gonna try it

sharp dew
#

@lament wolf be sure to use int for doing the calulation and the cast it back to short

#

cuz it might overflow

lament wolf
#

double/float, no ?

sharp dew
#

or double is good too

lament wolf
#

PacketPlayOutPosition is the corresponding parcket ?

sharp dew
#

gimme a sec

lament wolf
#

Yep =)

sharp dew
#

dosen't seem like it

lament wolf
#

🤔

sharp dew
#

cuz this is the constructor of the packet public PacketPlayOutPosition(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, int i) { this.a = d0; this.b = d1; this.c = d2; this.d = f; this.e = f1; this.f = set; this.g = i; }

#

too many fields

lament wolf
#

Oh shit

#

wiki lies to me

#

:p

sharp dew
#

it's cuz the names are not the same sadly

lament wolf
#

PacketPlayOutEntity.PacketPlayOutRelEntityMove opinion ?

#

fields is okay

sharp dew
#

seems right

lament wolf
#

But

#

nothing, everythings good

#

tyy

manic raptor
#

Is using ProtocolLib thread safe?
eg. Just getting the ProtocolManager and adding a packet listener?
(Such as the tutorial on the bukkit page? https://dev.bukkit.org/projects/protocollib/pages/tutorial)

By thread safe I mean should I be putting this on a different thread because it's sending / receiving packets? Or does ProtocolLib do that for you?

hoary parcel
#

Why would you register a packet listener async, lol

sharp dew
#

i'm tring to implement a TabCompleter class but i don't if and where i should register it like with an eventListener

icy pecan
#

Guys can sb help me with my SKYBLOCK, i want some for free, bcs i have 1.13 server, and i download skyblock, and its not working

manic raptor
#

@hoary parcel I'm new to this, could you explain why you wouldn't? 🙂 I assumed that (most)code that is sending / receiving packets should be async.

hoary parcel
#

Your listeners will be executed on netty threads

#

No need to run the register code async

icy pecan
#

And RN i downlaod LuckyPerms, i reload server, and my server can t start

cold wharf
#
String playerName = command.getArguments()[0];
sendMessage(playerName, command.getChannel());
Player player1 = (Player) Bukkit.getPlayer(playerName);

Why is this not working? It gives this error: https://paste.md-5.net/ivapotenaf.css

#

The error is for Player thing

#

Player player1 = (Player) Bukkit.getPlayer(playerName);

red linden
#

The player is probably offline

cold wharf
#

How do I get offline player

red linden
#

Bukkit#getOfflinePlayer

cold wharf
#

Oh okay thank you

remote socket
#

What is the best method to get which player killed an entity?

cold wharf
#

@red linden that didn't work

#

It still gives an error

red linden
#

Did you check if the player name is correct?

#

And you probably should use the player's UUID instead

cold wharf
#

No I can't do that

#

because I check for the argument

remote socket
#

How can it be replaced with null check. Surely an arrow also counts as an entity etc

red linden
#

because I check for the argument
@cold wharf Use an UUID fetcher

cold wharf
#

How to do that? Sorry I am new

cold wharf
#

@remote socket arrow is a projectile

#

Until it lands

hoary parcel
#

I bet getentity returns livingentity for you there @remote socket

remote socket
#

So getkiller also must be Player then? not another mob

vernal spruce
#

It only return a player if there is one

remote socket
#

// getKiller() returns a Player, so you don't have to check if it's a player.

#

yes it does

cold wharf
#
    public static UUID getUUID(String playername) {
        String output = callURL("https://api.mojang.com/users/profiles"
                + "/minecraft/" + playername);
        StringBuilder result = new StringBuilder();
        readData(output, result);
        String u = result.toString();
        String uuid = "";
        for (int i = 0; i <= 31; i++) {
            uuid = uuid + u.charAt(i);
            if (i == 7 || i == 11 || i == 15 || i == 19) {
                uuid = uuid + "-";
            }
        }
        return UUID.fromString(uuid);
    }

@red linden So I only need this right?

red linden
#

Yeah, but please cache the results as Mojang is rate-limiting their endpoints.

cold wharf
#

Huh?

narrow crypt
#

So i have a plugin that summons a chest on LightningStrikeEvent but for some reason its not working, to figure out where the problem is i put a system outprint as first action after the event:

void Lighting(LightningStrikeEvent event){
        System.out.println("syte");

But this wont even get printed out, any idea why?

frigid ember
#

@EventHandler?

narrow crypt
#

yea i do have that

#

currently trying monitor

#

also not working

#

commands work

#

enabling goes normal

#

any ideas?

frigid ember
#

I'm in big need of help, so this happends to my server, same time every day it's always 10:40, server running smoothly other than that, i never have tps drops or issue with ram, no errors throughout the days either, it's just this thing that happends exact at 10:40 every day, and i can't seem to understand what it is. But maybe anyone here can?

https://mcpaste.io/d837a111357a6baa

#

@slim hemlock fat

lament wolf
#

@sharp dew wtf dude 😂
The packet that we talked about, it's teleportation

sharp dew
#

the first one?

slim hemlock
#

thanks fanclub

lament wolf
#

The

sharp dew
#

@lament wolf or the one you sad

lament wolf
#

PacketPlayOutEntity.PacketPlayOutRelEntityMove

sharp dew
#

What

#

how

#

there is rel in the name

lament wolf
#

idk idk

#

There is not a field fot this ?

#

or something like that

sharp dew
#

i'm looking in the code

wanton delta
#

@frigid ember this is spigot server no paper support

#

Paper has their own discord

blissful verge
#

How do I make plugins only available in like survival world and not in hub wolrd

rapid holly
#

A friend of mine seems to not be able to lose hearts but they can lose hunger

#

Could anyone probably help me?

inland meteor
#

What's the replaced version of ProxiedPlayer.getAddress()

frigid ember
#

Is it allowed to have a free resource and a premium version of it; lets say the premium one gets updates a day before the free one but its more considered the donation version of it

frigid ember
storm vessel
#

Does anyone have suggestions for a good VPS provider? I am looking to spend around $60-100. I am currently hosting on my own PC. We average around 15 players and we have a ton of plugins. I have never seen it use the max 16gb of ram, but I have seen it at 14, so ram is important. More important is CPU, which usually runs at around 30% utilization (i5-6600k @ 4.4Ghz) but it spikes sometimes to max which causes a good amount of server lag

red linden
#

@storm vessel Location?

storm vessel
#

I am worried that most VPS's, which use server chips, won't have the clockspeeds necessary for a game server

#

Currently near Pittsburgh, though anywhere in the US will do

#

Preferably Eastern US

dusky herald
#

Then dont use a VPS

#

get a Dedicated Server if you're looking to spend around $60-100

storm vessel
#

I can find any for that price that aren't shitty

dusky herald
storm vessel
#

I could buy/build my own, but I want the benefits that come from having my server in a datacenter

#

Thank you

dusky herald
#

OVH is good as well, I personally don't use them because I've had transaction issues with the,.

#

but if you're going to spend the money, there's no reason to be on a shared VPS host.

storm vessel
#

I wish I could find a good hosting company that has servers with desktop chips

#

The 3950x would be perfect for MC

red linden
#

I heard good things of reliablesite aswell. I personally cant use them because I'm from EUW

storm vessel
#

@dusky herald My issue is that if I were to spend $100 I would be getting the cheapest dedicated server available which is usually worse than a good VPS as far as specs are concerned

dusky herald
#

¯_(ツ)_/¯

#

You said you have 15 players, I dont see an issue with using a dedicated server.

storm vessel
#

The server only started 25 days ago, so I am counting on expansion

dusky herald
#

Then wouldn't a dedicated server be your best option then? That why you're not using a shared VPS host?

storm vessel
#

Now that we are getting votes we get 10 new players per day. 2-3 actually play for more than a few days

boreal tiger
#

with 100$ you can get a good dedicated lmao

storm vessel
#

Yes, but for what I can afford, I can't find a dedicated server with good enough specs

boreal tiger
#

you said 60-100$

dusky herald
#

Maybe you're looking at specs way more than what you need right now; lol.

red linden
dusky herald
#

You could just get a dedicated server for now

#

and upgrade later

#

to fit the needs for your server

#

It's not really a crazy concept for a server to upgrade multiple times early in it's life.

storm vessel
#

I'm currently running it on my PC which has 32gb of ram, NVMe storage and a a mid level CPU that OC'ed the shit out of and I'm still having occasional lag. Before I installed plugins to optimize villagers and entitytracking I was at 100% utilization for 15% of the uptime

#

Ok, I'll do some research into that

dusky herald
#

I mean, the only thing that's really going to bottleneck you would be your CPU

#

NVMe storage helps, but not a great difference

#

and also seems like you could be experiencing more lag because your server isnt dedicated to your "server" yet

storm vessel
#

This is off topic, but I wander if optane is fast enough to store loaded in chucks instead of memory

boreal tiger
#

I think you might be exaggerating a bit on your requirements

#

I might be wrong tho

storm vessel
#

That is true. It is also doing regular Windows desktop things aswell (I run my server in an Ubuntu Server VM)

dusky herald
#

I think a dedicated could work fine for your needs, and if not you can always optimize performance and upgrade later.

storm vessel
#

I could be underestimating the performance toll that is taken by running it on the same PC that I use for other things

dusky herald
#

The crazy, high performance dedicated servers are meant to hold a crap ton of players; but I dont see why you wouldnt be able to hit 75+

storm vessel
#

Yeah you're right. I do have room to optimize as entities spawns are barely nerfed and view distance is at 8

dusky herald
#

I cant even give a good estimate nowadays anyways, back when I actually ran my own servers a dedicated server was more than adequate enough to hold over 700 people

storm vessel
#

My thing is that I have so many plugins

dusky herald
#

but, I hear 1.15 has some performance issues, so

storm vessel
#

We are now up to 60, and I go through them periodically and delete any that we don't need

dusky herald
#

I would cut down on plugins, mainly the ones you DONT need.

storm vessel
#

I have done that a whole bunch already. Getting rid of dynmap helped a ton

dusky herald
#

But, it still won't help optimization too much, not unless you get rid of plugins that aren't necessary, and if they are actually active during a lot of the server run time.

#

yeah Dynmap is bad for that.

storm vessel
#

Could you take a look and see if there are any that could be causing excessive lag as far as you know?

#

I would greatly appreciate it

dusky herald
#

I'm sure plugins like SkQuery/Skript dont help a lot; but I don't know.

#

I imagine you're using them so you can customize the server a little bit

storm vessel
#

They are dependencies for other plugins

wanton delta
#

say I have abstract class A that has sub classes B and C. I want to add a method to class A that returns itself again. However, I want B and C to have this same method but return themselves respectfully. How would I go about doing this?

storm vessel
#

And yes. Like "enhanced vanilla"

wanton delta
#
public <T extends A> T setTrue() {
    setBoolean(true)
    return this;
}``` is basically kinda what i want to accomplish
#

but i cant return this

storm vessel
#

Respectfully?

dusky herald
#

@wanton delta I don't know, cant you just return the abstract class?

wanton delta
#

i would want to return the class's instance

dusky herald
#

Okay I get you

wanton delta
#

well the problem is i wouldnt be bale to do B b = new B().setTrue()

dusky herald
#

try <? extends A>?

wanton delta
#

only other way i could think of doing it is making setTrue() abstract and add it to all subclasses

#

wildcard ? doesnt work... tried

tiny dagger
#

? super A?

wanton delta
#

nope cant use wildcard in place of T

tiny dagger
#

try t then

wanton delta
#

that method above is what i currently have, its just i cant return this

tiny dagger
#

oh hmm

dusky herald
#

I haven't read this, but I looked up your issue and it said this blog post might have a resolution

wanton delta
#

only reason why i havent googled is because i have no clue how to word it lol

dusky herald
#

You're working with Generics

wanton delta
#

interesting

#

i know that lol

dusky herald
#

lol

ashen stirrup
#

On the PlayerChatTabCompleteEvent, is event.getLastToken() the string before?
e.g /about <TAB>, would about be the last token?

wanton delta
#

no

#

it would return <TAB>

#

if tab is empty, it would return ""

ashen stirrup
#

Would event.getChatMessage() get about then?

wanton delta
#

conventions usually imply that last is always the last in an array, whereas previous would return the one before

#

i think youre looking for PlayerCommandPreProcessEvent

#

if you're trying to limit the commands players can see when they tab, use PlayerCommandSendEvent

#

hmm i could do java public A setTrue() { setBoolean(true) return this; } but that requires me to cast java B b = (B) new B().setTrue();

sturdy oar
#

is Minecraft's VarInt byte length maximum 5 inclusive or exclusive?

boreal tiger
#

inclusive I think

#

not sure though

sturdy oar
#

ok, it's kinda hurting my brain to work with packets

wanton delta
#

i would edge on the side of inclusive

boreal tiger
#

oh wait what do you mean by inclusive or exclusive?

wanton delta
#

if you feel comfortable protocollib makes things 100x easier 😛

sturdy oar
#

oh wait what do you mean by inclusive or exclusive?
@boreal tiger it should not be longer than 5 , so ( byteLength <= 5)

boreal tiger
#

ah, I think its inclusive then

sturdy oar
#

Wasn't there a website that talked about this?

#

if someone knows it

wanton delta
sturdy oar
#

oh that one , thank you.

wanton delta
#

np :D

ashen stirrup
#

Can you edit event.getTabCompletions()?

wanton delta
#

what is the event

#

PlayerCommandSendEvent you can use event.getCommands() and add/remove what you please

ashen stirrup
#

PlayerChatTabCompleteEvent

#

I want to check if the command before they press tab is /about

#

PlayerChatTabCompleteEvent

#

I was going to check the getChatMessage() and then getTabCompletions().clear();

wanton delta
#

use TabCompleteEvent then

#

dont use ChatTabCompleteEvent

#

wont fire when using a command

ashen stirrup
#

I'm using 1.8

wanton delta
#

in that case i cant help you

#

best i can recommend is using packets

ashen stirrup
#

Hm okay

#

Is it worth moving to 1.15 and using ViaRewind etc.

wanton delta
#

imo its not worth supporting 1.8

ashen stirrup
#

Oh, why?

wanton delta
#

its unsupported, any issues you have with viarewind or 1.8 wont be supported here

#

amount off ppl that play 1.15 is far greater than 1.8

#

found solution to my problem

#

i can do java public abstract class A<T extends A<T>> { protected abstract T getThis(); public T setTrue() { setBoolean(true); return getThis(); } }

tiny dagger
#

Nice

red linden
#

Is there a Maven repo for BlocksHub?

silver haven
#

When i try to compile my jar using github actions i get this error: Could not find artifact org.spigotmc:spigot:jar:1.15.2-R0.1-SNAPSHOT -> [Help 1]
What is a way to fix this?

subtle blade
#

Wow what is that monstrosity, Martoph? lol

#

The server jar is not available unless locally installed, 902

silver haven
#

Okay

#

Hum

subtle blade
#

I'm not sure if GitHub has a way to build using BuildTools (going to imagine not) though most people do things through Jenkins afaik

#

Though ideally you'd depend against the API which is hosted on the repository

silver haven
#

Hm

#

Ive been using maven tho...

#

It works locally

narrow crypt
#

For some reason my saved itemstacks(in a configyaml) are all being set to air after an hour or so, anybody an idea why?

subtle blade
#

Yes, it works locally because the server jar is locally installed when running BuildTools

#

GitHub doesn't have that

silver haven
#

Huh okay

#

Thanks

boreal tiger
#

mhm I was representing armor upgrades as follows:

    private final ImmutableMap<ItemStack, Upgrade<ItemStack>> upgrades = ImmutableMap.of(
            new ItemStack(Material.LEATHER_CHESTPLATE), new Upgrade<>(new ItemStack(Material.CHAINMAIL_CHESTPLATE), 10),
            new ItemStack(Material.CHAINMAIL_CHESTPLATE), new Upgrade<>(new ItemStack(Material.IRON_CHESTPLATE), 10),
            new ItemStack(Material.IRON_CHESTPLATE), new Upgrade<>(new ItemStack(Material.DIAMOND_CHESTPLATE), 10)
    );

However this approach does not allow me to check if the player is already in the last upgrade.
Any ideas how I could represent them?

I thought about implementing a directed weighted graph but was looking for other options before doing that

#

the reason why I was using a map is because It allowed me to easily look up the next upgrade

frigid ember
#

Would it not be easier to also then have a hashmap representing which armour upgrade they're on? (or just check what they're wearing?)

boreal tiger
#

thats what I'm doing

#

I check what they're wearing

#

and use that to lookup the next update

frigid ember
#

Ah

#

I only read half the message ngl lmao

boreal tiger
#

np xD

#

mhm I think I can just change a bit what I was doing. if the key is not in the map I can just say its the latest upgrade 🤷‍♂️

#

they wont have access to other armor types so it should be fine

prisma wolf
#

Guys is there any code to detect if player is on water, i mean, block.isLiquid() and block.getType() == Material.WATER is checking full block, not half blocks, you can stay on a kelp / seagrass / sea_pickle / coral being on water.

subtle blade
#

You would have to check for water as well as the waterlogged state

#

if (block.isLiquid() || (blockData instanceof Waterloggable && ((Waterloggable) blockData).isWaterlogged()))

#

(blockData being block.getData(), obviously)

boreal tiger
#

choco do you have any idea how I could solve the problem I mentioned :S?

silk bane
#

And in addition to what choco said, some blocks are waterlogged but don't have Waterloggable data

subtle blade
#

Any reason you're not using Materials here?

silk bane
#

e.g kelp

#

and bubble columns

boreal tiger
#

oops forgot about that yeah I can just switch to material I think

subtle blade
#

some blocks are waterlogged but don't have Waterloggable data
You're right. The fuck?

#

Why isn't kelp waterloggable?

#

Oh is kelp literally just always in water?

silk bane
#

yeah

subtle blade
#

Well that's silly

silk bane
#

from what i can tell the best you can do with the API is maintain your own list of 'always waterlogged' materials

prisma wolf
#

for 1.15 block.getData() is deprecated 😒

lofty crane
#

.

subtle blade
#

getBlockData(), sorry

storm vessel
#

Ok so after some research I decided to go with a dedicated server. Right now it looks like reliablesite.net is my best option. Any advice on other good/better hosts, or any bad experiences with reliablesite.net?

subtle blade
#

and yea as far as I can tell, it's not even considered a liquid block in NMS, konsolas

boreal tiger
#

@subtle blade would it be a bad idea to extend Upgrade and call it say NoFurtherUpgrades and point the last upgrade to that?

subtle blade
#

Now that's just silly

silk bane
#

null is feeling a bit neglected rn

subtle blade
#

^

boreal tiger
#

ah yeah lmao

#

🤦‍♂️

subtle blade
#

Point a diamond chestplate to null ;P

boreal tiger
#

thanks hahaha lmao

marble narwhal
bleak osprey
#

hey, do someone knows why its not possible to connect to other servers on a bungeesystem?

i edit the spigot and paper.yml, entered online-mode to false at the server properties... but cant connect

subtle blade
#

Don't think there's tab completion available for that through Bukkit, Thom

#

Might be a way to expose it in the API though

#

To be completely honest, the tab completion API should be slightly improved. I'll have to look into that

#

I might have an idea for it tbh

#

Y'know what? I'm going to take a stab at a PR right now to try and expose that a bit better

marble narwhal
#

Thanks! 😄

#

Also, @bleak osprey do you get any kind of message when joining?

bleak osprey
marble narwhal
#

Are you sure you entered the correct IP/Port in the config.yml in the bungee?

bleak osprey
#

yes

#

because they aree all on the same system

spring sapphire
#

Can anyone tell me please why chest.getPersistentDataContainer​(); not working?

subtle blade
#

What version are you using?

spring sapphire
#

1.15.2

subtle blade
#

Importing the right Chest? There are three

#

You want org.bukkit.block.Chest, not org.bukkit.block.data.type.Chest or org.bukkit.material.Chest

spring sapphire
#

Okay, fixed.

#

Thank you so much

#

That was fast and stupid of me lol

subtle blade
#

o/ Happens a lot. Bukkit's got lots of duplicate classes from MaterialData, BlockState and BlockData

#

Just the nature of Bukkit's forwards compat

spring sapphire
#

When creating a namespacedkey, it works like new NamespacedKey(plugin, plugin.getDescription().getName()); correct?

#

In my case, there is error in the first argument which is plugin.

#

What can I do about it?

subtle blade
#

The plugin.getDescription().getName() can just be whatever unique identifier you want. This is your key

spring sapphire
#

I know, however, there is in the first argument

subtle blade
#

new NamespacedKey(plugin, "my_unique_key")

#

The first argument has to be an instance of your plugin's class. The one that extends JavaPlugin

spring sapphire
#

import org.bukkit.plugin.java.JavaPlugin;

subtle blade
#

Yea, whatever class extends that, it should be an instance of it

#

If you're in your main class, you would pass this for instance

spring sapphire
#

got it, thanks

bleak osprey
#

so no one knows? 😄

subtle blade
#

Not familiar enough with Bungee to answer that question but if you're using a fork of Spigot, you're better off asking them for support as they may make changes we're unaware of

bleak osprey
#

hm ok 😦

spring sapphire
#

Can I use onBlockPlace with Chests from Bikkot?

#

private NamespacedKey owner_key = new NamespacedKey(plugin, "Lock Chest");

#

@subtle blade I moved it out of the main class to the one where I handle events, there're a listener

#

However, plugin has the error

boreal tiger
#

@subtle blade guava's ImmutableMap doesn't support null values. should I add a static upgrade LAST_UPGRADE
and then I just compare if the value for a certain key is LAST_UPGRADE
Similar to how the conversation api handles the end of a conversation in a prompt

humble widget
#

Hi guys,

I am making custom to plugin to teleport players to other servers after logging in on auth server.
I am correctly registering output/input channels in onEnable (bungeecord:main).

#
@EventHandler(ignoreCancelled = true)
    public void onLogin(LoginEvent event) {
        Player player = event.getPlayer();
        User user = this.userService.getUser(player);
        String server = Auth.getInstance().getConfig().getString("servers_for_areas." + user.getTeam().getId());

        Bukkit.getScheduler().runTaskLater(Auth.getInstance(), () -> BungeeUtils.sendPlayerToServer(player, server), 20);
    }```
#
public static void sendPlayerToServer(Player player, String server) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();

        out.writeUTF("Connect");
        out.writeUTF(server);

        Log.info("Sending " + player.getName() + " to server: " + server + ".");
        player.sendPluginMessage(Auth.getInstance(), "bungeecord:main", out.toByteArray());
    }```
#

A player should be connected to server test-1, but nothing happens.

#

Does someone know what is wrong?

marble narwhal
humble widget
#
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "bungeecord:main");```
marble narwhal
#

I believe the channel should be BungeeCord not bungeecord:main

humble widget
#

Channel names must be seperated with : on 1.13 or newer versions

#

Thus cannot use BungeeCord

marble narwhal
#

Then Spigot did not update it's examples xD

humble widget
#

That's true

subtle blade
#

You're welcome to update them. You can contribute to wikis

agile rock
#

It seems that whenever someone intiates a coinflip on my coinflipplugin, the servers tps drops a little

#

any ideas?

frigid ember
#
    PlayerList playerList = ((CraftServer) Bukkit.getServer()).getHandle();
    GameProfile gameprofile = new GameProfile(UUID.randomUUID(), "hithere");
    WorldServer world = ((CraftWorld) p.getLocation().getWorld()).getHandle();

    EntityPlayer entity = new NPCEntity(playerList.getServer(), world, gameprofile,
        new PlayerInteractManager(world));

    PlayerConnection playerConnection = new PlayerConnection(playerList.getServer(), new DummyNetworkManager(EnumProtocolDirection.SERVERBOUND), entity);
    
    entity.setPosition(p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
    entity.playerConnection = playerConnection;
    System.out.println("Spawning...");
    world.addEntity(entity, SpawnReason.CUSTOM);
    

Can someone help me, my fake player isn't showing up

marble narwhal
#

@humble widget It seems to work with BungeeCord when I'm trying on my PC. But not with bungeecord:main. 🤔
Running a 1.15.2 server with one of the newest BungeeCord versions.

humble widget
#

I tried it before

#

and it did not work

#

and now it works

marble narwhal
#

🤷‍♀️

humble widget
#
  • spigot
marble narwhal
#

It's weird though, because bungeecord:main should indeed work

narrow crypt
#

Im really confused, i saved item stacks to my configyaml using

for (int x = 0; x < 27; x++) {
                                    
                                    chestloot.set("loot." + args[0].toString() + "." + x , chestinv[x]);
                                    
                                    
                                }
saveChestLoot():

but after a few minutes it turns to air in the config file

  iron:
    '0':
      ==: org.bukkit.inventory.ItemStack
      v: 2230
      type: AIR

anyone an idea how this is possible?

frigid ember
#

You have to clone the item stack using .clone() I think

narrow crypt
#

what do you mean exactly?

#

chestinv is a chestinventory

#

at first it is being set good to the config

rotund prism
#

hi!
is there way I can forbid interaction with player and impact with player avoiding events?
now I tried to register ALL player events and cancel those which are not chat command event, but I realized that I can't register ALL events except chatcommand event
If that's important - I'm trying to realize simple authorization plugin and I want to "freeze" player until he sign in\sign up

narrow crypt
#

gamemode adventure?

#

then u already solved breaking blocks

brisk mango
#

Why would you avoid events

#

Just use a

final Set<Player> unauthorized = Collections.newSetFromMap(new IdentityHashMap<>();```
#

Put them in the set if they're not registered and then check that on events

#

and as soon as they register/login remove them

#

@narrow crypt beacuse you are saving the ItemStack object into the file

turbid vapor
#

Just only /balance

brisk mango
#

You need save the itemstack like this


Name:
  type:
  enchantments
  -
  -

etc

frigid ember
#
    MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();
    WorldServer nmsWorld = ((CraftWorld) world).getHandle();
    GameProfile profile = new GameProfile(UUID.randomUUID(), name);
    PlayerInteractManager interactManager = new PlayerInteractManager(nmsWorld);

    EntityPlayer entityPlayer = new NPCEntity(nmsServer, nmsWorld, profile, interactManager);
    new PlayerConnection(nmsServer, new DummyNetworkManager(EnumProtocolDirection.CLIENTBOUND), entityPlayer);

    entityPlayer.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(),
        location.getPitch());

    nmsWorld.addEntity(entityPlayer);
    new BukkitRunnable() {

        @Override
        public void run() {
        nmsWorld.players.remove(entityPlayer);

        }
    }.runTaskTimer(main, 20L, 20L);

    PacketPlayOutPlayerInfo playerInfoAdd = new PacketPlayOutPlayerInfo(
        PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, entityPlayer);
    PacketPlayOutNamedEntitySpawn namedEntitySpawn = new PacketPlayOutNamedEntitySpawn(entityPlayer);
    PacketPlayOutEntityHeadRotation headRotation = new PacketPlayOutEntityHeadRotation(entityPlayer,
        (byte) ((location.getYaw() * 256f) / 360f));

    Bukkit.getOnlinePlayers().forEach(player -> {
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(playerInfoAdd);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(namedEntitySpawn);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(headRotation);
    });

Hey guys, so I have this to spawn my custom player, but how do I create it without packets? Because when the player rejoins the fake player dissapears and I don't want to have to store their locations

brisk mango
#

You can't create player without packets

#

also it's not a custom player

#

its a NPC packet

narrow crypt
#

@brisk mango How would i save the items then

brisk mango
#

Also BukkitRunnable bad

#

I gave you exampe above

narrow crypt
#

oh

brisk mango
#

Also i'd suggest using a bin @frigid ember

narrow crypt
#

i got told to use this:

for (int x :... inventoryslots) { config.set("%uuid%.items." + x, inventorySlots[x])
That type of thing, basically
#

so that is itemstacks

brisk mango
#

Why are you storing it into a file anyway?

narrow crypt
#

cause i need to save it

brisk mango
#

what exactly are you trying to accoplish

narrow crypt
#

and it needs to be saved after a restart too

ashen stirrup
#
        String headerT = "§7You\'re playing on §2§lMineTropical§7!";
        String footerT = "§7§oCustom Coded Survival Experience";
        IChatBaseComponent header = IChatBaseComponent.ChatSerializer.a("{text: '" + headerT + "'}");
        IChatBaseComponent footer = IChatBaseComponent.ChatSerializer.a("{text: '" + footerT + "'}");

This seems throw an error as an issue with the JSON

brisk mango
#

Why not save it into a Map<Inventory, List<ItemStack>> and save it onDisable()

narrow crypt
#

people look at a chest and can save the contents to the configyaml, then when lightning hits the ground a chest with those items spawn

#

i also tried serialization

brisk mango
#

Why serialization

narrow crypt
#

cause someone told me to

brisk mango
#

Just save it into Map<Inventory, List<ItemStack>>

narrow crypt
#

but that was not efficient

#

dev from paper told me to do it like this

brisk mango
#

Don't follow noobie dev advice then

turbid vapor
#

Does someone know how to block commands for specified plugins

I have 2 plugins with the same command, and i want that one plugin the command will be blocked

I dont want that the whole command will blocked, just only for one plugin

brisk mango
#

PlayerCommandPreprocessEvent

narrow crypt
#

@turbid vapor remove it in there plugin.yml

#

;)

brisk mango
#

You can't just remove it from plugin.yml because if it's registered in the main class i'd throw a null pointer

turbid vapor
#

@turbid vapor remove it in there plugin.yml
@narrow crypt where can i fnd that?

narrow crypt
#

decompile the plugin

brisk mango
#

Don't remove it from the @turbid vapor

#

You can't just remove it from plugin.yml because if it's registered in the main class i'd throw a null pointer
@narrow crypt

turbid vapor
#

I cant write java, so i cant make a plugin for it

brisk mango
#

Then don't ask help in this channel lol

#

this is dev help channel

turbid vapor
#

oh

boreal tiger
#

this is for all questions

narrow crypt
#

i suggest looking at r/admincraft

boreal tiger
#

not just dev

narrow crypt
#

or their discord

boreal tiger
#

~so feel free to ask away

turbid vapor
#

Is there any plugin for this?

#

Or a way to do it?

brisk mango
#

learn java is the way to do it

frigid ember
#

Guys how do I make path finding goals on an EntityPlayer

brisk mango
#

NMS

frigid ember
#

I knew that, but how

patent monolith
#

Oh, for like NPCs?

frigid ember
#

Yeah

frigid ember
#

bruh

patent monolith
#

oh, big link

#

LOL

frigid ember
#

rip cloud flare

patent monolith
#

Ahaha

remote sluice
#

hello, where download version 1.12 4.4.4???

patent monolith
remote sluice
#

1.12(top)
Code (version112 (Unknown Language)):
java -jar BuildTools.jar --rev 1.12
Will build a CraftBukkit and Spigot jar for 1.12
Change Log: Mojang | Stash | Jenkins

#

no link download

patent monolith
#

@remote sluice you need to follow the process described on the page

#

There isn't a convenient link to download the spigot 1.12 jar

#

You have to build the jar on your computer

spring sapphire
#

Perzan, can I use your help in something?

patent monolith
#

Sure, if I can help

spring sapphire
#

private NamespacedKey owner_key = new NamespacedKey(plugin, "Lock chest");

#

why is the plugin argument marked as an error?

#

"plugin can't be resolved as a variable"

patent monolith
#

Is owner_key in your plugin's main class?

#

There is no variable called plugin on there I bet

spring sapphire
#

Nope, but even modifying it to the main class doesn't make it work

patent monolith
#

You will need to have a variable of the type Plugin called plugin somewhere on the page

#

It also cannot be null

brisk mango
#

@spring sapphire I suggest you to learn java

#

also plugin will be null if you do it like this

patent monolith
#

What does the class's constructor look like?

spring sapphire
#

Shouldn't it take the Plugin from library JavaPlugin of bukkit?

brisk mango
#

Wdym

patent monolith
#

For that argument, you need to reference your plugin's instance

#

We can static abuse if you want lol

brisk mango
#

public final class Main extends JavaPlugin {

@Override public void onEnable() { }
}

public class MyClass {

  private final Main plugin;
  
  public MyClass(Main plugin) {  this.plugin = plugin; }

  private NameSpacedKey owner_key;
  
  void myMethod() {
     owner_key = new NamespacedKey(plugin, "Lock Chest");
  }

}

#

No never static abuse

#

Should always use dep inj for main instance

#

not singletons

patent monolith
#

Use that layout ^ @spring sapphire

brisk mango
#

Dep inj is more flexible/testable

patent monolith
#

I was thinking JavaPlugin.getInstance(<your plugin main class>.class)

brisk mango
#

No that is wrong lol

patent monolith
#

Lol quick n dirty, but not good practice

vernal spruce
#

you also have JavaPlugin.getPlugin(class);

patent monolith
#

Yeah I forgot the method name

#

¯\_(ツ)_/¯

remote sluice
#

java -jar BuildTools.jar --rev 1.12 in start.bat no good 😦

vernal spruce
#

didnt see any difference between that and injection yet

patent monolith
#

@remote sluice what happened?

#

Did you download the buildtools jar?

vernal spruce
#

isnt buildtools used with gitbash?

remote sluice
#

last version from 1.12 spigot

patent monolith
#

Try putting @pause on the last line of your batch file

#

Run it again and see what it says

spring sapphire
#

@brisk mango Do I have to use the namespacedkey on the Main Class?

brisk mango
#

no

remote sluice
#

i need the latest version 1.12! Thanks!

patent monolith
#

@remote sluice did you follow the instructions on that page?

#

I need details lol

remote sluice
#

no understand...........

patent monolith
#

:(

#

One sec

remote sluice
#

please give me comand for start.bat

brisk mango
#

java -jar -Xmx1G BuildTools.jar --rev 1.12.2 PAUSE

#

@remote sluice

remote sluice
#

Please do not run in a path with special characters!

C:\Users\Ionut\Desktop\Folder nou (2)>PAUSE
Press any key to continue . . .

brisk mango
#

it says it lol

spring sapphire
#

Constructor NameSpacedKey is undefined although the library is defined.

brisk mango
#

Why do you have inner class

#

also eclipse bad

spring sapphire
#

I removed the inner class.

#

how to paste code here?

#

          private final Events plugin;
          
          public Events(Events plugin) {  this.plugin = plugin; }
          
          private NamespacedKey owner_key = new NamespacedKey(plugin, "Locking Chests");
#

Same error.

brisk mango
#

I didn't tell you to do it like this

#

look at my code again

rotund prism
#

@brisk mango
but I should register all events and cancel events those are not a chat command event, ain't it?
that's too much work for many events
Did I understand you right?

brisk mango
#

Wdym register all events

#

just register BlockBreak/PlaceEvent

agile rock
#

If im logging into my mongodb whenever someone breaks a block, should I make that async ex: new Thread(() -> { databaseApi.incOresMined(databaseApi.getSimplePlayerByUUID(event.getPlayer().getUniqueId().toString())); }).start();

narrow crypt
#

so im saving itemstacks to my yaml but after 20 minutes they are turned to air in the config, no events happened in the meantime with the plugin:


loot:
  kist1:
    '4':
      ==: org.bukkit.inventory.ItemStack
      v: 2230
      type: AIR
      amount: 0
    '10':
      ==: org.bukkit.inventory.ItemStack
      v: 2230
      type: AIR
      amount: 0
    '11':
      ==: org.bukkit.inventory.ItemStack
      v: 2230
      type: AIR
      amount: 0
    '16':
      ==: org.bukkit.inventory.ItemStack
      v: 2230
      type: AIR
      amount: 0
    '22':
      ==: org.bukkit.inventory.ItemStack
      v: 2230
      type: AIR
      amount: 0
    '24':
      ==: org.bukkit.inventory.ItemStack
      v: 2230
      type: AIR
      amount: 0
brisk mango
#

PlayerInteractEvent

narrow crypt
#

i have declared api-version: 1.15
at first they just are noted correctly
but they just change out of nowhere
anybody an idea how this is possible?

patent monolith
#

@spring sapphire assign the owner_key inside the constructor

brisk mango
#

@patent monolith no

#

You can't assign it inside the constructor

#

since it takes the plugin variable

#

while that's being initialised in the constructor

#

that's why there's a method for it

spring sapphire
#

          public class MyClass {
          private final Events plugin;
          public MyClass(Events plugin) {  this.plugin = plugin; }
          private NamespacedKey owner_key;
          void myMethod() {
                 owner_key = new NamespacedKey(plugin, "Lock Chest");
              }
          }}
brisk mango
#

@narrow crypt I told you how to do it so stop asking again

#

yes, like this

#

What

#

why do you have inner class

narrow crypt
#

im asking for another method to do it

brisk mango
#

``
public class Events implements Listener {

      public class MyClass {

``

frigid ember
brisk mango
#

@narrow crypt There's no other method if you're saving it into file

spring sapphire
#

Should be like this?

#

          private final Events plugin;
          public Events(Events plugin) {  this.plugin = plugin; }
          private NamespacedKey owner_key;
          void myMethod() {
                 owner_key = new NamespacedKey(plugin, "Lock Chest");
              }
    ````
patent monolith
#

Well imma hop on my pc

brisk mango
#

I don't think that can be done Async but you can try it @agile rock

narrow crypt
#

why doesnt anybody do it like that then .. :(

brisk mango
#

because nobody saving itemstacks into a file

#

I told you multiple ways

spring sapphire
#

Okay Perzan, that was my old code

#

However, it still returns the same error

brisk mango
#

What is the error

spring sapphire
#

Constructor NamespacedKey is not defined

agile rock
#

@brisk mango I was told to make all database calls async so it dosent disturb the main thread or something like that

patent monolith
#

On my phone in bed rn lol

brisk mango
#

Well it's not defined then?

patent monolith
#

Ill hop on my pc

rigid nacelle
#

@brisk mango I was told to make all database calls async so it dosent disturd the main thread or something like that
@agile rock You should, yes.

brisk mango
#

Oh hello my old friend

rigid nacelle
#

Helloo.

brisk mango
#

are we going to take this discord over yes?

rigid nacelle
#

(:

agile rock
#

Ok, is new Thread(() -> {// database call}).start(); a proper way to do it?

brisk mango
#

Creating threads is outdated but yes you can

patent monolith
#

Try bukkitrunnable async

agile rock
#

What would be a better way to do it?

#

ok

brisk mango
#

ExecutorService maybe

#

No, BukkitRunnable is a shit class

agile rock
#

D:

brisk mango
#

use BukkitScheduler/ExecutorService

spring sapphire
#

Eclipse is suggesting changing plugin to String to fix it

brisk mango
#

lol

rigid nacelle
#

I personally like CompletableFuture.runAsync(...). Depending on what I'm doing, CompletableFuture.supplyAsync(...) could come in handy too.

spring sapphire
#

However, Namespacedkey doesn't take a string in the first argument

#

It takes plugin

brisk mango
#

That means, dont use eclipse

patent monolith
#

Well, whatever you use, make sure you make it so it wont run if your plugin is disabled

spring sapphire
#

    private final Events plugin;
    public Events(Events plugin) {  this.plugin = plugin;
        owner_key = new NamespacedKey(plugin, "Locking Chests");
    }
#

Is there anything wrong with that?

#

Despite the last }

brisk mango
#

Yes, using plugin in the constructor

#

while it's not initialised

rigid nacelle
#

Temedy, he's using the one passed.

#

Not this.plugin so that's fine.

#

It would've been initialized anyways since he initializes it above the owner_key field initialization.

patent monolith
#

Where is owner_key

spring sapphire
#

below it

#

private NamespacedKey owner_key;

patent monolith
#

Ah

#

Yeah, that should work

brisk mango
#

private final Main plugin;

public Events(Main plugin) {
this.plugin = plugin;
owner_key = new NamespacedKey(plugin, "Locking Chests");
}

But doing this can cause null pointers

spring sapphire
#

It's not

#

It's driving me mad

rigid nacelle
#

If the plugin object passed is null, sure.

#

I'm not sure about the whole situation though. What is the actual error? I haven't seen it.

patent monolith
#

In that light, I suggest doing Objects.requireNonNull(plugin, "plugin")

#

For other params in the future as well

brisk mango
#

lol

patent monolith
#

k welp, im on my pc now

spring sapphire
#

temedy, still same

#

    private final Events plugin;
    public Events(Events plugin) {  this.plugin = plugin;
        owner_key = new NamespacedKey(plugin, "Locking Chests");
    }

    private NamespacedKey owner_key;}```
brisk mango
#

What same?

rigid nacelle
#

One thing that comes with the spigot API is Guava and I absolutely love it.

patent monolith
#

gson and yaml are also nice

rigid nacelle
#

Gson, agreed.

#

@spring sapphire What is the error?

spring sapphire
#

The constructor NamespacedKey is undefined

#

suggesting changing plugin to String which doesn't make sense

rigid nacelle
#

It does make sense.

#

Depending on your version.

patent monolith
#

I just realized

rigid nacelle
#

You could be using the 1.15.2 dep and it tells you to use plugin, string but running it on for example 1.8.8 would be string iirc.

patent monolith
#

you are referencing Events as a plugin....

#

in the parameter

#

but its that own class

rigid nacelle
#

Lmao..

patent monolith
#

welp

agile rock
#
    public void onPlayerJoin(PlayerJoinEvent event) {
        // Checks if player is new, if so it will create a new SimplePlayer and log the player into the database
        if(!event.getPlayer().hasPlayedBefore() || (databaseApi.getSimplePlayerByUUID(event.getPlayer().getUniqueId().toString()) == null)) {
            plugin.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
                @Override
                public void run() {
                    databaseApi.createSimplePlayer(event.getPlayer().getUniqueId().toString(), LocalDateTime.now().toString(), System.currentTimeMillis());
                }
            });
        }
   }``` Would this be the proper use of BukkitScheduler?
patent monolith
#

i had to paste this into my ide to notice that

spring sapphire
#

Wait, what should I reference as a plugin?

#

The main function?

patent monolith
#

your main plugin class

#

not events

spring sapphire
#

    private final ChestLock plugin;
    public Events(ChestLock plugin) {  this.plugin = plugin;
        owner_key = new NamespacedKey(plugin, "Locking Chests");
    }```
#

So it should be like this

#

considering ChestLock is the main

#

correct?

patent monolith
#

yeah

remote sluice
#

i finish, tahnks

patent monolith
#

did you do it? 😄

#

nice

remote sluice
#

I think I did :))

agile rock
#

@rigid nacelle @brisk mango Could u guys take a look at how I used the bukkitscheduler above please?

patent monolith
#
new BukkitRunnable() {
            
            @Override
            public void run() {
                // your code
            }
            
        }.runTaskAsynchronously(plugin);
agile rock
#

oh, is that the same as plugin.getScheduler().runTaskAsynchronously(plugin, new Runnable() { @Override public void run() { databaseApi.createSimplePlayer(event.getPlayer().getUniqueId().toString(), LocalDateTime.now().toString(), System.currentTimeMillis()); } });

patent monolith
#

yeah

agile rock
#

gotcha

patent monolith
#

should work either way

brisk mango
#

Its not the same it's 2 different classes

#

but BukkitRunnable is shit

agile rock
#

@brisk mango Would you recommend that I use the one I put above^

patent monolith
#

oh, i misread that

#

nvm

brisk mango
#

no

#

also you dont need plugin to use BukkitScheduler

patent monolith
#

oh

#

what other method is there?

brisk mango
#

?

patent monolith
#

to run the bukkit runnable task?

brisk mango
#

BukkitScheduler*

#

Bukkit.getScheduler()

patent monolith
#

ah

spring sapphire
#

Perzan, I can't my events handler the plugin folder?

brisk mango
#

Also both are shit

#

i'd use ScheduledExecutorService

spring sapphire
#

Because after I added ```public class EventsChest implements Listener {

private final ChestLock plugin;
public EventsChest(ChestLock plugin) {  this.plugin = plugin;
    owner_key = new NamespacedKey(plugin, "Locking Chests");
}``` to my Events folder
#

the getServer().getPluginManager().registerEvents(new EventsChest(), this); gave an error in the main

brisk mango
#

Put this

#

in the constructor

#

this

patent monolith
#

new EventsChest(this)

#

if you look at the constructor definition in the EventsChest class, it takes an instance of your plugin

spring sapphire
#

public void onEnable() { getServer().getPluginManager().registerEvents(new EventsChest(this), this); }

#

Now, it's working

patent monolith
#

using this is like a special variable in java that references the instance that your code is in

#

cool

spring sapphire
#

So without removing this, the argument is getting all of the instances ?

frigid ember
#

Depending on the use case @brisk mango it is acceptable to use either one

spring sapphire
#

using^

brisk mango
#

No it's not

pure pasture
#

How can you get which dealt damage?

brisk mango
#

It's not getting any

pure pasture
#

which entity*