#help-development

1 messages · Page 1444 of 1

sage swift
#

i already said this

shy wolf
#

ik

opal juniper
#

Can a falling Block have a custom name

ivory glacier
#

Anyone know how to get the most up to date placeholder values from PlaceholderAPI?

#

Or find out when they change?

ivory sleet
#

Elaborate

ivory glacier
#

I have java public static String lpWrap(Player p, String s) { return PlaceholderAPI.setPlaceholders( p, "%luckperms_prefix%" + s + "%luckperms_suffix%" ).replaceAll("&", "§"); }

#

When I give out a role, they have to disconnect/rejoin

#

Otherwise they get old chat colour

wraith rapids
#

anything can have a custom name but i doubt falling blocks render it

ivory glacier
#
@EventHandler(priority = EventPriority.NORMAL)
    public void onChat(AsyncChatEvent e) {
        if(e.isCancelled()) return;

        e.formatter(new ChatFormatter() {
            @Override
            public @NotNull Component chat(@NotNull Component displayName, @NotNull Component message) {
                return displayName.append(Component.text(":").append(message));
            }
        });
    }

My event listener

ivory sleet
#

Pixel well you could hook into LP API listening for direct changes

ivory glacier
#

But I set the format on chat

#

So it should get the new values every time right?

ivory sleet
#

Format is format tho

ivory glacier
#

oh

ivory sleet
#

Yeah well depends on how exactly you’re doing it but most likely

ivory glacier
#

I only set displayname on join

ivory sleet
#

Okay?

ivory glacier
#

Yeah I think that's it ^^

wraith rapids
#

that means that you only grab the placeholderapi replacements on join

ivory glacier
#

ty

#

Yeah

shy wolf
#

it's not working

wraith rapids
#

define not working

ivory sleet
#

🥲

shy wolf
#

cont not_working = idk

#

jk

#

this

wraith rapids
#

what

shy wolf
#

what what

night copper
#

what what what

wraith rapids
#

what do you mean not working

#

explain what it is that you expect to occur

#

and explain what is actually taking place

shy wolf
#

i what to make a menu

#

and i whant to make a thing

ivory sleet
#

sounds nice

shy wolf
#

idk

wraith rapids
#

that doesn't help me help you

sage swift
#

what does the flag mean

shy wolf
#

what

eternal oxide
ivory sleet
shy wolf
#

oh shit here we go agin

#

@wraith rapids

#

fuck you

sage swift
#

kek

ivory sleet
#

very polite of you fish guy

shy wolf
#

plz die

wraith rapids
#

anyway

#

if you want help

shy wolf
#

nvm

wraith rapids
#

you need to be able to say something other than "idk" when I ask what's wrong

#

is the gui not opening? is the item not doing anything when you click it? is there an exception when you click it? does it even load? does it behave somehow unexpectedly otherwise

#

i'm willing to put the giblets aside but you'll have to be cooperative if you want help with your issue

wispy fossil
#

lmaoooo

sage swift
#

you should have seen what he said

wispy fossil
#

"I want to make a thing"

shy wolf
#

STOP

wispy fossil
#

crazy fish
fish, but crazy

shy wolf
#

STOP RN

sage swift
#

why

ivory sleet
#

sir this is help development 😉

lost matrix
#

The problem is that the creative actions are completely client side.
So the client tells the server what item the user created. And the client thinks it actually has that lore.
So modifying item packets does not modify the item directly. But if the client is in creative he thinks
the item has those modifications and therefore tells the server the state which is accepted because item
creation is partly client authoritative in creative mode.

wraith rapids
#

i have no idea what we're talking about but creative is batshit broken and you should give up with whatever you're trying to do if it involves creative mode

lost matrix
#

I kind of didnt care because the plugin was only supposed to work in survival mode anyways.
One could possibly track incoming packets and mark the modified items somehow. So it might be possible.

young knoll
#

Yeah the game trusts the client a ton in creative

#

Which is annoying

#

I could use the PDC to store the lines that need to be removed when the item is updated, but that would get pretty bulky

warm galleon
lost matrix
#

Create a database that tracks all items and query the table each time a packet containing items goes out or in.
But make sure that the DB doesnt run on the same machine. Get a cheap one in indonesia.

young knoll
#

I might just do the PDC route

warm galleon
#

whats pdc

young knoll
#

It's only for tools, weapons, and armor, which players generally don't have a ton of

lost matrix
young knoll
#

I wish I could somehow add a namespaced key to a lore line

wraith rapids
#

you kind of can

#

how it was done back in the day is you converted your key or data or whatever into hex and then used colorcodes to write it into the lore

#

since the client doesn't render colorcodes, it's basically invisible

young knoll
#

You could probably improve that further with hex color codes

wraith rapids
#

or since lores are components now you could probably hide arbitrary data in like click-event value or something

young knoll
#

I could register the custom enchantments as real enchantments so they display automatically, then I only need to worry about the bottom lines

wraith rapids
#

does the client even render custom enchantments properly

#

i remember it being an issue before

lost matrix
wraith rapids
#

it like needs translation keys or something to display them and that blows up

lost matrix
#

For me it was an issue at least

young knoll
#

Ah, darn

chrome beacon
#

Yeah you still need to add lore

wraith rapids
#

but like yeah you can store unlimited arbitrary data in the lore if the pdc itself is an issue for some reason

#

probably not gonna get you far with creative shenanigans though

#

what's the actual issue you're trying to solve

chrome beacon
#

Working with creative is a mess

wraith rapids
#

i can't see replies so idfk what we're talking about

young knoll
#

I will probably just store an array of strings in the PDC that need to be removed when the item is updated

#

Side note, why don't we have a PersistantDataType.STRING_ARRAY yet

wraith rapids
#

do we even have UUID yet

young knoll
#

no

wraith rapids
#

we will never have anything

young knoll
#

But the example on the docs shows a uuid one

lost matrix
#

I have a ton of custom pdc types in my library including stuff like <byte[], ItemStack[]> or event <byte[], Inventory> ...

#

And UUID ofc

young knoll
#

What about String[] :p

sage swift
#

store pdc in pdc when

young knoll
#

I mean

#

You can

lost matrix
eternal night
#

But but you can store PDC in PDC

#

:(

young knoll
#

I assume I could just String.join the array with some kind of delimiter

wraith rapids
#

implementing them is trivial

lost matrix
#

PersistentDataType.TAG_CONTAINER

ivory sleet
wraith rapids
#

i just don't have the effort to cuntpaste them into my library every time I need one

#

so i never end up adding them into the library

#

so i just end up cuntpasting them into the project itself

#

and have a million duplicate impls

lost matrix
#

tf is "cuntpasting" XD

young knoll
#

This is why I just shade my library

wraith rapids
#

like yeah I shade it too

#

but I still need to open the project to include the new impl

#

and then build

#

and install

#

and then open the original project back up

#

and update maven indices

#

and it's just ugh on a low end machine

young knoll
#

Actually, I could probably serialize a List<String> to a byte[] easily enough

#

Or set<String>

lost matrix
#

List<String>
Hm. Generic types are tricky

wraith rapids
#

generic serializer for T,C extends Collection<T> and then just cast and shit

#

basically all collections can be serialized and deserialized with iterators so the underlying impl remains the same

lost matrix
#

I did this hacky stuff

public class StringList extends ArrayList<String> implements Serializable {

  public StringList() {
    super();
  }

  public StringList(final Collection<String> collection) {
    super(collection);
  }

}
public class PDCTypeStringList implements PersistentDataType<byte[], StringList> {

  @Override
  public @NotNull Class<byte[]> getPrimitiveType() {
    return byte[].class;
  }

  @Override
  public @NotNull Class<StringList> getComplexType() {
    return StringList.class;
  }

  @Override
  public byte @NotNull [] toPrimitive(@NotNull final StringList complex, @NotNull final PersistentDataAdapterContext context) {
    final ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try (final ObjectOutputStream oos = new ObjectOutputStream(bos)) {
      oos.writeObject(complex);
      oos.flush();
    } catch (final IOException e) {
      e.printStackTrace();
    }
    return bos.toByteArray();
  }

  @NotNull
  @Override
  public StringList fromPrimitive(final byte @NotNull [] primitive, @NotNull final PersistentDataAdapterContext context) {
    final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(primitive);
    StringList strings = new StringList();
    try (final ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream)) {
      final Object obj = objectInputStream.readObject();
      strings = (StringList) obj;
    } catch (final EOFException ex) {
      System.out.println("End of file reached.");
    } catch (final ClassNotFoundException | IOException ex) {
      ex.printStackTrace();
    }
    return strings;
  }
}
wraith rapids
#

