#help-development

1 messages ยท Page 1852 of 1

jagged monolith
#

Well it's ArmorStand

dark arrow
#

yah

#

i think its cuz of british english

jagged monolith
#

org.bukkit.entity.ArmorStand

dark arrow
#

yah thx

dark arrow
#

how to set items in off hand in armor stand?

young knoll
#

getEquipment

#

From there it should be easy to find the method

dark arrow
#

ok

#

thx

gentle oriole
#

How do I get plugin from class Main?

young knoll
#

Plugin is just a variable name

gentle oriole
#

how do I get the instance of the plugin

young knoll
#

Inside your main class this will refer to your plugin instance

gentle oriole
young knoll
#

Idk

#

I canโ€™t answer that without seeing it

gentle oriole
#

and return instance instead

young knoll
#

Iโ€™m going to guess itโ€™s a static method

#

this does not work in a static context

gentle oriole
#

oh yes

#

I'm always confused about static. What does static even do?

jagged monolith
#

ahh static... the beginners fav keyword

#

If you're implementing dependency injection, you don't really need to use static at all.

gentle oriole
#

ah I get it, If code is a mess, use static to make it work ๐Ÿ‘

jagged monolith
#

That's a bad mindset to have

young knoll
#

Lol

#

Just make everything static

gentle oriole
#

YES

young knoll
#

Object oriented? Never heard of it

quaint mantle
#

imagine dont say that coll ๐Ÿ™‚

gentle oriole
#

How do I find out if player is in death screen or no

#

I'm having deaths over deaths

young knoll
#

isAlive() mayhaps?

gentle oriole
#

How do I make a method that runs every second without stopping the server?

quaint mantle
#

runtasktimer

#

or what idk

#

i didnt look at bukkit javadocs these d ays

gentle oriole
#

is there an event that fires every tick?

mighty sparrow
#

?jd

gentle oriole
mighty sparrow
#

I find it simple

gentle oriole
#

cant filter searches

mighty sparrow
#

Ctrl f

gentle oriole
#

ctrl f overrated

mighty sparrow
#

Go in discord server search and type every tick

gentle oriole
#

is there a jd page that displays EVERYTHING

mighty sparrow
#

I dont know?

#

Try looking at bukkit jd

gentle oriole
#

bukkit has a jd?

quaint mantle
#

but you can create it urself

#

pretty easy

#
  1. create event
  2. on enable plugin make a bukkit scheduler or something you want to then call the even every tick
#

if you not using the bukkit sheduler, bukkit runnable then 1 tick = 0.05 second

torn badge
#

Just use a Scheduler

#

Why do you need to call an event for that

quaint mantle
#

oh

#

yeah

#

๐Ÿ™‚

cinder bone
#

Hey guys! How can I use the SpecialSource plugin in my Gradle projects. I know that Gradle doesn't support Maven plugins, but is there an alternative.

sullen marlin
#

Someone else here just made gradle exec the commands

#

Idk who, search gradle and specialsource

cinder bone
#

Ok thank you very much!

sullen marlin
#

It was @hasty prawn

hasty prawn
#

Yep lol

rough basin
#

Dogo

hasty prawn
#

You can use that task if you wish

rough basin
#

What Should I do if I want to loop this method every 100 ticks?
I read Scheduler Programming wiki, but I didn't understood it

round elbow
#

uhhh how can i send ActionBar to a player in 1.18? can't seem to find anything on the internet related to this topic

round elbow
#

it seems to tell me that the sendMessage() method is deprecated

lost matrix
round elbow
lost matrix
#

You need to get Player.Spigot via
Player#spigot()
And then call Player.Spigot#sendMessage(ChatMessageType, BaseComponent)

round elbow
lost matrix
#

?scheduling

undone axleBOT
jagged monolith
lost matrix
round elbow
#

i didnt hear about that

lost matrix
#

I think you can just call player.sendActionBar(Component.text("Hi"));

sullen marlin
#

This is the spigot server

quaint mantle
#

how do I give and get the value for each player PersistentDataContainer?

lost matrix
lost matrix
lost matrix
quaint mantle
lost matrix
#
    for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
      PersistentDataContainer container = onlinePlayer.getPersistentDataContainer();
      // Do stuff with container
    }
quaint mantle
quaint mantle
#

on, off

#

for players

quaint mantle
lost matrix
quaint mantle
#
NamespacedKey key = new NamespacedKey(this, "key");
            String value = p.getPersistentDataContainer().getOrDefault(key, PersistentDataType.STRING, "off");
            String newvalue = value.equals("on") ? "off" : "on";
            p.getPersistentDataContainer().set(key, PersistentDataType.STRING, newvalue);
            
            if (newvalue.equals("on")) {
                p.sendMessage("On");
            } else {
                p.sendMessage("Off");
            }
quaint mantle
#

But if any player writes a command, the value will change for all players

lost matrix
quaint mantle
#

I need to change the value for 1 player

gentle oriole
quaint mantle
gentle oriole
#

see if player is in config yet? if not create a new ddefault value?

tall dragon
#

instead of a string

gentle oriole
#

does config.addDefault overwrite previously manually overwritten values?

lost matrix
tall dragon
#

thats not a default type?

quaint mantle
tall dragon
#

ah alright

quaint mantle
#

"0:0:0:0"

#

seconds, minutes, hours, days

gentle oriole
lost matrix
quaint mantle
#

no, if restart server

tall dragon
quaint mantle
#

values clear

lost matrix
#

Also you shoul use a single long value for that which represents the time in milliseconds

quaint mantle
#

?

lost matrix
#

Use a long

#

unix time in millis

quaint mantle
lost matrix
lost matrix
quaint mantle
#

will they save the time that the player has played in the pdc?

lost matrix
#

Who is "they"? The pdc is a spigot API feature. Nothing vanilla related is in there.

tall dragon
#

why do you even want to save the playtime of the player

#

if its already done my minecraft

gentle oriole
#
  1. create hashmap
  2. every player that joined first time, put in hashmap start 0
  3. make a loop that increases every online players by a second every second
  4. convert it to d h m s when needed
quaint mantle
gentle oriole
quaint mantle
#
  1. convert it to d h m s when needed
#

what?

gentle oriole
#

store it in seconds because it will be easier to maintain

rough basin
#

Day Hour Minute Second

gentle oriole
#

only convert it when needed

quaint mantle
gentle oriole
#

if it is stored in a file or config no

lost matrix
tall dragon
quaint mantle
gentle oriole
#

pdc?

tall dragon
#

PersistentDataContainer

rough basin
#

What is pdc?

quaint mantle
tall dragon
#

the statistic system stores the ticks played

rough basin
#

oh god

tall dragon
#

all you need to do is convert

gentle oriole
#

yes maybe

gentle oriole
tall dragon
#

why would it reset

quaint mantle
quaint mantle
tall dragon
#
private static String TIME_FORMAT = "%s, %s, %s";

