#help-development

1 messages · Page 217 of 1

river oracle
#

Bad letter I prefer z

eternal night
#

exactly paidyy

agile anvil
#

Go to Unity and tell them

eternal night
#

but fast 😛

quaint mantle
#

So is rust

#

So is c++, so is C

river oracle
#

I like to learn languages that have actual use is V going anywhere

quaint mantle
#

So is Go most of the time

eternal night
#

see that is why I code assembly

quaint mantle
#

Maximum performance

river oracle
#

My golang is fast as fuck :)

glass tangle
#

i'm curious how many people use haxe

river oracle
#

Wtf is haxe

glass tangle
#

language that compiles to c, c++, java, php, js etc

#

it has syntax like in java and typescript

river oracle
#

Does it produce good transpiled code or is it slow

agile anvil
#

What's the point of compiling a code to java? What does that even mean?

glass tangle
river oracle
#

So you can compile to the jvm who knows seems dumb though lol

river oracle
#

But I will anyways transpile just goes into another language like ts is transpiled into js

agile anvil
#

V is sweet, didn't know it until now

alpine cairn
#

I'm back

river oracle
#

Still don't know what v is but gahh

#

Cool

glass tangle
#

haxe converts it's code to for example html5

alpine cairn
#

How do I actually download the SpigotMC Maven Repository?

glass tangle
river oracle
alpine cairn
glass tangle
alpine cairn
#

That's where I'm at

#

I have maven installed

#

How do I like

#

Put the thing in the thing

river oracle
#

You gotta create a maven project with intellij

#

Or eclipse or whatever you use

alpine cairn
#

Yeah I did that

#

Lookng at pom.xml

river oracle
#

Then just copy and paste not that complex

alpine cairn
#

Copy and pase

#

what

#

where

river oracle
#

The site tells you

glass tangle
#

in pom.xml

alpine cairn
#

uh

#

which part?

#

I see 6 lines

river oracle
#

It tells you read

#

both of the following

glass tangle
#

even i didnt had problems with setuping maven for the first time

#
    <!-- This adds the Spigot Maven repository to the build -->
    <repository>
        <id>spigot-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
</repositories>

<dependencies>
    <!--This adds the Spigot API artifact to the build -->
    <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.19.2-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
    </dependency>
</dependencies>``` copy and paste these to pom.xml
river oracle
alpine cairn
#

So just go to a new line and paste that whole thing?

glass tangle
#

inside <?xml> tag

#

sorry not that

#

<project>

alpine cairn
#

before the forward slash?

glass tangle
#

yeah

alpine cairn
#

"XML document structures must start and end within the same entity"

glass tangle
alpine cairn
#

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>CreeperSpawn</groupId>
<artifactId>CreeperSpawn</artifactId>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>

<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>/project>

river oracle
#

My lord lol

#

?paste

undone axleBOT
alpine cairn
#

🤷‍♂️

mint reef
#

So I've got a world generator I've been developing for a while and I'm wanting to add structures via Jigsaws. I know how Jigsaw blocks work so none of that will be a problem but I can't seem to figure out how to actually enter data into the jigsaw block on my populate method. I'm just wondering if anyone else has any more experience here. I have already looked at these and they seem to provide nothing:
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/data/type/Jigsaw.html
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Jigsaw.html

#

I may be missing something simple, but I'm not so sure

glass tangle
#

i still have hell flashbacks from working on world generator

alpine cairn
#

It wont let me just cntrl+c cnrtl+v?

glass tangle
#

what

river oracle
#

Mac user located???

alpine cairn
#

Uhhh yeah I dont know how to upload text

#

and nah windows

river oracle
#

?paste

undone axleBOT
glass tangle
undone axleBOT
river oracle
#

The paste ui is very self explanatory if you can't figure it out I can't help you

glass tangle
#

if you dont know where it is located

alpine cairn
#

I'm so confused

#

You want me to turn the text into a file and upload it?

glass tangle
#

you're telling me it's not a file

alpine cairn
#

Okay could you like explain this to me like I'm 10

glass tangle
#

you're using intellj?

alpine cairn
#

No, eclipse

glass tangle
#

damn

#

but you know where is you code located?

alpine cairn
#

for pom.xml?

#

I'm looking at it

glass tangle
#

yes

alpine cairn
#

Yeah

glass tangle
#

so can you upload pom.xml here

alpine cairn
glass tangle
#

what

#

send your pom.xml here

alpine cairn
#

I can't just drag it from eclipse to discord

river oracle
#

Just copy and paste it

glass tangle
#

because you need to drag it from explorer

alpine cairn
#

I did that tho

river oracle
#

?paste

undone axleBOT
river oracle
#

Use this website pastr your pom

glass tangle
river oracle
#

And the. Paste the link in the discord

alpine cairn
#

?paste

undone axleBOT
alpine cairn
glass tangle
#

you deleted <?xml> ?

river oracle
#

You don't have a closing project tag yoh deleted your xml tag you have no build tags

glass tangle
#

try adding
<?xml version="1.0" encoding="UTF-8"?> at the top of pom.xml

alpine cairn
#

"The processing instruction target matching "[xX][mM][lL]" is not allowed."

glass tangle
#

also before / add <

alpine cairn
remote swallow
#

add < to /project>

glass tangle
#

before /

alpine cairn
#

The one on the last line?

glass tangle
#

yes

alpine cairn
#

"Project build error: Non-readable POM C:\Users\jason\Desktop\MyPlugins\CreeperSpawn\pom.xml: no more data available - expected end tag </project> to close start tag <project> from line 1, parser stopped on END_TAG seen ...</dependencies>/project>... @22:25"

#

I have "</project>" at the end now tho

glass tangle
#

can you paste the file again here

#

you forgot to save

alpine cairn
#

yes

glass tangle
#

it should work i don't see any problem

#

have you saved

#

in eclipse

alpine cairn
#

ope that fixed it

#

good looks

#

Thank you very much hopefully it is smooth sailing from here

fallow violet
#

why cant i find Material.SPYGLASS?

#

does it have another name?

glass tangle
#

Material.SPYGLASS

#

yeah

#

maybe update dependency

fallow violet
#

yeah

#

idk how

#

but i had 1.16

#

you can have 1.16 plugins on 1.19 server? lol

glass tangle
#

yeah

#

i think?

river oracle
#

Yes

glass tangle
#

plugin.yml sets the requirement version

river oracle
#

As long as you don't use nms

#

If you use nms you'll need to do a bit more setup to get 1.16 jars working on 1.19

fallow violet
#

i changed it

river oracle
#

Note if you want to use 1.19 exclusive methods you'll need to use reflection and some version detection system

fallow violet
#

anyways is it possible to define 2 or more versions in plugin.yml?

river oracle
#

No just define the api version you use spigot is forwards compatible

#

As long as you don't use nms

fallow violet
#

but how ppl make multible version compatible jars?

river oracle
#

They put a 1.17 jar in a 1.19 server

#

That's how as long as you don't use nms don't worry about it

#

If you do use nms I reccomend either reflection or maven modules with reflection to create interfaces with certain methods

fallow violet
#

lol

worthy scroll
#

so, i'm trying to make a gui that shows player heads of offline players, but the head item's just don't show up in the gui.

public void RefreshHeads() {
        System.out.println(Lifesteal.plugin.banned);
        for (int i = 0; i == Lifesteal.plugin.banned.size(); i++) {
            OfflinePlayer p = Bukkit.getOfflinePlayer(Lifesteal.plugin.banned.get(i));
            ItemStack head = new ItemStack(Material.PLAYER_HEAD);
            SkullMeta headmeta = (SkullMeta) head.getItemMeta();
            headmeta.setDisplayName(p.getName());
            headmeta.setOwningPlayer(p);
            head.setItemMeta(headmeta);
            inv.addItem(head);
        }
    }```
