#help-development

1 messages · Page 1441 of 1

torn oyster
#

prolly not good for 1.8 huh

sullen marlin
#

there's a scoreboard api....

torn oyster
#

yeah but i've set up my scoreboard so it refreshes every second

sullen marlin
#

heck the first line of the code uses it

torn oyster
#

its a shitty scoreboard system i have never bothered to change cuz it works sorta

#

?paste

queen dragonBOT
torn oyster
#

this

#

idk what to do to make it better anyway

#

its ran every second

#

in a runnablr

outer sorrel
#

Whats the best way to store the players last position with packets?

sage swift
#

packets?

#

store the location with packets? what does that even mean

quaint mantle
#

Hello, how to remove <plugin>:<command>?

sage swift
#

in what context

#

you'll have to register it internally somehow, but all commands have a prefix

#

default minecraft commands are minecraft:<command>

#

the point of the prefix is as to not interfere with other plugins

#

if a server owner wants to remove that, the best way is through an external tab-completion controller

outer sorrel
sage swift
#

why are you not using events

#

the packet will probably only send what their new location is

outer sorrel
#

because packets can detect more stuff

#

for my plugin

outer sorrel
sage swift
#

:]

young knoll
#

So what’s the issue

sage swift
#

not so much "more stuff" as "less stuff"

outer sorrel
#

I want to get the position the player came from but theres no build in function thing for that with packets

young knoll
#

Correct

#

Use the player instance to get their last location

sage swift
#

packet receiving is probably done before the player is moved server-side

young knoll
#

It is

#

And it only contains the movement, not the full location

#

It’s not really possible to move the player before the packet is received

outer sorrel
#

ah makes sense

#

thanks

sage swift
#

double move them

#

this is a great idea and will not cause any issues at all

drowsy helm
#

ChatColor

#

not Color

bitter mural
#

hello all! Is there a standard way to create a stopwatch in Spigot? (i.e. tell the player how long they took to do a task)

sage swift
#

store System.currentTimeMillis, then subtract that stored value from System.currentTimeMillis when needed

bitter mural
#

perfect, thank you! That is exactly what I needed

marble granite
#

are there methods for setting and getting localisednames in spigot 1.8.8?

#

currentyl makeing a 1.16 plugin 1.8 compatible

summer scroll
#

is it for material?

marble granite
#

itemstack

#

does that make it more complicated?

summer scroll
marble granite
#

thx

tardy delta
#

I hope this works

if(event.getTo().getBlockX() != event.getFrom().getBlockX() || event.getTo().getBlockY() != event.getFrom().getBlockY()){
                event.setCancelled(true);
            }```

Y is the height right?
untold kernel
#

how do i change what an animal drops on entitydeathevent

#

?

dense kestrel
tardy delta
#

ok

untold kernel
#

;/

wraith rapids
#

iirc the returned collection only supports removals, not additions

sullen marlin
#

pretty sure it works fine for both, though iirc the user is on 1.7 or something

somber hull
#

so

#

plugin.reloadConfig()

#

whats it do?

wraith rapids
#

reloads the config of the plugin

sullen marlin
#

reloads the file returned by getConfig

somber hull
#

Yea but i changed smthng in the config

#

Ran a command that reloads the config

wraith rapids
#

you're probably caching it somewhere

somber hull
#

And tested

sullen marlin
#

the config loading code inside the plugin still needs to execute

#

ie where you call getConfig().getString etc

wraith rapids
#

it's not gonna magically update all of the values you've already pulled out of the config

#

you have to pull the freshly loaded values out again

somber hull
#

Well, how do i make a /pluginname reload command then?

wraith rapids
#

depends on what you're doing

sullen marlin
#

move your config loading code out of onEnable and then just call that method again

somber hull
#

Whats the difference?

sullen marlin
#

yes

wraith rapids
#

the difference is that now you can call it without calling onEnable

somber hull
#

weird fix but ok

#

lol, it works

untold kernel
#

uhh

#

i am on 1.8

#

lol

tardy delta
#

pff I've been looking for a while but I don't find anything, I'm looking for bukkit code that makes you can lock a container WITHOUT a key

wraith rapids
#

just generate a random key

#

or cancel the event for opening the container

tardy delta
#

I found something like this

    Block b = your block;
        if (b.getBlockData() instanceof Chest) {
            Chest chest = (Chest) b.getBlockData();
            chest.setLock("someLock");
        }
wraith rapids
#

the block data will never be an instance of Chest

#

not that Chest, anyway

#

there are two Chest's

#

one for BlockData, the other for BlockState

tardy delta
#

uh

wraith rapids
#

you have imported the BlockState one, but are getting the BlockData one

#

Block::getBlockData returns the block data; you want Block::getState

#

which returns the block state

#

which you can then call setLock on

opal juniper
#

@wraith rapids what time zone you in cause you always seem to be around? Or is ur sleep schedule just fucked

wraith rapids
#

sleep is for the weak

opal juniper
#

Fair enough then

tardy delta
#

pff i understand it half but yea

wraith rapids
#

you have imported org.bukkit.block.Chest but the getBlockData method returns an org.bukkit.block.data.type.Chest

#

you'll want to call getState which returns an org.bukkit.block.Chest

tardy delta
#

well it's not mt code xd

wraith rapids
#

well it's still wrong

tardy delta
#

can you give me how i could fix it?

wraith rapids
#

sigh

#

try reading what i literally just said

eternal oxide
#
BlockState state = block.getState();
if (state instanceof Lockable) {
    ((Lockable) state).setLock("someLock");
    state.update();
}```` Not sure what you are attempting to do, but thats how to set a lock for the block.
vivid lion
#

i think me and my friend may have found a bug

#

in spigot jar

wraith rapids
#

lockable is also a subtype of BlockState

#

Block itself is never actually subtyped by anything

#

you always want either Block::getBlockData or Block::getState

#

the latter in this case

eternal oxide
#

chest implements Lockable

wraith rapids
#

yes... and Lockable is a type of BlockState

eternal oxide
#

oh you mean as in state

#

yep

wraith rapids
#

not a type of Block

#

a Block will never be an instanceof Lockable, but its BlockState might be

tardy delta
#

i want to make a command that is able to lock a chest for other people than the owner

wraith rapids
#

save the uuid of the owner in the chest's pdc and cancel anyone else's opening attempts

eternal oxide
#

there, fixed

wraith rapids
#

lockette and blocklocker in particular

tardy delta
#

yea but i dont want to use signs/ keys

eternal oxide
#

Then set a key using the players UUID and check it in the event to open it.

potent pecan
#

how can I get default world?

errant drift
#

Explain?

eternal oxide
#

Bukkit.getWorlds().get[0]

dusty herald
eternal oxide
#

Overworld is always index zero and can never be unloaded

dusty herald
#

"that code doesn't work"

#

how u been elgar

eternal oxide
#

I died for 8 hours and lived in a fantasy world. But I'm alive again now.

dusty herald
#

glad to hear that

tardy delta
dusty herald
#

are you trying to get the executor or the target?

#

🤔

tardy delta
#

uhh i want to get the uuid of the players who executes the command :/

eternal oxide
#
if (sender instanceof Player) {
    UUID = sender.getUniqueId();```
