#help-development

1 messages ยท Page 1439 of 1

hollow canopy
#

you didnt understand what I mean

#

I will send another video wait

foggy bough
#

would this code work: ```java
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;

public class Main extends JavaPlugin {

private Main plugin;

@Override
public void onEnable() {
    
}    

public void onDisable() {

    
}

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if(label.equalsIgnoreCase("TNTSpawn")) {
        if(sender instanceof Player) {
            Player player = (Player) sender;
            Location loc = player.getLocation();
            World world = player.getWorld();
            BukkitScheduler timer = player.getServer().getScheduler();
            timer.scheduleSyncRepeatingTask(plugin, new Runnable() {

                @Override
                public void run() {
                    world.spawnEntity(loc, EntityType.PRIMED_TNT);
                    
                }}, 0L, 100L);
            return true;
        }
        
        else {
            sender.sendMessage("Nope!");
            return true;
        }
    }
    return false;
}

}

wraith rapids
#

i'm sure that'll help yeah

#

don't compare the label

#

the label may be anything

#

compare the command name

#

you are also never cancelling the repeating task so it'll be spawning tnt forever

foggy bough
#

how should I compare command name?

eternal oxide
#

cmd.getName().equalsIgnoreCase

foggy bough
#

where should I put that?

hollow canopy
#

and look at my fps

wraith rapids
#

ideally assign a specific command executor to the command

hollow canopy
eternal oxide
#

where you want to compare teh name

hollow canopy
#

this is not normal

#

it hits more than 1 time

raven vine
#

he only wants to hit this damage once.

hollow canopy
#

yeah

eternal oxide
hollow canopy
#

yeahh

#

look at the hurt animation

raven vine
#

yeah

eternal oxide
#

does it always kill every hit? no survivors?

raven vine
#

He just want it to hit it once

wraith rapids
#

doesn't the damage method fire a new damage event

#

which then runs your code

#

which fires the damage method

#

which then fires a new event

#

which then runs your code

eternal oxide
foggy bough
#
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;

public class Main extends JavaPlugin {
    
    private Main plugin;

    @Override
    public void onEnable() {
        
    }    
    
    public void onDisable() {
    
        
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(cmd.getName().equalsIgnoreCase("TNTSpawn")) {
            if(sender instanceof Player) {
                Player player = (Player) sender;
                Location loc = player.getLocation();
                World world = player.getWorld();
                BukkitScheduler timer = player.getServer().getScheduler();
                timer.scheduleSyncRepeatingTask(plugin, new Runnable() {

                    @Override
                    public void run() {
                        world.spawnEntity(loc, EntityType.PRIMED_TNT);
                        
                    }}, 0L, 100L);
                return true;
            }
            
            else {
                sender.sendMessage("Nope!");
                return true;
            }
        }
        return false;
    }

}``` like this?
eternal oxide
#

which means he's going ot have to manually set health

hollow canopy
#

Yeah it kills when I delete the event.setDamage(0) part

eternal oxide
wraith rapids
#

or just prevent recursing his events

hollow canopy
#

what did you mean

wraith rapids
#

as for how to go about that i'm not sure

#

maybe a set or something

#

or just a bool might do

eternal oxide
hollow canopy
hollow canopy
#

it insta kills

eternal oxide
#

um

hollow canopy
#

We should run this section only 1 time

wraith rapids
#

set a boolean to true in your listener to prevent recursive calls

hollow canopy
#

but how

eternal oxide
#

it insta kills with the setDamage(0) or without it, or always?

hollow canopy
#

if I delete the setdamage(0) and export it it insta kills the mobs in the radius

wraith rapids
#

private boolean bool;

#

if (bool) return;

eternal oxide
#

well if bool, reset bool and return

wraith rapids
#

nah, reset bool at the end of the handler

#

you'll be firing multiple new events in the handler

#

so you need to reset it once the handler is completely done

eternal oxide
#

um, true

#

however he also needs to cancel

#

for each manually applied

opal juniper
#

Now i get a null error because, i think it is because i call plugin.blocks.remove(id); from within the iterator?

wraith rapids
#

i think just letting the event fire normally would be the best recourse

#

it'd let other plugins do stuff with the spread out damage

eternal oxide
#

true

wraith rapids
#

though you might not want to use the final damage in that case

#

inter plugin compatibility is hard

hollow canopy
eternal oxide
#

However, he may get an event fire on an entity between his damaging

#

in which case he has to track who he's hitting

wraith rapids
#

shouldn't happen

#

it all happens on a single thread

eternal oxide
#

at the moment

wraith rapids
#

meaning that any events firing during his event handler are caused by his event handler

hollow canopy
#

Did I use bool thing true?

eternal oxide
#

sec

onyx shale
#

tell him the harsh truth m8...

wraith rapids
#

learn

#

try it and see or look at the impl

onyx shale
#

so... you expect us to test it for you?

wraith rapids
#
    @NotNull
    public static String getLastColors(@NotNull String input) {
        Validate.notNull(input, "Cannot get last colors from null text");

        String result = "";
        int length = input.length();

        // Search backwards from the end as it is faster
        for (int index = length - 1; index > -1; index--) {
            char section = input.charAt(index);
            if (section == COLOR_CHAR && index < length - 1) {
                // Paper start - Support hex colors
                if (index > 11 && input.charAt(index - 12) == COLOR_CHAR && (input.charAt(index - 11) == 'x' || input.charAt(index - 11) == 'X')) {
                    String color = input.substring(index - 12, index + 2);
                    if (HEX_COLOR_PATTERN.matcher(color).matches()) {
                        result = color + result;
                        break;
                    }
                }
                // Paper end
                char c = input.charAt(index + 1);
                ChatColor color = getByChar(c);

                if (color != null) {
                    result = color.toString() + result;

                    // Once we find a color or reset we can stop searching
                    if (color.isColor() || color.equals(RESET)) {
                        break;
                    }
                }
            }
        }

        return result;
    }
hollow canopy
#

@eternal oxide thats worked!!!

opal juniper
#

Is there anything glaringly obviously wrong with this? It is just that the entities don't get removed?

                        PacketContainer destroyEntity = new PacketContainer(ENTITY_DESTROY);
                        destroyEntity.getIntegerArrays().write(0, new int[] { id });
                        for(Player player : Bukkit.getOnlinePlayers()){
                            try {
                                plugin.protocolManager.sendServerPacket(player,destroyEntity);
                            } catch (InvocationTargetException e) {
                                e.printStackTrace();
                            }
                        }
hollow canopy
#

but why the that I hitted is not taken any damage?

#

mobs in radius take damage

eternal oxide
#

afk for delivery

hollow canopy
#

okey @eternal oxide I will store the normal weapon damage and use it for setdamage

#

thank you

eternal oxide
maiden briar
#
java.lang.NoClassDefFoundError: org/bukkit/plugin/Plugin
    at me.tvhee.tvheeapi.core.plugin.TvheeAPIPluginLoader.<init>(TvheeAPIPluginLoader.java:57)
    at me.tvhee.tvheeapi.core.plugin.BungeePluginLoader.onLoad(BungeePluginLoader.java:34)
    at net.md_5.bungee.api.plugin.PluginManager.enablePlugin(PluginManager.java:344)
    at net.md_5.bungee.api.plugin.PluginManager.loadPlugins(PluginManager.java:250)
    at net.md_5.bungee.BungeeCord.start(BungeeCord.java:273)
    at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:62)
    at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