just need to have a supplier for the collection type as a parameter

warm galleon
wraith rapids
#

<T,C extends Collection<T>> PersistentDataType<C,byte[]> giveMeType(@NotNull Supplier<C> ctor, @NotNull Function<T,byte[]> elementSerializer)

young knoll
#

Error: cannot use 'this' in a static context

wraith rapids
#

then just Util.getMeType(() -> new HashSet<>(), String::getBytes(), String::new)

eternal night
#

PDC hacker :(

warm galleon
#

well thats why i suck at java

#

¯_(ツ)_/¯

#

probably also why i go on github to copy code

young knoll
#

Eh... what

warm galleon
#

?

young knoll
#

Turns out spigot has an outdated version of apache commons

wraith rapids
#

imagine that

#

it's almost as if literally fucking everything spigot includes or depends on is half a decade out of date

opal juniper
#

I’m assuming that a lot of stuff will be updated when 1.17 comes out cause Java 16 and all

young knoll
#

Doubt it

#

Spigot likes backwards compat

wraith rapids
#

they're probably going to use a bytecode hack to rewrite plugins from java 8 to java 16 on the fly

#

can't have those fucking 1.8 plugins breaking can we

opal juniper
#

Lmao

young knoll
#

I switched to the code 7smite7 posted instead of SerializationUtils and it works fine

opal juniper
#

Smite

#

xD

wraith rapids
#

well, i guess java is pretty forward compatible to begin with

opal juniper
#

I got the weird blocks that formed fixed by using pdcs @wraith rapids

#

Which I was pretty happy about

wraith rapids
#

so you would only need to replace reflective hacks with methodhandles hacks or direct bytecode hacks

opal juniper
#

Ehh, idk. I feel like they are just gonna do something stupid

heady garden
#

Im trying to setup a scoreboard on bungeecord

#

keep getting NoSuchMethodError : net.md_5.bungee.protocol.packet.ScoreboardObjective.setType(Ljava/lang/String;)V

magic summit
#

how do I add on essentials a new sell?

wraith rapids
#

the method you're trying to call doesn't exist

heady garden
#

I followed multiple tutorials

#

they all used it?

wraith rapids
#

the method still doesn't exist

#

it could be that the tutorial was outdated

magic summit
#

how do I add on essentials a new sell?

wraith rapids
#

what is a new sell

warm galleon
#

whats a sell

#

and dont crosspost if thats a rule

#

its annoying

wraith rapids
#

and unless it's development related, you can piss off into #server-help

warm galleon
#

i alr replied to your question in the other channel

wraith rapids
#

yeah that

#

i don't get channel autocompletitions

upper adder
#

is using a player as a key for a hashmap troublesome? I have a hashmap that appears to have duplicate keys where the keys are players. when I forEach the HashMap and print the UUID of the players and the points I have a duplicate entry:

e69d7cd6-5355-49ad-a4a5-a4219a075de4  ->  3
e69d7cd6-5355-49ad-a4a5-a4219a075de4  ->  4

are player objects not reliable as keys should I just use UUIDs?

warm galleon
magic summit
#

ok

wraith rapids
#

you should discard any players upon logout

#

each time the player logs out and logs back in, a new player object is created for them

#

this new player object is not equal to the old player object

upper adder
#

that's the issue thank you

wraith rapids
#

meaning that both the old and new player objects can exist as keys at the same time

upper adder
#

yeah I see they aren't the same

wraith rapids
#

use UUID keyed maps if you want to persist data past login

upper adder
#

it's fine all the data gets reloaded upon logging back in and saved after log out I just have to make sure to delete it

wraith rapids
#

if you store Player anywhere, you should always be sure to clean out those player objects the moment the player logs out

hollow canopy
#

How can I save a shulkers inventory?

sage swift
#

BlockStateMeta

hollow canopy
#

I tried that

#

@sage swift

sage swift
#

try harder

hollow canopy
#

I tried to make player can open shulkers from their inventory

#

it works

sage swift
#

done before

#

let me get my code

hollow canopy
#

okey..

sage swift
#
    private void saveShulker(ItemStack item, Inventory shulkerInv) {
        ItemMeta itemMeta = item.getItemMeta();
        BlockState blockState = ((BlockStateMeta) itemMeta).getBlockState();
        ((ShulkerBox) blockState).getInventory().setStorageContents(shulkerInv.getStorageContents());
        ((BlockStateMeta) itemMeta).setBlockState(blockState);
        item.setItemMeta(itemMeta);
    }```
hollow canopy
#

so you used storagecontents()

gaunt eagle
#

I'm trying to write a very simple input - output message, but I got an error. Can anybody help me?

hollow canopy
#

can you send it with line numbers

gaunt eagle
#

oh

#

okey

#

Main:

#

Config:

#

LoginLeaveListener:

#

Error:

gaunt eagle
# gaunt eagle

I also don't understand why getLeaveMessage() will never be used 🤔

hollow canopy
#

you should add

gaunt eagle
#

also config.yml:

giris-mesaji: '§7Giriş yaptı'
cikis-mesaji: '§7Çıkış yaptı'
hollow canopy
#

implements Listener to your main public final class Main extends JavaPlugin {

#

I am trying to find the error

gaunt eagle
hollow canopy
#

where

gaunt eagle
hollow canopy
#

oh okey

#

Can I send a friend request?

#

We should speak our language

gaunt eagle
#

okey xD

ivory sleet
#

Oui oui

#

Bonjour

mortal hare
#

what's the name of the sort which maps values to the index of new array, and then iterates that array and checks if that array index is not 0
it basically utilises two loops. One iterates the old array and transforms value to the new array's index and sets that index to the iterated value, and the next for loop iterates that new array with defined indexes
or is it something i myself invented lol
it seems memory hungry for missing big integers, since the array size as big as the biggest value(edited)
but its dirt cheap for a cpu
all it does it sets the value to the new index
it seems very efficient

wraith rapids
#

Integer.MAX_VALUE wants to know your location

mortal hare
#

but its very efficient for non missing integer data

#

both for ram and for cpu

wraith rapids
#

ideal for a dense index yes

#

sparse indices not so much

#

a tool for its job

#

as for what it's called, dunno

heady garden
#

is there a way to access the bungeecord server name from a spigot plugin

gaunt eagle
sage swift
#

i think he wants the name

heady garden
#

^

#

like in the config how I set it as Lobby1, Lobby2 etc.

gaunt eagle
mortal hare
#
int array[4] = {1, 8, 9 ,5}

int newArray[9];
for (int i = 0; i < 4; i++) {
  newArray[array[i]-1] = array[i];
}

would result in array:
[1, 0, 0, 0, 0, 5, 0, 8, 9]
by iterating that new array you check if the value is 0 you reorder it with some magic or create new array and voila, sorted array. this is C btw

quaint mantle
#

Follow markup conventions

gaunt eagle
#

@wraith rapids can u there ?^^

quaint mantle
#

`Test`

It doesnt work on android :angry:

mortal hare
#

```java
code
```

gaunt eagle
vagrant stratus
#

lol

heady garden
#

I just want to put the server name on the scoreboard

gaunt eagle
#

ah

#

You know this is a developer channel, right?

heady garden
#

Yes

gaunt eagle
#

I thought you wanted to write some code

#

or?

heady garden
#

I do

#

I want to know how I can access the name of the bungeecord server from a spigot plugin

#

or if it isnt possible

gaunt eagle
heady garden
#

I haven't been able to figure it out, does someone know how to?

vagrant stratus
#

Something could be impossible if it's not ya know, possible to actually do @gaunt eagle

wraith rapids
#

use plugin messaging channels or sockets or whatever

heady garden
#

came for plugin help, ended up getting philosophy lessons :sad:

gaunt eagle
gaunt eagle
sullen marlin
heady garden
#

thank you

gaunt eagle
# gaunt eagle

I discovered that the problem is with getJoin and getLEave messages but I don't understand exactly what it is

quaint mantle
#

So I use SimpleScore Plugin but On Luck Perm i need to use & and on the SimpleScore u cant use & so what do I do?

onyx shale
#

not that much

#

if the author was so lazy to simply add a color translation its prop not worth

#

using it

quaint mantle
#

So what plugin do i use

quaint mantle
#

Ok

somber hull
#

So

#

I have a plugin that deletes the item in your inventory if it is in the config

#

it works fine

#

but there are some block, that it just dont worky

#

like command_block: 1

#

or other blocks like that such as spawner, jigsaw, repeating_command_block, etc

wraith rapids
#

show code

sage swift
#

if (type != Material.COMMAND_BLOCK) <-- remove this part

somber hull
queen dragonBOT
somber hull
wraith rapids
#

what am i looking at

somber hull
#

a lot

#

leme explain it

#

its looping through the items in invenbtory

#

then looping through keys

#

and seeing if they match

#

the key is == to command_block

wraith rapids
#

why are you cloning a new itemstack with the item's type and then checking issimilar

somber hull
#

to check if it has NBT

wraith rapids
#

hasItemMeta

somber hull
#

that works better

#

thank you

#

im planning on going through and making it all better

#

just need to get bugs sorted out first

wraith rapids
#

are you on 1.8 or something

somber hull
#

1.16

wraith rapids
#

use the item PDC instead of nbt editor

somber hull
#

ok

#

is it simple to use>?

wraith rapids
#

relatively straight forward

somber hull
#

Well does it really matter if i use that or the other one?

wraith rapids
#

basically a Map but with one or two extra doodads

somber hull
#

I mean ill look into using the normal one, but is there a difference?

wraith rapids
#

using nbteditor means that your build is version specific and probably will explode sooner or later when item related nms is changed

#

pdc is part of the api and will be supported by bukkit until like 2300

#

because it is fucking illegal for the api to drop support for literally anything

somber hull
#

But any reason why it doesnt detect command_block?

wraith rapids
#

not sure

somber hull
#

wait

#

hang on

wraith rapids
#

throw some debug at it i guess

somber hull
#

i know it wasnt working before

#

but i tried a fix

#

but i was opped

#

leme deop and try it

#

it works

wraith rapids
#

iterating over the entire config section for every item in the player's inventory is pretty inefficient

#

consider precomputing a Set of Materials and checking Set::contains

somber hull
wraith rapids
#

no, don't iterate

somber hull
#

a map

wraith rapids
#

having to iterate through things to find something is a sign that you're doing somethin wrong

somber hull
#

lol

#

yea i havent really worked with maps, if thats what i should use

wraith rapids
#

everything should be keyed such that you can easily query it without having to iterate over a potentially unbounded number of elements

#

f.e a Map with the Material as key and Integer as value to represent the min number of items or whatever

#

instead of iterating over every single element in a list and checking every single one if it matches

#

you'd just do map.get

#

which is a single operation

#

and doesn't become slower as the map gets bigger

somber hull
#

yea

#

oo

#

so do map.contains

#

then if thats true then map.get?

wraith rapids
#

containsKey but yeah

somber hull
#

ok

#

thank you

wraith rapids
#

though you can just do map.get and then check if it returns null

somber hull
#

Ill probably be back here if i cant figure out maps lol

wraith rapids
#

as a sort of combined contains&get

somber hull
#

Yea

wraith rapids
#

if the map doesn't have a value for that key, it returns null

#

if it does, it returns the value

somber hull
#

ok

#

if(plr.getGameMode().equals(GameMode.CREATIVE))return;

#

this checks for creative correct?

wraith rapids
#

yes but use == to compare enum constants

gaunt eagle
#

Tip:

compact haven
#

.equals and == on an enum make no difference

#

it'll never require debugging since that wont be a root cause

#

🤔

vagrant stratus
#

== is better than .equals though :p

eternal night
#

One method call less :>

ivory sleet
#

Objects::equals md_5

compact haven
#

well I never said that equals isnt trash for enum or constant comparisons

#

looks ugly and is ugly kekw

#

just saying it wouldnt require any debugging

ivory sleet
#

It’s null safe and removes awkwardness so yeah I agree with u

warm galleon
#

jk lmaoooooo

ivory sleet
#

Hilarious

upper adder
#

can anyone link any good maven or dependency tutorials? I'm completely lost right now trying to port my project over to work with maven

drowsy helm
#

I can walk you through the basics if you'd like

upper adder
#

I'm using IntelliJ and added the maven framework

#

my pom.xml looks like so:

<?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>me.imp</groupId>
    <artifactId>MapPlugin</artifactId>
    <version>1.0-SNAPSHOT</version>

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


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

when I package the project it generates MapPlugin-1.0-SNAPSHOT.jar so I place that in my plugin folder however it fails to load without any errors

quaint mantle
#

There is indeed an error

#

or your code just doesnt work

upper adder
#

it was working perfectly fine before I tried adding maven

#

ok nvm now its working i literally didnt change anything

#

alright so now I need help actually adding a dependency

#

where should I be cloning the repository to?

drowsy helm
upper adder
#

the plugin is working now

#

not sure why it went from not working to working suddenly I didn't do anything just repackaged it

#

anyways could you help me out with adding a dependency ?

drowsy helm
#

yeah sure, what did you want to add?

upper adder
#

so it says to clone the git repository to my local maven repo

#

I don't know where to find it though

drowsy helm
#

ew manual dependency install

#

get a new api lol

upper adder
#

yeah ill just look for another one I can't figure out how to install this

upper adder
#

the dependency is like so:

<dependency>
  <groupId>fr.minuskube.inv</groupId>
  <artifactId>smart-invs</artifactId>
  <version>1.2.7</version>
</dependency>
#

wait nvm its not red anymore

#

so I added the dependency above to my pom.xml

#

but when I packaged and attempted to start up my server

#

Error occurred while enabling ImpsPlugin v1.0.0 (Is it up to date?) java.lang.NoClassDefFoundError: fr/minuskube/inv/content/InventoryProvider

#

what am I missing to make this dependency work?

sage swift
upper adder
#

I want it to be included within the plugin jar is that not the purpose of maven or am I completely off?

sage swift
#

shading

#

unless you shade it, it won't show up

upper adder
#

I'll look into it thank you

#

also both the compiler and shade plugins aren't found

outer sorrel
#

I have a custom event thats async and is called async but also another piece of code that is sync and wants to call the event but it says

Could not pass event BlockPlaceEvent to FlappyAnticheat v1.6.0-BETA
java.lang.IllegalStateException: FlagEvent may only be triggered asynchronously.
#

I have tried

Bukkit.getScheduler().runTaskAsynchronously(FlappyAnticheat.getInstance(), () -> Bukkit.getPluginManager().callEvent(flagEvent));

but it doesnt let me cancel the event from an outside plugin

queen dragonBOT
sage swift
#

well since it's async you wont get a response to whether it's cancelled or not until it's been called

#

so based on what outside plugins do to the event, you can handle all that within the runTaskAsynchronously

outer sorrel
#

i just ran the function that has the event call in it async instead of the actual event call

sage swift
#

cause you gotta realize that even though there may be code after runTaskAsynchronously, it'll be run before the code within runTaskAsynchronously

quaint mantle
#

Where can I find the documentation?

quaint mantle
#

share your code

#

I don't have any code, I was just trying to find the documentation but I found it

kindred vale
#

Hi, how can I know why my spigot plugin was removed?

sharp badge
#

Could anyone tell me why I'm getting a method not found error on the following code:

Error:
java.lang.NoSuchMethodError: me.ryanhamshire.GriefPrevention.Claim.getOwnerID()Ljava/util/UUID;

Code:

public boolean isClaimed(Claim c, UUID uuid){
        return c.getOwnerID().equals(uuid);
    }```

GPP has https://i.imgur.com/uYfCNW2.png in the class im referencing
young knoll
#

Do you have GP running

sharp badge
#

Yes

young knoll
#

And depend setup in your plugin.yml

sharp badge
#

Yeah

quaint mantle
#
/**
 * Execute the trial code.
 */
void exec()
{
    // TODO insert execution code
}

Nutty

young knoll
#

They are using C# styles brackets

#

Not sure what other languages use it

subtle kite
#
...  
player.getInventory().getItemInHand().setAmount(wand.getAmount()-1);
                    player.updateInventory();
...

Anyone know why this wouldn't work?
I have created a itemstack that is why wand . is where it is
fix was player.getInventory().removeItem(wand);. Anyone want to know

drowsy helm
#

better off getting the item itself and incrementing, then setting

sage swift
#

bro

#

you are the second person today to use player.updateInventory()

#

that is a method only used when the inventory desyncs

#

which it shouldnt in this case

cinder thistle
#

It is a literal waste of space

ivory sleet
#

It’s called allman but ye it’s a waste of space totally

sinful kelp
#
e.setFormat(msgHandler.color(prefix + p.getDisplayName() + "&f &8» &7" + e.getMessage()));```
https://gyazo.com/89c78890af452b3ae9e2760183cc7096
#

Why is it adding this weird character

#

I'm using IntelliJ for the first time in a while

sullen marlin
#

make sure your source is utf-8

sinful kelp
#

yoooo its md_5 thats crazy

#

love ur work

#

my first ever coding project was a Bukkit plugin about 10 years ago, I'm now in University studying a major in Software Engineering. Thanks for your work <3

tardy delta
#

Hello here I'm again
I was trying to make a container lock system that stores hashsets with the uuid of the owner inside the persistant data container of the block. How can i do this exact? Please give me an example or something this is the first time I do this

candid galleon
#

store the UUID with the PDC

#

looks like the UUID object isn't supported

#

so you'd have to cast it to a string

tardy delta
#

yea

eternal oxide
#

4 longs

candid galleon
#

or that

eternal oxide
#

or follow the PDC tutorial/example and it shows you how to store a UUID in the PDC

candid galleon
#

^

tardy delta
#

i havent access to spigotmc on internet :/

#

school wifi

candid galleon
#

use VPN/tor

eternal oxide
#

then don;t bother attempting to write code, without access to the javadocs

candid galleon
#

or download the javadocs

#

you shouldn't be coding on a school pc either lol

tardy delta
#

uhh its study hour

eternal oxide
#

Get back to your lessons and learn all that crap you'll never need once you graduate.

tardy delta
#

^^

#

bleh

#

study hour i said XD

tacit drift
candid galleon
#

I mean like

sinful kelp
candid galleon
#

they're not mutually exclusive

sinful kelp
#

but thanks for correcting me!

#

even tho you're wrong

candid galleon
#

bOTh of YoU ArE CoRrEcT

tardy delta
#

rip protonvpn

#

broken

quaint mantle
#

Thanks you 🙂 But errors :(public void gogo() { file = new File(Bukkit.getPluginManager().getPlugin("Citizens").getDataFolder() + "saves.yml"); CitizensFile = YamlConfiguration.loadConfiguration(file); CitizensFile.getConfigurationSection("npc").getKeys(false).forEach(Bukkit::broadcastMessage); } ->

candid galleon
#

that should be getDataFolder(), not +

eternal oxide
#

You should not be accessing another plugins data files directly, but also you are missing a file seperator

candid galleon
#

and what's line 47 of the NPC.java file?

quaint mantle
candid galleon
#

and what's line 47 of the NPC.java file?

quaint mantle
candid galleon
#

so either CitizensFile or the npc config section is null/empty

quaint mantle
#

hmm

#

but it's not empty 🙂

#

OH!
wait

#

it works nowwwwwww

#

I guess i was typed miss

#

Ty

eternal oxide
#

Why are you not using teh Citizens API?

candid galleon
#

why would you use the citizens api 🤮

quaint mantle
#

cuz I want use my plugin 🙂

eternal oxide
#

Ok, a more direct question. Why are you directly accessing the datafiles of Citizens instead of obtaining data via its API?

quaint mantle
#

cuz i want move my npc data from citizens/saves.yml to my config 🙂

eternal oxide
#

Why do you need to read it from their data files? Surely you know how you created your NPC's so you already have the data

quaint mantle
#

nop

#

I didn't wrote data

#

so i'll write

eternal oxide
#

I'll give up asking

quaint mantle
#

sure

#

i'll answer gladly

eternal oxide
#

I only ask because if there is a way to get the data you want via the API you should use it

quaint mantle
#

ah

#

what api?

eternal oxide
#

directly accessing another plugins data files can have unpredictable results.

quaint mantle
#

omg

#

I should use it

eternal oxide
quaint mantle
#

Hey there! I just wanted to ask if there's a way to check if a player is near an entity or location.

candid galleon
#

There is

#

compare their location and distance

#

Entity#getLocation and Location#distanceSquared(Location)

quaint mantle
#

Okay

#

thank you

#
    @EventHandler
    public void onMove(PlayerMoveEvent e) {
        Player player = e.getPlayer();
        int radius = 2;
        World lobby = Bukkit.getWorld("lobby");
        Location BoostLoc = new Location(lobby, -236, 9, 341);
        if(BoostLoc.distanceSquared(player.getLocation()) == (radius^2) || BoostLoc.distanceSquared(player.getLocation()) > (radius^2)) {
            
            Vector v = player.getLocation().getDirection().multiply(-1.5D).setY(1.0D);
            player.setVelocity(v);
            }
        }```
#

this isn't working

#

it's boosting the whole time

#

not only at the location

eternal oxide
#

use >= instead of testing twice

#

also it shoudl be <= to only work at the location

sinful kelp
#

nvm fixed it

lost matrix
#

squaring in java:
x * x
or
Math.pow(x, 2)

quaint mantle
#

I know, I fixed it

#

but thanks anyways tho

quaint mantle
#

hey im making an AntiSpam Plugin and i want it to make it that one someone spams it kicks them but not a normal a kick a plugin kick iwant this line to run the command /mute (player) 1h

#

SpamDetector.getInstance().getCooldown().remove(player);

thats the part of the codfe i want to change

lost matrix
quaint mantle
#

it can't be like that

#

@Override
public void run() {
if (type == SpamDetector.Type.DELAY) {
SpamDetector.getInstance().getCooldown().remove(player);
} else if (type == SpamDetector.Type.REPEAT) {
SpamDetector.getInstance().getLastMessage().remove(player);
}
}
}

