#help-development

1 messages · Page 1687 of 1

trail remnant
#

i already looked at that and the methods they gave didnt work, if that only returns the file how am i supose to get the keys? ive tried everything i can think of :p

quaint mantle
#

what

#

it tells you everything

#

use the docs to look at methods for the config

#

?jd

quaint mantle
#

FileConfiguration

golden turret
#

do someone know a free maven provider like jitpack?

quaint mantle
#

why not use jitpack?

golden turret
#

i fucked it

quaint mantle
golden turret
trail remnant
#

its not giving me any options to get fileconfiguration or anything

quaint mantle
#

it tells you how though

lost matrix
golden turret
trail remnant
#

ive checked it... unless im blind, i didnt see it

golden turret
#

for this reason i asked for the jitpack to run buildtools

#

for each version

#

😔

quaint mantle
#
        config = YamlConfiguration.loadConfiguration(file);

        InputStream configStream = plugin.getResource(fileName);
            if (configStream == null) {
                return;
            }
            config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(configStream, Charsets.UTF_8)));
        }
        configStream.close();
snow ember
#

Hey all,

Anyone know why when I run:

INSERT INTO `premiumpunishments`.`players`(`uuid`,`username`,`banned`,`banexpirydate`,`muted`,`muteexpirydate`,`warns`,`kicks`)VALUES(uuid='511eef29-4923-4497-bbad-4172dd22a16e',username='Exortions',banned='false',banexpirydate='2021-09-10 17:12:00.016',muted='false',muteexpirydate='2021-09-10 17:12:00.016',warns='0',kicks='0');

it inserts all zeroes into SQL?
Raw Java code:

                String sql = "INSERT INTO" +
                        " `" + PremiumPunishments.getPlugin().getDatabase().getDatabase() + "`.`players`(" +
                        "`uuid`," +
                        "`username`," +
                        "`banned`," +
                        "`banexpirydate`," +
                        "`muted`," +
                        "`muteexpirydate`," +
                        "`warns`," +
                        "`kicks`" +
                        ")" +
                        "VALUES(" +
                        "uuid='" + player.getUniqueId() + "'," +
                        "username='" + player.getName() + "'," +
                        "banned='false'," +
                        "banexpirydate='" + new Timestamp(System.currentTimeMillis()) + "'," +
                        "muted='false'," +
                        "muteexpirydate='" + new Timestamp(System.currentTimeMillis()) + "'," +
                        "warns='0'," +
                        "kicks='0'" +
                        ");";

here's a screenshot: I honestly have no clue why this is happening, no results on Google

#

wait lemme send Imgur

shadow tide
#

Whats the problem here? Error occurred while enabling plugin v1.0 (Is it up to date?) java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.CJendantix.plugin.Plugin.getCommand(String)" is null at com.CJendantix.plugin.Plugin.onEnable(Plugin.java:17) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:511) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:425) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:619) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:266) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at java.lang.Thread.run(Thread.java:831) [?:?]

eternal oxide
#

command is not in plugin.yml because the return value of "com.CJendantix.plugin.Plugin.getCommand(String)" is null

shadow tide
#

IK

#

I don't understand that, here is my main file ```package com.CJendantix.plugin;

import org.bukkit.plugin.java.JavaPlugin;

import com.CJendantix.plugin.commands.PluginCommands;
import com.CJendantix.plugin.events.TutorialEvents;
import com.CJendantix.plugin.items.ItemManager;

public class Plugin extends JavaPlugin {

@Override
public void onEnable() {
    PluginCommands commands = new PluginCommands();
    getCommand("heal").setExecutor(commands);
    getCommand("givewand").setExecutor(commands);
    getCommand("givefirewand").setExecutor(commands);
    getCommand("giveadminwand").setExecutor(commands);
    getServer().getPluginManager().registerEvents(new TutorialEvents(), this);
    getServer().getConsoleSender().sendMessage("Plugin Enabled");
    ItemManager.init();
}


@Override
public void onDisable() {
    getServer().getConsoleSender().sendMessage("Plugin Disabled");
}

}

eternal oxide
#

why are you setting all commands to teh same executor?

shadow tide
#

yeah

#

sorry

#

I uh

eternal oxide
#

anyway, as I said one of your commands is not in your plugin.yml

shadow tide
#

yeah, found it

#

btw IK is bad practice to but all command in same file

#

sorry

shadow tide
# eternal oxide anyway, as I said one of your commands is not in your plugin.yml

it wasn't tabbed correctly givefirewand: description: Gives the TNT on a stick. usage: /<command> permission: default:op permission-message: You do not have permission to use this command! giveadminwand: description: Gives the OP Admin Weapon. usage: /<command> permission: default:op permission-message: You do not have permission to use this command!is now givefirewand: description: Gives the TNT on a stick. usage: /<command> permission: default:op permission-message: You do not have permission to use this command! giveadminwand: description: Gives the OP Admin Weapon. usage: /<command> permission: default:op permission-message: You do not have permission to use this command!
THAT IS ONLY PART OF MY PLUGIN.YML

quaint mantle
#

its still not tabbed correctly

snow ember
#

wdym?

#

This code works fine on other plugins

quaint mantle
#

you're creating a new instance of StringBuilder everytime you use '+'

snow ember
#

and when I print it to the console I get INSERT INTO premiumpunishments.players(uuid,username,banned,banexpirydate,muted,muteexpirydate,warns,kicks)VALUES(uuid='511eef29-4923-4497-bbad-4172dd22a16e',username='Exortions',banned='false',banexpirydate='2021-09-10 17:12:00.016',muted='false',muteexpirydate='2021-09-10 17:12:00.016',warns='0',kicks='0');

#

therefore it works

#

Just SQL doesn't handle it correctly?

quaint mantle
#

What

#

no its java

snow ember
#

ik