tardy delta
#

okay

tacit drift
#

👍 😀

eternal oxide
#

pseudo, so fix it to be proper code

tardy delta
#

and now i want to get the container where the person rightclicked on

#

something like this
if (event.getAction.equals(Action.RIGHT_CLICK_BLOCK) {

//Do Stuff

}

wraith rapids
#

have you tried looking at the javadocs

native ibex
#

Hello, I made a plugin with one command by overriding onCommand in my main class that extends JavaPlugin, on now I overrided onTabComplete for that exact same command but that method doesn't even get called, I get the default player list tab completion instead... Why doesn't it get called ? It is registered in the plugin.yml file

eternal oxide
#

onTabComplete​(CommandSender sender, Command command, String alias, String[] args) with @Override

#

no errors?

native ibex
#

Yes yes

eternal oxide
#

then it should be called

native ibex
#

Everything works, the command works but it is not called

eternal oxide
#

debug (sysout)

native ibex
#

I did

#

Maybe I messed plugin copy to server gimme 1s

eternal oxide
#

There is no reason for it to not be called. In fact its impossible. JavaPlugin implements TabCompleter

wraith rapids
#

real men use the async tab complete event anyway

eternal oxide
#

^ Not Spigot

wraith rapids
#

real men don't use spigot

tardy delta
#

:/

eternal oxide
#

You'll be saying real men wear dresses next

wraith rapids
#

they can wear dresses if they so choose

#

there is nothing more manly than being unquestionable and confident with your decisions

tardy delta
#

😮

eternal oxide
#

Says the cucked 😉

subtle kite
#

did you register it on your main class?

#

this.getCommand("command").setExecutor(new Classname());

wraith rapids
#

i'm going to cuck my fist into your ass

errant drift
#

seesh

eternal oxide
#

setExecutor(this)

#

Should not be needed though

#

as its JavaPlugin

native ibex
#

Ok my "compile and run" configuration wasn't compiling, sorry

wraith rapids
#

mild oversight

tough venture
#

Hi this code not work me very good who can fix me he

#
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;

public class leave_bed_inbepaarty implements Listener{


    @EventHandler
    public void onRightClick(PlayerInteractEvent er) {

        ItemStack bed = new ItemStack(Material.RED_BED);

        if (er.getAction() == Action.RIGHT_CLICK_BLOCK) {

            if (er.getItem() == bed) {
                Player player = (Player) er.getPlayer();
                Location lobby =  LocationManeger.getLocation("lobby");
                player.teleport(lobby);

            }

        }

    }

}
wraith rapids
#

nice class name

tough venture
#

Yes

wraith rapids
#

it may be beneficial to learn a common human language like english before trying to learn a common programming language like java

#

talking with computers is nice and all but you often end up having to ask help from fellow humans

shy wolf
urban trout
#

hello my code doesnt seem to be doing anything

wraith rapids
#

you should tell it to work harder

urban trout
#

huh

urban trout
wraith rapids
#

i don't remember if event.getBlock returns the placed block for block place event

urban trout
#

o

wraith rapids
#

you may want to call getPlacedBlock or some sort of an alternative

#

most events happen before the thing they're for happens

#

that is, this event probably fires before the block is actually placed

#

so the block might not exist yet

#

check the javadocs

shy wolf
#

getServer().getPluginManager().registerEvents(new leave_bed_inbepaarty(), this);
this is how to register event

subtle kite
#

yes

shy wolf
#

sooo y my code dont work

subtle kite
#

what was your problem and code?

wraith rapids
#

what is the problem

#

what do you mean by "don't work"

shy wolf
#

i dont get eny errors in the console

wraith rapids
#

that is not a problem

urban trout
shy wolf
#

1s let try some thing

eternal oxide
#

bad plugin.yml

wraith rapids
#

you should teach it some manners

subtle kite
#

I use spigot 1.8.8 api

@EventHandler
    public void onPlacement(PlayerInteractEvent e) {
        Player p = e.getPlayer();
        if (e.getItem() == null || e.getItem().getType() != Material.RED_BED)
            return;
        if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            Location lobby =  LocationManeger.getLocation("lobby");
            player.teleport(lobby);
        }
        }
#

idk if this works also

#

idk how your server is also set up

tardy delta
#

is there a way to see on which block a player clicks?
I have this now but all blocks are accepted

@EventHandler
    public void onContainerSelect(PlayerInteractEvent event) {
        if(event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            
        }
    }
urban trout
tardy delta
#

ow found it
if (block.getType().equals(Material.EMERALD_BLOCK))

subtle kite
#

what renn?

urban trout
# subtle kite what renn?

i want to make it so when a player places a bedrock block (imma use it as a barricade) it places a 2x3 wall in front of them

tardy delta
#

well I want to check if the block, the player rightclicks on, is a container (chest,enderchest,barrel etc) So can i make a list or something to check if the block.getType() is inside that list?

if(event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getType().equals(Material.CHEST)) {

        }
wraith rapids
#

get the block's state and check if it's an instanceof Container or whatever the interface for those is

tardy delta
#

block.getState() instanceof InventoryHolder

#

yeah thanks

subtle kite
#

ye

tardy delta
#

imagine switching from intellij theme when it becomes darker ._.

shy wolf
#

this is not working

wraith rapids
#

what do you mean not working

shy wolf
#

if (er.getItem() == bed) {
Player player = (Player) er.getPlayer();
Location lobby = LocationManeger.getLocation("lobby");
player.teleport(lobby);

        }

the server not concting to this or something

shy wolf
turbid grove
#

you should not compare ItemStacks with ==

shy wolf
#

IDK i whana die

#

IDKKKKKKKKKK

wraith rapids
#

ugh

shy wolf
#

lol

wraith rapids
#

go bomb some palestinian children or something

shy wolf
#

hi

shy wolf
#

WE ARE THE GOOD ONE

drowsy helm
#

no need for politics here.

#

take it somewhere else

subtle kite
#

@shy wolf I legit did code for you , just change out what you need