#

thats the complete code

eternal oxide
#

This is clearly someone elses plugin you are modifying. You need to learn Java better before trying to modify a plugin without adequate knowledge.

lost matrix
#

I dont see the problem...

quaint mantle
#

im not

#

its my own one

#

i just forgot bro

lost matrix
quaint mantle
#

yea but how do i put it in my code in a way to get no errors

#

and the command isnt just /mute player

#

its /mute player 1h for example

lost matrix
#

Then expand the method with another String which defines the duration.
Then you can just call that method with the proper parameters.

#

Pretty basic Java

quaint mantle
#

my brain is on an overload

eternal oxide
#

Seems asleep to me

clear lagoon
#

hello

lost matrix
# quaint mantle my brain is on an overload

Last spoon:

  public void muteThroughCommand(final Player player, final String duration) {
    final String playerName = player.getName();
    final String command = "mute " + playerName + " " + duration;
    final ConsoleCommandSender commandSender = Bukkit.getConsoleSender();
    Bukkit.dispatchCommand(commandSender, command);
  }

If you cant use this then you should probably refresh your basics.

clear lagoon
#

where can i see what i buyed on spigot

#

where can i see what i buyed on spigot?

quaint mantle
#

god dang it bro I CAN OPEN ANOTHER PUBLIC VOID ITS ALREADY IN ONE

