Coding support

Lil Putin Baby

U look funny

Status

offline

Posts

286

Likes

2,683

Resources

21

Bits Credits

0

LEVEL

5

1,110 XP

Member suspended from NullForums
WELCOME TO THE CODING SUPPORT THREAD
You can ask others about coding here.
5ff5c8667bd28baa91e9a13bb87335ae.gif

I don't know what to do but who can answers this question get 2 MC PASS:
How to write a code to change the color of a dye when picking up it.


(This thread is not a giveaway, I just want to start a useful thread)
 

MrCMDKiller

Contributor

Status

offline

Posts

38

Likes

2,208

Resources

15

Bits Credits

0

LEVEL

5

1,115 XP

WELCOME TO THE CODING SUPPORT THREAD
You can ask others about coding here.
5ff5c8667bd28baa91e9a13bb87335ae.gif

I don't know what to do but who can answers this question get 2 MC PASS:
How to write a code to change the color of a dye when picking up it.

(This thread is not a giveaway, I just want to start a useful thread)
idk xd
 
Liked by:

Cold

🐍 JUNGLE

Status

offline

Posts

606

Likes

11,368

Resources

352

Bits Credits

0

LEVEL

10

2,875 XP

Idk how to code ):
 
Liked by:

FateKid

DEVIL DID IT

Admin

Status

offline

Posts

14,912

Likes

129,711

Resources

3,394

Bits Credits

481

LEVEL

11

5,910 XP

WELCOME TO THE CODING SUPPORT THREAD
You can ask others about coding here.
5ff5c8667bd28baa91e9a13bb87335ae.gif

I don't know what to do but who can answers this question get 2 MC PASS:
How to write a code to change the color of a dye when picking up it.


(This thread is not a giveaway, I just want to start a useful thread)

Just to clarify:
You'd like a dye item to switch dye types once picked up, correct?
Is just the player going to receive this event on pickup, or other entities as well?

You might want to take a look at the DopItemEvents, along with ItemStackEvent. These contain loads of interesting calls .

https://hub.spigotmc.org/javadocs/s...player/PlayerDropItemEvent.html#getItemDrop()
https://hub.spigotmc.org/javadocs/s...#setItemStack(org.bukkit.inventory.ItemStack)

Example for PlayerDropItem Event
Java:
public void onItemDrop (PlayerDropItemEvent event){ // Fired when a player drops an item
  Item dropedItem = event.getItemDrop(); // Get the item (as an entity) that the player droped
}

I'm still learning Java so don't take my word for it ;), however if you learn to read GIT/JavaDocs, it'll be pretty easy to develop something small for this.
 

Lil Putin Baby

U look funny

Status

offline

Posts

286

Likes

2,683

Resources

21

Bits Credits

0

LEVEL

5

1,110 XP

Member suspended from NullForums
Just to clarify:
You'd like a dye item to switch dye types once picked up, correct?
Is just the player going to receive this event on pickup, or other entities as well?

You might want to take a look at the DopItemEvents, along with ItemStackEvent. These contain loads of interesting calls .

https://hub.spigotmc.org/javadocs/s...player/PlayerDropItemEvent.html#getItemDrop()
https://hub.spigotmc.org/javadocs/s...#setItemStack(org.bukkit.inventory.ItemStack)
how can I give an admin MC PASS? 😂 I will find a better answer.
 

Envoia

Community Champion

Status

offline

Posts

688

Likes

5,828

Bits Credits

195

LEVEL

10

2,465 XP

Here you go :)

Java:
    @Getter
    private List<Material> dyeColors;

    @Override
    public void onEnable() {
        dyeColors = new ArrayList<>();
        for(DyeColor dyeColor : DyeColor.values()) {
            dyeColors.add(Material.getMaterial(dyeColor.toString() + "_DYE"));
        }
        Bukkit.getPluginManager().registerEvents(new PlayerPickupItemListener(this), this);
    }


Java:
    @EventHandler
    public void onPlayerPickupItem(EntityPickupItemEvent event) {
        if(event.getEntity() instanceof Player) {
            Player player = (Player) event.getEntity();
            if(plugin.getDyeColors().contains(event.getItem().getItemStack().getType())) {
                event.getItem().getItemStack().setType(plugin.getDyeColors().get(
                        new Random().nextInt(plugin.getDyeColors().size())));
            }
        }
    }
 

Nullfox

User Suspended

Status

offline

Posts

10

Likes

6

Bits Credits

0

LEVEL

0

0 XP

Member suspended from NullForums
Bruh if i was just at right time yesterday here i could have won mc pass, i know how to code plugins.
 

Lil Putin Baby

U look funny

Status

offline

Posts

286

Likes

2,683

Resources

21

Bits Credits

0

LEVEL

5

1,110 XP

Member suspended from NullForums
tell FateKid to use my account to buy you 2 MC PASS. I am inactive
 

Nullfox

User Suspended

Status

offline

Posts

10

Likes

6

Bits Credits

0

LEVEL

0

0 XP

Member suspended from NullForums
If you need anything to code i will be glad to.
 

FateKid

DEVIL DID IT

Admin

Status

offline

Posts

14,912

Likes

129,711

Resources

3,394

Bits Credits

481

LEVEL

11

5,910 XP

If you need anything to code i will be glad to.
Same here! With the little java I know currently, I'm more than happy to help where I can.
Got HTML/WEB projects that need work? That's where I shine :cool:
 
Liked by:

FateKid

DEVIL DID IT

Admin

Status

offline

Posts

14,912

Likes

129,711

Resources

3,394

Bits Credits

481

LEVEL

11

5,910 XP

WELCOME TO THE CODING SUPPORT THREAD
You can ask others about coding here.
5ff5c8667bd28baa91e9a13bb87335ae.gif

I don't know what to do but who can answers this question get 2 MC PASS:
How to write a code to change the color of a dye when picking up it.


(This thread is not a giveaway, I just want to start a useful thread)

Kirazie created the plugin you're looking for :cool:
 
Liked by:

Lil Putin Baby

U look funny

Status

offline

Posts

286

Likes

2,683

Resources

21

Bits Credits

0

LEVEL

5

1,110 XP

Member suspended from NullForums
Liked by:

Latest threads

Forum statistics

Threads
57,555
Messages
88,460
Members
54,367
Latest member
locozuca
Top Bottom