Caused by: java.lang.ClassNotFoundException: org.bukkit.plugin.Plugin
    at net.md_5.bungee.api.plugin.PluginClassloader.loadClass0(PluginClassloader.java:97)
    at net.md_5.bungee.api.plugin.PluginClassloader.loadClass(PluginClassloader.java:59)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 7 more

I understand bungee can't get bukkit classes, but.... I never use org.bukkit.plugin.Plugin
Line 57: this.api = new TvheeAPICore(universalPluginLoader, pluginManager, messagingChannel, chatFormat, description.getPluginLoader(), plugin); (Whole class https://paste.md-5.net/qosidizaxi.js)

wraith rapids
#

just do it the not retarded way

maiden briar
#

Hmm what do you mean?

wraith rapids
#

you don't need to do classloader fucknuggetry to have you api support both bungee and bukkit

#

like I explained last time, have an api class for bukkit users to extend, and an api class for bungee users to extend

#

have them extend or contain a class that declares the common implementations between those two api classes

#

and only have things specific to bukkit or specific to bungee in those two classes

maiden briar
#

I have it, UniversalPluginLoader

eternal oxide
#

No need, just one class for Bukkit, one class for bungee

maiden briar
#

But it is fully possible to only extend my own class

maiden briar
wraith rapids
#

you ๐Ÿ‘๐Ÿฟ do ๐Ÿ‘๐Ÿฟ not ๐Ÿ‘๐Ÿฟ need ๐Ÿ‘๐Ÿฟ your ๐Ÿ‘๐Ÿฟ own ๐Ÿ‘๐Ÿฟ plugin ๐Ÿ‘๐Ÿฟ loader

maiden briar
#

But why do I get this error? I never use bukkit's plugin

quaint mantle
#

hi everyone

wraith rapids
#

something clearly does

eternal oxide
#

because you are initializing the other class

clear iris
#

How do you stop the milk bucket visual glitch when you cancel the milking event?

wraith rapids
#

can't you just give up and do it the not stupid way

maiden briar
#

I never done new BukkitPluginLoader()

wraith rapids
#

this is painful to look at

#

it's been like a week

maiden briar
#

No not the same issue

#

It's something else

wraith rapids
#

the issue is that you have no idea what you're doing

#

which was the same then as it is now

onyx shale
maiden briar
#

I will show you the final work if I done it

wraith rapids
#

i don't want to see it

maiden briar
#

If you don't want to help I have to find out myself

wraith rapids
#

i want you to stop banging your head against the wall

clear iris
#
    public void cowMilk(PlayerInteractEntityEvent event) {
        Player p = event.getPlayer();
        Cow cow = (Cow) event.getRightClicked();
        if (cow.getCustomName().equals("Bull") && p.getEquipment().getItemInMainHand().getType().equals(Material.BUCKET)) {
            event.setCancelled(true);
            p.sendMessage(":/");
        }
        else {
            ;
        }
    }```
maiden briar
#

Check your cast to Cow with intanceof

wraith rapids
#

not every right clicked thing is a Cow; check (instanceof) whether it is a cow before you assume (cast)

#

kind of like with genders

onyx shale
#

also we have special events or it tho

wraith rapids
#

@onyx shale what are your pronouns

onyx shale
opal juniper
#

Anyone know why this is happening?

#
    @Override
    public void onPacketSending(final PacketEvent event) {
        Player player = event.getPlayer();

        PacketContainer packetContainer = event.getPacket();
        int id = packetContainer.getIntegerArrays().read(0)[0];

        if(packetContainer.getMeta("CUSTOM").isPresent()) return;

        if(this.plugin.blocks.containsKey(id)) event.setCancelled(true);

    }

I am using this packet interceptor to stop the packets

wraith rapids
#

uh

opal juniper
#

but there is no reason as far as i can tell that the items' id should be in the map

wraith rapids
#

you probably want to restrict dropping the packets only for the fallingsand blocks

opal juniper
#

Thats a point, i couldn't see a way to get the entity from the packet tho

#

only the entity id

wraith rapids
#

mmm

#

how are you populating the id map

opal juniper
#

sure, one sec

#
@EventHandler
    public void onExplosion(EntityExplodeEvent event) {
        for (final Block b : event.blockList()) {
            Collection<ItemStack> drops = b.getDrops();
            if(drops.size() > 0) {
                try {
                    ItemStack item = Iterables.get(drops, 0);
                    Vector vector = (event.getLocation().toVector().subtract(b.getLocation().toVector())).multiply(-0.4);
                    vector.setX(vector.getX() * x);
                    vector.setY(vector.getY() * y);
                    vector.setZ(vector.getZ() * z);

                    FallingBlock block = b.getWorld().spawnFallingBlock(b.getLocation(), item.getType().createBlockData());

                    this.blocks.put(block.getEntityId(), 2);

                    block.setVelocity(vector);
                }catch (IllegalArgumentException e){

                }
            }
        }

x,y,z are set elsewhere. but are irrelevant to this

the reason i get the drops is for blocks like grass where i want dirt and things like dead bushes will not fling a dead bush, instead just error out with the stick

clear iris
#
    public void cowMilk(PlayerInteractEntityEvent event) {
        Player p = event.getPlayer();
        Cow cow = (Cow) event.getRightClicked();
        if (event.getRightClicked() instanceof Cow && cow.getCustomName().equals("Bull") && p.getEquipment().getItemInMainHand().getType().equals(Material.BUCKET)) {
            event.setCancelled(true);
            p.sendMessage(":/");
        }
        else {
            ;
        }
    }```
#

still give fake milky

maiden briar
#

instanceof after cast ๐Ÿคฆ

wraith rapids
#

now you are assuming and then checking

#

check first, assume later

opal juniper
#

I have a feeling it must have something to do with the drops

the reason i get the drops is for blocks like grass where i want dirt and things like dead bushes will not fling a dead bush, instead just error out with the stick

right @wraith rapids ?

wraith rapids
#

uh, try printing the map in your packet dropper

opal juniper
#

oh ok

#

sure

tardy delta
#

can i put these things inside a different method than onEnable() ?

this.getCommand("ignite").setExecutor(new PluginCommandExecutor(this));
opal juniper
#

?paste

queen dragonBOT
wraith rapids
#

yes, technically yes, but in practice there is almost never any reason to do so

tardy delta
#

oh okay because i saw it somewhere

wraith rapids
#

for one, you probably want your commands to be assigned to their executors during enable

opal juniper
tardy delta
#

uhu

wraith rapids
#

as long as that method gets called if and only if your plugin is enabling, it should be fine

opal juniper
#

You can see where they start to get deleted

tardy delta
#

but what if i have more commands and i want to make it faster?

wraith rapids
#

then you just repeat the line

tardy delta
#

okay

wraith rapids
#
this.getCommand("home").setExecutor(new HomeCommand(this));
this.getCommand("tp").setExecutor(new TpCommand(this));
this.getCommand("msg").setExecutor(new MsgCommand(this));
#

uh

cold tartan
#

btw u can color format code like this by typing three backticks and the language thing

wraith rapids
#

i vaguely remember there maybe being a way to get an entity by the entity id

tardy delta
#

yea thanks

wraith rapids
#

though i think that is nms

opal juniper
#

i will have a look

#

most likely

clear iris
#

yes yes i know

opal juniper
#

i can use it to debug at least

cold tartan
wraith rapids
#

for debugging purposes, maybe just iterate over all of the entities in the world and see which entity corresponds to which id

#

and then print it

opal juniper
#

yh

clear iris
#

ye idk tf im doing wrong

cold tartan
#

do you get any errors?

clear iris
#

nope just a fake milk bucket

cold tartan
#

hmmm

#

btw with that code if you right click a cow with nothing in your hand you get a nullpointer exception

clear iris
#
    @EventHandler
    public void cowMilk(PlayerInteractEntityEvent event) {
        Player p = event.getPlayer();
        if (event.getRightClicked() instanceof Cow) {
            Cow cow = (Cow) event.getRightClicked();
            if (cow.getCustomName().equals("Bull") && p.getEquipment().getItemInMainHand().getType().equals(Material.BUCKET)) {
                event.setCancelled(true);
                p.sendMessage(":/");
            }
        }
        else {
            ;
        }
    }```
craggy cosmosBOT
dusty herald
#

Dyno u do too much fucking thinking

#

ur broke as shit

cold tartan
#

lmfao

wraith rapids
#

what even happened

#

all I see is an empty message

dusty herald
#

its broken

tardy delta
#

yea

clear iris
#

any idea to stop the cum buckets visual bug

wraith rapids
#

try updating the player inventory

clear iris
#

ok nice

#

ty

dusty herald
#

shame on u

opal juniper
# wraith rapids try updating the player inventory

I added this in my runnable @wraith rapids :

                    for(Entity entity : Bukkit.getWorld("world").getEntities()){
                        if(entity.getEntityId() == id){
                            System.out.println(entity.getType());
                        }
                    }

But i just got a few Falling Blocks not anything else

sharp bough
#

i have a command, wich has 1 to 3 args, but some of the args are like "item" or "location", is there a way to setup alliases of item and location to items and locations? (my first idea was if the arg3 == items || itemss, arg3 = item and then check if the arg3 == item do something

clear iris
#

@dusty herald what then

dusty herald
#

==

sharp bough
#

buti want a cleaner way

#

aliases: [chests,ch]

#

like that

wraith rapids
#

use a command framework

clear iris
#

same thing ??

wraith rapids
#

or if you want to do it yourself

dusty herald
#

no

wraith rapids
#

have a String -> Subcommand map

clear iris
#

only mtters with strings?

wraith rapids
#

and have multiple Strings point at the same Subcommand

#

f.e "chests" and "ch" would point at the same subcommand

#

while "items" would point at a different one

sharp bough
#

i see

dusty herald
clear iris
#

damn that guy died

dusty herald
wraith rapids
#

debug the packet dropper

opal juniper
wraith rapids
#

make it print out the id and type of each entity it drops a packet for

sharp bough
wraith rapids
#

although i'm not sure if the entity still exists since the destroy entity packet has already been sent

sharp bough
#

like that?

#

no wait

wraith rapids
#

no that has nothing to do what you're doing

sharp bough
#

thats a different thing

#

nv

wraith rapids
#

that is for concatenating several arguments into one argument

quaint mantle
#

hey lads, i'm very confused about something that seems very simple and have always done in the years

            if (event.getFrom().getX() != Objects.requireNonNull(event.getTo()).getX() || event.getFrom().getZ() != event.getTo().getZ()) {
                Location loc = event.getFrom();
                event.getPlayer().teleport(loc.setDirection(event.getTo().getDirection()));
            }

it just randomly stopped working and had to cancel out the move event

opal juniper
#
    @Override
    public void onPacketSending(final PacketEvent event) {
        Player player = event.getPlayer();

        PacketContainer packetContainer = event.getPacket();
        int id = packetContainer.getIntegerArrays().read(0)[0];

        for(Entity entity : Bukkit.getWorld("world").getEntities()){
            if(entity.getEntityId() == id){
                System.out.println(entity.getType());
            }
        }

        if(packetContainer.getMeta("CUSTOM").isPresent()) return;

        if(this.plugin.blocks.containsKey(id)) event.setCancelled(true);

    }
eternal oxide
#

getBlockX @quaint mantle

opal juniper
#

doesn't print anything when there is the explosion

wraith rapids
#

yeah, figures

#

the entities are already gone by that point

quaint mantle
opal juniper
#

Soo stupid @wraith rapids

eternal oxide
#

um, why are you teleporting players to the location?

quaint mantle
#
@EventHandler
    public void onPlayerMove(PlayerMoveEvent event) {
      if (event.getFrom().getX() != Objects.requireNonNull(event.getTo()).getX() || event.getFrom().getZ() != event.getTo().getZ()) {
                Location loc = event.getFrom();
                event.getPlayer().teleport(loc.setDirection(event.getTo().getDirection()));
            }
        }
    }
#

this is all that it has to do

#

so it allows the player to move the camera

#

yet it just randomly stopped working for some of the players

wraith rapids
#

like, it seems to be dropping out the entity destroy packets for merging itemstacks

#

but not for picking them up

#

maybe comment out the entire thing and see if that's caused by something else entirely

#

i don't really have any more ideas as to what it could be

eternal oxide
#

pointless, all you have to do is check x,y,z in from and to, then cancel if they are different. ignore and allow pitch and yaw

#

no point in teleporting

#

also, stop using Objects.requireNonNull it literally has no place in that code

opal juniper
#

Sure, one mo

quaint mantle
#

well yeah that is not the problem though, the if check stopped working it never reaches the inside statement

opal juniper
#

It works fine without the packet interceptor @wraith rapids

quaint mantle
#

that was just an attempt to see what was going on, I do cancel the event normally

wraith rapids
#

get the entity ids of the dropping items and compare them to the ones that get dropped by the packet listener

eternal oxide
#

I'd be surprised if that test ever fails as you are comparing doubles for x and z

quaint mantle
#
@EventHandler
    public void onPlayerMove(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        if (event.getFrom().getX() != event.getTo().getX() || event.getFrom().getZ() != event.getTo().getZ()) {
            if (Main.getModeManager().isStarted()) {
                if (Main.getModeManager().isDeathmatch()) {
                    if (!player.isOp()) {
                        if (!player.getGameMode().equals(GameMode.SPECTATOR)) {
                            event.setCancelled(true);
                        }
                    }
                }
            } else {
                if (!player.isOp()) {
                    if (!player.getGameMode().equals(GameMode.SPECTATOR)) {
                        event.setCancelled(true);
                    }
                }
            }
        }
    }
eternal oxide
#

I bet they'd be different more often than not

quaint mantle
#

this is my normal code

#

I did debug the other checks, it never gets inside the x and z check

quaint mantle
eternal oxide
#

pretty much impossible

#

unless your event is not registered

wraith rapids
#

let me introduce you to my friend

quaint mantle
eternal oxide
quaint mantle
#

actually I switched to a new version of tuinity when that stopped working let me see if I revert back to an older version it works

#

still wouldn't make sense as I am pretty sure that fork doesn't touch anything relating that

eternal oxide
#

Well, all I can say is that code works just fine under Spigot

rotund pond
#

Hello !
I'd like to use a sqlite database foy my plugin, does anyone know a good video (or a good forum topic) to learn this please ?

(All i can found is for mysql...)

opal juniper
#

How do i get the id of the dropping items @wraith rapids

wraith rapids
#

listen to whatever event is fired when shit drops and print it out

opal juniper
#

kk

rotund pond
#

Oooh I didn't know there was one on spigot, sorry
Thank you for your time

wraith rapids
#

the only case where that would fail is if the player simply turns around

#

the move event is fired for rotational movement as well

eternal oxide
#

Thats true. If they are ONLY moving the mouse, it would never fire

#

but the event would just pass through and process normally, so no need to do anything

fierce salmon
#

how do you switch out one item with another item from a player.

#

like i want to get the diamond sword from the player's inventory and switch it with a stone sword

#

how would i do that

quiet ice
#

player.getInventory().setItem(slot, itemstack)

wraith rapids
#

take it away and then put something else in the slot

fierce salmon
#

yes

quiet ice
#

Of course you would need to do a few checks, maybe use #getFirst

opal juniper
#

it doesn't seem like they ever get to the packet listener tbh...

quaint mantle
wraith rapids
#

well something has to be fucking with the packets sent when itemstacks merge

#

try merging two items manually on the ground

#

see if it happens only when there's an explosion going on or if it always happens

fierce salmon
#

@quiet ice this is what i tried to set their main hand item to a diamond sword

opal juniper
#

needs an itemstack

quiet ice
#

new ItemStack(Material.UNOBTAINIUM)

wraith rapids
#

Material.DIAMOND_SWORD is not an ItemStack

#

it is a Material

fierce salmon
#

ty

wraith rapids
#

try it with stone instead of sand

#

or wait, do it with something that doesn't cause items to drop from the explosion

#

like ice

#

it might be that the client is dropping the sand items for the disappearing fallingsand blocks or something

opal juniper
#

my method doesn't work at all with ice cause there is no drops, lemme change it back a bit

fierce salmon
#

i am getting a warning about sword == 3 is always true

opal juniper
#

I think i found the problem

#

the problem was the code that was using the drops to determine the falling sand

#

wait no it wasn't

quiet ice
quaint mantle
fierce salmon
#

alright

quiet ice
#

Nvm, not strange at all

#

IntelliJ is right there, it can never be anything but 1,2 or 3. Really clever IDE there (even if I assume that it is just parsing Javac output)

#

to fix that, use random.nextInt(4) + 1 instead

clear iris
#

0123

wraith rapids
#

the min range is inclusive

#

the max range is exclusive

quiet ice
#

as such, you get an int that is either 0, 1 or 2, the + 1 does the rest

mystic adder
#

can somebody help?

quiet ice
#

no.

mystic adder
#

..

quiet ice
#

This is not a help channel and will never be one!

#

Muhahaha

mystic adder
#

oh my bad

clear iris
#

are you perhaps a block game player

wraith rapids
#

block head

fierce salmon
quiet ice
#

it is not

young knoll
#

Upper bound is exclusive

#

Like was said

quiet ice
#

If the IDE says there is an issue, then you will need to look at it very closely, especially if it is not null related

fierce salmon
#

if i set it to 4 it now says that sword == 4 is always true

ashen agate
#

Does anyone know if it's possible to alter/change the default minecraft Piglin bartering loot table in bukkit?

dense kestrel
fierce salmon
#

ok

clear iris
#

any cheese ways of making passive mob attack player

opal juniper
dense kestrel
clear iris
#

no no no no no no

#

๐Ÿคฌ

#

cheese ways

dense kestrel
#

There is no non-NMS way i know of doing that

#

There may be a way, but if there is I do not know it

young knoll
#

Stack it on a silverfish

#

Lel

ivory glacier
#

Hey how comes .displayName() isn't being used in advancement and death messages?

dense kestrel
#

You mean like the display name of a sword?

ivory glacier
#

Nah player

#

So I set player name colours

#

And I want them to show in all messages

dense kestrel
#

Then change it...

ivory glacier
#

I did

dense kestrel
#
@EventHandler
public void onDeath(PlayerDeathEvent event) {
      event.setDeathMessage(message);
}

This isnt the real code, but its close (cant be asked to open Intellij rn)

clear iris
#

get set

ivory glacier
#

But I haven't modified it at all

dense kestrel
#

Then modify it lol

eternal oxide
ivory glacier
#

Yeah for e.deathMessage()

#

Using chat components

#

Oh maybe it's a Paper thing

eternal oxide
#

This is Spigot not Paper

ivory glacier
#

Yeah sorry wrong place

eternal oxide
#

np

young knoll
#

If I remember correct it doesnโ€™t show the display name

#

But you can change that with a simple replace

ebon peak
#

Can anybody help me pls?

radiant aspen
#

what are u trying todo?

terse lily
#

using org.spigotmc:spigot:1.16.5-R0.1-SNAPSHOT as maven dependency for my plugin

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project <name hidden>: Compilation failure
[ERROR] Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider org.eclipse.sisu.space.SisuIndexAPT6 not found
#

does b1064c69c444b9447a65ad36b6cff39d9e052263 commit on CraftBukkit fix that?

quaint mantle
#

how can I paste a large schematic without lag through code without fawe

opal juniper
#

you can't?

quiet ice
#

smear the paste over a longer time

opal juniper
#

or do it bit by bit

#

yeah]

quiet ice
#

If that isn't possible you will need to use unsafe operations and such and generally is just a PITA

maiden briar
#

Is there a dependency with only the bungee chat api?

#

The one which is included in spigot

chrome beacon
#

It would be the chat module in Bungeecord

maiden briar
#

Ok how to import?

chrome beacon
#

You could manually install it

wraith rapids
#

as you would import anything else

maiden briar
#

How do you mean install ?

ivory sleet
#

@chrome beacon since when did u get rich

chrome beacon
#

Still poor

wraith rapids
#

paying money for things is for virgins

ivory sleet
#

Lol nice

opal juniper
#

I want to commit @wraith rapids

#

this just will not work

wraith rapids
#

did you get anywhere with it

opal juniper
#

No, i have stripped the code back

#

but i think there must be some packet i need to deal with

maiden briar
#

I don't know how to import only the chat api from bungee

opal juniper
#

i got this far:

    @EventHandler
    public void onExplosion(EntityExplodeEvent event) {
        final Entity en = event.getEntity();

        for (final Block b : event.blockList()) {

            double Max = 0.5;
            double Min = -0.5;
            double x = Math.random() * (Max - Min) + Min;
            double y = Math.random() * (Max - Min) + Min;
            double z = Math.random() * (Max - Min) + Min;

            Vector vector = (event.getLocation().toVector().subtract(b.getLocation().toVector())).multiply(-0.4);
            vector.setX(vector.getX() * x);
            vector.setY(vector.getY() * y);
            vector.setZ(vector.getZ() * z);

            FallingBlock block = b.getWorld().spawnFallingBlock(b.getLocation(), b.getBlockData());
            block.setDropItem(false);
            block.setHurtEntities(false);

            this.blocks.put(block.getEntityId(), 2);

            block.setVelocity(vector);

        }
    }

//#######################

    @EventHandler
    public void onBlockChange(EntityChangeBlockEvent event){

        if(this.blocks.containsKey(event.getEntity().getEntityId())){
            event.setCancelled(true);
        }
    }

//#######################

public class BlockLand extends PacketAdapter {

    private RealPhysics plugin;

    public BlockLand(final Plugin plugin) {
        super(plugin, PacketType.Play.Server.ENTITY_DESTROY);
        this.plugin = (RealPhysics) plugin;
    }

    @Override
    public void onPacketSending(final PacketEvent event) {

        int entityId = event.getPacket().getIntegerArrays().read(0)[0];

        if(this.plugin.blocks.containsKey(entityId)){
            event.setCancelled(true);
        }

    }
}
wraith rapids
#

and yet you're trying to write an api for people

opal juniper
#

he has a point @maiden briar

wraith rapids
#

i'm a pretty pointy guy

opal juniper
#

lmao

#

Is there a way to listen to all packets?

chrome beacon
#

Yes but why would you

opal juniper
#

for testing

wraith rapids
#

i don't remember there being an easy one, but there is a pretty good plugin for debugging packets

maiden briar
#

The solution is simple @wraith rapids I just work with multiple maven modules

wraith rapids
#

one that is made for this exact purpose

wraith rapids
#

of figuring out when what is sent

#

i just don't remember the name

opal juniper
#

<

chrome beacon
#

Yeah there's an easy way I've done it before

#

Wish I could remember it though sadcatto

opal juniper
#

it is old tho

wraith rapids
#

that's for events but it might have packets too, I don't remember off the top of my head

opal juniper
#

it does

wraith rapids
#

then that

opal juniper
#

but it is 1.13

wraith rapids
#

it works fine

opal juniper
#

ok

wraith rapids
#

it uses like reflection or something idk

tardy delta
#

how can i get rid of this message when enabling a plugin in the console?

wraith rapids
#

you don't

tardy delta
#

hmm

#

but how can i send a message then when the plugin is fully loaded?

wraith rapids
#

getLogger().info()

tardy delta
#

oh

#

does that support color codes?

quiet ice
#

ohno

wraith rapids
#

depends on your console, probably

#

not like you'd need colors in the console anyway

#

sending a message to the console sender and using system.out has the same color support

opal juniper
#

That plugin doesn't work

#

<

wraith rapids
#

it worked just fine for me last week

#

although i used it for events and not packets

opal juniper
#

it just spammed my console with all the packets even though i added specific ones

#

yeah, i think that the packets may not work

#

it also spat out an error

wraith rapids
#

try calling remove(key) instead of containsKey(key)

opal juniper
#

Where?

tardy delta
#

so onEnable is runned when the plugin is loaded? (just to be sure)

opal juniper
#

in the packet interceptor

wraith rapids
#

yeah

tardy delta
#

oki

wraith rapids
#

onEnable is called when the plugin is enabled

#

onLoad is called when the plugin is loaded

opal juniper
#

but that is not an if statement argument tho?

wraith rapids
#

!= it to null or something

tardy delta
#

and what does "loaded " mean? :/

wraith rapids
#

a plugin is loaded first

#

then it gets enabled

#

as for what that means is up to the plugin

tardy delta
#

uhh okay

opal juniper
#

ok....

worldly ingot
#

All plugins have their classes loaded by the server

#

After which point all plugins are then enabled

opal juniper
#

nah that didn't do anything

#

maybe choco will know

wraith rapids
#

not all classes are loaded at once though

worldly ingot
#

Yeah, when called upon

#

The primary class obviously, listeners, commands and whatever else is registered/referenced onEnable()

quaint mantle
wraith rapids
#

the main class and the classes directly deferenced by that class

tardy delta
#

how do i get rid of that orange thing in intellij?

wraith rapids
#

real men don't use tests

tardy delta
#

?

#

I dont know what this even is

wraith rapids
#

it's complaining that your code there isn't covered by any tests

tardy delta
#

goh

wraith rapids
#

as for how you managed to turn those warnings on despite not knowing what tests are, I have no clue

#

nor do I know how to turn them off because i don't use tests

tardy delta
#

xd

worldly ingot
tardy delta
#

fixed

worldly ingot
#

Then you can checkout that branch with git checkout paper-1_16_5-fix, compile using whatever build system they use

#

Which seems to be Maven. So mvn clean package

#

Or if you don't have the original repository, swap out that first command with just a git clone https://github.com/Fernthedev/NametagEdit.git

opal juniper
#

is there a way to see what PacketType.Play.Server.ENTITY_DESTROY does

#

cause it is causing no end of problems

worldly ingot
#

Do you want to know what the packet does or when it's being sent?

opal juniper
#

Well, as soon as i enable the packet listener it causes these weird ghost item drops

#

so i wondered why it does this

#

So, i guess both ๐Ÿคฃ

worldly ingot
#

Well, the packet listener shouldn't do anything unless you're actively modifying the packet. That packet will remove the entity with the given EID

wraith rapids
#

his issue is that he's trying to prevent fallingsand blocks from disappearing on the client by dropping the entity destroy packets

#

but somehow that is also preventing dropped items from despawning or merging properly

worldly ingot
#

PES_Think just on the client? wot

quaint mantle
wraith rapids
#

yeah, the actual server-side entity hits the ground and the block form event or whatever is cancelled

opal juniper
#

Well, i am trying to make a tnt physics pluin, onse sec

wraith rapids
#

so it poofs

worldly ingot
#

yeah of course because on the server, the falling sand would have dropped

#

Yeah

opal juniper
#

my code is up a bit ^^

wraith rapids
#

but he wants to retain the falling entities on the client for a short period of time

#

which is why he is dropping the entity destroy packet

#

and resending one for that eid later

worldly ingot
#

Ah I see what you mean

wraith rapids
#

but somehow this is fucking with dropped item entities

worldly ingot
#

Yeah because it would have dropped an item on the server ;p

#

but the client doesn't understand that because the sand is still there

wraith rapids
#

he has an eid set consisting only of eids for the fallingsand blocks he wants to retain

#

no other packets should be getting dropped

worldly ingot
opal juniper
worldly ingot
#

No no I get that, NNY. Regardless of whether or not you cancel that removal packet, this is going to happen

Server side: The falling sand entity is removed and an item is dropped
Client side: The falling sand entity is kept on the screen, no item is dropped because the entity is still there

tardy delta
#

well I have seen plugins that managed to remove the "enabling <pluginname>" on console :/

opal juniper
#

The vectors aren't done yet, hence the bad look

wraith rapids
#

does cancelling the event drop the corresponding item?

#

i don't remember it doing that

worldly ingot
#

It shouldn't, no

#

If you're cancelling the server-sided event from Bukkit, that is

wraith rapids
#

yeah, he is

opal juniper
#
    @EventHandler
    public void onBlockChange(EntityChangeBlockEvent event){

        if(this.blocks.containsKey(event.getEntity().getEntityId())){
            event.setCancelled(true);
        }
    }
wraith rapids
#

so the entity just poofs on the serverside, without having dropped an item nor having become a block

worldly ingot
#

Ah I see

wraith rapids
#

but since the destroy packet is cancelled, the fallingsand entity remains on the clientside

#

however there is a dropped item appearing from somewhere on the clientside as well

worldly ingot
#

Are they client-sided items?

#

(in the inventory* I mean)

wraith rapids
#

on the ground

#

they can't be picked up and don't merge, so I would assume they are client sided

#

they also all have a stack size of 1

opal juniper
#

Some can, but there are some that cannot

worldly ingot
#

I'd imagine that the ones that aren't are just from the explosion itself

opal juniper
#

Sorry, to clarify what does 'aren't' mean

#

as in merging?

worldly ingot
#

The ones that you can actually pickup* are from the explosion

#

The ones that you cannot pickup are client-sided

opal juniper
#

yeye ok

wraith rapids
#

the issue is definitely caused by the packets being dropped

worldly ingot
#

To fix those server-sided ones you can just set the explosion yield to 0, but yeah I'm not sure about the client-sided ones

#

Some weird fuckery with the falling sand entities lol

wraith rapids
#

but we've debugged the issue and we're fairly certain that only fallingsand eids are in the eid set

#

did you try it with different fallingsand vs physical block types yet

opal juniper
#

Is there another way to make the falling sand entities persist without packets?

wraith rapids
#

that'd let us see whether the items are being dropped from the falling sand by the client or something

opal juniper
#

what block you want me to try

worldly ingot
#

Wait, I'm curious

#

Why aren't you just spawning the falling sand client side? ;p

opal juniper
#

wait

#

oh yeah

#

hmm

wraith rapids
#

because just cancelling the destroy packet seemed easier ๐Ÿ™‰

worldly ingot
#

๐Ÿ‘€

wraith rapids
#

evidently fucking not though lmao

opal juniper
#

idk really

worldly ingot
#

Might save you a bit of hassle if you do those client-sided

#

You will have some other implications like being unable to damage entities that are hit by it, if you're concerned about that

#

but if you're going just purely for visual, client-side is the way to go

opal juniper
#

iirc i forgot the method and saw the spawnFallingBlock under world and was like 'thats a good way'

opal juniper
worldly ingot
#

Ah nothing a good ole for-each loop couldn't handle

opal juniper
#

how do you spawn the falling sand client side?

#

it completely evades me

fierce salmon
#

why am i getting an error here?

worldly ingot
#

There's a spawn entity packet for you, iirc. Though there might be one specifically for falling sand

#

Lemme check the protocol

opal juniper
#

sure ๐Ÿ‘

wraith rapids
#

because PotionEffectType is not a PotionEffect

worldly ingot
opal juniper
#

yeah i have seen it

clear iris
worldly ingot
#

Yeah looks like just spawn entity is what you need. It's for non-living entities and vehicles which would include falling sand

#

Also lets you specify a velocity x, y and z

#

Take a look at the server's PacketPlayOutSpawnEntity class, see its field structure and go from there

#

ProtocolManager has a #createPacket() method iirc

opal juniper
#

ok, thanks

paper viper
#

So I was wondering. Do you think hosting providers like BisectHosting have the user's password the same as the user login password?

The reason why I am asking is that my plugin requires an app (VLC Media Player) to be installed and that requires sudo like sudo apt-get to install, and I was wondering if the user could enter the password, make the plugin securely encrypt the password using some strong encryption standard (probably AES-256) and use it for installing the software. The code will obviously be open source so there wouldn't be anything sketchy going on.

Although I could just compile the sources by itself (using gcc), VLC Media Player uses many many dependencies that are a pain to handle. I would have to compile each of those dependencies and fetch the source code and statically link them to my VLC binaries, which would be just a pain to accomplish.

#

so i think im stuck

worldly ingot
opal juniper
#

Ok, nice

#

can i avoid NMS for this?

worldly ingot
#

If you just want to use ProtocolLib that's fine

opal juniper
#

i think so right?

#

ok

worldly ingot
#

Oh, well, same thing lol

opal juniper
#

hehe

wraith rapids
#

was renamed from falling sand to falling block at some point

worldly ingot
#

Deprecated because it's an internal magic value by the way but you're fine to use it in this case

#

Yeah I'm just so used to sand lol

opal juniper
#

ok awesome, i wish it was still sand

ivory sleet
#

Will spigot ever bump the version of snakeyaml?

wraith rapids
#

imagine having comments

ivory sleet
#

๐Ÿฅฒ

fierce salmon
#

im trying to get it so it acts like a golden head from hypixel

clear iris
#

lmao its called player_burp

wraith rapids
#

implying any of us have ever played on hypixel and know what the shit that is

clear iris
#

haha

#

its actually called player burp

fierce salmon
#

yea lmao

tardy delta
#

imagine saying lmao

clear iris
#

lmao true

tardy delta
#

๐Ÿ˜‚

opal juniper
#

I have no clue how to make this packet:

            PacketContainer sandPacket = new PacketContainer(SPAWN_ENTITY);
            sandPacket.getIntegers().
                    write(0, 500).
                    write(1, (int) EntityType.FALLING_BLOCK.getTypeId()).
                    write(2, (int) (event.getLocation().getX())).
                    write(3, (int) (event.getLocation().getY())).
                    write(4, (int) (event.getLocation().getZ()));
#

Not like this though:

#

How would i change this to make a custom falling block entity?

tardy delta
#

:/

fluid nacelle
#

If AnvilInventory#setMaximumRepairCost and setRepairCost are used, could I technically set the cost as high as I want (within the limits of an integer ofc)? Or will it reach a stage where it displays "Too expensive!"?

worldly ingot
#

setMaximumRepairCost() unfortunately doesn't update the client afaik so it may still show "Too expensive", though it would be useable

fluid nacelle
#

So a packet might also need to be sent as well then?

#

And listened for?

worldly ingot
#

If that were the case I would have done that in implementation stitchSad3

#

It's out of our control. Client has a hard-set cap

#

jeff you're missing a few other required fields. The missing entity data watcher is probably what's calling that NPE

fluid nacelle
#

๐Ÿ˜ฆ

worldly ingot
#

It's a very, very old gist, but it's still accurate afaik

opal juniper
#

okeee

tardy delta
#

Here I'm again :))))) Is there a way to lock a container inside mc and make it only accessible for the owner?

opal juniper
#

I mean, yeah probably

#

listen for the opening

#

and see if it is a container

#

if so, check the player has auth to open it

tardy delta
#

I want to make a command like /protect private and then only that person can open it

cold pawn
#

How do I get a player besides the sender in command executor?

opal juniper
#

what do you mean?

cold pawn
#

I want an op to be able to change a players info in there data file when they run a command but how do I specify that player in the CommandExecutor method cause all I see is that its just the sender not a specific player

opal juniper
#

What like:

Player player = (Player) sender;

?

summer scroll
#

Use the args.

cold pawn
#

But thats for the sender im trying to call a player thats not the sennder

summer scroll
#

Bukkit.getPlayer(args[0]); for example.

opal juniper
#

yeah

cold pawn
#

ah

opal juniper
#

ooooohh

#

i get you

fluid nacelle
opal juniper
#

what i then do is use a tabCompleter to add their names to the tab list

#
List<String> list = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers()) {
    list.add(player.getDisplayName());
}
return list;
``` like this
fluid nacelle
#

๐Ÿค” any ideas? I'd like to give the player a message letting them know they can still use the anvil if it says "Too expensive" but only for the version(s) needed that the player may be joining from.

fierce salmon
#

any idea why this wouldnt work?

opal juniper
#

define:

wouldnt work?

clear iris
#

wgat error

fierce salmon
#

Method invocation 'getType' may produce 'NullPointerException'

fluid nacelle
#

That aside, why don't you simply assign the level value as "bow" its self? .-.

ivory sleet
eternal oxide
#

getType will never produce an NPE unless getItem is null

fierce salmon
#

a lot of words i cant comprehend

#

XD

fluid nacelle
#

item.addEnchantment(Enchantment.ARROW_KNOCKBACK, bow);

fierce salmon
#

well i want to add a level of arrow knockback

#

o wait

#

true

#

never thought of that

sharp bough
eternal oxide
#
ItemStack item = event.getItem();
if (item != null && item.getType() == Material.BOW) {```
#

or just check event.getItem() is not null

worldly ingot
eternal oxide
sharp bough
#

give me a sec

#

brb

fierce salmon
#

@fluid nacelle it works but im only getting punch 1 or punch 2

#

rarely punch 2

#

o cause unsafe enchantment

#

got it

sharp bough
#

like chest.remove.item

eternal oxide
#

if those perms you showed are in your plugin.yml they are correct

sharp bough
#

yea

#

this is my command manager

hoary tiger
#

I'm trying to spawn an entity with a PDC so I made the spawn Entity creature1 = (Entity) event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), type); and tried to get creature1 but, it seems that I cannot get the method to an Entity so, how would I do this

eternal oxide
sharp bough
#

aight give me a min

eternal oxide
#

to use just log in, then in console type `/manuaddp <player> <permission>

tardy delta
eternal oxide
#

yes

tardy delta
#

ooo

#

I've used it before

clear iris
#

hes the guy

sharp bough
eternal oxide
#

if I'm about

radiant aspen
#

but how will he know if your about without tagging you first?

fierce salmon
#

my plugin somehow crashed my server lmao

magic verge
#

i need help with fast bridge

sage swift
#

do you though

magic verge
#

yes

sage swift
#

now if only this was a plugin help channel, or we knew what fast bridge was

magic verge
#

:/

clear iris
#

define

magic verge
#

can i send the link

#

of plugin

clear iris
#

ok

#

yes

eternal oxide
magic verge
#

there was something cald

#

/fastbridge build

#

but

fierce salmon
magic verge
#

i dont understand what happens

fierce salmon
magic verge
#

and the tutoriol in german and he made the host thru his pc

eternal oxide
#

You are setting to air which is causing it to throw a wobbly

fierce salmon
eternal oxide
#

most likely

fierce salmon
#

!= null

magic verge
#

no can help me : (

eternal oxide
fierce salmon
#

ok

#

wobbly lol

#

i like that

fierce salmon
magic verge
fierce salmon
#

spike i tried using ur link

#

it doesnt work

magic verge
#

wydm

eternal oxide
fierce salmon
magic verge
#

ad click on the

#

wait

eternal oxide
#

Its a plugin and its in german, neither of which I have any interest in

magic verge
#

i cant send pic

fierce salmon
#

and what is ur problem with it?

magic verge
magic verge
#

i mean like

fierce salmon
#

what version is ur server?

magic verge
#

the tutoriol is from his like pc host and not like a server host

#

1.8.9

fierce salmon
#

ok well

eternal oxide
#

Thats a plugin issue, talk to the plugin dev or ask in #help-server

#

This is not the correct channel

fierce salmon
#

k

sage swift
#

1.8.9

#

thats pretty cool

#

my favorite version in fact

tardy delta
#

how can i make values for players? for example if they can move. I want to check them later with a eventListener

sage swift
#

what

tardy delta
#

well for example boolean canMove

eternal oxide
#

if it doesn;t need to survive a server restart set a permission

tardy delta
#

do i need to put that in my main class? It seems like everything from my plugin can use it even if itsnt appliable

paper viper
sage swift
#

1.8 is epic

fierce salmon
#

@eternal oxide for some reason even if it is null the server still crases

eternal oxide
#

same crash? or different

fierce salmon
#

well when i have one item in my hand and right click it it doesnt crash but when i have a stack it does crash

eternal oxide
#

ah ok

#

in that case, you should be reducing the stack size rather than replacing the item

opal juniper
#

Hello!

sage swift
#

goodbye

opal juniper
#

๐Ÿ˜ข

#

I would like to make a falling block, with customisable material data as well as a vector with packets

#

however i am a bit stumped

#

I have this:

opal juniper
#
PacketContainer sandPacket = this.protocolManager.createPacket(SPAWN_ENTITY);
            sandPacket.getIntegers().
                    write(0, 500).
                    write(1, (int) EntityType.FALLING_BLOCK.getTypeId()).
                    write(2, (event.getLocation().getBlockX())).
                    write(3, (event.getLocation().getBlockY())).
                    write(4, (event.getLocation().getBlockZ()));
            sandPacket.getDataWatcherModifier().write(0,sandWatcher);
#

However it doesn't work

#

error:

#

I wondered if anyone could help !

fierce salmon
#

i think i got the solution

tardy delta
#

omg just made a method that freezes people

#

but what's the difference between return true and return false when checking for permissions etc. I assume that one gives the usage message defined in plugin.yml and the other not?

eternal oxide
#

onCommand yes

#

return false if your command failed, to show the usage

noble cedar
#

@rigid dew

tardy delta
#

i mean for example this, what would happpen when i change return true to return false?

eternal oxide
#

return true = do nothing
return false = display the usage from the plugin.yml for the command

tardy delta
#

oh already thought that ๐Ÿ˜›

#

thanks

opal juniper
#

What does this mean:
loaded class 0 from 1 which is not a dependent soft depend or load before or this plugin

#

when i try and send a packet

#

I have this in my plugin.yml:

depend: [ProtocolLib]

tardy delta
#

that class 0 wants to use something from another plugin?

#

hmm

opal juniper
#

Yeah exactly, idk why it gives that tho

proper notch
#

ive just generally ignored it because for me, it's happened even when it is depended upon.

#

It's just a warning so there's no physical implication

opal juniper
#

Caused by: com.comphenix.protocol.reflect.FieldAccessException: No field with type net.minecraft.server.v1_16_R3.DataWatcher exists in class PacketPlayOutSpawnEntity.

#

this is the error from console

#

yeah, mine actually errors

proper notch
#

What version of protocollib are you using? and can you send the full error

opal juniper
#

sure

proper notch
#

?paste

queen dragonBOT
opal juniper
#

i just downloaded the most recent one

#

my maven depend may be old

#

one sec

#

nope

proper notch
#

Make sure you're not packaging protocollib inside of your jar

#

decompile your plugin and make sure it coesn't contain com.comphenix.protocol packages

opal juniper
#
        <dependency>
            <groupId>com.comphenix.protocol</groupId>
            <artifactId>ProtocolLib</artifactId>
            <version>4.6.0</version>
            <scope>provided</scope>
        </dependency>
#

it wont

#

but i will check

proper notch
#

yh it shouldnt with that

opal juniper
#

well, its 8kb so no

proper notch
#

yh idk then

opal juniper
#

lemme try shading it

#

doesn't work

#

<

split panther
opal juniper
#

it was just to test

#

but idk what i am doing wrong

hoary tiger
#
@EventHandler
    public void onSpawn(CreatureSpawnEvent event) {
        
        if (event.getEntity().getPersistentDataContainer().has(new NamespacedKey(plugin, "Spwned"), PersistentDataType.INTEGER)) return;
            
        EntityType type = event.getEntity().getType();
        
        event.setCancelled(true);
        
        Entity creature1 = event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), type);
        System.out.println(creature1);
        
        
        PersistentDataContainer data1 = creature1.getPersistentDataContainer();
        data1.set(new NamespacedKey(plugin, "Spwned"), PersistentDataType.INTEGER, 1);
        event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), type);
        
        return;
        
    }