radiant cedar
#

should i save rank information in objects to use after or read an information about the rank from config file each time

fluid river
#

PDC's

#

as alternative to config

#

or sql

fluid river
#

any errors in console?

worthy scroll
#

nope

fluid river
#

what if you don't set owning player

#

just a name

worthy scroll
#

maybe, when i don't set the meta, the item shows up

radiant cedar
#

ima just save ranks as objects with attributes and just use them

#

is that bad

#

and read attributes from files every time server gets on

echo magnet
#

Multi-Scope Maven Dependency

hazy parrot
#

it will not iterate at all

#

because of i == ...size() condition

#

it will iterate once only if size is 0

worthy scroll
#

oh lol
sorry i'm pretty new to java
thank you!

fresh timber
#

I'm trying to stop a player from moving a certain item in their inventory and I have done InventoryClickEvent, InventoryMoveItemEvent, PlayerInteractEvent, and PlayerSwapHandItemsEvent. This blocks most all movement of the item besides one thing, when you hit the number index the item is in, if it is in your hotbar, it moves the item to the inventory slot that your mouse is hovering over. I cannot seem to stop this... does anyone know how I can?

hazy parrot
radiant cedar
#

Can I not do this to make my own class for players with extra methods

#

and then use this

#

it gives me error

vocal cloud
#

Pplayer 😭

radiant cedar
#

was just trying

#

to make my own player class

#

Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer cannot be cast to class

vocal cloud
#

You can't upcast to something it's not

frozen dune
#

and make sure that Pplayer has a constructor with the player object

vocal cloud
#

Yeah, but that defeats the purpose and you'd just want to make a utility class

radiant cedar
#

with Pplayer

frozen dune
#

You can do it a different way by just inside Pplayer adding functions that can run

ionic rampart
#

hey, can anyone help me on how to make mobs spawn in the air and at any time (for skyblock)

frozen dune
ionic rampart
frozen dune
# radiant cedar what
Pplayer player = new Pplayer(e.getPlayer());

player.coolFunction();

