#help-development

1 messages ยท Page 2122 of 1

fast path
#

that hard to understand so I don't know how ask on stackoverflow:////

golden turret
#

what is the issue i forgot

fast path
#

uh

#

for now is I can't minimize

harsh totem
#
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            if (!(sender instanceof Player)) {
                sender.sendMessage("Only players can use that command!");
                return true;
            }
            Player player = (Player) sender;

            // /heal
            if (command.getName().equalsIgnoreCase("heal")) {
                double maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
                player.setHealth(maxHealth);
                player.sendMessage(ChatColor.GREEN + "You were healed");
                player.playSound(player.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER , 1.0f, 1.0f);
            }

            // /feed
            else if (command.getName().equalsIgnoreCase(("feed"))) {
                player.setFoodLevel(20);
                player.sendMessage(ChatColor.GREEN + "You were fed");
                player.playSound(player.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER , 1.0f, 1.0f);
            }

            //spawnmob cow 5
            else if (command.getName().equalsIgnoreCase("spawnmob")) {
                if (args.length >= 2) {
                    try {
                        EntityType entity = EntityType.valueOf(args[0].toUpperCase());
                        int amount = Integer.parseInt(args[1]);
                        for (int i = 0; i < amount; i++) {
                            player.getWorld().spawnEntity(player.getLocation(), entity);
                        }
                    } catch (IllegalArgumentException e) {
                        player.sendMessage(ChatColor.RED + "That is not a valid entity");
                    }
                } else {
                    player.sendMessage(ChatColor.RED + "(!) /spawnmob <mob> <amount>");
                }
            }

            return true;
    }``` like that?
fast path
#

no

#

you need do detect for tab not command

fast path
golden turret
#

send all poms pls

#

send it here

brave goblet
#

java.lang.RuntimeException: java.io.FileNotFoundException: plugins\EndBot\tokens.txt (The system cannot find the path specified)
I am getting this issue when trying to open the text file

File file = this.getDataFolder();
File textFile = new File(file,"tokens.txt");
Scanner scanner = new Scanner(textFile);
lost matrix
brave goblet
#

I had resolved the issue a few days ago but it seemed to have come back and idk what i changed

brave goblet
lost matrix
fast path
#

after the java File file = this.getDataFolder();

brave goblet
#

Ah thanks that makes sense

#

i just checked, .getParentFile also works

harsh totem
#

I got this and I don't understand what to do from here. im trying to get auto complete for my command.


import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;

import java.util.List;

public class spawnmobTabCompleter implements TabCompleter {

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("spawnmob")) {
            
        }


        return null;
    }
}
brave goblet
#

i am guessing it considers the jar as the data folder

fast path
brave goblet
#

just read the text file

fast path
red sedge
#

is there any reason to not use minimizeJar?

lost matrix
lost matrix
brave goblet
#

how can I build a text file into a jar? or is that not possible

fast path
#
package com.ytg667.myplugin;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;

import java.util.List;

public class spawnmobTabCompleter implements TabCompleter {

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
List<String> r=new ArrayList<>();    
    if (command.getName().equalsIgnoreCase("spawnmob")) {
            if(args.length==1){
//your check here
}
        }


        return r;
    }
}
fast path
brave goblet
brave goblet
#

must put it under project root

fast path
#

why?

lost matrix
brave goblet
fast path
harsh totem
fast path
#

put in resource can let the file be put in jar

tardy delta
lost matrix
harsh totem
#

and 2 would be the amount?

brave goblet
red sedge
lost matrix
fast path
lost matrix
brave goblet
#

ok i get ur point, so why did someone else tell me to put it in project root and defiantly not in resource folder

fast path
brave goblet
#

is that if i was using gradle

lost matrix
brave goblet
red sedge
red sedge
red sedge
#

o-o wtf are you using..??

#

did you shade spigot-api or some shit

harsh totem
harsh totem
#

how?

#

and thank you very much for your help

fast path
#

just do r.addAll(Arrays.asList(EntityType.values()));

#

It will add all exists entity type

harsh totem
#

ok

fast path
#

and if you want only mob you need filter

brave goblet
#

and yes all of it i shaded

red sedge
#

wtf-

brave goblet
#
 <dependency>
            <groupId>pw.chew</groupId>
            <artifactId>jda-chewtils</artifactId>
            <version>2.0-SNAPSHOT</version>
            <scope>compile</scope>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>club.minnced</groupId>
            <artifactId>discord-webhooks</artifactId>
            <version>0.8.0</version>
        </dependency>
        <dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
            <version>1.5.21</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sedmelluq</groupId>
            <artifactId>lavaplayer</artifactId>
            <version>1.3.75</version>
        </dependency>
        <dependency>
            <groupId>net.dv8tion</groupId>
            <artifactId>JDA</artifactId>
            <version>5.0.0-alpha.9</version>
        </dependency>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.18.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
harsh totem
lost matrix
#
        List<String> mobNames = Arrays.stream(EntityType.values())
                .filter(EntityType::isAlive)
                .map(Enum::toString)
                .map(String::toLowerCase)
                .toList();
fast path
#

Arrays.stream(EntityType.values()).map(Enum::name).toList()

lost matrix
#

sniped

fast path
#
List<String> mobNames = Arrays.stream(EntityType.values())
                .filter(EntityType::isAlive)
                .map(Enum::name)
                .map(String::toLowerCase)
                .toList();
#

If your ide tips you need set language level just do it

fast path
lost matrix
lost matrix
fast path
lost matrix
fast path
#

where can I use lol

red sedge
#
    private static String emojify(String message) {
        String[] split = message.split(":");
        StringBuilder sb = new StringBuilder();
        for (String s : split) {
            sb.append(emojis.getOrDefault(":" + s + ":", s));
        }
        return sb.toString();
    }``` is there anyway to maek this better??
#

or well, any simple-ish way?

fast path
#

why do you need to do that?

red sedge
#

hm?

brave goblet
#

How can i stop a datapack overriding events?

fast path
#

datapack?

brave goblet
lost matrix
fast path
#

I am confusing how datapack overriding event..

brave goblet
#

lemme explain

fast path
#

sure

