mffs/src/main/java/mffs/item/module/interdiction/ItemModuleWarn.java

28 lines
920 B
Java
Raw Normal View History

2022-10-28 16:20:12 +02:00
package mffs.item.module.interdiction;
2023-01-08 16:58:21 +01:00
import mffs.api.security.IInterdictionMatrix;
import net.minecraft.entity.EntityLivingBase;
2022-10-28 16:20:12 +02:00
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
2023-01-08 16:58:21 +01:00
public class ItemModuleWarn extends ItemModuleInterdictionMatrix {
2022-10-28 16:20:12 +02:00
public ItemModuleWarn() {
super("moduleWarn");
}
2023-01-08 16:58:21 +01:00
2022-10-28 16:20:12 +02:00
@Override
2023-01-08 16:58:21 +01:00
public boolean onDefend(
final IInterdictionMatrix interdictionMatrix, final EntityLivingBase entityLiving
) {
2022-10-28 16:20:12 +02:00
final boolean hasPermission = false;
if (!hasPermission && entityLiving instanceof EntityPlayer) {
2023-01-08 16:58:21 +01:00
((EntityPlayer) entityLiving)
.addChatMessage(new ChatComponentText(
"[" + interdictionMatrix.getInventoryName()
+ "] Leave this zone immediately. You have no right to enter."
));
2022-10-28 16:20:12 +02:00
}
return false;
}
}