Skip to content

Instantly share code, notes, and snippets.

@tryb4
Created January 14, 2014 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tryb4/8420899 to your computer and use it in GitHub Desktop.
Save tryb4/8420899 to your computer and use it in GitHub Desktop.
public static void b_applyTag(Block b, String tag, String value, Plugin host)
{
b.setMetadata(tag, new FixedMetadataValue(host, value));
}
public static String b_getTag(Block b, String tag)
{
if (b.getMetadata(tag) != null)
{
for (MetadataValue val : b.getMetadata(tag))
{
return val.asString();
}
}
return "NO_DATA_RECIEVED";
}
public static void b_removeTag(Block b, String tag, Plugin host)
{
if (b.getMetadata(tag) != null)
{
b.removeMetadata(tag, host);
}
}
public static void e_applyTag(Entity e, String tag, String value, Plugin host)
{
e.setMetadata(tag, new FixedMetadataValue(host, value));
}
public static String e_getTag(Entity e, String tag)
{
if (e.getMetadata(tag) != null)
{
for (MetadataValue val : e.getMetadata(tag))
{
return val.asString();
}
}
return "NO_DATA_RECIEVED";
}
public static void e_removeTag(Entity e, String tag, Plugin host)
{
if (e.getMetadata(tag) != null)
{
e.removeMetadata(tag, host);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment