#help-development

1 messages ยท Page 349 of 1

sterile token
#

Lmao you are treating me like a dumb

#

Will do what ever they implement

wet breach
#

not sure why there is confusion in how to handle your own objects

sterile token
#

What is the best way for retriving the data form the packet? Using an event-listening system or something more simple, like a run(Packet packet) method

wet breach
#

same way you send packets

#

I think you mis-understand the events

#

the events purpose isn't for retrieving data

orchid gazelle
#

if you want to do xy with the Object directly, just execute it on Constructor

wet breach
#

the purpose of them is after you have your data, you want to notify things of this data as they may want to do something with it

sterile token
#

Yeah that is what im trying to figure the best way

wet breach
#

so, the obtaining of the packet, and parsing its data should be kept with the rest of the packet stuff until you get your object, then if you want stuff to be notified of it you would execute your events with the data part of the event

sterile token
#

that is what im confused and dont really know what to chose here

wet breach
#

I am not sure why this is even a choice to you

#

regardless of which you do, you still need to parse your packet

sterile token
#

Atm i harcode like this, using Json to test

wet breach
#

the only optional thing here is whether you want to setup an event system or not

tepid tide
#

Hi, I'm making a plugin for an UHC and there are several things I have to do with the plugin but I couldn't figure it out even with some tutorials, maybe someone can help me, I need to create custom death messages and chats a bit specific
Context of custom chats
||I have to do 3 chats, because it is a 6vs6 UHC with couples there will be 3 different chats, 1 will be global, I want to use an @, for example when putting "@Who died?" is displayed for all 12 players. Then for teams of 6 with the use of !, that by putting for example "!Where do we meet?" it will only be sent to those 6 of that team, and that by simply not putting anything it is only shown to your partner. Thank you very much in advance. If anyone knows of a plugin (for 1.16.5 in spigot) that allows me to do that, I would greatly appreciate it.||

wet breach
#

this is help development

tender shard
#

what the heck is an UHC

sterile token
#

Frost did know i explain what i need?

tender shard
#

is that some kind of electronical device lol

sterile token
tepid tide
tender shard
#

no

wet breach
#

you still have to parse your packet regardless

tender shard
tepid tide
#

sorry, where should I ask for help?

tender shard
#

for help about plugins, you should ask on the plugin's discord

sterile token
tender shard
#

or in #help-server but the chance that anyone here can help is small

tepid tide
#

I am trying to make the plugin by myself tho. Thanks

wet breach
tender shard
#

oh then you're right here

wet breach
#

an option you can do is make use of conversation api

tender shard
wet breach
#

it isn't required but you might want it if you are making an API as it makes it easier for those that might need to do something with that data

tepid tide
sterile token
wet breach
#

that is up to you

#

that isn't something for us to decide for you

sterile token
#

ik but im asking for recommendations ๐Ÿ˜‚

tender shard
wet breach
#

its not like using an event system is unefficient or anything

#

it just depends on what you are wanting, what you are comfortable in using

#

etc

tepid tide
tender shard
#
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
  String message = event.getMessage();
  if(message.startsWith("!")) {
    // Do your global chat stuff
  } else if(message.startsWith("@")) {
    // Do your team chat stuff
  } else {
    // Do your normal chat stuff
  }
}
#

sth like that

sterile token
#

right, thanks and sorry for losting your time and also you too DaeFist

misty ingot
#

E.

#

that moment when you got several unique ideas but are too lazy to start making any of them

sterile token
misty ingot
#

nobody

#

I answer myself

sterile token
misty ingot
#

I am making a minigame and I want to let the user define play regions for each team which the team will not be able to get out off while in a match, is there any effective way to do this without worldguard/worldedit api(s)?

sterile token
#

So then i dont depend on third parties libs or apis

#

As far you should only code on newer versions, you can make use of BoundingBox

misty ingot
#

yeah I only plan on making 1.13+ plugins

#

I'll look into BoundingBox, thank you

#

the thing is

#

I actually want the player to select a 2D region, which would be the floor of the play area

#

and then the "box" will cover infinite height

humble tulip
#

well use a cuboid but ignore the y

#

or bounding box or whatever

sterile token
humble tulip
#

yeah

sterile token
#

minion are u free bro?

#

I need to talk with you i have some questions to do but im really confused

humble tulip
#

kinda busy atm

#

just ask and i'll respond

sterile token
#

hmnn ok i will wait once you are free, because its something really confusing

wooden hearth
#

Hello, I'm not sure this is the right channel but I was wondering how would I make my API compile inside other plugins from my local files thank you. I'm using Maven.

jagged monolith
#

Add the project in your dependencies and it should pick it up if it's in your .m2 local repo for maven. If not you may need to do a mvn clean install for the api to add it to your maven local repo

wooden hearth
#

Alright thank you ๐Ÿ™‚

hardy pollen
#

Hi i want to make pig npc will attack player using EntityCreature use

this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(10.0D);

but it got this error Cannot invoke "net.minecraft.server.v1_16_R3.AttributeModifiable.setValue(double)" because the return value of "org.nightmcc.bosses.mcs.CustomEntity.getAttributeInstance(net.minecraft.server.v1_16_R3.AttributeBase)" is null

#

can someone help?

icy beacon
#

I guess pigs don't have that attribute ๐Ÿ˜„

#

maybe you need to create the attribute & add it to the entity somehow before setting its value? I'm not really versed in attributes

misty ingot
hardy pollen
hardy pollen
icy beacon
misty ingot
#

I mean, I can certainly do some damage

icy beacon
#

emotional damage

misty ingot
#

exactly

icy beacon
#

๐Ÿ˜ณ

hardy pollen
sullen marlin
#

Also use the API for attributes

misty ingot
#

is there a way to make it so a prefix is automatically attached to all messages that the plugin sends to players? my plugin has tons of messages and I dont want to manually add "prefix +" to all of them

wet breach
#

sounds like a design problem

misty ingot
#

well, what other way can I use to send messages to players

wet breach
#

you could design your plugin to pull strings from a file you configure

#

so that it isn't hardcoded completely, or design the messages to check like a message manager for the messages to send

#

but in either case neither of these are going to get around the fact you just might have to re-design how you are doing it so as in the future it isn't difficult to change it later

#

that is, should have made it dynamic in the messages to begin with

#

sometimes, you have to break things to make them better

misty ingot
#

the strings arent hardcoded yeah

#

thinking about it however, I could make one function which takes in the player to send the message to, and the message and that function would automatically attach the prefix and all

#

and if I want to make any changes to all the messages, I only have to change one line of code

#

the messages themselves are grabbed from a file

remote swallow
#

Utils.sendMessage(player, message)

#

just append the messasge there

#

or the prefix

misty ingot
#

Utils who?

remote swallow
#

Utils you

past wedge
#

Hello, I'm trying to apply skins to npc using citizens API, but doesn't spawn the skin i'dd want. Here is my code:

NPCRegistry registry = CitizensAPI.getNPCRegistry();
NPC npc = registry.createNPC(EntityType.PLAYER, "npc test");
World world=Bukkit.getWorlds().get(0);
Location loc=new Location(world,-41,200,-120);
SkinTrait skinTrait = npc.getTrait(SkinTrait.class);
skinTrait.setTexture(...,...)
npc.spawn(loc);
past wedge
#

and I do setTexture after ?

chrome beacon
#

Yes

icy monolith
#

Are all veriables saved for ever? like if i set a veriable: x to a location. Will that location stay saved in x even after restart or updating the plugin?