red sedge
lost matrix
lost matrix
brave goblet
#
@EventHandler
    public void portalPlayerEvent(PlayerPortalEvent event) {
        if (event.getPlayer().getWorld().getName().equals("build")) {
            event.setCancelled(true);
            Player player = event.getPlayer();
            player.setNoDamageTicks(40);
            Vector vector = player.getLocation().getDirection();
            if (vector.getY() >= 0) {
                vector.setY((vector.getY() * -1));
            }
            player.setVelocity(vector.multiply(-1));
            if (!playerCooldown.contains(player)) {
                player.sendMessage("error!");
                playerCooldown.add(player);
                new BukkitRunnable() {

                    @Override
                    public void run() {
                        playerCooldown.remove(player);
                    }

                }.runTaskLater(pl, 60);
            }

        }
    }```
in a server without the datapack this works but in a server with that datapack it doesn't
#

how ever java @EventHandler public void portalEntityEvent(EntityPortalEvent event) { if (event.getEntity().getWorld().getName().equals("build")) { event.setCancelled(true); } } works on both servers

red sedge
#

easy solution, disable the datapack

fast path
#

lol

brave goblet
brave goblet
#

I need it

brave goblet
fast path
lost matrix
fast path
#

getEntityType check it is player

red sedge
# lost matrix

Oh i see, but again would i need to iterate over all the emojis to find if there is a match for each char?

fast path
brave goblet
fast path
brave goblet
#

anyways ill try ur solution

lost matrix
fast path
#

but with emoji system idk

lost matrix
fast path
#

maybe is the datapack

#

teleport the player

#

not player enter portal

brave goblet
#

Ok but surely it still has to tp them when

#

ah

#

it tps them to the end

#

which ignores the main enter portal event ig

fast path
#

that's just what I think not meaning the fact

lost matrix
brave goblet
lost matrix
golden turret
brave goblet
#

and then i just test the world they get tped to

fast path
#

nice

golden turret
lost matrix
#

So does he want to detect dimension changes or world changes?

golden turret
#

the correct way to do that is by using the envoriment

fast path
golden turret
#

i forgot the getter method

fast path
#

yes

golden turret
fast path
#

getFrom#getLocation#getEnvironment and getTo#...

golden turret
#

and if the dimension is different it is supposed that the world is different too

#

PlayerChangeWorldEvent btw

fast path
#

k

brave goblet
#

ah ty

golden turret
#

PlayerChangedWorldEvent

fast path
#

That's not important XD

brave goblet
#

so even if i try tp myself it would cancel

fast path
#

yes

brave goblet
lost matrix
brave goblet
#

just stop people going to nether or end in a specific world

golden turret
#

bruh

brave goblet
golden turret
#

PlayerPortalEvent

#

better

fast path
#

see the full chat

brave goblet
fast path
#

you'll know why it won't be calles

brave goblet
#

doesn't work .

golden turret
#

is the event fired?

brave goblet
#

and tps the player

lost matrix
#
  private static final Set<String> NETHER_BLOCKED_WORLDS = Set.of("build", "spawn", "lobby");

  @EventHandler
  public void onTeleport(PlayerTeleportEvent event) {
    String worldName = event.getFrom().getWorld().getName();
    World.Environment targetDimension = event.getTo().getWorld().getEnvironment();
    if(targetDimension == World.Environment.NETHER && NETHER_BLOCKED_WORLDS.contains(worldName)) {
      event.setCancelled(true);
    }
  }

I would probably do this:

harsh totem
#

I have this as a tabCompleter and it doesn't work.


    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
        List<String> mobs = new ArrayList<>();
        mobs.addAll(Arrays.stream(EntityType.values()).map(Enum::name).toList());
        if (command.getName().equalsIgnoreCase("spawnmob") && args.length == 1) {
            return mobs;
        }


        return null;
    }
}```
I also have this in my main file `getCommand("spawnmob").setTabCompleter(new spawnmobTabCompleter());`
golden turret
brave goblet
golden turret
#

then remove the specific function form the datapack

lost matrix
golden turret
#

and what does the datapack do?

brave goblet
golden turret
#

are you trying to

harsh totem
golden turret
#

/command <auto complete here>?

harsh totem
golden turret
#

so

#

the args starts after the command

#

/complete this_is_index_0

harsh totem
#

so it's args[0]?

golden turret
#

yes

harsh totem
#

ok i'll try

#

thank you

golden turret
#

๐Ÿ‘

brave goblet
harsh totem
harsh totem
brave goblet
#

or plugins which don't bother with tab completion, EG multiverse

brave goblet
golden turret
#

i dont use tab completer btw

#

i need to implement that in my command api

harsh totem
golden turret
#

it is what i need to implement

fast path
#

I have my command api

harsh totem
#

I don't understand

golden turret
fast path
#

It waste time using spigot way to create command

#

Oh well

#

Your harder to understand than mine.
But that more exactly.

mellow edge
#

how is an sound effect when you buy something in bedwars called?

golden kelp
#

ting ting

#

xd

brave goblet
#

this datapack is cursed?

golden kelp
#

think so

brave goblet
#

legit sends me the message before i even enter, and it removes the portal

golden kelp
mellow edge
#

THANK YOU VERY MUCH @golden kelp

golden kelp
#

xd you are welcome

mellow edge
#

I am working on my bw plugin and it's really weird if there isn't any sound when you buy something

golden kelp
#

is it open source

#

id like to contribute, thinking of making one as well so..

harsh totem
#

I have this tabCompleter code: ```public class spawnmobTabCompleter implements TabCompleter {

@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
    List<String> mobs = new ArrayList<>(Arrays.stream(EntityType.values()).map(Enum::name).toList());
    if (command.getName().equalsIgnoreCase("spawnmob") && args.length == 1) {
        return mobs;
    }


    return mobs;
}

}```
And this line of code in the main: getCommand("spawnmob").setTabCompleter(new spawnmobTabCompleter());
Im trying to make it autoComplete to any mob in the game but it doesn't work. can anyone help me figure out what is wrong here?

golden kelp
#
if (command.getName().equalsIgnoreCase("spawnmob") && args.length == 1) {
            return mobs;
        }


        return mobs;

this is kinda redundant, even if it doesnt match ur condition, it will return mobs

harsh totem
golden kelp
#

both will be null if anyone of them is null, as both are same

harsh totem
# golden kelp both will be null if anyone of them is null, as both are same
    public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
        List<String> mobs = new ArrayList<>(Arrays.stream(EntityType.values()).map(Enum::name).toList());
        if (command.getName().equalsIgnoreCase("spawnmob") && args.length == 1) {
            return mobs;
        }


        return null;
    }
}```
golden kelp
#

yea thats better

harsh totem
#

so

#

there must be an error

#

i just don't know where and what it is

river oracle
harsh totem
dark arrow
#
 if(block instanceof Openable){
                Openable door = (Openable) block.getBlockData();
                door.setOpen(true);
                block.setBlockData(door);
            }else{
                player.sendMessage("No doors found");
            }```It is suppose to open doors and if there is no door then it will give a message that there is no  door , and when i try it , it says no door found even i am standing in front of a door
golden kelp
#

.

golden kelp
red sedge
#

ugh okay i give up on trying to not use regex

#

how do i get a list of all text inside 2 chars

#

so like "afinjskdf :text: sdfunjlk :yue:"

golden kelp
#

why not use regex? its way simple

red sedge
#

and it would return a list that is [text, yue]

red sedge
golden kelp
#

oh wait then

golden kelp
red sedge
#
private static String emojify(String message) {
        String[] split = message.split(":");
        StringBuilder sb = new StringBuilder();
        for (String s : split) {
            sb.append(emojis.getOrDefault(":" + s + ":", s));
        }
        return sb.toString();
    }
