summaryrefslogtreecommitdiff
path: root/src/main/java/jp/plusplus/fbs/event/wish/entry/WishEntryHealth.java
blob: a299a45c7ac11f0ff41533a05b0f2da1de05e01d (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
34
35
package jp.plusplus.fbs.event.wish.entry;

import jp.plusplus.fbs.FBS;
import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
import jp.plusplus.fbs.event.wish.WishHandler;
import jp.plusplus.fbs.mod.ForSS2;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.StatCollector;

import java.util.regex.Pattern;

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

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

    @Override
    public ItemStack get(EntityPlayer player, String string) {
        player.addChatComponentMessage(new ChatComponentText(WishHandler.getGetMessage("health")));
        player.heal(100);
        player.getFoodStats().addStats(20,1);
        return null;
    }
}