// Pplayer.java
public void coolFunction() {
  //code
}```
frozen dune
#

easily atleast

ionic rampart
#

ive seen servers with it tho?

radiant cedar
#

i dont wanna add every single function in Player to Pplayer

frozen dune
radiant cedar
#

lol

frozen dune
#

🤣

ionic rampart
radiant cedar
#

ye so how can i use the functions in Player with Pplayer object

frozen dune
ionic rampart
#

i cant find anything

radiant cedar
#

just more functions

frozen dune
fresh timber
#

I keep getting this error when I start my plugin on my server... anyone know why?

worthy scroll
#

so, i need to check if the inventory a player has open is the custom one i'm making, but the inventory is never equal.
this always returns false.

fresh timber
worthy scroll
#

yea, i won't

fresh timber
#

ok then that should work

shadow gazelle
#

I need a way to basically reset a map like in skywars or bedwars and I'm not sure how to go about doing it, does anyone have any experience with doing things like this or have any ideas how I could?

#

I would prefer to have it loaded from a schematic if possible but I think I need WorldEdit for that, not sure if you can read schematics otherwise without an entire loading system

vocal cloud
#

Write your own method to store the data and restore it or use WE

shadow gazelle
#

Store it with MySQL or something?

vocal cloud
#

Yeah, or file based.

shadow gazelle
#

not sure how schematic files actually work, yml would probably end up being huge unless schematics are basically just text files

vocal cloud
#

Well you can always make your own serialization system. It's going to be a big file obviously

old atlas
#

Has anyone used SuperBoostersAPI to create custom boosters?

wet breach
#

You also don't need worldedit. You can do the loading and saving yourself

shadow gazelle
#

Thanks

warm light
#

how to check if player trying to add an item in the bottom inv?

#

on invDragEvent

drowsy helm
warm light
#

How to do it? is it even possible to check for clicks?

chrome beacon
#

InventoryClickEvent

vital sandal
#

What are the ways to save item data ?

#

Except lores/nbt tags

chrome beacon
#

Save item data where and for what purpose

vital sandal
#

Like saving rpg weapon stats

chrome beacon
#

PDC

#

?pdc

vital sandal
#

It is contain in nbt tag i think

chrome beacon
#

Yes

vital sandal
#

Some how some shop plugin doesnt copy it :l

#

It void that pdc

chrome beacon
#

That is not your problem

vital sandal
#

Yeh ik

chrome beacon
#

Use PDC don't make it hard for yourself

vital sandal
#

Alright

loud frost
#

I have only recently started using maven. How do I properly shade a dependency?

#

I have added the dependency to my dependency list in my pom.xml, but do i still need to add the jar manually?

eternal oxide
#

Never manually add jars

loud frost
#

That is what I thought. But after adding the dependency I cannot access its classes. Is there other things I need to do?

wet breach
static ingot
# loud frost I have only recently started using maven. How do I properly shade a dependency?

You need to use the maven shade plugin. Not at an IDE, but here's a mockup

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-shade-plugin</groupId>
      <version>3.4.1</version> <!-- May depend on your Java version -->
      <executions>
        <execution>
          <phase>package</phase>
          <goals>
            <goal>shade</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
#

I believe it shades all compile and runtime dependencies by default (default scope of a dependency is compile if none is set)

loud frost
#

Just making sure, I do not need to link to a jar or a repo, I only need to add it to the dependency list?

ivory sleet
static ingot
loud frost
#

I have added it, I cannot access anything though. 💀

#

Is there a way to verify its added? It compiles just fine

static ingot
#

You have to compile it using the maven package task

loud frost
#

Can I share my warning here?

static ingot
#

sure

loud frost
#
commandapi-shade-8.5.1.jar, distancemeasure-1.0.jar define 1 overlapping resource: 
  - META-INF/MANIFEST.MF
maven-shade-plugin has detected that some class files are
present in two or more JARs. When this happens, only one
single version of the class is copied to the uber jar.
Usually this is not harmful and you can skip these warnings,
otherwise try to manually exclude artifacts based on
mvn dependency:tree -Ddetail=true and the above output.
See https://maven.apache.org/plugins/maven-shade-plugin/
static ingot
#

You can safely ignore that.

#

It's just a warning for overlapping manifest files. Only really required for standalone apps afaik, so not so much for libs and plugins

loud frost
#

damn

#

Could there be anything else I might be doing wrong/over looking?

static ingot
#

You're not doing anything wrong, but if the warning is bothersome, you can add a filter to exclude all manifest files

loud frost
static ingot
#

The warning even says itself it's usually not harmful and can be skipped

#

oh, mb

#

I'm not sure, you should just share your pom file as it is so we can see what's wrong

loud frost
#

Whats the site for posting files

static ingot
#

?paste

undone axleBOT
loud frost
static ingot
#

It looks like it should be fine.

ivory sleet
#

In principle no need to care about manifest files for plugin jars

loud frost
#

💀

ivory sleet
#

As plugin.yml is used instead

static ingot
#

Maybe you're not using the right output jar?

ivory sleet
#

But in most jar oriented infrastructures you’d work with manifest files more integrated

loud frost
#

nvm

static ingot
#

rip

loud frost
#

so close lol. I refreshed my ide and it gave me more options lol

#

but still not compile 😭

ivory sleet
#

What’re those options?

loud frost
#

It gave me 'import class'. It didnt before, but I added it 'manually', so no change.

ivory sleet
#

What ide do you use?

loud frost
#

intelij

ivory sleet
#

Can you remove the dependency manually?

loud frost
#

yes?

ivory sleet
#

(And let maven handle it entirely)

loud frost
static ingot
#

Your pom setup works fine for me. It includes the command api

ivory sleet
#

Well, what do you mean by added the dependency manually

loud frost
#

Il fiddle around with things for a bit

#

Thanks for the help though.

ivory sleet
#

Im still a bit confused, import as in a java import?

loud frost
#

import package.package

ivory sleet
#

Ah okay

#

But what’s the issue that remains? The shading right? If it still didnt work after added what Mauwh gave you, maybe you’re constructing the jar wrongly?

#

cause basically, you wanna run mvn clean install and then take the jar from the target folder that is not labelled with -original iirc

static ingot
#

what's the difference between package and install? I've pretty much always used mvn clean package

ivory sleet
#

No clue🥲

static ingot
#

lmfao

#

I think install calls package anyway

ivory sleet
#

I dont use maven, but gradle :,)

static ingot
#

lol

ivory sleet
#

Ah okay

static ingot
#

I only use gradle for multi-module projects

ivory sleet
#

Fair

loud frost
static ingot
#

That's the decompiled output JAR.

loud frost
#

ah

#

il check that

#

its there 💀

static ingot
#

nice

#

lmfao

hybrid spoke
static ingot
#

Ahh

loud frost
#

@static ingot If you still have your dependency test, can you add you verify that adding CommandAPI.onEnable(this); or calling anything works or not?

static ingot
#

I just noticed this after going to double-check the decompile output, lol

#

bad dependency?

loud frost
#

Is that a possibility?

#

I will look into that

static ingot
loud frost
#

I believe it says because im shading i dont need to use that

static ingot
#

oh

#

mb, you're right

#

I see the xml code you grabbed from there

loud frost
#

also, progress report: my pom defaulted to java 1.8, changing the version to 19, it showed in the decompile!

#

but still no worky

static ingot
#

I'm not sure what the dependency is supposed to include. The module is completely empty on Github.

static ingot
#

Yeah, I was looking at that

#

?paste

undone axleBOT
static ingot
quaint mantle
#

Hey i have this code that generates a random location for some reason it lags.

Why?

        // Generate Random Location for door code
        Random random = new Random();

        int x = 0;
        int z = 0;
        int y = 0;

        x = random.nextInt(1000);
        z = random.nextInt(1000);
        y = 150;

        Location randomLocation = new Location(player.getWorld(), x, y, z);
        y = randomLocation.getWorld().getHighestBlockYAt(randomLocation);
        randomLocation.setY(y);

        return randomLocation;
    }```
#

its supposed to be for a plugin that like when u enter a door it teleports u

hybrid spoke
#

first of all, either dont create a new random instance every time or just dont use random

static ingot
#

You should keep a single Random instance instead of making a new one every time. Are you sure your code is making the server lag and not the player?

hybrid spoke
#

second, i see nothing that could lag out. how many times do you execute the method?

static ingot
#

Might be loading chunks

quaint mantle
#

i printed 2 stuff "1" and "2" i put the 1 print before this and the 2 after.

it printed the 1 and then lagged and then printed 2

hybrid spoke
#

and it would be loaded anyways on teleport

quaint mantle
#

i havethis second function:

public static boolean isLocationSafe(Location location){

        int x = location.getBlockX();
        int y = location.getBlockY();
        int z = location.getBlockZ();
        Block block = location.getWorld().getBlockAt(x, y, z);
        Block below = location.getWorld().getBlockAt(x, y - 1, z);
        Block above = location.getWorld().getBlockAt(x, y + 1, z);
        return !(bad_blocks.contains(below.getType())) || (block.getType().isSolid()) || (above.getType().isSolid());
    }