quaint mantle
#
String sql = new StringBuilder()
    .append("INSERT INTO")
    .append("`uuid`," // etc.
snow ember
#

why would that do anything

quaint mantle
#
you're creating a new instance of StringBuilder everytime you use '+'
#

make it faster

snow ember
#

okay but

#

that won't fix the problem

quaint mantle
#

i dont know sql, somebody else can help

#

just a general java tip

snow ember
#

okay but that wasn't really relevant

quaint mantle
#

Jesus

young knoll
#

Why doesn’t the compiler optimize that

quaint mantle
#

it might, idk

snow ember
#

no.

#

The string is fine

quaint mantle
#

can you just listen lmao

snow ember
#

the string once built is INSERT INTO premiumpunishments.players(uuid,username,banned,banexpirydate,muted,muteexpirydate,warns,kicks)VALUES(uuid='511eef29-4923-4497-bbad-4172dd22a16e',username='Exortions',banned='false',banexpirydate='2021-09-10 17:12:00.016',muted='false',muteexpirydate='2021-09-10 17:12:00.016',warns='0',kicks='0');

#

The SQL is correct

#

Which is why I asked the question- SQL is being weird and I don't know why.

ivory sleet
#

Afaik "a"+"b"+"c" compiles to new StringBuilder().append("a").append("b").append("c").toString()

quaint mantle
#

JDK 9+ someone said

snow ember
#

im using JDK 8

ivory sleet
#

Well Java 8 is old af anyways

minor garnet
#

Java 5

eternal oxide
#

um, the values should not have the names, they should just be values

snow ember
#

ElgarL

#

That is the value after I printed it to the console

eternal oxide
#

print the actual query

snow ember
#

lemme show u

#
String sql = "INSERT INTO" +
                        " `" + PremiumPunishments.getPlugin().getDatabase().getDatabase() + "`.`players`(" +
                        "`uuid`," +
                        "`username`," +
                        "`banned`," +
                        "`banexpirydate`," +
                        "`muted`," +
                        "`muteexpirydate`," +
                        "`warns`," +
                        "`kicks`" +
                        ")" +
                        "VALUES(" +
                        "uuid='" + player.getUniqueId() + "'," +
                        "username='" + player.getName() + "'," +
                        "banned='false'," +
                        "banexpirydate='" + new Timestamp(System.currentTimeMillis()) + "'," +
                        "muted='false'," +
                        "muteexpirydate='" + new Timestamp(System.currentTimeMillis()) + "'," +
                        "warns='0'," +
                        "kicks='0'" +
                        ");";
eternal oxide
#

"VALUES(" + "uuid='" +

minor garnet
#

🤓

eternal oxide
#

you are including the value names in values

snow ember
#

oh my god

#

I'm the stupidest person alive

#

alright thanks

minor garnet
wet nacelle
#

Hello, sorry but my Maths are really bad

#

do you know how can I get the distance between a player and the current worldborder?

#

the worldborder is the vanilla one, a square

#

I found this:

But is giving bad values when player is near to the border, negative values

young knoll
#

Abs the players X and Z, then use the larger one to check the distance to the border

wet nacelle
young knoll
#

If X is larger then you can do X - worldborder size

#

Otherwise Z - worldborder size

wet nacelle
#

I abs the border size too?

young knoll
#

Border size should always be positive

#

Might need to divide it by 2 though

shadow tide
#

if you summon for example, an arrow. Is it possible to change the amount of damage it deals?

wet nacelle
#

@young knoll

#

is this your approach?

shadow tide
#

?

wet nacelle
#

fck i cant send screenshot

young knoll
#

I’ve not tried it but it should work

wet nacelle
#
                    double result;
                    
                    Location playerLocationABS = player.getLocation();
                    playerLocationABS.setX(Math.abs(player.getLocation().getX()));
                    playerLocationABS.setZ(Math.abs(player.getLocation().getZ()));

                    double borderSize = Bukkit.getWorld("world").getWorldBorder().getSize()/2;

                    if (playerLocationABS.getX() > playerLocationABS.getY()) {
                         result = playerLocationABS.getX() - borderSize;
                    } else {
                        result = playerLocationABS.getZ() - borderSize;
                    }

                    player.sendMessage(
                            "You are "+
                            result +
                            "  Blocks away from the border!");
                }```
shadow tide
#

k

young knoll
#

You could compact that code

#

But yes

wet nacelle
#

i try

#

Lol it works perfect!!!

shadow tide
young knoll
#

Add a pdc tag to the arrow

young knoll
#

And then use event.setDamage

wet nacelle
#

@young knoll Thanks you very much with the distance problem. I should have attended more in math classes hehehe

#

Oh but I see that is only working well in one side of the square

shadow tide
young knoll
#

You could also just use a set with the arrow uuid

#

But pdc is persistent

snow ember
#

would this make uuid never be null?

this.uuid = uuid == null ? null : "";
ivory sleet
#

No

#

Well

#

Is that a string?

snow ember
#

okay how would I do it with the ternary operator

#

yes

#

it is

ivory sleet
#

Ig but like why

#

An empty string isn’t a valid uuid

snow ember
#

none of your business :)

#

ik

#

im just saying

young knoll
#

If you really want a not null uuid

snow ember
#

for other stuff

young knoll
#

UUID.randomUUID iirc

snow ember
#

i didnt mean to use it with a uuid

#

i was just testing

ivory sleet
#

Anyways Id use Objects::requireNonNullElseGet rather than the ternary

snow ember
#

alright

young knoll
#

Ooh fancy methods

#

Gotta remember that one

ivory sleet
#

Lmao

snow ember
#

Yeah me too

shadow tide
# quaint mantle ?pdc

ok but how would I apply this PersistentDataContainer to only arrows shot by my "Admin Wand"

ivory sleet
#

Or the one without Get at the end of the object isn’t a heavy one

young knoll
#

Is the wand an item you right click

#

Or a bow

shadow tide
young knoll
#

Then you are manually spawning an arrow

shadow tide
#

yes

young knoll
#

Arrow a = player.launchProjectile(blahblah)

unreal quartz
shadow tide
#

???

snow ember
#

uuid = Objects.requireNonNullElse(uuid, ""); this one is actually easier @ivory sleet

shadow tide
#

wait nvm

#

ik

quaint mantle
shadow tide
#

I have no Idea what that means

quaint mantle
#

read

#

?pdc

shadow tide
#

should I create a new class for my arrow*

quaint mantle
#

i'd do it

ivory sleet
quaint mantle
ivory sleet
shadow tide
quaint mantle
#

in the entity container

shadow tide
#

here? "my.custom.arrow"

quaint mantle
#

thats the key

shadow tide
#

ok I'll change that

snow ember
#

@shadow tide You should probably brush up on your Spigot/Java skills a bit

quaint mantle
#

its like a map on a thing

shadow tide
#

I just want to store something like an NBT value (I was an expert in minecraft commands once) or a tag so I can identify the entity so I can change how much damage it does, not something super complicated like this don't you dare hit me with the its suuuper simple you just need to know more java hahahaha

ivory sleet
#

🥲

quaint mantle
#

just read the thread

#

?pdc

shadow tide
quaint mantle
#

then you should understand how to use it

shadow tide
#

I DON'T UNDERSTAND

quaint mantle
#

it explains pretty much everything

#

Alright here

shadow tide
#

I'M FRUSTRATED AND MY BRAIN HURTS

#

I'M SORRY

quaint mantle
#

I dont know

#

i cant really help you

#

if you got a question ask it, but that thread covers it all

#

just go with it

shadow tide
#

when your comfort zone is making calculators in python thats when you start feeling like me

quaint mantle
#

i do that too

#

😄

shadow tide
#

ok, in the thread he stores this PersistentDataType.DOUBLE, Math.PI right?

quaint mantle
#

yeah

shadow tide
#

what is he actually storing, and what is the use of what he did store

quaint mantle
shadow tide
#

so when I store I should do PersistentDataType.DOUBLE, Math.aidhludhg

quaint mantle
#

you would store

#
PersistentDataType.BYTE, (byte) 1
#

because in this case, the byte exists

#

so you can check if it exists when you're checking for admin arrow

shadow tide
#

so should I replace 1 with something?

quaint mantle
#

no

#

it exists

#

that all that matters

shadow tide
#

lets say I'm using multiple PersistantDataTypes (this is just an example) would I replace the 1 with something?

quaint mantle
#

what do you want it to be

shadow tide
#

idk

quaint mantle
#

the byte represents a boolean, or just a placeholder since you're only using #has

shadow tide
#

people keep using #s, what does that mean

quaint mantle
#
A a = new A();
a.something();

// a#something

B.something();

// B.something
#

= instance representation

shadow tide
#

don't know what that means

#

a representation of a variable?

quaint mantle
#

yes

shadow tide
#

k

#

ok so when I summon the arrow Player player = event.getPlayer(); Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.ARROW); Vector velocity = player.getEyeLocation().getDirection(); velocity.multiply(2); entity.setVelocity(velocity);

#

how do I add a PersistantDataType to it

quaint mantle
#

entity.getPersistentDataContainer()

shadow tide
#

this is so much simpler than I thought, but I'm not done yet

quaint mantle
#

How can i change the damage of a weapon in 1.8.8 ?

shadow tide
#

I used attributes, then again I'm creating a plugin for 1.17.1

quaint mantle
#

hmm k ty

shadow tide
#

@quaint mantle kinda like how I checked to see if the player is holding my item if (event.getItem().getItemMeta().equals(ItemManager.wand.getItemMeta())) how would I check for the entity with my pdc and if it exists do something to it

quaint mantle
#

thats not good either

#

but anyways

shadow tide
#

whats not good

quaint mantle
#

that if statement

shadow tide
#

whatever

#

I don't care\

#

it works

quaint mantle
#
if (event.getItem().getPersistentDataContainer().has(wandKey, PersistentDataType.BYTE)) {
    //
}
shadow tide
#

I wouldn't care if someone used a goto as long as it works

#

whats getItem() supposed to be

#

@quaint mantle

#

@quaint mantle

quaint mantle
#

why are you pinging me twice

#

its an item

shadow tide
#

first, sorry

#

second whats getItem() supposed to be

quaint mantle
#

An Item

#

or ItemStack

shadow tide
#

so ItemManager.adminWand

quaint mantle
#

i guess

shadow tide
#

nope

quaint mantle
#

i mean you're checking the item here

#
public class FireballDamageFix implements Listener {
  final FileConfiguration file = Main.getPlugins().getConfig();
  
  @EventHandler
  public void fireballDamageFix(EntityDamageByBlockEvent e) {
    if (e.getEntity() instanceof org.bukkit.entity.Player && 
      e.getCause() == EntityDamageEvent.DamageCause.BLOCK_EXPLOSION) {
      double realdamage = e.getDamage();
      e.setDamage(realdamage / this.file.getDouble("fireball-damage"));
    } 
  }
}

i wanna make for weapon damage in the same way but i cant find the event D:

shadow tide
#

wait yes

#

no I'm checking the entity

quaint mantle
#
public class IronSwordDamageFix implements Listener {
  final FileConfiguration file = Main.getPlugins().getConfig();
  
  @EventHandler
  public void IronSwordDamageFix(EntityDamageByEntityEvent e) {
    if (e.getEntity() instanceof org.bukkit.entity.Player && 
      e.getCause() == EntityDamageEvent.DamageCause.IRON_SWORD) {
      double realdamage = e.getDamage();
      e.setDamage(realdamage / this.file.getDouble("ironsword-damage"));
    } 
  }
}

Something like this right?

#

ye

#

whats the default damage of iron sword? in 1.8.8?

young knoll
#

IIRC it's the same as future versions

#

6

quaint mantle
#

k ty

shadow tide
#

I'm still trying to use event.setDamage in EntityDamageByEntityEvent the whole reason this started was because I needed to check if it was an arrow from my "Admin Wand" so I could then change the damage value

young knoll
#

Didn't we say to just add a PDC tag

shadow tide
#

I am

#

I'm trying to figure out how to check for it

#

I need some sort of if statement

young knoll
#

yes

#

You would use PersistantDataContainer.has

shadow tide
#

yeah, ik

#

but imaginedev gave me this one ```if (event.getItem().getPersistentDataContainer().has("pdcKey", PersistentDataType.BYTE)) {

    }```
#

but the tag is on an entity that the item is creating if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (event.getItem() != null) { if (event.getItem().getItemMeta().equals(ItemManager.wand.getItemMeta())) { Player player = event.getPlayer(); Entity entity = player.getWorld().spawnEntity(player.getLocation(),EntityType.ARROW); Vector velocity = player.getEyeLocation().getDirection(); velocity.multiply(2); NamespacedKey key = new NamespacedKey(plugin, "pdcKey"); entity.getPersistentDataContainer().set(key, PersistentDataType.BYTE, (byte) 1); entity.setVelocity(velocity); not an item

young knoll
#

So use the entity instead

shadow tide
#

how

young knoll
#

?jd

young knoll
#

getDamager

shadow tide
#

stop it

young knoll
#

Stop what

#

That is the entire reason we have the javadocs

shadow tide
#

?.jd

#

the javadocs are wayyyyyyy out of my comfort zone when it comes to documentation, its a small change but maybe a prettier design and some more examples would help

young knoll
#

Go tell java that

shadow tide
#

lol

#

alright

#

the entity

vague oracle
#

Am I being stupid or is it broken lol, this is what the System.out returns "true" | false

vague oracle
#

The Boolean.parse should return true

#

but its false

quaint mantle
#

it has the quotes around it

vague oracle
#

Ah you smart

#

lol

shadow tide
#

@quaint mantle what do I put in event.getItem()

quaint mantle
#

the item

#

the item you want to check

shadow tide
#

I'm using an entity

#

I want to check an entity

#
                    Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.ARROW);
                    Vector velocity = player.getEyeLocation().getDirection();
                    velocity.multiply(2);
                    NamespacedKey key = new NamespacedKey(plugin, "pdcKey");
                    entity.getPersistentDataContainer().set(key, PersistentDataType.BYTE, (byte) 1);
                    entity.setVelocity(velocity);```
