diff --git a/pom.xml b/pom.xml index a208105..45d3ffc 100644 --- a/pom.xml +++ b/pom.xml @@ -1,8 +1,8 @@ 4.0.0 com.hyperling.minecraft - CoderDojoTest - 0.1.3-SNAPSHOT + CoderDojoEVV + 0.1.4-SNAPSHOT Coder Dojo Test Test project written to learn how to do Minecraft plug-in for Coder Dojo. diff --git a/src/main/java/com/hyperling/minecraft/coderdojotest/CoderDojoTest.java b/src/main/java/com/hyperling/minecraft/coderdojoevv/CoderDojoEVV.java similarity index 67% rename from src/main/java/com/hyperling/minecraft/coderdojotest/CoderDojoTest.java rename to src/main/java/com/hyperling/minecraft/coderdojoevv/CoderDojoEVV.java index fb8395a..eab26b4 100644 --- a/src/main/java/com/hyperling/minecraft/coderdojotest/CoderDojoTest.java +++ b/src/main/java/com/hyperling/minecraft/coderdojoevv/CoderDojoEVV.java @@ -1,22 +1,20 @@ -package com.hyperling.minecraft.coderdojotest; +package com.hyperling.minecraft.coderdojoevv; -import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; +import org.bukkit.attribute.Attributable; +import org.bukkit.attribute.Attribute; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.plugin.java.JavaPlugin; -public final class CoderDojoTest extends JavaPlugin implements Listener { - public CoderDojoTest() { - - } +public final class CoderDojoEVV extends JavaPlugin implements Listener { @Override public void onEnable() { @@ -53,6 +51,10 @@ public final class CoderDojoTest extends JavaPlugin implements Listener { inv.addItem(item); item = new ItemStack(Material.DIAMOND_SPADE); inv.remove(Material.DIAMOND_SPADE); + /* For 1.13 API + item = new ItemStack(Material.DIAMOND_SHOVEL); + inv.remove(Material.DIAMOND_SHOVEL); + */ inv.addItem(item); item = new ItemStack(Material.DIAMOND_HOE); inv.remove(Material.DIAMOND_HOE); @@ -79,6 +81,26 @@ public final class CoderDojoTest extends JavaPlugin implements Listener { getServer().broadcastMessage("Inventory has been cleared for Creative mode."); } - getLogger().info("Refreshed diamond items."); + getLogger().info("Finished onJoin()."); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + Player player = (Player) sender; + + getLogger().info(player.getName() + " issued command with label " + label + "."); + + if (label.equals("heal")) { + double health = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue(); + int food = (int) health; + + player.setHealth(health); + player.setFireTicks(0); + player.setFoodLevel(food); + getLogger().info(player.getName() + " has healed."); + } + + getLogger().info("Finished onCommand()."); + return super.onCommand(sender, command, label, args); } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 2257280..da449cd 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,3 +1,7 @@ -name: CoderDojoTest -main: com.hyperling.minecraft.coderdojotest.CoderDojoTest -version: 0.1.2 \ No newline at end of file +name: CoderDojoEVV +main: com.hyperling.minecraft.coderdojoevv.CoderDojoEVV +version: 0.1.4 + +commands: + heal: + description: Heal hearts, food, and ends fire. \ No newline at end of file diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml index 2257280..da449cd 100644 --- a/target/classes/plugin.yml +++ b/target/classes/plugin.yml @@ -1,3 +1,7 @@ -name: CoderDojoTest -main: com.hyperling.minecraft.coderdojotest.CoderDojoTest -version: 0.1.2 \ No newline at end of file +name: CoderDojoEVV +main: com.hyperling.minecraft.coderdojoevv.CoderDojoEVV +version: 0.1.4 + +commands: + heal: + description: Heal hearts, food, and ends fire. \ No newline at end of file diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties index debb43c..d043e76 100644 --- a/target/maven-archiver/pom.properties +++ b/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Thu Dec 27 10:04:47 CST 2018 -version=0.1.3-SNAPSHOT +#Fri Dec 28 10:02:46 CST 2018 +version=0.1.4-SNAPSHOT groupId=com.hyperling.minecraft -artifactId=CoderDojoTest +artifactId=CoderDojoEVV diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 3ea79a7..3f7abb3 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1 +1 @@ -/home/ling/Programs/eclipse-workspace/CoderDojoTest/src/main/java/com/hyperling/minecraft/coderdojotest/CoderDojoTest.java +/home/ling/Programs/eclipse-workspace/CoderDojoEVV/src/main/java/com/hyperling/minecraft/coderdojoevv/CoderDojoEVV.java