``` that checks if the loc is safe
#

it might be this?

static ingot
loud frost
quaint mantle
#

oh yea i got it confused

hybrid spoke
static ingot
#

e.e

#

lol

#

idk

hybrid spoke
#

where and how many times do you call your method

quaint mantle
#

once

loud frost
#

Do you have a loop calling this on random locations?

quaint mantle
#

Nah

loud frost
#

What kind of lag was it?

quaint mantle
#

i can chat but cannot type commands for a few seconds and then it tps\

loud frost
#

Can it be from teleporting?

quaint mantle
#

I dont think tho.

#

like i said

#

i put a println code

#

that prints 1 and 2

#

i put the 1 before the function and the 2 before the tp

#

it printed the 1

#

and waited

#

and then 2

hybrid spoke
#

so then its the chunkloading and your server is just garbage

#

because this y = randomLocation.getWorld().getHighestBlockYAt(randomLocation); statement loads the chunk you are getting the highest y from

loud frost
#

iirc arnt sys prints slow with plugins?

hybrid spoke
#

nah

#

the only thing which are making them slow in general is the internal synchronized

quaint mantle
#

then i guess i cannot make it not lag?

#

how do rtp plugins stop this lag and instantly teleport?

loud frost
hybrid spoke
#

or use a server software which is more performant

#

or both

loud frost
#

You could try to look at chunks already generated by existing players? and have them rtp, if you really need it to work

#

But that wouldnt really be too random

hybrid spoke
#

but that could grief other stuff

#

waste of ram, less entities in naturally loaded chunks, ...

#

more on what kind of server it is

#

yeah but if you keep xx chunks loaded less entities will spawn which could be a problem for survival server

#

but you could also just redirect the spawnings to natural loaded chunks

#

fuck them

#

be unique

#

dont go mainstream

#

or just dont have entities

#

fake them with packets

#

but handdrawn

quaint mantle
#

is there a way to keep the chunks loaded?

eternal oxide
#

plugin tickets

loud frost
#

Seems like other rtps plugins (the one I checked) does the checking asynchronously as well as chunk loading, then teleports the player. However this means the teleport isn't instantaneous.

wet breach
loud frost
#

My current pom is the working one @static ingot sent

quaint mantle
#

for the people before that toild me to get a better server cause of the lag of the chunk loading just so u know i fixed the problem with the lag

quaint mantle
#

the issue was the getHighestBlockYAt loads chunk at the random cords i generated

loud frost
#

yes

hybrid spoke
#

thats exactly what i said from the beginning on

quaint mantle
#

the fix was to teleport the player to y 5 and then use getHighestBlockYAt to tp him back up

#

it legit fixed the lag

hybrid spoke
#

and will kill players with 0.5 hearts if they get tpt at the wrong tick

quaint mantle
#

so i can make it so the player wont get damaged in that time

hybrid spoke
#

rather teleport them to a really high y

quaint mantle
#

if iteleport them high they will die on tp

loud frost
#

I have no clue

#

🥳

#

👯‍♂️

#

@static ingot @hybrid spoke @ivory sleet we did it

static ingot
#

🎉

loud frost
#

"This plugin is simple quick to make, might as well use this as an opportunity to learn a useful api"

#

3 hours later

static ingot
#

ye, the dev for the command api has a bit of an odd setup - it seems like it literally just indirectly includes the core module anyway x.x
(nvm, it includes some other parts of the project)

#

Don't store your world directly. Use its name or UUID or something.

echo basalt
#

haha memory leak go brr

brisk estuary
#
@Description("{@@command.description.clan}")
#

Does anybody know what's the name of this mechanism (passing a property value directly to an annotation) or how it's done?

static ingot
#

Annotations are basically just fancy interfaces. You're setting a value in that interface when you do that, and it can be accessed via reflection, as is normally done in annotation-based frameworks.

radiant cedar
#

can you make it in a minecraft world so that the whole coordinates change like a certain x y z becomes 0 0 0 and every coord also changes

eternal night
#

not without huge effort on the server level

#

tho look for a plugin, this feels like someone may have already done the work for you

drowsy helm
#

Maybe just annotation variable?

#

Wait no

#

Annotation attribute value

wet breach
#

And sorry for not replying earlier. Am at work lol. Well am for another 15 minutes then I go home

quaint mantle
#

Does someone know how to make a GUI update automatically every second and on click?

#
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getInventory() == null) {
            return;
        }
        if (!(event.getInventory().getHolder() instanceof InventoryMaker.InventoryMakerHolder)) {
            return;
        }
        if (event.getCurrentItem() == null) {
            return;
        }

        InventoryMaker.InventoryMakerHolder inventoryUIHolder = (InventoryMaker.InventoryMakerHolder) event.getInventory().getHolder();

        event.setCancelled(true);

        if (event.getClickedInventory() == null || !event.getInventory().equals(event.getClickedInventory())) {
            return;
        }
        InventoryMaker ui = inventoryUIHolder.getInventoryMaker();
        InventoryMaker.ClickableItem item = ui.getCurrentUI().getItem(event.getSlot());

        if (item != null) {
            item.onClick(event);
        }
        event.getWhoClicked().openInventory((Inventory) ui);
    }```
#

My current code

drowsy helm
#

Use a runnable and re open it each second

#

Although you should only update it when needed, a runnable could be pretty inefficient

quaint mantle
#

Yeah, I want it to be lightweight

#

How do plugins like deluxemenus do it tho?

#

They repeat it every second

quaint mantle
#

because #updateInventory doesn't work in my case at least

sonic goblet
#

Doesn’t it reset the player’s cursor everytime you reopen the inventory?

quaint mantle
#

I haven't tested yet, will do now

sonic goblet
#

When a new inventory opens it resets the player’s cursor to the center of the screen

quaint mantle
#

Yk, idk how to do it exactly without cursor being centered

sonic goblet
#

Idk what you’re doing but why not just use the same inventory instead of trying to open a new one every second

#

And just update the inventory with whatever changes need to be made

quaint mantle
#

you mean with #updateInventory?

#

I tried but it doesn't update it

sonic goblet
#

No I mean just updating the contents

#

You shouldn’t have to use updateInventory

quaint mantle
#

Because u can't just add extra diamond sword for example

#

unless u are talking about itemmeta?

hybrid spoke
sonic goblet
hybrid spoke
#

yes but not explicit

#

it just overwrites the "currently open" instance

#

but doesnt really close it

sonic goblet
#

@quaint mantle see god knows what to do he’ll help you, how kind of him

#

🙂

mint reef
#

I hate to spam, but I asked yesterday and nobody seemingly knew any answers so I will ask again in hopes anyone new sees this:
So I've got a world generator I've been developing for a while and I'm wanting to add structures via Jigsaws. I know how Jigsaw blocks work so none of that will be a problem but I can't seem to figure out how to actually enter data into the jigsaw block on my populate method. I'm just wondering if anyone else has any more experience here. I have already looked at these and they seem to provide nothing:
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/data/type/Jigsaw.html
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Jigsaw.html

hybrid spoke
#

tf is a jigsaw block

hybrid spoke
#

what kind of data?

#

for block related stuff you have the blockstate

#

otherwise PDC

kind hatch
# hybrid spoke tf is a jigsaw block

Jigsaw blocks are similar to schematic files, but have many more drawbacks. They are actually used in vanilla world generation for structures like villages.

hybrid spoke
#

are they new or something?

kind hatch
#

Not really. They've been in the game for a while now.

#

Added in 1.14

hybrid spoke
#

new is for me 1.12+

#

ah

eternal night
#

Cipher living in the future

hybrid spoke
#

always, has been

kind hatch
#

