Skip to content
Permalink
Browse files
Added pattack_cooldown().
  • Loading branch information
Lildirt committed Oct 17, 2020
1 parent f5ecef5 commit 3942d27
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
@@ -42,4 +42,6 @@ public interface MCHumanEntity extends MCInventoryHolder, MCLivingEntity, MCAnim

void setCooldown(MCMaterial material, int ticks);
//boolean setWindowProperty(MCInventoryView.Property prop, int value);

float getAttackCooldown();
}
@@ -93,6 +93,11 @@ public void setCooldown(MCMaterial material, int ticks) {
he.setCooldown((Material) material.getHandle(), ticks);
}

@Override
public float getAttackCooldown() {
return he.getAttackCooldown();
}

@Override
public MCInventoryView openInventory(MCInventory inventory) {
return new BukkitMCInventoryView(he.openInventory((Inventory) inventory.getHandle()));
@@ -7,6 +7,7 @@
import com.laytonsmith.abstraction.MCCommandSender;
import com.laytonsmith.abstraction.MCConsoleCommandSender;
import com.laytonsmith.abstraction.MCEntity;
import com.laytonsmith.abstraction.MCHumanEntity;
import com.laytonsmith.abstraction.MCItemStack;
import com.laytonsmith.abstraction.MCLocation;
import com.laytonsmith.abstraction.MCOfflinePlayer;
@@ -5560,6 +5561,54 @@ public MSVersion since() {

}

@api(environments = {CommandHelperEnvironment.class})
public static class pattack_cooldown extends AbstractFunction {

@Override
public Class<? extends CREThrowable>[] thrown() {
return new Class[] { CREPlayerOfflineException.class };
}

@Override
public boolean isRestricted() {
return true;
}

@Override
public Boolean runAsync() {
return false;
}

@Override
public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException {
MCHumanEntity he = (args.length == 0)
? env.getEnv(CommandHelperEnvironment.class).GetPlayer() : Static.GetPlayer(args[0], t);
return new CDouble(he.getAttackCooldown(), t);
}

@Override
public String getName() {
return "pattack_cooldown";
}

@Override
public Integer[] numArgs() {
return new Integer[]{0, 1};
}

@Override
public String docs() {
return "double {[player]} Gets the charge value of the player's attack cooldown. This is a "
+ " double with range 0.0-1.0 inclusive. 1.0 is fully charged, while 0.0 is no charge.";
}

@Override
public MSVersion since() {
return MSVersion.V3_3_4;
}

}

@api(environments = {CommandHelperEnvironment.class})
public static class get_plist_header extends AbstractFunction {

0 comments on commit 3942d27

Please sign in to comment.