``` rn i got this but it does not allow the user to have a : anywhere
golden kelp
#
:(.*?):

Use this pattern

dark arrow
golden kelp
#
":(.*?):"

Java String

golden kelp
harsh totem
golden kelp
#
Pattern pattern = Pattern.compile(":(.*?):");
if (matcher.find()) {
    String[] result = pattern.split(str);
    System.out.println(Arrays.toString(result));
}

@red sedge

golden kelp
harsh totem
#

๐Ÿ˜ฅ

golden kelp
#

why dont u try adding some print statements to debug it

harsh totem
golden kelp
#

before returning, send the list to the player so u can see if it is full or not and then find the cause

golden turret
#

not actually

golden kelp
#

Kinda, but that should do it for u

#
Pattern pattern = Pattern.compile(":(.*?):");
if (matcher.find()) {
    String[] result = pattern.split(str);
    System.out.println(Arrays.toString(result));
    //Use the array `result`
}
harsh totem
#

Cannot resolve method 'print' in 'spawnmobTabCompleter' what???

red sedge
#

print isnt a method

golden turret
#

?learnjava

undone axleBOT
golden kelp
#
sender.sendMessage(mobs.toString());

@harsh totem

red sedge
# golden kelp Kinda, but that should do it for u
private static String emojify(String message) {
        Matcher matcher = pattern.matcher(message);
        while (matcher.find()) {
            String s = matcher.group();
            message = message.replace(s, emojis.getOrDefault(s, s));
        }
        return message;
    }
```?
lost matrix
red sedge
#

my brain is about to crash

golden turret
#

i would use indexOf btw

terse ore
#

How do I use getConfig().set()

#

I use it but it doesn't update in config.yml

golden kelp
#

Whats your usecase

terse ore
red sedge
golden kelp
#

like what are u trying to do

red sedge
#

for it to update on the disk

golden kelp
terse ore
lost matrix
#
    Function<MatchResult, String> replacer = result -> ...;
    Matcher stringMatcher = somePattern.matcher(input);
    String replaced = stringMatcher.replaceAll(replacer);
red sedge
terse ore
#

kk Tcr.getInstance().saveConfig();

#

let me try it

#

i tworks @red sedge

#

tysm ๐Ÿ˜Œ

golden turret
#

dont regex

#

use toCharArray and iterate it

river oracle
#

Don't use toCharArray create your own string parser using only binary and run it as an external program in Java

golden turret
cosmic tree
#

it still doesn't work but the file appeared

golden turret
#

print the

#

plugin.yml

#

and

#

the project folders and files

harsh totem
#

but it still doesn't work

golden kelp
#

return is a problem then

brittle lily
#

Hey Guys How Can I Sett Skull to Zombie Head

golden kelp
#

set type?

#

or is there a skull specific meta

lost matrix
brittle lily
lost matrix
#
ItemStack zombieHead = new ItemStack(Material.ZOMBIE_HEAD);
brittle lily
#

There is no zombie head

#

๐Ÿ˜ฆ

lost matrix
lost matrix
golden turret
#

one of them

cosmic tree
haughty storm
#

Is it possible to create a config without doing it manually?

createDefaultConfig()

Gives me an IllegalArgumentException

lost matrix
lost matrix
lost matrix
#

^

haughty storm
#

ok, gimme a sec

golden turret
maiden thicket
haughty storm
#

Not the entire exception, but I think this should be the most important part

java.lang.IllegalArgumentException: The embedded resource 'config.yml' cannot be found in plugins\Main-1.0-SNAPSHOT.jar
        at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:193) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.saveDefaultConfig(JavaPlugin.java:180) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at de.firecreeper82.main.Main.createConfig(Main.java:23) ~[?:?]
        at de.firecreeper82.main.Main.onEnable(Main.java:19) ~[?:?]
golden turret
#

you

#

need to add the config.yml

haughty storm
#

ok, I'll try

#

thx

golden turret
#

what are you using

#

maven, gradle or raw

haughty storm
#

maven

lost matrix
golden turret
#

add the config to the /src/resources

#

or something like this

haughty storm
#

ok

lost matrix
cosmic tree
lost matrix
cosmic tree
#

all what i need is use api without individual plugin

cosmic tree
#

and

#

tasks {
build {
dependsOn(shadowJar)
}
}

lost matrix
slate pendant
#

Hello everyone! I heard no async threads should use bukkit api. But is that related to YamlConfiguration class? I mean it's also a part of the api

lost matrix
slate pendant
#

And can I somehow use it outside the plugin? There are just too good methods to make own using snakeyaml

cosmic tree
#

ok..

eternal night
#

Man even posted a screenshot

#

On how to build it

#

LOL

lost matrix
hasty prawn
#

"7smile" and "can't help" never belong in the same sentence

lost matrix
cosmic tree
#

that we must read gradle documentation

#

Thank you for explanation

lost matrix
left swift
#

What is the best way to determine servers when sending redis publish / subscribe? I mean e.g. which server sends the message to the proxy and vice versa.

slate pendant
#

it can make gameplay worse with the thing I am making

#

I mean not to run the config operations in a single tick

lost matrix
slate pendant
#

So, is this yamlConfiguration thing uploaded somewhere as an independent library?

left swift
lost matrix
harsh totem
#