young knoll
shadow tide
#

???

#

just tell me exactly what to put there I got to got very soon idc if I don't learn anything

#

like what.getDamager

#

@young knoll

#

pleeeeeaaaaassssseeeee

shadow tide
#

my entity is in the same class but not in the same event so how do I link to a specific event in here public static void onRightClick(PlayerInteractEvent event, Plugin plugin) {

#

@young knoll

#

HELLO??????

#

I'm tired, stressed out and having a panic attack

#

@young knoll

#

@young knoll

quaint mantle
#

stop pinging

#

he'll respond when he responds

young knoll
#

You can put the event wherever you want

#

You don't need a link to the entity you spawn

drowsy helm
#

lmao

quaint mantle
#

how does one go about registering every command automatically

#

instead of this.getCommand()

quaint mantle
gray zodiac
#

how to fix org.bukkit cannot be resolved?

quaint mantle
#

The last action is running first, how do I run it after the others.

vague oracle
#

What does the cache method look like

eternal oxide
winged anvil
eternal oxide
#

Sorry I can;t view pastebin links. uBlock blocks them

winged anvil
#

where else can i paste them for you to see?

eternal oxide
#

?paste

undone axleBOT
crude charm
#

What version

quaint mantle
#

well-packer

#

what is that mean

quaint mantle
#

having an issue where an inventory a player is looking at isnt refreshing fast enough

#

does player.updateInventory() also affect invs theyre looking at

#

or is there another way to update what theyre looking at

ivory sleet
#

Wym by update?

quaint mantle
#

```language
code
```

shadow night
#

is there a event that executes when the night skips because players sleep?

solid cargo
#

if (sender.hasPermission("kit.use"))

ivory sleet
#

@quaint mantle ask in one channel and ask only in the proper channel, in this case #help-server

solid cargo
#

or PermissionsEx?

ivory sleet
#

Idk

solid cargo
#

idk PermissionsEx

#

also Luckperms better, and go to the correct Chanel- #help-server

ivory sleet
#

Send the error

#

?paste

undone axleBOT
ivory sleet
solid cargo
#

conc, can you help me with stuff after helping this human?

ivory sleet
#

Just ask away

#

Use the proper channel

#

We have told you like 5 times now

solid cargo
#

who da hell deleted my message :(

#

how can i get the breaker of the block

ivory sleet
#

Idk what the breaker is

solid cargo
#

how can i get who broke the block

ivory sleet
#

Idk

#

You really need to tell me more

solid cargo
#

ah so

ivory sleet
#

Like what event are you using?

solid cargo
#

i am using BlockBreakEvent to spawn a specific custom entity, and whenever the boss spawns, i set the player's vector to something, but the vector applies to everyone online

#

but i want to vector just the player who broke the block

ivory sleet
#

Cant u use BlockBreakEvent::getPlayer

#

so event.getPlayer()

solid cargo
#

foreach not applicable to type 'org.bukkit.entity.Player'

ivory sleet
#

Wat

solid cargo
#

oh wait

ivory sleet
#

Of course you cannot write Player.foreach() or whatever u tried to do

solid cargo
#

I just deleted Bukkit.getOnlinePlayers or whatever, and still doesnt work

unreal quartz
#

what r u doing

#

you can’t integrate over a single player

#

iterate

solid cargo
#

but then

#

how can i send the title or what to the player who broke the block

unreal quartz
#

by invoking the send title method on the player who broke the block

shadow night
#

when the player gets a advancement, how do i get the item on the advancement?

#

here for example is a map

opal juniper
#

resource pack maybe

#

idk it’s probably hard coded

quaint mantle
#

i want to make a professional minecraft server

#

can anyone help me?

#

How to get tab complete by command string?

shadow night
#
    @EventHandler
    public void onPlayerAdvancementDone(PlayerAdvancementDoneEvent event) {
        Player player = (Player) event.getPlayer();
        Server server = (Server) this.plugin.getServer();
        player.sendMessage("Ваш режим игры сейчас будет изменён!");
        Bukkit.getServer().getScheduler().scheduleSyncDelayedTask((Plugin) this, () -> {
            player.setGameMode(GameMode.CREATIVE);
            Bukkit.getServer().getScheduler().scheduleSyncDelayedTask((Plugin) this, () -> {
                player.setGameMode(GameMode.SURVIVAL);
            }, 3*20L);
        }, 5*20L);
    }
#

whats wrong?

quaint mantle
solid cargo
#

any way i can make a custom entity immune to arrows?

drowsy helm
shadow night
#

I alr fixed

solid cargo
#

whoops, i forgot to put it in braces, ig every entity will now drop 4 diamond blocks

quaint mantle
echo basalt
#

Example: VILLAGER_HAPPY can be tossed without data

#

But REDSTONE requires it

quaint mantle
#

so

#

what should i set

#

how should i set

echo basalt
#

Example
world.spawnParticle(Particle.REDSTONE, location, 1, 0, 0, 0, new Particle.DustOptions(Color.PURPLE, 1));

#

you can toss any RGB color in the DustOptions constructor

quaint mantle
#

so color is editable ? nice

drowsy helm
#

For some particles, yes

quaint mantle
#

does anyone have a resource for

#

hitting invisible players

deft patrol
#

so im currently trying to change the sounds of players when they get hurt using ProtocolLib, firstly from what i can tell i cant actually cancel the sound of the client getting hit themself but other players can have it changed, Is this just a hard limit or is there a way around this, secondly is there a way of getting the entity/player that a sound has come from since i need to access of which player was hurt for the correct sound to play

severe marsh
#

How can I make player chat but without sending the message?

#

Like I want to make player type /hello but not send it

young knoll
#

Afaik you can only do that when they click a chat component

tardy delta
#

typing /hello is already a command smh

#

thats cool

quaint mantle
#

qq all

#

how to make it impossible to throw a bubble of experience?

stone sinew
crimson terrace
#

you mean a bottle of enchanting?

quaint mantle
crimson terrace
#

cancel the playerInteractEvent if the thrown thing is what youre talking about

stone sinew
quaint mantle
#

exp bottle

crimson terrace
#

read what I wrote. thats all you need to do

stone sinew
crystal pike
#

is it possible to scale a entity in size with nms inside a custom entity class?

quaint mantle
tardy delta
#

i know i can save a hashset into a file but how do i deserialize it?

stone sinew
torn shuttle
#

"google translate is as good as a real translator"

shadow night
#

:bruh:

torn shuttle
#

meanwhile, me, an actual professional translator

#

yeah checks out

#

I am very good but how do I fix things guys

ivory sleet
#

Unless it’s something like slime but ye

crystal pike
#

Well, it's size is set in the entity types. constructur, in the server code, so is there some way to modify that, or update the access modifier inside the entity class.

#

maybe use reflection or something to set the value to a custom value??

ivory sleet
#

Yeah Idk if that value is actually reflected to the client tho

#

But you can try

shadow night
#

Does someone knows a good idea that would allow to develop and build plugins from mobile? I'm a dev but i can't use my pc all the time, i still want to develop plugins.

ivory sleet
#

Nop

stone sinew
misty current
#

how can I change the armor of a player with protocolLib? I could only figure how to change the tool

        ProtocolManager pm = plugin.getProtocolManager();
        PacketContainer packet = pm.createPacket(PacketType.Play.Server.ENTITY_EQUIPMENT);

        packet.getIntegers()
                .write(0, p.getEntityId());

        packet.getItemModifier()
                .write(0, new ItemStack(Material.WOOD_SWORD));

        Bukkit.getOnlinePlayers().forEach(player -> {
            if(player == p) return;
            try {
                pm.sendServerPacket(player, packet);
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            }
        });
    }``` this is my code
stone sinew
#

No i read it as player == null for some reason xD My bad.

misty current
#

np :p

stone sinew
#

Not sure honestly try debug?

misty current
#

this code works, i'm tryna add armor too

#

using getItemModifier#write() with higher indexes gives me an error in the console

stone sinew
misty current
#

found that too but it's outdated

stone sinew
digital kettle
#
[15:35:21 ERROR]: Error occurred while enabling ULT-RedPvP v4.0 (Is it up to date?)
java.lang.NullPointerException
        at net.aboudey.ultimis.redpvp.sql.MySQL.createTable(MySQL.java:49) ~[?:?]
        at net.aboudey.ultimis.redpvp.Main.onEnable(Main.java:196) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:408) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:372) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:327) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:267) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched.jar:git-PaperSpigot-"4c7641d"]
        at java.base/java.lang.Thread.run(Thread.java:834) [?:?]
[15:35:21 INFO]: [ULT-RedPvP] Disabling ULT-RedPvP v4.0```

Hello, i have this error for my plugin
#

line MySQL:49 = PreparedStatement st = getCurrentConnection().prepareStatement( "CREATE TABLE IF NOT EXISTS redpvp_data (Name VARCHAR(100), UUID VARCHAR(100), Kills INT(100), Deaths INT(100), Coin INT(100), ArrowTrail INT(100), Perks INT(100), TrailsMove INT(100), Messages INT(100), KillStreaks INT(100), KillStreaksTop INT(100))");

unreal quartz
#

connextion null

royal hawk
#
//                        Create session
                        LocalSession editSession = FaweAPI.wrapPlayer(sender).getSession();
                        CuboidRegionSelector cuboidRegionSelector = new CuboidRegionSelector(editSession.getSelectionWorld(), vector.add(-radius, -vector.getY(), -radius), vector.add(radius, 255, radius));
                        EditSession affected = FaweAPI.wrapPlayer(sender).getNewEditSession();
                        
//                        Mask
                        Mask mask = affected.getMask();
                        Mask2D mask2d = (mask != null) ? mask.toMask2D() : null;

//                        Replace biome
                        BiomeReplace biomeReplace = new BiomeReplace(affected, e);
                        FlatRegionVisitor visitor = new FlatRegionVisitor(Regions.asFlatRegion(cuboidRegionSelector.getRegion()), new FlatRegionMaskingFilter(mask2d, biomeReplace));
                        Operations.completeLegacy(visitor);

Hello i need help. I want change biome in region. I craete cuboid custom region and go to take mask, but mask has been null. And this code goto to exception after this code:

new FlatRegionMaskingFilter(mask2d, biomeReplace);

maiden briar
#

Is Fr33styler in this discord? From his BedWars plugin

royal hawk
maiden briar
#

Yes, if you are the owner of the bedwars (clashwars) plugin

#

My friend wants generator speed customizable, and I don't think I have permission to change the code?

eternal night
#

The spigot page links a support discord have you tried that one

maiden briar
#

Ok I will try

wild reef
#

Hey guys, do you have to use NMS to spawn and later remove particles or is there an other way arround?

wild reef
sharp bough
#

just let them die

chrome beacon
#

You can't remove them

#

You can only send

wild reef
#

ah okay. Can u specify the duration / what is the duration? :D

sharp bough
wild reef
#

yea that's true, alright thank you guys :)

tardy delta
#

whats the best way of saving a hashmap to a yaml file?

sharp bough
#

yw

tardy delta
#

:/

sharp bough
#

jk

#

you can just save the hashmap in the yml

#

it makes like a structure of data

#

i dont wheres the problem here

tardy delta
#

a bruh i meant hashset

sharp bough
#

ah no idea

tardy delta
#

maybe like this
.set("vanished_players", new ArrayList<>(vanishedPlayers));

#

and then load it with .getStringList().blablabla

sharp bough
#

idk

#

i havent used java in like 4 months lol

tardy delta
#

is there some way to give a lambda as parameter that returns an array of strings? (String...)

quaint mantle
#

how do you spawn a ghast fireball

#

cant find it anywhere

tardy delta
#

just a normal fireball?

#

EntityType.FIREBALL ?

quaint mantle
#

Fireball fireball = (Fireball) player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREBALL);