public static String getFormattedTime(long ticks) {
        long seconds = ticks / 20;

        int day = (int) TimeUnit.SECONDS.toDays(seconds);
        long hours = TimeUnit.SECONDS.toHours(seconds) - (day * 24);
        long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
        long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);

        return String.format(TIME_FORMAT, hours, minute, second);
    }
rough basin
#

Dear god

#

They are so kind enough

tall dragon
#

huh?

quaint mantle
#

khm

#

thanks, i will try

#

i'm russian)

rough basin
#

ok finally i can ask my question

lost matrix
rough basin
#

?paste

undone axleBOT
rough basin
#

I want this method to repeat every 20 ticks, continuously passing the sentry to itself.
But what I made seems to make the plugin work after 10 ticks, not run() or detectNearestEntity() .
Why using a 'plugin' here? And how do I just keep repeating the method over and over?

lost matrix
#

There are 2 options:
Either recursively call the method or use the scheduler to run a repeated task

lost matrix
# rough basin Here's full code and it's not main - https://paste.md-5.net/posaxegobi.java

When the server starts:
Wait 40 ticks,
broadcast a message,
then every 20 ticks
broadcast a message

  @Override
  public void onEnable() {
    startRepeatedTask();
  }

  private void startRepeatedTask() {
    long initialDelay = 40L;
    long repeatedDelay = 20L;
    Bukkit.getScheduler().runTaskTimer(this, () -> {
      String msg = "Im being broadcasted.";
      Bukkit.broadcastMessage(msg);
    }, initialDelay, repeatedDelay);
  }
rough basin
#

If that method is used multiple times in several places, won't it conflict with each other?

tall dragon
#

it will just start multiple schedulers

#

and youl end up with multiple broadcasting at different times

turbid crest
#

Does anyone knows the keyboard shortcut in IntelliJ to import the bukkit method (at top of file) instead of just adding it before the string when autocompleting ?

`
#Instead of this (this is when I just hit enter)
public class test implements org.bukkit.event.Listener {}

#I want this
import org.bukkit.event;
public class test implements Listener {}`

lost matrix
#

The same code just more volatile:

  private void startRepeatedTask() {
    long initialDelay = 40L;
    long repeatedDelay = 20L;
    BukkitScheduler bukkitScheduler = Bukkit.getScheduler();
    Runnable runnable = new BroadcastRunnable();
    JavaPlugin plugin = this;
    bukkitScheduler.runTaskTimer(plugin, runnable, initialDelay, repeatedDelay);
  }

With a simple Runnable implementation:

public class BroadcastRunnable implements Runnable {
  @Override
  public void run() {
    Bukkit.broadcastMessage("Im being broadcasted");
  }
}

@rough basin

rough basin
#

it's quite confusing but i will try to understand it myself, Thanks bro

lost matrix
turbid crest
#

Ooooooh yep thanks ๐Ÿ™‚

rough basin
spiral light
lost matrix
#

So the run() method comes from the Runnable interface. Each class that implements Runnable
must implement this method as-is. What you can do is adding a field in your runnable class and using the constructor
to fill it.

lost matrix
# rough basin Is there any way to put values โ€‹โ€‹in run() ? run( LivingEntity entity ) throws an...
  private void startRepeatedTask() {
    String message = "Im being broadcasted";
    long initialDelay = 40L;
    long repeatedDelay = 20L;
    BukkitScheduler bukkitScheduler = Bukkit.getScheduler();
    Runnable runnable = new BroadcastRunnable(message);
    JavaPlugin plugin = this;
    bukkitScheduler.runTaskTimer(plugin, runnable, initialDelay, repeatedDelay);
  }
public class BroadcastRunnable implements Runnable {

  private final String message;

  public BroadcastRunnable(String msg) {
    this.message = msg;
  }

  @Override
  public void run() {
    Bukkit.broadcastMessage(message);
  }

}
lost matrix
#

Or is this more like a boss mob runnable?

rough basin
#

No, I'm working on making some specific snowman loop run().

lost matrix
#

This can lead to memory leaks or performance issues quite fast.
Make sure that you cancel the task as soon as the snowman unloads or dies.

rough basin
#

Thanks bro, I'm thankful that these snowmen won't spawn much lmao

gentle oriole
#

how do I insert a arraylist into config.yml?

lost matrix
lost matrix
lost matrix
gentle oriole
lost matrix
junior briar
#

hi guys, anybody knows how to deserialize a raw message of /tellraw and send it to a player?

junior briar
#

uhm, cuz i need that i think?

lost matrix
#

Spigot has an API for everything you could do with the tellraw command.

spiral light
#

player.sendRawMessage()

junior briar
#

umm, i don't like very much to do that by executing the command.

spiral light
#

what

lost matrix
#

What are you trying to achieve?

junior briar
#

i think there should be api to do that elegantly, i just didn't find it.

lost matrix
#

What are you trying to achieve?

spiral light
junior briar
lost matrix
#

Can you please tell us what you want to do? Why do you need the tellraw format.

junior briar
lost matrix
junior briar
#

better to have a cache for it.

lost matrix
#
    TextComponent message = new TextComponent("Click me");
    message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org"));
    message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Visit the Spigot website!").create()));
junior briar
#

well. i mean can i do this by deserializing?

#

as i said above

spiral light
#

client side .... you cant

#

unless you set velocity all the time up

lost matrix
#

This sounds tricky. Movement is not fully server authoritative so it will look weird either way.

spiral light
#

probably waaaaay to laggy

junior briar
#

because i've coded it, or generated it as a json text.

lost matrix
#

meh teleportation is not that expensive if its within 8 Blocks or so.

junior briar
spiral light
#

spigot/bukkit config or PlayerFoodLevelChangeEvent

lost matrix
#

Several ways. Simplest would be to edit the spigot.yml and increase the amount of food that is being consumed
by healing, running and jumping

spiral light
#

you should take a look at javadocs spigot .... its rly not complicated to modify how much the player looses

junior briar
#

it exists even before /tellraw.

lost matrix
#

Another way would be using a scheduler that just constantly chips away at a players food level

turbid crest
#

Hey ๐Ÿ™‚ Is the onEnable method sync ?

lost matrix
turbid crest
#

Thanks ๐Ÿ™‚

spiral light
#

?paste

undone axleBOT
spiral light
gentle oriole
#

if I add something to my disabled arraylist, does the Module get affected? ArrayList<String> disabled = Modules.disabled;

spiral light
#

yes

gentle oriole
#

how do I make it so it isnt affected

tall dragon
spiral light
#

since its not a copy of the list .... with that you just create a reference

gentle oriole
tall dragon
#

pretty sure this will work

gentle oriole
tall dragon
lost matrix
spiral light
#

not anything ....

gentle oriole
spiral light
#

strings, integers.... all the primitive things copy and not create a refernce

lost matrix
#
    List<String> A = new ArrayList<>();
    List<String> B = A;
    List<String> C = A;
    A.add("Hi");
    
    System.out.println(A.get(0));
    System.out.println(B.get(0));
    System.out.println(C.get(0));