eternal oxide
#

Learn Java and no need to shout

lost matrix
clear lagoon
#

thx

lost matrix
quaint mantle
#

Bukkit.getScheduler().runTaskAsynchronously(AntiSpam.getInstance(), new MessageCooldown(Type.DELAY, player), AntiSpamConfig.getInstance().getDelay() * 20);

Ive got everything imported and the getDelay is imported to and i get an error

#

public int getDelay() { return delay; }

this is it

#

any1?

lost matrix
#

Whats the error?
Also dont use a scheduler for a message cooldown.
Just use a timestamp on the last message and when the next message occurs, calculate the difference between the current and the last message.

quaint mantle
#

its eazier for me

lost matrix
#

Using a timestamp is objectively more trivial, performant and easy but ok.
What exactly is your error?

quaint mantle
#

i can't post screenshots here

#

"Cannot resolve method 'runTaskAsynchronously(me.bender.bender.AntiSpam, me.bender.bender.MessageCooldown, int)"

#

Lol

#

🥵

lost matrix
#

its runTaskTimerAsynchronously

quaint mantle
#

🥶🥶

#

good point

#

what can i do with it?

#

🧑‍🚀

#

👚

#

how can i fix it

#

🦷

lost matrix
#

Use the method runTaskTimerAsynchronously instead of runTaskAsynchronously