I have this tabCompleter and when I use the command thw command works but the tabCompleter doesn't. I checked the variables and it says that when I use /spawnmob COW 5, args[0] is COW args[1] is 5 mob is the list of all entities and the name of the command is spawnmob. all of the variables are what they should be and yet it does not work. can you help?

    public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
        List<String> mobs = new ArrayList<>(Arrays.stream(EntityType.values()).map(Enum::name).toList());
        System.out.println(mobs);
        System.out.println(command.getName());
        for (int i = 0; i < args.length; i++){
            System.out.println(args[i]);
        }
        if (command.getName().equalsIgnoreCase("spawnmob") && args.length == 1) {
            return mobs;
        }
        System.out.println(args[0] + " " + args[1]);


        return null;
    }
    }```
slate pendant
lost matrix
slate pendant
#

so you mean I just shouldn't perform multiple operations on the same config object at the same time?

#

ok

#

thank you

fickle helm
#

I can't figure out why my plugin's soft dependencies are loading afterwards. In plugin.yml I have this
softdepend: [ ExecutableItems, SCore ]
yet both of those are loading first

golden kelp
#

loading before ur plugin?

fickle helm
#

problem is I need them loaded beforehard but my plugin loads first

hasty prawn
#

Do depend then

fickle helm
#

problem is they are optional

#

I did test with depend and that did make them load first

hasty prawn
#

softdepend should make them load first too, what is it saying to make you think yours is loading first?

fickle helm
#

server console shows it enables my plugin then afterwards runs all the other plugins startup messages.
In my plugin it's calling Bukkit.getPluginManager().isPluginEnabled(plugin)) and it's returning false since hasn't been enabled yet

maiden briar
#

Is it allowed to use # in a permission string?

fickle helm
#

I have a few other soft dependency plugins and they load first, it seems to be something special about this particular plugin that refuses to load first

fickle helm
#

impressive!

maiden briar
#

I know, this will make sure my plugin is enabled first

#

And it will disable last

#
SimpleReflection reflectedPluginManager = ReflectionProvider.reflect(Bukkit.getServer().getPluginManager());
        Map<Pattern, PluginLoader> pluginLoaders = new HashMap<>(reflectedPluginManager.getField("fileAssociations").getObjectInstance(Map.class));
        JavaPluginLoader javaPluginLoader = null;

        for(PluginLoader pluginLoader : pluginLoaders.values())
        {
            if(pluginLoader instanceof JavaPluginLoader)
            {
                javaPluginLoader = (JavaPluginLoader) pluginLoader;
                break;
            }
        }

        javaPluginLoader.enablePlugin(this);
        getServer().getPluginManager().registerEvents(this, this);

        BukkitPluginManager bukkitPluginManager = new BukkitPluginManager(javaPluginLoader);
        pluginLoaders.put(Pattern.compile("\\.jar$"), bukkitPluginManager);
        reflectedPluginManager.setField("fileAssociations", pluginLoaders);

This is custom reflection btw, are you able to understand it?

dark arrow
#

is it possible to increase the amount of time particle stays

#

cuz it disapears instatly

fickle helm
maiden briar
#

Ok if you understand Java reflection you will be good

brittle lily
#

Hey Guys How Can I Set "name config" When Player enter String(name) get message and change config?

mellow edge
#

OMG

#

I WORKED ON MY BEDWARS WIN CHECK FOR AN HOUR

#

and it works!

#

that stuff can get CONFUSING very fast

dark arrow
#

is there any way to create circle shape particle, by any formula or something?

mellow edge
#

worldedit has done it and some other plugins, so yeah

cyan compass
#

So i'm making a boss bar and i'm very confused cause this error has something to do with a skull:

rough drift
#

Simply move players from their team to the spectator team if they got final killed

rough drift
cyan compass
#
import org.bukkit.boss.BarStyle;```???
rough drift
#

It is a joke

#

Show us the code

#

I can't see what error you have unless I see what you did

eternal oxide
cyan compass
#

this is where i make the bar i think:


    private BossBar countdownBar;
    public Game_Manager(PluginName plugin) {
        this.plugin = plugin;
        this.team_manager = plugin.getTeam_Manager();
        this.maps_manager = plugin.getMaps_Manager();
        //items = maps_manager.getItems();
        countdownBar = Bukkit.createBossBar("Countdown", BarColor.WHITE, BarStyle.SOLID);


    }```
cyan compass
#

what?

rough drift
#

Why are you using _

#

in names

cyan compass
#

Yeah i know about that

rough drift
#

that are not public static final variables

rough drift
cyan compass
#

Cause i'm not the only one working on this project so i didn't make those

rough drift
#

Are you using intellij?

cyan compass
#

yes

mellow edge
#
 if (team.getDeathPlayers().size() >= team.players.size()) {
              for (GameTeam tm : gameTeams) {
                  if (tm.getTeamId() != team.getTeamId() && tm.getDeathPlayers().size() < tm.players.size()) {
                      System.out.println(tm.getTeamName() + " team was added to potential win");
                      temp.add(tm);
                  }
              }
          }

cyan compass
#

I am aware i can fix them

rough drift
#

right click, refactor, rename

cyan compass
#

Just looking for the issue today since i can't wrap my head around that error

#

Not worried about names right now

mellow edge
#

idc if it can be simplified, it works

cyan compass
#
    public void startCountdown() {
        countdownRunning = true;
        countdownBar.setVisible(true);
        countdownBar.setProgress(1.0);
        countdown = new BukkitRunnable() {
            private int timer = 15;
            private final double mathStuff = 1.0/timer;
            @Override
            public void run() {
                //timer--;
                if (timer == 0) {
                    this.cancel();
                    startGame();
                    return;
                }
                plugin.getServer().broadcastMessage("Game starts in: " + timer + " Second(s)");
                countdownBar.setProgress(countdownBar.getProgress()-mathStuff);
                timer--;
            }
        };
        countdown.runTaskTimer(plugin, 0, 20);
    }``` 
This is where i mainly use the boss bar
rough drift
#

Thats fine

#

They probs did it when sending

#

I sometimes do that too

cyan compass
#

Yeah i replaced it when sending

#

NDA stuffs

#

Do you really need to question my methods?

#

I come here asking for help for an error i do not understand

#

Not to be judged

rough drift
#

can you please show more

rough drift
#

Nothing

cyan compass
#
    public void stopCountdown() {
        countdown.cancel();
        countdownRunning = false;
        countdownBar.setVisible(false);
    }``` this is my stop countdown
rough drift
#

^

cyan compass
#

I think i do that somewhere else

rough drift
#

yeah

#

that's the problem

#

You need an iterator

cyan compass
#

not sure why it would act up when adding the boss bar

#

I also have no idea what class it would be erroring in

#

wait looping and modifying it.... No just looping and adding stuff

rough drift
#

yep

#

Looping and adding/removing

#

causes errors

eternal oxide
#

Do you get this error when running vanilla Spigot?

cyan compass
#

Don't think so no

eternal oxide
#

Then its a Paper issue

cyan compass
#

well i haven't tried vanilla spigot with this plugin

eternal oxide
#

Paper doing things async and you are fetching Players sync

cyan compass
#

But the plugin was working just fine before i added the boss bar

#

Then it errors when i run start countdown

eternal oxide
#

It may be the boss bar code causing issues, if your teams are holding a stale player object that Paper has already removed

#

um, no Teams stuff in there

cyan compass
#

yeah that's the thing

#

it shouldn't be erroring

#

the boss bar doesn't do anything with teams here

eternal oxide
#

Do you reference ANY Player objects in yoru boss bar code?

cyan compass
#

Nope

eternal oxide
#

Then I see no reason for your error. Test with Spigot and see if it still happens

cyan compass
#

Unless you count .setVisible

#

But that's just true and false

#

Eh. Doesn't need to be in my use case

eternal oxide
#

We are Spigot support here. So we need to know if this is actually a Spigot issue or a Paper one.

#

We see nothing in yoru code that could be causing the error so the only thign left is to test on Spigot

cyan compass
#

I'm aware of that but i can't just go and easily swap our entire dev sever over to a different .jar. And i can't just do a local server since running 2 minecraft clients + a local server + Inteliji + discord + firefox would quickly cap my computer specs

terse ore
#

Can I detect when someone refreshes server list to send a different motd? I don't manage to see it in the docs (in skript I was able to do so)

cyan compass
#

I am currently waiting 5 minutes so i can do speak there

harsh totem
#

do you think it would be ok if I had my plugin send a message with the syntax of the command instead of it trying to auto complete it?

cyan compass
#

But i doubt they will help since i'm using the spigot API and not any paper api stuff

fair breach
#

how can you place entire Buildings with a plugin?

left swift
cyan compass
eternal oxide
cyan compass
#

Yeah it is a paper issue. but what i'm saying is my plugin is not a paper exclusive plugin

#

It is designed using the spigot thingy and not paper

cyan compass
#

How in the world is that being triggered by a new boss bar

eternal oxide
#

its not. Its nothign to do with your Bossbar

cyan compass
#

oh

eternal oxide
#

probably you moved areas which loaded a chunk with a bad skull?

cyan compass
#

well my boss bar isn't rendering and it was triggered as soon as it should have

#

and i don't think there are any skulls placed

#

I guess i shall talk with the server owner and have them put the args in the server so i can find it

#

cause that will cause issues when debuggin

#

debugging*

#

It has to be a skull

#

I realized the error was as soon as my second tester joined the game

#

Maybe i shall delete their playerdata

haughty storm
#

If I have something like this:

    effects:
      - name: "ยง5Defence"
        duration: 10
        amplifier: 2
      - name: "ยง5Speed"
        duration: 10
        amplifier: 2

If I do

Main.config.getList("Potions." + args[1] + ".effects")

How would I get the name or duration?

tardy delta
tardy delta
#
// length checks and stuff
return StringUtil.copyPartialMatches(args[0], Arrays.stream(EntityType.values()).toList(), new ArrayList<>());```
#

assuming that the entity type is the first argument entered

#

you might even want to cache the result of that stream

left swift
#

If I send plugin message channel (own), that get info from proxy and I want to send chat message with that info to certain player should I do it on proxy, or send it again to the server and here send chat message?

rough drift
#

example:

effects:
  defence:
    name: "ยง5Defence"
    duration: 10
    amplifier: 2
  speed:
    name: "ยง5Speed"
    duration: 10
    amplifier: 2
#

that is correct

haughty storm
#

ok, thx

eternal night
#

in my opinion, the round trip to the server is probably best

#

most of your state, logic, all that jazz lives on the server

#

if you have anything that is appended to the message (idk rank or whatnot) you need the server most likely

#

unless you also fetch that on the proxy, but then you are doubling logic a lot

harsh totem
#

Is there a way for me to make it so that if I don't input any number it will only spawn 1 instead of giving me the error below?

        else if (command.getName().equalsIgnoreCase("spawnmob")) {
            EntityType entity = EntityType.valueOf(args[0].toUpperCase());
            if (args.length >= 2) {
                try {
                    int amount = Integer.parseInt(args[1]);
                    System.out.println(amount);
                    try {
                        for (int i = 0; i < amount; i++) {
                            player.getWorld().spawnEntity(player.getLocation(), entity);
                        }
                    } catch (IllegalArgumentException e){
                            player.sendMessage(ChatColor.RED + "That is not a valid number");
                        }

                } catch (IllegalArgumentException e) {
                    player.sendMessage(ChatColor.RED + "That is not a valid entity");
                }
            } else {
                player.sendMessage(ChatColor.RED + "(!) /spawnmob <mob> <amount>");
            }
        }```
river oracle
#

Learn Java?

#

You can do that with some basic if else checks and that's the bad way to do that

glossy venture
#

lmfao yeah

#

checking if an integer is valid is annoying tho

river oracle
#

So true lmao

glossy venture
#

i usually use a try { } catch (NumberFormatException) for that

#

but only for that

river oracle
#

Yep same here

tardy delta
#

uuuuhm my eyes

#

dont put all the stuff that wont cause an illegal arg ex in the same try block

harsh totem
#

No need to be rude

#

๐Ÿฅฒ

tardy delta
#

im not

river oracle
#

Constructive criticism isn't rude

dark arrow
#

how to freeze particles

gusty gorge
#

Can I somehow have every Class that used a constructor implement a method/interface?

tardy delta
#

wha-

gusty gorge
#

I want to have every class using a specific constructor implement an interface

dense geyser
#

is there a way to to force Bukkit.getOfflinePlayer(uuid) to do a web lookup like Bukkit.getOfflinePlayer(name) does when the player has never joined before? (when the OfflinePlayer from Bukkit.getOfflinePlayer(uuid) starts returning null for everything)

tardy delta
#

im still wondering which one does a web lookup cuz i searched in the decompiled code and didnt find it

gusty gorge
#

getOfflinePlayer#getPlayer()#getName I believe

#

Nvm

dense geyser
#

Bukkit.getOfflinePlayer(name) seems to return the player regardless of if theyve joined or not

#

something like Bukkit.getOfflinePlayer(uuid).getName() when the player has never joined returns "null" as a string

harsh totem
#

I'm trying to make it so that it detects if the entity is valid and if the number is valid and if you don't put any number it only spawns 1 entity but when I use it in game the it doesn't give me the error messages that it should give.

            if (args.length >= 2) {
                try {
                    EntityType entity = EntityType.valueOf(args[0].toUpperCase());
                    try {
                        int amount = Integer.parseInt(args[1]);
                        for (int i = 0; i < amount; i++) {
                            player.getWorld().spawnEntity(player.getLocation(), entity);
                        }
                    } catch (NumberFormatException nfe) {
                        if (args[1] == "") {
                            player.getWorld().spawnEntity(player.getLocation(), entity);
                        } else {
                            player.sendMessage(ChatColor.RED + "That is not a valid number");
                        }
                    }
                } catch (IllegalArgumentException e) {
                    player.sendMessage(ChatColor.RED + "That is not a valid entity");
                }
            } else {
                player.sendMessage(ChatColor.RED + "(!) /spawnmob <mob> <amount>");
            }
        }```
dense geyser
#

pretty sure Bukkit.getOfflinePlayer(name) is deprecated for the very reason that it uses a web lookup, might be an idea to fork spigot and add a feature to it where if it cant find it, it saves it to wherever Bukkit.getOfflinePlayer(uuid) looks

rough drift
mellow edge
#

how can I detect when someone is trying to put their armour off?

golden kelp
#

Inventory change event?

#

Check slots and validate accordingly

rough drift
#

So, I am storing data in player PDC's

#

Is there a way to remove data from PDC's of offline players

crisp steeple
rough drift
#

Because of the server making a request to the mojang api to get data

crisp steeple
#

yea

crisp steeple
trail oriole
#

When should I test my code ?

#

I've been working on a plugin for like 6 hours

#

but didn't try any of it on mc yet

crisp steeple
#

best practice is probably to test as often as you can

#

but a lot of people donโ€™t

red sedge
#

How would I sort a list of objects according to an integer variable inside that object? So like

private int priority;
}

and sort a List<Test> from 0 to above 0 coming at first

crisp steeple
#

#sort(<use priority as comparator>);

red sedge
#

Idk how to

#