I think the top three things that have been added post 1.12 are

  • Namespaced IDs (1.13)
  • The PDC (1.14)
  • Yaml comments no longer being lost when saved. (1.18.2)
wet breach
#

according to the spec, it is appropriate to ignore comments not belonging to the header block

#

but it is left to the whoever is implementing the spec to handle them how they see fit

quaint mantle
wet breach
#

you can just hold a reference to your inventory object if you have to constantly keep opening it

#

without ever getting rid of it

#

this saves time and resources

bold gorge
#

How can I check if the y coordinate is a block or air?

wet breach
#

in essence it is basically caching

hybrid spoke
wet breach
hybrid spoke
hybrid spoke
quaint mantle
wet breach
#

most of what I put here is from memory XD

#

there fixed 😛

hybrid spoke
#

if its something that only updates on click, then update it on click

hybrid spoke
wet breach
#

There is also things called work too

#

I just got home from work XD

quaint mantle
#

but how to update it on click? I've tried player#updateInventory

#

but it doesn't work anymore

hybrid spoke
#

im currently at work sadge

hybrid spoke
#

you will have to reopen it

quaint mantle
#

event.getWhoClicked().openInventory(event.getClickedInventory());

hybrid spoke
mint reef
#

I spent like 9 hours on this yesterday and I am totally at a loss for it

hybrid spoke
#

i think for those you will have to dig through NMS

mint reef
#

They seem so poorly implemented I am debating just making my own system for it

fluid river
hybrid spoke
#

or at least grant an api for them since they have to be implemented already

#

otherwise they wouldnt work

mint reef
#

christ okay. time to learn nms i suppose

#

I was hoping there would be something implemented I was being silly and missed

rare rover
#

how do i fix this?

#

never really worked with buildtools before

sterile token
rare rover
#

yeah i got the spigot buildtools in my libraries

sterile token
#

Check because maybe you are impottung the spigot api

rare rover
#

ye i am

sterile token
#

Maven right?

rare rover
#

and buildtools is in my libraries

sterile token
#

Oh thst why

tardy delta
#

thats just the api youre importing

rare rover
sterile token
#

Spigot api doesnt co tains thst package

tardy delta
#

remove the -api

rare rover
#

oh-

sterile token
#

Josh

#

Maven doesnt work like that

tardy delta
#

i hope thats the rigth dependency 😳

rare rover
#

also, how would i make multiple versions of NMS? I seen a tutorial but they used the library

sterile token
#

You should replace the spigot-api from porn.xnl into spigot

#

pom.xml*

rare rover
#

well, the default version of my plugin is 1.17 and i wanna support 1.17 - 1.19.2

rare rover
#

oh

#

okay

hybrid spoke
rare rover
#

thanks guys, sorry about the interruption, i've never really worked with buildtools before

sterile token
#

Josh

#

I will explain you

#

When u run build tools its install the Artifacts into local maven repo

#

So you import them thru libraries

#

You just import them vía pom.xnl

rare rover
#

👍

sterile token
#

I mean he was not adding dependencies correct ly

harsh totem
#

How do I do this without it being deprecated?

eternal night
#

check the deprecation notice

kind hatch
#

Pretty sure you need to use PotionMeta

radiant cedar
#

if i have all worlds in a folder how can i use Bukkit.getServer().getWorld()

harsh totem
#