quaint mantle
#

k

#

👚

#

now it showes me that :

On the runTaskTimerAsynchronously on the little () i get a red line and at the end ) i get a red line

lost matrix
#

Btw how does your MessageCooldown class look like?
Because im almost certain that your plugin will crash because of concurrent modification from two threads.

quaint mantle
#

1 SECFIXED IT

#

FIXED IT POGGES

#

poggers

#

people call me big brain

lost matrix
#

Btw how does your MessageCooldown class look like?

quaint mantle
#

idk software crashed

#

day in a life of an HDD

quaint mantle
#

name: BenderILAntiSpam author: bender version: 1.0 main: me.bender.BenderAntiSpam.AntiSpam permissions: antispam.*: description: give access to spam and everything about this plugin children: antispam.ignoreDelay: true antispam.ignoreRepeat: true antispam.ignoreDelay: description: give access to spam without delay poggers default: op antispam.ignoreRepeat: description: give access to repeat message Poggers default: op

#

this is my path.yml

#

any1 know whats the problem? it dosen't show up when i hit /pl

chrome beacon
#

Rename it to plugin.yml

#

And make sure it's in the jar

quaint mantle
#

wdym the name of it is plugin.yml

chrome beacon
quaint mantle
#

o i missed it

#

i misstyped it

#

its plugin

daring sierra
#

🤦

chrome beacon
#

Then make sure it's in the jar

quaint mantle
#

what?

#

i sent you a screensshot

chrome beacon
#

Your plugin.yml needs to be inside the plugin jar

#

Why is it in src

#

Put it in resources

quaint mantle
#

wdym resources

#

like drag it to where it says BenderAntiSpam

chrome beacon
#

Actually you might not be using maven

quaint mantle
#

?

chrome beacon
#

Either way when you export the jar it needs to include that file

quaint mantle
#

so do i need to do it

chrome beacon
#

Well that's up to you

quaint mantle
#

wdym

#

i just want it to work

chrome beacon
#

As long as the file is in the jar it doesn't matter where it is in the project

quaint mantle
#

so y doesn't it work

#

app crashed: day in a life of HDD

chrome beacon
#

Because you haven't included the plugin.yml in the jar yet

quaint mantle
#

HOW

#

im confused

chrome beacon
#

Hm I'm feeling a bit rude xd

#

Open project structure

quaint mantle
#

k

chrome beacon
#

And click the plus icon and add the file

quaint mantle
#

on artifacts?

chrome beacon
#

Yes

quaint mantle
#

ive already got the artifact

#

i got the file

#

but it dosen't work

chrome beacon
#

How does your artifact menu look

#

Screenshot it

quaint mantle
#

sent it

hollow canopy
#

@sage swift

#

I used your code like this

#

but it isnt working I mean the code is working but it didnt save shulker inventory

#

whats wrong

lost matrix
hollow canopy
#

sorry :d

lost matrix
#
  1. No single letter variables. e -> event
  2. Formatting -> Your brackets are off. Eclipse auto formatting is Ctrl + Shift + F
  3. Compare enums with == so event.getClick() == ClickType.LEFT
  4. Dont stack your if cases like that. Use a early return pattern. Example:
if(event.getClick() != ClickType.LEFT) {
  return;
}
  1. Dont reuse getters or other methods. Call the method once, create a variable and use it from then on instead of chaining method calls.
if(e.getCurrentItem() != null && e.getCurrentItem().hasItemMeta()) {

to

ItemStack box = event.getCurrentItem();
if(box == null || !box.hasItemMeta()) {
  return;
}
...
hollow canopy
#

thanks

#

why should I use return;

lost matrix
#

So you want to be able to open a shulker from your hand, right?

hollow canopy
#

no player I want to open shulker from my inventory

#

It is working I can open the shulker from my inventory

#

but when I try to put smth on this inventory it wont save

lost matrix
# hollow canopy why should I use return;

Because it is a lot nicer to read and debug:

  @EventHandler
  public void onInventoryClick(final InventoryClickEvent event) {
    if (event.getClick() != ClickType.LEFT) {
      return;
    }

    final ItemStack box = event.getCurrentItem();
    if (box == null || !box.hasItemMeta()) {
      return;
    }

    final ItemMeta boxMeta = box.getItemMeta();
    if (!(boxMeta instanceof BlockStateMeta)) {
      return;
    }

    final BlockState boxState = ((BlockStateMeta) box).getBlockState();
    if (!(boxState instanceof ShulkerBox)) {
      return;
    }

    final ShulkerBox shulker = (ShulkerBox) boxState;
    final Inventory inv = shulker.getInventory();
    event.getWhoClicked().openInventory(inv);
  }
dire marsh
#

I just updated a plugin to gradle 7 but I am getting Entry config.yml is a duplicate but no duplicate handling blah blah when building even though there is only one config.yml, any idea how to fix?

lost matrix
hollow canopy
#

ah I see

#

this error occurs when I use your code

lost matrix
#

final BlockState boxState = ((BlockStateMeta) box).getBlockState();
to
final BlockState boxState = ((BlockStateMeta) boxMeta).getBlockState();

hollow canopy
#

Thanks bro

#

thats worked

lost matrix
hollow canopy
#

I adjust some of your codes to my code

quaint mantle
#

expected <block end>, but found '<scalar>' in 'string', line 5, column 47: ... &2[BenderIL] &cPlease slow down";

#

any1 know why does it happend/

lost matrix
quaint mantle
#

wich class?

chrome beacon
#

Config

quaint mantle
#

ill guess config

lost matrix
#

I dont know. You tell me lol. Looks like a yaml error

quaint mantle
#

`#PREFIX
prefix: "&2[BenderIL]&9"

#message when the message is blocked
spamMessage: "&2[BenderIL] &cPlease slow down";

#Message Delay In Seconds:

delay: = 3

#message when a message is blocked cuz repeated
repeatMessage: "&2[BenderIL] &cDo not repeat the same message!"

#delay when the player is able to send the same message again (in seconds)
repeatDelay: 13`

#

thats my config

#

what should be the problem here?

chrome beacon
#

Remove ;

lost matrix
#

^

quaint mantle
#

ohhhh

#

now rebuild?

#

i guess so

#

HDD PLS RESPOND

quaint mantle
minor garnet
#

does anyone know how to make a player control an entity

ivory sleet
#

define control

glass sparrow
#

here you go sir

minor garnet
#

like a horse, but entities that I can't, like a spider

cinder thistle
fickle hound
#

Hi, due to paper#678 (upstream) a plugin API doesn't seems to work anymore, i think because a change on PluginClassLoader, it need to be reported on spigot jira?
Paper#677 and lower not accourd this error on that plugin

quaint mantle
#

enyone know like a website that will help me configure plugins

sleek pond
#

config.yml

quaint mantle
#

ty

eternal night
#

paper errors are not to be reported on spigot jira

chrome beacon
#

^^

eternal night
#

also paper is downstream

fickle hound
eternal night
#

wat

fickle hound
#

sorry ping 😢

eternal night
#

paper is a fork of spigot

#

it is downstream

#

spigot is the upstream of paper

#

hence, errors on paper would have to be also confirmed on spigot before actually reporting them on spigot

#

furthermore, this seems to be a plugin issue not a paper issue

#

paper changed something, the plugin uses some funny hacks to do its things

#

that isn't papers issue

#

its the plugins issue

quaint mantle
#

lmao

#

this is so fkin annoying

#

i finally found a warp plugin that works

#

but its not english

#

so fk

chrome beacon
#

Just use EssentialsX

quaint mantle
#

alr i tried it before but it didnt work

#

but imma try it agin

chrome beacon
#

It does work perfectly fine

urban elbow
quaint mantle
#

yeah

urban elbow
#

Go DM

quaint mantle
#

k

#

is intellij IDEA, good for java plugins? or eclipse?

urban elbow
#

But I hink IDEA is better

#

Personnaly, I use eclipse

eternal oxide
#

IDEA is feature rich, which can be a heavy load on less powerful systems. Eclipse is lighter and simpler. Its all just personal choice.

opal juniper
#

I need to make a user editable list of Materials in like a .yml file

#

is there an easy way to serialise them?

chrome beacon
#

You can loop through the values in the enum and add them to a list

#

I would also recommend XMaterial and the rest of the XSeries libraries

opal juniper
#

Wait, do you mean all of the materials?

hexed saddle
#

I'd like to make a custom event to my class that other plugins can listen to, so my runnable can be tied up with other plugins.
It's a plugin to pay people every 15 minutes.
any advice on how to make a custom event? Not really sure on how to do that (don' need code, if I can get a good tutorial i'm fine )

ivory sleet
#

If you wanna use the Bukkit event api it’s quite trivial to setup

hexed saddle
#

if ya happen to have any code somewhere?
I learn best by seeing it work, not really by reading a long paragraph

ivory sleet
#

I don’t have any code of my own rn but pretty sure spigot wiki has an example

eternal oxide
opal juniper
hexed saddle
#

That's.. not my question

#

I know how runnables work

#

it's for the WiiPay plugin (pretty well known )

#

I'm just attempting to code an API

#

so other plugins can interact with it.

quaint mantle
#

yo enyone know what number do i set to have a 15k by 15k border?

fathom nova
#

Hey, anyone know how I can move a player up on the tablist

midnight garden
#

Can Spigot save ItemStacks to config? I know it can save an ItemStack but I want to save the whole inventory

paper viper
#

ofc

#

its an array, yaml supports array

#

then for each element, store the itemstack

midnight garden
#

Specifically, it is saving the whole array, not looping

quaint mantle
#

erm

paper viper
#

I don't think you have to loop? iirc

#

but even if you have to

#

its not that bad

ivory sleet
#
class ExampleEvent extends Event implements Cancellable {
  static final HandlerList HANDLERS = new HandlerList();
  boolean isCancelled;

  public boolean isCancelled() { return this.isCancelled; }

  public void setCancelled(boolean cancel) {
    this.isCancelled = cancel;
  }

  public HandlerList getHandlers() { return HANDERS; }

  public static HandlerList getHandlerList() {
    return HANDLERS;
  }
}
class EventRunner {
  {
    Plugin plugin = JavaPlugin.getProvidingPlugin(EventRunner.class);
    plugin.getServer().getScheduler().runTaskTimer(plugin, () -> {
      ExampleEvent event = new ExampleEvent();
      plugin.getServer().getPluginManager().callEvent(event);
      if (event.isCancelled()) return;
      //if not cancelled 
    },0L,20L*60L*15L);
  }
}``` @hexed saddle  wrote on mobile so might be some issues but you get the idea
chrome beacon
fathom nova
#

how do I move players order in a tablist

maiden briar
#

If I try to create a project template for intellij, the configurations (Test servers) are not saved. Anybody an idea where I can find the folder where intellij stores those template projects?

opal juniper
hexed saddle
#

Kudo's to you!

ivory sleet
#

(:

sleek pond
#

lmao

hexed saddle
#

This code I am rewriting uses to much statics 😦

ivory sleet
#

Yup

minor palm
#

constants are fine tho, no?

ivory sleet
#

And you should split those up into a constant registry or smtng

minor palm
#

like half of those variables are constants

ivory sleet
#

Single responsibility principle

sleek pond
minor palm
#

ahh just noticed they're in the main class

minor palm
ivory sleet
#

That too

drifting halo
#

is there a way to get the drops from shearing a sheep in PlayerInteractEntityEvent? Or is there a better event for it?

ivory sleet
#

Maybe like ItemSpawnEvent or smtng

hexed saddle
#

This code really needs a rework, it has ...so little classes

#

gonna make packages later 🙂

#

using enum classes makes code fun :)à

drifting halo
#

little classes doesnt mean bad lol, if it does what it does properly

#

¯_(ツ)_/¯

ivory sleet
fathom nova
#

Uh can someone tell me how to sort a tablist

#

like depending on their group (I have a custom group system)

#

I just need to know how to sort

#

I tried teams and it didnt work

maiden briar
#

I made an annotation, and now I want that people MUST use the annotation if they extend my class

#

So we have an abstract class, and the class which extends the abstract class must apply the annotation

#

strings.length

sleek pond
#

if strings.length >= 2 do stuff

opal juniper
#

Has anybody seen like a vector visualisation tool?

sleek pond
#

unity

#

game engine

#

or like any other game engine

opal juniper
#

i just mean like a website

sleek pond
#

idk

compact haven
#

@fervent robin strings[1] refers to the object in the array at the 2nd index, and .length is an accessor of that object- so if the array doesn't have 2 or more elements, strings[1] is null & it'll throw an index out of bounds exception
the trick here is "if the array doesn't have 2 or more elements" then it will "throw an exception." Check the size of the array, and this is why

sleek pond
#

and online game engine

opal juniper
#

that i can plugin numbers and it will show me the exact vector that produces

#

ok

sleek pond
#

idk

sleek pond
opal juniper
#

thanks

glossy scroll
maiden briar
#

Ok, I am making my own @graceful fractalquired annotations (with the class), and then I can check if the annotation is present

glossy scroll
#

this.getClass().getAnnotation(MyAnnotation.class) == null

#

Im pretty sure this will work

#

Disclaimer that ive not dealt with annotations in a while

sharp bough
#

could someone explain to me what a getter is? i dont understand what to return so make the Main.isDebug()

#

like

#

i know what a getter is

#

i have this

#

    private static Main instance;

    @Override
    public void onEnable() {
        // Plugin startup logic
        instance = this;
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
    

    public static Main get() {
        return instance;
    }
}```
compact haven
#

static singleton

#

named Main

sharp bough
#

and when i do Main.get , i get the stuff from main like getconfig etc

maiden briar
#

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project PluginTemplate: Fatal error compiling I just get this, no more information.....

minor garnet
#

some1 know how to resolve this ?

maiden briar
#
final Set<? extends Element> requiredElements = roundEnvironment.getElementsAnnotatedWith(Require.class);

        for(Element element : requiredElements)
        {
            Class<? extends Annotation> requiredAnnotation = element.getAnnotation(Require.class).value();

            if(element.getAnnotation(requiredAnnotation) == null)
            {
                System.out.println("[ERROR] You missed the " + requiredAnnotation.getName() + " annotation in class " + element.getClass().getName());
                return false;
            }
        }```
This is the code I added
glossy scroll
#

getAnnotation().value will throw an NPE if the annotation isnt there

maiden briar
#

Oh that's the problem.... stupid

#
final Set<? extends Element> requiredElements = roundEnvironment.getElementsAnnotatedWith(Require.class);

        for(Element element : requiredElements)
        {
            Require requireAnnotation = element.getAnnotation(Require.class);

            if(requireAnnotation == null)
                continue;

            Class<? extends Annotation> requiredAnnotation = requireAnnotation.value();

            if(element.getAnnotation(requiredAnnotation) == null)
            {
                throwError("You missed the " + requiredAnnotation.getName() + " annotation in class " + element.getClass().getName());
                return false;
            }
        }```
Keep getting the error
glossy scroll
#

Well its a compile error

#

And youre still doing it wrong

maiden briar
#

What do I need to do then?

glossy scroll
#

the variable requiredAnnotation is completely useless

glossy scroll
#

If thisnis null

#

The element doesnt have the annotation

#

Also, requiredElements all have the annotation anyways?

#

So why do you need to do this check?

maiden briar
#

I will check if the class is annotated with @require, then I will check if the sub class contains the value (The class which extends the abstract class / interface)

glossy scroll
#

Why do yoy need the annotation

#

?xy

queen dragonBOT
opal juniper
maiden briar
#

I need it because they must annotate so I can generate the plugin

#

But have dinner now, brb

glossy scroll
opal juniper
glossy scroll
#

Youre asking me

#

I think id know a thing or two

opal juniper
#

He really spinning

#

i mean, i am using random

#

but multiplying it with constants

glossy scroll
#

Use that phi/theta

quaint mantle
#

yo can i hire enyone thats a dev ?

#

i need ranks.kts

glossy scroll
#

X: cos(theta)sin(phi)
Z: sin(theta)sin(phi)
Y: cos(phi)

#

In a vector

chrome beacon
#

?services

queen dragonBOT
glossy scroll
#

Then use vector.multiply to your needs

opal juniper
#

ill give it a go

quaint mantle
#

spigot forums wont work for me

cosmic fjord
#

how can I change the hit delay of an item?

#

I mean since the 1.9 theres a delay to hit with every weapon

#

how can I change that?

glossy scroll
#

0 <= theta <= 2pi

chrome beacon
glossy scroll
#

0 <= phi <= pi/2

cosmic fjord
#

what is the name of the attribute I have to change?

chrome beacon
#

GENERIC_ATTACK_SPEED

cosmic fjord
#

ok thx

#

what methode do I have to use to change this?

quaint mantle
#

enyone know how to protect spawn so pepole cant destroy/place blocks

cosmic fjord
#

ok ty

opal juniper
cosmic fjord
chrome beacon
#

Use the Minecraft wiki

cosmic fjord
#

oke

quaint mantle
#

enyone a dev i can hirer ?

opal juniper
#

not here

#

go to fiverr or sommin

glossy scroll
#

?services

queen dragonBOT
glossy scroll
#

Stop asking

opal juniper
#

He said it didn't work for him

glossy scroll
#

It probably does

#

They ain’t saying what don’t work

#

You cant post threads on “looking for” before u use forums

opal juniper
#

¯_(ツ)_/¯

quaint mantle
#

that forums wont work for me

glossy scroll
#

You can go to the offering section

#

And choose a dev

opal juniper
#

go to fiverr or sommin

glossy scroll
#

@quaint mantle wel im gonna tell u stop asking here

#

You wont find anyone here

glossy scroll
quaint mantle
#

alr dont ping me @glossy scroll

glossy scroll
#

You’re right here give me a break lol

cosmic fjord
#
m1.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, new AttributeModifier("AttackSpeed", 0.1, AttributeModifier.Operation.ADD_NUMBER));