#

this is firing a small fireball

sharp bough
#

wdym small

quaint mantle
#

so

#

theres the blaze fireball size, normal fireball size, then ghast fireball size

#
    SMALL_FIREBALL("small_fireball", SmallFireball.class, 13),```
#

theres these two, but the one i want is the rly big ones that ghasts shoot

sharp bough
#

what about this

quaint mantle
#

cheers

tardy delta
#

building pyramids tututu

paper viper
#

use variables for the unique id and chunk 🥲

tardy delta
#

i only use the chunk two times 🙂

paper viper
#

usually the rule is if you use it more than once store it for readability 🙂

tardy delta
#

🥺

ancient plank
#

fuck the rules!

ivory sleet
#

Explanatory variables 😌

waxen plinth
#

if (uses.getOrDefault(p.getUniqueId(), 5) < 4)

#

Can also do a lot of early return

eternal night
#

Also the perfect 'location.getChunk().isLoaded()' trap

tardy delta
#

😳

waxen plinth
#

Oh yeah lmao

#

Why does that method even exist

eternal night
#

Idk

#

Technically you can hold onto a chunk instance

#

And let the backing NMS chunk unload

tardy delta
#

theres some stuff under it but thats just teleportation shit

eternal night
#

It uses weak ref to the NMS chunk

waxen plinth
#
int cx = loc.getBlockX() >> 4;
int cz = loc.getBlockZ() >> 4;
if (loc.getWorld().isChunkLoaded(cx, cz)) {```
#