Why does this make an uncraftable potion instead of a normal potion?

                        PotionMeta meta = (PotionMeta) item.getItemMeta();
                        meta.addCustomEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 3*60*20, 0), true);
                        item.setItemMeta(meta);
                        e.getLocation().getWorld().dropItem(e.getLocation(), item);
                        break;```
kind hatch
#

Might be due to the amplifier being 0.

harsh totem
#

0 means 1

#

1 means 2

kind hatch
#

Depends on the method, but if that's how it is then alright.

harsh totem
#

it is still an uncraftable potion

raw epoch
#

Hello ! 😄 Do someone know how to get the first two digits after the "," in a coord loc ? Cause it's doing that in my DB : -146.63253833031763

I do that btw:

preparedStatement.setString(2, loc.getWorld().getName());
preparedStatement.setDouble(3, loc.getX());
preparedStatement.setDouble(4, loc.getY());
preparedStatement.setDouble(5, loc.getZ());
kind hatch
#
ItemStack item = new ItemStack(Material.POTION);
PotionMeta meta = (PotionMeta) item.getItemMeta();
PotionData data = new PotionData(PotionType.WATER);
meta.setBasePotionData(data);
item.setItemMeta(meta);
kind hatch
raw epoch
#

Is this realy the only solution ?

harsh totem
#

@kind hatch thank you

raw epoch
#

if it is, it's pretty ok tho

kind hatch
#

You can store doubles in mysql.

radiant cedar
#

how can I use worlds folder, I did world-container: worlds in settings but still

#

it creates new world folders

#

in server folder

#

and not worlds folder

raw epoch
#

and then SQL round it

#

a bit

#

or cut the last 4 digits

kind hatch
#

Is that level of precision necessary for you? Personally, I doubt it is, so it shouldn't be that big of an issue. However, if you have a reason, please correct me.

raw epoch
#

no it's that i don't want this level of précision xd

#

i only want 2 digits

#

but i found ! round(200.3456, 2);

kind hatch
#

You can define how many digits are stored using the data type.

#

Keep in mind that those parameters are based on digits. A typical minecraft world will have a range of 30 million blocks, so 8 digits should suffice.
DOUBLE(8, 2)

tardy delta
#

cant you cast in mysql?

kind hatch
#

Actually, the MySQL docs say that the first parameter is the total digit length, (including past the decimal place) so DOUBLE(16, 2) is what you would want.

patent fox
#

How can i make entites glow in a player's screen. i am not really good with packets

tardy delta
#

i know postgres has '100'::numeric(3, 0)

kind hatch
tardy delta
#

true

#

just do xx.yyyyyy * 100 and then cast to an int and do / 100 again?

#

xx.yy

full forge
#

Entity result = player.getWorld().rayTraceEntities(player.getEyeLocation(), player.getEyeLocation().getDirection(), 10).getHitEntity(); returns myself, how do i make it so that it doesnt

kind hatch
#

Remove yourself from the list?

full forge
#

but it doesnt return a list?

#

the getHitEntity's uuid is my own

kind hatch
#

Oh, my bad. I thought that method returned a list of entities.

eternal night
#

You should be able to supply a predicate

#

To filter out entities

#

One of the overloads

full forge
#

yeah i just saw a forum post about that right as you sent that

#

ty

wheat dirge
#

hi im new to coding and wanna code a plugin that removes player collision can anyone help

echo basalt
#

it's not that hard

#

well... it depends actually

#

there are 2 ways to make an entity glow

quaint mantle
#

Anyone know a good tutorial on importing entire builds or schematics? (I'm guessing this would be done with the worledit API, which I already have)

echo basalt
#

either the glowing potion effect

#

or just metadata

quaint mantle
#

I mean technically it cant glow properly cus of lighting engine :/

echo basalt
echo basalt
#

FAWE or just worldedit?

#

FAWE -> Clipboard#paste(BlockVector3)
WorldEdit -> you gotta use editsessions

quaint mantle
#

I forget i installed it a while ago

#

in the plugins i have worldedit-bukkit-7.2.12.jar

#

and in maven i have

kind hatch
quaint mantle
#

should I install fawe or just worledit

#

aka which ones easier to paste builds into world

kind hatch
#

FAWE is far more performant, but I'm not sure about it's API. I haven't used it before, but I'm willing to bet it's easier than WorldEdit's API.

quaint mantle
#

This thing I'm assuming

kind hatch
#

Yep, that's the one.

quaint mantle
#

So would I import the jar into the project and plugins folder or just my project

kind hatch
#

You're using maven. Import the dependency and put the jar on the server.

tardy delta
#

worldedit nearly let my raspberry pi burn

#

all threads were trowing an outofmem

#

fawe just gave a bunch of console errors

#

what do you guys think?

#

i wish enums were generic

#

might just make it an enum instead of holding an enum internally tho

quaint mantle
#

I added it here and put a copy in the server's plugins folder

chrome beacon
quaint mantle
chrome beacon
#

That won't work

quaint mantle
quaint mantle
hybrid spoke
#

core

#

bukkit is only "patches" or functionality stuff iirc

chrome beacon
#

Bukkit should contain the adapters as well

#

You'll need them

tardy delta
#

could use plugin singleton too

mental jackal
#

have anyone a free eggwars plugin?

radiant cedar
#

anyone would know why this could be happenning

glass tangle
#

i think it only registers it

eternal oxide
radiant cedar
#

oh

#

i do createWorld then

#

ok

glass tangle
#

just make a copy of these worlds

radiant cedar
#

what

glass tangle
#

to make sure they do not reset for some reason

radiant cedar
#

wait how do I Bukkit.createWorld(WORLDTHATALREADYEXISTS)

#

doesnt createWorld make new

quaint mantle
#

Well I imported it into maven, but IntelliJ doesn't recognise it :/

#

by it I mean FAWE

#

so I can't really code without it

#

anyways I can temporarily import into IntelliJ while I am developing it

hybrid spoke
#

otherwise created

quaint mantle
#

so how do I spawn a schematic into a world using worldedit

hybrid spoke
#

read the docs

quaint mantle
#

effort

hybrid spoke
#

yeah ours to copy n paste from the docs

glass tangle
flint coyote
quaint mantle
#

what is the logic

#

it wants a World passed into the args, but it doesn't 🤔

chrome beacon
#

It wants a world edit world

#

Not a bukkit one

#

You need to use the BukkitAdapter

quaint mantle
chrome beacon
#

Well it's part of the WorldEdit API

#

Don't forget the FAWE bukkit dependency

quaint mantle
#

is this correct?

#

not causing errors

#

idk what that method does

#

honestly if someone could share a link to a tutorial on spawning schematics into the world using WorldEdit, I would love u

tardy delta
#

A as generic type is atleast better than mongos <TItem>

wary harness
#

Can someone explain me in noob way for what is Pattern.quote() used I was looking some code and not sure what is that for

#

xd

#

command = command.replaceFirst(Pattern.quote(type.getIdentifier()), "");

tardy delta
tardy delta
#

i'm wondering if i would have to handle mongodb async or if its quick enough to be executed sync?

wheat dirge
#

hi im new to coding and wanna code a plugin that removes player collision can anyone help pls

chrome beacon
crystal salmon
#

Hi, since 1.9, player#getInventory returns the inventory content, with items in mainHand and offHand? I'm doing 1.8 plugin and I'm want to be secure that's work

remote swallow
#

like actually pasting it throughcommands or api

unreal sandal
#

Hello, I code on Intellij and I imported an external library but when I build the program, I have an error and it's written : package "mypackage" does not exist

#

Someone can help me please ?

quaint mantle
#

also I'm getting package com.sk89q.worldedit does not exist

#

I copied this stuf

remote swallow
#
<dependency>
  <groupId>com.fastasyncworldedit</groupId>
  <artifactId>FastAsyncWorldEdit-Core</artifactId>
  <scope>provided</scope>
</dependency>
#

think thats missing

quaint mantle
patent fox
#

i have this code in a bukkitrunnable but the armor stand is moving very fast and i dont know how to make him slower

Location dest = armorstand.getLocation().add(armorstand.getLocation().getDirection().multiply(1));
Vector vector = dest.subtract(armorstand.getLocation()).toVector();
missile.teleport(armorstand.getLocation().add(vector.normalize()));
quaint mantle
#

Well the Bukkit Runnable you should be running once every x ticks, which is shown by the number. 20 ticks per second, play around with that number appearing at the end of the runnable declaration

#

How do I properly import FAWE into my project

patent fox
#

yes but the animation wont be smooth

eternal oxide
#

You are modifying the location twice

#

add teh directional vector to the location once

#

normalize teh direction and multiply by a fraction to make the jumps smaller

quaint mantle
#

I tried creating a class:

public static void spawnSchematic(String fileName, Location loc, World w) {
        try{
            File sFile = new File(Housing.inst.getDataFolder().getAbsolutePath() + "/" + fileName + ".schematic");
            ClipboardFormat format = ClipboardFormats.findByFile(sFile);
            ClipboardReader reader;
            reader = format.getReader(new FileInputStream(sFile));

            Clipboard clipboard = reader.read();

            try {
                com.sk89q.worldedit.world.World adaptedWorld = BukkitAdapter.adapt(w);

                EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(adaptedWorld, -1);

                Operation operation = new ClipboardHolder(clipboard).createPaste(editSession)
                        .to(BlockVector3.at(loc.getX(), loc.getY(), loc.getZ())).ignoreAirBlocks(false).build();

                Operations.complete(operation);
                editSession.flushSession();
            } catch(WorldEditException e) {
                Bukkit.getLogger().info(ChatColor.DARK_RED + "There was an error spawning in a schematic, please contact an administrator.");
                e.printStackTrace();
            }
        } catch(IOException e) {
            //
        }
    }
``` This class should spawn in a schematic at the specified location, but it doesn't. No error message, no output, nothing. So I was hoping if someone could help me out. First time using the world edit API. This is the resource I was using: https://www.spigotmc.org/threads/1-13-load-paste-schematics-with-the-worldedit-api-simplified.357335/
unreal sandal
quaint mantle
#