what did I wrong that I get this:

#

wait

glossy scroll
#

Youre adding 0.1 to the attack speed

cosmic fjord
#

I cant make a screenshot

glossy scroll
#

Is that what you want

#

Cuz ur not verified

cosmic fjord
#

no I mean I cant make a screenshot at my computer

glossy scroll
#

Oh well you wouldnt be anle to upload it anywyas

cosmic fjord
#

bruh

#

ok wait

glossy scroll
cosmic fjord
#

so it says:

When in main hand:
...
When in off hand:
...
when of feat:
...

...
#

how can I disable this?

cosmic fjord
sharp bough
upper adder
#

what am I doing wrong?

// ItemSpawnEvent
Location itemLoc = e.getLocation();
World itemWorld = e.getEntity().getWorld();

if (itemWorld.getBlockAt(itemLoc.add(0, -1, 0)).getType().equals(Material.GOLD_BLOCK)) {
  System.out.println("item under entity is gold!");
}

is this not the correct way to compare?

#

I've tried logging the item under material and it outputs as GOLD_BLOCK so I'm not sure why the code within the if statement doesn't execute

echo basalt
#

Probably unrelated, but that method can be remade to

itemLoc.add(0, -1, 0).getBlock().getType() == Material.GOLD_BLOCK

upper adder
#

