#help-development

1 messages · Page 1775 of 1

hasty prawn
#

What are you asking then

acoustic pendant
#

that

#

to give a value

ivory sleet
acoustic pendant
#

it has to check that value and has to be at least x blocks away from a value it has gave before.

ivory sleet
#

Can you give a concrete example?

acoustic pendant
#

yes

hasty prawn
#

So like, if they need to be 5 apart

1st: 7
2nd: 6 (fails 5 away test from 7)
2nd: 13
etc etc

ivory sleet
#

but from what I understand
Let’s say you roll in the first instance
34
then you want the next value to atleast be
x+34 or higher?

acoustic pendant
#

ok

#

wait

#

The first time the value was "540" then the value is "600" but as this is not 200 away (for example) it takes another number

hasty prawn
#

Yeah so what I said

ivory sleet
#

It is not 200 away from what?

hasty prawn
#

540

#

The last number it generated

acoustic pendant
#

540 600

#

yep

#

no

ivory sleet
#

Hmm yeah

acoustic pendant
#

not the last number

#

any number it has generated

hasty prawn
#

Oh

acoustic pendant
#

well

#

any number no

#

any number that has been executed

hasty prawn
#

Well keep track of all the numbers you've generated, when you generate a new number, make sure none of them are within 200 of the one you just generated

#

If they are, just generate a new number and repeat

eternal oxide
#

are you trying to generate random spawn locations which must be x blocks apart?

acoustic pendant
#

yes?

eternal oxide
#

?

#

its a yes or a no

acoustic pendant
#

yes

eternal oxide
#

do you have a specific area this has toi happen in?

acoustic pendant
#

i mean

#

Random random = new Random();
int x = random.nextInt(999999999);
int y = 100;
int z = random.nextInt(999999999);

#

i have done this

eternal oxide
#

don;t show me code, just answer the question

acoustic pendant
#

sure

acoustic pendant
#

not an area

eternal oxide
#

ok, then stop using random to generate and instead use a grid

acoustic pendant
#

but a void world

#

GridLayout?

eternal oxide
#

yes, using a grid all points will always be x blocks apart and you can easily calculate a new location and track any that have been used

acoustic pendant
#

oooh

#

tysm! 😄

hoary pawn
#

what is this suppose to mean

#

[15:20:34] [Server thread/INFO]: com.splyfof.splymain.ItemsJsonReader@9eaa91

#

the @ part

tardy delta
#

then why is a constructor in the main class never used?

hoary pawn
#
try (Reader reader = new FileReader("splymainitems" + File.separatorChar + filename)) {
                ItemsJsonReader itemsjsonreader = gson.fromJson(reader, ItemsJsonReader.class);
                getLogger().info(itemsjsonreader.toString());
                System.out.println(itemsjsonreader);```
ivory sleet
#

The part after @ is the memory address

tardy delta
#

the class extending JavaPlugin

hoary pawn
#

it should print a object toh

#

tho

ivory sleet
#

That string is printed since you haven’t overridden ItemsJsonReader::toString

ivory sleet
ivory sleet
tardy delta
#

oh never saw it

ivory sleet
#

It’s just not used at compile time

ivory sleet
#

Which is why the compiler might mark it as unused

hoary pawn
#

how would i do that lol

ivory sleet
#

Try adding
public String toString() {
return "blah";
}
In your ItemsJsonReader

#

You’ll recognize a change

#

Then work it out from there I suppose

hoary pawn
#

that toString should make it a string tho right?

ivory sleet
#

Yuh

#

That’s the intention of it

hoary pawn
#

hmm

ivory sleet
#

It should represent an instance of the class in a mere string

hoary pawn
#

hmm

#

wouldnt it show the name string then?

ivory sleet
#

Not automatically

hoary pawn
#

trying with this guide so probably some wrong code lol

ivory sleet
#

You’d have to return name; in toString

hoary pawn
#

ahhmm

#

i thought it was gonna show something like this
Staff{name='mkyong', age=35, position=[Founder, CTO, Writer], skills=[java, python, node, kotlin], salary={2018=14000, 2012=12000, 2010=10000}}

ivory sleet
#

Oh that’s possible

#

If you format it like that

#

For instance

tardy delta
#

String.format uwu

ivory sleet
#

return "{name="+this.name+"}"; in toString could achieve that

hoary pawn
#

the guide i was following was totally different so probably that

ivory sleet
#

Well I mean are you trying to deserialize and serialize stuff into/from json using Gson?

blazing scarab
ivory sleet
#

Lol what library is that

blazing scarab
#

Guava

ivory sleet
#

Interesting, never heard of it 👀

tardy delta
#

I saw MoreListeners

#

heh i cant call super.onTabComplete(...) when implementing TabExecutor

mystic sky
west oxide
#

uwu

native bloom
#

Is it possible to flip the direction of a powered furnace minecart without using NMS?

solar sable
#

guys how to repeat a task?

#

like make it non stop repeating the same task

mystic sky
#

ItemStack be like

solar sable
#

like BukkitRunnable or something

eternal night
#

.scheduler

#

?scheduler

#

Aww

eternal oxide
#

?scheduling

undone axleBOT
eternal night
#

Wow

solar sable
#

okay so guys

#

i found out how to repeat a task

#

but now i dont know how to repeat the task i want

#

right now its just spamming "this is a repeat task" in chat

mystic sky
#

Btw in how much time u repeat the task?

solar sable
# mystic sky remove the logger i guess
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
            @Override
            public void run() {
                Bukkit.broadcastMessage("this is a repeat task");
            }
        }, 0L, 20L); //0 Tick initial delay, 20 Tick (1 Second) between repeats
``` yeah but how do i put the task that i want it to repeat in it?
mystic sky
#

Well it's obvuisly that will spam

#

If it's a repetitive task XD

solar sable
#

yup ik thats what i want it to do but idk how to put the task i want it to be in that

#

well let me say what i want to do first so you can understand

mystic sky
#

Well i don't know even what do u want to do.

solar sable
#

so i made a scoreboard but its not updating so i think to update it every tick then i need the repeat task but now idk how to put the task inside the repeat scheduler

mystic sky
#

Do u want to do a task for that?

solar sable
#

i have the task

#

but idk how to put the task inside the repeat scheduler

mystic sky
#
    //Updating the scoreboard
    private void updateBoard(SternalBoard board) { //SternalBoard it's my api
        List<String> lines = core.getConfig().getStringList("settings.scoreboard.lines"); //Path
        lines.replaceAll(s -> PlaceholderUtils.sanitizeString(board.getPlayer(), s)); //Papi parse
        board.updateLines(lines);
    }
}
solar sable
#

whats this