I made this

    @Override
    public int compare(Test o1, Test o2) {
        return o1.getPriority() - o2.getPriority();
    }
}``` but it doesnt owrk
crisp steeple
#

as in it doesnโ€™t sort them properly?

red sedge
#

nope

#

do i need to set the list back?

#

theres prob smth else

crisp steeple
#

whatโ€™s your code for the actual sorting

red sedge
#

Debug.consoleWarn(itemStatsContainer.toString());
itemStatsContainer.sort(new SortByPriority());
Debug.consoleWarn(itemStatsContainer.toString());

crisp steeple
#

hm

#

not sure then

trail oriole
midnight shore
harsh totem
midnight shore
#

๐Ÿ˜๐Ÿ‘

quaint mantle
#

What is regen-exhaustion ?

#

does any smart person know

brittle lily
#

How Can I Use Economy On My Plugin? Its With API or something like that ?

worldly ingot
#

Vault API is your best friend when interacting with economy

brittle lily
#

thank you so much ๐Ÿ™‚

brittle lily
tardy delta
#

add it to your dependencies

#

and let your plugin depend/ soft-depend on it in your plugin.yml

harsh totem
#

how do I get a player variable from a string of it's name?

brittle lily
#

Oh Okay, Thank You ๐Ÿ™‚

tardy delta
#

Bukkit.getPlayerExact("name here")

harsh totem
trail oriole
#

how do i make a Player variable public to other classes ?

tardy delta
#

i gues i have to rethink your design

#

or

exotic depot
#

how can i create a spectator mode without using the actual gamemode? I want the player to be able to use items in the inventory but I want them to not be visible to the rest of the server and not interfere with any projectiles/block placing

tardy delta
#

?di

undone axleBOT
trail oriole
#

doesn't work

#

i don't want a getter/setter

tardy delta
#

if you read it

#

you see that its not a getter/ setter

chrome beacon
harsh totem
#

I have this in my main file and when the plugin is turned on I get this error: the return value of "com.ytg667.myplugin.MyPlugin.getCommand(String)" is null

    public void onEnable() {
        // Plugin startup logic
        getServer().getPluginManager().registerEvents(new TutorialEvents(), this);
        getCommand("heal").setExecutor(new TutorialCommands());
        getCommand("feed").setExecutor(new TutorialCommands());
        getCommand("spawnmob").setExecutor(new TutorialCommands());
        getCommand("spawnmob").setTabCompleter(new spawnmobTabCompleter());
        getCommand("tphere").setExecutor(new TutorialCommands());
        getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "[MyPlugin]: plugin is enabled!");
    }```
chrome beacon
#

Did you register the command in the plugin.yml

harsh totem
midnight shore
#

In the commands section

#

Also the others?

harsh totem
#
  heal:
    description: Heals a player
    usage: /<command>
  feed:
    description: Feeds a player
    usage: /<command>
  spawnmob:
    description: Spawns mobs at a player
    usage: /<command> <entity> <amount>
tphere:
    description: Tp's a player to you
    usage: /<command> <player>```
chrome beacon
#

tphere has wrong spacing

harsh totem
#

ok

#

nvm

#

thanks

#

i understand

tardy delta
#

good

trail oriole
#

I'm so confused on how DI works

#

I'm just trying to pass a player var from a command executor to a listener

crisp steeple
#

pass it as an argument?

trail oriole
#

Well I need to use it in the listener

crisp steeple
#

so pass it as an argument into the listener

trail oriole
#

like the targeted player

crisp steeple
#

wdym

#

like youโ€™re listening for an event?

#

and you want to pass your player into that?

trail oriole
#

No

#

I have a command that needs a player as of an arg, and I need to then use this player in my event listener

crisp steeple
#

i donโ€™t know what you mean by โ€œuse this player in my event listenerโ€

exotic depot
#

does inventory#getContents include slots that contain nothing?

crisp steeple
#

events are supposed to be called by bukkit or somewhere else

#

you wouldnโ€™t just use it as a function

trail oriole
#

well i need to change the targeted player's gamemode in my event listener

crisp steeple
#

why does it need to be in an event listener?

trail oriole
#

because it is in a gui

crisp steeple
#

what?

#

can you send some of your code

#

iโ€™m very confused on what you mean

trail oriole
#

I didn't code the listener yet though

crisp steeple
#

why does it need to be a listener

#

what event are you trying to listen for

trail oriole
#
public boolean onCommand1(CommandSender sender, Command cmd, String msg, String[] args) {
        if(sender instanceof Player) {
            Player player = (Player)sender;
            
            if(cmd.getName().equalsIgnoreCase("gm")) {
                if(args.length == 0) {
                    player.openInventory(inv);
                    Player play = (Player) sender;
                }
                if(args.length >1 && args.length <0 ) {player.sendMessage("ยง8[ยง2Kiwi pvpยง8] ยงfWrong number of arguments");}
                else {
                    player.openInventory(inv);
                    Player p = Bukkit.getPlayerExact(args[0]);
                    if (p != null) {
                        String pName = args[0];
                        Player play = Bukkit.getPlayer(pName);
                    } else {
                        sender.sendMessage("ยง8[ยง2Kiwi pvpยง8] ยงcPlayer doesn't exist");
                    }
                }
                return true;
            }
        }
        return false;
    }```
#

this command

#

opens a gui

#

with 4 choices

crisp steeple
#

okโ€ฆ

#

so what does that need an event listener for

trail oriole
#

and either changes your own gamemode, or the one of the targeted player

mellow edge
#

can I add a costum tag or something to a villager so I can detect that it's the right one

coarse finch
#

so i updated my development server and it needs to download the files and im at school and they have the endpoint blocked..... what can i do?

trail oriole
#

but to check which slot the player clicks on, I need that to be in the listener

#

to change the gamemode regarding of which the players clicks

crisp steeple
#

ok so

golden kelp
#

Wait

#

No it doesnt

crisp steeple
#

a listener listens for an event

#

when the event is called itโ€™ll pass the event along with extra information to that function

crisp steeple
#

you would not give a player to the event

#

the event already contains the player who clicked

trail oriole
#

Yes, but I need to change the gamemode of the player put in the command's arg and not the one who clicks

crisp steeple
#

then you would need to make a class for this

#

and make itโ€™s constructor have your command arg

#

then use that in your listener

trail oriole
#

And I thought all this was gonna be easy

#

okay I'll try this

small current
trail oriole
#

LMAO

#

dude i'm sorry

#

i'm a beginner

small current
#

Ok. That was a joke

trail oriole
#

I know ๐Ÿ˜ญ

small current
#

What are you exactly trying to do

coarse finch
trail oriole
#

what

tardy delta
#

i like to have a different class for each of my commands

small current
coarse finch
small current
#

Also name the pointers what they realy are
For example target instead of p

#

Cool tips

trail oriole
# small current <@425363058374737920>

I want to have a command that takes a player as an argument, then opens a gui with 4 items being the 4 gamemodes, then changes the gamemode of the targeted (arg) player to the one clicked on

small current
#