chrome beacon
#

No

icy monolith
#

if not how do i make it save for ever

chrome beacon
#

You will need to save and load it from a file

icy monolith
#

so save in a file and then load from that file?

remote swallow
#

if its never gonna change you can probably re-make that variable on enable

past wedge
#

Doesn't work, it's not the skin I want. What are the texture signatures and values ? :/

chrome beacon
#

So it does add the skin?

past wedge
#

The skin I want is a dwarf picked from mineskin, instead, I get a black woman

#

no joke

chrome beacon
#

Send the link to that skin

past wedge
chrome beacon
#

Looks fine now show your code

past wedge
#
NPCRegistry registry = CitizensAPI.getNPCRegistry();
        net.citizensnpcs.api.npc.NPC npc = registry.createNPC(EntityType.PLAYER, "npc test");
        World world= Bukkit.getWorlds().get(0);
        Location loc=new Location(world,-41,200,-120);
        SkinTrait skin=npc.getOrAddTrait(SkinTrait.class);
        skin.setTexture([value copied from mineskin],[signature copied from mineskin]);
        npc.spawn(loc);
chrome beacon
#

Send the exact thing

#

Don't replace things

past wedge
#
NPCRegistry registry = CitizensAPI.getNPCRegistry();
        net.citizensnpcs.api.npc.NPC npc = registry.createNPC(EntityType.PLAYER, "npc test");
        World world= Bukkit.getWorlds().get(0);
        Location loc=new Location(world,-41,200,-120);
        SkinTrait skin=npc.getOrAddTrait(SkinTrait.class);
        skin.setTexture("ewogICJ0aW1lc3RhbXAiIDogMTY1NDgzNDA4NTUxNCwKICAicHJvZmlsZUlkIiA6ICJmNTgyNGRmNGIwMTU0MDA4OGRhMzUyYTQxODU1MDQ0NCIsCiAgInByb2ZpbGVOYW1lIiA6ICJGb3hHYW1lcjUzOTIiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWQxMWU3OWZmMjk2ZDZmYTdlNTc5Y2U5NjE5ZWVkZjM3OGJlMGJjODNkYjZkOGI3NWVlMzBhOTQ4NDg5ZGZmZCIKICAgIH0KICB9Cn0=","uVSLHxoBBBWOGLOuVmm/u8/jhFoZsjlxIew4Ah/CwGMJY32hCD+bns/CSk+gjq34Tb0WyUpcdcwtYp1S6ejE5EV/34O7O1/R5neIEJKYzHJx3MoJjU2eCE9cB/zsuDnjHl7Kwz7MW1Yv7StcUaXaXirjHv3JjERxda+76kPVnA9bJ7wdP4N5DptCUuh9OIjwWR4ZCxX9DOD3yzmvdTjidfczcToAnrOumLGvZTGlfSESY9MUBgkfZM75sKGpgH9dgGC0pKE4AMi8BmbtvbnByWdqOGHzA91E9GccVqr1UUikO7f73suJaO303pF52jyIfMxxr2jY5fvhMbv5x+GdYmJdfYGOpFeJ/ud1GMhW+QR8bjYKX8bTipmmDCsTvIeRCclr4Pfz69iYILemwjsZDSN0sLN2gb2zFaFr6sDXSt39LyvBgINBdhSjbfsFRJ5Yn64Y3ejJ1GzvVtvK0+ZcY3WouX/jEpMCwoVn0ew7UGfoG/HedlrxC3gBhW3W0Rw+LwxfGh5Cj5XgrhFlXLzYherMHK0YbPIBSrp+dU5u81wQABswUfreJVShFcrH+XCtfvO4C4rHqF463HR1pGQXPKIXjTQrSRW7iv6AaDENuIwBp7kMQGz2JR6PZn9QUWp1Slcg9THKg3oQtCJWvBqS7xLD75b+RSyjqGO//sq90Mc=");
        npc.spawn(loc);
chrome beacon
#

hm looks fine

past wedge
#

you got the right skin ?

#

because when reloading the server, it changes skin

#

now it's a sort of mage women

chrome beacon
#

I haven't tested the code but the skin texture value is correct

past wedge
#

I feel like my server has dementia lul

chrome beacon
#

You can decode the texture value since it's base64

#

in it is the link to the skin you want

#

I haven't verified the signature though

#

Try setting fetchDefaultSkin to false

past wedge
#

"Expected 0 arguments found 1" what

chrome beacon
#

The method name is setFetchDefaultSkin

#

fetchDefaultSkin will get the value

past wedge
#

oooh

#

ima try that

#

default steeve skin

#

oh wait

#

nope, still steeve

vivid skiff
#

How can i add multilanguage support in to my plugin?

chrome beacon
#

Depends on how you want it to work

#

Do you want a resource pack with language files?
Do you want to detect the client language and show that?
Or do you just want a simple setting?

#

Also what version are you making the plugin for

vivid skiff
#

I created a folder containing all the differtent language files, ad just whant to get the file with the language and the strings from it

chrome beacon
#

I assume it's a yaml file

vivid skiff
#

yes

chrome beacon
#

so use the config api

vivid skiff
#

But how can i make it create the folder with the files, like the default config?

chrome beacon
#

?configs

undone axleBOT
remote swallow
#

new File(JavaPlugin.getDataFolder(), "folder").mkdirs

chrome beacon
#

Let them read the wiki

vivid hill
#

what is the @Transient methode from kotlin in java?

chrome beacon
#

Java has the transient keyword

vivid hill
#

ohh ups

ivory sleet
#

IntelliJ iirc has a way to convert kotlin to java, but also java to kotlin

chrome beacon
#

Yeah it does

#

but it's quite bad

ivory sleet
#

Ye but wouldnt say the transpilation is too bad

past wedge
#

Adding skins to npc using citizens API

eternal ivy
#
p.getWorld().getBlockAt(p.getLocation()).setType(Material.BIRCH_SIGN);
Sign sign = (Sign) p.getWorld().getBlockAt(p.getLocation()).getState();
sign.setLine(0, "line");

It doesn't work

#

setLine()

remote swallow
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

eternal ivy
#

Bruh I can't upload an image

remote swallow
#

?img

undone axleBOT
eternal ivy
#

the setLine() method has gone

remote swallow
#

check if .line is a thing

#

if it is, use spigot api not paper

eternal ivy
eternal night
#

that is just the wrong import

#

has nothing to do with paper or spigot ๐Ÿ˜…

eternal ivy
#
import org.bukkit.block.data.type.Sign;
eternal night
#

you are importing the block data Sign not the block state Sign

#

yea

eternal ivy
#

Ah

#

Thx

onyx fjord
#

in BlockFromToEvent can i somehow get the original water source?

#

im figuring out who placed it

wary harness
#

So what are you fine people talking about?

#

on this wonderful Sunday

onyx fjord
wary harness
elfin atlas
#

How would I'll be able to shot particles like this?

#

So is there basically a way to give them a direction?

astral condor
#

What happened to event?

molten hearth
molten hearth
#

you didnt define it