This prints Hi 3 times.
then new keyword creates a new Object in memory.
Then = sign lets a variable point to an Object in memory.
You can have arbitrarily many variables point to the same Object.

tall dragon
#

actually @lost matrix i have a question for you, does this work the same when storing objects in a hashmap for example

#

for example if i save A in 2 different hashmaps

gentle oriole
#

do I have to make another class if I want to make another command?

#

or I can just have a Commands class and have it all there

tall dragon
lost matrix
spiral light
gentle oriole
#

how do I make it so only ops can access my command

spiral light
#

player.isOp ?

gentle oriole
#

how abt console

spiral light
#

console is op all the time ? xd

gentle oriole
#

oh i thought it would have a separate more powerful method

#

what does @Override do?

tall dragon
#

allows you to override a method from its superclass

spiral light
#

replace the method of the superclass with your method

gentle oriole
#

i am confused.

tall dragon
#
public abstract class Animal 
{
    
    protected String getName()
    {
        return "Animal";
    }
    
}


public class Cow extends Animal
{

    @Override
    protected String getName() {
        return "Cow";
    }
}

#

for example ^

spiral light
#

all the time that specific examples O.o

tall dragon
#

since its a cow object and i have overidden the getName method to return cow instead of Animal

gentle oriole
#

thanks, but im still confused, ill try to understand it later

ivory sleet
gentle oriole
ivory sleet
#

Wym by separate?

gentle oriole
#

like there is no parent/child

#

all of them classes in one folder

visual tide
#

abstraction = good (normally)

ivory sleet
#

then override wonโ€™t be attachable there

#

Like the only good thing about @Override is that it checks at compile time that you do in fact override some parent methods

gentle oriole
#

can override override a Final method?

ivory sleet
#

but it has not other functionality, mostly speaking annotations do not altho some libraries use them for actual code behavior but that is not the case for java

#

nope

#

you cannot extend a final class and you cannot override a final method and you cannot reassign a final variable

lavish wave
#

How does Minecraft's Names/Customnames system work?
(Please explain and do not send source code)

spiral light
#

do you mean entity.setCustomName ?

lavish wave
#

From a Player

spiral light
#

player=entity

lavish wave
#

I mean CustomName and Name

ivory sleet
#

Custom name is just something for plugins iirc

#

Like changing it wonโ€™t inherently change anything virtually

lavish wave
#

And what about Displayname?

ivory sleet
#

Think itโ€™d change the visual name

lavish wave
ivory sleet
#

If I remember correctly

#

Or recall

gentle oriole
#

how do I put a ArrayList into the config?

lost matrix
#

Just throw it in

gentle oriole
#

throw it in?

lost matrix
#
    FileConfiguration configuration = ...;
    List<String> someList = List.of("E1", "E2", "E3");
    configuration.set("SomeKey", someList);
gentle oriole
#

now how do I get it

#

there is no getArrayList

lost matrix
#

For a List of Strings its simply

    FileConfiguration configuration = ...;
    List<String> someList = configuration.getStringList("SomeKey");
gentle oriole
#

is it called ArrayList or StringList?

lost matrix
#

What does your "it" refer to?

gentle oriole
#

what's the difference of the two?

lost matrix
#

For once StringList does not exist as a type...

tall dragon
#

uh, well StringList is just method name to get an Arraylist of strings

lost matrix
gentle oriole
#

aight thanks.

lost matrix
#

We simply get a List

tall dragon
#

ah yea thats true

gentle oriole
#

I cant write to my config. It says it's null

next fossil
#

How would I be able to create a DataWatcher in 1.18 with the new Mojang Mappings? This what I have so far:

// Extra Textures for Skin
            DataWatcher watcher = npc.getDataWatcher();
            byte bytes = (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40);
            watcher.set(DataWatcherRegistry.a.a(17), b);```
#

I can import the DataWatcher objects and all but it keeps throwing the "Cannot Find Symbol" error at me

spiral light
#

bytes and b?

lost matrix
#

LivingEntity#getEntityData()

gentle oriole
#

How do I save config?

lost matrix
#

FileConfiguration#save(File)

gentle oriole
#

what do I put in File?

lost matrix
#

are you using the default config?

gentle oriole
#

custom

#

or default

#

how do I tell them apart?

lost matrix
#

Do you load the config via JavaPlugin#getConfig()

gentle oriole
#

yes

lost matrix
#

then you are using the default config setup.

gentle oriole
#

what is the default config

lost matrix
#

Simply call JavaPlugin#saveConfig() after chaning it

gentle oriole
#

are there contents?

lost matrix
gentle oriole
#

then how abt custom

next fossil
#

How do you initialise a ServerPlayer?

#
ServerPlayer npc = new ServerPlayer(((CraftServer) Bukkit.getServer()).getServer(),
                    ((ServerLevel) player.getWorld().getHandle()), gameprofile);
#

The ServerLevel keeps messing up

lost matrix
#

"keeps messing up" in terms of what

lost matrix
next fossil
#

Like it doesn't properly initialise from the Player World's getHandle() method

#

This what I have so far..

            // Create CraftPlayer
            ServerPlayer craftPlayer = (ServerPlayer) ((CraftEntity) player).getHandle();

            // NPC Skin
            Property textures = (Property) craftPlayer.getGameProfile().getProperties().get("textures").toArray()[0];
            GameProfile gameprofile = new GameProfile(UUID.randomUUID(),
                    ChatColor.translateAlternateColorCodes('&', displayName));
            gameprofile.getProperties().put("textures",
                    new Property("textures", textures.getValue(), textures.getSignature()));

            // Spawn NPC
            ServerPlayer npc = new ServerPlayer(((CraftServer) Bukkit.getServer()).getServer(),
                    ((ServerLevel) player.getWorld().getHandle()), gameprofile);

            // Extra Textures for Skin
            SynchedEntityData sed = npc.getEntityData();
            byte bytes = (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40);
            watcher.set(DataWatcherRegistry.a.a(17), b);

            // Set Position
            npc.setPos(x, y, z);

            Connection connection = ((CraftPlayer) player).getHandle().connection;
            connection.send(new ClientboundPlayerInfoPacket(Action.ADD_PLAYER, npc));
            connection.send(new ClientboundAddPlayerPacket(npc));
            connection.send(new ClientboundSetEntityDataPacket(((Entity) npc).getId(), ((Entity) npc).getEntityData(), true));
            connection.send(new ClientboundRotateHeadPacket(npc, (byte) (npc.getBukkitYaw() * (256 / 360))));
spiral light
#

yeah... well your getHandle is wrong

spiral light
#

and the Extra Textures would be:
SynchedEntityData sed = npc.getEntityData();
byte bytes = (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40);
sed.set(SynchedEntityData.defineId(net.minecraft.world.entity.player.Player.class, EntityDataSerializers.BYTE), bytes);

gentle oriole
#

how do I put a string in .java into plugin.yml

spiral light
gentle oriole
#

I want it similar to /gamerule

#

but with disable/enable

#

I want to put ("playerPunchedAir", "playerTooHigh", "playerBreakTooSlow", "playerAteTooMuch", "playerOverworked", "playerSlipped", "playerTookDamage", "playerTooHealthy") but it is currently a StringArray

spiral light
#

in your plugin.yml ???

gentle oriole
gentle oriole
spiral light
#

and why do you ask smth about .java ?

gentle oriole
#

I could format it so it would be separated of | instead of commas, and surround it in []

spiral light
#

just set
usage: /<cmd?> playerPunchedAir/playerTooHigh/playerSlipped ....

gentle oriole
gentle oriole
#

something like '${project.version}'

lavish wave
#

How is the event named, that will be triggerd, if I write something in the chat?

spiral light
#

uhmmm i dont think this is possible to write it automaticle in the plugin-.yml

gentle oriole
#

unless...

#

I make a new plugin.yml

#

is that possible?

chrome beacon
#

Just don't

gentle oriole
#

k

chrome beacon
#

Make the command say the usage message rather than messing with the plugin.yml

gentle oriole
#

how will the users know what to type?

#

ah so if there is no args[1] in the command send them the list

chrome beacon
#

You can tell them?

spiral light
#

the arguments should be always the same - so dont try to do smth complicated with your skill level -> just time waste

summer scroll
#

For example, you have a command /eco give (player) (amount), If the args length is below 3, send an usage message.

gentle oriole
#
        System.out.println("Nulling run");
        System.out.println("<"+args[0]+">");
        if (args[0] == "LIST") {
            System.out.println("Usage run");
            sender.sendMessage("Usage: /" + command.getName() + " [enable|disable|list] " + modules);
            return false;
        }
        System.out.println("Wrong arg run");

Any idea why Usage run didnt fire?

#

args[0] is typeof string

gleaming grove
#

@gentle oriole Try if(args[0].equalsIgnoreCase("LIST"))

spiral light
#

you cant compare a String with a String with just "==" ... you will need to use equals or equalsIgnoreCase

gentle oriole
#

Ooh

eternal oxide
#

== is only true if they are the exact same object in memory, just not comparatively equal.

eternal oxide
#

yes

gentle oriole
#

Oh.

eternal oxide
#

So two strings set to the same value will not be == but will be .equals

gentle oriole
#

I understood. Is java only one doing this?

eternal oxide
#

Depends, C++ is all pointers so can;t really be compared

spiral light
#

no

gentle oriole
#

It literally makes no sense...

#

Since when did you need to compare values from the same memory address

eternal oxide
#

Since always

gentle oriole
#

How

grim ice
eternal oxide
#

== is an instance check

#

.equals is an object comparison

gentle oriole
#

Why not do it the other way round to make it simpler

#

Is because java isn't a scripting language?

eternal oxide
#

? Why not have True mean False

eternal oxide
hybrid spoke
#

strings with the same value internally are

eternal oxide
#
String one = "Test";
String two = "Test";```
#