yes

#

I added the dependencies required for the core-bukkit not just the core

unreal sandal
#

Okay good because I just managed to fix it so I asked you to help you if you want, but you managed to fix it too, so it's good 😄

quaint mantle
wheat dirge
#

Wait

#

I can show you what I’ve tried

unreal sandal
wheat dirge
tardy delta
#

hmm is there a reason to use the schedulers threadpool instead of the cf common pool to do cf::runAsync?

#

to not clog it up ig but im not querying it often

hybrid spoke
#

but every other plugin could be

elfin atlas
#

Hey is there a way to check if a player was standing for 5 seconds on a Pressure Plate if yes how?

hybrid spoke
elfin atlas
worldly ingot
#

PlayerInteractEvent

#

The action is PHYSICAL

elfin atlas
#

Okay thanks

hybrid spoke
naive bolt
#

Could not find method maven() for arguments why does this error happen when refreshing gradle

#
    maven("https://repo.codemc.io/repository/maven-public/")
}```
found out that ` maven { url 'https://repo.codemc.io/repository/maven-public/' }` works
mighty pier
#

i wanna make a gui where you can upgrade items like a pickaxe, sword, axe and each tool tier would have better and better enchants

#

how could i do that

#

i dont have any good ideas

summer agate
fallow violet
summer agate
#

server == egg

quaint mantle
#

Hey guys, Is there a way to save pdc data (Item PersistenceDataContainer) on config as a string? Something like this
I success to save & load default item data but I don't know is it possible to save the other data

eternal oxide
#

The point of a PDC is you don;t need to save it anywhere else

quaint mantle
#

Oh

#

Soo that mean it always saved on itself?

radiant cedar
#

why wont this actually save the location

#

do i need to set section to yml or something

vale ember
#

Why are you using getX on every line?

radiant cedar
#

oh shit forgot to change

#

but still

#

doesnt save

#

oh fr

#

how do i read and write

#

oh ok

#

ok

#

wait so it saves world too

#

damnn

#

ty

#

@last temple

#

can i not do this

#

it doesnt even create the file anymore

remote swallow
#

are you creating it onEnable

radiant cedar
#

no

#

onjoin

#

huh

#

the others always worked

#

cus im just doing default when they join it just worked so i kept doing it

#

now it doesnt work idek

#

oh lmao

#

i wasnt listenint go onjoin

#

so it never triggered

#

do u know why this defaults i have could not work tho

#

wait it does work

#

wth

wheat dirge
#

but that didnt work

#

What

#

xD

chrome beacon
#

At least explain the code and what they did wrong

quasi patrol
#

Ello. So I’m tryin to dispatch a command from a discord bot, but only issue is you kinda need to have the bot on a different thread or else it would just freeze the server, but dispatch command has errors if it isn’t on the main thread soo.

#

I used Bukkit.runTask which made it work, but still has the errors.

stone light
#

Running my plugin on a localhost and it throws this error org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
as well as Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml I've checked my jar in winrar and the plugin.yml is in there. My plugin.yml is as follows

main: me.nightterror.hungergames.Main
version: 0.1.0
load: STARTUP
commands:
 kit:
   description: Select your kit to play with.
   usage: "Correct usage: /kit <kitname> or /kit list"
 target:
   description: Assassins can use this to select which player their compass targets.
   usage: "Correct usage: /target <playername>"```
Does anyone know why I'm getting this error?
#

its in my src folder, is that correct?

remote swallow
#

resources folder

#

src/main/resources

stone light
quasi patrol
remote swallow
stone light
#

yeah maven

#

tried putting plugin.yml in the root directory and it failed

stone light
#

Maven is literally just ignoring the other directories?

split atlas
#

is there any way to change the config of the .yml file to allow tnt duping on servers?

vocal cloud
split atlas
#

Well, that is the question at hand, the server I have is a spigot not paper server I know paper.yml file has an allow-piston-duplication but after going through spigots.yml file that is not an option I am wondering if there is a way to allow for piston duplication through spigot.

vocal cloud
#

If it's not an option you'd need a plugin to allow it.

fierce heath
#

Hello,
I'm using Spigot's multiworld feature to host a Minecraft server and I ran into a bit of an issue with the nether

For example, I have 6 worlds:
world1
world1_nether
world2
world2_nether
world3
world3_nether

In my plugin i have a command to switch between them and they all work fine, the issue is when I try to use a netherportal in world2 or world3, it defaults to going to world1_nether and then when I go back it brings me to world1. Is there a way to have it so each world goes to it's corrasponding nether (so world2->world2_nether etc.)
Any help would be greatly appreciated!

balmy valve
#

Anyone know how I would go about checking if a chunk is loaded?

river oracle
#

simply setTo to another demention?

#

idk if that will work very easily, but its some semblance of a solution

#

that'd be where I'd look to start atleast

river oracle
white dew
#

Hi guys, is there a way to make so drinking milk doesn't delete potion effects?

river oracle
sonic goblet
#

Copy the effects when the milk is drank and reapply them afterwards, or cancel and delete the itemstack

#

^

fierce heath
white dew
#

I'm making a plugin where drinking milk gives you different powers

#

and there are a lot of types of milk

#

the problem is that drinking milk type X is cancelling drinking milk type Y

#

so maybe I can cancel the event and replace with a empty bucket, and at the same time apply the code that will run with PlayerItemConsumeEvent

#

to give the power

river oracle
#

I'd save the bucket item stack to a var cancel and remove than use the item stack var to check things like pdc etc

white dew
#

makes sense 🤔

#

thank you

#

I will try It

river oracle
#

np

toxic haven
#

How can I print out all of the args except for the first one?

stuck flax
#

If there's a yaml file in the servers root directory, how can I read it?

white dew
#

thank you

#

now I won't have to do some ugly fix 😅

sterile token
wary topaz
#