Are the guis opening fine?

#

You have problems for listening for the slot ?

trail oriole
#

Didn't try it yet, wanted to get done with this command before

#

like before testing it

#

and I don't have problems with the listener itself (yet), but with how to get the player from the command to the listener

#

both being in different java files

brittle lily
#

I set 3 variables. While doing the 2nd operation, it enters the variable I used before for the 3rd variable, how do I prevent this?

tardy delta
#

put the listener in the command is the simplest option

trail oriole
#

Can I put an event handler in a command ?

#

is that really a thing ?

small current
#

No just dont

#

@trail oriole do you know about statics ?

#

And hashmaps?

trail oriole
#

honestly I started java 2 days ago

small current
#

๐Ÿ’€

tardy delta
#

static abuse here we go

trail oriole
#

so not really

small current
tardy delta
#

a processor?

trail oriole
#

I can try

tardy delta
#

amd ryzen 5 like

small current
brittle lily
#

Hey Guys Can You Help Me Please I set 3 varible of Name, Healthi Type. Its like this
Please enter boss name
name
Please enter boss health
but When I do 2nd operation, it enteres the varible I used before 3rd varible, hwo do I prevent this But Its happening just on 3rd varible

tardy delta
#

no need to store inventories basically

small current
#

@trail oriole also learn more java before coding spigot, it will be hard to help you if you dont know much java
Good luck!

tardy delta
#

the only thing im doing is making a custom inventory class which extends InventoryHolder and which has a listener in it to checks for clicks dynamically

trail oriole
#

Well how do I learn java without practicing ?

tardy delta
#

not

trail oriole
#

Watching tutorials doesn't help much

small current
trail oriole
#

And I figured spigot would be a good way to practice ?

coarse finch
#

am i being dumb

tardy delta
#

if you dont have a basic knowledge of java, its not the best practice

eternal night
#

you are missing a bracket

#

in the for loop

coarse finch
#

i am?

small current
tardy delta
#

after the getOnline.. ())

trail oriole
#

Nono

coarse finch
#

oh yeah i am

trail oriole
#

I know how to do and use gui's

small current
coarse finch
#

thanks

tardy delta
#

x)

small current
trail oriole
#

I made it

#

the gui isn't the problem

small current
#

The slots?

trail oriole
#

I can make the listener too

#

nope

#

The problem is only getting that player variable into the listener

small current
# trail oriole nope

Just open gui in cmd
And then see if the clicked gui in the listener has a title of blabla
Handle the slots
event.getplayer
event.getinventory.getname

trail oriole
#

Well again

#

no

small current
#

You can set the holder
And check with instanceof
But it will be hard

tardy delta
#

you usually get a player variable by calling the getPlayer method on the event object

supple elk
#

Anyway I can do this ๐Ÿค”

#

I'm trying to create the same listener for every event which I put in the list

#

I'm guessing this doesn't work cause of type erasure

trail oriole
zinc mist
#

I am wanting to know what the best way would be to protect certain blocks from damage.
I know that I can make a listener for breaking blocks and stop it there, but is that the best way to do it for lots of little areas (the area is 3x4x3)

small current
#

Oh

#

Target player

#

Aaaaa

#

I understand now

tardy delta
#

doesnt this work

private <T extends Event> PermissionManager() {}``` im bad at generics lol
trail oriole
#

i'm sorry if I am not clear

tardy delta
#

and then do the generic stuff in the body

small current
#

I got it my problem

haughty storm
#

How would I change the custom texture id and the tag of an ItemStack

small current
#

@trail oriole you need to add data with inventoryholder
If anyone can give him an example please help him, im with a phone

supple elk
still coral
#

Hey

#

Can anyone help me add my newly bought scematic

trail oriole
zinc mist
#

I am wanting to know what the best way

small current
#

Yes

#

Use worldedit

small current
tardy delta
#
private <T extends Event> PermissionManager() {
  for (Class<T> clazz : permissionsList) {
    new AbstractListener<T>() {}
}```isnt this something?
small current
#

Good wifi

#

And good battery

trail oriole
#

what did you mean by add data to inventoryHolder ?

tardy delta
#

do you know what implementing an interface is?

trail oriole
#

Okay

#

you know what

#

imma learn java deeper lmao

tardy delta
#

good

tardy delta
#

what is it saying

supple elk
#

but doesn't T extend event >_<

tardy delta
#

and change the <eventclass> to <T> too

supple elk
#

says the same thing?

tardy delta
#

its extending Event lol

#

java generics weird

supple elk
#

yup

#

If I have something like this?

#

How do I actually provide T?

tardy delta
#

where

supple elk
#

in the createListener() method

#

generics aaahhh

#

basically I want the same thing to be performed every time for a bunch of listeners

tardy delta
#

is the abstractListene rinerface smth liek