astral condor
molten hearth
#
public void onSomeEvent(@Notnull EventName event) {```
#

you're missing the event on the right of PlayerJoinEvent

#

also I could be tripping but I think its @NotNull

molten hearth
#

I dont use notnull so not sure

#

np

onyx fjord
#

ij always tells u what to use

lofty laurel
#

how would you set the maximum enchant level for a certain enchantment table? for example i open an enchantment table via a gui, how would i be able to manipulate the maximum enchantment level

wet breach
#

ij gives bad advice

onyx fjord
#

idk i dont use annotations anyway

molten hearth
#

same lol

#

i only use them for ACF

onyx fjord
#

it makes a mess

wet breach
#

well it also suggests using notnull method thing too

onyx fjord
#

imagine annotating every parameter

#

you double your line length

#

what is it for anyway?

#

ides right

molten hearth
#

cant comments to the same

wet breach
#

which is annoying when some people come here with problems, and its an NPE but because they used that requireNonNull or notnull or whatever it is, it hides the problem as some other problem instead of an NPE lol

dry yacht
lofty laurel
#

alr ty

icy monolith
#

?paste

undone axleBOT
onyx fjord
#

frost, or someone else do you maybe know how to get the water source for BlockFromToEvent?

quiet ice
#

@NotNull shouldn't do anything on it's own - but IJ could be doing some shenanigans there

buoyant viper
#

ie. annotating a method with Nullable, it lets other devs know a method or field can return null when accessed or invoked, so they can properly handle it

onyx fjord
#

it ruins the fun

#

does java have its native Multimap?

buoyant viper
#

those annotations are also in reference to something by the Java team themselves iirc, its JSR-305 i believe

hazy parrot
#

also its cool if you use java library in kotlin for example, string defined with @NotNull will be String, otherwise it will be String!

quiet ice
dry yacht
onyx fjord
#

now another thing i need to know who placed that source

#

im afraid of memory leaks long term tho

buoyant viper
onyx fjord
#

i'd need to keep track of each water placed by player

dry yacht
buoyant viper
#

theyre like a specification AbsoluteHalal

quiet ice
#

Mojang uses them for example, but pretty much every mod loader remaps them to IJ annots

onyx fjord
#

when entries are broken?

quiet ice
buoyant viper
#

ye

buoyant viper
quiet ice
#

eclipse also has their own annotations but even as an eclipse user I don't use them

onyx fjord
#

native would be the best lmao

dry yacht
# onyx fjord ive never used that, what if for example the water flow takes ages

Not completely sure what you mean :-: You just want to know which player made a block break by water, right? So make a WeakHashMap<Block, Player> entry in PlayerBucketEmptyEvent and then, in BlockFromToEvent, follow the water until you find a source block, check if it's in that map, and if so, you got the info you need. If the block get's garbage collected, the entry will just disappear from the map. If you're afraid that a player might destroy the source before the flow reaches the destroyed block, use a custom implementation of the weak map which stores the entry for x more ticks, I'm sure there's a way to do that. Otherwise, you could also listen for destroys of that water-block yourself and remove the weak-concept all together. Just some ideas, you'd have to experiment on that yourself.

onyx fjord
#

otherwise we have a shit ton of implementations

lavish wing
#

Guys pls help me.Why this code didnt send me a messages in discord?
https://paste.md-5.net/ikaxoxugip.java

15:06:19 [INFO] DiscordSRV enabled! Sending discord message...
15:06:19 [SEVERE] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
15:06:19 [SEVERE] SLF4J: Defaulting to no-operation (NOP) logger implementation
15:06:19 [SEVERE] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
15:06:21 [SEVERE] SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder".
15:06:21 [SEVERE] SLF4J: Defaulting to no-operation MDCAdapter implementation.
15:06:21 [SEVERE] SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details.
15:06:21 [SEVERE] [Server thread] INFO JDA - Login Successful!
15:06:22 [SEVERE] [JDA MainWS-WriteThread] INFO WebSocketClient - Connected to WebSocket
#

Im trying to make DiscordSRV for infdev 20100618 (Ported poseidon project)

onyx fjord
#

๐Ÿ’€ for what

lavish wing
#

So

#

Why it message didn't send?

onyx fjord
#

i have no idea, might be a good idea to talk with ppl at discordsrv

#

Does it matter if map/list is initiated in class or in constructor?

chrome beacon
#

Usually no

astral condor
#

what happened

tall dragon
#

version mismatch

#

ur plugin has been compiled on a more recent version

#

downgrade ur compiled version or upgrade your java version ur server runs on

astral condor
#

thank you

dry yacht
eternal ivy
#

how to compile .jar to plugins folder directly to use pom.xml

buoyant viper
#
    private final Map<String, String> headers = new HashMap<>() {
        {
            put("Connection", "close");
        }
    };```
#

initializing with a preset key/value AbsoluteHalal

buoyant viper
#

oh wait

eternal ivy
#

yes

buoyant viper
#

specify outputDirectory in like

#

maven-jar-plugin configuration

eternal ivy
#

yeah I tried it but

#

cause error

buoyant viper
#

what error

eternal ivy
buoyant viper
#

try using version 3.3.0 (current latest)

eternal ivy
#

same

quiet ice
#

send full pom then

eternal ivy
#

ok wait

#
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mng.minecraft</groupId>
    <artifactId>MinecraftPlugin</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>MinecraftPlugin</name>

    <description>Minecraft plugin</description>
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <url>https://github.com/%github%</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>16</source>
                    <target>16</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <outputDirectory>%mydirectory%</outputDirectory>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.19.3-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
misty ingot
#

is there a way to asynchronously wait for a player to type a specific phrase in chat inside a method?

#

I am trying to make a setup system for my minigame plugin

buoyant viper
#

the Conversation api might have something of use

misty ingot
#

so if the player types "done", it completes that part of the setup and moves onto the next

weak kayak
#

have you considered AsyncPlayerChatEvent

#

you could do something with that

misty ingot
#

Inside a method?

weak kayak
#

oh

eternal ivy
quiet ice
#

And clean caches and stuff

buoyant viper
eternal ivy
misty ingot
#
if (data.getString("setup-stage").equalsIgnoreCase("set map spawn")) {
            // send message
            player.sendMessage(plugin.setup_messages.get("SetMapSpawn"));
            // wait for player to type "set" in chat
            Bukkit.getPluginManager().registerEvents(new Listener() {
                @EventHandler
                public void onChat(AsyncPlayerChatEvent event) {
                    if (event.getPlayer().equals(player)) {
                        if (event.getMessage().equalsIgnoreCase("set")) {
                            // set spawn
                            data.set("spawn", player.getLocation());
                            // send message
                            player.sendMessage(plugin.setup_messages.get("MapSpawnSet"));
                            // set next stage
                            data.set("setup-stage", "set team spawns");
                            // save data
                            try {
                                data.save(new File(plugin.getDataFolder() + "/maps/" + mapName + "/data.yml"));
                            } catch (Exception e) {
                                throw new RuntimeException(e);
                            }
                            // start next stage
                            setupProcess(player, mapName, data);
                            // unregister listener
                            AsyncPlayerChatEvent.getHandlerList().unregister(this);
                        }
                    }
                }
            }, plugin);
        }

this is what I came up with, is anything wrong here?

weak kayak
#

not anything that's immediately clear from what i can tell

tall dragon
#

you should really create a proper framework thingy for that

weak kayak
#

probably

tall dragon
#

instead of listening everywhere

misty ingot
#

Yeah i will make a proper class for it

buoyant viper
#

throwing runtimeexception questionable behaviour duke

misty ingot
#

I just wrote that code, chill out

buoyant viper
misty ingot
#

We are allowed to edit code right?

buoyant viper
#

No.

#

All code is final.

weak kayak
weak kayak
#

oh well

#

better restart

tall dragon
#

better make ur own

dry yacht
wet breach
# quiet ice Objects#requireNonNull throws an NPE

I know, but if you use requireNotNull on an object. And you subsequently make that object null or it becomes null and then you try to do something with it, the way the stacktrace is for it doesn't make it obvious that the object is null. Whenever I see it happen to someone I will save the output from that to show you.

misty ingot
misty ingot
#

All i need to check is that the message matches the required phrase

dry yacht
# misty ingot Actually good idea, then i could also just have a player chat listener running w...

Yep, but maybe it could even be improved a bit by supporting cancellation through cancel in chat, or by making requests timeoutable, by adding a creation time-stamp as well as a timeout checker task. Just make sure that you don't end up with a lot of unexpected map entries which never got called because the user cancelled the process which will then later fire randomly whenever they seem to match something.

mortal hare
#

yay

#

i finally learned how to use classloaders to make my own plugin extension system

buoyant viper
#

poggers

#

URLClassLoader go brrrr

mortal hare
#

now i can bundle my jobs in a seperate jar files

#

I wonder if i would extend url classloader

#

but i dont seem to think a reason why

#

but bukkits extends it for some reason

buoyant viper
#

it checks for extra stuff i think so

#

idk

tall dragon
mortal hare
#

eh

tall dragon
#

might not need spigot tho

#

for ur case

mortal hare
#

i pass generic plugin object

#

that lets you interact like an api

tall dragon
#

yh right

#

fair enough

mortal hare
#

but you're right

#

for more functionality i would need to cast down to bukkit implementation of that object

#

to get plugin's instance

#

:/

rotund pond
#

Hello !
I have a question about Spigot and BungeeCord.

What would happen If I create a plugin who support both (and I install this plugin on both) and create a command bungee side and the a command with the same label spigot side ?

Is there any priority?

misty ingot
mortal hare
#

URLClassloader does grab resources from folder/jar right?

harsh badge
#

Hey guys whatโ€™s the best and most efficient way to code it in my mini game so if a player dies they get teleported to a spot instead of actually dying and get healed.

buoyant viper
mortal hare
#

bungee should win

buoyant viper
#

but u can always just try it and see

rotund pond
#

Ty ๐Ÿ‘Œ

harsh badge
#

Is there a way to be like if the damage is more then my health then tp to x position?

mortal hare
harsh badge
#

Yes

#

Iโ€™m on 1.8 as well

buoyant viper
#

but i mightve just been stupid

harsh badge
#

Iโ€™m doing it one way but I feel like thereโ€™s a more efficient way because the way Iโ€™m doing it takes a lot of ram

mortal hare
#

how does dying take a lot of ram

dry yacht
mortal hare
#

i feel like you're not cleaning up your list or maps

#

after death

#

alr, now i need to implement proper api and classes for my roleplay job plugin and i would be good to go

harsh badge
#

Youโ€™re supposed to stay on the map after death but the issue I was having was that I had to manually input how much damage players should die on. So I was wondering can I do something like if the damage is higher then my health then do this?

mortal hare
misty ingot
#

@dry yacht can also store the exact player to target with the requests using this, wouldnt want some random in chat to confirm my setups for me

mortal hare
#

Just like in Far cry 5 County officer said, sometimes its best to leave some things alone

buoyant viper
#

idea from bed rn but

on PlayerDeathEvent, set respawn location, and then force respawn player?

harsh badge
#

Can I just do that?

kind hatch
#

That means that they would have to die first.

buoyant viper
#

well, taking more damage than available health usually means u die

kind hatch
#

You should listen for the PlayerDamageEvent and check values there.

harsh badge
#

I donโ€™t want them to go to the death menu

kind hatch
#

Yes, but the PlayerDeathEvent is fired once you die. Meaning that you get hit with the death screen.

harsh badge
#

Is there a way to cancel it?

buoyant viper
#

?jd-s for me got an unrelated idea

undone axleBOT
mortal hare
#

is there any difference in terms of performance if i need the instance of the class and I use findClass() and newInstance() instead of doing Class.ForName() and newInstance()

#

static blocks should be still initialized if i use first option

#

right?

#

since new instance is made?

#

Classloader question

buoyant viper
#

does forName call findClass internally

mortal hare
#

so its just a wrapper?

#

but if it initializes the class

buoyant viper
#

im laying in bed, i dont remember and i cba to look

dry yacht
# misty ingot <@697274381587447899> can also store the exact player to target with the request...

Oh yeah, of course, I totally forgot that you need to scope requests to a player. You should probably create a ChatRequest (or similar) wrapper which stores the string and timestamp, as you very likely will add multiple fields in the future, like a Runnable for cancellation too, for example. This way you don't need multiple maps. Also, make sure to remove from the map on PlayerQuitEvent, to avoid memory-leaks.

kind hatch
# harsh badge Is there a way to cancel it?

There is, but you won't achieve it by cancelling the death event. (You shouldn't really be cancelling that event as it will cause many problems) You need to listen for for the EntityDamgeEvent, check if the damaged entity is a player, then compare how much damage was given vs how much health the player has. If it's enough to kill them, then cancel that event, and switch them to spectator or what not.

