Created
January 13, 2019 08:57
-
-
Save ArtemBelz/b75a8599d9018faa0c2ed94acfe6cd8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private UUID contentDetermineUUID = UUID.fromString("f680df9b-ac5c-4d3f-9bac-75bc0e316afa"); | |
private String vacuumWolrd = AirshipModule.getInstance().getManager().getBase().getOptions().getVacuumWorld(); | |
@Listener | |
public void onInteract(InteractBlockEvent.Secondary event) { | |
Player player = event.getCause().first(Player.class).get(); | |
World world = Sponge.getGame().getServer().getWorld(vacuumWolrd).get(); | |
BlockSnapshot targetBlock = event.getTargetBlock(); | |
Vector3i pos = targetBlock.getPosition(); | |
Location<World> loc = new Location<>(world, pos); | |
if(player.getItemInHand(HandTypes.MAIN_HAND).get().getType().equals(ItemTypes.APPLE)) { | |
player.sendMessage(Text.of(targetBlock.getCreator().get())); | |
BlockSnapshot blockSnapshot = BlockSnapshot.builder().from(loc) | |
.creator(contentDetermineUUID) | |
.build(); | |
loc.restoreSnapshot(blockSnapshot, true, BlockChangeFlags.ALL); | |
player.sendMessage(Text.of(blockSnapshot.getCreator().get())); | |
} else if(player.getItemInHand(HandTypes.MAIN_HAND).get().getType().equals(ItemTypes.BONE)) { | |
player.sendMessage(Text.of(targetBlock.getCreator().get())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment