#help-development

1 messages · Page 417 of 1

hybrid spoke
#

or remove it with worldedit

lost matrix
#

setType(Material.AIR) PES_Hehehe

young knoll
#

If you want them to be broken in a certain time like normal blocks, that’s a bit more advanced

quaint mantle
#

You can do Block#getBreakingSpeed and add the total progress and check if it's over one

hybrid spoke
#

change the texture to wood to make it breakable

quaint mantle
#

But I think that always returns 0 when the block is unbreakable

#

God

ancient plank
#

Send a fake block and when they break the fake block break the bedrock brain

echo basalt
young knoll
#

Just don’t have bedrock in the world

#

Problem solved

ancient plank
#

True

hybrid spoke
#

dont have blocks in the world

quaint mantle
torn shuttle
#

lmao seriously

delicate lynx
#

don't run a server

young knoll
#

Don’t have world

hybrid spoke
#

or break every block a player looks at

torn shuttle
#

left rotation and right rotation? the hell

quaint mantle
#

I think I came here in a bad time

lost matrix
ancient plank
quaint mantle
#

wasn't able to find any xd

torn shuttle
lost matrix
young knoll
#

Ask Mojang

tardy delta
#

i wanted to do rendering in c++ but when i saw this, nah man

lost matrix
#

Have fun. Took me a while to figure out

haughty storm
#

What do i have to put as the second argument for the World#spawnFallingBlock(Location, Blockdata) for it to spawn a Magma Block?

delicate lynx
#

BlockData

young knoll
#

Material.MAGMA_BLOCK.createBlockData

hybrid spoke
haughty storm
torn shuttle
lost matrix
native gale
#

How do I get the second part of the bed when BlockMultiPlaceEvent is fired?

#

Ok, you can obtain it via getReplacedBlockStates

torn shuttle
#

this seems like a lot of effort for something that seems hard to justify

young knoll
#

But smooth on client

hushed pawn
#

i know in hypixel duels there is few arenas in one server. whats a good way to create same structure and manage such arenas (specially load/unload worlds)?

bitter steeple
#

NBTTagCompound not existing anymore?

lost matrix
torn shuttle
# young knoll But smooth on client

that's another thing too, if I have a transform and change the transform halfway into it to reflect a new state and do that a bunch of times but clients are running slow, how do they catch up?

sacred wyvern
#

With the Spigot Config Is it better to using a String index for a lists or should I use an ArrayList and parse?

wet breach
young knoll
#

Yeah they run a few of several games on one server

wet breach
#

but how can you be certain of that o.O

sacred wyvern
#

I'm trying to make the autocomplete dynamic and simple to generate but the ArrayList was requiring a lot of parsing. I tried looking around on forums and got both being recommended.

torn shuttle
wet breach
#

not that I am aware of, if it has nothing that wasn't like important

#

but I have a general idea in how hypixel does their stuff

young knoll
#

In the past there have been bugs to leak chat and game messages between games on the same server

#

You can also get watchdog removal messages when it’s no one in your specific game

wet breach
#

chat isn't an indicator that you are on the same server

young knoll
#

Well sure

#

But it’s way more likely they let chat slip from another game on the same server than another sever entirely

wet breach
#

doubt it

young knoll
#

Plus some of their games are very small, it would be a waste to use 1 server per game

wet breach
#

it would be far more optimal to leverage the single threaded nature of mc then it would be to stuff a single server with several games

torn shuttle
#

assuming that a minigame is going to max your thread out is a fun assumption

wet breach
#

you are also assuming the OS wouldn't use the freed up space either

torn shuttle
hushed pawn
#

as far as i know

#

hosting 500 servers each for every duel game would be not that cheap

young knoll
#

Yeah duels is a good one to have multiple on 1 server

#

Since they are tiny games

lost matrix
hushed pawn
#

ah

#

i mean

lost matrix
#

Then create an Arena class with a BoundingBox and a Set<UUID> for participants
And an ArenaManager which manages those arenas. Maybe in a Map<String, Arena> where the key is the name of the Arena.

hushed pawn
#

one world with arenas? but none of big servers done it by this way

lost matrix
hushed pawn
#

cords on hypixel are the same on every map

#

same thing in mineman

lost matrix
#

Not an argument. Also: You are not Hypixel.
If you want to "do it like Hypixel" then start writing your own server
software. Dont use Spigot. Fork it and create a dedicated jar just for
minigame instances.

hushed pawn
#

why not?

#

an argument

lost matrix
#

Because in theory you can have multiple players have the same coordinates on the same world
but perceive completely different game states. *Assuming you have a highly modified jar like Hypixel.

wet breach
quaint mantle
#

is there any plugin which automatically rekit a player when a player kills another player?
if anyone have it please give me ill apricate it

hushed pawn
#

btw there is no good ways to manage worlds in this way?

lost matrix
#

But again: You dont need to scale that way. They are using a fk ton of technology
for load balancing. They dynamically start servers, load worlds etc depending on
how many players are trying to play something.

wet breach
#

you are under the assumption that every server would need to have 10gb of ram or something, when this is not the case, the amount of ram you would need to allocate if it was just per server for a small minigame tends to be lower then if you tried to stuff a single server with many games

quaint mantle
#

I am not asking about what's the behavior, but the expected behavior instead. Like, should we expect the API to hide the eating sounds as well or is this feature not intended?

wet breach
#

and 7smile7 is correct in what hypixel does, as well as they have their own fork for servers

lost matrix
young knoll
#

I wonder how that instanced dungeon plugin handles it

wet breach
#

the main problem with having multiple worlds for games, is the fact you can't fully unload them without modifying the server code to cleanly do it

quaint mantle
# hushed pawn btw there is no good ways to manage worlds in this way?

This is my assumption of how Hypixel bedwars work. So each server runs multiple worlds which are exact duplicates of a file and then splits players between worlds. So each arena has a world dedicated to it. Whenever the arena is done, I think it marks the world as dirty (which means that changes have been made, like it's no longer clean). At some point, it will no longer be viable so it marks the server instance to removal and will no longer accept new players for arenas and will just request a new server instance to the cloud provider.

It's simple even when it doesn't. So Hypixel still makes use of multiple worlds per server. This has been demonstrated in their Skyblock gamemode. Don't lie yourself!

#

hello.

#

how do i make an async function sleep?

#

um

smoky oak
#

on async you can just call sleep

quaint mantle
#

is it just Thread.sleep();?

wet breach
#

no

tardy delta
#

schedule a task in a task

smoky oak
#

why cant u make an async task sleep

#

i mean isnt it async

quaint mantle
#

what?

wet breach
young knoll
#

It uses a thread pool

wet breach
#

there could be other tasks on the same thread

ivory sleet
quaint mantle
#

players might be able to break stuff while stuff gets processed (there is disk io going on) if they spam stuff, so i need to put the thread to sleep until stuff gets processed.

smoky oak
tardy delta
#

while (true) Thread.yield() :)

ivory sleet
#

it just sleeps the thread lol

lost matrix
torn shuttle
#

was mojang smoking some kind of crack when they came up with the way these display entities rotate?

ivory sleet
#

if the thread is in a pool too bad

quaint mantle
#
private HashSet<Player> playersBeingProcessed = new HashSet<Player>();
while (playersBeingProcessed.contains(player)) {
                    Thread.sleep(50);
                }```
young knoll
#

I mean it would only be a problem if you sleep every thread in the pool, no?

quaint mantle
#

this is how i am trying to do it.

quaint mantle
wet breach
ivory sleet
#

smile tell em

quaint mantle
#

i need to stop the player from spamming stuff.

young knoll
#

Do tasks get assigned to a thread for their entire lifetime

hazy parrot
ivory sleet
#

maybe use a cyclicbarrier or semaphore

quaint mantle
#

a what?

lost matrix
# quaint mantle why not?

You are burning valuable processing power. This is just a glorified room heater in code form.
Use a CountdownLatch or Mutex to notify when the processing is done.

young knoll
#

Or does a thread just get picked from the pool whenever a tasks executed

wet breach
#

a worker thread can process multiple tasks

torn shuttle
quaint mantle
#

why does it matter? stuff just runs asynchronously, right?

#

when the thread sleeps, the cpu processes other stuff though, right?

torn shuttle
#

oh is it because it doesn't strictly have to be its actual starting point? I think I see what's going on

#

ok

quaint mantle
#

does not that mean it is blocking or something like that?

wet breach
#

what do you mean why?

quaint mantle
#

nvm.

torn shuttle
#

alright now I get why this is like this

quaint mantle
torn shuttle
wet breach
#

threads are not created for every task that gets scheduled this isn't feasible. Hence there being a thread pool

torn shuttle
#

smooth animation is cool but I don't know what will happen when things start getting desynced

quaint mantle
#

If someone's doing a wrapper for doing easy transformation and such without needing to do complex math ops I will star their project 🦾

#
private HashSet<Player> playersBeingProcessed = new HashSet<Player>();
if (playersBeingProcessed.contains(player)) {
    return;
}```
#

is this okay?

tardy delta
#

what are you even doing