mystic sky
#
    //Update tasks > 20
    public void init() {
        taskIds = new Integer[2];

        if (core.getConfig().getInt("settings.scoreboard.update") <= 0) {
            core.getConfig().set("settings.scoreboard.update", 20);
        }

        if (!core.isAnimationEnabled()){
            taskIds[0] = (core.getServer().getScheduler().runTaskTimerAsynchronously(core, () -> {
                AsynchronousFileChannel file = (java.nio.channels.AsynchronousFileChannel) AsynchronousFileChannel;
                for (SternalBoard board : this.boards.values()) {
                    updateBoard(board);
                }
            }, 0, core.getConfig().getInt("settings.scoreboard.update", 20))).getTaskId();

            if (core.getConfig().getInt("settings.scoreboard.update") > 0) {
                taskIds[1] = (core.getServer().getScheduler().runTaskTimerAsynchronously(core, () -> {
                    for (SternalBoard board : this.boards.values()) {
                        board.updateTitle(PlaceholderUtils.sanitizeString(board.getPlayer(), core.getConfig().getString("settings.scoreboard.title")));
                    }
                }, 0, core.getConfig().getInt("settings.scoreboard.update", 20))).getTaskId();
            }
        }
    }
#

I think u want to do something like that

solar sable
#

uhm yes but this seems complicated

mystic sky
#

U can see it, it's open source.

quaint mantle
#

is there a way to send message through bungeecord to other server without having bungeecord plugin?

solar sable
#

are you just showcasing your api-

quaint mantle
mystic sky
solar sable
#

ye im using bukkit rn cause i understand it a bit

#

but tell me how to put the task that i want it to repeat, inside it

ripe burrow
mystic sky
mystic sky
solar sable
#

the scoreboard

#

should i send the whole code?

ripe burrow
solar sable
#
ScoreboardManager manager = Bukkit.getScoreboardManager();
        Scoreboard board = manager.getNewScoreboard();

        Objective obj = board.registerNewObjective("HubScoreboard", "dummy",
                ChatColor.translateAlternateColorCodes('&', "&a&l<< &2&lCodedRed &a&l>>"));
        obj.setDisplaySlot(DisplaySlot.SIDEBAR);
        Score score = obj.getScore(ChatColor.BLUE + "=-=-=-=-=-=-=-=-=-=");
        score.setScore(3);
        Score score2 = obj.getScore(ChatColor.AQUA + "Online Players " + ChatColor.DARK_AQUA + Bukkit.getOnlinePlayers().size());
        score2.setScore(2);
        Score score3 = obj.getScore(ChatColor.AQUA + "Total Mob Kills: " + ChatColor.DARK_AQUA + player.getStatistic(Statistic.MOB_KILLS));
        score3.setScore(1);
        player.setScoreboard(board);
mystic sky
solar sable
#

cause i want the Mob Kills to update every tick so it can show me what my actual mob kills is instead of just staying on 71

quaint mantle
mystic sky
#
public void taskUpdate(Player player){

new BukkitRunnable(){
@Override
public void run(){

if(player == null){
this.cancel();
}else{
Scoreboard board = p.getScoreboard();

//Here ur stuff to update
}

}
}.runTaskTimer(Scoreboard.plugin, 0, 20)
}
solar sable
#

oop

mystic sky
#

It's pretty much bet generate a config, and add a string to edit the ticks-check

solar sable
#

eh

mystic sky
#

Nvm, if it's for you i guess that u will not edit it so much.

solar sable
#

i dont understand what you mean but that

#

by that*

#

but uh that will repeat the scoreboard?

#

nonstop?

mystic sky
#

