summaryrefslogtreecommitdiff
path: root/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryDeath.java
blob: 9563aa2db873ce8122f3fdb2af66541d6032752c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package jp.plusplus.fbs.event.wish.entry;

import jp.plusplus.fbs.event.wish.WishHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.util.StatCollector;

import java.util.regex.Pattern;

/**
 * Created by plusplus_F on 2016/03/31.
 */
public class WishEntryDeath implements IWishEntry {
    @Override
    public float priority() {
        return 1.f;
    }

    @Override
    public boolean matches(String string) {
        return Pattern.compile(StatCollector.translateToLocal("wish.fbs.death.regex"), Pattern.CASE_INSENSITIVE).matcher(string).matches();
    }

    @Override
    public ItemStack get(EntityPlayer player, String string) {
        player.addChatComponentMessage(new ChatComponentText(WishHandler.getGetMessage("death")));
        player.attackEntityFrom(DamageSource.generic, 99999);
        player.setDead();
        return null;
    }
}