torn shuttle
quaint mantle
#
            Bukkit.getScheduler().runTaskAsynchronously(ChunkClaimsPlugin.getThisPlugin(), () -> {
                Player player = (Player) event.getWhoClicked();

                if (playersBeingProcessed.contains(player)) {
                    return;
                }

                playersBeingProcessed.add(player);

                // some code runs here probably.

                playersBeingProcessed.remove(player);
            });```
#

is that okay?

wet breach
#

What would be better to do, would simply make your code just exit the code block if a condition hasn't been met for it to run

tardy delta
#

if (!remove)

#

wait you are checking contains, adding and removing there 😵‍💫

lost matrix
#
public class AsyncPlayerProcessor {

  public AsyncPlayerProcessor() {
    playerQueue = new ArrayDeque<>();
    notification = new CompletableFuture<>();
  }

  private Queue<Player> playerQueue = new ArrayDeque<>();
  private final CompletableFuture<Void> notification;

  // Is called from one thread
  public void processNext() {
    Player nextPlayer = playerQueue.poll();
    if(nextPlayer == null) {
      notification.complete(null);
    }
  }

  // Anyone can get this and wait for the process to finish
  public CompletableFuture<Void> getNotification() {
    return notification;
  }

}

Example one

quaint mantle
#

while stuff gets processed.

#

spamming the command might break stuff.

wet breach
#

you could just implement a command delay based off how long ago they used it

quaint mantle
#

is this not just that?

lost matrix
#
public class AsyncPlayerProcessor {

  public AsyncPlayerProcessor(Collection<Player> players) {
    playerQueue = new ArrayDeque<>(players);
    notification = new CountDownLatch(players.size());
  }

  private final Queue<Player> playerQueue;
  private final CountDownLatch notification;

  // Is called from one thread
  public void processNext() {
    Player nextPlayer = playerQueue.poll();
    if(nextPlayer != null) {
      notification.countDown();
    }
  }

  // Anyone can get this and wait for the process to finish
  public CountDownLatch getNotification() {
    return notification;
  }

}

With this you even have a counter on how many players are left for processing

ivory sleet
#

mapping timestamps :o

quaint mantle
#

plus, i cant just have an arbitrary delay, i need the task to finish first.

wet breach
#

you don't need to iterate anything if you are only dealing with timestamps

quaint mantle
#

there is disk io going on, i am fetching stuff from a database and it takes a while and between delays, if the thing is triggered again, it seems to be causing issues.

torn shuttle
wet breach
#

your DB is consuming disk IO? o.O

lost matrix
wet breach
#

what are you doing using sqlite?

quaint mantle
#

yep, sqlite.

lost matrix
#

Every DB uses Disk IO...

quaint mantle
#

oh yeah, right, most dbs use network io, if they are not on the same machine probably.

wet breach
#

use mysql or mariadb if you are having this much of an issue with IO

#

sqlite is not scalable

torn shuttle
wet breach
#

nor was it meant to be

lost matrix
#

sqlite for me is just a fallback DB for when someone doesnt have a proper DB installed

wet breach
quaint mantle
fresh timber
#

how do I give a player a permission?

quaint mantle
#

just have to change the jdbc url to do that perhaps?

wet breach
quaint mantle
wet breach
#

jdbc url would indeed need to be changed

quiet ice
wet breach
#

but sqlite is not designed to be used on a large scale or storing massive amounts of information

quaint mantle
#

i would probably just have compatibility for sqlite and mysql, that is probably it.

#

somebody told me sqlite can handle like 2 million transactions or something.

lost matrix
quaint mantle
#

its probably not meant for multiple connections.

lost matrix
#

But yeah there are in memory DBs

quiet ice
wet breach
quaint mantle
#

since you may not be able to use more than one application to access the file.

quiet ice
#

I just know that maven can use it for file locking for whatever reason

wet breach
#

the reason its not possible is because sqlite requires a file handle

wet breach
quaint mantle
wet breach
#

size on disk that is

quaint mantle
wet breach
#

no I mean actual file size

quaint mantle
#

probably not that bad.

quaint mantle
#

i mean it might have a few thousand rows.

wet breach
#

if you want to make IO on disk a non-issue mount the file into a ramdisk

#

same the ramdisk periodically to hard disk every so often

quaint mantle
#

i feel like this xy problem.

#

disk io is not my problem.

#

i need to prevent players from spamming sutff, which seems to be no longer a problem nvm.

wet breach
#

you are the one using a system not designed to be scaled in this way, all I am doing is providing you a bandaide solution that will work for the time being

quaint mantle
#

uh...?????

wet breach
#

ramdisk is in memory only, and having the file in memory at all times means fast access and virtually no IO on the hard drive except every so often to save it back to hard drive

#

since your sqlite file is most likely going to be small, odds are you only need at most like 100-200mb ramdisk

quaint mantle
#

i am probably going to providing mysql compatibility.

tender shard
young knoll
#

Or hook the vault api

quaint mantle
#

but i still dont have disk io problems, at least none i have discerned yet.

tender shard
lost matrix
wet breach
#

so...now IO is not an issue?

#

if IO is not an issue, I don't see a reason to pause stuff since that was the premise of the whole problem

young knoll
#

I mean if you use an attachment

#

You have to save it don’t you

tender shard
#

Yeah sure, i thought they wanted to do a permissions plugin or sth

quaint mantle
#

ok it seems to be working fine now for the most part.

#

java should probably consider some functional programming like some of the web development libraries like react.

ivory sleet
#

java has done it significantly lol

lost matrix
#

CompletableFuture

#

Functional interfaces

ivory sleet
#

CF, Stream, Optional, lambda

lost matrix
#

^

#

And if you like react that much then go and get Reactor.
Create your Monos and Fluxs

ancient plank
#

Java created Java

lost matrix
#

lies and deception

ivory sleet
#

like sure java os oop at core but it has functional aspects

lost matrix
bold gorge
#

How can i open guis like loom and stuff usually available in paper?

bold gorge
torn shuttle
ivory sleet
#

lol

quaint mantle
#

i sometimes i wonder why some of you seem so knowledgeable despite only really being in a discord server for minecraft coding.

lost matrix
torn shuttle
#

how's your college debt doing

lost matrix
#

wdym

#

0

#

I live in a developed country

quaint mantle
#

university debt?

#

if that is any different.

#

probably not.

young knoll
torn shuttle
#

it would be a sick burn if I didn't also live in such a country

quaint mantle
quaint mantle
#

does the country have a name?

lost matrix
lost matrix
quaint mantle
#

OH.

bold gorge
lost matrix
bold gorge
#

So I don't have best luck

#

1.12.2

torn shuttle
#

inb4 a version that doesn't have looms

quaint mantle
#

do you even pay for college in germany? is it free like healthcare despite being so much better than america perhaps?

bold gorge
lost matrix
#

Well step one would be to update. Not many people remember how to do stuff for legacy versions.

young knoll
#

1.12 doesn’t have looms

#

Kinda hard to open one

bold gorge
#

Tbf I will

#

How do I open looms and stuff in 1.16.5?

torn shuttle
bold gorge
#

fr

torn shuttle
#

I am very tempted to go try out this whole visual entity thing right now

#

which is unfortunate because I really have some other stuff to finish first

bold gorge
#

lmao

smoky oak
#

iirc if you create an inventory you can say of what but i dont recall if workstations are inventories

twilit roost
#

will this do the job?

lost matrix
#

Yes this will create a combat system with adapted cooldowns

twilit roost
#

oh very nice 😄

#

I mean if it would do
for eg 10d:5h:3m:40s

#

and not error out

lost matrix
#

This segment does nothing. We have no idea what you are doing.

twilit roost
#

turning long into timestamp

lost matrix
#

Yes, looks ok. But make SimpleDateFormat a field

#

Wait does DateFormat also format time?

twilit roost
#

¯_(ツ)_/¯

lost matrix
#

You might need a DataTimeFormatter

#
String timeColonPattern = "HH:mm:ss";
DateTimeFormatter timeColonFormatter = DateTimeFormatter.ofPattern(timeColonPattern);
fresh timber
#

so if u store info in a player entity PDC and the player leaves the server afterwards and rejoins, does the data get wiped or does it stay?

lost matrix
fresh timber
#

hmmm

#

so it vanishes

quaint mantle
#

how do i delete a world?

#

since world.getWorldFolder().delete() just gives me an error

lost matrix
fresh timber
#

yea

lost matrix
#

Ok

lost matrix
bold gorge
quaint mantle
lost matrix
wet breach
#

some are going to school in regards to programming as well

#

also

#

not everyone is young either lol

quaint mantle
lost matrix
torn shuttle
#

I do wonder if ultimately it is feasible to use the new transformations to interpolate points

lost matrix
#

Who you talking abouit

torn shuttle
#

I'm a spry young lad so certainly not me

lost matrix
#

Same

wet breach
torn shuttle
#

yo

#

I'm lit af and on fleek

lost matrix
#

true dat

torn shuttle
#

get away from me grandpa

wet breach
#

lol

torn shuttle
#

dab

sage patio
#

How can i replace something in a string in a string builder?

wet breach
#

by using replace

lost matrix
ancient plank
#

Frostalf is the old one

sage patio
twilit roost
quaint mantle
lost matrix
torn shuttle
#

the main issue I see with the client-side interpolation is that I have no clue of how I'm going to reconcile it with what is at its basis a moving entity

grizzled oasis
#

Im trying making a gui with an Open and Close system, for updating the gui when someone runs the command and update it for everyone in the server, but only the people who have open it how can i do that?

quaint mantle
# lost matrix Yeah should be fine
Bukkit.unloadWorld(world, true);

            Bukkit.getScheduler().runTaskLater(plugin, () -> {
                world.getWorldFolder().delete();
            }, 100);

is this the correct way to delete a world?

quaint mantle
grizzled oasis
lost matrix
young knoll
#

There is sadly no callback for when a world successfully unloads

lost matrix
#

Well... then just change the content of the inventory.

wet breach
young knoll
#

Probably

sage patio
young knoll
#

Actually, yes

#

You can't unload the main world

lost matrix
lost matrix
#

Just edit the Inventory

sage patio
#

^

wet breach
sage patio
wet breach
#

which it isnt lol

#

the exception being the main world

young knoll
#

I mean the current method returns a boolean already

tender shard
#

why the heck is this not enabled by default ><

wet breach
young knoll
#

How does the current method even return a boolean instantly

#

If unloading isn't instant

worldly ingot
# sage patio

StringBuilders aren't really meant to replace things. If you really absolutely need to do it, you can call indexOf("the string you want to replace"), then replace(index, sizeOfString, "the thing you want to replace with")

wet breach
sage patio
worldly ingot
#
StringBuilder builder = new StringBuilder("foo bar baz");
int index = builder.indexOf("bar");
builder.replace(index, index + 3, "blah");```
#

You'd get a builder that contains "foo blah baz"

sage patio
#

now its something like this

worldly ingot
#

gotcha

sage patio
#

thanks for help

young knoll
#
    public boolean unloadWorld(World world, boolean save) {
        if (world == null) {
            return false;
        }

        WorldServer handle = ((CraftWorld) world).getHandle();

        if (console.getLevel(handle.dimension()) == null) {
            return false;
        }

        if (handle.dimension() == net.minecraft.world.level.World.OVERWORLD) {
            return false;
        }

        if (handle.players().size() > 0) {
            return false;
        }

        WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
        pluginManager.callEvent(e);

        if (e.isCancelled()) {
            return false;
        }

        try {
            if (save) {
                handle.save(null, true, true);
            }

            handle.getChunkSource().close(save);
            handle.entityManager.close(save); // SPIGOT-6722: close entityManager
            handle.convertable.close();
        } catch (Exception ex) {
            getLogger().log(Level.SEVERE, null, ex);
        }

        worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));
        console.removeLevel(handle);
        return true;
    }
#

I see

onyx fjord
#

did mojang mess with ServerGamePacketListenerImpl?

tender shard
#

Arrays.asList("hello", "world")

young knoll
#

If you want to keep the current stuff you need to get it and then append

#

List<String> current = config.getStringList(key)
current.add("poop")
config.set(key, current)

tender shard
#
List<String> message = getConfig().getStringList("message");
message.add("test");
getConfig().set("message", message);
young knoll
#

Okay well alex's is more accurate

#

But mine says poop so

lost matrix
#

Coming back to this...

#

Thats a list of lists

#

Coderino pls

#

Arrays.asList now creates a List<List<String>>

#

just pass nicknames

wet breach
#

nicknames is already an array

lost matrix
#
List<String> nicknames = configuration.getStringList("message.nicknames");
nicknames.add(player);
configuration.set("message.nicknames", nicknames);
wet breach
#

since you obtained it as a stringlist

small timber
#

can someone help me

#
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
#

i've been trying since yesterday

small timber
#

huh?

lost matrix
#

What are you typing in console

#

Or how do you compile

small timber
#

intellij run button

lost matrix
#

First press clean and then package

small timber
#

where do I find this

lost matrix
quaint mantle
#
    private static final FieldAccess NF_PLAYER_NETWORK_MANAGER_FIELD;
    private static final List<RawPacketListener> packetListeners = new ArrayList<>();

    static {
        Field playerNetworkManagerField;

        try {
            playerNetworkManagerField = PlayerConnection.class.getDeclaredField("h");
        } catch (NoSuchFieldException e) {
            throw new RuntimeException(e);
        }
        playerNetworkManagerField.setAccessible(true);

        NF_PLAYER_NETWORK_MANAGER_FIELD = NoReflection.shared().get(playerNetworkManagerField);
    }
#

Any ideas why this error occurs?

lost matrix
#

This code does not relate to your error.
Also: What are you doing? What are you tinkering with the PlayerConnection?

rough drift
quaint mantle
#

ahh okay

quaint mantle
rough drift
#
public void deleteFolder(File folder) {
for(File file : folder.listFiles()) {
  if(file.isDirectory()) {
    deleteFolder(file);
    return;
  }

  file.delete();
}
}
``` @quaint mantle Something like this (really simple code, you should do error checking, and safety checks if the files are null)
small timber
#

still throws the same error

lost matrix
quaint mantle
#

no

lost matrix
small timber
#

u mean the project structure?

lost matrix
small timber
#

i do have a pom

lost matrix
small timber
#
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException

Process finished with exit code 1```
#

i mean it throws the same error after i press run again

lost matrix
#

You have done something to massively break something

small timber
#

i've done nothing

lost matrix
kind hatch
#

I don't think he's actually using the maven panel.

small timber
#

huh?

lost matrix
#

Your run configuration is botched

lost matrix
#

This compiles your plugin

small timber
#

ok thx

lost matrix
#

To fix your "run" button your would need to edit this:

small timber
#

yea nvm i'll just use package

kind hatch
#

Why not just set a default goal in your pom and use the maven run button?

honest relic
#

I have problem with spigot can someone help me

kind hatch
#

?ask

undone axleBOT
#

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

honest relic
#

I need to send photo to explain my problem better

kind hatch
#

You'll need to verify yourself before you can send images. Otherwise you'll have to use imgur, liteshot, or some other image sharing site.

lost matrix
#

?image

remote swallow
#

?ig

#

?img

undone axleBOT
lost matrix
quaint mantle
#

great good god what have i done

kind hatch
honest relic
#

@kind hatch come prv

kind hatch
#

Tf is prv?

tall dragon
#

dm probably

honest relic
#

@kind hatch dm

hazy parrot
honest relic
#

@hazy parrot I can't send photo

hazy parrot
#

?img

undone axleBOT
remote swallow
#

if you cant use that use imgur or smth

kind hatch
#

Alternatively, !verify yourself.

honest relic
#

Now can someone help me

remote swallow
#

update protocol lib and or via version

honest relic
#

I find a protocol lib but it's old on spigot web

#

And the via version same thing

remote swallow
#

old spigot web?

kind hatch
#

Idk about you, but this sure doesn't look old to me.

remote swallow
#

^^

torn shuttle
#

so is it possible in theory for fireworks to get stuck inside of blocks?

#

it seems like someone reported to me that they have over 1k lingering fireworks

lost matrix
#

Shouldnt they explode after a certain amount of ticks alive?

torn shuttle
#

see that's what I thought

#

it's like I'm spawning them in unloaded chunks or something but that doesn't make any sense

#

oh

eternal oxide
#

do you spawn them with a velocity?

torn shuttle
#

are they getting shot into unloaded chunks maybe?

#

that could do it

#

yeah some of these are angled

eternal oxide
#

that could do it

torn shuttle
#

so fun question

#

if I set it to not be persistent, will it be smart enough to remove itself if it goes into an unloaded chunk?

lost matrix
#

Yes

#

Wait

#

Probably

torn shuttle
#

I've been up for way too long, that's good enough for me

honest relic
#

@remote swallow @kind hatch I get the same problem

hasty prawn
#

It doesn't look nearly as cool but I'm fairly certain it's capable of them

lost matrix
kind hatch
#

At least 1.12, but I don't think it was capable of triangle regions.

#

Not sure if it is even now

hasty prawn
#

Maybe not, but if you make a polygon selection with WorldEdit and just define a region with that, it works (iirc anyways)

kind hatch
#

They are a pain in the ass to setup though.

hasty prawn
#

They absolutely are yes

lost matrix
#

Oh yeah you can do elipsoids etc. But can you define N points and an arbitrary polygon within that?

hasty prawn
#

Yes

kind hatch
#

There was some command that you could bind to the selection tool that would set the points.

lost matrix
#

Eh mine is still cooler 🤷

honest relic
hasty prawn
#

Yeah I don't remember the command but you definitely can do it. It takes forever though and afaik there's no way to have a visual aspect to it.

kind hatch
#

Damn, he's coming on to me.

hasty prawn
#

So... still really epic looks cool af👍

lost matrix
honest relic
lost matrix
kind hatch
#

Have you tried a different client?

honest relic
#

@lost matrix
1.19.4 spigot

honest relic
kind hatch
#

Keep in mind that 1.19.4 only came out like 2 days ago. It'll take time for plugins to update. ProtocolLib might still be usable up to 1.19.3

honest relic
#

good thank you

lost matrix
# honest relic <@220605553368498176> 1.19.4 spigot

Then go to ProtocolLib and ViaVersion and look at the supported versions.
1.19.4 is not production ready and should only be used for test versions.
Many plugins dont have updated their code for that version.

#

A bit clownish calling us useless when he simply refuses to read plugin descriptions

sage patio
#

how i can calculate this (i know i described badly)
50 / 10 = 5
51 / 10 = 6
59 / 10 = 6
60 / 10 = 6
61 / 10 = 7

kind hatch
#

Modulus?

sage patio
kind hatch
#

Flooring the number is like rounding down.

#

But on the decimal scale

honest relic
kind hatch
#

So 5.1 - 5.4 would floor to 5

sage patio
sage patio
#

thanks

quiet ice
#

Make sure to have either double or float division

#

That being said beware of floating point shenanigans

lost matrix
#
  public static void main(String[] args) {
    for(int i = 0; i < 50; i++) {
      int floored = (int) Math.ceil(i / 10.0);
      System.out.println("Number: " + i + " Floored / 10: " + floored);
    }
  }