@tardy delta getChunk loads the chunk hell3

#

You gotta use isChunkLoaded(int, int)

tardy delta
#

owh

waxen plinth
#

CommandMagmabuildnetwork 🤢

tardy delta
#

or just isChunkLoaded(loc.getChunk()) ?

eternal night
#

No

#

the gerChunk call is the one that loads

#

getChunk

waxen plinth
#

^

tardy delta
#

ah so just that

waxen plinth
#

I gave you the code to check if a chunk is loaded

tardy delta
#

You gotta use isChunkLoaded(int, int)

#

uhu

brittle loom
#

Hello, does anyone know a method that can get the number of players on a network?

shadow tide
#

so I have an events manager and I need to link a variable from one event to another, is this possible?

south estuary
#

Need help on how to update a spigot plugin, Thanks!

tribal sparrow
#

hey does anyone know i can intercept a packet, getting the name of the entity and changing it using protocollib? any good documentation on protocollib or some tutorials maybe?

tardy delta
#

does this looks good?

private List<Home> getHomes(UUID uuid) {
        final ConfigurationSection s = homesFile.getConfigurationSection("homes." + uuid);
        if (s.getKeys(false).size() > 0) {
            List<Home> homes = new ArrayList<>();
            s.getKeys(false).forEach(home -> homes.add(new Home(
                    homesFile.getString("homes." + home + ".name"),
                    (UUID) homesFile.get("homes." + home + ".uuid"),
                    (Location) homesFile.get("homes." + home + ".location"))));
            return homes;
        }
        return null;
    }
shadow tide
#

its a yes or no question

hushed kelp
#

Wait how do u get does commands

#

Of /homes

tardy delta
#

whoa

#

?paste

undone axleBOT
shadow tide
#

k

tardy delta
#

why do people even copy the imports :/

shadow tide
#

idk

#

in this ```java
if (entity.getDamager().getPersistentDataContainer().has("pdcKey", PersistentDataType.BYTE)) {

    }``` I need the entity part to be a variable from ```java

if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (event.getItem() != null) {
if (event.getItem().getItemMeta().equals(ItemManager.wand.getItemMeta())) {
Player player = event.getPlayer();
Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.ARROW);
Vector velocity = player.getEyeLocation().getDirection();
velocity.multiply(2);
NamespacedKey key = new NamespacedKey(plugin, "pdcKey");
entity.getPersistentDataContainer().set(key, PersistentDataType.BYTE, (byte) 1);
entity.setVelocity(velocity);

            }
        }
    }```
tardy delta
shadow tide
#

also, how do I highlight my code?

tardy delta
#

```java
blabla
```

shadow tide
#

k

shadow tide
waxen plinth
tardy delta
#

ok

#

so just creating the list outside of the if

ashen gulch
#

world generation

shadow tide
#

never mind

#

for once I stopped being stupid

#

and did something on my own

#

I don't need that question answered because that would be a VERY stupid way to do it

tardy delta
#

🤔

shadow tide
#

what happened and how do I fix it [12:37:56] [Server thread/INFO]: [plugin] Enabling plugin v1.0 [12:37:56] [Server thread/ERROR]: [plugin] plugin v1.0 attempted to register an invalid EventHandler method signature "public static void com.CJendantix.plugin.events.TutorialEvents.onRightClick(org.bukkit.event.player.PlayerInteractEvent,com.CJendantix.plugin.Plugin)" in class com.CJendantix.plugin.events.TutorialEvents

tardy delta
#

you made a static eventhandler?

shadow tide
tardy delta
#

public static void (Event event)?

#

remove static

shadow tide
#

k thanks

tardy delta
#

this is not public static void main

#

😂

shadow tide
#

I did, but whats wrong with having it static?

tardy delta
#

it requires objects

shadow tide
#

