Updated C2SKeyPress class.
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
package com.micle.loginprotection.network;
|
||||
|
||||
import com.micle.loginprotection.LoginProtection;
|
||||
import com.micle.loginprotection.setup.Config;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
|
||||
@ -25,10 +28,25 @@ public class C2SKeyPress {
|
||||
if (LoginProtection.protected_players.getPlayer(sender.getUUID()) == null) { return; }
|
||||
if (!LoginProtection.protected_players.getPlayer(sender.getUUID()).isLoading()) { return; }
|
||||
|
||||
LoginProtection.protected_players.getPlayer(sender.getUUID()).setLoading(false);
|
||||
sender.sendMessage(new StringTextComponent("Grace Period started!"), sender.getUUID());
|
||||
if (!Config.POST_GRACE_ENABLED.get()) {
|
||||
LoginProtection.protected_players.removePlayer(sender.getUUID());
|
||||
} else {
|
||||
LoginProtection.protected_players.getPlayer(sender.getUUID()).setLoading(false);
|
||||
sender.sendMessage(new StringTextComponent("Grace Period started!"), sender.getUUID());
|
||||
}
|
||||
if (sender.isInWater()) {
|
||||
sender.setAirSupply(sender.getMaxAirSupply());
|
||||
if (Config.POST_DROWN_ENABLED.get()) {
|
||||
sender.setAirSupply(sender.getMaxAirSupply());
|
||||
}
|
||||
if (Config.POST_WATER_ENABLED.get()) {
|
||||
sender.addEffect(new EffectInstance(Effects.WATER_BREATHING, Config.POST_WATER_DURATION.get()*20, 0));
|
||||
}
|
||||
}
|
||||
if (sender.isInLava() && Config.POST_LAVA_ENABLED.get()) {
|
||||
sender.addEffect(new EffectInstance(Effects.FIRE_RESISTANCE, Config.POST_LAVA_DURATION.get()*20, 0));
|
||||
}
|
||||
if (sender.isOnFire() && Config.POST_FIRE_ENABLED.get()) {
|
||||
sender.addEffect(new EffectInstance(Effects.FIRE_RESISTANCE, Config.POST_FIRE_DURATION.get()*20, 0));
|
||||
}
|
||||
});
|
||||
context.setPacketHandled(true);
|
||||
|
||||
Reference in New Issue
Block a user