interface AbstractListener<T extends Event> {
  @EventHandler
  void trigger(T t);
}```
supple elk
#

but don't want to have to register a listener every time

haughty storm
#

How would I change the tag of an ItemStack

tardy delta
#

im not even sure if you could do it like youre doing

supple elk
#

so then I want a list of events, then to go over them and create the same listener each time

tardy delta
#

as generics get erased on runtime

supple elk
#

wfnweoufowefweofnswewee

tardy delta
#

ask conclure if hes on lol

#

im too bad at it

#

i dont dare to tag him

supple elk
#

lol

#

do I dare

tardy delta
#

no

supple elk
#

mkay

chrome beacon
#

I wouldn't do things that way

quiet ice
#

wehat do you want there?

supple elk
#

oooh Olivo is here

#

possible salvation

supple elk
quiet ice
#

This looks like a really cursed way of registering listeners

chrome beacon
#

^

quiet ice
#

?jd-s

undone axleBOT
supple elk
#

why not do it like that ๐Ÿค”

haughty storm
#

that is the display name, not the tag

chrome beacon
#

I've noticed that you have a habit of doing thing the hard way

brittle lily
haughty storm
#

np

tardy delta
#

what tag?

quiet ice
#

That being said, generics can enforce certain things there

haughty storm
# tardy delta what tag?

You can give custom tags to items and entities with commands, but I dont know how to do that in a plugin

tardy delta
#

thats pdc iirc

quiet ice
#

So really, use the method I linked to instead of using the built-in bukkit way of declaring listeners

supple elk
#

So is there a way of doing what I'm trying to do?

tardy delta
#

?pdc

quiet ice
supple elk
#

right

quiet ice
#

Leme draw up some code how I think it may work

supple elk
quiet ice
#
public abstract class AbstractHandler<T extends Event> implements Listener {
    public AbstractHandler(Class<T> type, Plugin pl) {
        Bukkit.getPluginManager().registerEvent(type, this, EventPriority.NORMAL, (x, evt) -> trigger(evt), pl);
    }
    public abstract trigger(T event);
}
#

Of course there will be people shouting that such code does not belong in the constructor but to those people: I challenge your to write it in your way and post it there so I can ridicule the "correct" way as there is no correct way

haughty storm
mellow edge
#

how to make villager no ai, 1.8 I can't find NBTTagCompound class

chrome beacon
#

Did you import NMS

brittle lily
#

hey guys How can I perform an action 5 seconds after the event?

mellow edge
#

not really, is that a library

undone axleBOT
quiet ice
# mellow edge not really, is that a library

Are you sure that you should be using 1.8 without proper knowledge of miencraft internals (for reference NMS is the net.minecraft.server package, which is built into the server)?

brittle lily
quiet ice
#

That being said, in bukkit world the nms package is obfuscated

quiet ice
#

Ugh, that is such a bad argument

#

The real argument is that NMS is just pain; it wasn't written for use by plugins - bukkit was

supple elk
#

you really need mappings if you wanna do NMS

#

otherwise

#

omg

mellow edge
#

then nope

#

is there any other way to make a villager no-ai

#

for example how hypixel did it in bw

quiet ice
supple elk
#

here are your functions:
a()
a()
a()
a()
a()
b()
b()
c()
c()
c()
aa()
ab()

mellow edge
#

I get it

#

I hate obfuscation

supple elk
#

have fun

quiet ice
#

1.8.8 is old as hell and was compiled at a time where a search feature wasn't introduced in javadocs

mellow edge
#

I normally use 1.18 but now I need 1.8.8 for bw

quiet ice
#

but it appears that there is no pathfinding goal API there yet

#

that being said you might be able to emulate the no moving part via potion effect - albeit this is a REALLY cursed solution

mellow edge
#

what if I add him a potion effect with turtle master

#

lol yes

supple elk
supple elk
#

ah whoops skipped over, okay lemme look

mellow edge
#

what if I give him a slow potion of a lvl 255 or the max limit

quiet ice
#

no idea really

supple elk
#

Does this not run into the same issues?

#

You still have to provide a generic

supple elk
quiet ice
supple elk
#

mhm but still the generic is required

#

this works fine to be clear

#

The issue was trying to create a series of listeners from a list of event classes

quiet ice
#

Are you sure that this works?

supple elk
#

so that I could create the same listener for a bunch of different events without having to make a new method each time

supple elk
#

tried and tested

quiet ice
#

Hm, then javac is generating bridge methods

supple elk
#

that also works

quiet ice
supple elk
#

why?

#

means having to pass in the class twice

quiet ice
#

Because to listen for another event type X you just pass it's class

supple elk
#

but you still need to provide the generic of the class

quiet ice
#

The reflection instance of the class yes, how else would you do it?

supple elk
#

but isn't passing the generic in the whole issue in the first place?

#

trying to do a generic like that

quiet ice
#

Valhalla is not here there so generics can be ignored

#

Not the generic, the class instance

quiet ice
#

Brain was temporarily fried

supple elk
#

I am still confused lol

quiet ice
#

Basically generics are still in the same miserable state as they were 10 years ago: Effectively useless beyond compile time

#

You have to pass the concrete class instance

supple elk
#

I get that much

supple elk
quiet ice
#

So something like

new AbstractListener<Event>(eventClass, this) {
  // ...

... I think

supple elk
#

oh right

quiet ice
#

You can just ignore the generic after all

#

Or just not have the generic present at all in my AbstractHandler class

supple elk
#

yeah

#

I'll give it a try later

#

thanks for the help

crisp steeple
#

i mean

#

itโ€™s possible to just use the generic in the interface trigger event as well

#

iโ€™ve used something like that at some point

quiet ice
#

Nah, that is not how java works - you have to pass the concrete instance of the class somehow or hope that you compiler generates bridge methods in the way you expect it to generate

crisp steeple
#

ik that types get erased at runtime

#

but the type of a parameter doesnโ€™t

quiet ice
#

this is a phenomenon called bridge methods

ivory sleet
#

That type wont get erased tho

quiet ice
#

Unless you are talking about something else where the generics do not matter at all

ivory sleet
#

If a class derivative defines the type for its super class type parameter the type cannot go erased

quiet ice
#

I have a hard time guessing whether you guys are talking about java.lang.Class or generic signatures

ivory sleet
#

I thought deotime talked about generics in particular

#

tho tldr ๐Ÿ˜…

coarse finch
crisp steeple
#

iโ€™m saying in this example it could be something like

coarse finch
quiet ice
#

Myes

#

You need to add teh gradle shadow plugin

#

And then you need to compile that plugin/lib via mvn install

fair breach
#

Can someone recommend me a tutorial for creating teams and managing them
For a game like Bedwars

crisp steeple
#

(syntax error probably because on mobile)

public interface Example<T>{
     void trigger(T test);
}
quiet ice
#

And then you can add mavenLocal() to the repositories

coarse finch
crisp steeple
#

whenever something implements Example itโ€™ll have to profile itโ€™s generic type

#

which in turn defines the param type

quiet ice
#

Okay yeah, then that only works if you use that as the EventExecutor, but not for the registering itself

coarse finch
#

i dont even know if i need to shade it i just wanna be able to use it

quiet ice
#

oh it's on ossrh apparently

crisp steeple
quiet ice
#

it's just a QoL thing

crisp steeple
#

how would you have multiple event handlers in only one listener

#

you would have to define whatever you want to happen in that one method

#

unless you had a mapping or something between events and event handlers

#

but at that point why not just register it normally

quiet ice
#

QoL

sterile token
#

Geol i have some issues too using your code, because i cannot use Boostrap boostrap on constructor

#

Its oblise me to either use BungeePlatform or SpigotPlatform class, because then i cannot access to the methods

#

๐Ÿ˜ฎโ€๐Ÿ’จ

ivory sleet
#

I mean the biggest benefit with using EventExecutor over the normal Listener api is the fact that you can avoid reflective invocations

#

which was a huge benefit when reflection wasnt particularly optimized like it is today

sterile token
#

Java 8 == shity reflections just dont use it if u use tha java version

ivory sleet
#

mye

quiet ice
#

Basically you will have some something like this @sterile token
Bukkit launches SpigotPlattform -> Finds & Launches your plattform-independent plugin class
Bungee launches BungeePlattform -> Finds & Launches your plattform-independent plugin class

sterile token
#

Im have a nightmae in fact

quiet ice
#

You probably can use the service loader API for that if you want extra nightmare fuel

mellow edge
#

I almost finished the bedwars plugin

quiet ice
#

Oh in that case you could've just made the villagers be imprisoned instead of preventing them from moving

sterile token
#

Geol

#

Can i send code?

quiet ice
#

Clever map design can hide a few code design issues ๐Ÿ˜

mellow edge
#

I did, I blocked them in a 1 block space

#

and thats it lol

sterile token
#

Why the reason of using prvate methods if then you can access via reflections ๐Ÿค”

ivory sleet
#

watttt

quiet ice
#

Not for long

#

You cannot access private methods in another module already for example

#

Unless the module is open to the module that performs the reflective access