Number: 26 Floored / 10: 3
Number: 27 Floored / 10: 3
Number: 28 Floored / 10: 3
Number: 29 Floored / 10: 3
Number: 30 Floored / 10: 3
Number: 31 Floored / 10: 4
Number: 32 Floored / 10: 4
Number: 33 Floored / 10: 4
Number: 34 Floored / 10: 4
Number: 35 Floored / 10: 4
Number: 36 Floored / 10: 4
Number: 37 Floored / 10: 4
Number: 38 Floored / 10: 4
Number: 39 Floored / 10: 4
kind hatch
quiet ice
#

one can't really call that flooring if you are ceiling

lost matrix
#

Well thats not floored its ceiled...

#

Yeah language barrier kicks in

#

ceiling is up, floor is down ^^

young knoll
#

Shoutout to worldguard for having a nice easy API for what I need

kind hatch
young knoll
#

Most protection plugins don't let you query an entire area easily :c

lost matrix
young knoll
#

Nah I want to query a cube

#

Without iterating every single location ideally

#

Worldguard lets me do

public boolean canBuild(Player player, BoundingBox bounds) {
        LocalPlayer localPlayer = worldguard.wrapPlayer(player);

        if (WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(localPlayer, localPlayer.getWorld())) {
            return true;
        }

        RegionManager regions = CONTAINER.get(BukkitAdapter.adapt(player.getWorld()));
        BlockVector3 min = BlockVector3.at(bounds.getMinX(), bounds.getMinY(), bounds.getMinZ());
        BlockVector3 max = BlockVector3.at(bounds.getMaxX(), bounds.getMaxY(), bounds.getMaxZ());
        ProtectedRegion dummy = new ProtectedCuboidRegion("dummy", min, max);

        ApplicableRegionSet set = regions.getApplicableRegions(dummy);

        return set.testState(localPlayer, Flags.BUILD);
    }
flint coyote
#

Is there a way to disable this warning (in the serverlog)?

Loaded class <classpath> from <Plugin> v1.0.0 which is not a depend or softdepend of this plugin.

I'm trying to dynamically (based on a config) load classes from other plugins so I can not depend or softdepend on those plugins.

lost matrix
young knoll
#

I approve

lost matrix
flint coyote
#

Because I will not know all of the plugins.
Basically I want to enable other developers to create plugins based on an interface that my plugin can use

lost matrix
#

Why do you need to load their classes then?
Its their responsibility to add your plugin to their dependencies in this case.

#

Ok lets take a step back. To understand this correctly:

  • You are defining an Interface
  • Another plugin can implement this Interface
  • You will use their implementation
flint coyote
#

I'm working on a Plugin to configure and run "Events" (basically just code) at certain times, in certain areas etc.

So basically any developer will be able to create an own event while depending on my plugin. But my plugin will have to instatiate those events with the right values (from it's configuration)

#

Therefore I need the classes of the other plugin. And I might need to have multiple instances of a class so handing me one instance would not be enough (unless I keep deepcopying it)

kind hatch
#

Oh, I think you have the same issue that PlaceholderAPI had.

flint coyote
#

Sounds about right that they would run into that aswell

lost matrix
#

This is commonly solved by using Factory classes.
And you need a system for others to register their factories.
This means you should not load anything from their plugin
but rather provide an API for registering their Factories.
They need to depend on your plugin.
So your plugin loads first.
Then their plugins load and register their factories.

flint coyote
#

Yeah that sounds possible. Might be able to create those Factories via Reflection aswell in order to keep the API as simple as possible.

Thanks, I'll figure something out based on the factory pattern

pseudo hazel
#

you wouldnt need reflection though

lost matrix
flint coyote
#

But they'd have to implement an extra factory for each event (sure it wouldn't be much code) but the fields to configure in each event are already filled using annotations. So might aswell use those annotations for an automatically created factory

flint coyote
#

Well that's what a lot of frameworks are based on. Spring Framework also adds Beans to classes via annotations

#

Therefore the implementation of an event is extremely simple

ivory sleet
#

Spring... hehe

lost matrix
lost matrix
flint coyote
#

Well I can collect all the annotated variables during startup time and then I just set the values via reflection and don't have to fetch them each time.

I might think about skipping on reflection but the Factory-Method implementation increases the complexity for other devs

#

I'm not injecting depencies as in complex objects. I only inject simple values like Strings, ints that are read from a config

lost matrix
#

Meta programming via annotations is much more complicated and implicit than actually implementing a simple class
and calling registry.register(new CoolFactory())

#

But ok. You will find your way

flint coyote
#

Is that more complicated than creating a Factory for those 3 values?

#

I mean sure you have to know what an annotation is but besides that?

pseudo hazel
#

i would rather just implement an interface because its clear in what it does

#

but this seems just as good though

lost matrix
#

You would not create factories for those. This looks nothing like what you described...

flint coyote
#

Ok lets deep dive a bit then

lost matrix
#

And also: What if someone just wants to have other objects in there?
Do you have a dedicated Codec where they can register context resolvers?

flint coyote
#

They will get complex objects as configurationSections

#

Or MemorySection to be exact

flint coyote
#

Isn't it the same? Either I do the conversion by calling a context resolver or they do it themselves

#

But yeah to keep the "Eventpack" Plugins cleaner I might add that in aswell. Good point

lost matrix
#

If you are working with ConfigurationSections then you can just utilize
ConfigurationSerializable from Spigot

kind hatch
#

?paste those please

undone axleBOT
flint coyote
#

So to kinda explain what I want to achieve:

We have this abstract class
https://paste.md-5.net/revacimisa.java
And for a command Block event I'd plan to implement it like this:
https://paste.md-5.net/peyeyagosa.java

The config would look kinda like this:

Events:
  commandblocker:
    engine_classpath: me.fabsi23.basicEventPack.events.restricting.BlockCommand
    engine_name: '&bCommand blocker'
    engine_description: 'Blocks commands'
    commandBlockedMessage: 'Command not allowed in this region'
    blockedCommands:
      - /tp
tardy delta
flint coyote
#

That's the reason someone was added to the event, not a placeholder name

lost matrix
#

Im seeing a bunch of problems right from the get go

#

This alone is really dangerous

tardy delta
#

exposing players hehe

flint coyote
#

Because of the public getter or because Player objects can change?

lost matrix
#

Public getter

#

Also why are those abstract? Arent they supposed to mutate the participatingPlayers?

young knoll
#

Also player objects can change

flint coyote
#

No those are called and based on the return value it either adds the player to the event or does not

young knoll
#

If the player relogs

flint coyote
tardy delta
#

weak hashset kek

young knoll
#

Fair

#

I don't use anything weak because I am not weak

tardy delta
#

💪

young knoll
#

Is there a StrongHashSet or maybe an AlphaHashSet

lost matrix
pseudo hazel
#

im more of an OmegaSet user myself

lost matrix
flint coyote
lost matrix
#

I can assure you that other devs will introduce massive problems here

flint coyote
#

I'm open for feedback since this is supposed to end up as an open api.

  • I love to learn
#

And yes I will document all those methods and write guides obviously. It's just not done yet

lost matrix
#

Ok so step one would be: Rename your enums

flint coyote
#

Alright what names would recommend?

tardy delta
#

yes