Event prints a major Error that crashes the server and that is just too long
https://paste.md-5.net/sufohojemu.pl
But that is a part of it

I think Its because the mobs are infinitely spawning

eternal night
#

yes

#

you are spawning two entities, applying the PDC value to the first after it was fully spawned

#

the event is called prior to you modifying the PDC of creature1

#

Use the callback version of spawn to modify an entity prior to it being added to the world

hoary tiger
#

When you say event you mean the event that spawns the entity right? and also Thankyou so much I've been working on this for like 4 hours now

tardy delta
#

Hello there, I'm now trying to make a method that 'freezes' players, so they can't move. But for now I use the event PlayerMovement and that also blocks looking arround, is there another way so it only blocks moving (running arround) and not looking arround?

eternal night
tardy delta
#

and how do i do that XD

summer scroll
#

There is event.getFrom() and event.getTo() on PlayerMoveEvent, just compare them.

tardy delta
#

okay let's see what we can do

summer scroll
#
if(event.getTo().getBlockX() != event.getFrom().getBlockX()){
  event.setCancelled(true);
}
```example, but you might want to check the Z too.
tardy delta
#

or Z idk what the height is, i dont want the height

#

oh it already workd

cold pawn
#

When I run a command ingame its suppose to run the code bellow but instead I get a null exception dose anyone know why?

tardy delta
#

well go with your mouse over the highlighted things

clever sequoia
#

Could not pass event PlayerJoinEvent to Firstplugin v1.0-SNAPSHOT

clever sequoia
cold pawn
#

its not the args that the console is mad about its the first if datamanger call

clever sequoia
#

if is printint the passed thing

topaz dune
#

ItemStack redWool = new ItemStack(Material.WOOL);

#

how to get a red Wool ?

eternal night
#

?paste

queen dragonBOT
paper viper
topaz dune
clever sequoia
paper viper
#

you have to use the color ids

clever sequoia
#

@eternal night

paper viper
#

and that shit

#

and specifiy another short or smthing

eternal night
#

@clever sequoia the stacktrace not the code xD

clever sequoia
#

idk what that is

eternal night
#

the long exception message that pops up in your console

clever sequoia
#

ok

#

@eternal night

eternal night
#

well there we have it huh. TabAPI seems to be missing

topaz dune
eternal night
#

update the block state des

hoary tiger
#

Could I have a quick example how World.spawn is used? I can't seem to understand the clazz and Consumer function parameter

eternal night
#

chest.update(true)

#
world.spawn(location, Zombie.class, zombie -> {
  zombie.setCustomName("Prior-world-add-name");
})
clever sequoia
eternal night
clever sequoia
#

i think so

#

bcz i can call the method

#

os the api

eternal night
#

that does not mean you shade it

clever sequoia
eternal night
#

are you using maven ?

clever sequoia
#

no

eternal night
#

what build tool are you using

#

actually

cold pawn
#

is there a reason why this is null?

eternal night
#

you don#t have to

#

@clever sequoia tab api is not a pure library it is a plugin

#

is the plugin in your server plugin dir ?

clever sequoia
#

wtf im so confused lol

eternal night
#

tab api is a plugin that you need on your server

#

in order to use it

clever sequoia
#

so i have to drag it to the plugins folder?

eternal night
#

ye

clever sequoia
#

ok

eternal night
#

wtf

#

what are those casts

#

this code errors right ?

#

you should be getting a bunch of exception

clever sequoia
eternal night
#

did you put the plugin in your dependOn part

#

in your plugin.yml

clever sequoia
#

nope

#

lol

clever sequoia
eternal night
#

ah yeah. ```yml
depend:

  • "TabAPI"
