var scriptName = "DamagePlayer";
var scriptAuthor = "Bury";
var scriptVersion = 1.0;//u can use it to make DamageFly for China Hypixel
var C04PacketPlayerPosition = Java.type('net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition');
var MathHelper = Java.type('net.minecraft.util.MathHelper');
function DMGPlayer(DMG) {
	if(DMG < 1) {
		DMG = 1;
	}
	if (DMG > MathHelper.floor_double(mc.thePlayer.getMaxHealth())) {
		DMG = MathHelper.floor_double(mc.thePlayer.getMaxHealth());
	}
	var offset = 0.0625;
	if (mc.thePlayer != null || mc.getNetHandler() != null) {
		for(var i = 0; i <= ((3 + DMG) / offset); i++) { 
		    mc.getNetHandler().addToSendQueue(new C04PacketPlayerPosition(mc.thePlayer.posX,mc.thePlayer.posY + offset, mc.thePlayer.posZ, false));
		    mc.getNetHandler().addToSendQueue(new C04PacketPlayerPosition(mc.thePlayer.posX,mc.thePlayer.posY, mc.thePlayer.posZ, (i == ((3 + DMG) / offset))));
		}
	}
}
function DamagePlayer() {
	var Damage = value.createInteger("Damage",1.0,1.0,20.0);
    this.getName = function() {
        return "DamagePlayer";
    }
    this.getDescription = function() {
        return "DamagePlayer";
    }
    this.getCategory = function() {
        return "Misc"; 
    }
    this.onEnable = function() {
		DMGPlayer(Damage.get());
    }
	
	this.onUpdate = function() {
		commandManager.executeCommand(".t DamagePlayer");
	}
    this.addValues = function(event) {
        event.add(Damage);
	}
}

var damagePlayer = new DamagePlayer();
var Client;

function onLoad() {
	
}

function onEnable() {
    Client = moduleManager.registerModule(damagePlayer);
}

function onDisable() {
    moduleManager.unregisterModule(Client);
}