use of net.minecraft.server.v1_15_R1.Block in project Denizen-For-Bukkit by DenizenScript.
the class BlockHelperImpl method ringBell.
@Override
public void ringBell(Bell block) {
org.bukkit.block.data.type.Bell bellData = (org.bukkit.block.data.type.Bell) block.getBlockData();
Direction face = Direction.byName(bellData.getFacing().name());
Direction dir = Direction.NORTH;
switch(bellData.getAttachment()) {
case DOUBLE_WALL:
case SINGLE_WALL:
switch(face) {
case NORTH:
case SOUTH:
dir = Direction.EAST;
break;
}
break;
case FLOOR:
dir = face;
break;
}
CraftBlock craftBlock = (CraftBlock) block.getBlock();
((BellBlock) Blocks.BELL).attemptToRing(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition(), dir);
}
use of net.minecraft.server.v1_15_R1.Block in project solinia3-core by mixxit.
the class EntityUtils method teleportSafely.
public static void teleportSafely(Entity targetEntity, Location targetLoc) {
if (targetEntity == null)
return;
if (targetLoc == null)
return;
final UUID entityUuid = targetEntity.getUniqueId();
final Location loc = targetLoc.clone();
Bukkit.getScheduler().runTask(StateManager.getInstance().getPlugin(), new Runnable() {
@Override
public void run() {
if (StateManager.getInstance().isStopping())
return;
Entity entity = Bukkit.getEntity(entityUuid);
if (entity == null)
return;
// if over 3 chunks, remove any pets
if (entity.getLocation().distance(loc) > 48) {
if (EntityUtils.HasPet(entityUuid)) {
EntityUtils.KillAllPets(entityUuid);
entity.sendMessage(ChatColor.GRAY + "* Your pets have been removed due to teleportation" + ChatColor.RESET);
}
}
if (entity instanceof Player) {
Essentials ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
if (ess != null) {
User user = ess.getUser((Player) entity);
if (user == null)
entity.teleport(loc);
else
try {
user.getTeleport().now(loc, false, TeleportCause.PLUGIN);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
entity.teleport(loc);
}
} else {
entity.teleport(loc);
}
} else {
entity.teleport(loc);
}
}
});
}
use of net.minecraft.server.v1_15_R1.Block in project solinia3-core by mixxit.
the class ItemStackAdapter method generateSpellLoreText.
private static List<String> generateSpellLoreText(ISoliniaItem soliniaItem) {
List<String> loreTxt = new ArrayList<String>();
ISoliniaSpell spell;
try {
spell = StateManager.getInstance().getConfigurationManager().getSpell(soliniaItem.getAbilityid());
if (spell.getEffectid1() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid1()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid1()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue1() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid1()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue1() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid1()).name() + ChatColor.RESET);
}
if (spell.getEffectid2() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid2()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid2()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue2() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid2()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue2() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid2()).name() + ChatColor.RESET);
}
if (spell.getEffectid3() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid3()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid3()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue3() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid3()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue3() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid3()).name() + ChatColor.RESET);
}
if (spell.getEffectid4() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid4()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid4()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue4() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid4()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue4() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid4()).name() + ChatColor.RESET);
}
if (spell.getEffectid5() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid5()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid5()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue5() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid5()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue5() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid5()).name() + ChatColor.RESET);
}
if (spell.getEffectid6() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid6()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid6()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue6() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid6()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue6() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid6()).name() + ChatColor.RESET);
}
if (spell.getEffectid7() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid7()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid7()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue7() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid7()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue7() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid7()).name() + ChatColor.RESET);
}
if (spell.getEffectid8() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid8()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid8()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue8() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid8()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue8() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid8()).name() + ChatColor.RESET);
}
if (spell.getEffectid9() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid9()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid9()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue9() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid9()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue9() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid9()).name() + ChatColor.RESET);
}
if (spell.getEffectid10() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid10()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid10()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue10() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid10()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue10() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid10()).name() + ChatColor.RESET);
}
if (spell.getEffectid11() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid11()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid11()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue11() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid11()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue11() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid11()).name() + ChatColor.RESET);
}
if (spell.getEffectid12() != 254 && !SpellUtils.getSpellEffectType(spell.getEffectid12()).name().contains("LIMIT_") && !(SpellUtils.getSpellEffectType(spell.getEffectid12()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue12() == 0) && !SpellUtils.getSpellEffectType(spell.getEffectid12()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue12() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + SpellUtils.getSpellEffectType(spell.getEffectid12()).name() + ChatColor.RESET);
}
if (!spell.isBardSong()) {
if (spell.getComponents1() > 0) {
ISoliniaItem item = StateManager.getInstance().getConfigurationManager().getItem(spell.getComponents1());
if (item != null && item.isReagent()) {
loreTxt.add(ChatColor.WHITE + "Requires Component: " + ChatColor.YELLOW + item.getDisplayname() + " x " + spell.getComponentCounts1() + ChatColor.RESET);
} else {
loreTxt.add(ChatColor.WHITE + "Requires Component: " + ChatColor.YELLOW + "ERROR-ALERT-ADMIN-SPELL" + spell.getId() + "-ID" + spell.getComponents1());
}
}
if (spell.getComponents2() > 0) {
ISoliniaItem item = StateManager.getInstance().getConfigurationManager().getItem(spell.getComponents2());
if (item != null && item.isReagent()) {
loreTxt.add(ChatColor.WHITE + "Requires Component: " + ChatColor.YELLOW + item.getDisplayname() + " x " + spell.getComponentCounts2() + ChatColor.RESET);
} else {
loreTxt.add(ChatColor.WHITE + "Requires Component: " + ChatColor.YELLOW + "ERROR-ALERT-ADMIN-SPELL" + spell.getId() + "-ID" + spell.getComponents2());
}
}
if (spell.getComponents3() > 0) {
ISoliniaItem item = StateManager.getInstance().getConfigurationManager().getItem(spell.getComponents3());
if (item != null && item.isReagent()) {
loreTxt.add(ChatColor.WHITE + "Requires Component: " + ChatColor.YELLOW + item.getDisplayname() + " x " + spell.getComponentCounts3() + ChatColor.RESET);
} else {
loreTxt.add(ChatColor.WHITE + "Requires Component: " + ChatColor.YELLOW + "ERROR-ALERT-ADMIN-SPELL" + spell.getId() + "-ID" + spell.getComponents3());
}
}
if (spell.getComponents4() > 0) {
ISoliniaItem item = StateManager.getInstance().getConfigurationManager().getItem(spell.getComponents4());
if (item != null && item.isReagent()) {
loreTxt.add(ChatColor.WHITE + "Requires Component: " + ChatColor.YELLOW + item.getDisplayname() + " x " + spell.getComponentCounts4() + ChatColor.RESET);
} else {
loreTxt.add(ChatColor.WHITE + "Requires Component: " + ChatColor.YELLOW + "ERROR-ALERT-ADMIN-SPELL" + spell.getId() + "-ID" + spell.getComponents4());
}
}
}
loreTxt.add(ChatColor.WHITE + "Mana/Power: " + ChatColor.YELLOW + spell.getMana() + ChatColor.RESET);
loreTxt.add(ChatColor.WHITE + "Spell Skill: " + ChatColor.YELLOW + SkillUtils.getSkillType(spell.getSkill()).name().toUpperCase() + ChatColor.RESET);
loreTxt.add(ChatColor.WHITE + "Range: " + ChatColor.YELLOW + spell.getRange() + ChatColor.RESET);
loreTxt.add(ChatColor.WHITE + "Casting Time: " + ChatColor.YELLOW + (spell.getCastTime() / 1000) + " seconds" + ChatColor.RESET);
if (spell.isAASpell()) {
loreTxt.add(ChatColor.WHITE + "This spell is an AA spell" + ChatColor.RESET);
}
if (spell.isBuffSpell() && spell.getBuffduration() > 0) {
loreTxt.add(ChatColor.WHITE + "Buff Duration: " + ChatColor.YELLOW + (spell.getBuffduration() * 6) + " seconds" + ChatColor.RESET);
}
loreTxt.add(ChatColor.WHITE + "Target Type: " + ChatColor.YELLOW + SpellUtils.getSpellTargetType(spell.getTargettype()).name() + ChatColor.RESET);
List<String> classInfo = generateClassesText(spell);
if (classInfo.size() > 0)
loreTxt.addAll(classInfo);
} catch (CoreStateInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return loreTxt;
}
use of net.minecraft.server.v1_15_R1.Block in project solinia3-core by mixxit.
the class ItemStackAdapter method generateWeaponAbilityLoreText.
private static Collection<String> generateWeaponAbilityLoreText(ISoliniaItem soliniaItem) {
List<String> loreTxt = new ArrayList<String>();
ISoliniaSpell spell;
try {
spell = StateManager.getInstance().getConfigurationManager().getSpell(soliniaItem.getWeaponabilityid());
loreTxt.add(ChatColor.WHITE + "Chance to Proc on Hit: " + ChatColor.YELLOW + spell.getName() + ChatColor.RESET);
} catch (CoreStateInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return loreTxt;
}
use of net.minecraft.server.v1_15_R1.Block in project java-docs-samples by GoogleCloudPlatform.
the class Detect method detectDocumentText.
// [START vision_detect_document]
/**
* Performs document text detection on a local image file.
*
* @param filePath The path to the local file to detect document text on.
* @param out A {@link PrintStream} to write the results to.
* @throws Exception on errors while closing the client.
* @throws IOException on Input/Output errors.
*/
public static void detectDocumentText(String filePath, PrintStream out) throws Exception, IOException {
List<AnnotateImageRequest> requests = new ArrayList<>();
ByteString imgBytes = ByteString.readFrom(new FileInputStream(filePath));
Image img = Image.newBuilder().setContent(imgBytes).build();
Feature feat = Feature.newBuilder().setType(Type.DOCUMENT_TEXT_DETECTION).build();
AnnotateImageRequest request = AnnotateImageRequest.newBuilder().addFeatures(feat).setImage(img).build();
requests.add(request);
try (ImageAnnotatorClient client = ImageAnnotatorClient.create()) {
BatchAnnotateImagesResponse response = client.batchAnnotateImages(requests);
List<AnnotateImageResponse> responses = response.getResponsesList();
client.close();
for (AnnotateImageResponse res : responses) {
if (res.hasError()) {
out.printf("Error: %s\n", res.getError().getMessage());
return;
}
// For full list of available annotations, see http://g.co/cloud/vision/docs
TextAnnotation annotation = res.getFullTextAnnotation();
for (Page page : annotation.getPagesList()) {
String pageText = "";
for (Block block : page.getBlocksList()) {
String blockText = "";
for (Paragraph para : block.getParagraphsList()) {
String paraText = "";
for (Word word : para.getWordsList()) {
String wordText = "";
for (Symbol symbol : word.getSymbolsList()) {
wordText = wordText + symbol.getText();
out.format("Symbol text: %s (confidence: %f)\n", symbol.getText(), symbol.getConfidence());
}
out.format("Word text: %s (confidence: %f)\n\n", wordText, word.getConfidence());
paraText = String.format("%s %s", paraText, wordText);
}
// Output Example using Paragraph:
out.println("\nParagraph: \n" + paraText);
out.format("Paragraph Confidence: %f\n", para.getConfidence());
blockText = blockText + paraText;
}
pageText = pageText + blockText;
}
}
out.println("\nComplete annotation:");
out.println(annotation.getText());
}
}
}
Aggregations