Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
[ADD] - begin evo pickaxe
Browse files Browse the repository at this point in the history
  • Loading branch information
VidsSkids committed May 15, 2022
1 parent bba10fa commit 3800cf6
Show file tree
Hide file tree
Showing 7 changed files with 272 additions and 12 deletions.
32 changes: 27 additions & 5 deletions SkyblockCore.iml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>BUKKIT</platformType>
<platformType>ADVENTURE</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_X">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_16">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
Expand All @@ -28,7 +28,6 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-key:4.7.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:examination-api:1.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:examination-string:1.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.11.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:20.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-gson:4.7.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-legacy:4.7.0" level="project" />
Expand All @@ -48,8 +47,31 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-tree:9.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-analysis:9.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-minimessage:4.1.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.iridium:IridiumSkyblock:3.2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fastasyncworldedit:FastAsyncWorldEdit-Libs-Core:2.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.intellectualsites.paster:Paster:1.1.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:antlr4:4.9.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:antlr-runtime:3.5.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:ST4:4.3.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.abego.treelayout:org.abego.treelayout.core:1.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.glassfish:javax.json:1.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.ibm.icu:icu4j:69.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-nbt:4.9.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: it.unimi.dsi:fastutil:8.5.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.17.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mozilla:rhino-runtime:1.7.13" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.luben:zstd-jni:1.4.8-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:antlr4-runtime:4.9.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fastasyncworldedit:FastAsyncWorldEdit-Libs-Bukkit:2.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.lz4:lz4-java:1.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.zaxxer:SparseBitSet:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.anarres:parallelgzip:1.0.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.21.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.8-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:2.2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-base:2.2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: dev.notmyfault.serverlib:ServerLib:2.3.1" level="project" />
</component>
</module>
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>SkyblockCore</groupId>
<artifactId>SkyblockCore</artifactId>
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/fr/verymc/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@
import main.java.fr.verymc.island.guis.IslandGuiManager;
import main.java.fr.verymc.island.protections.BlockListener;
import main.java.fr.verymc.island.protections.EntityListener;
import main.java.fr.verymc.items.FarmHoeCmd;
import main.java.fr.verymc.items.FarmHoeGui;
import main.java.fr.verymc.items.FarmHoeManager;
import main.java.fr.verymc.items.ItemLegCmd;
import main.java.fr.verymc.items.*;
import main.java.fr.verymc.minions.*;
import main.java.fr.verymc.playerwarps.PlayerWarpCmd;
import main.java.fr.verymc.playerwarps.PlayerWarpGuiManager;
Expand Down Expand Up @@ -301,6 +298,7 @@ public void startListenerModule() {
getServer().getPluginManager().registerEvents(new MoneyTradeGui(), this);
getServer().getPluginManager().registerEvents(new EntityListener(), this);
getServer().getPluginManager().registerEvents(new BlockListener(), this);
getServer().getPluginManager().registerEvents(new PickaxeManager(), this);
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(this, this);
}
Expand Down Expand Up @@ -356,6 +354,7 @@ public void startCommandModule() {
this.getCommand("tradeyes").setExecutor(new TradeYesCmd());
this.getCommand("tradeno").setExecutor(new TradeNoCmd());
this.getCommand("tradecancel").setExecutor(new TradeCancelCmd());
this.getCommand("pickaxe").setExecutor(new PickaxeCmd());
}

}
4 changes: 2 additions & 2 deletions src/main/java/fr/verymc/items/FarmHoeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ public static void AddBlockHaversted(Player player, ItemStack a) {

public static Integer GetBlockHaversted(ItemStack a) {
String tosearch = a.getLore().get(0).replace("§7", "");
boolean digit = false;
boolean digit;
try {
@SuppressWarnings("unused")
int intValue = Integer.parseInt(tosearch);
digit = true;
} catch (NumberFormatException e) {
digit = false;
}
if (!tosearch.contains(".") && digit == true) {
if (!tosearch.contains(".") && digit) {
int num = Integer.parseInt(tosearch);
return num;
}
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/fr/verymc/items/PickaxeCmd.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package main.java.fr.verymc.items;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;

public class PickaxeCmd implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (args.length < 1 || args.length > 1) {
sender.sendMessage("§cErreur, utilisation: /pickaxe <joueur>");
return false;
}
if (Bukkit.getPlayer(args[0]) == null) {
sender.sendMessage("§cErreur, joueur inconnu");
return false;
}
Player p = Bukkit.getPlayer(args[0]);
ItemStack custom6 = new ItemStack(Material.NETHERITE_PICKAXE, 1);
ItemMeta customf = custom6.getItemMeta();
customf.setDisplayName("§6Gros Cailloux Tier §cI (1X1)");
customf.setLore(Arrays.asList("§70", "§7", "§6Clic droit pour ouvrir le menu d'amélioration"));
customf.setUnbreakable(true);
custom6.setItemMeta(customf);
p.getInventory().addItem(custom6);
p.sendMessage("§eVous avez reçu une pioche évolutive !");
return false;
}
}
200 changes: 200 additions & 0 deletions src/main/java/fr/verymc/items/PickaxeManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
package main.java.fr.verymc.items;

import main.java.fr.verymc.evenement.BlocBreakerContest;
import main.java.fr.verymc.island.Island;
import main.java.fr.verymc.island.IslandManager;
import main.java.fr.verymc.island.challenges.IslandChallenge;
import main.java.fr.verymc.island.challenges.IslandChallengesGuis;
import main.java.fr.verymc.shopgui.BuyShopItem;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.Ageable;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class PickaxeManager implements Listener {
public static ArrayList<Material> breakingBlock = new ArrayList<Material>(Arrays.asList(Material.STONE, Material.COAL_ORE, Material.IRON_ORE, Material.DIAMOND_ORE, Material.EMERALD_ORE, Material.LAPIS_ORE, Material.REDSTONE_ORE));

public static void AddBlockHaversted(Player player, ItemStack a) {
String tosearch = a.getLore().get(0).replace("§7", "");
if (!tosearch.contains(".")) {
int num = Integer.parseInt(tosearch);
num += 1;
List<String> lores = a.getLore();
lores.set(0, "§7" + num);
player.getItemInHand().setLore(lores);
}
}

public static Integer GetBlockHaversted(ItemStack a) {
String tosearch = a.getLore().get(0).replace("§7", "");
boolean digit;
try {
@SuppressWarnings("unused")
int intValue = Integer.parseInt(tosearch);
digit = true;
} catch (NumberFormatException e) {
digit = false;
}
if (!tosearch.contains(".") && digit) {
int num = Integer.parseInt(tosearch);
return num;
}
return 0;
}

public static Integer GetTier(ItemStack farmhoe) {
if (farmhoe == null) {
return null;
}
if (farmhoe.getType() == Material.AIR) {
return null;
}
if (farmhoe.getItemMeta() == null) {
return null;
}
if (farmhoe.getType() != Material.NETHERITE_HOE) {
return null;
}
if (!farmhoe.isUnbreakable()) {
return null;
}

if (farmhoe.getDisplayName().contains("§cIII")) {
return 2;
} else if (farmhoe.getDisplayName().contains("§cII")) {
return 1;
} else if (farmhoe.getDisplayName().contains("§cI")) {
return 0;
} else {
return null;
}
}

@EventHandler
public void PickaxeClick(PlayerInteractEvent e) {
if (e.getPlayer().getLocation().getWorld().getName().equalsIgnoreCase("world")) {
return;
}
if (e.getAction() == Action.LEFT_CLICK_BLOCK) {
ItemStack itemInHand = e.getPlayer().getItemInHand();
if (itemInHand.getType() == Material.AIR) {
return;
}
if (itemInHand.getItemMeta() == null) {
return;
}
if (itemInHand.getType() != Material.NETHERITE_PICKAXE) {
return;
}
if (!itemInHand.isUnbreakable()) {
return;
}
Player player = e.getPlayer();
Location clicloc = e.getClickedBlock().getLocation();

int tier;
if (itemInHand.getDisplayName().contains("§cIII")) {
tier = 2;
} else if (itemInHand.getDisplayName().contains("§cII")) {
tier = 1;
} else if (itemInHand.getDisplayName().contains("§cI")) {
tier = 0;
} else {
return;
}
if (e.getPlayer().getItemInHand().getLore() == null) {
return;
}
if (!itemInHand.getLore().get(0).contains("§")) {
return;
}

World world = player.getWorld();
int gained = 0;
for (Block rf : FarmHoeManager.getNearbyBlocks(clicloc, tier)) {
if (!breakingBlock.contains(rf.getType())) {
continue;
}
Block bltmp = Bukkit.getWorld(world.getName()).getBlockAt(rf.getLocation());
int fd = 1;
for (ItemStack eed : bltmp.getDrops(e.getItem())) {
if (BuyShopItem.GetAmountToFillInInv(eed, player) > 0) {
player.getInventory().addItem(eed);
continue;
}
world.dropItemNaturally(rf.getLocation(), eed);
}
gained++;
bltmp.getState().update(true);
AddBlockHaversted(player, itemInHand);
if (BlocBreakerContest.instance.isActive) {
if (bltmp.getType().equals(BlocBreakerContest.instance.material)) {
BlocBreakerContest.instance.addBlock(player.getUniqueId());
}
}
if (!IslandManager.instance.asAnIsland(player)) {
return;
}
Island playerIsland = IslandManager.instance.getPlayerIsland(player);
IslandChallenge challenge = null;

for (IslandChallenge c : playerIsland.getChallenges()) {
if (c.getMaterial() == bltmp.getType()) {
challenge = c;
break;
}
}
if (challenge == null) {
continue;
}

if (!challenge.isActive()) {
continue;
}

challenge.addProgress(1);

if (challenge.getProgress() >= challenge.getMaxProgress() * (challenge.getPalier() + 1) * playerIsland.getMembers().size()) {
challenge.setProgress(0);
if (challenge.getPalier() == 4) {
challenge.setActive(false);
}
challenge.setPalier(challenge.getPalier() + 1);
IslandChallengesGuis.CompleteChallenge(player, challenge);
}
}
}
if (e.getAction() == Action.RIGHT_CLICK_AIR) {
if (e.getPlayer().getItemInHand().getLore() == null) {
return;
}
if (!e.getPlayer().getItemInHand().getLore().get(0).contains("§")) {
return;
}
String tosearch = e.getPlayer().getItemInHand().getLore().get(0).replace("§7", "");
boolean digit = false;
try {
@SuppressWarnings("unused")
int intValue = Integer.parseInt(tosearch);
digit = true;
} catch (NumberFormatException ede) {
digit = false;
}
if (!tosearch.contains(".") && digit == true) {
FarmHoeGui.MakeGui(e.getPlayer(), GetTier(e.getPlayer().getItemInHand()));
}
}
}
}
3 changes: 2 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@ commands:
trade:
tradeyes:
tradeno:
tradecancel:
tradecancel:
pickaxe:

0 comments on commit 3800cf6

Please sign in to comment.