(I don't really know what static does)

quartz pike
#

almost never use static

shadow tide
#

(and when I should use it)

eternal oxide
#

Don't use static unless we tell you to 😉

tardy delta
#

makes something belong to a class

shadow tide
#

k

hasty prawn
#

Are you one of those that claims static abuse at any sight of static

tardy delta
#

utils classes...

eternal oxide
#

Utils and constants

quartz pike
tardy delta
#

plugin instances 😬 😬

hasty prawn
#

Static is there for a reason.

#

It has its uses lmao

quartz pike
#

if you are running a normal shitty program on java you can use static all you want , i'm just saying on multiple threads you really need to be careful using static

shadow tide
#

so what would you use static for, give me an example

tardy delta
#

private static Main instance

ancient plank
#

smh my normal shitty program may be shitty but thats not for u to say!!!

hasty prawn
shadow tide
quartz pike
tardy delta
#

the instance...

quartz pike
#

people assume so much stuff from 4 words

#

my god

hasty prawn
shadow tide
tardy delta
#

a class cannot be static :kekw:

hasty prawn
#

I asked if you claim static abuse at any sight of static and you literally said yes.

torn vale
#
    public void inventoryClickEvent(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked();
        if ()
        }```
I want that no one can click a item in player inventory. How?
tardy delta
#

oh fail

shadow tide
tardy delta
lost matrix
tardy delta
#

uhm

#

inner class

torn vale
tardy delta
#

why wouldnt it

torn vale
#

idk

shadow tide
#

I removed static and I'm still getting this [12:43:13] [Server thread/INFO]: [plugin] Enabling plugin v1.0 [12:43:13] [Server thread/ERROR]: [plugin] plugin v1.0 attempted to register an invalid EventHandler method signature "public void com.CJendantix.plugin.events.TutorialEvents.onRightClick(org.bukkit.event.player.PlayerInteractEvent,com.CJendantix.plugin.Plugin)" in class com.CJendantix.plugin.events.TutorialEvents

tardy delta
#

did you repackage?

shadow tide
#

wdtm

quartz pike
#

bro

#

just read the message

tardy delta
#

wait

quartz pike
#

its literally saying the error

#

your method cannot have the signature (Event e , plugin p)

#

its an @EventHandler

shadow tide
#

wdym

#

Pretend I'm stupid (because I am)

tardy delta
#

oh didnt saw it

#

too sleepy

quartz pike
#

you cannot have onRightClick(PlayerInteractEvent e ,CJendantix.plugin.Plugin p)

#

i cant be more straightforward than this...

shadow tide
#

why not

lost matrix
# shadow tide wdym

Your event handler method is only allowed to have one single argument which has to be of type Event

shadow tide
#

so I remove , Plugin plugin

#

?

ancient plank
#

finna make a ?hardest command that just says my catchphrase,

The hardest part about using spigot is knowing java.

tardy delta
#

yes

shadow tide
#

k

torn vale
tardy delta
#

uhh just ```java
if (!player.isOp()) event.setCancelled(true);

torn vale
#

kk, ty

tardy delta
#

never saw anyone using ..calcelled(false)

torn vale
#

lol im using it xd

torn shuttle
tardy delta
#

ugh

#

forgive my typing skills

lost matrix
#

Talking about event.setCancelled(false);

tardy delta
#

ah

#

never used it so

ashen gulch
#

how do i make a custom world generator, and would i be able to make that world generator make multiple worlds i can teleport between?

shadow tide
#

alright my "Admin Wand" is now shooting arrows but java ((EntityDamageByEntityEvent) entity).setDamage(999999); this isn't doing anything

tardy delta
#

lmao

#

are you coding in notepad?

#

casting an entity to a EntityDamageByEntityEvent?

shadow tide
quasi flint
#

How is that supposed to work

#

Your ide should slap u in the face

shadow tide
#

would java Entity damager = ((EntityDamageByEntityEvent) entity).getDamager(); ((EntityDamageByEntityEvent) damager).setDamage(999999); this work

quasi flint
#

And spit at u with that wrror

shadow tide
#

I'm using eclipse

#

and its not

quasi flint
#

U get the damaged entity

#

Use that to get the damager

#

No casting some shit that won't ever work

shadow tide
#

?

#

what

#

i have no idea

shadow tide
tardy delta
#
public void inject(Player player) {
        CraftPlayer craftPlayer = (CraftPlayer) player;
        channel = craftPlayer.getHandle().playerConnection.networkManager.channel;
        channels.put(player.getUniqueId(), channel);

        if (channel.pipeline().get("PacketInjector") != null) return;

        channel.pipeline().addAfter("decoder", "PacketInjector", new MessageToMessageDecoder<PacketPlayInUseEntity>() {
            @Override
            protected void decode(ChannelHandlerContext channelHandlerContext, PacketPlayInUseEntity packet, List<Object> arg) {
                arg.add(packet);
                readPacket(player, packet);
            }
        });
    }

error: Caused by: java.util.NoSuchElementException: decoder

shadow tide
quasi flint
#

Gimme a minute

#

For god's sake

ember crag
#

how do i get the servers tps?

tardy delta
#

event.getDamager()

#

eventually cast it to player

quasi flint
ember crag
#

dont you think i tried that already?

quaint mantle
#

There's a few events I saw for the inventory, but what's the event to use for when getting an anvils output item

ember crag
#

also everything that comes up is deprecated

quasi flint
#

Look for it

shadow tide
quasi flint
#

Well not that hard to find is it?

shadow tide
#

?

quasi flint
#

MinecraftServer.getServer().recentTps

#

Should work @ember crag

shadow tide
#

what?

quasi flint
#

Wrong oing

shadow tide
#

lol

quasi flint
#

U got Ur answer

#

Use it

shadow tide
#

but u were saying casting wouldn't work

tardy delta
#

casting an event 🥺

#

brrrr

quasi flint
#

U casted an event to an player u donut

shadow tide
#

uhh, no

#

I was making an entity

#

then casting an event to that entity

#

so I could use .getDamager()

quasi flint
#

Casting event to entity

shadow tide
#

k

#

so casting to a variable, then using that variable would make it any better

quartz pike
#

casting to a variable

#

what

quasi flint
#

Wtf

quartz pike
#

?learnjava

undone axleBOT
quartz pike
#

here u go

quasi flint
#

An entity is not an event

#

That can't work

shadow tide
#

ok

quasi flint
#

LearnJava pleas

shadow tide
#

I was making a entity in an event

quasi flint
#

?

#

It's like alchemy

#

U can't fucking convert iron to gold

unkempt peak
#

lmao

shadow tide
#

I'M SORRY

#

Cannot cast from PlayerInteractEvent to EntityDamageByEntityEvent

unkempt peak
# shadow tide I'M SORRY

chill, just take some time to learn before you try and make plugins. I'm not here to make fun you but please take our advice

#

trust me it will make it easier for everyone

quartz pike
#

yes. this ⬆️

shadow tide
#

the thing is I do know a little java and C# just, like, I just learned how to cast

unkempt peak
#

if you want help with something specific or you want links to videos or tutorials let me know

#

that's not how casting works so clearly you don't

#

please just listen and learn

shadow tide
unkempt peak
#

why are you making a variable for an event?

#

that's not how events work

shadow tide
#

look at the link

#

idk

quasi flint
#

Not copy core

shadow tide
#

?

quasi flint
#

Understand it

manic crater
#

I know this is gonna be really stupid of me to ask, but i completely forget on how you get a username in a gui.

I tried Player p = Bukkit.getPlayer(getName()); that didn't seam to wanna work and all it did was return a null error and disable the plugin.

quasi flint
#

code

unkempt peak
#

events are methods that are called by the server when something happens. The EntityDamageByEntityEvent is just a class for the event and has nothing to do with the Entity class, thefore you cannot cast them to eachother because it would not work and be pointless

manic crater
#

So kinda wanting to just know ig how do i get the player name through a gui?

shadow tide
#

I do understand it, it is making a variable for a cast in an event

manic crater
#

brb

manic crater
#

Cuz its saying "p" is null,

manic crater
#

so kinda got me thinking that idrk what to do.

manic crater
chrome beacon
#

?eventapi

undone axleBOT
tardy delta
chrome beacon
#

You can learn without bad youtube videos

tardy delta
#

like (Player) sender

manic crater
#

well, if u wanna put it that way ig,

#

but i have a cmd that opens the gui, and a completely seperate method aside from the command.

chrome beacon
#

Then pass the player in the method

#

Or just the name

unkempt peak
# shadow tide not gonna happen

I won't spoonfeed you but i will give you resources to learn yourself. If you don't want to do that then leave this server because you will not get help like this. Nobody is going to take you serously if you won't learn stuff on your own. We aren't go to give you the code because then everytime you want to do something you will ask for us to spoonfeed instead of you actually learning

manic crater
tardy delta
#

i dont get it

shadow tide
unkempt peak
delicate bear
unkempt peak
#

anyone else still need help?

tardy delta
#
@EventHandler
public void onJoin(PlayerJoinEvent event) {
  if (somethingHappened) {
    // do something
  }
}

basics

#

uhh

#

wait

unkempt peak
#

lol

tardy delta
#

nvm take another event

opal juniper
#

@lost matrix Your Chunk pregenerator, it doesnt seem to support datapack chunk generators... is there a way to support them

lost matrix
opal juniper
#

hmmm, it just leads to stuff like this

#

yeah, the chunks inside the generator are not the datapack ones

#

and the farther ones are the datapack generated ones

opal juniper
shadow tide
#

in a EntityDamageByEntityEvent event, how would I check if the entity was damaged by a custom entity (arrow)

young knoll
#

Check the entity type of the damager

#

Or in your case, the pdc of the damager

shadow tide
#

?pdc

shadow tide
#

forgot how pdcs work

#

stupid question, when ur adding a pdc to an entity, do you need a key?

young knoll
#

Yes?

shadow tide
#

stupid question

manic crater
#

Cannot invoke "org.bukkit.entity.Player.getUniqueId()" because "p" is null

Bruh......

dusk flicker
#

kek

tardy flame
#

Tell what you want

manic crater
#

Player p = Bukkit.getPlayer(getName()); is that even right for getting the users name? or am i just terrible at remembering on how to get the users name through Bukkit. and whatever...

shadow tide
#

someone said in an event function (I think thats what its called, if not correct me. this thing public void onEntityDamaged(EntityDamageByEntityEvent event)) you can't have more than one variable EntityDamageByEntityEvent event if this is true for the pdc the plugin instance as a variable?

pine elbow
#

Sorry for the noob question, my google fu is failing me.. How would you go about listening to an event after it has been fully processed. I Want to have certain blocks react to water flowing (Currently trying to use the BlockFromToEvent event)

young knoll
#

Use the monitor priority

#

Although you should not make any changes in that priority

tardy flame
#

Hashmap cointaing players' uuids as a key and value new object class in which you have every boolean with specific tasks "items"

lost matrix
shadow tide
#

whats a static getter?

tardy flame
#

You could create method in class that is checking if all booleans are true

pine elbow
tardy flame
unkempt peak
#

just check when they pickup an item or close an inventory

wide coyote
#

aka singleton @shadow tide

tardy flame
#

You can set boolean if you acquire item

shadow tide
#

k, I don't want to push you so how do you have the JavaPlugin variable as a field in my listener class

unkempt peak
#

you where just told

#

static getter or an instantator

shadow tide
#

this ->>>>>> instantator

#

how

unkempt peak
#

?

tardy flame
#

in which Economy is main class

#

extending JavaPlugin

shadow tide
#

ooooh

#

got it

lost matrix
#

Like this for example:

  private final Map<UUID, Collection<Material>> playerMaterials = new HashMap<>();

  public boolean containsAll(final Inventory inventory, final Collection<Material> items) {
    // Check if the inv has at least one of each
  }

  @EventHandler
  public void onPickup(final EntityPickupItemEvent event) {
    if (event.getEntity() instanceof Player player) {
      final Inventory inventory = player.getInventory();
      final UUID playerID = player.getUniqueId();
      final Collection<Material> materials = this.playerMaterials.getOrDefault(playerID, Collections.emptyList());
      // PS: This might have to run one tick later
      if (containsAll(inventory, materials)) {
        // Do some stuff
      }
    }
  }

But you should def put the map in its own class and maybe even wrap the Collection<Material> in a new class.

shadow tide
#

so now economy would be the equivilent of Plugin plugin?

shadow tide
#

cool

shadow tide
tardy flame
shadow tide
#

cool!

quaint mantle
#

how to make a org.bukkit.entity.Entity get fire effect ? (make it burn)

pine elbow
quaint mantle
#

and what value should i put it setFireTicks

#

the fire tick is

wide coyote
#

setFireTicks sets the ticks before the entity stops being on fire

quaint mantle
#

oh

unkempt peak
#

its the ticks before the fire burns out

quaint mantle
#

ok

#

nice

#

thanks

shadow tide
#

ok, I'm sorry but can someone explain to me what this means? The method set(NamespacedKey, PersistentDataType<T,Z>, Z) in the type PersistentDataContainer is not applicable for the arguments (NamespacedKey, PersistentDataType<Byte,Byte>, int) I will try my best to learn these errors I promise.

wide coyote
#

np

slim kernel
#

Anyone know how the Particle.SPELL_WITCH is called in a texture pack?

eternal oxide
#

PersistentDataType.INTEGER

unkempt peak
#

Yeah it looks like the wrong data type but can you please show your code and what your trying to store?

#

@shadow tide

young knoll
#

Or cast the int to a byte

eternal oxide
#

Java 16

unkempt peak
#

wait what you can declare a variable like that?

#

that's really cool

lost matrix
#

Each player has a fixed collection. The collection should be created and then not modified anymore.

narrow vessel
#

you can if you know the right guy

crimson terrace
#

you can if you just kick the player joining

narrow vessel
#

that

#

the trickier part is canceling the leave event :)