hoary tiger
clever sequoia
#

ok

eternal night
young knoll
#

event.getEntity.getType.getEntityClass()

eternal night
#

or just

young knoll
#

Pretty sure you can just use the type these days

eternal night
#

entity.getClass

hoary tiger
#

thx! ๐Ÿ˜„

eternal night
#

wait

#

no

#

I lied

#

coll is right

#

entity.getClass would return the craftbukkit impl class

#

Note that you then obviously only have access to methods all entities share

young knoll
#

You can cast if need be

cold pawn
eternal night
#

it might

#

you null check the result

young knoll
#

It returns null if no player with that name is online

eternal night
#
Player player = Bukkit.getPlayer(nameOfThePlayerAsString);
if (player == null) {
  //  player wiht that name is not online
  return;
}
#

also intellij is already yelling at you that you are accessing args[0] before validating that the args array contains at least one element

cold pawn
eternal night
#

well for your case args.lenght >= 1 would also work

#

length of 1 means you can access index 0

cold pawn
#

ok

#

Thats helped fix intellij yelling at me but when I run the command with a valid name it still just says its null

wraith rapids
#

TabAPI
why do people insist on writing things that might just as well be regular libraries as plugins

eternal night
#

tbf that library had its last commit on gh in 2013 xD

upper vale
#