should fail on ==

ivory sleet
#

Probably not

#

Itโ€™s not unlikely the compiler might infer them to the same object

hybrid spoke
eternal oxide
ivory sleet
#

Well I said might because itโ€™s probably not the case in older versions

#

But newer ones would definitely do some of these string optimizations at compile time

hybrid spoke
#

you can also force it with the intern() method

eternal oxide
#

Best example I can find, not to use == java class Teststringcomparison3{ public static void main(String args[]){ String s1="Sachin"; String s2="Sachin"; String s3=new String("Sachin"); System.out.println(s1==s2);//true (because both refer to same instance) System.out.println(s1==s3);//false(because s3 refers to instance created in nonpool) } }

#

Which only gets worse on older java

gentle oriole
eternal oxide
#

in that example, yes

#

its in an object pool

gentle oriole
#

What happens if you change one of them then changed it back

eternal oxide
#

you change both

gentle oriole
#

Both????

eternal oxide
#

from what I'm seeing

gentle oriole
#

Why both?

eternal oxide
#

or

#

perhaps not

#

I don;t have an ide up, it may just reassign if changed

gentle oriole
#

@hybrid spoke do you have an ide up?

eternal oxide
#

I don;t know the byte code under the hood

#

easy to test though

#

ok, it reassigns

glossy venture
#

i dont think it works with values entered at runtime

eternal oxide
#

so changing the value of s2 it no longer references the same object as s1

next robin
#

Hi, in spigot-api 1.18.1 i can't use GameProfile like 1.16

#

how i can fix that ?

ivory sleet
eternal oxide
ivory sleet
#

But yes itโ€™s a very dumb assumption as it is clearly stated that string is a value based class thus any == comparisons are likely to yield an unintentional result unless you do as cipher and at runtime invoke intern to get or add if absent to the internal string pool

rough basin
#

?paste

undone axleBOT
next robin
rough basin
#

What I'm making is that the snowman fires an arrow every 30 ticks.
But in luncharrow.shootToEntity(), Basically line 45 - isDead() works normally,
but in run(), isDead() does not working normally. Is there a way to fix this damn problem and kill the Task?

There's Full code - https://paste.md-5.net/exemiriqok.java

cold field
#

Is there an API method to send an action bar message?

spiral light
turbid crest
#

Hey ๐Ÿ™‚ What is most efficient between a JSON object and a Java Object ?

tender shard
#

in 1.17 and earlier, are explosions in the nether generalle stronger?

#

e.g. when I create an explosion with power 4 in 1.17 nether, it deals twice the damage as an explosion with power 4 in the overworld

spiral light
#

the blockstrength of netherrack is just low(er)

tender shard
#

I am talking about the player damage only

#

my explosions don't do any block damage ๐Ÿ™‚

spiral light
#

could be a bug.... you should test it in survival world too

cold field
next robin
#

anyone can help me ?

burnt current
#

Hey quick question: I am currently programming that players can claim chunks through my plugin by placing a specific item in the chunk. This will then store the id of the chunk (chunkX + "." + chunkY) under the person's name in a MySQL data table. Now, however, for certain scenarios, e.g. if the chunk has been claimed by another player or you have claimed it yourself before, I wanted to have the player always send a message regarding this and wrote the following lines of code for this:

if(MySQLMethods.getPlayernameByChunkid(chunkID) == null) {
                MySQLMethoden.addChunkId(player, chunkID);
                player.sendMessage("You have claimed this area with the id " + chunkID);
            } else if(MySQLMethods.getPlayernameByChunkid(chunkID).equals(player.getName())) {
                player.sendMessage("You have already claimed this area");
                return;
            } else {
                player.sendMessage("This area was already claimed by another player");
                return;
            }

The getPlayernameByChunkid method searches the database for which player this chunkid was stored under, based on the given chunkid.
My problem now is that the code right after the first if query is never executed. Even if no player was saved under this chunk. So the plugin doesn't seem to identify an empty table row as null. Does anyone maybe know how I can do this correctly?

eternal oxide
#

Don't use Player names, they can change

young knoll
#

TranslatableComponent iirc

minor wren
#
login to "{@token}" with the name "{@bot}"

it says cant understand this event
idk why it dont work because it worked some time ago on another server but now it dont work

spiral light
young knoll
#

Skript

minor wren
spiral light
#

"Serious Spigot and BungeeCord programming/development help | Ask other questions here"

#

isnt skripting something of a plugin ?

minor wren
#

yea? there is no room to skript so i figured i could use this

young knoll
#

This is the wrong server for skript

#

Go to their server

minor wren
#

it is... its spigotMC's plugin i need help to understand

keen lantern
#

Does anyone know the placeholderapi?

young knoll
#

They have their own discord

minor wren
#

okay sry

young knoll
#

Pretty much no one here uses skript

burnt current
balmy osprey
#

Hey someone know how to fix NMS i saw the Message from md_5 for remapping but it dident worked (i am using MacOS)

spiral light
balmy osprey
#

Cannot resolve org.spigotmcspigot1.18.1-R0.1-SNAPSHOT

#

I am using Maven pom.xml

balmy osprey
quaint mantle
#

run buildtools for 1.18.1

spiral light
#

so how does your pom looks like ?

spiral light
#

do you want to use 1.18.1 or 1.18 ?

balmy osprey
balmy osprey
spiral light
#

then this is already wrong

quaint mantle
#

You did --rev 1.18.1?

balmy osprey
spiral light
#

replace 1.18 with 1.18.1

#

and look at Skeagle's posts

balmy osprey
#

R0.1-SNAPSHOT??

spiral light
#

this is my for 1.18.1

hallow lion
#

How would i register a CommandExecutor without a command?
Essentially this:
getCommand("name").setExecutor(new CommandExecutorImplementation);
but without the getCommand.

spiral light
#

you cant

#

if you want to add commands without adding them to the plugin.yml you should take a look at PlayerCommandPreprocessEvent

misty current
hallow lion
#

no

balmy osprey
#

java -jar BuildTools.jar --rev 1.18.1 --remapped

#

??

#

like this

lost matrix
hallow lion
#

I just need one commandexecutor to be registered but i need it to fire whenever any command is ran.
the only way i can think of is using the preprocess event.

quartz ferry
#

can someone help me with spigot plugins? I am trying to add featherboard but it is not showing up when I do /pl it doesnt even turn red plus it doesnt make a folder in the pl folder it stays as a jar

balmy osprey
quartz ferry
spiral light
buoyant viper
#

yeah not sure why the guy told u to come here

balmy osprey
#

PacketPlayOutPlayerInfo

#

is this removed from api?

spiral light
#

its not the api -.-

quaint mantle
#

If you're using remapped the names are changed

spiral light
#

PacketPlayOutPlayerInfo is NMS and since you wanted to use remapped version you now have the mojang names for that

balmy osprey
#

u know the Mojang name ?xD

spiral light
#

ClientboundPlayerInfoPacket

balmy osprey
#

I sending Packets changed too?

spiral light
#

not rly

#

but EntityPlayer is now ServerPlayer iirc

balmy osprey
#

public static void sendPacket(Packet<?> packet) {
for(Player all : Bukkit.getOnlinePlayers()){
((CraftPlayer)all).getHandle().playerConnection.sendPacket(packet);
}
}

#

.playerconnection dont work

spiral light
#

see image above ^^

#

its not playerconnection... its connection now

balmy osprey
#

soooo wierd xD

spiral light
#

you can take a look at my tool to translate your stuff back to mojang names - once the site is full loaded you can use the searchbar at the top left
https://timcloud.ddns.net/mapping

balmy osprey
#
public static void rmTab(CraftPlayer cp){
        ClientboundPlayerInfoPacket packet = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, cp.getHandle());
        sendPacket(packet);
    }

    public static void sendPacket(Packet<?> packet) {
        for(Player all : Bukkit.getOnlinePlayers()){
            ((CraftPlayer)all).getHandle().connection.send(packet);
        }
    }

    public static void addTab(CraftPlayer cp){
        ClientboundPlayerInfoPacket packet = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, cp.getHandle());
        sendPacket(packet);
    }
}```
#

is this right?

worldly ingot
#

Basically, forget all knowledge of existing mappings. They're probably not the same anymore

#

Though pretty much all of what you're doing here can be done with API

#

Player#showPlayer() and Player#hidePlayer()

spiral light
worldly ingot
#

Oh it's fake players

#

That snippet there alone just looks like it's hiding existing players

spiral light
#

i think so .,.. because otherwise there is the api xD

misty current
#

is there a way to dynamically start up multiple servers from a single template on different ports?

rough basin
#

My EntityDamageEvent spawns 10,000 threads in one attack.
i have no idea What is going on my code now

foggy estuary
#

?paste

undone axleBOT
spiral light
balmy osprey
#

PacketPlayOutTitle

#

i do not found this one

worldly ingot
misty current
#

yea i'm aware

#

i was wondering if there were any programs that could help me

#

or any open source projects

rough basin
spiral light
worldly ingot
#

Relevant code would be helpful ;p

foggy estuary
misty current
#

but i haven't found much

worldly ingot
#
  1. There's no way you unironically space your code like that
  2. Bukkit#getOfflinePlayer() is going to absolutely kill your server
misty current
#

i saw someone talking about docker

worldly ingot
#

You can just use strings. I'm pretty sure that #getScore(OfflinePlayer) is deprecated in favour of #getScore(String) anyways

foggy estuary
#

i see

#

I will try now.

rough basin
worldly ingot
#

Your BroadcastRunnable, which is a task timer, is spawning other task timers in its run method

#

Line 37

rough basin
#

dear god

worldly ingot
rough basin
#

i thought it just returns some numbers

pliant tundra
#

how can i make player skulls stackable
i have a command that gives skulls in stacks, but i would like to be able to stack them if they have the same owner

misty current
#

i wanted to try out the concept but i'm not even sure if spigot allows multiple instances of itself to be launched at the same time

rough basin
#

Is there a way for a thread to get its own taskID?

spiral light
spiral light
buoyant viper
worldly ingot
#

You're cancelling with the task id but there is a better way to go about that. You have the choice of either accepting a BukkitTask instance in your constructor, or extending BukkitRunnable instead of Runnable

#

I'd honestly opt for the constructor route

misty current
#

the best idea that came to my mind is having a template, copying it using the File class, changing the port in properties and starting the bash file

worldly ingot
#
    public static class BroadcastRunnable implements Runnable {

        private final BukkitTask task;

        public BroadcastRunnable(BukkitTask task, LivingEntity entity) {
            this.task = task;
            // etc.
        }

        // etc.

    }```