mortal hare
#

wouldnt be that Class.forName() creates dummy object

#

just to initialize static blocks

#

or is it somehow hotstopintrinsic

#

ie depends on jvm

#

itself

dry yacht
buoyant viper
#

i dont own a laptop.

dry yacht
#

:(

kind hatch
misty ingot
#

yeah, why should I?

mortal hare
#

im drinking from this cup

#

its huge

kind hatch
quiet ice
mortal hare
kind hatch
quiet ice
#

It just initialized it?

mortal hare
#

if so, why does findClass() doesnt do that

#

it has to have some special black hole dark matter stuff

#

to make it work

#

by initialize i mean initialize static blocks

#

findClass() returns class object but doesnt do that while Class.forName() does that

quiet ice
#

Yeah, I mean Class#findClass0 is a native method

#

So figure out how it does it. Hint: It doesn't involve Java code

mortal hare
#

it doesnt have any complete java bytecode implementation

dry yacht
# kind hatch I'm sorry what?

Independent libraries which can be separately maintained, updated and just used as in composition with a project are far superior to these inflexible, set-in-stone and version-dependent bukkit APIs.

mortal hare
#

so it should be implemented internally

quiet ice
#

Yeah, it's implemented in C code

#

Or better said: It's implemented by the JVM

mortal hare
#

i think there's no difference if you need an instance which one is faster to compute

#

since both are getting initialized anyways, but with class.forname() it would try to initialize twice

#

since newInstance() also initializes the class if the object is created first time

#

maybe couple ns at max

kind hatch
quiet ice
#

newInstance would be a serious security risk

#

You'd need to use Unsafe#allocateInstance

#

Which would be equally stupid

mortal hare
#

why newInstance is a security risk?

dry yacht
# kind hatch I agree with this to a certain extent. However, what api methods are set in ston...

I'm talking about the case of "I need another little feature in there". I cannot just fork it and extend it, if I don't want to be bound to the latest version, whenever that releases, if they accept my PR. I strongly dislike that way of adding functionality.

Also, most really useful APIs have been added way too late. Libs have done that kind of stuff for ages. I hate being bound to versions.

mortal hare
#

im calling it from constructor

#

its not deprecated

quiet ice
#

It's calling the constructor?

mortal hare
#

Constructor#newInstance()

buoyant viper
#

that wasn't the point geol was making methinks

quiet ice
#

Still calls the constructor

#

Only Unsafe#allocateInstance does not run the constructor

mortal hare
#

can you further elaborate by what youre defining as a security risk?

dry yacht
quiet ice
#

You're running arbitrary code when it shouldn't run

kind hatch
misty ingot
#

discord doesnt recognize IntelliJ as an activity wtf

mortal hare
#

but in that case JavaPluginLoader class would be a security risk too

mortal hare
#

since it calls JavaPlugin constructor

quiet ice
#

Yes, but it is called when it should be called

#

not when it shouldn't be called

mortal hare
#

im developing an addon system for my plugin

quiet ice
#

When calling the constructor very early some stuff might not have been initialized yet which results in NPEs at best and absolute fire at worst

#

I really recommend looking at how SSVM implements Class#forName0

#

It never allocates an instance of that class in the whole process

dry yacht
# kind hatch Ah, fair enough. I get that. Things like yaml comments or nbt were the most anno...

I really appreciate the bukkit API, don't get me wrong. I would hate to write low level stuff like just spawning and managing entities myself, that would be a huge pain. They're doing a great job, but we need to differentiate between core functionality and APIs which build on top of that. All the abstractions should be kept outside, in libs. No need to set anything in stone, to depend on any specific version. Some people would again strongly disagree with me on this one, but I'm totally convinced that this is the way to go.

The ideal for me is having many smaller libraries which do what I want, which are transparent and don't contain many transitive dependencies, which I can then compile together and dead-code-eliminate what I don't need.

mortal hare
#

i still dont get your point

quiet ice
buoyant viper
#

before u load the rest of the classes

#

o

quiet ice
#

in most cases it doesn't matter - java works exactly like that.
But once you use reflection - it does matter

mortal hare
#

so how i can be sure that classes are loaded

#

and are ready to be used in an instance

quiet ice
#

Plus the constructor of our JavaPlugin would run twice if Class#forName0 were to indeed create an instance

#

And surprise ... it does not. I wonder why ๐Ÿค”

dry yacht
# pseudo hazel this would be so nice

This is why I'm personally working this way, :). I'd love to see a future where nobody discriminates against any versions only because we collectively screwed up the architecture and boxed ourselves into this little prison.

It most definitely can be done, and I'm gonna proof this with some resources I will hopefully release sometime in the future. There are many great APIs already doing it, like NBT API.

mortal hare
#

i get that reflection instantiation is not safe, but how can i instantiate the class then

#

safely

pseudo hazel
#

yeah thats also the reason why I dont wanna touch nms

quiet ice
#

Plus it would be absolutely garbage for performance. There are tens of thousands of classes on a fully loaded JVM. That would mean tens of thousands of allocations that are unnecessary

mortal hare
#

i mean an object

#

i dont want a class

quiet ice
#

You mean running the constructor?

mortal hare
#

i want an object

#

yes

pseudo hazel
#

construct it

quiet ice
#

You run it when it is appropriate to run it

mortal hare
#

how can i know

#

thats the problem

quiet ice
#

Well you should know that

mortal hare
#

๐Ÿ˜„

#

oml

quiet ice
#

You will need to call the constructor before you use it - that's obvious. Whether you run it way before it depends on your usecase and I can't really tell you more about it than "figure it out yourself"

mortal hare
#

im using newInstance to instanciate an addon object, at the the plugin's enable.

quiet ice
#

It might be useful to do that in the constructor of your plugin - but as I said, everything depends on usecases

mortal hare
#

oh i think i get it what you mean about that safety stuff rn

#

you were debating of whether to use class.forname or the second method to initialize the class

#

and then construct it?

#

right?

buoyant viper
quiet ice
#

I was debating about whether Class#forName creates an instance of the class

mortal hare
#

yea but you misguided yourself and started to talk about the safety of instantiating classes

#

with newIntance()

glacial shell
#

Hi, so I was following a article on the Bukkit forums on how to add a delay to an event and in this part it is telling me to remove the VanillaCustomItems plugin from inside the public Events(VanillaCustomItems plugin) {...

    public static VanillaCustomItems plugin;

    public Events(VanillaCustomItems plugin) {
        this.plugin = plugin;
    }
mortal hare
#

but i dont get it what you were talking about the safety of newInstance()

#

from what I understand you were talking that newInstance() alone is not safe as Class.forName() to instanciate class since class could be not fully resolved at that time

#

im sorry it is just so hard to understand, since class loading is a new dimension for me rn

mortal hare
#

its a static field

#

so what is your question?

buoyant viper
#

IDE is probably yelling at them for setting value of a static object from non-static context

#

just remove the static modifier from the field yaknow

mortal hare
#

Or use Class name instead of this keyword to access the field

buoyant viper
#

or that ig

glacial shell
dry yacht
# buoyant viper if anything, itd be nice to see newer bukkit api stuff *backported* (like PDCs),...

How would that solve the issue in a broad manner? Many people are already running servers and are very unlikely going to update frequently.

This approach is just wrong and falls apart for so many reasons. Again, libraries are to be preferred. Their maintainers become experts in those domains and make the best implementation they can, which is simultaneously dispersing the immense workload which just comes with modding a game like that.

mortal hare
#

backporting wouldnt solve the issues

#

i agree

buoyant viper
#

i never said it would solve any issue

#

just that it would be nice to have

mortal hare
#

those who stay on the old version should acknowledge the fact that they're working with an old software

dry yacht
#

You said if anything, thus kinda talking down on what I suggested.

kind hatch
dry yacht
dry yacht
quiet ice
buoyant viper
#

people still using optifine for performance are the obsolete AbsoluteHalal

glacial shell
#

also, in my main class where I have the event registered:

      getServer().getPluginManager().registerEvents(new Events(), this);

It gives this error on the "Events()" part, "Expected 1 arguments but found 0"

buoyant viper
mortal hare
glacial shell
orchid gazelle
#

hi. how can I create an empty blockstate just with the Position of a block?

buoyant viper
mortal hare
#

Fabric Sodium > Optifine

buoyant viper
#

sodium doesnt provide any higher benefit than optifine for me :p

mortal hare
#

i havent used forge or optifine for at least 3 years

#

and i dont miss it

#

especially with the mod support it provides

#

both for the client and the server

#

at the same time

buoyant viper
#

and some shaders i occasionally use are still partially broken on Iris, not faulting Iris though, OF being closed-source makes it a bit hard

mortal hare
#

I fps limit myself when i play minecraft

#

less cpu

#

with high power comes high electricity bill

chrome beacon
#

Me playing Apex Legends isn't great for the electricity bill

buoyant viper
#

anybody playing Apex isnt good for the electric bill

chrome beacon
#

CPU 100% GPU 100%

mortal hare
#

DynamicFPS is a great mod

#

for fabric

buoyant viper
mortal hare
#

limits your fps when you're minimized the game or went afk

buoyant viper
#

12 core cpu on max fucking load for one game

#

at all times

chrome beacon
#

I have 4 core 4 threads

mortal hare
#

I have 2 cores 4 threads

buoyant viper
#

12c/24tr amd ryzen 9 3900x

mortal hare
#

and it still kicks ass in Rust

#

with 100 fps

dry yacht
buoyant viper
#

i average 30fps in Star Citizen in high detail scenes like starports

#

rtx 2060 but i dont think im gpu bottlenecking in SC

mortal hare
#

i wonder where on what class should i store user data regarding the job

#

job class

#

or the user class

mortal hare
#

both have cons

buoyant viper
#

well, which one has the less annoying con

dry yacht
mortal hare
#

both have

chrome beacon
mortal hare
#

if i store it inside a map of user manager, i would get issues whenever i would want to index available jobs

buoyant viper
mortal hare
#

if i store it inside a map of job manager i would get issues whenever i would want to index player's data

#

since it would be fragmented inside different job classes

#

transitivity problem

#

too bad that the java doenst have pointers :/

#

two pointers for the same map

#

voila done

mortal hare
#

a bit low end eh

buoyant viper
#

i3 lelebCry

mortal hare
#

i bought this pc around in 2016-2017

#

and since then i upgraded ram, gpu

buoyant viper
#

ive only had bad (sloowwwww) experiences with i3's, maybe intel just has shit laptop cpus for that level

mortal hare
#

but still havent managed to upgrade the cpu

#

i literally spent only 20 bucks to upgrade my ram from 8gb to 16gb

#

kek

buoyant viper
#

thinkin abt upgrading to 32 or 64

#

but if i go 64 ill need to swap out my current sticks (2x8gb)

mortal hare
#

i mixed ram, but i managed to find one stick so similar on the market, that even the chips serial codes match up

#

it was just a different arrangement and manufacturer

#

if i havent bought that stick i would've needed to pay 80 bucks

buoyant viper
#

ill probably stick to same lineup, just the non-rgb variant this time x)

mortal hare
#

for the same shit

mortal hare
#

i peak at 11-12gb at most

buoyant viper
#

it uses 10gb of ram on its own, and then winblows uses the fckin rest of it

river oracle
#

I have 32 gigs of ram and boy do i love it

mortal hare
#

12gb enough for rust

mortal hare
#

use Revision OS

#

best iso

buoyant viper
#

cba to custom rom my windows

#

besides, more ram = more upscaling for my anime pictures

mortal hare
#

I used before debloated win 8.1 it used around 700mb of ram at startup ๐Ÿ˜„

buoyant viper
#

then i can go higher resolution

mortal hare
#

that win 8.1 iso was so clean that it matched the linux ram usage

buoyant viper
#

it idled at like 6GB on my machine

#

win10 isnt much better but i save an extra 2GB by using it

mortal hare
misty ingot
#

my windows 10 machine idles at like 4+ GB ๐Ÿ’€

mortal hare
#

if firefox tabs are at the top why start menu couldnt lmao

#

you move your mouse at the top much more and it easier to move at the top then down

buoyant viper
mortal hare
#

if it doesnt i would probs switch to linux or on the worst case use third party start menu

buoyant viper
#

Debian ๐Ÿ’ช until APT accidentally uninstalls a core system package

mortal hare
#

๐Ÿ˜„

#

i use arch btw

buoyant viper
#

Arch ๐Ÿ’ช now that archinstall exists, i might finally try it out

buoyant viper
#

Fedora ๐Ÿ’ช used by Linus Torvalds himself

#

anything else sus_dance idfk i dont use linux

river oracle
#

My friend uses fedora he said he really likes it

buoyant viper
#

it seems nice

#

and its backed by RHEL so

#

support out the wazoo

quiet ice
#

Fedora is meh

#

I've been using it for over 2 years now and the amount of bugs haven't been that great

#

The WM and whatever shit they are using for sound needs to be improved in terms of stability

buoyant viper
#

the only OS i actually had issues trying to daily was Ubuntu i think

#

ironic, since its supposed to be one of the good ones

#

but every day was a new problem

quiet ice
#

these days it isn't that good

buoyant viper
#

my main issue was nvidia drivers, the install was just so fucked for no reason

#

and then i think it ended up breaking a bunch of other stuff like Steam's Proton

orchid gazelle
buoyant viper
#

ironically just switching to the Kubuntu flavour fixed that whole debacle, so i guess they package some better stuff in, but it was just so annoying trying to do different workarounds with no success on plain old Ubuntu

orchid gazelle
#

that'll just do the same?

buoyant viper
#

id imagine

orchid gazelle
#

imma try rq

worldly ingot
#

What do you mean when you say "empty block state"

#

And why do you need it?

orchid gazelle
#

I wanna send a shit load of block changes to the client, but Player#sendBlockChanges needs a BlockState

#

and I only have the blockdata

worldly ingot
#

Gotcha

orchid gazelle
#

yep, still the same

buoyant viper
#

woopsi

orchid gazelle
#

xD

buoyant viper
#

its interesting bc in minecraft itself its actually the opposite behaviour (at least from what i remember), u get the Block from the BlockState instead, but this is only 1.8 era knowledge

orchid gazelle
glacial shell
#

Does anyone know how to stop an event from running again for a set amount of time? I can't figure it out, all the things on google are to delay it not stop it from happening again.z

ex:
Player right clicks Item
Player is teleported up 1 block
Player right clicks Item within delay time
Chat Message "You Must wait (# of seconds) before doing that again"
Player right clicks Item after delay time
Player is teleported up 1 block
...

mortal hare
#

then do subtraction math currentTime - oldTime > 0.5second then allow do something

#

no repeating tasks, no lag just two variables with the current and the old time

#

just remember that the player can log on or log off to bypass

#

that

#

if you wouldnt handle it properly

glacial shell
#

Okay I will try that thx

terse ore
#

is pitch vertically or horizontally from players perspective?

buoyant viper
#

pitch is up and down, so vertical

terse ore
#

okok

#

ty

#

is there a way to get player direction (north south east west)

#

or I need to check all possibilities using yaw degrees

eternal ivy
#

I added ActionBarAPI from Spigot but it caused errors

chrome beacon
eternal ivy
dry yacht
chrome beacon
eternal ivy
chrome beacon
#

also if you're on 1.19.3 you don't need that

#

The spigot api can already send actionbars

tardy delta
#

player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(str))