how can i consistently listen to when a player holds out a certain item

wraith rapids
#

listen to player item held event or whatever it's called

upper vale
#

like PlayerItemHeldEvent just ignores picking up items, /give command, etc.

opal juniper
#

hey @wraith rapids you got any experience with protocollib

upper vale
#

you have to switch on and off the slot or it doesnt get called

wraith rapids
#

then you need to listen to inventory click/drag and player pickup event as well

sage swift
wraith rapids
#

and player change hand event

#

i bet that just checks the fucking slot every tick doesn't it

sage swift
#

Uh huh

wraith rapids
#

haram

sage swift
#

@waxen plinth defend yourself lol

clever sequoia
#

lol

wraith rapids
#

inventory.setitem(slot, item)

sage swift
#

random.nextInt(inv.getSize())

wraith rapids
#

TabAPI is not installed or goes by a different name

#

or is not a plugin

#

maybe it is a library after all

#

at least redempt's library is an actual library

waxen plinth
upper vale
#

is it not possible to get the previous main hand in PlayerChangedMainHandEvent :bruh:

waxen plinth
#

Better to have it in one place

wraith rapids
#

ironically enough you don't need to add it to a txt file to use it

sage swift
#

well it's probably the opposite lmao

wraith rapids
#

unlike the api

waxen plinth
#