```java
Bukkit.getScheduler().runTaskTimer(plugin, task -> new BroadcastRunnable(task, entity), 0L, 20L);```
misty current
#

but it's probably a pretty bad idea

worldly ingot
#

Then you can call this.task.cancel(); to stop it

worldly ingot
#

Alternatively if you extend BukkitRunnable instead of Runnable, it itself carries a cancel() method. Can just invoke this.cancel() or super.cancel(), whichever you prefer

#

Which isn't a bad solution tbh. Might be better to do that given that you're already passing in other information into your constructor anyways

#

But at this point you can almost avoid int ids entirely for schedulers. They're pretty old

spiral light
#

isnt BukkitRunnable depricated for some reason ?

balmy osprey
#

PacketPlayOutChat

#

is it now ClientboundChatPacket

#

I am searching for IChatBaseComponent as well

spiral light
balmy osprey
#

CraftPlayer p = (CraftPlayer)player;
IChatBaseComponent cbc = IChatBaseComponent.ChatSerializer.a("{"text": "" + message + ""}");
PacketPlayOutChat ppoc = new PacketPlayOutChat(cbc, (byte)2);
p.getHandle().connection.send(ppoc);
}
}

#

for a action bat

#

bar*

spiral light
#

and the problem is ???

balmy osprey
#