lost matrix
#

AddReason RemoveReason etc

tardy delta
#

what

lost matrix
#

Next up: Find a way to strongly encapsulate your participatingPlayers.

#

No getter no setter

flint coyote
#

Wish it was kotlin and I could use internal lol

tardy delta
#

i saw students in my class not using access modifiers for collections at all 🥵

lost matrix
#

To be honest. I dont think this collection should be inside your event

#

Or at least not together with your abstract methods

kind hatch
#

Wdym? If you want to access a variable in another class, make a getter method. Doesn't matter if it's primitive or a "normal" object.

jagged briar
#

hi

flint coyote
#

Well I want it to be accessible inside the event. I might add it to the EventController where it's still accessible from inside the event

lost matrix
#

In what context do you use "Event" here?

quaint mantle
#

why cant i check this? it worked on another project on a dif java version. this one is java 8

lost matrix
undone axleBOT
flint coyote
#

What do you mean?
It's basically all kinds of things.

Can be "spawn mobs" "tp player" "block command", "kick player" - any code, really

Wasn't sure what fits better/is more generic than "event"

lost matrix
flint coyote
#

Because it is regionbased. Not in the region = not participating.

Regions can be worlds, cuboids or spheres

patent socket
#

How can I make my while statement loop every 4 ticks until the statement inside is true? ```public class DialogueCommand implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String [] args) {
if (args.length == 0 || args[0].length() > 0 && args[1].length() == 0) {
sender.sendMessage(ChatColor.RED.toString() + "You need to provide both a selector and text.");
return false;
} else {
Player player = Bukkit.getPlayerExact(args[0]);
int idx = 1;
String word = "";
int counter = 0;
while (counter < args[1].length()) {
word = word + args[1].charAt(idx);
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(word));
idx = idx + 1;
counter = counter + 1;
}
}

    return true;
}

}```

kind hatch
#

?scheduling

lost matrix
flint coyote
#

A region can have multiple events running but one event (instance) can only be in one region

#

But by being in the region you aren't forced to be in every event in that region

#

Could be that you reached the goal (e.g. find a certain block) and therefore you are removed from one event but are still in another (e.g. one that gives you a slowness effect or whatever)

lost matrix
#

My guy you need more classes

#

You are creating an uber class

flint coyote
#

It has 4 methods lol

#

everything else is up to the actual implementation of that class

quaint mantle
lost matrix
#

It tracks its participants, it listens to bukkit events, it provides registrations for itself
it contains all mutators and accessors.
This is an uber class

quaint mantle
#

the currentStats thing is:

    public HashMap<StatType, Double> currentStats = new HashMap<>();
#

thats it

#

but for some reason i cant check .containsKey since it wants an object and not StatType

flint coyote
#

Hmm. I can move the participants to the controller but I feel like the Listeners should be registered inside the event that is consuming them, no?

lost matrix
#

?paste

undone axleBOT
flint coyote
#

The reason I put the players in there is that nothing would break if someone (for whatever reason) called removePlayer themselfes/actually removed a player. And to have one abstract "Api-Class". Basically to keep it as simple and quick to implement as possible.

lost matrix
#

I would start with this

#

Separate your configuration

quaint mantle
flint coyote
#

I can see where you are going with this. As in reusable configurations for multiple events

quaint mantle
lost matrix
#

If you are trying to simplify the API usage then you can not use those classes within your internals.
You might need to generate or create new Objects which can handle those simple implementations
in a more general and robust way.

flint coyote
#

Something like a "RunningEvent"-Class that holds an instance of "Event" and keeps the players within?

lost matrix
flint coyote
lost matrix
#

The only problem would be delegating or exposing participants to your Event implementations

#

Dont tell me EventController is a Singleton you use to manage your Events

flint coyote
#

I could create a copy of the list each time they query them. Or I just copy it once and if they mess with it in the wrong way it's their fault 😅

#

It's not a singleton but there is only one instance

#

Actually wait a sec let me push the whole project to a git repo. But it's not done yet so there's some things I still have to clean up

lost matrix
#

Im hungry and this system looks like it is written to mock SOLID in every way possible.

flint coyote
#

Well each region does have it's own Handler

#

But the EventController creates the regions and handlers (on startup) and keeps track of them (cleanup on shutdown etc)

lost matrix
#

Give the S and D a good look

river oracle
#

I always forget what solid is I just kinda code lmao

flint coyote
#

I'll do that and rethink the current structure I guess

lost matrix
#

Its a cool idea with the annotations and all but this will wreak havoc on devs and servers

river oracle
patent socket
#

Ok so this is my code: ```public class DialogueCommand implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String [] args) {
if (args.length == 0 || args[0].length() > 0 && args[1].length() == 0) {
sender.sendMessage(ChatColor.RED.toString() + "You need to provide both a selector and text.");
return false;
} else {
Player player = Bukkit.getPlayerExact(args[0]);
final int[] idx = {1};
final String[] word = {""};
final int[] counter = {0};
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskTimer(plugin, () -> {
while (counter[0] != args[1].length()) {
word[0] = word[0] + args[1].charAt(idx[0]);
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(word[0]));
idx[0] = idx[0] + 1;
counter[0]++;
}
}, 4l, 4L
}

    return true;
}

}

class Other {
private final Dialogue plugin = Dialogue.getPlugin(Dialogue.class);
}```
And here are my errors:

flint coyote
#

Yeah I like the concept which is why I got behind this project.
I will definitly do some improvements before publishing it tho

quaint mantle
#

at the end of the run task tmer

flint coyote
#

Especially chunk based region activation (for now all regions are active at once).
But I'll start with improving what you already mentioned!
Thanks a lot ❤️

jagged briar
#

we cant really help you from just that

#

well does the variable get edited at some point? where do you use it?

olive sparrow
#

Guys I'm at my wits end. What am I doing wrong ?

kind hatch
#

Are you trying to connect the torch to the block?

olive sparrow
#

Yeah. First to place cobble and then the torch and connect it to previous block.

terse ore
#

facingDirection?

kind hatch
#

Use a WALL_TORCH and set the orientation using the BlockState

olive sparrow
#

Oh ! I'll play with that now ! Thank you for pointing me in the right direction ! 🙂

patent socket
#

These are the problems again:

patent socket
undone axleBOT
patent socket
#

What about the red plugin word?

oak locust
#

can anyone please help me with displaying hex colors in chat?

kind hatch
#

ChatColor#of()

rough drift
#

§x§f§f§f§f§f§f for white

rough drift
kind hatch
#

Yes?

rough drift
#

That maps it to the nearest chat color

kind hatch
#

No it doesn't.

#

It returns the exact color

#

Maybe the bukkit one does

rough drift
#

well then fuck me

kind hatch
#

But the bungee one doesn't.

rough drift
#

Ah

#

I see

#

I'll just commit fell out of the world right now

rotund ravine
sterile token
#

How does Gson#fromJson() inernally does to assign values to fields without having any empty constructor on the "type class"?

rotund ravine
#

Reflection probably

sterile token
#

Hmn, elaborate more please

sterile token
# rotund ravine Reflection probably

