-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
196 additions
and
40 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
package me.efekos.simpler; | ||
|
||
import me.efekos.simpler.commands.CommandManager; | ||
import me.efekos.simpler.egs.commands.GiveCookied; | ||
import me.efekos.simpler.items.ItemManager; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
public final class Simpler extends JavaPlugin { | ||
private final String customItemDataPath = getDataFolder().getAbsolutePath()+"\\CustomItemData.json"; | ||
|
||
@Override | ||
public void onEnable() { | ||
try { | ||
CommandManager.registerBaseCommand(this, GiveCookied.class); | ||
ItemManager.setPlugin(this); | ||
ItemManager.loadItemData(customItemDataPath); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onDisable() { | ||
// Plugin shutdown logic | ||
ItemManager.saveItemData(customItemDataPath); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/me/efekos/simpler/egs/commands/GiveCookied.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package me.efekos.simpler.egs.commands; | ||
|
||
import me.efekos.simpler.annotations.Command; | ||
import me.efekos.simpler.commands.BaseCommand; | ||
import me.efekos.simpler.commands.syntax.Syntax; | ||
import me.efekos.simpler.egs.items.ClickerCokkie; | ||
import me.efekos.simpler.items.ItemManager; | ||
import org.bukkit.command.ConsoleCommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
|
||
@Command(name = "givecookie",description = "Give you cookied") | ||
public class GiveCookied extends BaseCommand { | ||
@Override | ||
public @NotNull Syntax getSyntax() { | ||
return new Syntax(); | ||
} | ||
|
||
public GiveCookied(@NotNull String name) { | ||
super(name); | ||
} | ||
|
||
public GiveCookied(@NotNull String name, @NotNull String description, @NotNull String usageMessage, @NotNull List<String> aliases) { | ||
super(name, description, usageMessage, aliases); | ||
} | ||
|
||
@Override | ||
public void onPlayerUse(Player player, String[] args) { | ||
ItemManager.giveItem(player,new ClickerCokkie()); | ||
} | ||
|
||
@Override | ||
public void onConsoleUse(ConsoleCommandSender sender, String[] args) { | ||
|
||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/me/efekos/simpler/egs/items/ClickerCokkie.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package me.efekos.simpler.egs.items; | ||
|
||
import me.efekos.simpler.items.CustomItem; | ||
import org.bukkit.Material; | ||
import org.bukkit.event.entity.EntityPickupItemEvent; | ||
import org.bukkit.event.player.PlayerDropItemEvent; | ||
import org.bukkit.event.player.PlayerInteractEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.inventory.meta.ItemMeta; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ClickerCokkie extends CustomItem { | ||
private int click; | ||
|
||
@Override | ||
public void onLeftClick(PlayerInteractEvent event) { | ||
click +=1; | ||
event.getPlayer().sendMessage("You clicked to this "+ click + " times."); | ||
} | ||
|
||
@Override | ||
public void onRightClick(PlayerInteractEvent event) { | ||
onLeftClick(event); | ||
} | ||
|
||
@Override | ||
public void onDrop(PlayerDropItemEvent event) { | ||
|
||
} | ||
|
||
@Override | ||
public void onPickup(EntityPickupItemEvent event) { | ||
|
||
} | ||
|
||
@Override | ||
public @NotNull String getId() { | ||
return "clicker_cookie"; | ||
} | ||
|
||
@Override | ||
public @NotNull ItemMeta getDefaultMeta() { | ||
return new ItemStack(getMaterial()).getItemMeta(); | ||
} | ||
|
||
@Override | ||
public @NotNull Material getMaterial() { | ||
return Material.COOKIE; | ||
} | ||
} |
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
24 changes: 0 additions & 24 deletions
24
src/main/java/me/efekos/simpler/items/CustomItemRegister.java
This file was deleted.
Oops, something went wrong.
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