PacketPlayOutChat is not givin

#

ClientboundChatPacket is this the Mojang one

spiral light
#

well you litterly wrote that

#

PacketPlayOutChat is also Mojang - but a different name

worldly ingot
#

BR isn't deprecated, but its scheduling methods are because you should be scheduling those with itself, not through the scheduler

balmy osprey
#

and wat is with IChatBaseComponent

worldly ingot
#
new YourBukkitRunnable().runTaskTimer(plugin, 0, 20);
// vs... deprecated
Bukkit.getScheduler().runTaskTimer(plugin, new YourBukkitRunnable(), 0, 20);```
spiral light
balmy osprey
#

No lol

spiral light
#

Component component = Component.Serializer.fromJson("Hello World");

#

where Component is nm.network.chat

balmy osprey
#

Component cbc = Component.Serializer.fromJson("{"text": "" + message + ""}");

rough basin
#

new BukkitTask?

worldly ingot
#

See that same message you quoted ;p

lapis lark
#

Anyone know how to build BungeeCord fork? I am using IntelliJ command package on BungeeCord-Parent and get only net.md_5.bungee package without libraries. Maybe it is a stupid question, but anyway i am kinda new in Maven

rough basin
worldly ingot
#

Yeah the scheduler accepts a Consumer<BukkitTask>

hushed pawn
#

public void onPlace(BlockPlaceEvent e){
Bukkit.getScheduler().scheduleSynkDelayedTask(this, () -> {/do something/}, 100L);
}
How should i get "plugin"? "this" doesn't work

balmy osprey
#

PacketPlayOutTitle PacketPlayOutPlayerListHeaderFooter i also searched on the internet

rough basin
#

take it from main and keep it static?

#

i did it like this

spiral light
# rough basin

well you can use the Constructor of the Class directly .... then it doesnt need to be static and its more smooth

rough basin
#

hmm

balmy osprey
#

cannot access net.minecraft.network.protocol.Packet

lapis lark
balmy osprey
spiral light
#

did you rerun maven ?

balmy osprey
#

yes

spiral light
#

?paste can you send your pom ?

undone axleBOT
spiral light
#

^^

balmy osprey
#

But i found everything on coding

spiral light
#

did you run buildtools remapped ?

balmy osprey
#

i did java -jar BuildTools.jar --rev 1.18.1 --remapped

#

Success! Everything completed successfully. Copying final .jar files now.
Copying spigot-1.18.1-R0.1-SNAPSHOT-bootstrap.jar to /Users/sebastian.zaengler/./spigot-1.18.1.jar

  • Saved as ./spigot-1.18.1.jar
spiral light
#

compared to my pom it looks like the same ^^

spiral light
balmy osprey
#

yes thats all

spiral light
#

while running maven install ?

balmy osprey
#

Yes and package

spiral light
#

then probably @ivory sleet can help by pinging someone else who knows more about remapping system with maven and 1.18.1

rough basin
#

Ok i solved the goddamn 10000 tasks, but seems any task is invoking now

#

I tested with message so bug must in Task

#

does some find what's wrong with it?

#

any Task seems working now

lavish hemlock
eternal needle
#

hi i have a /stuck command on my server but i don't now how i can let the player have face doraction the same way now i am facing the same way every time

spiral light
#

still not good but a lot easier then canceling task and creating new ones all the time

lavish hemlock
#

and also not using a static method to initialize your class would be good

snow stratus
#

Having problems using the remapped jar from BuildTools to use NMS.

            <groupId>spigot</groupId>
            <artifactId>server</artifactId>
            <version>1</version>
            <scope>system</scope>
            <systemPath>G:\Spigot\Spigot\Spigot-Server\target\spigot-1.18.1-R0.1-SNAPSHOT-remapped-mojang.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.18.1-R0.1-SNAPSHOT</version>
            <classifier>remapped-mojang</classifier>
            <scope>provided</scope>
        </dependency>

I have these dependencies, but it's still not letting me access NMS.
Any ideas?

eternal needle
#

if someone think they can help if they see the code say it i can send the code

spiral light
snow stratus
spiral light
#

what type ?

snow stratus
#

StructureGenerator.m

spiral light
eternal needle
spiral light
#

you probably missed that remapped means a new "naming"-system ?

snow stratus
#

I'm creating bounding boxes for those structures, definitely not API

spiral light
spiral light
eternal needle
spiral light
snow stratus
spiral light
#

but if you want to use remapped mojang version you need to rename almost every nms stuff

snow stratus
#

but I was getting this error:
The type com.mojang.serialization.Codec cannot be resolved. It is indirectly referenced from required .class files

When I tried it without using the remapped mojang

#

Any idea how to fix that without using remapped mojang then?

spiral light
#

well, replace remapped-mojang in your maven ^^

snow stratus
#

replace it with?

spiral light
#

try to remove the line completly

snow stratus
#

Sorry, that's the error I get without any remapped-mojang in my dependency

spiral light
#

never used maven with not remapped mojang since its too easy with real method-names

snow stratus
#

so I tried switching to remapped-mojang to attempt to fix it

spiral light
snow stratus
#

so I added it in, still had no luck, and came here

spiral light
#

i dont know where this error comes from... does it refer to a specific class / line ?

snow stratus
#

Nope, that's all it gives me

#

It only appears when I have StructureGenerator.m

#

because something in there depends on Codec

spiral light
#

StructureGenerator.m = OCEAN_MONUMENT ?

snow stratus
#

yeah

lavish hemlock
#

I believe you need to import datafixerupper

snow stratus
#

How do I do that?

snow stratus
lavish hemlock
#

hm

#

unfortunate

snow stratus
#

I'm perfectly fine with porting this over to remapped-mojang if someone knows what all of these classes/methods would be called

lavish hemlock
#

what mappings does remapped-mojang use?

spiral light
#

made an tool for exactly that - if you wait for the site to load you can use the search box top-left

lavish hemlock
#

mojmap?

buoyant viper
spiral light
#

broken ?

#

define it

snow stratus
spiral light
#

yes

vernal marsh
#

Hallo i found this thread and i just need help with that. But did not answer there yet, can someone help me here

https://www.spigotmc.org/threads/custom-nms-1-18.540050/

lean gull
#

anyone know if it's possible to render certain textures on spesific blocks with a resource pack? so like i wanna have custom blocks with blockstates, but it's very limited - can i maybe have it so if a block is in one location it will render one texture from the resource pack, but if it's in a different location it will render something else?

lean gull
#

i've been told origin realms made a plugin that makes it so noteblocks are usable even though they use noteblocks' blockstates for custom blocks

dense geyser
#

Is there a serializer for serializing text to json form like ComponentSerializer? The first one is the form the text should be in, the second is what ComponentSerializer outputs

[{"text":"greetings","color":"dark_purple","bold":true},{"text":"hello","color":"green","bold":true}]
{"extra":[{"color":"red","text":"Hello"}],"text":""}
ivory sleet
snow stratus
chrome beacon
lean gull
snow stratus
#

@spiral light
Question though, it's fine if you don't know:

Since WorldGenMonumentPieces -> OceanMonumentPieces
any idea what a PillagerOutpost piece would be?

spiral light
#

one of them probably

#

1.18 recreated a lot / renamed a lot or rebuilded the system a lot ... very hard to know what they did sometimes

lavish hemlock
#

WorldGenFeaturePillagerOutpostPieces?

burnt current
snow stratus
chrome beacon
#

Are you looking for PillagerOutpostFeature?

#

Okay just checked the PillagerOutpost does not have it's own piece

snow stratus
#

I'm just going to keep it as an OceanMonumentPiece and see what happens since that's what the original guide was doing

chrome beacon
#

Are you generating structures?

snow stratus
#

No, setting bouding boxes so vanilla mobs spawn naturally where I want them to

chrome beacon
#

ah

spiral light
buoyant viper
lavish hemlock
#

lmao

#

or Gradle

#

NamedDomainObjectContainer

buoyant viper
#

true

#

there was some ungodly class name i remember seeing in my gradle error log

lavish hemlock
#

at least Minecraft doesn't use a DI framework

#

and dynamic compilation

buoyant viper
#

found it

#

JumpToApplicationThreadServerStreamListener

unreal quartz
#

the industrial revolution and its consequences

snow stratus
#

Since this is my first time using the mappings, what jar are we supposed to distribute after compile?

-remapped.jar
or -remapped-obf.jar

spiral light
#

obf

#

not

snow stratus
#

what do you mean by not?

#

not the obf?

spiral light
#

yes

snow stratus
#

so distribute the -remapped.jar

eternal oxide
#

When choosing to use the 'Mojang Mappings', it is absolutely imperative that you are aware of the conditions attached to them as well as the Mojang EULA. These are not restrictions you can simply ignore. In particular you may only 'use the mappings for development purposes'. This means that you must only use the remapped-mojang jar for development and must remap your plugin prior to distribution.

manic furnace
#

When i publish a plugin, which i made in intelij with maven, do I have to list all libraries in a NOTICE.txt? Because in maven, there are many libraries that are downloaded

misty current
#

But you can use noteblocks depending on the state, since they have a lot for custom block textures

buoyant viper
#

can u publish ur source code if its using remapped-mojang or

chrome beacon
#

You can

chrome beacon
chrome beacon
spiral light
chrome beacon
#

Do you want your own strucuture or spawn a vanilla one?

spiral light
#

vanilla one... but i cant find where those stuff was init.

chrome beacon
#

They're in the StrucutureFeature class

lean gull
chrome beacon
#

The only reason I know all of this is because a few days ago I decided to dig through how structure generation works for one of my mods

chrome beacon
chrome beacon
#

I have no idea what you mean by that

lean gull
#

i want to not render a resource pack texture of a block with a blockstate at certain times and instead render the normal block

chrome beacon
#

Why don't you just open the OriginRealms resourcepack and take a look?

lean gull
#

so like if i have a noteblock that has a blockstate and in my resource pack i set a noteblock with that blockstate to a texture, i want to be able to not render the resource pack's texture and instead render the normal vanilla noteblock texture if a variable or something is set

misty current
#

I am pretty sure some noteblock states are impossible in vanilla, so you can use those

lean gull
misty current
#

Also why don't you look at origin's source

chrome beacon
#

Well duh

chrome beacon
lean gull
chrome beacon
#

No need for it to be

misty current
#

Decompile

lean gull
misty current
#

Or just look at the resourcepack

lean gull
#

i can, but the resource pack is not what's doing that

misty current
#

And see what state they use

lean gull
#

it's the plugin

chrome beacon
#

Open the resoucepack. See what data it uses and mimic that data for when you want your blocks

oblique geyser
#

how can i add text decorations like a underline text to a message?

lean gull
#

that's not what i meant

spiral light
snow stratus
misty current
#

The resourcepack checks for a certain status of a noteblock so look what it is

oblique geyser
#

okey i thought wasnt chat color

#

xDDD

misty current
#

In the resourcepack

lean gull
#

i meant like i want to render a default texture instead of a resourcepack texture if a variable is set with a plugin

oblique geyser
#

tyuwu

lean gull
#

i know how to make custom blocks using blockstates

misty current
#

You can't make a noteblock show a texture you want by setting a variable as you are saying

lean gull
#

no

#

ok i want to use noteblocks' blockstates for my custom blocks, but i also don't want them to render their custom textures i set with the resource pack if a variable is set

chrome beacon
#

BlockStates aren't magic. They're predefined you cannot add your own

lean gull
#

omg

misty current
#

Don't omg

lean gull
#

omg

misty current
#

I have no idea about whatyour are saying

lean gull
#

i explained it like 4 times

chrome beacon
#

^^

misty current
#

You're*

chrome beacon
lean gull
#

origin realms have noteblocks, even though they use their blockstates for textures

chrome beacon
#

Yeah so kill05 said it probably has unused block states. Which you can use

lean gull
#

they did that by not rending certain blocks' textures

chrome beacon
#

Yeah now look in the resource pack to see what data they're using

lean gull
#

fine

misty current
lean gull
#

they literally did it

misty current
#

They can't use "their blockstates" since you can't create them

lean gull
#

"instrument=banjo,note=1,powered=false":{"model":"custom/misc_blocks/crates/crate_2"}

chrome beacon
#

So unused block states

#

Now replicate them

lean gull
#

ohh i know how they did it

#

they probably didn't use like one noteblock texture and then have the noteblocks always set to those blockstates, and instead store the instrument and whatnot in the block data

chrome beacon
#

mhm

misty current
#

mhm

chrome beacon
#

Working with Forge has really helped me understand these things

lean gull
#

so there is no way to not render a resource pack's texture with a plugin?

chrome beacon
#

You can make blocks never have a certain blockstate

#

That's pretty much it

lean gull
#

alr, how do i do that? also how do i make it so their blockstates won't update?

chrome beacon
#

Packets or heavy NMS

lean gull
#

frick

chrome beacon
#

Packets would probably be easiest

lean gull
#

i don't know either

chrome beacon
#

Yeah this is quite advanced you shouldn't do it yet

#

Keep learning basics and come back later

lean gull
#

this is very important for my server though

misty current
#

If you wanna do it the crappy way just cancel right click events on the specific location

lean gull
#

how do i do it in the not crappy way

misty current
lean gull
#

crappy ways are crappy

chrome beacon
#

Hire someone

#

You're not ready for this

misty current
lean gull
#

i want to learn though

misty current
#

Learn what are packets then

#

Plenty tutorials

lean gull
#

you got a good one? i also need one that explains everything

misty current
#

No

#

Google does

lean gull
#

In this episode, I show you how to listen for and create packets using ProtocolLib. I explain what packets are, how to extract and set data in packets, and more. #Spigot #SpigotTutorial

Packet Reference: https://wiki.vg/Protocol
ProtocolLib: https://www.spigotmc.org/resources/protocollib.1997/
Code: https://github.com/Spigot-Plugin-Development...

โ–ถ Play video
chrome beacon
#

It's a decent start to Protocollib

lean gull
#

alright, sounds good

misty current
#

Yeah but if you know what a packet is already and how are they used Just watch the part about the protocol api tutorial

lean gull
#

i don't

misty current
#

Then watch it all

lean gull
#

all i know is that they're like advanced event listeners or whatever

misty current
#

Uhh

#

No

lean gull
#

oh

#

welp i better get to watchin

misty current
#

Watch it all

#

Maybe twice

vale ember
misty current
#

Packets are the most basic form of communication between a server and a client

#

And while you can listen for them they are not listeners

misty current
#

Imo using nms is better and less painful

lean gull
#

should i learn packets first?

misty current
#

But protocollib makes compatibility easier

#

Yeah you should learn what a packet is first

chrome beacon
misty current
#

With less painful i mean you don't have to guess the fields

#

Even if it takes reflection to use nms, i'd rather do that

#

But if it involves obfuscation ehhh

vale ember
#

mojang mappings and abstraction is not that painful

misty current
#

Yea compared to reading protocol wiki

vale ember
#

and packetwrapper also makes better use of protocollib

misty current
#

The wrappers are outdated and if they are wrong good luck finding out what's wrong

vale ember
#

:sad:

misty current
#

Yeh

vale ember
#

๐Ÿ˜ญ

misty current
#

I had to play a lightning bolt with packets to make an animation and protocollib was just making it painful

#

Nms code legit took 3 minutes

lean gull
#

does nms use a library

#

or is it builtin in spigot

misty current
#

Nms stands for net minecraft server

vale ember
#

nms is mojangs code

misty current
#

Its the core code of mc servers

vale ember
#

the actual server written by mojang

misty current
#

So yea it's mojang's code

lean gull
#

so builtin?

misty current
#

Huh

lean gull
#

like i don't have to use a depenency or whatever

misty current
#

I mean it's in the main server jar

vale ember
#

just replace 'spigot-api' with 'spigot' in your pom.xml

misty current
#

He has to use buildtools

#

Since putting it in a maven repo is not very legal

lean gull
#

doing what?

vale ember
#

java -jar BuildTools.jar --rev MC_VERSION

lean gull
#

i have the buildtools' spigot api

misty current
#

Try to import CraftPlayer and see if it finds the class

lean gull
#

how do that

misty current
#

Just start typing craft and see if it lets you autocomplete

lean gull
#

nope

misty current
#

Or press shift 2 times and search for craftplayer

vale ember
#

do you use maven?

lean gull
#

idk i use minecraft development thing

vale ember
#

do you have pom.xml?

lean gull
#

yeh

#

i think it's maven

vale ember
#

replace 'spigot-api' with 'spigot' in it

lean gull
#

honestly i barely know anything about all this

vale ember
#

bad, very bad

lean gull
vale ember
#

it will take spigot from your local maven repo

lean gull
#

@misty current help

vale ember
#

if you at least once built that mc version via BuildTools.jar

misty current
#

Why do you ping me

#

He is helping you

lean gull
#

i need help

#

u said it was illegal

misty current
#

...

lean gull
#

i am confusion

misty current
#

I said that if someone were to upload mojang code in an online maven repo

#

It would be illegal

lean gull
#

what does that mean

misty current
#

Don't mind about it

lean gull
#

ok

misty current
#

Just search on google buildtools spigot

#

And run them for the version you need

lean gull
#

what am i supposed to search

lean gull
misty current
#

Then do what areg told ya

lean gull
#

i'm supposed to import the api.jar not the buildtools.jar right?

misty current
#

Send your pom

#

The part with repos

lean gull
misty current
#

Sorry i meant the dependencies

lean gull
#
    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.18.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>```