if(!Objects.equals(iteminhand, new ItemStack(Material.AIR))) {
iteminhand is player.getItemInHand-- How would I make this work?

wary topaz
#

omg ty

vocal cloud
#

Ugh object.equals

wary topaz
#

it was intellij suggestino

#

suggestion

vocal cloud
#

Yes intellisense is not intelligence

raw prairie
#

How might I use ASWM to unload a world, delete the world, copy a world from a save and repeat

#

when games end

river oracle
fierce whale
#

?paste

undone axleBOT
fierce whale
#

does anyone know about this error?

#

My console is being bloody 😭

vocal cloud
#

Every few weeks someone complains that an Object.RequiresNonNull throws a NPE

river oracle
#

lmao

river oracle
#

it requires setup and configuration

vocal cloud
#

Yeah but it hopefully doesn't give the terrible recommendations like Objects.equals

river oracle
#

no it doesn't

#

sonar lint doesn't like Object#equals iirc

#

i'd have to recheck but yea I'm pretty sure

#

nvm sonar lint won't yell at you, but it won't yell at you for not using it

wary topaz
#

So in my config.yml how would I access the permission under "More"
Permissions:
more:
permission: betterserver.permissions.more

#

this.plugin.getConfig().getStringList("Permissions") or this.plugin.getConfig().getStringList("more") I dont know if the 2nd one will work

remote swallow
#

"Permissions.more" as the path

wary topaz
#

thanks

river oracle
vocal cloud
#

It's easier to just laugh at the people doing Objects#whatever

desert loom
#

what's wrong with Objects?

vocal cloud
#

most people use it wrong

fallen bloom
#

is squishing mob models a thing

#

or is it mod exlusive

frozen dune
#

is there a way to raytrace with a specific decimal hit vector rather than blockpos

#

that already exists and not me having to steal MC source code

granite burrow
#

How can I tell where a splash water bottle lands? In the PotionSplashEvent when its a water bottle none of these work:
PotionSplashEvent#getEntity() returns the slash potion
PotionSplashEvent#getAffectedEntities() returns an empty collection
PotionSplashEvent#getHitBlock() returns null

jagged monolith
worldly ingot
#

Yes. That's how you would do that

#

getEntity().getLocation()

granite burrow
#

I'm so dumb

hard pebble
#

any solution to get rid of this deprecation

eternal oxide
#

?jd-s Attributes

undone axleBOT
fleet falcon
#

i don't blame you but learn reading docs

mighty pier
#

to read*

eternal oxide
#

both are correct

mighty pier
#

no

#

reading is wrong

#

form

eternal oxide
#

it may sound a little odd, but it's correct

mighty pier
#

ok

fleet falcon
hard pebble
#

lol

fleet falcon
#

english is not my native language let me know

hard pebble
fleet falcon
#

what

kind ridge
glad prawn
#

🤓

mighty pier
glad prawn
#

Learn to eat docs 🤓

worn tundra
#

i ated the docs

mighty pier
#

you edited it

#

and its still wrong

round finch
#

learn to feed the ducs

tardy flame
#

Why can't we just say "read docs before you ask questions"

onyx fjord
#

read le docs innit bruv

round finch
#

are your keyboard broken?

onyx fjord
#

tek

small current
#

im sending a block change to 4 locations but one of them are not being changed

#

i ensured the position being correct by sending some glowstone change around it

#

sometimes its not showing

hazy parrot
#

Share code?

small current
# hazy parrot Share code?
    public void highlight(Player player, Material material) {
        Scheduler.runTask(() -> player.sendBlockChange(toLocation(), material.createBlockData()));
    }
#

now its two of them

#

this only happens with gold blocks

elfin pilot
#

anyone have any good tutorials on worldgen? does spigot allow the use of datapack biomes when generating chunks?

#

sorry to cut into the current discussion

pallid oxide
elfin pilot
#

lol will do, i found a pretty decent forum post that helped me generate this

#

ah, right, i can't post images

#

but i am trying to populate the world with one or two custom biomes that i made in a datapack

#

googling around seems to indicate that it isn't possible

#

thought i would also check here

radiant cedar
#

whats the best way to setup plots in a world, shold i check everytime a player places a block if the block is in their plot

#

and when claiming a plot should i check with every plot in a file, if the plot intersects with any other ones

#

oh nvm ill replace outer blocks with certain block and if a block is that block i wont let it do

fallow violet
#

what is the replacement for World#GetWorldType()?

undone axleBOT
fallow violet
#

damn

#

okay its fine i found another way

#

why is this not firing?

pine forge
#

Hey, I want to check if the player is looking at the moon.
Does anyone know how I can calculate a Vector for the moon position using the ingame time?

kind hatch
#

AFAIK, the moon is stuck on an axis. The only time it's not is with texture packs and or shaders. (Offsets and what not)
Are you sure you need to use vectors? Or is the player's pitch not enough?

pine forge
pine forge
#

Correct me if im like completely offroad

pine forge
#

okay ill try that out

#

Thanks :D

pine forge
# kind hatch More or less.

The sky is apparently offset by about 10 degrees causing the sun to appear at exactly 22925 and the moon to appear at 12575

#

but only sometimes

#

idk

quaint mantle
#

how do i spawn in a schematic with world edit? anything I've seen is very outdated, using deprecated functions, and non-existent functions 😦

#

I have FAWE

#

so what am i missing?

desert loom
#

Check your Vector import.

quaint mantle
#

from java.util, guessing that's wrong 😛

desert loom
#

I think you're looking for the Bukkit one

quaint mantle
#

yes i imported that now

#

except paste requires a BlockVector3

#

so why was that thread using Vector

desert loom
#

was from 2019 so maybe the method changed since then

quaint mantle
#

@desert loom do you have a link to an updated version? ive spent like 2 hours searching

desert loom
#

I haven't used that plugin/api before so I don't sorry

#

not sure if this is what you're doing though

quaint mantle
#

i have that importing now

desert loom
#

no problem

quaint mantle
#

ok I have 2 versions of spawnSchematic I'll test them both soon

#

yes i added that to the 1st method after seeing in a random thread

pine forge
# kind hatch More or less.

Okay so this is what I have so far:

long time = player.getWorld().getTime();

//Check if night time
if(time < 12000 || time > 24000) break;
//Check if players yaw is on moons "orbit"
if(Math.abs(player.getLocation().getYaw()) < 85 || Math.abs(player.getLocation().getYaw()) > 95) break;
double moonAngle = getMoonAngle(time);
player.sendMessage("Moon angle: " + moonAngle);
if(moonAngle > 90) {
    if(player.getLocation().getYaw() < 0) break;
    moonAngle = 180 - moonAngle; // Moon Angle should always be between 0 and 90
}
else if(player.getLocation().getYaw() > 0) break;

if(Math.abs(Math.abs(player.getLocation().getPitch()) - moonAngle) < 5) {
    player.sendMessage("You are looking at the moon!");
}
    public static double getMoonAngle(long time) {
        time = time % 24000; // 24000 ticks in a day
        return time / 24000.0 * 360.0 - 180;
    }

Problem being that the night is shorter in minecraft causing the actual moon angle to be off by about 10 degrees sometimes. Do you know how to factor that in? (or anyone else)

#

Sun can be seen for 11 minutes, the moon only for 9 minutes

old cloud
#

I guess you should reduce the range to these 9 minutes then

kind hatch
#

That's the thing, their time range is just fine.

old cloud
#

if(time < 12000 || time > 24000) break; is more than 9 minutes right