dry yacht
#

Funny that your IDE didn't limit the number of choices there based on the available signatures of sendMessage.

tardy delta
glacial shell
#

How do I get the Integer value out of this Hashmap?

    public static HashMap<Player, Integer> map = new HashMap<>();
tardy delta
#

get()

chrome beacon
#

^^

tardy delta
#

best is get or default

#

check if its not null in the first case

glacial shell
#

I tried this

int maptime = map.get(Integer);
#

but it gives an error:

tardy delta
#

Integer

glacial shell
chrome beacon
#

?learnjava

undone axleBOT
quaint mantle
#

you get the player

tardy delta
#

whats that Integer doing there

glacial shell
#

I am trying to set it as a number to represent a time in seconds

dry yacht
glacial shell
#

How do I umm... do it in a if statement.. i dont know how to English.

how do i do like this below

ex:
HashMap stores player and integer value
gets player
gets integer value
if player has integer value > 0 then:
send message "Wait {integer value} second(s)!"
command doesn't execute

misty ingot
#

@dry yacht I just realised that in setup parts like setting the team player limit, I'd also need the user to input (any) number(s)

#

instead of a specific message

glacial shell
#

i dont know what im doing

undone axleBOT
misty ingot
#

also consider storing a Timestamp instead if you are making a command cooldown kinda thing

glacial shell
#

but how would I like get the player that the timestamp belongs to tho

misty ingot
#

try actually clicking one of those links up there

glacial shell
#

i am

misty ingot
#

good

tardy delta
#

when do you want to execute that code?

dry yacht
glacial shell
#

and its not as simple as i thought

hazy parrot
misty ingot
#

@glacial shell store player instance and timestamp of last time the command was executed in a HashMap
now everytime they make the task happen, check if 15 seconds have passed since the timestamp and do your thing

#

it actually is pretty easy

glacial shell
#

okay

#

if i cant do it ill be back in 15 minutes complaining again ๐Ÿซ 

misty ingot
#

cant really help further than this

glacial shell
#

k

tardy delta
soft viper
#

How can i get inventory title from Inventory object?

eternal night
#

you don't

#

you get it from the inventory view

soft viper
#

Ok, thanks

tardy delta
#

me being happy that we finally use ij in college

tardy delta
#

hmm what looks cleaner?

zealous osprey
spice shoal
#

guys how i can teleport a player with cords to a world ?

tardy delta
#

the stupid thing is that my assert thing cannot combine a string supplier and objects as placeholders

#

as i dont want to call getOrdinalName when its not needed

eternal ivy
#
@EventHandler(priority= EventPriority.HIGH)
    public void onPlayerUse(PlayerInteractEvent e){
        Player p = e.getPlayer();
        Block block = e.getClickedBlock();
        Action action = e.getAction();

        if (action.equals(Action.RIGHT_CLICK_BLOCK)) {
            if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.AQUA + "Clear Axe")) {
                Location location = block.getLocation();
                p.sendMessage("You have clicked a block at " + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ() + "!");
                e.setCancelled(true);
            }
        }
    }

I want to get the block location when I clicked right button.
But it doesn't work well.

If I clicked my right button at block, it send message twice.

crimson relic
#

because 2 hands

tardy delta
#

?playerinteractevent

#

?playerinteract

#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
eternal ivy
#

I want to develop a plugin like worldedit

#

How to set block with two locations?

echo basalt
#

Well

#

Let's break down basic worldedit

#

In 2D, you can represent a square with 2 points

#

topLeft and bottomRight

eternal ivy
#

but it is in 3d

echo basalt
#

So 0,0 -> 10,10 is a 10x10 square, with an area of 100

#

In 3d you can also represent it with 2 points

#

min and max

#

so

#

(-10, -10, -10) -> (10, 10, 10) is a 20x20x20 cuboid

#

With a volume of uhh

#

8000? cubic blocks

#

mental math here

tardy delta
#

isnt it 21x21x21

echo basalt
#

uhh yeah

tardy delta
#

meth

echo basalt
#

idfk

#

Anyways

#

Those 2 points represent the 2 opposite corners

#

Now

#

Let's say you want to fill that area

#

You can just loop in each axis

#

and set the blocks

#

example

restive mango
#

Anyone know of a library for generating points in various 3D spaces?

echo basalt
#
for(int blockX = min.getBlockX(); blockX <= max.getBlockX(); blockX++) {
  for(int blockY = min.getBlockY(); blockY <= max.getBlockY(); blockY++) {
    for(int blockZ = min.getBlockZ(); blockZ <= max.getBlockZ(); blockZ++) {
      ...
    }
  }
}
#

And that's literally how you fill a cuboid

eternal ivy
#

Um

#

How to except some blocks?

#

like

echo basalt
#

You can then do some checks inside

eternal ivy
#

oh

echo basalt
#

Like if you only want hollow anything that's not minX, minY, minZ, maxX, maxY, maxZ

#

or you can make like 8 separate loops

#

This is basic 3d math

eternal ivy
#

bedrock, beacon, red concrete, red glass, netherite block <- this is what i want to except

#

*these are

echo basalt
#

yeah you can get the block, get type, filter

#

and all

#

?paste

undone axleBOT
echo basalt
#

Here's a cuboid utility class I made

eternal ivy
#

.cpp?

#

Is it c++?

crimson relic
#

ignore extension

eternal ivy
#

ok

serene sigil
#

hi, is there a way to access the persistentdatacontainer of an OfflinePlayer even if its offline? i cant do OfflinePlayer#getPlayer cuz it returns null if its not online

echo basalt
#

You most likely need to access the NBT files directly

serene sigil
#

alr

echo basalt
#

I doubt you can do that through bukkit though

#

But there are APIs for that kind of stuff

serene sigil
#

so do u know how to access the nbt directly?

echo basalt
#

I'd probably use NBT-API or just nms

serene sigil
echo basalt
#

uhh

tardy delta
#

just load player files

echo basalt
#

access the file, read the nbt off the filestream

#

and you'll have a big tag

#

then you need to like parse that tag

#

I have a basic nms guide (click on my profile, it's in my about me)

#

and uhh

#

I've done something like this in the past

#

like 2 years ago

eternal ivy
#

How to check that block.getType() contains exceptArr

echo basalt
#

ArrayUtils#contains

eternal ivy
#

Should i have to use foreach?

echo basalt
#

or just use a set

#

or soemthign

#

hashset -> contains

shut mauve
#

Hello guys,
I'm creating a 1.8.8 spigot plugin, but I got some graphical issues.
When I launch my local server, I don't get any of these bugs, but when it's an online server, I got them.
These bugs occurred when I'm trying to move an item in my inventory, but these items go back to their source when I close my inventory.
Do anyone knows why ?

undone axleBOT
serene sigil
#

alr, i have one more question, when does Player#hasPlayedBefore turn true?

#

but when exactly?

crimson relic
#

what do you mean?

echo basalt
#

pretty sure it just checks if the player file exists

serene sigil
#

what does it say when i check it on PlayerJoinEvent?

serene sigil
orchid gazelle
echo basalt
orchid gazelle
echo basalt
#

uhh yeah

#

well

#

I was helping him out on that

orchid gazelle
#

hhahahha aight

#

and why the heck does it need a BlockState instead of a BlockData?

echo basalt
#

idfk that's not on me

#

Anyways I believe sendMultiBlockChange might be a paper thing

serene sigil
#

how long after that is it false?

echo basalt
#

yeah, that's how I learned regex

#

w3schools iirc

eternal night
#

didn't spigot propose a method for multi block change too think

#

I feel like I recall a choco PR

echo basalt
#

as I've said

orchid gazelle
#

does not exist for me

echo basalt
#

choco PR in collab with me

#

:)

#

as for the block state

#

uhh

eternal ivy
#

how to check left click on block?

echo basalt
#

it gets a bit tricky because iirc

#

blockstates are linked to the location

serene sigil
tardy delta
#

๐Ÿ’€

echo basalt
#

obfuscation

orchid gazelle
eternal ivy
#
 @EventHandler(priority= EventPriority.HIGH)
    public void onPlayerUse(PlayerInteractEvent e){
        Player p = e.getPlayer();

        if (e.getHand() != EquipmentSlot.HAND) {
            Block block = e.getClickedBlock();
            Location location = block.getLocation();
            if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.AQUA + "Clear Axe")) {
                p.sendMessage("You have clicked a block at " + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ() + "!");
                plugin.rightZone.put(p, location);
                e.setCancelled(true);
            }
        } else {
            Block block = e.getClickedBlock();
            Location location = block.getLocation();
            if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.AQUA + "Clear Axe")) {
                p.sendMessage("You have broken a block at " + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ() + "!");
                plugin.leftZone.put(p, location);
                e.setCancelled(true);
            }
        }
    }
#

right click message sent twice

echo basalt
orchid gazelle
#

and getting a blockstate from blocks based on a blockdata for 100000 times a tick is hella unefficient

crimson relic
orchid gazelle
#

so I need it to work with blockdata

eternal night
#

so just use that

echo basalt
eternal ivy
orchid gazelle
eternal ivy
#

BlockBreakEvent and PlayerInteraction

echo basalt
#

uhh not strictly

#

you can convert stuff a bit

eternal ivy
#

But it caused error when I used BlockBreakEvent

echo basalt
#

^ I've fully remade this

#

but

#

some of it works

orchid gazelle
#

wtf is this

#

lol

echo basalt
#

protocollib fake blocks

#

with like

#

click detection and all

#

doesnt disappear when you click and all

#

per-player blocks

#

it's nice

orchid gazelle
#

this looks like I would need 10000000 hours to implement this

echo basalt
#

yes

crimson relic
#

better get to work then

#

lmaoo

echo basalt
#

and then you get into lighting and all

#

it's a pain

#

I think I've spent like 2 weeks straight working on fake blocks

orchid gazelle
#

yeah now that does not help me

#

I just need to send BlockChanges with BlocKData instead of BlockState lol

orchid gazelle
#

why does sendBlockChanges even need a BlockState at all?

crimson relic
#

reposting after 4 minutes does not help

echo basalt
#

wait let me pull 1.19.3

orchid gazelle
#

aight

charred blaze
#
app//com.destroystokyo.paper.profile.CraftPlayerProfile.copyProfileProperties(CraftPlayerProfile.java:213)
[19:45:17] [Paper Watchdog Thread/ERROR]:         app//com.destroystokyo.paper.profile.CraftPlayerProfile.copyProfileProperties(CraftPlayerProfile.java:202)      app//com.destroystokyo.paper.profile.CraftPlayerProfile.completeFromCache(CraftPlayerProfile.java:174)   app//org.bukkit.craftbukkit.v1_16_R3.inventory.CraftMetaSkull.setProfile(CraftMetaSkull.java:89) app//org.bukkit.craftbukkit.v1_16_R3.inventory.CraftMetaSkull.setOwningPlayer(CraftMetaSkull.java:209)    com.alonsoaliaga.alonsotags.AlonsoTags.buildPlayerHeadItem(AlonsoTags.java:1407)
com.alonsoaliaga.alonsotags.AlonsoTags.openTags(AlonsoTags.java:1147)```
#

what is this error?

echo basalt
#

uhh

charred blaze
#

i have same issue on spigot

#

error is almost same

crimson relic
#

contact author

charred blaze
#

on spigot

charred blaze
crimson relic
#

??

charred blaze
#

its also printing much random my plugins

#

in errors

echo basalt
#

something tells me you don't deserve the "dev" in your discord name

charred blaze
#

huh?

charred blaze
crimson relic
#

no

#

this is spigot not paper

charred blaze
charred blaze
#

DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH

#

says the log

echo basalt
#

contact alonsoaliaga

shut mauve
#

Graphical bugs spigot 1.8.8 online

glacial shell
#

I'm getting an error saying that 'time' is null, which it is at the start, but it is later set as an Integer (like it is supposed to be). I can't figure out how to set it as an Integer temporarily (that Integer being 0), so it still later can be set as another Integer, without being overwritten by the 0 Integer.

Could someone tell me how I would do this?

orchid gazelle
#

you should not have said this

echo basalt
#

@worldly ingot this impl isn't usable

charred blaze
orchid gazelle
eternal night
echo basalt
#

casting to CraftBlockChange

#

it isn't made to aid sendBlockChange

orchid gazelle
#

"this impl isn't usable". Yeah I have noticed that the whole afternoon lol

echo basalt
#

because you need to use craftbukkit's block states

orchid gazelle
#

yeah

#

but that sucks lol

eternal night
#

very unusuable smh

cloud torrent
#

as soon as I step out of the 16 block range from my spawners, they don't work... I thought editing the entity-activation-range would change it? Anyone have any ideas??

eternal night
#

using the API instances

#

smh

restive mango
#

actually

eternal night
#

watch till you find out PDC won't work with custom PDC implementations

echo basalt
#

It literally only lets you send blocks that are already sent to the client

eternal night
#

what

echo basalt
#

creating fps spikes in the process

orchid gazelle
#

thats literally by issue all the time lmao

#

im gonna cry

echo basalt
#

If you want to work on an alternative solution we can do that within the hour, choco

worldly ingot
#
List<BlockState> states = new ArrayList<>();

for (int x = 0; x <= 10; x++) {
    for (int y = 0; y <= 10; y++) {
        for (int z = 0; z <= 10; z++) {
            BlockState state = world.getBlock(x, y, z).getState();
            state.setType(Material.AIR);
            states.add(state);
        }
    }
}

player.sendBlockChanges(states);
#

This literally works

#

#getState() returns a snapshot

orchid gazelle
#

thats a blockstate

eternal night
orchid gazelle
#

and blockstates need a real block to exist

eternal night
#

no

worldly ingot
#

They don't

#

They're data objects

echo basalt
#

mm that's a cringe way to impl this

eternal ivy
#

How do I manually get the type of World?

orchid gazelle
#
            BlockState blockstate = new Location(player.getWorld(), block.getX(), block.getY(), block.getZ()).getBlock().getState();
            blockstate.setBlockData(block.getBlockdata());
            states.add(blockstate);
#

thats what im doing

#

and this literally drains my server performance to hell

eternal ivy
echo basalt
#

Let's just add a secondary impl then

orchid gazelle
#

plz let me update my blocks with BlockData lmao xd

worldly ingot
#

You can clean up that impl real quick by dropping 2 instance creations

#

BlockState state = world.getBlockState(x, y, z);

#

Now you don't instantiate a Location or Block

eternal night
#

I mean, BlockState works nicely.... Its literally a combination of position and block data

orchid gazelle
#

and I need to create a Location for it since my block is not a Block

worldly ingot
#

That's fine. I passed in an x, y, and z

echo basalt
echo basalt
#

this line can be problematic

glacial shell
#

How do I see if an Integer is null, because when I try to use an if statement, it says the Integer needs to be an Integer..

worldly ingot
#
BlockState blockstate = new Location(player.getWorld(), block.getX(), block.getY(), block.getZ()).getBlock().getState();```
This is nonsensical.
```java
BlockState blockState = block.getState();```
orchid gazelle
#

where's that line?

worldly ingot
#

What you are doing is creating a location at a block's x, y, and z, getting the Block again, then calling getState lol

echo basalt
eternal night
#

I mean, the only reason you'd need a fake block state is if you want to avoid copying the data of the block that exists

#

which I guess is what I give you there

orchid gazelle
worldly ingot
#

Still not creating a Location or Block

orchid gazelle
#

that does the same thing

echo basalt
#

I still don't think it's a great idea to fetch stuff like the block's type and chunk data and all of that

#

to override it afterwards

worldly ingot
#

It does the same thing but you're not instantiating 2 random objects that you're immediately discarding

orchid gazelle
#

while still destroying my server performance

worldly ingot
#

It's faster

eternal night
#

sure, tho your chunk should be loaded

orchid gazelle
#

they are

eternal night
#

the operations to fetch its internal block states hence are pretty damn fast

#

yea you override it and you could avoid that with some "FakeBlockState"

#

but bleh

worldly ingot
#

That method doesn't guarantee how it will work for unloaded chunks

orchid gazelle
eternal night
#

have you considered that a client does not like a multi block change packet of your size ?

orchid gazelle
#

this is WAYYY to much. This is in a small scale

eternal night
#

lol

worldly ingot
#

I don't know how you think you could improve it because there's really no improveable means of doing this imo

echo basalt
#

well

worldly ingot
#

Maybe if you're sending one block type, sure

echo basalt
#

The first improvement we can do is ditch the CraftBlockState class in itself