modifierTag.putDouble("Amount", modifier.getAmount()); modifierTag.putString("Name", modifier.getName()); modifierTag.putInt("Operation", modifier.getOperation().ordinal()); UUID uuid = modifier.getUniqueId(); modifierTag.putLong("UUIDLeast", uuid.getLeastSignificantBits());
modifierTag.getString("Name"), modifierTag.getDouble("Amount"), AttributeModifier.Operation.values()[modifierTag.getInt("Operation")]));
if (parameters.length > 4) { try { operation = AttributeModifier.Operation.valueOf(parameters[4].toUpperCase()); } catch (Exception ex) { player.sendMessage(ChatColor.RED + "Invalid operation: " + parameters[4]);
if (operationType != null && !operationType.isEmpty()) { try { operation = AttributeModifier.Operation.valueOf(operationType.toUpperCase()); } catch (Exception ex) { controller.getLogger().warning("Invalid operation " + operationType + " on entity_attributes." + key + " in mage class " + getKey());
if (CompatibilityUtils.setItemAttribute(newItem, attribute, value, attributeSlot, operation.ordinal())) { if (attributeSlot == null) { attributeSlot = "(All Slots)"; .replace("$value", Double.toString(value)) .replace("$slot", attributeSlot) .replace("$operation", operation.name().toLowerCase())); } else { player.sendMessage(api.getMessages().get("item.attribute_not_added").replace("$attribute", attribute.name()));
@Override public ByteBuf encode(ByteBuf buf, EntityPropertyMessage message) throws IOException { ByteBufUtils.writeVarInt(buf, message.getId()); Map<String, Property> props = message.getProperties(); buf.writeInt(props.size()); for (Entry<String, Property> property : props.entrySet()) { ByteBufUtils.writeUTF8(buf, property.getKey()); buf.writeDouble(property.getValue().getValue()); Collection<AttributeModifier> modifiers = property.getValue().getModifiers(); if (modifiers == null) { ByteBufUtils.writeVarInt(buf, 0); } else { ByteBufUtils.writeVarInt(buf, modifiers.size()); for (AttributeModifier modifier : modifiers) { GlowBufUtils.writeUuid(buf, modifier.getUniqueId()); buf.writeDouble(modifier.getAmount()); buf.writeByte(modifier.getOperation().ordinal()); } } } return buf; } }