With }else{
Scoreboard board = p.getScoreboard(); u are getting the scoreboard that u created

#

Just will check all time the players.

#

As i said, u can see my plugin to "guess" how u want it?

#

Or using an api, that does that more easy.

solar sable
#
public void createBoard(Player player) {

        ScoreboardManager manager = Bukkit.getScoreboardManager();
        Scoreboard board = manager.getNewScoreboard();

        Objective obj = board.registerNewObjective("HubScoreboard", "dummy",
                ChatColor.translateAlternateColorCodes('&', "&a&l<< &2&lCodedRed &a&l>>"));
        obj.setDisplaySlot(DisplaySlot.SIDEBAR);
        Score score = obj.getScore(ChatColor.BLUE + "=-=-=-=-=-=-=-=-=-=");
        score.setScore(3);
        Score score2 = obj.getScore(ChatColor.AQUA + "Online Players " + ChatColor.DARK_AQUA + Bukkit.getOnlinePlayers().size());
        score2.setScore(2);
        Score score3 = obj.getScore(ChatColor.AQUA + "Total Mob Kills: " + ChatColor.DARK_AQUA + player.getStatistic(Statistic.MOB_KILLS));
        score3.setScore(1);
        player.setScoreboard(board);
            new BukkitRunnable(){
                @Override
                public void run(){

                    if(player == null){
                        this.cancel();
                    }else{
                        Scoreboard board = player.getScoreboard();
                    }

                }
            }.runTaskTimer(plugin, 0, 20);
    }
``` does it seem okay?
mystic sky
#

Well, i whouldn't do that in the same class?

#

"ScoreboardTasks.class" or idk

solar sable
#

well uh i dont mind it

mystic sky
#

Well, seems fine.

solar sable
#

but its okay right?

#

okay then

#

let me try it

mystic sky
#

Btw i forgot

#

For what version is it?

#

To avoid kick issues and that things.

solar sable
#

oh

#

1.17

mystic sky
#

Then nvm

#

Just under 1.13 u should set a check

mystic sky
ivory sleet
#

That works however it requires a player to be online

solar sable
#

hm

#

it doesnt seem to repeat

#

i mean like im online and also killing mobs but it doesnt change

mystic sky
#

 public void updateScoreBoard(Player player) {

        Scoreboard board = player.getScoreboard();
#

I guess

solar sable
#

just that?

#
new BukkitRunnable(){
                @Override
                public void run(){

                    if (player == null){
                        this.cancel();
                    }else{
                        Scoreboard board = player.getScoreboard();
                    }

                }
            }.runTaskTimer(plugin, 0, 20);
``` do i remove this then?
mystic sky
#

        if (Bukkit.getOnlinePlayers().size() == 0) {
            board.getTeam("onlineCounter").setPrefix(ChatColor.DARK_AQUA + "0" + ChatColor.RED + "/" + ChatColor.DARK_RED + Bukkit.getMaxPlayers());
        } else {
            board.getTeam("onlineCounter").setPrefix(ChatColor.DARK_AQUA + "" + Bukkit.getOnlinePlayers().size() + ChatColor.RED + "/" + ChatColor.DARK_RED + Bukkit.getMaxPlayers();
        }
 
solar sable
#

oh

#

uh where do i put this?

mystic sky
#

Using the team

solar sable
#

can you put it in the code for me?

#

idk where to put this

mystic sky
#
        Score score= obj.getScore(ChatColor.translateAlternateColorCodes('&', "&a&l<< &2&lCodedRed &a&l>>"));
        score.setScore(3);

        Team onlineCounter= board.registerNewTeam("onlineCounter");
        onlineCounter.addEntry(ChatColor.RED + "" + ChatColor.WHITE);
        onlineCounter.setPrefix(ChatColor.GREEN + "Online" +  Bukkit.getMaxPlayers());
        Score score3 = obj.getScore(ChatColor.AQUA + "Total Mob Kills: " + ChatColor.DARK_AQUA + player.getStatistic(Statistic.MOB_KILLS));
#

something like that lol

solar sable
#

thanks

mystic sky
sage patio
#

Hello, how I can delete my resources?

solar sable
#

delete resources?

#

what do you mean by that

sage patio
#

my resources on spigotmc

ivory sleet
#

He probably means in the resource section

solar sable
#

ooh

sage patio
#

plugins / resources on my spigot page

solar sable
#

well i dont know that too sorry 😅

mystic sky
#

XD

sage patio
#

np man XD why sorry?

mystic sky
#

Yeah well all we ask sometime

solar sable
#

oh no

#

well uh

#

it doesnt show anything

#
Objective obj = board.registerNewObjective("HubScoreboard", "dummy",
                ChatColor.translateAlternateColorCodes('&', "&a&l<< &c&lRiskyRay &a&l>>"));
        obj.setDisplaySlot(DisplaySlot.SIDEBAR);

        Team OnlineCounter = board.registerNewTeam("OnlineCounter");
        OnlineCounter.addEntry(ChatColor.RED + "" + ChatColor.WHITE);
        OnlineCounter.setPrefix(ChatColor.GREEN + "Online: " +  Bukkit.getMaxPlayers());
        Team MobKills = board.registerNewTeam("MobKills");
        MobKills.addEntry(ChatColor.AQUA + "" + ChatColor.WHITE);
        MobKills.setPrefix(ChatColor.BLUE + "Mob Kills: " + player.getStatistic(Statistic.MOB_KILLS));
#

it only shows the scoreboard title

#

how to make it visible

ivory sleet
#

It’s hard to tell from that mere snippet of yours

solar sable
#

oop

ivory sleet
#

Would be easier if you showed the entire class or something

solar sable
#

do you want me to send the whole code?

#

oh okay

ivory sleet
#

Also make sure you’re testing a newly compiled jar with the latest changes

solar sable
#

well its combined with another code so dont mind it

ivory sleet
#

If you have GitHub push it to a remote repo there

solar sable
#

?paste

undone axleBOT
solar sable
#

thats the whole class code

#

its combined with one of my other code so dont mind that

ivory sleet
#

Send the 2 classes

solar sable
#

2 classes?

ivory sleet
#

Or well is that it?

solar sable
#

uh thats all of the scoreboard

ivory sleet
#

So what are you trying to do?

solar sable
#

to make the Mob Kills count update

ivory sleet
#

Cuz right now it looks somewhat like a mess

solar sable
#

because i want to make like a mob kills count that can show players how many mobs they've killed

#

but it doesnt seem to update while theyre online

ivory sleet
#

Ah I understand

#

First of all

#

You probably want to map a scoreboard instance to every player online, and not setting a new one for every player once a player joins

solar sable
#

oh

#

i dont really know how to do that

ivory sleet
#

Yeah I guess I can walk you through, 1 second

#

First of all let’s do it from a new class, such that we can isolate the scoreboard logic itself, okay?

solar sable
#

okay

ivory sleet
#
public class ScoreboardRepository {
  
  public void add(Player player) {
    
  }

}``` something like this is probably enough for the time being
#

you might notice it won’t do a jack shit as of now

solar sable
#

yup i see that 😅

ivory sleet
#

But if you want, you could go ahead in main class and do smtng like

public class FancyMainClassEpicStuff extends JavaPlugin {
  @Getter 
  private final ScoreboardRepository scoreboardRepo = new ScoreboardRepository();
  
  @Override public void onEnable() {
    this.getServer().getPluginManager().registerEvents(new WelcomeListener(this),this);
  }
}

//then in WelcomeListener you probably will have something like:

public record WelcomeListener(FancyMainClassEpicStuff plugin) implements Listener {

  @EventHandler public void onJoin(PlayerJoinEvent event){
    Player player = event.getPlayer();
    plugin.getScoreboardRepo().add(player);
  }
}```
#

Now let’s continue the repository class

solar sable
#

wait

#

uh

#

im tryna understand what you want me to do with this code here gimme a sec

ivory sleet
#

The first class is your main class, which basically instantiates/creates an instance if ScoreboardRepository, then we expose a getter (which can be done without Lombok, and is probably what you should do)

solar sable
#

so i gotta put the code

@Getter 
  private final ScoreboardRepository scoreboardRepo = new ScoreboardRepository();
  
  @Override public void onEnable() {
    this.getServer().getPluginManager().registerEvents(new WelcomeListener(this),this);
  }
}
``` in my main?
ivory sleet
#

How does your main class look right now

solar sable
#

uhm

#

very

#

messy

ivory sleet
#

Send it, I don’t mind

solar sable
#

because i dont know how to seperate recipe codes

#

?paste

undone axleBOT
solar sable
vale ember
#

is it better to use reflection or create modules for each version for NMS?

ivory sleet
#

Okay ima jump on my pc 1 sec lol

solar sable
ivory sleet
#

But the performance difference is negligible

#

Especially in later versions

#

Of course with the assumption that you cache the reflection instances you obtain

vale ember
#

ok

solar sable
#

my main is messy lol

#

also idk how to put my recipes in one class instead of them out in the open at the main

#

lol

ivory sleet
#

yuh

#

okay im on my school laptop now lol

#

but anyways

#

you could just extract the recipe logic out from the onEnable method in another method

mellow flower
#
Block block = p.getTargetBlockExact(5);
                Material smoker = block.getType();
                if (smoker == Material.SMOKER) {
                    p.getInventory().removeItem(malzeme);
                    p.closeInventory();
                    if (block.getState() instanceof Smoker) {
                        Smoker f = (Smoker) block.getState();
                        f.setBurnTime((short) (20 * 60 * 2));
                    }``` guys this is not working why?
#

I am setting the furnace burning when I did something

ivory sleet
#

@solar sable maybe?

#

and then ofc in onEnable

#

you'd call setupRecipes()

solar sable
#

what-

#

uh

#

idk what you mean but i did this

#

?paste

undone axleBOT
solar sable
solar sable
#

i think what you did is easier

ivory sleet
#

yuh ^

#

anyways the

public void setupRecipes() {
  //the code
}```
is just the definition of a method/instruction
#

we then of course need to make sure that the instruction is read by our program

#

which is precisely done in onEnable

solar sable
#

oh

#

its that easy

#

damn

ivory sleet
#

yuh

#

and void just means the instruction does something and thats it

#

if you were to replace void with for instance String it would expect you to once the instruction has been completed, return a string value

#

well if you're interested in that, I suggest googling a little about Java methods, and of course you're free to ask if there's something you wouldn't understand

#

anyways should we continue with the scoreboard?

near kite
#

can anyone explain

#

i have the depend

#

it isnt working

ivory sleet
#

are you using maven/gradle?

near kite
#

Yes

ivory sleet
#

then you need to reload your project

near kite
#

huh

#

wtf

#

it fixed

ivory sleet
#

oo

near kite
#

NVM

#

its back

ivory sleet
#

sounds delightful

near kite
tardy delta
ivory sleet
#

lol

near kite
vale ember
# near kite anyone?

open your pom.xml and click the refresh button on top-right corner if it is there

vale ember
#

if there is no such button, please send content of pom.xml

near kite
#

why the fuck did i type kick

vale ember
#

Actually, there is no com.andrei1058.bedwars.BedWars class, maybe you are search for com.andrei1058.bedwars.api.BedWars? though it is still weird cuz in my ide it works fine.

try invalidation cache via File -> Invalidate Caches, check all checkboxes and click Invalidate and Restart

vale ember
#

??? ???

near kite
#

do i run

#

invlidate caches

vale ember
#

click "File" at the top-left of intellij, then click "Invalidate Caches..." then check all checkboxes and click "Invalidate and Restart"

ember estuary
#

Can you do plugin.saveDefaultConfig() in onLoad() ?

#

Or might that cause problems?

#

Is doing it in onEnable() prefered?

eternal night
#

You should be perfectly fine calling this onLoad

#

it doesn't interact with the server whatsoever

#

Just copies a file from inside your jar into the plugin folder

tardy delta
#

i cant call super.onTabComplete(....)

ivory sleet
#

Not if the super method is an abstract method

visual tide
#

^^

tardy delta
#

ah bruh

#

i thought you could call abstract methods

#

then how can i block the method from being executed

@Override
    public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args) {
        return (!isAuthorized(sender, permission) || !hasTabComplete || isConsoleSender) ? null : super
    }
#

otherwise call itself (the method is overridden so)

#

this without stackoverflow

foggy estuary
#
                Bukkit.broadcastMessage("test");
                }
                     ``` anyone know why when i killed the entity it doesnt broadcast it...
tardy delta
#

are you sure it gets executed?

paper viper
#

nvm i was thinking something else

#

but tbh id prefer a map

#

¯_(ツ)_/¯

#

I thought it was like materials to normal display name or smthing but i was wrong

quaint mantle
#

Translatable components 😎

grave kite
#

Hi, is it possible to trigger PlayerPortalEvent on a player manually (so he changes the world and a portal gets created/discovered)?

mortal hare
#

java.util.ConcurrentModificationException: null

#

i hate this bullshit

#

its not as if im using async operations

#

its due to the way i cannot delete something while iterating the same reference of the collection

#

so annoying

quaint mantle
#

(iterators)

mortal hare
#

you can do iterator.remove()

#

but heck, i already a made public method doing that

#

now i need to make iterator version of it

#

disgusting

quaint mantle
#

There's also removeIf

mellow flower
#

can somebody help please? I am getting this error craftsmoker cannot be cast to block.smoker

#

                Block block = p.getTargetBlockExact(5);
                Material smoker3 = block.getType();
                BlockState state = block.getState();
                Smoker smoker = (Smoker)state;
                BlockData data = Material.SMOKER.createBlockData((blockData) -> ((Smoker)blockData).setBurnTime((short) 1));
                p.sendBlockChange(smoker.getLocation(), (BlockData) smoker);
                ```
winged ocean
#

Hey, i just started learning java. So i thought i might as well make a plugin whilst learning to apply skills to something I might use in future for good practice.
I am juist wondering, currently I just installed Intellj IDE, for the JDK would I use java 16, the plugin is for a 1.17.1 server. I am not too sure which version to use, so I am assuming java 16 is the best version to use

ivory sleet
#

Yeah

#

I mean soon Java 17 is probably the wiser choice between the two

#

But for the time being 16 or just 11 are both safe bets

winged ocean
#

how soon is soon tho

ivory sleet
#

When more stuff surrounding the development of Java starts to support Java 17

#

For instance gradle, a popular build and dependency management tool for Java has recently added support for Java 17

young knoll
#

Or when you want to use NMS in 1.18

ivory sleet
#

That too

sullen marlin
#

using nms

#

😠

winged ocean
#

so im guessing java is very backwards compatible?

ivory sleet
#

Sort of

winged ocean
#

i just started learning coding so idk too much

mellow flower
young knoll
#

What do you want me to do, contribute or something, smh

ivory sleet
#

Generally a java compiled class with the version x and a jvm instance with the version y, you’d get the version relationship of x<=y

sleek pond
#

How would one get the actual Item entities from a death, instead of the itemstacks?

mellow flower
sleek pond
#

that's a design flaw

young knoll
sleek pond
#

i can work around it

#

but it'll be kind of janky

young knoll
#

What do you want the entities for

winged ocean
#

huh

sharp bough
#

is it possible to access the config files of plugin A from plugin B?

winged ocean
#

for oracle website i need to fill in all my personal info for just JDK

#

tf

sharp bough
#

i ask this because i want to create a "manager plugin" or like a main plugin to controll my other plugins in my server

undone axleBOT
sullen marlin
#

sure, Plugin.getConfig is public

sharp bough
#

another way of askign this is "is it possible to access a config file with a given path?"

young knoll
#

As is getDataFolder if you want to access other files

young knoll
ivory sleet
sharp bough
#

aight im gonna try that thanks

young knoll
#

Remember when we didn’t have to use adopt open jdk

#

Smh oracle

winged ocean
#

does which JVM really matter or no

sullen marlin
#

I thought with java 17 oracle is giving normal builds again

arctic moth
#

anyone know why this isnt working?

@EventHandler
    public void onJoin(PlayerJoinEvent event) {
         createBoard(event.getPlayer());
    }
    public void createBoard(Player player) {
        ScoreboardManager manager = Bukkit.getScoreboardManager();
        Scoreboard board = manager.getNewScoreboard();
        Objective obj = board.registerNewObjective("ScoreboardName", "dummy", ChatColor.RED + "" + ChatColor.BOLD + "<< " + ChatColor.DARK_RED + "Savage SMP" + ChatColor.RED + " " + ChatColor.BOLD + ">>");
        obj.setDisplaySlot(DisplaySlot.SIDEBAR);
        Score discord = obj.getScore(ChatColor.BLUE + "Discord: " + ChatColor.RESET + "discord.gg/aserver");
        Score ip = obj.getScore(ChatColor.AQUA + "IP: " + ChatColor.YELLOW + "savagesmp1.minehut.gg");
        Score divider = obj.getScore("");
        Score statstitle = obj.getScore(ChatColor.GOLD + "" + ChatColor.BOLD + "STATS:");
        Score mobkills = obj.getScore( "Mob Kills: " + ChatColor.DARK_GREEN + player.getStatistic(Statistic.MOB_KILLS));
        Score playerkills = obj.getScore("Player Kills: " + ChatColor.DARK_PURPLE + player.getStatistic(Statistic.PLAYER_KILLS));
        Score deaths = obj.getScore("Deaths: " + ChatColor.DARK_RED + player.getStatistic(Statistic.DEATHS));

        discord.setScore(7);
        ip.setScore(6);
        divider.setScore(5);
        statstitle.setScore(4);
        mobkills.setScore(3);
        playerkills.setScore(2);
        deaths.setScore(1);

        player.setScoreboard(board);
    }
arctic moth
#

no errors or anything in the console

#

its like onJoin isnt getting triggere

young knoll
#

Fun fact, discord detects server invites in code blocks

arctic moth
#

lol

sullen marlin
#

did you register the event

ivory sleet
arctic moth
#

um

#

no

#

lol

#

im dumb

#

i swear thats what happens half the time im here

#

i always forget to register

sullen marlin
#

one day I'll port Minecraft java edition to xbox

#

just to prove what microsoft should have done

young knoll
#

But performance!!!11

sullen marlin
#

lol if you think bedrock performance is good

young knoll
#

I mean, I hear it runs fine

#

Just buggy

winged ocean
#

port it to ps5

sullen marlin
#

I mean it gets high framerates / huge render distance if you just sit there

#

but aside from that, 💩

young knoll
#

Give us @EventListener annotation kthx

#

Not sure that would work well with spigot due to people using a lot of dependency injection

sullen marlin
#

idk how that would work

#

you'd need to include a whole dependency injection framework too

young knoll
#

Yeah

#

Works for forge since no mod instance is passed around

ivory sleet
#

Hehe

misty current
#

is there a way to instant respawn the player without the death screen flashing for a split second?

young knoll
#

What version

misty current
#

there's no gamerule in the ver im using

winged ocean
#

im so stupid, didnt even see the built in jdk installation for intellj

sullen marlin
#

sooo 1.8

#

lol

misty current
#

i thought of canceling the damage event if damage's fatal but then i'd have to handle the drops and the rest

#

yea exactly

#

was wondering if there was another way else than canceling damage event

ivory sleet
#

Update

#

🍉

young knoll
#

Intercept the outgoing packet telling them they died maybe? Idk

misty current
#

oh yea that's a good idea too

#

i'll try

#

thanks

#

would they be in a state of perma death or something client side if i don't tell the client the player respawned tho?

young knoll
#

Probably

#

But the respawn method should to that

misty current
#

a yea will try

#

thanks

mortal hare
#

playing minecraft on bedrock feels like you're having lots of latency issues

young knoll
#

I don’t understand how

#

They basically got the chance to give minecraft the recode it needed

sullen marlin
#

bedrock is incredibly poorly coded

#
  • the fact that its c++ means poor code = crash
sleek pond
#

PlayerDeathEvent.getDrops() is a mutable list, right?

sullen marlin
#

I feel like it is mutable, what do the docs say

sleek pond
#

nothign

young knoll
#

Pretty sure it is

mortal hare
#

well C++ is great language for performance, its just that the code is not that great

young knoll
#

I mean even java isn’t that bad

sleek pond
opal juniper
sullen marlin
#

java is great lol

young knoll
#

At least java has an excuse, 11 years of code from several different devs

mortal hare
#

Java is as nearly performant as C/C++ because of the JIT

#

it works like magic

young knoll
#

But bedrock doesn’t have that excuse, because it was made from scratch afaik

eternal oxide
#

I've worked in a lot of languages and Java would be my top one, with Pascal second.

mortal hare
young knoll
#

True

#

I like that bedrock connects all these platforms

#

And from what I know it has some neat customization tools

#

But like, that’s about it

sullen marlin
#

they could've ported java to all platforms

#

though the phones would be a bit difficult back then

ivory sleet
#

Some dude on the team probably persuaded them Java runs poorly

sullen marlin
#

but the consoles would've been ez pz

young knoll
#

Impossible, only 3 billion devices run java

mortal hare
#

Bedrock is not great, not terrible version, but it really needs some polishing

#

i despise wiggly hands

#

on that version

#

it just looks weird

young knoll
#

They have some good features but are also missing some good features

#

Mojang full parity plz

mortal hare
#

redstone is weird too

young knoll
#

True

mortal hare
#

Mobs that are on fire looks different

mystic sky
young knoll
#

But I want my moveable tile entities, and they want their banners on shields

mortal hare
#

Flying mode is really weird on bedrock too. On Java you have that smooth gliding effect whenever you stop holding WASD buttons, while on bedrock you stop immediately.

arctic moth
#

anyone know why this kinda flickers and any way to fix it?

new BukkitRunnable() {
            @Override
            public void run() {
                for(Player plr : Bukkit.getOnlinePlayers()) {
                    createBoard(plr);
                }
            }
        }.runTaskTimer(this, 5L, 5L);
mortal hare
#

you're creating scoreboard every 5 ticks?

mortal hare
#

if i had to guess

mystic sky
#

Lmao XD

#

Please, i whould run that task firs Async

#

Also 0L, 20L

arctic moth
#

ok

mortal hare
#

can't you just remove objectives

young knoll
#

Also don’t create a new scoreboard each time

mystic sky
#

yeah

mortal hare
#

instead of just creating scoreboard every time

mystic sky
#

creating a board every 5s

#

lmao

#

XD

young knoll
#

Update the prefix and suffix of stuff for a smooth transition

mortal hare
#

that way it wouldnt flicker

mystic sky
#

Good memory leak

ivory sleet
#

Is everything regarding Scoreboard and ScoreboardManager thread safe?

ivory sleet
#

Not a memory leak tho

mystic sky
young knoll
#

The garbage collector will get it

#

Eventually

ivory sleet
#

No memory leak is when garbage collector can’t collect an object even though it is dead with no references to it any longer

mortal hare
#

if i had to guess, no, since NMS has Scoreboard and ScoreboardTeam objects which are mutable

mystic sky
ivory sleet
#

At least without making it externally thread safe

mortal hare
#

well all it does it sends the packet

young knoll
#

Storing a player instance can cause a memory leak can’t it

mortal hare
#

if you don't modify the object

#

its thread safe

young knoll
#

If you don’t remove it on disconnect

mortal hare
#

Yes, since player objects on disconnect are stale

ivory sleet
#

Yeah, well in this high abstraction, god knows when spigot decides to mutate something

mystic sky
young knoll
#

Pretty sure the scoreboard manager will handle it

#

But I could be wrong

mortal hare
#

On newer versions of NMS reflections for packets are useless

mystic sky
#

nNah

mortal hare
#

you can just instanciate it via PacketDataSerializer

mystic sky
# young knoll But I could be wrong

I whould do something like this

    public void removeScoreboard(Player player) {
        SternalBoard board = getBoards().remove(player.getUniqueId());
        if (board != null) {
            board.delete();
        }
    }
mortal hare
#

or via constructor directly

#

without any reflection costs

young knoll
#

Instanciate

mortal hare
#

edited my dear

mystic sky
young knoll
#

Instantiate

mortal hare
#

I took me lots of time to research PacketDataSerializer

#

since there's little to no info on google

#

and methods are obfuscated

arctic moth
#

ok so um what am i supposed to do

#

lol

mortal hare
#

by creating scoreboard every 5 ticks (5/20 second), you're sending packet back to the client, thus why it flickers

#

you need to modify your previous created scoreboard

arctic moth
#

ok

young knoll
#

Even that will flicker

mortal hare
#

really

young knoll
#

Hence why teams and prefix/suffix is used

arctic moth
#

so like return the scoreboard with the create scoreboard and then modify that?

mystic sky
#

By default the NBTCompressedStreamTools on PacketDataSerializer it's of 2MB and no server will use that, doing overflow/books exploits, i whould decrease it to 40000L no way u will use 2MB. At least on 1.8x (U avoid use "anticrash" plugins)

arctic moth
mortal hare
#

saved it

#

for later

#

minecraft's scoreboard is weird

sullen marlin
#

noooo everyone knows you have to use nms and packets for scoreboards

#

<insert rage meme here>

mortal hare
#

so basically objectives are static while teams have some sort dynamicality on GUI?

grave kite
#

Is it possible to import the default nether TravelAgent for spigot 1.12.2? I mean the one being used to create and find portals in the nether and back

sullen marlin
#

wdym

#

it uses the default agent unless you override it

grave kite
#

it demands the TravelAgent from me

sharp bough
#

md5 why dont you have your github profile in your discord?

grave kite
young knoll
#

I wonder what md even has on git

ivory sleet
#

You could simply google it?

sharp bough
#

nvm lmao

ivory sleet
young knoll
#

Md forks all the plugins

sullen marlin
#

generally you shouldnt be doing that

mortal hare
#

maybe he has custom portal implementation

#

and wants to call that event to make integration with plugins easy as 1 2 3

young knoll
#

As simple as do re mi?

mortal hare
#

yesn't

grave kite
# sullen marlin why are you making an event?

I want to instantly move a player on join to a created/found portal. I basically want to split the overworld and the nether to different servers and naturally switch between them

mortal hare
#

Wouldn't Inventory Sync plugin make this possible

grave kite
sullen marlin
#

oh well 1.17 doesnt even have TravelAgent anymore

#

so idk

mortal hare
#

oh

#

nvm

#

it was 1.12.2 question

grave kite
#

on 1.17 it's much better, but I need it to work on 1.12.2

sullen marlin
#

idk, 1.12.2 is too long ago

echo basalt
#

why wouldn't you go 1.13+

sullen marlin
#

CraftTravelAgent.DEFAULT ?

earnest tulip
#

Hey all, so I'm trying to give players with a certain PersistentDataContainer value some effects, such as giving jumpboost2 while the player is sprinting
I've been googling for an hour but can't seem to figure this out

echo basalt
#

loop in a scheduler runnable, check every player, run stuff

young knoll
#

There is a toggle sprint event

#

Or runnables

earnest tulip
#

oh yeah so i just watched a video about tasks and schedules, but i wasntsure if that was the solution to myproblem

grave kite
sullen marlin
#

its not in the api

earnest tulip
#

so should i just run a task every tick to detect the player value? or is there an event or something i could use

#

idk

young knoll
#

A b c, easy as N M S

grave kite
young knoll
worldly ingot
earnest tulip
#

oh thats just one of many things tho

worldly ingot
grave kite
earnest tulip
#

stuff like that

young knoll
#

Then you probably need many events

#

Like the damage event

earnest tulip
#

i dont see an event for detecting player nbt tho

young knoll
#

What do you mean

#

Why do you need to “detect” NBT

earnest tulip
#

I'm using the player's NBT/Persistent Data to give them effects

#

and buffs

grave kite
young knoll
#

You’ll need to check the pdc in the various events

#

Damage event for armor, etc

earnest tulip
#

oh?

#

wait so i have to check it every time the player damages an entity?

young knoll
#

If you want swords to be stronger or something, yes

earnest tulip
#

i see

#

ill give it a shot, thank you

west oxide
mortal hare
#

if that's not sarcastic question which I didn't get it, its practically yes. Its your repository where you can edit the source code of the software

left swift
#

where can I find the SynchedEntityData class? it throws it out to me as an exception, and I do not see it in the files some time.

Caused by: java.lang.IllegalArgumentException: Duplicate id value for 15! at net.minecraft.network.syncher.SynchedEntityData.define(SynchedEntityData.java:90) ~[app:?]```
west oxide
#

is it possible to fork a plugin that's not open source ?

young knoll
#

No

mortal hare
#

yesn't

young knoll
#

I mean, you can decompile it and then edit that

#

But I wouldn’t call that a fork

west oxide
#

i wanna do it with strike practice plugin

#

i want to fix some things

#

which is 1 reason why am learning to code plugins

mortal hare
#

well if you don't publish the plugin

#

its ok

west oxide
#

i wont

#

i just need it for my network practiice server

mortal hare
#

its morally ok to edit software to fix bugs

left swift
# echo basalt What you trying to do?

Fix that exception :/

Caused by: java.lang.IllegalArgumentException: Duplicate id value for 15!
        at net.minecraft.network.syncher.SynchedEntityData.define(SynchedEntityData.java:90) ~[app:?]
        at pl.tuso.xentitydev.entities.type.EntityDev.initDatawatcher(EntityDev.java:98) ~[xEntityDev-2021-11-18 22.46.jar:?]
        at net.minecraft.world.entity.Entity.<init>(Entity.java:508) ~[patched_1.17.1.jar:git-Paper-386]
        at net.minecraft.world.entity.LivingEntity.<init>(LivingEntity.java:281) ~[app:?]
        at net.minecraft.world.entity.Mob.<init>(Mob.java:131) ~[app:?]
        at net.minecraft.world.entity.PathfinderMob.<init>(PathfinderMob.java:19) ~[app:?]
        at pl.tuso.xentitydev.entities.type.EntityDev.<init>(EntityDev.java:64) ~[xEntityDev-2021-11-18 22.46.jar:?]
        at pl.tuso.xentitydev.entities.Snail.<init>(Snail.java:22) ~[xEntityDev-2021-11-18 22.46.jar:?]
        at pl.tuso.xentitydev.events.DevCommand.onCommand(DevCommand.java:25) ~[xEntityDev-2021-11-18 22.46.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.17.1.jar:git-Paper-386]
        ... 21 more```I get it at
```java
    @Override
    protected void initDatawatcher() {
        super.initDatawatcher();
        this.Y.register(dA, (byte)0);
        this.Y.register(dB, vA);
        this.Y.register(dC, vB);
        this.Y.register(dD, vC);
        this.Y.register(dE, vD);
        this.Y.register(dF, vE);
        this.Y.register(dG, vF);
    }```
young knoll
#

tell that to the people who make a tos saying you can’t decompile

grave kite
left swift
young knoll
#

Because their code is clearly top quality and very lucrative to steal

west oxide
mortal hare
#

it sometimes illegal to decompile software, especially rerelease them on shelves with patches

west oxide
#

decompiling works well ?

grave kite
mortal hare
#

well spigot and paper are kinda doing naughty stuff behind the buildtools and paperclip

west oxide
#

someone once told me its not very good

west oxide
young knoll
#

They are patching the vanilla server jar

#

Not exactly naughty, it’s quite common

mortal hare
#

still it modifies bytecode of .class files

#

but that's legal

#

since the server is downloaded from mojang servers

#

while patches are going out straight from repos

young knoll
#

Yep

mortal hare
#

this thing exists only due to DMCA of craftbukkit drama

mortal hare
young knoll
#

Not really

mortal hare
#

you need to correct some places to make it work

young knoll
#

Re-hosting the minecraft server has never been allowed afaik

west oxide
mortal hare
#

depends on the plugin

west oxide
#

oh ok

#

what's a good decompiler ?

young knoll
#

Also depends if they tried to obfuscate it

mortal hare
#

fernflower

#

if you want something simple

#

use jd-gui

#

fernflower is included inside intellij idea

west oxide
#

ohh

mortal hare
#

you can just plop the jar file inside your project libraries

#

and it'll allow you to decompile .class files that are in that jar file

west oxide
#

well

#

time to fix the strikepractice

#

i wont republish it

#

also

#

it costs 100+$

young knoll
#

It costs what now

west oxide
mortal hare
#

hmm

#

is that a mod

young knoll
#

Find me the dev

#

I have an ocean to toss them into

west oxide
#

plugin

#

lol

mortal hare
#

how he have been able to modify tab background color

west oxide
#

could be client ?

young knoll
#

Pretty sure that part is a mod

#

Or resource pack

west oxide
#

yeah

west oxide
young knoll
#

They said IntelliJ

#

So... maybe

west oxide
#

idk him much but i think his friends with most of bs staff i think

#

but not sure

mortal hare
#

JD-GUI is a standalone Java GUI application

young knoll
#

Bytecode viewer is another option

lavish hemlock
#

Fernflower is baked into IDEA tho, seeing as JB were the ones who made it.

#

There is a mirror that separates the two tho.

mortal hare
#

yea

lavish hemlock
#

Fernflower is a very good decompiler tho.

young knoll
#

Fern flower be bad for NMS

#

In my experience anyway

lavish hemlock
#

I have it in my crows :)

#

also

#

use crow

#

it's cool

#

I made it

#

shameless plug

west oxide
lavish hemlock
young knoll
#

Ma-crow

#

Boooo get off the stage

grave kite
grave kite
lavish hemlock
#

So ye mainly a Windows thing.

ivory sleet
#

That’s neat

proud basin
#

how can I find out the minecraft server version?

lavish hemlock
#

I believe Bukkit has a method for it.

proud basin
#

through another jar btw

lavish hemlock
#

...you mean one running independently of the Minecraft JVM?

opal juniper
#

yes he does

lavish hemlock
#

the fuck

#

uhhh well

proud basin
#

yea

worldly ingot
#

Check the manifest file

#

iirc version and git hash is in it

proud basin
#

without doing that Choco

worldly ingot
#

? then how do you expect to get it? lol

proud basin
#

with some magic code

lavish hemlock
#

you could send the version from a plugin on the server through a socket/RMI to your external jar

worldly ingot
#

Going to wish it into existence?

opal juniper
#

craftbukkit package is still named with the version right?

worldly ingot
#

Yes

opal juniper
#

so use that ig then

lavish hemlock
#

if you don't wanna use a plugin on the server, have fun figuring out process memory 👋

proud basin
#

huh

lavish hemlock
#

or ye you can also use the craftbukkit package

proud basin
#

Is it located in org/bukkit/craftbukkit?

lavish hemlock
#

I think so

worldly ingot
#

or the manifest PES_CryHands which literally has the version in it

opal juniper
#

yea

worldly ingot
#

It's practically a text file

lavish hemlock
#

^ and it wouldn't be hard to read the manifest either

#

java.util.jar.Manifest

proud basin
#

more effort

lavish hemlock
#

...not at all

#

it would be more effort not to use the manifest/package

young knoll
#

Use reflection to check for the existence of various classes to single in on a version

#

Best method

sullen marlin
#

isnt there like uh Bukkit.getVersion

lavish hemlock
#

yeah

#

that doesn't return just Minecraft version tho afaik

#

but it contains Minecraft version

sullen marlin
#

you shouldnt ever need to know the mc version

#

everyone wants to make plugins into mods 😦

worldly ingot
#

through another jar btw

sullen marlin
#

the whole point of plugins is to not need updating every MC version

young knoll
#

NMS modules

worldly ingot
#

Doesn't want to use a plugin

lavish hemlock
young knoll
#

😮

west oxide
#

is this even something special ?

sullen marlin
#

so uh improve the API?

lavish hemlock
proud basin
#

fix it felix

lavish hemlock
#

I can imagine it's literally just a kill entities thing lmao

sullen marlin
#

the best irony is that server owners complain to developers each release to update their plugins

#

why dont they complain to authors to code their plugins to not need updates

#

or is that too big brain

young knoll
#

Developers don’t want to wait for PRs to be accepted

sullen marlin
#

no that's putting the cart before the horse

proud basin
#

wait are you not able to use a hashmap in FileSystems#newFileSystem?

lavish hemlock
#

I think you are

#

also why do you need a ZipFileSystem for your jar reading?

#

it's generally slower

#

except when replacing shit ig

#

cuz without a ZipFS then replacing requires you to rewrite every jar entry through java.util.jar (which, until Java 9 or so, used native methods bc of zlib)

quaint mantle
#

so, do HEX colours just not work in components?

lavish hemlock
#

They should in newer versions.

#

1.16+ I believe.

quaint mantle
#

odd

lavish hemlock
#

What kind of components btw?

#

Adventure or Bungee API?

quaint mantle
#

TextComponent

quaint mantle
sullen marlin
#

are you putting legacy colour codes inside components?

#

dont do that, use .color

quaint mantle
#

im using ChatColor.of(Color)

#

Java.awt.color

#

i think its java.awt.Color actually,

sullen marlin
#

post your full code

quaint mantle
#

do keep in mind im new to TextComponents)

#

its really just on the Hover part that i can notice it

lavish hemlock
#

b l u r p l e

quaint mantle
#

actually, lemme just

sullen marlin
#

because your concating legacy text into the hover

quaint mantle
#

oh shit

sullen marlin
#

you need to use TextComponent.fromLegacyText to convert it

quaint mantle
#

ahhhh

sullen marlin
#

or build it with components rather than strings

#

and have List<BaseComponent> roles instead

quaint mantle
#

👍

#

so this should work better, in theory?

sullen marlin
#

yes

quaint mantle
#

coolio

quaint mantle
lavish hemlock
#

fuckers removed it with their redesign

#

now it's just a meh blue

buoyant viper
ember estuary
#

Is there any way to control where a Nether Portal spawns? (i know there is a PortalCreateEvent, but it only gives you List<BlockState>, meaning you cant change the block position)

ember estuary
#

How do I get the ID (-1, 0, 1, -999) of the Worlds Dimension?

#

getId() is deprecated, but whats the alternative/new way to get it?

hollow cliff
#

I have a plugin that when blocks are broken or placed they give xp, how can i make it so if a block was placed, that block when broken wont give xp?

#

please ping me if you know

sullen marlin
#

why do you need it?

lavish hemlock
#

so people can't farm the same block over and over

waxen plinth
lavish hemlock
#

oh

waxen plinth
#

Though with PDC you can only do this for tile entities

#

And most blocks that drop xp are not tile entities

eternal oxide
waxen plinth
#

Chunks have PDC? I did not know that

hollow cliff
#

what does pdc stand for

eternal oxide
#

?pdc

hollow cliff
#

ah ok

hollow cliff
eternal oxide
#

each chunk has its own pdc

#

when a block is broken, you store that x/y/z in the relevant pdc

#

you are markign locations that have had a block broken

#

you can do the same for block place

#

So when a block is placed you add its x/y/z to teh pdc and it will not give xp when broken

hollow cliff
#

alr ill see what i can do ty

golden turret
#

hello. i need to get who placed the items in the brewing stand

#

basically i want to give him xp

proud basin
#

I have never touched maven before how the hell do I shade?

quaint mantle
#

?google

undone axleBOT
ember estuary
golden turret
#

no

#

you can spam clicks

ember estuary
#

i dont think that breaks anything

#

just get which slot was "clicked", and if theres now an item in it.
Save last player who put something in, maybe using the brewing stands position. Maybe HashMap<Position, Player>.
And in the brewevent get position and look up last player

#

should work, or not?

sharp bough
#

how does it look like

ember estuary
#

Hex: #7289DA
RGB: 114, 137, 218
Thats what it looks like

#

its light blue basically

#

What causes this error?

[02:13:10 ERROR]: The embedded resource 'config.yml' cannot be found in plugins..-1.0.jar initializing ..v1.0 (Is it up to date?)

#

I run saveDefaultConfig(); in onLoad

proud basin
#

Hey uh im getting Plugin 'org.apache.maven.plugins:maven-shade-plugin:3.2.0' not found (Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.1:shade (default-cli) on project ww: Failed to create shaded artifact, project main artifact does not exist.
)

ember estuary
#

so i dont get why it doesnt exist

#

ok so google says i need a config.yml in my plugins jar
Where does it have to be? in source.main.resources ? or at the topmost level? or at the level my code files are at?

young knoll
#

Same level as plugin.yml

ember estuary
#

Ok, resources in my case

#

ty

neon kestrel
#

I'm currently in the process of making a MC server in C#. When implementing the final bits of the MOTD, I've found that the Chat object supports fonts. The fonts it supports is the uniform (unicode font), alt (Enchanting table) and default. Now, the discovery I've found is that the font works on the MOTD. Since I'm currently in the process of making a legacy string parser for the Chat object, I was wondering what symbol should be used to set the font? Since color/formatting codes come after §, I don't want to use any of those. §# is used to show that a Hex code is coming up (even though it's not natively supported by the client). I was thinking that §@1-9 should be used to set the font. Thoughts?

quaint mantle
#

font?

#

what do you mean?

#

those \u0001?

neon kestrel
#

Let me see if I can send a screenshot

#

But I do mean a literal font

quaint mantle
#

it will convert into a font later

neon kestrel
quaint mantle
#

and it still depends on the resource pack ngl, some servers use font to make custom emoji, faces, etc...

neon kestrel
#

Through using a font property, I was able to set the text to the enchanting table font

#

(1.16+ only obviously)

ember estuary
#

does WorldSaveEvent get called on a normal server stop?
or does the plugin already get disabled before that?

young knoll
#

Test it with a sysout

ember estuary
#

cant rn, hoped maybe someone just knows

#

How can i run something every second?

#

BukkitScheduler only accepts ticks, which i assume rely on server performance

#

so if my server is 10 tps instead of 20 tps, it will only run once every 2 seconds, which is not what i want

#

is there a spigot way?
or do i need to use ScheduledExecutorService / Timer

proud basin
#

If the player DeltaXZ is greater than 0 does that mean they are going at a suspicious speed?

ember estuary
#

How do I send a string to a players actionbar?

#

player.spigot().sendMessage(ChatMessageType.ACTION_BAR, ...) is deprecated

sullen marlin
#

no its not

rigid drum
#

@ember estuary yeah executor service would work, iirc so would an async task.. but either way you need to sync back up

ember estuary
# sullen marlin no its not

oh, i thought i was looking at the spigot docs, but it were the paper docs. the "player.spigot" irritated me. my bad

ember estuary
#

ill use executer service then, thank you

proud basin
#

D is just a double float right?

sullen marlin
#

Yes

proud basin
#

am I doing my math right

#

if someone has speed 2 and is sprinting they would be going 0.21 right?

young knoll
#

I mean that would be the value of their movement speed

#

Not blocks/s or anything

proud basin
#

what do you mean not blocks?

young knoll
#

"Speed of movement in some unknown metric. The mob's maximum speed in blocks/second is a bit over 43 times this value"

proud basin
#

then im not sure what im doing wrong

gray crypt
#

I'm not sure if this is the proper way to use EventHandlers, but I'm trying to use an event listener in another class to do some logic.

So I have this listener:

public class PlayerPortalEnterEvent implements Listener {

    @EventHandler
    public boolean onPlayerPortalEnter(EntityPortalEnterEvent event, Portal portal) {
        Location[] portalBlocks = portal.getPortalBlocks();
        Location portalLowerLocation = portalBlocks[0];
        Location portalUpperLocation = portalBlocks[1];
        if (portalLowerLocation == event.getLocation() || portalUpperLocation == event.getLocation()) {
            return true;
        } else {
            return false;
        }
    }
}

And in another class I want to be able to do something like this:

if (PlayerPortalEnterEvent.onPlayerPortalEnter(portal) = true) {
//do stuff
} else {
continue;
}
#

Is this possible?

quick turtle
#

Make them return void

gray crypt
#

Alright
And if I need to use that logic in another class (when a command is ran)
Should I do something differently?

quick turtle
#

You should only have the event as the parameter as well

quick turtle
gray crypt
#

Could I potentially make a custom event and then listen to that within a command?

quick turtle
quick turtle
quick turtle
gray crypt
#

That logic is generally just psuedo code

#

To get my intention across

#

Yeah true on the XY problem, let me back up.
I am creating a teleportation plugin, but it uses small portals (using end gateway blocks) to teleport the player.
When the player runs for instance the /tp command it creates a portal which lasts for let's say 10 seconds

What I need to do is when the player enters the portal, run my teleportation logic (already have it)

#

I can't necessarily put my teleportation logic into the EventHandler because the destination is handled by the /tp command

#

So my plan was to create the portal within the command, and before the portal is deleted (in 10 seconds) listen to the event and teleport the player if need be (if the player enters the portal)

quick turtle
#

Store the location in a HashMap possibly, or create an object for the portal that stores all the data needed.

gray crypt
#

Yeah I guess that makes the most sense

candid plover
#

Is it possible to cache multiple places in a hashmap using a class?

#

For example, to cache a player I pull information from a class

#

However there can only be one player per hashmap, I would like to do the same with the houses, but how do I put several houses for one player?

young knoll
#

Use a mutlimap

#

Or create a class that holds a list of locations

#

And then map to that

waxen plinth
#

Map<K, List<V>>

young knoll
#

World.spawn and mob caps

#

That works too, but a multimap looks nicer :p

waxen plinth
#

Dedicated multimap classes are for cowards

#

People too afraid to use IdentityHashMapMap<Map<Player, Collection<UUID>>, Vector<Map<PriorityQueue<Integer>, BiFunction<Player, String, List<Map<? extends ? extends Object, TreeSet<Long>>>>>>>

sullen marlin
#

Please add that to join message++ or whatever the thing is

#

DeluxeAsyncJoinMessage

waxen plinth
#

FastAsyncDeluxeJoinMessagesUUID

candid plover
waxen plinth
#

Also I'd imagine you want a Map<UUID, Map<String, LBHome>>

#

So that you can get homes by name per player

candid plover
#

yes

candid plover
waxen plinth
#

You're storing x, y, z, pitch, yaw (but not world for some reason?)

#

Just store a Location instead

#

It already stores all those things

candid plover
#

is good?

quaint mantle
waxen plinth
#

What library is that from

quaint mantle
#

Guava

candid plover
#

how to select name?

#

i`m confused

waxen plinth
#

I don't get why you keep sending screenshots of code instead of code

#

And that's not enough code for us to know what you're talking about

candid plover
#

oh shit

#

private static final Map<UUID, Map<String, LBHomes>> homesCache = new HashMap<>();

#

this is my cached hashmap

#

How do I get houses by name?

waxen plinth
#

You'd need to get it by UUID and name

candid plover
#

cache.get(uuid, name) ?