thanks I prefer that notation I'll keep it in mind

echo basalt
#

Items don't usually spawn under gold blocks when thrown by players

#

try tracking the item, probably with a scheduler task

maiden briar
#
final Set<? extends Element> requiredElements = roundEnvironment.getElementsAnnotatedWith(Require.class);

        for(Element element : requiredElements)
        {
            System.out.println(element);

            Require requireAnnotation = element.getAnnotation(Require.class);

            System.out.println(requireAnnotation);

            if(requireAnnotation == null)
                continue;

            System.out.println("not null");
            System.out.println(requireAnnotation.value());

            Class<? extends Annotation> requiredAnnotation = requireAnnotation.value();
            System.out.println(requiredAnnotation);

            if(element.getAnnotation(requiredAnnotation) == null)
            {
                System.out.println(requiredAnnotation.getName());
                System.out.println(element.getClass());
                //System.out.println("[ERROR] You missed the " + requiredAnnotation.getName() + " annotation in class " + element.getClass().getName());
                throwError("You missed the " + requiredAnnotation.getName() + " annotation in class " + element.getClass().getName());
                return false;
            }
        }```
I see the prints until the not null, the print after that is not printed (`Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project PluginTemplate: Fatal error compiling`)

The other prints:

me.tvhee.plugin.PluginMain
@me.tvhee.tvheeapi.core.annotations.Require(value=me.tvhee.tvheeapi.api.plugin.Plugin)
not null

upper adder
#

yeah I didn't include the scheduler task here but I schedule one a second after the event triggers

#

the code I posted is the code within the task

echo basalt
#

¯_(ツ)_/¯

#

If the material is a gold block

#

The code should run

#

Send full code idk

maiden briar
#
@Inherited
public @interface Require
{
    Class<? extends Annotation> value();
}```
#

This is to require annotations on methods/fields/classes

upper adder
#
@EventHandler
public void itemSpawns(ItemSpawnEvent e) {
  Bukkit.getScheduler().runTaskLater(this.plugin, new Runnable() {
    @Override
    public void run() {
      Location itemLoc = e.getLocation();
      World itemWorld = e.getEntity().getWorld();
      
      // Shrine structure test
      if (itemLoc.add(0, -1, 0).getBlock().getType().equals(Material.GOLD_BLOCK)) {
        System.out.println("item under entity is gold!");
      }
    }
  }, 20L);
}
echo basalt
#

Not exactly sure, never mess with annotations tbh

maiden briar
#

What can I do with @retention?

echo basalt
maiden briar
#

Ok thanks

warped gull
#

I'm trying to make chunk claiming for my server, and I'm not sure how to do it. Wouldn't it be VERY inefficient to check each individual block over tons of files to see if the chunk is claimed?

upper adder
echo basalt
#

So just keep track of claimed chunks and check if the block belongs in it

warped gull
#

But that would get kinda laggy if there are lots of players online/who have claimed chunks?

echo basalt
#

I'd make a ChunkData object, that would contain

UUID owner
int chunkX
int chunkZ
#

Since you don't care about floating point numbers,

int chunkX = blockX >> 4; 
int chunkZ = blockZ >> 4;
stiff topaz
#

I'm having issues with Dependency injection and commands

MarketGUI:

public MarketGUI g;

public OpenMarket(final MarketGUI gui) {
    this.g = gui;
}```

Main Class: 
```java
this.getCommand("openmarket").setExecutor(new OpenMarket());

Error:

-'OpenMarket(com.olliejw.oremarket.MarketGUI)' in 'com.olliejw.oremarket.Commands.OpenMarket' cannot be applied to '()'
echo basalt
#

You gotta pass a variable on the constructor, @stiff topaz

#

Of the type MarketGUI

#

Yeah no worries

stiff topaz
#

how can I do that

echo basalt
#

This is basic OOP

#

Dependency Injection is basically passing an instance to another by means of a constructor

#

Your constructor asks for a MarketGUI

#

So you must pass an object instance of the type MarketGUI

#

An instance can reference itself by the term this

blazing scarab
#

Please dont call class attributes by single letter

maiden briar
#
final Set<? extends Element> requiredElements = roundEnvironment.getElementsAnnotatedWith(Require.class);

        for(Element element : requiredElements)
        {
            Require requireAnnotation = element.getAnnotation(Require.class);

            Class<?> requireAnnotationClass;

            try
            {
                requireAnnotationClass = Class.forName(requireAnnotation.toString().replaceAll("me.tvhee.tvheeapi.core.annotations.Require\\(", "").replaceAll("\\)", ""));
            }
            catch(ClassNotFoundException e)
            {
                System.out.println("Class not found");
                continue;
            }

            System.out.println(requireAnnotationClass);
            System.out.println(requireAnnotation.value().getName());

            if(element.getAnnotation(requireAnnotation.value()) == null)
            {
                System.out.println(requireAnnotation.value().getName());
                System.out.println(element.getClass());
                //System.out.println("[ERROR] You missed the " + requiredAnnotation.getName() + " annotation in class " + element.getClass().getName());
                throwError("You missed the " + requireAnnotation.value().getName() + " annotation in class " + element.getClass().getName());
                return false;
            }
        }

I found out where the problem is: Class not found prints, and that's why also Required#value does not print

echo basalt
#

Good job

silk mirage
#

..

wispy fossil
ivory sleet
#

Why do u use Class::forName

#

You don’t have access to the class at compile time or what?

tacit drift
#

how can i detect when a player closes a chest?

dense kestrel
sage swift
#

i think you can do /ban (player) and then you'll know for sure that it closed

dense kestrel
#

Pretty sure this requires NMS, let me check

#

could be wrong

tacit drift
dense kestrel
tacit drift
#

oooh

#

lol

maiden briar
sage swift
maiden briar
#

Ok problem fixed, if somebody knows a better way just let me know 😄

dense kestrel
#
    public void sendMessage(Player player, String message) {
        PlayerConnection con = ((CraftPlayer) player).getHandle().playerConnection;
        IChatBaseComponent chat = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + message + "\"}");
        PacketPlayOutChat packet = new PacketPlayOutChat(chat, (byte) 2);
        con.sendPacket(packet);
    }

This is how I do actionbar messages pretty sure you just change the new PacketPlayOutChat(chat, (byte) 2); to make it show in the middle of the screen or whatever

#

i forget which number it is

#

np

glossy scroll
sage swift
#

but what if they're using bukkit

#

no spigot what will they do

worn tundra
#

ew bukkit

glossy scroll
glossy scroll
#

This is the spigot discord

sage swift
#

was a joke

dense kestrel
#

which is all i use lol

ivory sleet
#

Consider switching

dense kestrel
#

cant

ivory sleet
#

Ofc you can (:

dense kestrel
#

Factions isnt possible to play in 1.16

errant drift
#

nah