本文整理汇总了Java中cn.nukkit.metadata.MetadataValue类的典型用法代码示例。如果您正苦于以下问题:Java MetadataValue类的具体用法?Java MetadataValue怎么用?Java MetadataValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetadataValue类属于cn.nukkit.metadata包,在下文中一共展示了MetadataValue类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBigBoom
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBigBoom(ExplosionPrimeEvent event) {
Entity entity = event.getEntity();
Location location = NukkitUtil.getLocation(entity);
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
final Plot finalPlot = area.getOwnedPlot(location);
if (!entity.hasMetadata("plot")) {
entity.setMetadata("plot", new MetadataValue((Plugin) PS.get().IMP) {
private Plot plot = finalPlot;
@Override
public Object value() {
return plot;
}
@Override
public void invalidate() {
plot = null;
}
});
}
}
示例2: getMetadata
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
@Override
public List<MetadataValue> getMetadata(String metadataKey) throws Exception {
if (this.getLevel() != null) {
return this.getLevel().getBlockMetadata().getMetadata(this, metadataKey);
}
return null;
}
示例3: onEntityFall
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onEntityFall(EntityBlockChangeEvent event) {
Entity entity = event.getEntity();
Location location = NukkitUtil.getLocation(entity);
if (!PS.get().hasPlotArea(location.getWorld())) {
return;
}
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Block from = event.getFrom();
Block to = event.getTo();
final Plot finalPlot = area.getOwnedPlotAbs(location);
boolean toBlock = from == null || from.getId() == 0;
if (toBlock) {
List<MetadataValue> meta = entity.getMetadata("plot");
if (meta.isEmpty()) {
return;
}
Plot origin = (Plot) meta.get(0).value();
if (origin != null && !origin.equals(finalPlot)) {
kill(entity, event);
}
} else {
entity.setMetadata("plot", new MetadataValue((Plugin) PS.get().IMP) {
private Plot plot = finalPlot;
@Override
public Object value() {
return plot;
}
@Override
public void invalidate() {
plot = null;
}
});
}
}
示例4: setMetadata
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
@Override
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
this.server.getEntityMetadata().setMetadata(this, metadataKey, newMetadataValue);
}
示例5: getMetadata
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
@Override
public List<MetadataValue> getMetadata(String metadataKey) {
return this.server.getEntityMetadata().getMetadata(this, metadataKey);
}
示例6: setMetadata
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
@Override
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) throws Exception {
this.server.getLevelMetadata().setMetadata(this, metadataKey, newMetadataValue);
}
示例7: getMetadata
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
@Override
public List<MetadataValue> getMetadata(String metadataKey) throws Exception {
return this.server.getLevelMetadata().getMetadata(this, metadataKey);
}
示例8: setMetadata
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
@Override
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) throws Exception {
if (this.getLevel() != null) {
this.getLevel().getBlockMetadata().setMetadata(this, metadataKey, newMetadataValue);
}
}
示例9: setMetadata
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
@Override
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
this.server.getPlayerMetadata().setMetadata(this, metadataKey, newMetadataValue);
}
示例10: getMetadata
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
@Override
public List<MetadataValue> getMetadata(String metadataKey) {
return this.server.getPlayerMetadata().getMetadata(this, metadataKey);
}
示例11: setMetadata
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
this.server.getPlayerMetadata().setMetadata(this, metadataKey, newMetadataValue);
}
示例12: getMetadata
import cn.nukkit.metadata.MetadataValue; //导入依赖的package包/类
public List<MetadataValue> getMetadata(String metadataKey) {
return this.server.getPlayerMetadata().getMetadata(this, metadataKey);
}