#help-development

1 messages · Page 2249 of 1

river oracle
#

use pastebin

quaint mantle
lost matrix
quaint mantle
quaint mantle
quaint mantle
river oracle
#

I don't know sql so I can't help tehre

simple silo
#

How to change the chest title? I heard you can do it with NMS but I don't know how

river oracle
quaint mantle
#

but there is the error

ornate patio
#

how do you make a horse attack players

chrome beacon
ornate patio
#

yeah i did

#

i added the NearestAttackableTargetGoal target seelctor and a MeleeAttackGoal goal selector

#

thing is if i go next to a horse the server crashes and i get this error message:

#

I understand what this means, I haven't set the amount of damage that the horse can do

#

but like, how do i set it

chrome beacon
#

Well Can't find attribute minecraft:generic.attack_damage

#

Just set the attribute

ornate patio
#

can i just grab the bukkit entity and do that

chrome beacon
#

Maybe

sonic cosmos
#

Hello, I have such a problem, I am trying to fix it for almost 1 hour

error in console:

 Index 0 out of bounds for length 0 initializing Mediumhc v1.0-SNAPSHOT (Is it up to date?)
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
        at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?]
        at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?]
        at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) ~[?:?]
        at java.base/java.util.Objects.checkIndex(Objects.java:372) ~[?:?]
        at java.base/java.util.ArrayList.get(ArrayList.java:459) ~[?:?]
        at org.bukkit.craftbukkit.v1_8_R3.CraftOfflinePlayer.<init>(CraftOfflinePlayer.java:34) ~[servert.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.getOfflinePlayer(CraftServer.java:1324) ~[servert.jar:git-Spigot-db6de12-18fbb24]
        at org.bukkit.Bukkit.getOfflinePlayer(Bukkit.java:759) ~[servert.jar:git-Spigot-db6de12-18fbb24]
        at net.jedzius.mediumhc.data.Deserialization.deserializeGuild(Deserialization.java:112) ~[?:?]
        at net.jedzius.mediumhc.data.Deserialization.deserializeGuilds(Deserialization.java:105) ~[?:?]
        at net.jedzius.mediumhc.guild.GuildService.load(GuildService.java:47) ~[?:?]
        at net.jedzius.mediumhc.CorePlugin.onLoad(CorePlugin.java:77) ~[?:?]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:297) [servert.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [servert.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [servert.jar:git-Spigot-db6de12-18fbb24]
        at java.base/java.lang.Thread.run(Thread.java:829) [?:?]

Code: https://paste.md-5.net/eritisehev.js

any idea how to fix?

#

I have analyzed the code 10 times already and I still don't know why

ornate patio
#

theres the Attributable#getAttribute that returns null if the attribute is not applicable

#

theres no setAttribute

chrome beacon
#

Oh well use NMS

ornate patio
#

how do i do that with NMS

chrome beacon
#

There should be a method in there can't remember the name

#

Should be pretty obvious

river oracle
#

NPE

ornate patio
#

hm wait

#

i found this in the zombie class

#
   public static Builder createAttributes() {
      return Monster.createMonsterAttributes().add(Attributes.FOLLOW_RANGE, 35.0D).add(Attributes.MOVEMENT_SPEED, 0.23000000417232513D).add(Attributes.ATTACK_DAMAGE, 3.0D).add(Attributes.ARMOR, 2.0D).add(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
   }
#

doesn't really help though

#

it doesn't override a super class

mortal hare
#

more progress on ui lib

river oracle
river oracle
ornate patio
mortal hare
ornate patio
#

damnn

#

how are you gonna post ur ui lib tho

#

automatic resource pack generator 👀

river oracle
#

if he doesn't its a sin tho

#

you'd need a server for that :(

mortal hare
#

?paste

undone axleBOT
mortal hare
#

its basically bunch of hacks for NMS to get fooled

#

this class is not perfect tho

ornate patio
#

how do I register custom attributes with NMS

#

i want to set attack damage on a hrose

chrome beacon
#

Took 2 seconds to find

#

createBaseHorseAttributes

ornate patio
chrome beacon
#

Yes

ornate patio
#

oh okay

#

thanks

chrome beacon
#

Actually wait it's static

#

It might be a bit tricky

#

Maybe just create your own attack goal with a hardcoded value

ornate patio
ornate patio
ornate patio
ornate patio
river oracle
#

foo you can't change the inside of amethod with reflection

#

thats a mixin

mortal hare
#

Mob.createMobAttributes().add(Attributes.JUMP_STRENGTH).add(Attributes.MAX_HEALTH, 53.0D).add(Attributes.MOVEMENT_SPEED, 0.22499999403953552D)

#

that static method literally contains this

humble tulip
#

mob.hi()

mortal hare
#

it just constructs a builder

#

Mob.createMobAttributes() is what you need

mortal hare
#

that's what NMS provided me

#

i haven't wrote this

chrome beacon
#

Alternatively you can replace the attributes in the constructor

lost matrix
chrome beacon
#

I tried setting up Mixins in my standalone project

#

It's a pain and I'm so lost

lost matrix
#

Just get the attribute and add '1' to it

ornate patio
chrome beacon
#

Just replace the attributes field with reflection

ornate patio
#

oh nvm i see it

chrome beacon
#

It's probably better

ornate patio
lost matrix
#
  public void increaseMaxHealth(Player player, int amount) {
    AttributeInstance maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
    maxHealth.setBaseValue(maxHealth.getBaseValue() + amount);
  }
chrome beacon
# ornate patio what attriubutes field lmao
        AttributeMap attributeMap = new AttributeMap(createBaseHorseAttributes().add(Attributes.ATTACK_DAMAGE, 3.0).build());
        try {
            Field attributes = LivingEntity.class.getField("attributes");
            attributes.setAccessible(true);
            attributes.set(horse, attributeMap);
        } catch(NoSuchFieldException e) {
            //Handle
        }

Untested code

lyric grove
#

Ive not used javas instant much before, would this be the best way of removing another instant

chrome beacon
# ornate patio thanks

If you want to use the API with the attack attribute you will need to replace the craftAttributes field too

ornate patio
#

in LivingEntity?

ornate patio
ornate patio
# chrome beacon If you want to use the API with the attack attribute you will need to replace th...

I'm assuming you mean like this?

AttributeMap attributeMap = new AttributeMap(createBaseHorseAttributes().add(Attributes.ATTACK_DAMAGE, 3.0).build());
CraftAttributeMap craftAttributeMap = new CraftAttributeMap(attributeMap);
try {
    Field attributes = LivingEntity.class.getField("attributes");
    Field craftAttributes = LivingEntity.class.getField("craftAttributes");
    attributes.setAccessible(true);
    attributes.set(this, attributeMap);
    craftAttributes.setAccessible(true);
    craftAttributes.set(this, craftAttributeMap);
} catch (Exception e) {
    e.printStackTrace();
}
#

i'm getting a NoSuchField exception

#

but i know why

#

the fields get re-obfuscated

#

behind the scenes

chrome beacon
#

Wait

#

nvm

#

lmao

ornate patio
#

lol

ornate patio
#

I'm trying to use this

#

to fix the nosuchfield thing

chrome beacon
#

Are you on 1.18.1?

ornate patio
#

yes

chrome beacon
#

Why not use 1.18.2

ornate patio
#

reasons

#

dw about it

#

but here i found this

#

so I replaced the first field declaration with Field attributes = LivingEntity.class.getField("bQ");

#

but craftAttributes is not there

chrome beacon
#

I don't think that's obfuscated since it's a bukkit only field

ornate patio
#

alright lemme try

#

ok now I'm lost 🤔

#

java.lang.NoSuchFieldException: bQ

chrome beacon
#

It's named bQ in the 1.18.2 jar

#

I don't have the 1.18.1 to check

ornate patio
#

i mean the site says its also bQ in 1.18.1

#

lol what am i supposed to do

chrome beacon
#

Maybe try Horse.class instead

#

🤷‍♂️

ornate patio
#

nope not a thing

wild reef
#

Hey guys I got a question.
So I got the following case:

  • I got the PlayerInteractEvent

  • I got the PlayerInteractAtEntityEvent

  • both of them are doing basically the same but only one should be triggered
    The problem is when I am clicking an invisible armorstand it selects the block beneath as well, so both events are triggered.
    Is there a way to like (I thought this could be done by setting the priority if I am right?) to say something like, if event A was triggered, cancel event B?

ocean lion
#

items: any-text: id: 284 slot: 0
display-name: ''
lore:

  • another-item: id: SEEDS slot: 2
    display-name: ''
    lore:
  • wheat-item: id: WHEAT slot: 4
    display-name: ''
    lore:
#

I'm trying to make a customconfig item.yml and make something like this.

#

I cant seem to find out why the file is not working properly. Comes out blank

ornate patio
red sedge
#

is vscode good for making java stuff

ocean lion
lost matrix
ornate patio
#

my opinions differ

#

i always have used vscode

lost matrix
#

vs code is a literal handicap for working with java compared to the dedicated IDEs

red sedge
#

thats why im asking, i've used vscode for literally everything but i heard its not really good for java

eternal night
#

I mean, give both a try 🤔

ornate patio
lost matrix
# wild reef anyone got an idea?

Cancel the event that was fired first. The other events shouldnt fire afterwards.
*Assuming this behaves like PlayerInteract and BlockBreak

eternal night
#

tho ngl, jetbrains suggestions, auto completion and all its context aware shit is kind of OP vs vs code just vibing on the language server

lost matrix
lost matrix
wild reef
lost matrix
#

The other one wont be fired at all

wild reef
#

okay thanks, I will try

#

I see what you mean

ornate patio
lost matrix
ornate patio
#

i have no idea whats going on here lmao

lost matrix
#

Im curious so im looking through it atm

#

Doesnt look to bad. You just need a ResourceKey

ornate patio
#

i have no idea how this operates or what it even does

#

does Horse implement or extend this class?

lost matrix
#

Yeah data driven designs can be quite hard to follow because so much is decided at runtime

lost matrix
ornate patio
#

nvm lmao

lost matrix
#

No this is for registering new custom attributes data

ornate patio
#

i'm not making a custom attribute though

#

I'm just trying to add attack damage attribute to a horse

lost matrix
#

omg...

eternal night
ornate patio
lost matrix
# ornate patio my bad sorry

Horse < AbstractHorse < Animal < LivingEntity
Then from there
LivingEntity#getAttributes() : AttributeMap
LivingEntity#getAttributeValue() : double
...
and so on

ornate patio
#

on a horse

eternal night
#

did you read the method

#

lmfao

ocean lion
#

I have a custom config file item.yml. I'm trying to make it take the default data of the item in the stack and place it into the config. Does not happen thought as I get a blank file. it says my itemstack is null but with getCustomConfig().set("path", itemstack); I thought it should autogenerate by default

ornate patio
#

yes

ocean lion
#

How would I fix this problem or reprogram it

eternal night
#

that method would actively register your attack damage attribute

#

which is exactly what you are trying

#

tho I guess you are on spigot-api

ornate patio
#

is registerAttribute new?

eternal night
#

[23:13] okay1204: yes

ornate patio
#

i'm on 1.18.1 though

eternal night
#

it is a paper only method

ornate patio
#

oh

#

well im not on paper

eternal night
#

you could look at the patch impl

#

and just do the same

#

tho that will need NMS/craftbukkit

lost matrix
# ocean lion bump

It generates the values on default. You probably didnt write the FileConfiguration to a File afterwards.

ocean lion
#
public class FileManager {



    public static File customConfigFile;
    public static FileConfiguration customConfig;

    public static FileConfiguration getCustomConfig() {
        return customConfig;
    }

    public static void createCustomConfig() {
        customConfigFile = new File(LobbyGadgets.getInstance().getDataFolder(), "item.yml");
        if (!customConfigFile.exists()) {
            customConfigFile.getParentFile().mkdirs();
            LobbyGadgets.getInstance().saveResource("item.yml", true);
        }

        customConfig = new YamlConfiguration();
        try {
            customConfig.load(customConfigFile);
        } catch (IOException | InvalidConfigurationException exception) {
            exception.printStackTrace();
        }
    }
}
ornate patio
#

i can't exactly modify the AttributeMap returned from LivingEntity#getAttributes()

#

i cant add new attributes

ornate patio
#

👀

ocean lion
#

....

lost matrix
ocean lion
#

it does not give me anything in the item.yml

#

no item no nothing

lost matrix
#

How does your item.yml look like inside your jar?

ocean lion
#

in resources

lost matrix
ornate patio
ocean lion
# lost matrix sure, or there

I really want to fix this but I dont know what to do. I've been trying to find solutions for 2 days now on spigot and other forums...

ornate patio
#

i only see MAX_NAME_LENGTH

#

hmm wait

lost matrix
ocean lion
#

There is "supposedly" nothing wrong

lost matrix
ocean lion
#

item:
gadgetsmenu:

ornate patio
#

ah great

#

LivingEntity#getAttributes() returns null

lost matrix
lost matrix
ornate patio
#

it is

lost matrix
#

Then you are doing something wrong

ocean lion
#

item:
gadgetsmenu:

lost matrix
ocean lion
#

no but there has to be something to do

#

no?

#

I dont find anything on item.yml on spigot or bukkit forums

#

either

lost matrix
#

item.yml is your own thing. You wont find anything on that.
Why do you want to save an yml with just empty paths anyways?

ocean lion
#

?

lost matrix
#
item:
   gadgetsmenu:

this is just an empty path without any real data

ocean lion
#

I create the itemstack, use customconfig.set path and get the default item meta like type: displayname: lore:

ornate patio
lost matrix
torn shuttle
#

sidenote but has anyone noticed vpns getting worse recently? It feels like services are starting to get 100% block coverage, I get capchas and denials everywhere and sometimes my latency is measured in seconds when loading pages

lost matrix
# ocean lion FileManager: https://paste.md-5.net/tudavaxalo.java ItemManager: https://paste.m...
    public static void setItem() {
        FileManager.getCustomConfig().set("item.gadgetsmenu", gadgetsMenu);
        LobbyGadgets.getInstance().saveResource("item.yml", true);
    }

saveResource copies a File from your jar and writes it into your plugin folder
You can edit your config all you want. If you just copy the same file from your jar into the
plugin folder and overwrite everything then you can edit all day long and dont see any changes.

ocean lion
#

so where should i put the saveResource line

#

or should I just remove it

chrome beacon
#

@ornate patio Found the issue replace getField with getDeclaredField

ornate patio
#

oh bruh

#

lmao

lost matrix
ornate patio
#

i should noticed that earlier

ocean lion
#

Of course

ornate patio
#

finally man

#

thanks

#

the whole thing worked

ocean lion
# lost matrix Remove it and check out how to work with the configuration api

I'm trying to do something like this SampleItem:
==: org.bukkit.inventory.ItemStack
type: DIAMOND_SWORD
damage: 1500
amount: 1
meta:
==: ItemMeta
meta-type: UNSPECIFIC
display-name: §6Sample Item
lore:
- First line of lore
- Second line of lore
- §1Color §2support
enchants:
DAMAGE_ALL: 2
KNOCKBACK: 7
FIRE_ASPECT: 1

lost matrix
white root
#

How would yall go about modifying the format of the console log of chat messages in console?
For instance, currently if I send a message chat, the message sent to the console will show[current:time INFO] <MrMcyeet> Hey, I am a sample message!

If I wanted to change that to show the player's level, like [current:time INFO] <MrMcyeet [Professional]> Hey, I am a sample message!how would I go about that?

silver pulsar
#

how do you deconnect a variable form a file configuration.
public static List<List<Object>> oreList = new ArrayList<>();
oreList = FileHandeler.getFile().getObject("oreTypes", oreList.getClass());
the problem is when im editing oreList it also edits the file.

lost matrix
silver pulsar
#

its for a list of diffrent ore types for a custom block im creating

lost matrix
# ocean lion and how would I do that
    File file = new File(getDataFolder(), "test.yml");
    FileConfiguration configuration = YamlConfiguration.loadConfiguration(file);
    // Edit config
    configuration.save(file);
silver pulsar
silver pulsar
silver pulsar
lost matrix
ocean lion
#

on configuration.save

lost matrix
silver pulsar
# lost matrix How does your yml look like?

`oreTypes:

    • ==: org.bukkit.inventory.ItemStack
      v: 2865
      type: RAW_IRON
    • 50.0
    • ==: org.bukkit.inventory.ItemStack
      v: 2865
      type: RAW_GOLD
    • 25.0
    • ==: org.bukkit.inventory.ItemStack
      v: 2865
      type: LAPIS_LAZULI
    • 20.0
    • ==: org.bukkit.inventory.ItemStack
      v: 2865
      type: DIAMOND
    • 5.0`
ocean lion
#

and between that it would just set it

#

?

lost matrix
lost matrix
ocean lion
#

and now I have a blank item.yml

lost matrix
ocean lion
#

I have showed you my code. What you sent and told me to remove did not work at all

lost matrix
silver pulsar
lost matrix
lost matrix
ocean lion
#

okay so how do I tell it to write type, displayname, lore, enchants etc

torn shuttle
lost matrix
# ocean lion okay so how do I tell it to write type, displayname, lore, enchants etc
  public static void setItem() {
    ItemStack itemToWrite = gadgetsMenu == null ? createDefaultItemStack() : gadgetsMenu;
    FileManager.getCustomConfig().set("item.gadgetsmenu", itemToWrite);
  }
  
  private static ItemStack createDefaultItemStack() {
    ItemStack itemStack = new ItemStack(Material.STONE);
    ItemMeta meta = itemStack.getItemMeta();
    meta.setDisplayName("CustomName");
    meta.setLore(Arrays.asList("Line 1", "Line 2", "Line 3"));
    itemStack.setItemMeta(meta);
    return itemStack;
  }
nimble zinc
#

Hi there, I'm totally new to Java/Spigot programming and I'm wondering why my args length is always 0. Even when I enter /wild nation the args.length is always 0 and I never go in the next condition. Any idea ?

@Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (!(sender instanceof Player)) {
            // Command can be only executed by player
            return false;
        }

        Player player = (Player) sender;

        Location tpLoc;

        System.out.println("args.length: " + args.length);
        if (args.length > 0)
            System.out.println("args[0]: " + args[0]);
        if (args.length > 1)
            System.out.println("args[2]: " + args[1]);

        if (args.length == 0 || !args[0].equalsIgnoreCase("nation")) {
            sender.sendMessage("Téléportation aléatoire en zone neutre dans 5 secondes");
            tpLoc = getRandomLocation("neutral");
        } else if (player.hasPermission("kokiria.wild.din")) {
            sender.sendMessage("Téléportation aléatoire à Din dans 5 secondes");
            tpLoc = getRandomLocation("din");
        }...```
#

[00:24:13 INFO]: Litorax issued server command: /wild nation
[00:24:13 INFO]: [Kokiria] [STDOUT] args.length: 0```
lost matrix
nimble zinc
#

yeah

#

always 0

#

I don't understand honestly

lost matrix
#

What Spigot version are you using

nimble zinc
#

What you mean add brackets ?

#

Is that new programming rule haha ?

#

It's only for debugging

lost matrix
#
        if (args.length > 0)
            System.out.println("args[0]: " + args[0]);

to

        if (args.length > 0) {
            System.out.println("args[0]: " + args[0]);
        }
lost matrix
nimble zinc
#

Alright

eternal oxide
#

One I sometimes follow. It all depends how I feel 😉

nimble zinc
lost matrix
hybrid spoke
#

oneliner always without brackets

nimble zinc
#
<dependencies>
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.19-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
nimble zinc
lost matrix
#

You guys go read "Clean Code" from Robert Martin and then come back.
Or at least watch the yt video about his lecture.

hybrid spoke
#

i did

#

its garbage

#

actually thats a convention of my work place to not use brackets if its a oneliner

nimble zinc
#

I think the clean code debate will never end

#

But could I get some help with these args please haha I have no clue what to do

lost matrix
eternal oxide
#

Well the code you posted is impossible. args can;t be zero

nimble zinc
#

Well, it is, wanna come and see my stream ?

nimble zinc
#

Maybe I'm doing something wrong idk

eternal oxide
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

eternal oxide
#

then send us yoru jar

nimble zinc
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

lost matrix
nimble zinc
#

!verify Litorax

undone axleBOT
#

A private message has been sent to your SpigotMC.org account for verification!

hybrid spoke
eternal oxide
#

eff Oracle

lost matrix
#

Oracle, Google, ASAP, AWS.
Pick one. All of them agree on this code style.

limber owl
#

how can I stop chunks from preloading after world creation? so I wont have to unload them and then load the back in. reason is that i have block populators which I can apply only after creating the world, so I have to unload the loaded chunks, apply the populators and then load them back in with the populator to get the effect

eternal oxide
#

True, but they are all wrong 😄

lost matrix
#

Just wanna trigger me

hybrid spoke
#

google writes in blocks, they dont even have something to say

#

not even a whitespace

#

they just glue all of their code together

lost matrix
nimble zinc
#

Maybe my command in plugin.yml is not well defined ?

proud basin
#

Hey! Anyone have an idea how I could read a jars execution?

lost matrix
nimble zinc
#

Also I changed load to STARTUP

#

Idk

lost matrix
nimble zinc
#

Here is my jar

#

/wild nation
should give an error if you don't have the good permission, but never output "Téléportation aléatoire en zone neutre dans 5 secondes"

eternal oxide
#

server starting

nimble zinc
#

thx

limber owl
lost matrix
undone axleBOT
limber owl
lost matrix
# limber owl its on 1.8

well then you are out of luck.
Support for that ancient version was dropped almost half a decade ago.
Go read in old forum posts or update to a version that is actually used.

limber owl
river oracle
lost matrix
eternal oxide
#
[23:42:26] [Server thread/INFO]: args.length: 1
[23:42:26] [Server thread/INFO]: args[0]: nation```
nimble zinc
#

Hoooow

eternal oxide
#

and it teleported me somewhere

nimble zinc
#

Did you die btw ?

proud basin
#

I’m trying to catch things such as prints, certain executions etc…

eternal oxide
lost matrix
eternal oxide
#

I was op though

nimble zinc
#

I am too

eternal oxide
#

seems your plugin hates you

lost matrix
nimble zinc
#

Are you using last build of Paper 1.19 ?

lost matrix
#

Ah you are on Paper

nimble zinc
lost matrix
eternal oxide
#

I do everything on Spigot

nimble zinc
#

Is the teleportation very long for you too ?

#

It takes more than 3 seconds for me but I didn't add any delay

lost matrix
nimble zinc
#

Also, that no damage thing is random, don't know why

player.setNoDamageTicks(20*20);
        player.teleport(tpLoc);
lost matrix
#

looks like you are loading tons and tons of chunks in a single tick

nimble zinc
#

Hmmm

#

I'm checking the highest y in a 11x11 square

#
int highestBlockY = 0;
        // Get the highest block in the surrounding locations
        for (int i = (int)x - 5; i <= x + 5; i++) {
            for (int j = (int)z - 5; j <= z + 5; j++) {
                int y = Bukkit.getWorld("world").getHighestBlockYAt(i, j);
                if (y > highestBlockY)
                    highestBlockY = y;
            }
        }```
lost matrix
# nimble zinc I'm checking the highest y in a 11x11 square

If the chunks at those locations are not loaded then the server first needs to generate all of the chunks in that square
before it can check for the highest coordinate. Makes sense because you cant test the height in a an non-existent chunk.

nimble zinc
#

Yeah makes sense

#

My world will be pregenerated though so thats not a problem

severe turret
#

oh yeah smile

nimble zinc
#

Are the args working for you ?

lost matrix
lost matrix
severe turret
#

did you see the code i made to write PlayerData yet

nimble zinc
#

Paper 1.19 build 36 ?

lost matrix
nimble zinc
#

Oh yeah didnt see

#

Ill update

regal anchor
nimble zinc
#
[00:54:03 INFO]: Litorax issued server command: /gamemode survival
[00:54:07 INFO]: Litorax issued server command: /wild nation
[00:54:07 INFO]: [Kokiria] [STDOUT] args.length: 0```
#

Still

#
[00:55:08 INFO]: Litorax issued server command: /wild abc def jhi klm
[00:55:08 INFO]: [Kokiria] [STDOUT] args.length: 0```
#

May it be because of another plugin ?

#

Omg

#

My aliases are working

#

/rtp and /randomteleport work

#

oh my god I think i know

severe turret
#

something like this

#

Should probably put the method after the login is allowed

left swift
#

is there any way to change the gamemode of the fake player?

tawny otter
#

Any good way to make a player climb like a spider?
I could always detect if a player is near a wall then give them Levitation
but I would like for it to work just like a spiders climb (kinda like a invisible ladder)

raw totem
#

Hey 🙂

How can i get the offline player object? 👀 I only get null xd

eternal oxide
#

Bukkit.getOfflinePlayer(...) will never return null

#

even when you ask for an invalid OfflinePlayer

buoyant viper
#

?jd-s

undone axleBOT
buoyant viper
#

well ill be damned

#

its NotNull

torn oyster
#

should i register my configs in my main class

#

or should i make a separate class for registering it

eternal oxide
#

"registering"?

#

plugin has its own config. If you are talking about other configs (multiple) then definitely a handler class

buoyant viper
#

nah

#

master class master race

left swift
#

Hi, I'm doing fake players tablist right now, and I have one question. Should I recreate player tablist slots with fake players too or there is no need? (one problem that i noticed is when player changes gamemode to spectator, it disappears)

raw totem
eternal oxide
#

a Player object only exists for Online Players

raw totem
#

👍

quaint mantle
#
30.06 22:47:52 [Server]  java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LnV0aWwuaW8uV3JhcHBlcvJQR+zxEm8FAgABTAADbWFwdAAPTGphdmEvdXRpbC9NYXA7eHBzcgA1
30.06 22:47:52 [Server]  ...' at line 3
 public void createTable(){
        PreparedStatement ps;
        Configuration CallousConfig = CallousPvP.getInstance().getConfig();
        String NethPotInv = CallousConfig.getString("DefaultNETHPOTINVInventoryContents");
        try{
            ps = plugin.SQL.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS callouspvp (UUID VARCHAR(100) DEFAULT 'Nan' NOT NULL," +
                    "   NAME VARCHAR(100) DEFAULT 'Nan' NOT NULL," +
                    "   FFAKILLS INT(100) DEFAULT 0 NOT NULL," +
                    "   FFADEATHS INT(100) DEFAULT 0 NOT NULL," +
                    "   NETHPOTINV VARCHAR(65000) DEFAULT "+NethPotInv+" NOT NULL," +
                    "   PRIMARY KEY (UUID))");
            ps.executeUpdate();
        } catch (SQLException e){
            e.printStackTrace();
        }
    }

how do i make the default value be NethPotInv?

#

it ends up erroring

#

for context nethpotinv is a serialized inventory

#

a huge string

tranquil dome
#

I am unsure if I can still get support for spigot 1.8.8, but is there any way to find out whether a slab (step) is located on the bottom or the top? https://prnt.sc/snX2rsZeyeRm

quaint mantle
#

like instead of "+NethPotInv+" you do '+NethPotInv+'

native nexus
#

No

#

you know how you have 'nan'

quaint mantle
#

yes

native nexus
#

oh wait hmm

quaint mantle
#

so i do ' " + NethPotInv + " '

#

with or without ...

native nexus
#

and no spaces?

cursive kite
#

I can't find any resources on how to add tab completion on existing arguments such as if you do "time set 0" while you are still on the 0 it lets you tab for "s" "d" "m"

quaint mantle
#

it just returns nan

#

not config

#

when i print it out it prints what it is supposed to

#

okie

#
    public void createTable(){
        PreparedStatement ps;
        Configuration CallousConfig = CallousPvP.getInstance().getConfig();
        String NethPotInv = CallousConfig.getString("DefaultNETHPOTINVInventoryContents");
        try{
            ps = plugin.SQL.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS callouspvp (UUID VARCHAR(100) DEFAULT 'Nan' NOT NULL," +
                    "   NAME VARCHAR(100) DEFAULT 'Nan' NOT NULL," +
                    "   FFAKILLS INT(100) DEFAULT 0 NOT NULL," +
                    "   FFADEATHS INT(100) DEFAULT 0 NOT NULL," +
                    "   NETHPOTINV VARCHAR(65000) DEFAULT ' "+ NethPotInv +" ' NOT NULL," +
                    "   PRIMARY KEY (UUID))");
            ps.executeUpdate();
        } catch (SQLException e){
            e.printStackTrace();
        }
    }
#

when i print out NethPotInv it prints out what it is supposed to

#

i want it to be at nethpotinv by default instead of Nan

crisp steeple
quaint mantle
#

wut

#

parameters where

crisp steeple
#

it would look like " NETHPOTINV VARCHAR(65000) DEFAULT ? NOT NULL,"
and then ps.setString(1, NethPotInv)

quaint mantle
#

oh

undone axleBOT
quaint mantle
#
            ps = plugin.SQL.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS callouspvp (UUID VARCHAR(100) DEFAULT 'Nan' NOT NULL," +
                    "   NAME VARCHAR(100) DEFAULT 'Nan' NOT NULL," +
                    "   FFAKILLS INT(100) DEFAULT 0 NOT NULL," +
                    "   FFADEATHS INT(100) DEFAULT 0 NOT NULL," +
                    "   NETHPOTINV VARCHAR(65000) DEFAULT ? NOT NULL," +
                    "   PRIMARY KEY (UUID))");
            ps.setString(1, NethPotInv);
#

so like that?

crisp steeple
#

yeah

quaint mantle
river oracle
#

Idk how you manage your configs in depth

#

But something is wrong with it

quaint mantle
#

how

quaint mantle
white root
#

How do I edit the format of a chat message in console?
For instance, if I wanted to show additional information about a user in the console log of their message, how would I go about doing this?

For instance, if I wanted to change verilog [currentTime INFO] <MrMcyeet> This is a message! to this ```verilog
[currentTime INFO] <MrMcyeet@WORLD_NETHER> This is a message!

hidden kestrel
#

Does anybody know why this happens?

#
public class TerrainGenerator extends ChunkGenerator {
    
    private int size;
    private boolean generateStuff;
    
    public TerrainGenerator(int size) {
        this.size = size;
    }
    
    @Override
    public void generateNoise(WorldInfo worldInfo, Random random, int chunkX, int chunkZ, ChunkData chunkData) {

        
        for(int y = chunkData.getMinHeight(); y < chunkData.getMaxHeight(); y++) {
            for(int x = 0; x < 16; x++) {
                for(int z = 0; z < 16; z++) {
                    if(chunkX < (size) && chunkZ < (size) && chunkX >= -(size) && chunkZ >= -(size)) {
                        generateStuff = true;
                    } else {
                        generateStuff = false;
                    }
                }
            }
        }
    }
    
    @Override
    public boolean shouldGenerateNoise() {
        return generateStuff;
    }
    
    @Override
    public boolean shouldGenerateBedrock() {
        return generateStuff;
    }
    
    @Override
    public boolean shouldGenerateSurface() {
        return generateStuff;
    }
    
    @Override
    public boolean shouldGenerateDecorations() {
        return false;
    }
    
    @Override
    public boolean shouldGenerateCaves() {
        return false;
    }
    
    @Override
    public boolean shouldGenerateMobs() {
        return false;
    }
    
    @Override
    public boolean shouldGenerateStructures() {
        return false;
    }
}
#

or how I can make it not do this

#

because apparently, just replacing all blocks with AIR outside of the chunks totally overload the server, who would've guessed !!

lost matrix
hidden kestrel
#

Hmm

#

So how would I go about fixing that

#

Resetting the value ?? Surely that won't work because it might just load an unwanted chunk outside

#

or the other way around, an empty chunk inside

lost matrix
raw sky
#

Is there any way for me to detect when you press space on a mount?

lost matrix
#

The problem is that shouldGenerateNoise() does not provide the x and y coordinate. That honestly seems like a flaw in the api

hidden kestrel
#

Well I got it to not generate any chunks outside .. But now it's only generated 3 chunks out of 16 inside lol

lost matrix
# hidden kestrel Truly

I mean what you can do is request the chunks in a spiral from inwards out. So as soon as the first chunk outside of reach is
hit, you simply dont let the server generate vanilla noise anymore.

lost matrix
raw sky
#

but on a mount?

#

its a phantom too which by defualt cant jump. I can switch to a custom entity if that would help

lost matrix
#

Let me check the protocol if the client sends this information

hidden kestrel
#

Better yet - is there a way to load certain chunks manually?

lost matrix
raw sky
#

ok tysm!

lost matrix
#

World#getChunkAt(int, int)

hidden kestrel
#

Oh

#

Well that might have been a bad idea

#

because I still don't have any way for it to not generate it wrong

#

Unless, can I stop it from generating at all ??

#

So that I choose specifically what chunks to generate, and it doesn't do it at all

lost matrix
hidden kestrel
#

as far as i've read, it's not so easy getting the vanilla generator as an instance?? or have i read wrong

lost matrix
#

Like that

lost matrix
hidden kestrel
#

Yeahh

lost matrix
#

Ill think about writing a pr for this

hidden kestrel
#

Eesh

#

they're not making this easy on me huh

lime moat
#
public class TestCommand implements TabCompleter {
    private static final String[] COMMANDS = {"minecraft", "spigot", "bukkit", "google"};
    private static Main main;

    //create a static array of values

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
        //create new array
        final List<String> completions = new ArrayList<>();
        //copy matches of first argument from list (ex: if first arg is 'm' will return just 'minecraft')
        StringUtil.copyPartialMatches(args[0], Arrays.asList(COMMANDS), completions);
        //sort the list

        Collections.sort(completions);
        return completions;
    }

}``` How would I get a response when I use the command?
#

Normally I would use something like java @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {but I'm just lost.

lost matrix
lime moat
#

Basically, I just want to send this message whenever I use the command: java sender.sendMessage(MiniMessage.miniMessage().deserialize(prefix_message + ' ' + non_player_message));

lost matrix
lime moat
#

Well, my hopes in the future is to make the command /kit and have kits. However, right now I'm just testing to see how it works.

lost matrix
#

All of this makes no sense...
TestCommand implements TabCompleter
This is used to auto complete arguments for commands.
Its not an actual command implementation.

lime moat
#

I see, would I need to make a new public class with CommandExecutor?

#

(I'm very new to java lol)

lost matrix
lime moat
#

Sorry, I'm still confused on how I would use the tab completer with it?

topaz cape
#
@EventHandler(priority = EventPriority.MONITOR)
    public void invMove(InventoryMoveItemEvent event) {
        if(NBTEditor.getBoolean(event.getItem(), "ModernFFA", "immovable") || event.getItem().getType() == Material.AIR) {
            event.setCancelled(true);
        }
    }

    @EventHandler(priority = EventPriority.MONITOR)
    public void invClick(InventoryClickEvent event) {
        if(!(event.getWhoClicked() instanceof Player player)) {
            return;
        }
        ItemStack clickedItem = (event.getClick() == org.bukkit.event.inventory.ClickType.NUMBER_KEY)?
                event.getWhoClicked().getInventory().getItem(event.getHotbarButton()) : event.getCurrentItem();
        List<ItemStack> items = Arrays.asList(clickedItem, event.getCurrentItem(), event.getCursor());

        for(ItemStack item : items) {
            if (NBTEditor.getBoolean(item, "ModernFFA", "immovable")) {
                event.setCancelled(true);
                if(event.getAction() != InventoryAction.HOTBAR_SWAP) {
                    player.chat("/menu");
                }
            }
        }

    }```
slate mortar
#

not directly related to spigot, but to regex.
idk regex that good, but shouldn't "[0-9A-Fa-f]{6}" match for FF00FF or similar hex codes? because it doesnt apparently

buoyant viper
#

it should

topaz cape
#

^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$

slate mortar
#

well java says it doesnt apparently

buoyant viper
#

?paste ur code

undone axleBOT
slate mortar
#

at least 00FFFF doesn't

buoyant viper
slate mortar
#

it's just Pattern.matches("[0-9A-Fa-f]{6}", s)

slate mortar
#

why tf is there a need for such a long one

topaz cape
#

try it

buoyant viper
#

the one u have now is fine

slate mortar
#

if the short one should normally work

buoyant viper
#

dw abt it

topaz cape
#

¯_(ツ)_/¯

slate mortar
#

well lets try

buoyant viper
#

works for me with it set to Java 8 tester

slate mortar
#

apparently its not the regex thats not matching

#

but bungee's ChatColor.of("#FF00FF"); beeing null... odd

#

isnt that the right format?

topaz cape
#

seems to be

slate mortar
#

if ( string.startsWith( "#" ) && string.length() == 7 )
7?

#

tf

#

i'm confused

buoyant viper
slate mortar
#

#00ff00 should be 7

buoyant viper
#

it is

river oracle
#

You want to use hex? Just use iridium chat color api I really like there's

slate mortar
#

i try to not use 50 api's in my plugin rn

topaz cape
#

well just dont

ancient plank
#

I can't count to 50

slate mortar
#

also that doesn't answer the question why tf it's null... i'm confused

#

i can't count to 1

#

why does spigot hate me

buoyant viper
#

the result of ChatColor.of is null

#

?

#

even when supplied with a valid argument "#FF00FF"

#

?

slate mortar
#
                if (color != null) {
                    PDCUtil.setString(player, "nameColor", color.getName());
                    player.setPlayerListName(TranslationUtil.translate("player_display_name", new Placeholder("<player_name>", player.getName()), new Placeholder("<player_color>", color.getName())));
                    player.sendMessage(color + "This is your new name-color ^_^");
                } else player.sendMessage("§cPlease use a legal color code §7[§e0-9§7|§ea-f§7]");

it sends me the else message, so it apparently is

#

lemme check smt

topaz cape
#

i highly doubt the string of the color is ok

slate mortar
#

even the console output is #00FFFF

#

what the heck

topaz cape
slate mortar
#

you are

#

not nice

topaz cape
#

i know 😄

slate mortar
#

i hope you have a really bad day ._.

topaz cape
#

well i dont think neither of us did go sleep yet

#

did ya?

slate mortar
#

Timezones exist

topaz cape
#

i know mine is as same as Germany's

slate mortar
#

so?

#

i still hope you have a bad day

topaz cape
#

wait do you even remember me

desert loom
topaz cape
#

hm

#

ill look into that

buoyant viper
#

whats the value of the string right before its passed into .of @slate mortar

desert loom
#

actually that probably wouldn't work since that's for cursor events

topaz cape
#

oh

#

well cursor events are cancelled xd

slate mortar
#

well

#

?paste

undone axleBOT
slate mortar
topaz cape
#

well what u just sent is bs 😄

#

validateColor(args[0]); returns null

#

thats why you should have sent that

slate mortar
#

if it returns null

ancient plank
slate mortar
#

why tf does it print out #00FFFF

topaz cape
#

you said the color is null

topaz cape
ancient plank
#

ok and

slate mortar
#

sure i am

#

as you saw today

#

right?

topaz cape
#

not today

#

just always

slate mortar
#

lmfao

topaz cape
#

especially in ESS

slate mortar
#

who cares about ESS

#

i'm not on that server for ages anymore

topaz cape
#

okay 👍

slate mortar
#

because it has become a pile of toxicity

topaz cape
#

cool

keen spindle
#

is it possible to instantly update the code and run mc

#

to test it

topaz cape
#

its called hotswap and yes

keen spindle
#

instead of manually moving it into the paper

keen spindle
keen spindle
#

ok

topaz cape
#

maybe String.valueOf(color) isnt

#

hmm so it seems to be not null

slate mortar
#

so

#

the output of ```java
ChatColor color = this.validateColor(args[0]);
System.out.println(args[0]);
System.out.println(this.validateColor(args[0]));


is
```console
[06:04:30 INFO]: LinaGHG issued server command: /namecolor 00FF00
[06:04:30 INFO]: [Survival-Core] [STDOUT] 00FF00
[06:04:30 WARN]: Nag author(s): '[Cxlina]' of 'Survival-Core' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[06:04:30 INFO]: null

and yes, i'm putting the # in front of it

return ChatColor.getByChar(s.charAt(0));

returned by validateColor

#

oops

#

last one is ChatColor.of("#" + s);
wrong line lol

#

oh i'm an idiot

#

absolute idiot

#
    private ChatColor validateColor(String s) {
        //LEGACY codes ( §b )
        if (s.length() == 1 && ChatColor.getByChar(s.charAt(0)) != null) {
            return ChatColor.getByChar(s.charAt(0));
        }
        //Hex-Codes ( 00FF00 )
        if (s.length() == 6 && Pattern.matches("[0-9A-Fa-f]{6}", s)) {
            ChatColor.of("#" + s);
        }
        return null;
    }
```happy guessing what's the reason ._.
#

just forgot the return one the line lol. now it works fine ahhhhhhhhhhhhhhhhhh

buoyant viper
#

F

ancient plank
#

we will never know

native nexus
#

Static abuse

#

Show your classes in a pastebin

#

?paste

undone axleBOT
echo saddle
#

so, just to let everyone know, InventoryClickEvent doesn't seem to be consistent in behavior for normal mouse mode vs. touch mode.

#

If someone changes to touch mode, click events may not be handled properly.

#

If you rely on a click event for example where someone clicks outside the container (menu) to cancel, its not going to fire an event.

#

specifically, say if you are checking if the RawSlot = -999 when they click outside the menu, this event may not occur at all when the container closes

#

if you are dependent on this for state related stuff, it may break your code.

rancid snow
lime moat
#

Could someone give me some guidance on how to fix this?

keen spindle
#

its kinda confusing

#

and its saying that it only suports v8 and v11 jvm

buoyant viper
#

alternatively, use DI

#

?di

undone axleBOT
lime moat
#

In another command I have, I have java public Kit(Main main) { this.main = main; } Is that what you mean?

#

(I'm very new to Java, so I don't really understand the methods yet :P)

keen spindle
echo saddle
visual tide
#

and it takes in a Main object, like a normal function can take in arguments

#

and it sets the Kit object's main variable to the main variable that was passed into the contructor

#

so to create a new instance of a kit you would do new Kit(yourMainVariable)

#

and if youre instantiating a kit from your Main class then you can use this as your main variable

lime moat
#
        TestCommand test = new TestCommand();
        getCommand("test").setTabCompleter(test);
        getCommand("test").setExecutor((CommandExecutor) new Test(this));``` Is this somewhat on the right page?
eternal oxide
#

why separate?

#

implement TabExecutor in one class then register .setExecutor(...) It will register as both

lime moat
#

Hmmm, I'm having issues doing it not seperate.

#

.setExecutor((CommandExecutor).SetTabCompleter doesn't work which is one of the main things I would've assumed.

eternal oxide
#
public class TestCommand implements TabExecutor {```
```java
getCommand("test").seExecutor(new TestCommand(this));```
#

no casting

#

That will handle both the command and Tab completion

lime moat
eternal oxide
#

delete from your Main private static Main plugin;
In your TestCommandjava public TestCommand(Main main) { this.main = main; }

#

also delete this as it does nothing getConfig().options().copyDefaults();

lime moat
#
public class TestCommand implements TabExecutor {
    private static final String[] COMMANDS = {"test", "test1", "test2", "test3"};

    public TestCommand(Main main) {
        this.main = main;
    }

    //create a static array of values

    @Override``` Like this, correct?
eternal oxide
#

and make it not static

#
public class TestCommand implements TabExecutor {
    private static final String[] COMMANDS = {"test", "test1", "test2", "test3"};
    private Main main;

    public TestCommand(Main main) {
        this.main = main;
    }```
visual tide
#

alsooo

#

?main

keen spindle
#

can i make maven, to build only the plugin's jar file into another folder

#

instead of keeping it in the target folder

twilit roost
#

does it include armorstands?

half sinew
eternal oxide
#

they are all static

#

You never register any listeners

half sinew
#

the listeners in the SharedListener file are called on from other files i think

eternal oxide
#

test it on Spigot and see if it still errors

half sinew
#

ok

#

actually where do i even get just straight spigot

eternal oxide
#

?bt

undone axleBOT
brave goblet
#
private UUID uuid = UUID.fromString("b292e61a-e293-47cc-a6a6-5982a1ec5c5f");

    @EventHandler
    public void InvClickEvent(InventoryClickEvent event) {
        String worldname = event.getWhoClicked().getWorld().getName();
        if (worldname.equals("spawn") && event.getWhoClicked().getUniqueId() != uuid) {
            event.setCancelled(true);
        }
    }

    @EventHandler
    public void InvSwapEvent(PlayerSwapHandItemsEvent event) {
        String worldname = event.getPlayer().getWorld().getName();
        if (worldname.equals("spawn") && event.getPlayer().getUniqueId() != uuid) {
            event.setCancelled(true);
        }
    }


    @EventHandler
    public void ItemDropEvent(PlayerDropItemEvent event) {
        String worldname = event.getPlayer().getWorld().getName();
        if (worldname.equals("spawn") && event.getPlayer().getUniqueId() != uuid) {
            event.setCancelled(true);
        }
    }

RaiderRossUUID of player RaiderRoss is b292e61a-e293-47cc-a6a6-5982a1ec5c5f
The events are still triggered even if I trigger them, I am sure it's a simple mistake but what am I doing wrong?

eternal oxide
#

you can;t compare a UUID with !=

#

its an object you are performing an instance comparison.

#

use teh UUID compare methods

brave goblet
#

ah thanks :D

half sinew
#

ok well i ran build tools but cant find the spigot.jar

eternal oxide
#

It will be in teh folder where you ran buildtools

#

If it built without error

half sinew
#

i guess it didnt

eternal oxide
#

um, I have no idea. I've never seen that error and google search shows nothing

half sinew
#

rip

eternal oxide
#

did you run buildtools in a folder? and not on your desktop?

half sinew
#

i ran it in a folder on my desktop

eternal oxide
#

move it off your desktop

#

That usually gives a OneDrive error not teh one you have, but worth a try

half sinew
#

well i dont have it in onedrive so idk

#

but ill still try

eternal oxide
#

I believe teh desktop on win10 is in OneDrive

half sinew
#

mine isnt because i hate onedrive

eternal oxide
#

good

half sinew
#

i got ransomeware when i first got a pc and onedrive made it so anytime i would try wiping my pc it would come back since u know my desktop was onedrive

#

still errors out when not in desktop

#

moved it to a whole other drive

eternal oxide
#

same error?

half sinew
#

i think so?

#

yes it is

eternal oxide
#

I'm finding nothign relating to your error

#

I'll run it myself and check

half sinew
#

ok

eternal oxide
#

Mines into decompiling so its past where yours fails

chrome beacon
#

Try removing fast util from your .m2

buoyant viper
#

and make sure ur running it with git bash if ur on windows

#

bc for some reason BT doesnt like cmd

chrome beacon
#

Git bash isn't required

#

It works fine without

buoyant viper
#

idk i get one build out of it and then i need to clear the entire directory if i need a new ver

#

if i run it with git bash i dont need to clear the dir

half sinew
#

i was using git bash

eternal oxide
#

C:\Users\%USERNAME%\.m2\repository\it\unimi\dsi

#

delete fastutils if its there

half sinew
#

ok

#

alright attempt number 7

#

wait this is 1.18.2?

eternal oxide
#

you didn;t specify a version so it's building the release version

#

but that doesn;t matter

#

get it to build first

half sinew
#

it built

eternal oxide
#

ok now add teh version to the command

buoyant viper
#

me when --rev 1.19

half sinew
#

bro edited his message but didnt fix the

eternal oxide
#

I rarely do. I do it so often I no longer bother

half sinew
#

ok time to test this on spigot

twilit roost
#

im prob pretty dumb but idk what is going on..
Im setting integer sellValue to persistent data contairner of item
but it doesn't save?

#
public ItemStack setSellValue(ItemStack item,int value){
    ItemStack nev = item.clone();
    ItemMeta meta = nev.getItemMeta();
    PersistentDataContainer pdc = meta.getPersistentDataContainer();
    NamespacedKey key = new NamespacedKey(Pirates.plugin,"sellValue");
    pdc.set(key,PersistentDataType.INTEGER,value);
    nev.setItemMeta(meta);
    return nev;
}
public static int getSellValue(ItemStack item){
    ItemMeta meta = item.getItemMeta();
    PersistentDataContainer pdc = meta.getPersistentDataContainer();
    NamespacedKey key = new NamespacedKey(Pirates.plugin,"sellValue");
    if(pdc.has(key,PersistentDataType.INTEGER))
        return pdc.get(key,PersistentDataType.INTEGER);
    return -1;
}

it always returns -1

half sinew
eternal oxide
#

Magic pixies in the machine

still kindle
#

som1 can help me?

twilit roost
#

write down what you need help with

still kindle
#

i need help with serverr

regal anchor
#

Hey

still kindle
#

i need a plugin for tablist

#

can som1 gimm

still kindle
#

okee

limber owl
#

anyone know anything about perlin noise cave generation?

chrome snow
#

Hey guys, I am not sure if this is the right channel so I apologize in advance. I am trying to create a plugin that will allow players to claim 1 out of 10 islands which are in a circular formation, in their center is a island that will automatically regenerate "every n amount of hours". I am not sure what exactly I need to learn and study to be able to do that, so any help will be highly appreciated. If you can point me the right way of how custom generations work and stuff like that I would really appreciate it!

chrome snow
#

Not really, just recently started doing that.

limber owl
#

how long have you been working with java? @chrome snow

chrome snow
#

Not that long, studied it last semester in university. Im quite new to all of this, i am learning java while I am in summer break.

#

Also I apologize if I was supposed to make a Thread and not post my question like this.

limber owl
eternal oxide
#

First start with a tutorial to learn how to make a plugin

chrome snow
#

I am not sure how to ask my question properly I guess haha

chrome snow
chrome snow
limber owl
eternal oxide
#

Ok, well your question. If this is a designed map, you can specify the location of the islands.

#

so I'll assume you want only owners of the islands to build there or something

limber owl
#

he can use schematics for islands instead of procedural generation

chrome snow
#

I can explain in more detail if you would like?

eternal oxide
#

yep schematics would be simplest

chrome snow
#

The concept is this:

limber owl
#

you can have more than one schematic but really procedural generation is hard AF and I know people (including me) that have more than 2 years experience with math, programming and these and don't know how to make it

#

you would probably have to use perlin noise, determining the block that should be placed, and knowing the surrounding in numbers

chrome snow
#

A flat ocean world in a specific size. Let's say 50kx50k block range.
People would use a command / custom gui which will let them create an island (each island will be randomly generated but based of a theme, like having lakes, custom trees etc). Total of 10 islands for players. Which will be in a circle. In the center will be a bigger island that will generate randomly each let's say 10 hours or so.

limber owl
#

50000 x 50000 blocks??

chrome snow
#

It's umm

#

A flat ocean world

limber owl
#

thats still too much

#

dont get me wrong

#

but calculate it

eternal oxide
#

That is an extensive and very complex idea

chrome snow
#

Concept of this is that players won't be able to play in other worlds and stuff.

#

So that's basically their entire play world, and the center island is where they get resources and stuff.

limber owl
#

it's area of 640 000 000 000 blocks

#

and that only 256 on y axis

torn badge
#

Anyone know why setItemInOffHand always sets the amount of the item to 2?

torn badge
#

player.getInventory().setItemInOffHand(new ItemStack(Material.STICK, 1));

#

Gives me 2 sticks

chrome snow
limber owl
#

yea

chrome snow
#

I understand the concept is complex, tho I have to learn it one way or another. What's the best way to approach this? Any forums or videos I can watch to implement the basic of basic generations? So i can get the hang of it ? Or at least ways to implement schematics ? I find it fascinating so I am really interested

torn badge
limber owl
chrome snow
eternal oxide
limber owl
hidden kestrel
agile anvil
#

@chrome snow Why don't you divide your world in multiple worlds

#

Each world is an island

#

That would be much easier to manage

limber owl
#

yes, but the main point is about the generation

eternal oxide
#

A friend created a plugin called PersonalWorlds, which allowed each player to have their own world. Basically you are doing this but on one map.

#

with a Mining world

chrome snow
#

You can say so yeah. The idea is so people could have their own homes, which are their islands. The only world could actually farm and build stuff etc. The center island's only purpose is to be able to harvest resources. And you won't be able to go to other islands unless u are related to them via party/friends system I am currently working upon.

twilit roost
#

I have Enum with Strings

and I don't want to call SoundManager.SHOVEL_DIG.getName()
isn't there a way to just do SoundManager.SHOVEL_DIG?
Like Bukkit Sound does?

chrome snow
#

The only idea I get is creating n amount schematics and just place them on the exact cords I need..

limber owl
twilit roost
#

for example rn with my code I would need to do this:

limber owl
twilit roost
#

but with Bukkit's Sound class:

#

I dont want to call getName every time

limber owl
#

look what the Sound enum returns

twilit roost
limber owl
#

what does that playSound func takes in

twilit roost
#

String or Sound
oh im dumb .. 😄

#

nvm
but isn't there some other way to do this?

chrome snow
limber owl
limber marten
#

Is there an equivalent of Mini's Mapping Viewer to translate Spigot Mappings to Mojang Mappings?

chrome snow
eternal oxide
#

Spigot has Schematics

chrome snow
#

Oh, didn't know that lol, my bad. Will check it right away ! Haha

eternal oxide
#

I can;t remember their name for the life of me though

chrome snow
#

Alright boys, thank you a lot! Appreciate all the help.

chrome snow
chrome snow
agile anvil
#

@chrome snow It sounds really impossible to achieve what you need. Putting all of the 50k² islands on the same map is just too much in my mind. I don't even see how you can manage to generate it while the other players are near. Cause Worlds sucks in mc and it will just freeze everything (I think you can't it on multiple threads).

  • I can't imagine the size of your world after that 🥲
#

You should probably just create on world for each island, and if you want to make the switch, why not check if the player is in the water on the edge and make a smooth teleport to link all islands

chrome snow
chrome snow
agile anvil
limber owl
# topaz cape bump

cancel the event even when its not that item i would suggest, but you will have to debug and learn why it doesnt know that that item is not in the list

chrome snow
topaz cape
#

i only want to cancel that item

#

not anything else

limber owl
#

you asked "anyone familiar with a way of fixing this?"

#

thats it

#

and I told you to debug why it doesnt recognize it

agile anvil
#

But try. This is the best advice

chrome snow
topaz cape
#

the event geta cancelled when the croshair isn't on the item but when it's it doesn't

limber owl
#

well, you didnt ask a specific question adn this thred is not your personal feed so others can debug you code

topaz cape
#

i did show a gif

limber owl
#

still, this is not your personal thread for others to fix your code

topaz cape
#

and it's obv why because the code is obv

torn badge
#

Anyone know why EntityPickupItemEvent gets called twice?

#

That was the reason why I got 2 sticks

#

Listener is only registered once

#

Wait I know why, because I'm cancelling it so the player tries to pick it up again right away

chrome snow
#

I wish I could find my bugs that fast lmao

limber owl
topaz cape
#

ok so you didn't understand and you are fighting because you didn't understand

#

instead do something else fam

#

it's really obvious to get what's wrong

limber owl
#

hmm, and you wonder why noone responds to you

topaz cape
#

you just don't get it yet

limber owl
#

so if you know whats wrong go fix it, dont make others do it for you

topaz cape
limber owl
#

then why are you asking on spigotmc?

topaz cape
#

because that's maybe what i use

limber owl
#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

topaz cape
#

???????

#

you ok??

#

i never asked for code lololol

limber owl
topaz cape
#

and what does that have to do with spoon-feeding

limber owl
#

no, but youre asking for someone to fix it for you

topaz cape
#

no i said if anyone is familiar with a fix maybe im wrong and there's one through the spigot API

summer scroll
#

what is your goal ahmed?

topaz cape
#

and apparently the Spigot API doesn't provide the item slot destination

torn badge
#

@topaz cape You shouldn't use monitor priority if you're actually changing anything in the event

topaz cape
#

actually it gets called last

eternal oxide
#

No changes are to be made in Monitor

torn badge
topaz cape
#

but the event gets cancelled

hybrid spoke
eternal oxide
#

then cancel at HIGHEST. No changes at MONITOR

topaz cape
#

ok ok

limber owl
#

btw I just want to say that he just asked if anyone know how to fix it, now saying what

topaz cape
#

even though that's not a fix

twilit roost
#

Can I somehow display text in upper right corner?

torn badge
hybrid spoke
topaz cape
eternal oxide
#

No idea what your actual question was

limber owl
topaz cape
#

that's my question

agile anvil
topaz cape
#

notice that im willing to cancel the moving of only that item

eternal oxide
#

What event?

limber owl
#

now I understand, and I think im not the only one

hybrid spoke
torn badge
summer scroll
#

number key

topaz cape
limber owl
topaz cape
#

just press 9 when hovering to the first slot

torn badge
#

Well but it looks like it does get cancelled, doesn't it?

topaz cape
#

lol

hybrid spoke
#

and just for the protocol, i understood it right away

torn badge
topaz cape
#

what?

limber owl
limber owl
eternal oxide
#

My suggestion. Remove all your logic code and just blindly cancel the event. (as a test), at HIGHEST (never modify in MONITOR).

limber owl
topaz cape
hybrid spoke
topaz cape
torn badge
limber owl
limber owl
topaz cape
#

i sent a gif of what's wrong and what i wrote my code if my question isn't proper I don't know what is

hybrid spoke
#

let him trashtalk

topaz cape
#

im thinking it's possible to be fixed if i could get the destination of the slot through the sent packet

#

and maybe then i can either cancel the packet or just change the slot back

torn badge
#

Can't you get both slots?

topaz cape
#

nope

torn badge
#

Using getSlot() and getHotbarButton()

topaz cape
#

getHotbarbutton?

#

what that

torn badge
topaz cape
#

wait.. that should be able to fix it

torn badge
#

It returns which number was clicked

golden turret
#

what are you trying to do?

topaz cape
#

YOU'RE A GENIUS (will have to hardcode the numbers currently but yeah hopefully that works)

torn badge
#

Glad I could help!

topaz cape
#

always thought that getHotbarButton just gets the current item slot

golden turret
#

that is why we have docs

limber owl
agile anvil
limber owl
#

Im trying to make custom cave populator and doesnt really understand how to implement it into the code, this is the function that i made

    private double perlin3D(World world, double x, double y, double z) {
        PerlinNoiseGenerator perlinNoise = new PerlinNoiseGenerator(world);
        double ab = perlinNoise.noise(x, y);
        double bc = perlinNoise.noise(y, z);
        double ac = perlinNoise.noise(x, z);

        double ba = perlinNoise.noise(y, x);
        double cb = perlinNoise.noise(z, y);
        double ca = perlinNoise.noise(z, x);

        double abc = ab + bc + ac + ba + cb + ca;
        return abc / 6;
    }
#

@agile anvil

agile anvil
#

Well i don't know how bukkit manage it's world generation

#

But have a look at WorldGeneratorAPI

#

I think you can easily implement your noise generation

limber owl
#

the thing is i know how it works (mostly) but doesnt know how to add the perlin noise

limber owl
agile anvil
limber owl
agile anvil
limber owl
#

so if I do this I should be fine?

            if(perlin3D(world, blockX, blockY, blockZ) > 0.5) {
                worm.add(world.getBlockAt(blockX, blockY, blockZ));
            }
agile anvil
#

Long time no see bro

agile anvil
agile anvil
#

Could you imagine that 😂

tawdry lava
#

.

solid cargo
#

how can i set weather to clear????

limber owl
#

i think

solid cargo
#

nope. doesnt work

limber owl
#

what version?

solid cargo
#

1.8.8, to save resources

glass mauve
#

uh 1.8.x

solid cargo
#

well yes

#

.setStorm(false)?

limber owl
#

saying youre using 1.8 here is dangerous, people will send you death threats

limber owl
glass mauve
#

no idea about old versions

solid cargo
#

nope :(

#

.dispatchCommand spams my chat

glass mauve
#

there is:
#setWeatherDuration(int)
#setStorm(boolean)
#setThundering(boolean)

#

but you could maybe try to set gamerule

solid cargo
#

there is no gamerule for weather cycle in 1.8 :(

limber owl
#
@EventHandler(priority=EventPriority.HIGHEST)
    public void onWeatherChange(WeatherChangeEvent event) {
     
        boolean rain = event.toWeatherState();
        if(rain)
            event.setCancelled(true);
    }
 
    @EventHandler(priority=EventPriority.HIGHEST)
    public void onThunderChange(ThunderChangeEvent event) {
     
        boolean storm = event.toThunderState();
        if(storm)
            event.setCancelled(true);
    }
#

try this

glass mauve
solid cargo
#

bro