wraith rapids
#

lmao

shy wolf
tardy delta
#

how can i select the block, the player right clicks on and make sure it does not move the 'inventory' of that block?
something like java Block b = event. ...

wraith rapids
#

wdym move the inventory of that block

drowsy helm
#

wdym inventory of the block

tardy delta
#

well i mean that it doesnt opens what is stored inside

dusty herald
#

what

tardy delta
#

:/

drowsy helm
#

what are you trying to achieve

wraith rapids
#

cancel the interact event or something

drowsy helm
#

do you mean say if it were a chest it wont open?

tardy delta
#
@EventHandler
    public void onContainerSelect(PlayerInteractEvent event) {
        Block block = event.getClickedBlock();
        if(event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getState() instanceof InventoryHolder && block.getState() instanceof Lockable) {
//HERE

        }

If it put event.setCancelled(true); inside the body of the if, will that block the chest from opening or just everything?

shy wolf
tardy delta
#

:/

quaint mantle
#

How can i do crafting with custom material predicates?

wraith rapids
#

custom material predicates?

#

elaborate

tardy delta
#

can i even use an eventhandler inside my CommandExecutor?

eternal oxide
# shy wolf

Damn I thought it was a little early for flies.

wraith rapids
#

the flies seem to disagree

tardy delta
#

i want to use an event inside the code for a command is that possible?

wraith rapids
#

not really

#

an event will not be fired at the same time as a command is used

#

do you can't process them both at once

#

you can store data from an event and then access that data in a command handler

#

or vice versa

#

but you can't have both the command and the event being processed at once

tardy delta
#

if the person does /lock is says something like "right click on a block to lock it" and then an eventhandler looks if you click on it and then lock it

#

something like that :/

wraith rapids
#

yes then you would have to store information that the player has executed the command and then have the event handler look at that information and act based on it

tardy delta
#

:/

subtle kite
#

Player p = (Player) sender;
p.sendMessage(Color("your message here"));
return false;

tardy delta
#

?? i know how to do that

#

XD

eternal oxide
#

No need to cast to player. The sender has the sendMessage method.

tardy delta
#

hmm i'm really stuck at this

wraith rapids
#

put the player in a set or something when they execute the command

#

and then check if the set contains that player when they click a block

eternal oxide
#

players UUID

wraith rapids
#

then lock the block and remove them from the set

#

real men use weak hashsets so they can put the Player in directly :fingerguns:

eternal oxide
#

Real men never use anything weak.

wraith rapids
#

weakness is subjective

#

a weak thing becomes a strong thing by mere virtue of being used by a real man

tardy delta
#

like this?
public static List<UUID> playersWhoExecuteThisCommandIdk = new ArrayList<>();

wraith rapids
#

make it not public

#

make it not static

#

make it not a list

tardy delta
#

but its in my main class?

#

private??

wraith rapids
#

yes

#

private final Set<UUID>

tardy delta
#

oh never worked with before

wraith rapids
#

then expose it with a method that tests whether the player is in a set

#

public boolean isPlayerLockingSomething(UUID uuid) { return set.contains(uuid)

#

and so on

urban trout
#

hello i have this https://paste.md-5.net/obupotehuz.java

it makes small barricade
but it doesnt always face the right way, i think its something to do with the pitch or yaw or something but i dont know how to fix it
i also want to make the blocks slowly break within 5 seconds but i dont know how :/

tardy delta
#

ooooh

#

and in the body of the command i add people to the set?

wraith rapids
#

yes

#

and when they click a block, you remove them from the set

#

and if they were in the set, you do whatever you do to lock the whatever block they're clicking

tardy delta
#

wait is this an ArrayList?

wraith rapids
#

no, a set is not an arraylist

#

Set

tardy delta
#

set is abstract

wraith rapids
#

yes

#

just like List is

#

you need to choose an implementation of Set to instantiate

#

for List you used ArrayList

#

for Set use HashSet

upper mica
#

new HashSet<>()

tardy delta
#

oh

wraith rapids
#

or any other set implementation you choose

tardy delta
#

wew

#

but i declared it private and its inside my main class so how do i access it?

wraith rapids
#

with the method

tardy delta
#

uhh

wraith rapids
#

you need to

  1. be able to add players to it -> create a public method that adds a player to it
#
  1. test if a player is in it -> create a public method that tests if a player is in it
#
  1. remove a player from it -> create a public method that removes a player from it
tardy delta
#

and those methods has to be in my main class wathever

wraith rapids
#

or wherever else, doesn't really matter where they are

#

as long as they are in the same class as the Set

tardy delta
#

main class so ._.

wraith rapids
#

not really the ideal place to hold state but whatever

#

you can move it later

tardy delta
#

well i'll make a new class

#

something like this

shy wolf
tardy delta
#

idk how to get the sender its not inside the onCommand

wraith rapids
#

the method should accept the player as a parameter

#

the method isn't concerned with where the player comes from or what the player is

#

the method's purpose is to mark a given player as wanting to lock a container

#

therefore it should take a Player as a parameter

#

and then do the thing

tardy delta
#

like this?

#

im sorry im stupid

wraith rapids
#

that is not how you declare a method with a parameter

#

public void addPlayer(Player player) {

tardy delta
#

and where do i get that player from??

wraith rapids
#

doesn't matter

tardy delta
#

its not inside the onCommand method

#

what

wraith rapids
#

that's the problem of the guy calling the method

#

for the moment just focus on the method

tardy delta
#

but it gives an error

wraith rapids
#

what is the error

tardy delta
#

that it cant find player

wraith rapids
#

what

#

declare a method

#

with a fucking player parameter

tardy delta
#

this is the whole class :/

package io.github.FourteenBrush.MagmaBuildNetwork;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

import org.bukkit.entity.Player;

public class PublicMethods {

    private final Set<UUID> playersWantingLock= new HashSet<>();

    public void addPlayerToWantingLock() {
        playersWantingLock.add(Player player);
    }
}

wraith rapids
#

that is not how you declare a fucking method

dusk flicker
#

🤦

wraith rapids
#

with a parameter

#

public void addPlayerToWantingLock(Player player) {
//your fucking code here

tardy delta
#

is saying I'm tired a good excuse?

wraith rapids
#

no

dusk flicker
#

no.

tardy delta
#

oh

#

😢

wraith rapids
#

you make me want to go bomb palestinian children

dusk flicker
#

The only excuse is you dont know basic java

#

holy shit NNY

eternal oxide
#

NNYa got his 10 minutes of cardio for today

dusk flicker
#

lmao

tardy delta
#

yes i know i was doing some random things idk

quaint mantle
tardy delta
wraith rapids
#

you need to use ExactChoice rather than MaterialChoice

#

materialchoice accepts any itemstack that is of a specific material

#

exactchoice only accepts identical itemstacks

#

which includes model data and lore and whatever

quaint mantle
#

but it won't work if item would have enchantments or display name

wraith rapids
#

i'm not sure if you can, but you could try implementing the RecipeChoice interface yourself and doing the checks yourself

#

there are some classes in bukkit that you shouldn't implement, and recipechoice is probably one of them

#

if that doesn't cut it, listen to the prepare craft event or whatever it's called and do it manually

urban trout
#

im trez confused

tardy delta
#

for some reason it cant resolve the method i just made

wraith rapids
#

i'm going to throw a wild guess that you're trying to invoke it statically

tardy delta
#

well this is the method
oh yes the set is somewhere above this


    public boolean testForUUIDInsideSet(Player player) {
        if(playersWantingLock.contains(player.getUniqueId())) {
            return true;
        }
        return false;
    }

and i want to use it here

@EventHandler
    public void onContainerSelect(PlayerInteractEvent event) {
        Block block = event.getClickedBlock();
        if(testForUUIDInsideSet()) {
            if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getState() instanceof InventoryHolder && block.getState() instanceof Lockable) {
                event.setCancelled(true);
            }
        }
    }
dusk flicker
#

you need to pass the player object into the testForUUIDInsideSet if statement

wraith rapids
#

the method takes a parameter

dusk flicker
#

testForUUIDInsideSet(event.getPlayer());

tardy delta
#

iknow

wraith rapids
#

you need to supply this parameter

tardy delta
#

but it cant even find the method

#

..

wraith rapids
#

then the method is declared on a different class

#

obtain an instance of that class and call the method on that instance

#

but of course that means literally nothing to you since you don't know what an instance is, do you

tardy delta
#

😂

#

sure i do

lofty junco
#

hello does anyone know how to translate messages ?

tardy delta
#

well it gives no eerors

#

errors

lofty junco
#

i found this TranslatableComponent but it doesent help me at all because it is used for bungee and not for spigot

lofty junco
tardy delta
#

oh yea

wraith rapids
#

it is used for spigot

#

spigot uses the bungee chat api

#

as for why the fuck it was designed that way, don't ask me

lofty junco
#

TranslatableComponent no it is not it is used for bungee

wraith rapids
#

it is also used for spigot

#

spigot includes the bungee chat api

#

spigot makes use of the bungee chat api

lofty junco
wraith rapids
#

are you reading what I am saying

#

the guide you linked has a fucking section on how to use these on spigot

#

Send message in Spigot:

#

player.spigot().sendMessage(component)

lofty junco
#

tf calm down my mistake

dusty herald
minor garnet
#
    private void loadGuns(final Player player) {
        File[] files = guns.listFiles();
        if (files.length == 0) {
            warn("§eNot found files.."); return;
        }
        Arrays.asList(files).stream()
        for (File file : files) {``` who is best ?
proper notch
#

?

wraith rapids
#

how about you don't do disk io on the main thread

turbid grove
#

@wraith rapids how expensive is it to run a Runnable task on an asnyc worker, then pipe back the result to the main thread?

ivory sleet
#

Also Arrays::stream is a thing

#

What is the runnable task doing?

wraith rapids
#

depends on your definition of expensive

#

it will introduce a delay that may be significant depending on context

#

since the task will have to wait till it gets executed by a thread, and then it has to wait up to 50ms until it gets synced back to main

turbid grove
#

i see

wraith rapids
#

the individual overhead of scheduling a single task is negligible but you don't want to be doing that for thousands of tasks as even the small overhead will add up

#

overloading the bukkit scheduler ends in tears

urban trout
#

int x4 = block.getX(); int y4 = block.getY() +1; int z4 = block.getZ() +1; Location loc4 = new Location(player.getWorld(), x4, y4, z4); loc4.setDirection(player.getLocation().getDirection()); loc4.getBlock().setType(Material.BEDROCK);

how do i set the direction? that doesnt do anything ^

wraith rapids
#

a good example of things not to do that with is to schedule 1000 tasks that each change the type of 1 block

ivory sleet
wraith rapids
#

getBlock doesn't care about direction

#

it just gets the block at the location

turbid grove
#

working on a territory plugin that notifies players whenever they enter a region
lets assume the server has 100 territory definition, each of them consist of a rectangle (tl and br coordinate)
what my problem is, it starts eating TPS when 100+ players are wandering around, even if movements are only checked at block ever/leave
this is why i want to move collision checks to async thread

wraith rapids
#

doable, but you should do them in bulk

turbid grove
#

wdym bulk?

wraith rapids
#

that is, add each player that moves more than 1 block to a set, and once all players have moved, process the new locations in bulk asynchronously, all at once

#

then notify them once the async computation is complete

turbid grove
#

oh i see

wraith rapids
#

instead of scheduling a new async runnable on each playermoveevent

#

that'll overload the scheduler

turbid grove
#

thx for help

#

helped a lot

wraith rapids
#

since you don't actually need to modify the event, you can do the work asynchronously

#

if you had to f.e cancel the event based on the result, you'd have to keep doing it sync

#

and doing it asynchronously would only deadlock the server

turbid grove
#

yes, unfortunately. but here its not the case

urban trout
ivory sleet
#

Bruh

urban trout
#

so if a player is facing north it makes it north, etc

wraith rapids
#

BlockFace

ivory sleet
#

what’s it?

wraith rapids
#

block.getrelative

ivory sleet
#

The block?

wraith rapids
#

he wants to build a small wall when a player places down bedrock

ivory sleet
#

Ah

urban trout
#

thank you

cold tartan
#

is there an event for when water drys up in the nether?

urban trout
turbid grove
#

@cold tartan i dont know if there's a specific event for this. I would use PlayerBucketEvent

#

water placed by player buckets should instantly disappear

eternal oxide
#

How do you mean "dried up"? Water can;t be placed in the nether, other than by an ice block

wraith rapids
#

pretty sure ice blocks don't work anymore either

turbid grove
#

i believe he means that a player right clicks with water bucket and places water on the ground

cold tartan
#

^^^

urban trout
cold tartan
#

i wanna make a dumb video where I jump from a high place in the nether and bucket clutch

eternal oxide
#

no water appears so thats impossible

cold tartan
#

not with plugins

young knoll
#

Listen to the bucket event and manually place water I guess

cold tartan
#

thats what im doing^

young knoll
#

Or the interact event

wraith rapids
#

note that the bucket events are sort of buggy

#

expect an aneurysm if you want to modify the item result

cold tartan
#

there we go

minor garnet
cold tartan
#

here it is

    @EventHandler
    public static void onBucketPlace(PlayerBucketEmptyEvent event) {
        if (event.getBlock().getType() == Material.AIR) {
            event.getBlock().setType(Material.WATER);
        }
    }
young knoll
#

Does the if statement pass

cold tartan
#

yep

wraith rapids
#

i think the nether might nuke water on physics updates or something

#

not sure how it works these days

young knoll
#

Don’t think so

minor garnet
#

i’m reading all the files in a folder, and then you’ll read the data inside them and save it to an array

wraith rapids
#

last i looked at it was over half a decade ago

minor garnet
#

GunLoad read = new GunLoad(player, YamlConfiguration.loadConfiguration(file));

young knoll
#

You could place it in the nether in a 1.17 snapshot and it worked fine

cold tartan
manic phoenix
#

Is there a way to block messages in certain areas?

young knoll
#

Yes

#

You could use the worldguard API to add a custom flag

manic phoenix
#

Yeah Ik but Idk how I have to code that

summer scroll
#

Is there any event that listen when Player receive or re-new potion effect?

wraith rapids
#

you'd check whether the player is in a region and if they are, block the message

quaint mantle
#

?paste

queen dragonBOT
tardy delta
#

how can i specify that the player has to give 0 arguments?

quaint mantle
#

==============
Hey spigot! I am kick with the message "Disconnected" when I right click on an npc made of packets.
Also, I'm kicked when I left click npc. "internal exception: io.netty.handler.codec.decoderException: Java.lang.NullPointerException" I don't know why. I watched this tutorial and copied it: https://www.youtube.com/watch?v=Ema8_qxQAXM I don't know what the problem was. My code is: https://paste.md-5.net/herokoyaxa.java

In this video, you will learn how to create a custom event for NPCs! Not using Citizens or ProtocalLib API. You will learn how those APIs do it! This video shows how to right-click an NPC and perform some sort of event. Whether it's opening a GUI or sending a message, you can do whatever you would like!

Patreon:
https://www.patreon.com/codedre...

▶ Play video
tardy delta
#

oke

ivory sleet
#

oke

urban trout
tardy delta
#

uhh does sender.sendMessage(""); work in the onCommand or do i need to cast it to a player?

#

Player p = (Player) sender ?

#

forget it

quaint mantle
tardy delta
#

oh

quaint mantle
#

or ```((Player) sender).sendMessage("");

tardy delta
#

like this

Player p = (Player) sender;
                p.sendMessage("Right click a chest/ barrel etc to lock it..");
quaint mantle
#

ya

tardy delta
#

okay

#

😛

young knoll
#

Sender already has sendMessage

tardy delta
#

grrrrr

cold tartan
cold tartan
quaint mantle
#

why are you sending video to this channel xD

cold tartan
#

cuz i was asking for help about it earlier

quaint mantle
#

ah

tardy delta
#

how can i send a message again in a eventHandler?

#

there is no sender there i assume

quaint mantle
quaint mantle
tardy delta
#

and where do i get the player from?

quaint mantle
#

what event are you using brtoo

#

most events has Player attributes

#

like event.getPlayer()

tardy delta
#

look when someone rightclicks on a block and is inside the list, the event will cancel and say the player "block locked"

#

ow yea i forgot

#

i have to sleep more

quaint mantle
#

event.getPlayer()

#

xd

wraith rapids
#

so you made it public and static after all

dusty herald
#

wait that's a fucking thing?

#

awesome

obtuse basin
#

Is there a way loading Hashmap properties from Yaml Configuration?

wraith rapids
#

so instead of actually learning how to use the language you reverted to your old nooby ways because that was too hard

#

very good

ivory sleet
#

🎈

eternal oxide
wheat dome
#
package de.tayfun.plugin.commands;

import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class ServerCommand implements CommandExecutor {


    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        ProxiedPlayer player = (ProxiedPlayer) sender;
        player.connect(ProxyServer.getInstance().getServerInfo("Skywars_desert"));
        return false;
    }

why doesnt work this code and how can i fix it?

wraith rapids
#

mmm

ivory sleet
tardy delta
#

normally my lock thing works, only the lock itself doesnt XD

summer scroll
obtuse basin
young knoll
tardy delta
#

so cool

summer scroll
young knoll
#

It would be the oldEffect

summer scroll
#

Ah, so OldEffect is the effect that ran out.

young knoll
#

The action would be removed

summer scroll
#

And new effect is the new effect being added.

#

Gotcha, thanks!

young knoll
#

And the cause would be expiration

tardy delta
#

is this true?
/test a b c
args0 = a

#

and args.length == 3

native ibex
#

Yes

ivory sleet
#

That’s the essence of truth

tardy delta
#

does args[0].equals("") makes sense?

ivory sleet
#

isEmpty

tardy delta
#

yea but imagine i put something between the ""

#

args[0].equals("idk")

ivory sleet
#

Usually when the string is constant we do it the other way around

#

So
"idh ".equals(other)

tardy delta
#

oh doesnt matter

ivory sleet
#

It does

#

It prevents NPE

wraith rapids
#

not in this case but usually yes

tardy delta
#

and whats that?

wraith rapids
#

args[0] could theoretically be null

ivory sleet
#

NNY can explain

wraith rapids
#

i'm going to explain my boot up your ass

tardy delta
#

nice

turbid grove
#

how can it be null?

wraith rapids
#

it can't in this case

#

which is why it doesn't matter in this case

#

but usually yes

#

unless it's a primitive array, any of its elements may be null

ivory sleet
#

It can be if some stupid guy decides to call onCommand on ur command executor instance

wraith rapids
#

bukkit just has a contract where it says that the elements of the String array should not be null

#

they could still be null, but that would be a breach of bukkit's contract, so it blowing up wouldn't be your fault

turbid grove
#

great

tardy delta
#

I have this now

else if(args.length == 1 && args[0].equalsIgnoreCase("cancel")) {
                Player p = (Player) sender;
                MagmaBuildNetwork.playersWantingLock.remove(p.getUniqueId());
            }
wraith rapids
#

make it not public

#

make it not static

#

you should not expose internal state directly

#

create accessor methods that expose specific functions on that state

#

like I told you earlier

#

and like you had in place

#

but then deleted everything because you didn't know what an instance is

tardy delta
#

are you talking to me?

wraith rapids
#

yes

tardy delta
#

oh

wraith rapids
#

no

tardy delta
#

i fixed it all now

wraith rapids
#

that's not a fix

#

that's degeneracy

#

that isn't proper

tardy delta
#

🥺

turbid grove
#

there is bo need of forcing oop concepts on beginners imo

tardy delta
#

well i'm teached in oop ._.

wraith rapids
#

learning something right the first time around is infinitely better than learning something wrong and then having to unlearn it

turbid grove
#

being teached doesnt imply knowing

tardy delta
#

yea i learned it right i was just reading it wrong

turbid grove
#

im 2nd year software engineer student

#

most people in my class cant even write double forloop

wraith rapids
#

nothing sticks as hard as a bad habit

tardy delta
wraith rapids
#

demoman

tardy delta
#

or which year or idk how to ask xd

turbid grove
#

wdym which?

#

2nd

tardy delta
#

at high school or what?

turbid grove
#

no :D

#

undergrad

tardy delta
#

Idk we dont have these things here 🙄

turbid grove
#

it means im done with 12 years of regular school

tardy delta
#

oh

#

now i'm thinking you're 12 😂

turbid grove
#

and after that i jouned a university course o 3 years

tardy delta
#

😮

turbid grove
#

xd

#

and now im at the end of the 2nd year

#

of the 3 years

sinful kelp
#
OfflinePlayer op = Bukkit.getOfflinePlayer(args[0]);
            
            if(!UserHandler.getInstance().playerExists(op)) {
                
                msgHandler.sendError(sender, ERRORS.PLAYER_NOT_FOUND);
                return true;
                
            }```

/bal huiwfewohifwef = Player not found
/bal JordieYT = NPE pointing at the Bukkit.getOfflinePlayer
tardy delta
#

how do people not know how to write a double for loop in your class :/

turbid grove
#

idk

tardy delta
#

i even know

turbid grove
#

being teached doesnt imply anything directly

tardy delta
#

xd

#

yea my school thinks nah we wont teach them that so i learn the most things by myself..

wraith rapids
#

how do you not know how to declare a method with a parameter

wraith rapids
#

no this guy

tardy delta
#

I was just interpreting wrongly what you said 🙄

#

my english is not so beast you know

sinful kelp
#

got any ideas for my problem?

wraith rapids
#

uh

#

paste the stack trace

sinful kelp
#

okay

turbid grove
#

i belive getofflineplayer returns null if player with that name havent joined the server yet

wraith rapids
#

getofflineplayer should always return a player

#

even if the player doesn't exist

eternal oxide
#

getOfflienPlayer alwasy returns a player.

turbid grove
#

should it

wraith rapids
#

yeah, it's weird like that

eternal oxide
#

the offline players name will be null if they are unknown

wraith rapids
#

i'm guessing the npe is on either msgHandler.sendError or getInstance().playerExists

sinful kelp
tardy delta
#

lmao my father walks in and says stop hacking

sinful kelp
#

oh wait i think im stupid

#

im assuming user.getUUID is returning null

#

ignore me for a sec

dusty herald
sinful kelp
wraith rapids
#

too much blue

tardy delta
#

XD

wraith rapids
#

let me find mine

dusty herald
#

this is my theme atm ill put a spoiler bc light theme

tardy delta
#

well the other was too dark xd

#

so i decided to put a higher contrast 😂

turbid grove
sinful kelp
coral sparrow
#

Hello , This code doesnt work as intended... Any help?

    public void onInteract(PlayerInteractEvent event) {
        Action action = event.getAction();
        Player player = event.getPlayer();
        Block block = event.getClickedBlock();
        
        if(action.equals(Action.RIGHT_CLICK_BLOCK)){
            if(block.getType().equals(Material.STONE)){
                player.sendMessage(ChatColor.GREEN + "Ok works");
}         else{
                player.sendMessage(ChatColor.GOLD + "Doesnt work :/ ");}
        }```
tardy delta
wraith rapids
#

how does it differ from what you intended

turbid grove
#

put it in triple altgr please

coral sparrow
turbid grove
#

like this

wraith rapids
#

use == to compare enum constants

dusty herald
#

no spoiler for yall

sinful kelp
#

AHHHHH

coral sparrow
sinful kelp
#

WHERES THE SPOILER

wraith rapids
#

block might also be null

tardy delta
#

lets look for a different theme 🙄

coral sparrow
wraith rapids
#

it does, but you should use ==

dusty herald
#

I normally use this theme but I decided to give a light theme a shot for a bit

sinful kelp
#

Your current work will be fine, but if you start handling block in the else statement, you'll encounter problems

coral sparrow
solar citrus
#

What's the code for registering your event?

sinful kelp
#

Input:

System.out.println(player.toString());
System.out.println(player.getUniqueId().toString());```
Output:
```CraftPlayer{name=JordieYT}
[23:33:38 INFO]: 26dbd890-c96d-46bf-aaf2-e1d180733ed2```

So why does if (player.getUniqueId().equals(user.getUUID())) {
Give a NPE?
#

user.getUUID() isnt null either

wraith rapids
#

put each deference on a new line and you'll see

#

(player
.getUniqueId()
.equals(user
.getUUID())) {

#

or enable verbose npe messages on your server that i'm sure is running java 16

sinful kelp
#

it's pointing at .getUniqueId()

#

am i retarded why is it doing that

solar citrus
wraith rapids
#

player is null then

#

or, well

#

the uuid returned could be null but i don't know if that's possible

sinful kelp
#

but player.toString is fine

wraith rapids
#

send actual code and the actual stack trace

sinful kelp
#

ok one sec lemme try one more thing

coral sparrow
solar citrus
#

Awesome 👍

coral sparrow
#

thanks

solemn shoal
#

how can i launch a process in java, interactively, from a string?

wheat dome
#

does somebody know how I can code a plugin where somebody will connect to an other server?

solemn shoal
#

ProcessBuilder p = new ProcessBuilder(args); takes either a string (no arguments) or an array of strings

wraith rapids
#

place down a sign at your server spawn telling the player to connect to another server

subtle kite
#

doesn't multiverse portals do the cross ip thing?

dusty herald
#

no?

sinful kelp
#

Thats BungeeCord

subtle kite
#

BungeePortal

#

yeah

#

idk I haven't done hub stuff in ages

tardy delta
#

is multiverse core or something good?

sinful kelp
solemn shoal
#
[16:20:55]: Command being ran: cmd /c echo hi
[16:20:55]: Launching (List<String>)...
hi
[16:20:55]: Launching (String)...
java.io.IOException: Cannot run program "cmd /c echo hi": CreateProcess error=2, The system cannot find the file specified```
#

any ideas?

#

i somehow need to split the String into a List<String> but i cant split strings passed as arguments

#

say i were to run cmd /c echo "This is a multi-word argument encapsulated in a string."

eternal oxide
#

Keep going, eventually you'll give us enough to work with

solemn shoal
#

who?

sinful kelp
#

you

solemn shoal
#

oh

sinful kelp
#

my problem is just weird i doubt anyones gonna be able to help

#

i dont get it

solemn shoal
#

well i have this code:

#
public static void StartProcess(List<String> command){
    final ProcessBuilder p = new ProcessBuilder(command);
    p.inheritIO();
    try {
        p.start().waitFor();
    } catch (InterruptedException | IOException e) {
        e.printStackTrace();
    }
}
public static void StartProcess(String command){
    final ProcessBuilder p = new ProcessBuilder(command);
    p.inheritIO();
    try {
        p.start().waitFor();
    } catch (InterruptedException | IOException e) {
        e.printStackTrace();
    }
}```
#

and im calling it like this:

#
String[] cmd = new String[]{"cmd", "/c", "echo", "hi"};
String command = String.join(" ", cmd);
Console.WriteLine("Command being ran: " + command);
Console.WriteLine("Launching (List<String>)...");
Util.StartProcess(Arrays.asList(cmd));
Console.WriteLine("Launching (String)...");
Util.StartProcess(command);```
#

keep in mind this is a demo of the issue i'm having

#

what i want to be able to do is use Util.StartProcess(command) with arguments

sinful kelp
#

omg im legit so dumb

#

im setting op to args[0] getplayer

solemn shoal
#

dunno what else i can say @eternal oxide

sinful kelp
#

not p

eternal oxide
#

Sorry, internet died

#

why are you not just concatenating your args?

paper viper
#

what operating system is this?

#

is this windows?

hollow canopy
#

@wraith rapids

tardy delta
#

what do they mean its working with a key?

hollow canopy
#

@eternal oxide

solemn shoal
paper viper
#

in some cases, you have to specify to the actual file itself

#

like the exe file

solemn shoal
#

@paper viper every argument needs to be separated

paper viper
#

what

solemn shoal
#

yes

paper viper
#

yes ik they are separated

#

how does that have to do with the actual file

#

like im refeerring to a direct path

#

to the actual cmd.exe file

#

in place of the cmd subcommand

solemn shoal
#

oh, nope

#

if you were to launch {"cmd", "/c echo hi"} it'd pass "/c echo hi" as args[0] which cmd will complain about

paper viper
#

well, just separate the arguments

#

anyways

coral sparrow
#

Does anyone know how to make ur plugin support other placeholders?

dusty herald
#

PAPI

paper viper
#

you have to look at the papi api

solemn shoal
#

how would i separate the arguments

#

i cant just split by spaces

coral sparrow
#

ok

hollow canopy
#

Guys I write a Shulker Backpack code but when I left click the shulker in inventory a error occurs in the console.This is the code https://paste.md-5.net/ikawigomon.java I guess there is a check and cast error at the line 20/21.I tried to fix it but I couldn't.How can I fix it?

solemn shoal
#

nano "C:\Some Filename.txt" would get split into {"nano", "\"C:\\Some", "Filename.txt\""}

paper viper
#

no, you have to add the extra backslash from the space

#

iirc

#

and also, you should never even use split

solemn shoal
#

you cant escape out spaces under windows

split panther
#

wait whaa?

paper viper
#

C:\"Test Folder"\File.txt

#

you can

#

well actualy

#

hm

#

nvm the space is still there

#

but why are you using split tho?

solemn shoal
#

because i dont know any better way to split arguments?

paper viper
#

wait so are you trying to get a full command

#

then executing it?

solemn shoal
#

kinda?

#

basically i have a function to launch a process, that takes a string as input

#

public static void LaunchProcess(String command) { /*code*/ }

paper viper
#

So Im thinking of this

#

hm it's just the string which makes everything harder

solemn shoal
#

hm i wonder

#

what if i used the system's command interpreter

paper viper
#

if you passed only a string[] it would be easier

#

but you can't right

solemn shoal
#

(cmd /c <command> on windows or bash -c <command> on linux/mac)

paper viper
#

actually

#

Process has an execute

#

that accepts a Stirng

#

let me check

solemn shoal
#

well

#

i need to run it interactive

#

so i was using ProcessBuilder

paper viper
#

You could use Runtime.exec(String cmd)

#

it returns a Process

#

then you can run that using start

solemn shoal
#

yep, but Process doesn't have inheritIO()

paper viper
#

it doesn't, but you can read the output

solemn shoal
#

well, the inheritIO() is a big part in this

paper viper
#

are you just logging the output?

#

cause you can do that with Process

solemn shoal
#

some processes i run need to be interactive

#

input and output

tardy delta
#

but what do they mean with key?

solemn shoal
#

named item

tardy delta
#

bruh

solemn shoal
#

yeah vanilla lets you do that

tardy delta
#

i'm making a plugin that does not use named items

#

to lock something

#

and then i see this...

solemn shoal
#

listen for PlayerInteractEvent and cancel it

tardy delta
#

wait

solemn shoal
#

well, you CAN use setLock but once someone figures out the key you set...

solemn shoal
#

for example it runs a minecraft server

tardy delta
#

look if I do the command /protect, the player will be added at a hashset and the eventHandler below will check if you're in that and then lock the item you right click on (if its lockable)

 @EventHandler
    public void onContainerClick(PlayerInteractEvent event) {
        Block block = event.getClickedBlock();
        if(MagmaBuildNetwork.playersWantingLock.contains(event.getPlayer().getUniqueId())) {
            if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getState() instanceof InventoryHolder && block.getState() instanceof Lockable) {
                event.setCancelled(true);
                ( (Lockable) block ).setLock("lock");
                event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&2Locked!"));
                MagmaBuildNetwork.playersWantingLock.remove(event.getPlayer().getUniqueId());
            }
            else {
                event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&2This block can't be locked!"));
                MagmaBuildNetwork.playersWantingLock.remove(event.getPlayer().getUniqueId());
            }
        }
    }
solemn shoal
#

easy to bypass

tardy delta
#

🙄

solemn shoal
#

just rename an item to "lock" in anvil

tardy delta
#

no

#

i dont use keys

#

(items)

solemn shoal
#

youre using setLock

paper viper
tardy delta
#

yea thats what i realized now but i want to lock something based on the user their uuid

solemn shoal
paper viper
#

no, not that

#

like physically actually

#

putting input to it

solemn shoal
#

oh, like internally?

paper viper
#

Yes

solemn shoal
#

no idea

paper viper
#

well..

tardy delta
#

i dont know which method i could use to avoid keys

paper viper
#

Cause Im looking at the docs for it

#

and i dont see anything that allows it to execute another command

#

or smthing

solemn shoal
#

@tardy delta implement it yourself

#

use PlayerInteractEvent, if its locked, cancel the event

tardy delta
#

...

#

i even havent the lock

#

setLock requires a key i know atm but i want to avoid that

quaint mantle
#

you dont need a lock if you're canceling the event for every other uuid

tardy delta
#

wdym?

solemn shoal
paper viper
#

Ah, I see what you are talking about now

#

some comamdns have something like "press enter to continue"

#

and require that interaction

#

I see

solemn shoal
#

and minecraft servers for example require console input

#

well not require but its useful to have

tardy delta
#

but how would i link a chest to someones uuid than?

quaint mantle
# tardy delta wdym?

just make it so that when the chest is "locked" and bound to a uuid, cancel the event when any other player tries to click on the chest

tardy delta
#

yea

quaint mantle
#

you dont need setLock for that

quaint mantle
#

hashmap

tardy delta
#

tell me more

solemn shoal
#

if you use setLock() players are required to have the named item

tardy delta
#

already using a hasmap

#

uhu

paper viper
#

wait i got it

#

You can use Process for this, let me show you

solemn shoal
#

ah?

solemn shoal
#

manually processing input i guess?

paper viper
#
final Process p = Runtime.exec("cmd"); // or whatever full command to use
final BufferedReader output = new BufferedReader(new InputStreamReader(p.getInputStream()));
final BufferedWriter input = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));

input.write("AGREE"); // writes agree into the actual console input
input.flush();
#

then you need to have a blocking thread

#

of some sort if you want to wait

#

for the interaction

#

and make sure that the input/output is syncronized too

#

just in case

tardy delta
#

oh i'm using a hashset for the uuids

#

can i use items in a hashmap that are linked together and then use them together or something?

solemn shoal
#

and what is pr?

#
final Process p = Runtime.getRuntime().exec("cmd"); // or whatever full command to use
final BufferedReader output = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter input = new BufferedWriter(new OutputStreamWriter(System.out));```
#

i guess this would work?

tardy delta
#

the location or something?

paper viper
#

and that would work

#

and also wdym by pr

#

oh

#

i meant p

quaint mantle
paper viper
#

sorry

solemn shoal
#

ah

tardy delta
#

something else that is easier?

#

XD

paper viper
#

you need to listen to the input of the system.in

#

and then send it into the input of the process

eternal oxide
#

store the players UUID in the chests PDC, then test for it on interact

solemn shoal
#

oh

paper viper
#

that only creates a reader for the input of the java app, but doesnt correctly send it to the actual process itself

tardy delta
#

and whats the pdc?

#

wait

paper viper
#

persistent data container

tardy delta
#

uhh

#

i'm looking for it

#

hmm not really finding it

solemn shoal
solemn shoal
#

this should work right? @paper viper

#

because it doesnt seem to

paper viper
#

one sec

#

no

solemn shoal
#

oh wait because im not calling the funcion

paper viper
#

not just that

#

regardless

solemn shoal
#

hm

paper viper
#

you need to have multiple threads prolly

#

one will use a while loop to continuously read the System.in

#

then when it finds a line which is entered in

solemn shoal
#

well getting output works..

paper viper
#

execute the method write the input

solemn shoal
paper viper
#

for the process

paper viper
#

I'm going to draw a diagram

#

actually im going to write some code

#

one second

tardy delta
#

something like this to lock a container?
container.set(key, new UUIDDataType(), uuid);

solemn shoal
#

yeah its pretty slow lol

#

inheritIO doesnt break colors either

#

ill see if it works with cmd /c + command

quaint mantle
tardy delta
#

well this is all new for me

solemn shoal
#

managed to get it workign @paper viper

#

apparently the solution was right in front of us

tardy delta
#

but would this work?

container.set(key, new UUIDDataType(), uuid);
paper viper
#

final Process p = ...;
final BufferedWriter input = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
final BufferedReader output = new BufferedReader(new InputStreamReader(p.getInputStream()));

protected void readProgramInput() {
  // code for reading input from java app (separate thread)
  final Scanner scanner = new Scanner(System.in);
  while (p.isAlive()) {
    while (!scanner.hasNextLine()) {} // block thread and wait for input
    final String line = scanner.nextLine();
    sendProcessInput(line);
  }
}

protected synchronized sendProcessInput(final String line) {
  input.write(line);
}

protected void readProcessOutput() {
   // code for reading output from process (separate thread)
   while (p.isAlive()) {
      final String line = output.readLine();
      while (line == null) {
        line = output.readLine();
      }
      ssendJavaOutput(line);
   }
}


protected synchronized sendJavaOutput(final String line) {
  System.out.println(line);
}
#

breh

tardy delta
#

and container is the block i select

solemn shoal
#
public static void StartProcess2(String command){
    final ProcessBuilder p = new ProcessBuilder(Arrays.asList("cmd", "/c", command));
    p.inheritIO();
    try {
        Console.WriteLine(String.format("Launching command: %s", command));
        p.start().waitFor();
    } catch (InterruptedException | IOException e) {
        e.printStackTrace();
    }
}```
quaint mantle
#

If I wanted to give a player a particle trail, that they could toggle on/off, would it be better to hashmap or arraylist it?

solemn shoal
#

this SEEMS to work

paper viper
#

what

paper viper
#

i thought your command had the

#

sigh

#

whatever

solemn shoal
#

cmd doesnt care

#

afaik

quaint mantle
#

well, assuming container is the pdc instance

solemn shoal
#

i mean i can try adding args with spaces

paper viper
#

so your command could be something like echo hi?

solemn shoal
#

yep

paper viper
#

and you are

#

creating a new command process for each command?

solemn shoal
#

yes

#

i am

paper viper
#

yea idk if that is efficent

#

but it works

tardy delta
# quaint mantle yes

how do i get the container? like this?
Block container = event.getClickedBlock();

#

owh

#

pdc instance

solemn shoal
#

cmd in itself doesnt take that much resources

tardy delta
#

how do i get that one xd

quaint mantle
#

you would first need to check if the block is a chest or other container

tardy delta
#

yea i have that

quaint mantle
#

then container.getPersistentDataContainer().set(...)

solemn shoal
#

tfw java still includes WindowsVersion types for win9x

paper viper
#

wat

solemn shoal
#

yeah java still includes OSInfo.WINDOWS_95

ivory sleet
#

🥲

solemn shoal
opal juniper
#

This is probs gonna be stupid, but can i give a falling block more friction?