crimson terrace
#

"Just cancel the player controlling the Account trying to join"

narrow vessel
#

lmao

#

cancel them on twitter

crimson terrace
#

I was referring to murder, but thats fine too

narrow vessel
#

😵‍💫

crimson terrace
#

Im on tumblr too much

#

Do I have to update an entitys PersistentDataContainer when I set something?

#

or is that just blocks

#

after I do this, is there still any way the entity will despawn or be removed?

waxen plinth
#

Set persistenceRequired to true

#

entity.setPersistenceRequired(true);

crimson terrace
#

it is a LivingEntity (Im on 1.17, maybe thats it?)

#

sorry, forgot to mention.

#

this is the only thing Im finding

tardy delta
#

cast it to the real entity i guess

crimson terrace
#

that Method straightup doesnt exist (at least in the 1.17 one)

eternal oxide
crimson terrace
#

what does it mean when an entity is persistent? does it just not get removed by any means unless killed? or is there something else to pay attention to?

tardy delta
#

doesnt entity has a getPersistentDataContainer() method or something?

crimson terrace
#

it does

tardy delta
#

trying something out

#

but worldguard hates me

ivory sleet
#

🥴

waxen plinth
#

Much like a named entity won't

#

How are you sending it

#

Well there's your problem

#

You're doing string +