Rather than a bunch of plugins all doing it on their own

lyric grove
#

Im trying to make a cooldown but its not working

waxen plinth
#

You don't need a txt file to use RedLib lmao

#

That's only the command manager

wraith rapids
#

yeah that's why it's ironic

waxen plinth
#

Shut up with your stupid one joke

eternal night
wraith rapids
#

because you do need to add a name to a txt file to use that other api

eternal night
#

that is at least what I found from your package name

sage swift
#

i use it don't judge me

waxen plinth
#

I judge you positively for it

sage swift
#

i just said dont

#

foolish

waxen plinth
#

Hey gecko, how do you find the command manager?

wraith rapids
#

kill him

sage swift
#

i go to the wiki

#

Lmao

waxen plinth
#

Is it an evil thing for needing an external file?

#

No I mean how do you find it as in do you like it

sage swift
#

i know

#

I'm just too funny

waxen plinth
#

smh

wraith rapids
#

he just doesn't want to admit to sin

sage swift
#

it's a bit more difficult to get started but it's very useful for organizing commands

waxen plinth
#

Fair

#

I bet this guy would hate crunch too because it uses strings

wraith rapids
#

i'll crunch your balls

waxen plinth
#

Do it

#

Right now

waxen plinth
#

Man why did that not open in the GitHub app

wraith rapids
#

404's for me

waxen plinth
#

404

#

Yep

wraith rapids
#

the github app is trash

#

stupid electron shit

sage swift
#

hmm how do I share it by phone