Because so far im using, to get the packet id while being registered, but what if i dont to oblise you to have an empty constructor. Cuz right now, if none default empty constructor while throw an InstantiationException

int id = (int) packet.getDeclaredMethod("getUniqueId").invoke(packet.newInstance());

patent socket
#

Why is the word plugin red in this line? scheduler.runTaskTimer(plugin, () -> {

undone axleBOT
sterile token
#

I need full code to help

#

maybe the plugin var doesnt exists, so your IDE puts in red meaning smth its wrong

somber sequoia
#

Hey, I want to create a plugin that can alternate how ores are spawning, does anyone have an idea how would I maybe extend the normal world generator and change it like that? Anything is appreciated

ivory sleet
#

Gson can use unsafe to create an object from a class nullary constructor regardless if it exists or not

sterile token
#

Okay

#

I ill read about it

#

Thanks

undone axleBOT
sterile token
ivory sleet
#

Java Unsafe

#

Its a class

sterile token
#

oh ok

patent socket
#

How can I do this? I read the article over and I can't really make sense of it

sterile token
livid dove
sterile token
#

Its just people that just want things easy, and they expecting to code a bigger plugins in weeks without even knowing the lang where they coding

sterile token
livid dove
#

I shrugged

#

As in eh, you are probs right

#

still doesnt hurt to sign post em

sterile token
rotund ravine
#

No?

#

A shrug is a plain english word

#

Shrugs is the act of shrugging

modest tartan
#

Not at home to test the code so I just want to ask for later. Can you use a textured player head on the new block display and item displays?

kindred valley
#

java

#

avaj

rotund ravine
#

Hello

kindred valley
#

That skin 🥴🥴

rotund ravine
#

Why is your head an old tv-screen

tender shard
#

it's because I migrated to the US and now I only have NTSC resolution

modest tartan
#

Lmao

#

Got help from the funniest person too, amazing

rotund ravine
#

He’s flirting with you Alex

tender shard
#

i got a bf >.<

modest tartan
#

Oop

#

Come on JanTuck

flint coyote
#

Alex when are you upgrading to this?

modest tartan
#

🤣🤣

rotund ravine
young knoll
#

How can you use a textured head on a blockdisplay

rotund ravine
#

Magic

young knoll
#

It only has nbt to store states

tender shard
echo basalt
#

what's the res

flint coyote
tender shard
echo basalt
#

eh

#

ok

young knoll
#

Ah okay

echo basalt
#

bet you paid like 5 grand for it

tender shard
young knoll
#

Item display not block display

tender shard
echo basalt
#

paid 1k for my 17" 2k 16:10 laptop

#

ddr5 too

sacred wyvern
#

Is there a way to prevent a entity Villager from moving?

tender shard
sacred wyvern
#

🙂

tender shard
#

no, that's why we remove the goals 😛

sacred wyvern
#

Cheers

tender shard
#

requires NMS though

young knoll
#

setAi false

tender shard
#

that also prevents gravity etc

#

or being pushed by water or stuff like that

echo basalt
#

villagers are more complex than that

young knoll
#

Well gravity is moving

echo basalt
#

removing goals won't do much

#

they use the MemorySenses system

tender shard
#

I thought with moving, they meant the villager moving itself

echo basalt
#

I know

#

I tried

#

like

#

a year ago

young knoll
#

Sets whether this mob is aware of its surroundings. Unaware mobs will still move if pushed, attacked, etc. but will not move or perform any actions on their own. Unaware mobs may also have other unspecified behaviours disabled, such as drowning.

sacred wyvern
#

That will work thank you

tender shard
#

didnt know that existed

young knoll
#

Oh yeah custom crops with player heads and item displays

#

Now we are talking

terse ore
#

is there a way to fill an area of nether portals without them breaking?

rotund ravine
#

Yes

terse ore
#

how

kind hatch
#

Don't send a block update.
Set the type

eternal oxide
#

place without physics

terse ore
# kind hatch Don't send a block update. Set the type
public void fill() {
        System.out.println("asd");
        Block block = startBlock;
        for (int y = 1; y < height - 1; y++) {
            for (int x = 1; x < width - 1; x++) {
                System.out.println(block.getX() + x + " " + block.getY() + y + " " + block.getZ());
                block.getWorld().setType(block.getX() + x, block.getY() + y, block.getZ(), Material.NETHER_PORTAL);
            }
        }
    }```
terse ore
#

mb guys

young knoll
#

Alright idk how interpolation on these things works

kind hatch
#

The display entities?

young knoll
#

Alright I got it

sacred wyvern
young knoll
#

no?

#

Represents a Mob. Mobs are living entities with simple AI.

sacred wyvern
#

Gotcha thank you. Was trying to find examples of spawning it. Found it on YouTube.

kind hatch
#

Hey @young knoll, do you know if the text display entities still use the ARGB color space for the background color?

patent socket
#

I already have this line in my onEnable() in Dialogue.jar. DialogueCommand.jar contains the files for the command: getCommand("dialogue").setExecutor(new DialogueCommand());

hazy parrot
#

,

rough ibex
#

put them in different files misread

young knoll
#

Class X implements A, B

hazy parrot
#

You can implement two interfaces, also there is TabExecutor which implements both

#

?

#

Oh it's Listener

fluid river
#

only in case you have

hazy parrot
#

I trough its CommandExecutor lol

fluid river
#

extends JavaPlugin implements Listener, CommandExecutor {}

hazy parrot
#

Forget about TabExecutor thingy then

young knoll
#

JavaPlugin already implements CommandExecutor

rotund ravine
#

Cute

onyx fjord
#

finally we will be able to grow weed

#

realistically

young knoll
#

The annoying part would be keeping track of them all, and ticking them

onyx fjord
#

u can tick those loaded

#

and unloaded keep track of unload time

young knoll
#

You could be jank about it and recreate vanilla ticking

onyx fjord
#

that too

young knoll
#

Pick 3 ranom blocks per loaded chunk every tick, and see if there is a itemdisplay with a certain tag on that block

#

Then grow it

patent socket
#

I have already, these are just the parts I don't know.

eternal oxide
#

its an entity? so grab all entities in the chunk on chunk load

young knoll
#

Yeah

patent socket
#

Yeah I did this and it didn't work. I don't know if you would like me to put it in the Dialogue.jar or the DialogueCommand.jar.

young knoll
#

Grab them on load and load them into a map of some kind

undone axleBOT
eternal oxide
#

entities will not be loaded when the chunk loads, so delay your search

young knoll
#

Right right

#

There is a new event for that

#

Well, "new"

patent socket
sacred wyvern
#

Is this the right way to spawn a mob?

        try {
            this.entity = this.location.getWorld().spawn(this.location, Mob.class);
        } catch( IllegalArgumentException e ) {
            LOG(LogType.Info, e.getMessage());
        }

I keep getting

IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.Mob

This is almost similar to the spawnEntity command which worked for a regular villager.

olive sparrow
#

Guys am I doing this directional wrong. Could you point me in the right direction please ?

static ingot
onyx fjord
olive sparrow
#

Hmm no luck there

echo basalt
#

before state.update

olive sparrow
echo basalt
#

haven't worked with the bukkit api in so long despair

olive sparrow
#

Like I got the torch rotation done through setRawData but thats deprecated and I wanted to work the proper way out 😄

echo basalt
#

no clue

#

torch extends like

#

hangable or something

olive sparrow
#

Attachable mby ?

#

Yeah wall torch.

echo basalt
#

It's directional for sure

young knoll
#

Torch is always on the ground

olive sparrow
#

Rotating one torch got me stuck for couple of hours lol 😄

young knoll
#

Wall torch is the one that can be rotated

patent socket
#

Did you get it?

olive sparrow
#

Well nvm I'll just set the direction through setRawData.

patent socket
#

plugin is still red, but now getCommand is

undone axleBOT
patent socket
weak meteor
#

is this null check on inv good? if (e.getClickedInventory().getItem(21).equals(null) || e.getClickedInventory().getItem(23).equals(null)){

#

idk if its cool

#

bcause im getting error

#

at that line

young knoll
#

== null

weak meteor
young knoll
#

Using .equals for null doesn't make sense

#

If it's null, using .equals with throw a NPE

#

Otherwise it will always be false

weak meteor
#

Thanks

#

appreciate it

balmy pasture
#

Is there a way to listen that player holds left mouse button?

weak meteor
#

?paste

undone axleBOT
weak meteor
#

this is my code for my InventoryClickListener https://paste.md-5.net/igegudociv.java

The problem is that i cant interact with my inventory even when i close the mainMenu or the next inventory, why?

#

For me it is okay

#

nvm

#

just found

#

i had a ; in my if statement

real fable
#

How can I make a sort of /execute as @p run my_plugin_command in a command block for one of my plugins command ?

young knoll
#

Does execute not just work with plugin commands

real fable
#

It look like it don't :c

weak meteor
#

like /menu lets say?

real fable
#

yes

flint coyote
real fable
#

I want it in a command block (and I am using 1.18.2, for this plugin)

flint coyote
#

Oh

weak meteor
#

Bukkit.dispatchCommand(player, "command");

#

Oh

#

thats another thing

young knoll
#

I mean /execute should work

real fable
#

my command don't appear in the tab completer, and when I write it, it says wring argument

weak meteor
young knoll
#

Ah I’ve taken a look at jira

#

Commands registered through spigot are not available for /execute

#

But if you use a command framework that supports brigadier they would be

real fable
#

Find my way by making another command that executes a command for the player

weak meteor
pseudo hazel
#

cancelling the inventory event outright prevents you from moving any items in the whole inventory

#

you need to only cancel it if the player tries to move items that shouldnt be able to be picked up

weak meteor
#

but if (inventoryView.getTitle().equals("Main Menu"))

#

isnt preventing cancelling the normal inventory?

pseudo hazel
#

thats the whole view

#

the player inventory is always part of the same view

weak meteor
#

Hmm

pseudo hazel
#

you need to check the slot numbers

weak meteor
#

so can i change it so i can move in my inv but not in the artificial inv

pseudo hazel
#

yes

#

cancel it if the slit number is invalid

weak meteor
#

Wdym

young knoll
#

You can check if the clicked inventory equals the top inventory

#

Or the bottom inventory

weak meteor
#

How to?

pseudo hazel
#

probably some method

#

of the event

young knoll
#

event.getClickedInventory.equals(view.getTopInventory())

#

Iirc

weak meteor
#

if (e.getClickedInventory().equals(inventoryView.getTopInventory()))

#

okay

#

ill try

#

Thanks, it worked.

#

Is there any other type of passing enchants from a book to a item other than: ```java
ItemStack sword = e.getClickedInventory().getItem(21);
ItemStack book = e.getClickedInventory().getItem(23);

                        ItemMeta swordMeta = sword.getItemMeta();
                        ItemMeta bookMeta = book.getItemMeta();

                        Map< Enchantment, Integer> enchants = bookMeta.getEnchants();
                        for (Map.Entry<Enchantment, Integer> entry : enchants.entrySet()){
                            Enchantment enchantment = entry.getKey();
                            int level = entry.getValue();
                            swordMeta.addEnchant(enchantment, level, false);
                        }
                        sword.setItemMeta(swordMeta);```
rare rover
#

epic

sterile token
quartz sorrel
#

Anyone knows how I could get the Virtual host a player connected through (Not in join event or whatever but in general)?

sterile token
#

I think you can obtain the virtual host from it, but im not sure currently

quartz sorrel
#

Nope.

#

Already checked it

#

Unless the getAddress() provided there would be the host, but I doubt that.

modest tartan
#

Could anybody provide an example of how to set the transition of a block display so that the block is just rotated 45 degrees or standing on one corner? I've been goofing off with the numbers in the setTransformation method the entity goes somewhere in my world and I've tried teleporting to it but I don't see the entity. Heres the code I'm currently using.

public void omPlace(BlockPlaceEvent event) {
        event.setCancelled(true);
        BlockDisplay nameTag = (BlockDisplay) event.getPlayer().getWorld().spawnEntity(event.getBlock().getLocation(), EntityType.BLOCK_DISPLAY);
        nameTag.setBlock(event.getBlock().getBlockData());
        nameTag.setDisplayWidth(1);
        nameTag.setDisplayHeight(1);
        nameTag.setTransformation(new Transformation(new Vector3f(0, 2, 0), new AxisAngle4f(45, 0, 2, 0), new Vector3f(0, 1, 0), new AxisAngle4f(12, 9, 3, 4)));
        nameTag.setInterpolationDelay(0);
    }```
#

Idk what AxisAngle4f or Vector3f really is either so the numbers I'm using are just to fill the requirements

#

I figured I'd learn what they are once I filled them in and saw the effect but my effect is no entity display lmao

young knoll
#

Vector3f is just a vector

#

X Y Z

modest tartan
#

Yeah I noticed that

young knoll
#

The other one is a quaternion

modest tartan
#

Its optionally AxisAngle4f I think

#

Thats why I have it

#

I can try Quaternion but idk what that is either

weak meteor
#

I like to code with music, u dont?

#

?javadocs

#

?docs

#

damn

hazy parrot
#

?jd

weak meteor
#

thanks

#

How to get the title of a InventoryCloseEvent?

eternal oxide
#

don't use titles

weak meteor
#

Then?

eternal oxide
#

instances

weak meteor
#

okay

young knoll
#

Use the inventory instance itself

#

Or the view from openInventory

#

Or if you must, inventory holder

static finch
#

hello i'm a little bit new to java and minecraft developement, but not to dev

i have 2 plugin

1 that is a lib, this plugin can speak to an Rest API
2 and the other that i want to be able to use the plugin 1

i know that its possible but idk how i'm using VScode
so there is a public class named api in my plugin 1
that i want to be able to use in my plugin 2 how can i do that ?

thanks you for helping !

#

ping me :)

#

ho btw i use maven

young knoll
#

Publish it to your maven local with the maven publish plugin, then you can add it like any other dependency

undone axleBOT
raw crow
#

is ItemStack immutable?

young knoll
#

No

raw crow
#

hmmm

brave sparrow
#

it's not immutable but you can't get a mutable copy of an item in an inventory

#

you make a copy of it, modify the copy, and set it back into the slot

young knoll
#

Items in hand are mutable tho