misty current
#

Ok

#

See spigot-api?

lean gull
#

yuh

misty current
#

Change it with spigot

lean gull
#

so just remove -api?

misty current
#

Ye

lean gull
#

kk

#

i think i've done this before

misty current
#

Good

#

Does it give you red underline?

lean gull
#

it's downloading or whatever

misty current
#

Resolving dependencies

lean gull
#

ok it's done

misty current
#

Ok now you can use mojang's code

lean gull
#

ok

misty current
#

Now go back to what u were doing and learn packets

lean gull
#

i got craftplayer

misty current
#

Means it works

lean gull
#

nice

#

im gonna go to bed but actually just be on my phone for like an hour

#

i am tired

#

thanks and have a good one!

misty current
#

Np

#

Gn

lean gull
#

ty

candid quail
#

Hey so I'm trying to move away from NMS, I've relied upon it for writing NBT Tags upon a NMS Copy of an item

#

Is there a spigot implementation for writing NBT Data to items or similar, I want to avoid using Object lore as I want to avoid overhead of encoding/decoding invisible strings (they're run asynchronously) but lots of async tasks queued doesn't seem fun

eternal oxide
#

?pdc

candid quail
#

Some of my item choices move outside of the PDC's scope

#

(Sorry should of mentioned, I took a step back while I was waiting for the 1.18 Spigot to enter a release state)

rustic mica
#

Hey there i need some help, i want to create an item that when it is right clicked it would execute some functions i have

#

How would i do that?

candid quail
rustic mica
#

I already know how to create the item and i have created it

#

I tried to do something with the PlayerInteractEvent but no matter what i do nothing gets executed

#

And i have registered the listener class

hasty prawn
proven coral
#

so im guessing thare is no way to use @p with plugins

candid quail
#

@proven coral in what regards?

#

Like to target local player, etc

proven coral
#

i have a man hunt plugin that you need to run as a player and say the player you want the comand to use it wuld be /manhunt hunter sjfdog

#

i want to use a comand block to automate this

#

so nearist player that pushes butten becomes hunter

#

if i put /manhunt hunter @p it thinks @p is a player

rotund prawn
#

can someone hlep me banning players with my plguin?

#

its not doing anything

proven coral
#

do /ban

rotund prawn
#

no but

#

in plugin

proven coral
#

what do you want it to do

rotund prawn
#

i made a bnagui menu

#

wich you click ban

#

it bans the selected player

#

but its not banning the player

young knoll