#

That implicitly calls toString on it

#

Which doesn't do what you want

#

Depending on what version you're on, you either need to call player.spigot().sendMessage(tmsg)

#

Or player.sendMessage(tmsg)

#

You can't send chat components to console because console can't click or hover over text like a player can

misty zenith
#

Better you don't do that because if someone want to use plugin with jdk 8 or others this will be give you error

lost matrix
misty zenith
#

If you make it for your self and you know that you will use jdk 16 its not problem but for public its better to don't do this

#

Sorry for grammar 😁

waxen plinth
#

I think it would be pretty based if everyone stopped supporting spigot 1.8

#

So that people would be forced to move the fuck on

proud basin
#

1.8 is the greatest

misty zenith
misty zenith
proud basin
#

I never said it was the best

#

I said it was the greatest

#

Those have different definition

misty zenith
#

😁

proud basin
#

idk ask the person who invented the word

ancient plank
#

english be like

shut field
#

don't even know what that is

#

literally 1984

ancient plank
#

dont u know? literally 1984

lost matrix
#

No

quaint mantle
#

does anyone know how to ban a player?

lost matrix
#

Given this List of Materials: [STONE, IRON_INGOT, COBBLESTONE]
And this Inventory: [OAK_PLANKS, COBBLESTONE]
What would be the outcome of your containsAll method?
Try to go through the code step by step

crimson terrace
quaint mantle
#

yes

#

I found this: ```Bukkit.getBanList().addBan();

lost matrix
#

Yes it would be true. Even tho the player does in fact not have all those items in its inventory.

quaint mantle
#

but what is the source aka the last argument for the method? It says I need a source

lost matrix
#

You dont need a done list

#

You just need one list that never changes.

#

Ah i see. So even when the player throws the item away?

crimson terrace
quaint mantle
crimson terrace
#

you mean this?

#

Im getting this error when starting my plugin. Its supposed to wait 5 seconds after onEnable() and then spawn a skeleton with special PersistentDataContainer contents... I get the skeleton from another method which returns it.

lost matrix
#

Then:

  public boolean removeAndCheck(final Inventory inventory, final Collection<Material> items) {
    items.removeIf(material -> {
      if (inventory.contains(material)) {
        // Material is removed from collection
        return true;
      }
      // Nothing happens
      return false;
    });

    return items.isEmpty();
  }

Or with an old school iterator

  public boolean removeAndCheck(final Inventory inventory, final Collection<Material> items) {
    final Iterator<Material> materialIterator = items.iterator();
    while (materialIterator.hasNext()) {
      final Material next = materialIterator.next();
      if (inventory.contains(next)) {
        materialIterator.remove();
      }
    }

    return items.isEmpty();
  }

Go through the Collection of Materials that still need to be done.
If the Collection is empty afterwards then the player is done.
You can react on each item that gets removed.

crimson terrace
#

?paste

undone axleBOT
lost matrix
crimson terrace
#

oh wait

#

I may have found it

#

oh yeah I did initialize it with null which I didnt see. just automatically did the initialize when it told me to

#

wooooo its working... lmao

quaint mantle
#

what do I put for source

#

?

crimson terrace
#

im not sure what you mean by source

regal lake
#

I have a quite weired issue..
I try to speed up the arrow of bows, i added a eventlistener for the EntityShootBowEvent and changed the velocity of the arrow

arrow.setVelocity(arrow.getVelocity().multiply(10));

If i have the bow in the main hand it works fine, but if i have have the bow in the offhand the bow loses his velocity instantly after i shot.
That makes no sense for me at all.
Any ideas ?

lost matrix
regal lake
#

I just multiply the velocity by 10, which works fine for the main hand.
I also tried to delay it by 2 ticks, but then the arrow will loses the velocity instantly after the 2 ticks in the air.

crimson terrace
#

try setting the multiplier to less

regal lake
#

Why ? It works for the main hand, so that makes no sense or ?

crimson terrace
#

I dont think anything is supposed to go 10x the speed of an arrow

#

maybe its that

regal lake
#

I try it but i don't think that is the solution, because it works fine in the main hand 😄

crimson terrace
#

send the code?

regal lake
#

Its above

crimson terrace
#

there should be more than that tho

#

send the Method its in maybe

#

?paste

undone axleBOT
onyx shale
#

a arrow will spawn kinda.. angled down not completly straight,multiplying that value would mean an arrow might even do a full 360 towards the player or towards the ground(who knos)

#

however it is indeed strange

#

that one works

regal lake
#

Maybe i found the issue, have to test a few more things.

#

I found the cause, but i don't understand it o.O
If i hardcode the 10 like the example above it works fine for both hands.
If i get the 10 from the config and use the variable it don't work for the offhand o.O

onyx shale
#

i beleive there may be some issues if your setting a default?

#

try to debug the config value before using it

regal lake
#

I did, the variable contains "10"

#

That is the reason why i don't understand it o.O

crimson terrace
#

its java, you dont have to understand it

ivory sleet
#

?

lost matrix
lost matrix
# regal lake I did, the variable contains "10"

This works for me no matter what hand i use:

  @EventHandler
  public void onShoot(final EntityShootBowEvent event) {
    if (event.getEntity() instanceof Player) {
      final Projectile projectile = (Projectile) event.getProjectile();
      projectile.setVelocity(projectile.getVelocity().clone().multiply(5));
    }
  }
regal lake
#

Give me a second, maybe i found something

#

Hmm.. i don't know..
But i found a way how it works...

arrow.setVelocity(
            arrow.getVelocity()
                .setX(arrow.getVelocity().getX() * multiplier)
                .setY(arrow.getVelocity().getY() * multiplier)
                .setZ(arrow.getVelocity().getZ() * multiplier)
        );

.multiply should do that internal, but i don't know 😄

young knoll
#

You can cancel the target event

#

EntityTargetLivingEntity

waxen plinth
#

🤔

prime reef
#

Is there a quick way to get the string produced by sending a BaseComponent array?

waxen plinth
#

It's not just a string

prime reef
#

i don't care about events

waxen plinth
#

Oh

#

I think there's something like toLegacy..?

#

Not sure

prime reef
#

i just want the raw text with color formats

#

i'll take a look rq

#

nada, just .appendLegacy() on componentbuilder

#

java 8 to the rescue

#
   public String getDescription(CharacterBase characterBase) {
        BaseComponent[] desc = new ComponentBuilder("egg")
                .create();
        String[] descStringArray = new String[desc.length];
        Arrays.stream(desc).map(BaseComponent::toLegacyText).collect(Collectors.toList()).toArray(descStringArray);
        return String.join("", descStringArray);
    }```
#

ended up just doing this

#

¯_(ツ)_/¯

#

it's gross, but so be it

finite quest
#

how do i make a command block activate to the person who used it

trail remnant
#

is it possible to make a falling block never fall?

quaint mantle
prime reef
#

so...

#

Quick question, if you cancel() a runnable task, that executes the rest of the code in the run() method anyway, right?

young knoll
#

Yes

young knoll
#

But you can return;

quaint mantle
#

it has to complete ^

#

unless the thread's terminated