Skip to content

Commit

Permalink
renamed ServerTypes, fixed some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzKatze committed May 8, 2024
1 parent 4a3e276 commit a0fcfe8
Show file tree
Hide file tree
Showing 190 changed files with 360 additions and 359 deletions.
8 changes: 4 additions & 4 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions commons/src/main/java/net/swofty/commons/ServerType.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
@Getter
public enum ServerType {
ISLAND,
VILLAGE,
FARMING_ISLANDS;
HUB,
THE_FARMING_ISLANDS;

public static boolean isServerType(String type) {
for (ServerType a : values())
Expand Down
24 changes: 12 additions & 12 deletions configuration/Minestom.crystals.csv
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
_id,url,x,y,z,itemType,serverType
1,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,43.13005921622691,75.1118727240194,-122.24967766591506,WHEAT_CRYSTAL,VILLAGE
2,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,28.31150256073339,75.48551224990652,-140.6871747405607,WHEAT_CRYSTAL,VILLAGE
3,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,63.414336674908704,76.97180664240655,-134.42058576459584,WHEAT_CRYSTAL,VILLAGE
4,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,73.69529306049547,79.21654074104354,-160.75138423775255,WHEAT_CRYSTAL,VILLAGE
5,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,59.50817153963336,79.21654074104354,-182.6970617412972,WHEAT_CRYSTAL,VILLAGE
6,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,23.69214972882618,77.72147472159656,-178.00258311237133,WHEAT_CRYSTAL,VILLAGE
7,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,-7,78,-27,FLOWER_CRYSTAL,VILLAGE
8,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,134.8683294293372,78.83531391075113,-212.77871289031293,WHEAT_CRYSTAL,FARMING_ISLANDS
9,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,118.09829197561052,78.0854154409095,-221.89615973940928,WHEAT_CRYSTAL,FARMING_ISLANDS
10,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,179.6704613500174,82.90219669149552,-216.48506739711638,PUMPKIN_AND_MELON_CRYSTAL,FARMING_ISLANDS
11,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,168.39194062684598,90.78562053479897,-269.59782005232177,POTATO_CRYSTAL,FARMING_ISLANDS
12,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,132.578203624726,91.16748587959599,-284.62450974516634,CARROT_CRYSTAL,FARMING_ISLANDS
1,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,43.13005921622691,75.1118727240194,-122.24967766591506,WHEAT_CRYSTAL,HUB
2,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,28.31150256073339,75.48551224990652,-140.6871747405607,WHEAT_CRYSTAL,HUB
3,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,63.414336674908704,76.97180664240655,-134.42058576459584,WHEAT_CRYSTAL,HUB
4,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,73.69529306049547,79.21654074104354,-160.75138423775255,WHEAT_CRYSTAL,HUB
5,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,59.50817153963336,79.21654074104354,-182.6970617412972,WHEAT_CRYSTAL,HUB
6,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,23.69214972882618,77.72147472159656,-178.00258311237133,WHEAT_CRYSTAL,HUB
7,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,-7.1,78.1,-27.1,FLOWER_CRYSTAL,HUB
8,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,134.8683294293372,78.83531391075113,-212.77871289031293,WHEAT_CRYSTAL,THE_FARMING_ISLANDS
9,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,118.09829197561052,78.0854154409095,-221.89615973940928,WHEAT_CRYSTAL,THE_FARMING_ISLANDS
10,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,179.6704613500174,82.90219669149552,-216.48506739711638,PUMPKIN_AND_MELON_CRYSTAL,THE_FARMING_ISLANDS
11,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,168.39194062684598,90.78562053479897,-269.59782005232177,POTATO_CRYSTAL,THE_FARMING_ISLANDS
12,9265f96f54b78885c46e7d2f86b1c1dbfe643c6060fc7fcc9834c3e3fd595135,132.578203624726,91.16748587959599,-284.62450974516634,CARROT_CRYSTAL,THE_FARMING_ISLANDS
2 changes: 1 addition & 1 deletion configuration/Minestom.regions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ vs1,VOID_SEPULTURE,100,56,62,7,-17,-96,end_region,
vs2,VOID_SEPULTURE,68,140,70,23,-96,-21,end_region,
vs3,VOID_SEPULTURE,74,49,50,8,-51,-91,end_region,
POG,WILDERNESS,58,123,71,76,118,123,,
barn_1,THE_BARN,82,250,26,120,-177,-334,,FARMING_ISLANDS
barn_1,THE_BARN,82,250,26,120,-177,-334,,THE_FARMING_ISLANDS
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ public void initialize(MinecraftServer server) {
*/
if (mainInstance != null) {
ServerHolograms.spawnAll(SkyBlockConst.getInstanceContainer());
FairySoul.spawnEntities(SkyBlockConst.getInstanceContainer(), FairySoulZone.HUB);
String zone = typeLoader.getType().toString();
FairySoul.spawnEntities(SkyBlockConst.getInstanceContainer(), FairySoulZone.valueOf(zone));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void run(MinestomCommand command) {
player.sendMessage("§cYou must complete your starting missions!");
return;
}
player.sendTo(ServerType.VILLAGE);
player.sendTo(ServerType.HUB);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static List<SkyBlockRegion> getAllRegions() {
int x2 = doc.getInteger("x2");
int y2 = doc.getInteger("y2");
int z2 = doc.getInteger("z2");
ServerType serverType = ServerType.valueOf(doc.getOrDefault("serverType", ServerType.VILLAGE.name()).toString());
ServerType serverType = ServerType.valueOf(doc.getOrDefault("serverType", ServerType.HUB.name()).toString());
SkyBlockRegion region = new SkyBlockRegion(
name,
new Pos(x1, y1, z1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void run(PlayerMoveEvent event) {
return;
}

player.sendTo(ServerType.VILLAGE);
player.sendTo(ServerType.HUB);
delay.add(player.getUuid());

MinecraftServer.getSchedulerManager().buildTask(() -> delay.remove(player.getUuid()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ public class ActionRegionBlockBreak implements SkyBlockEventClass {
public void run(PlayerBlockBreakEvent event) {
final SkyBlockPlayer player = (SkyBlockPlayer) event.getPlayer();

if (player.isBypassBuild())
return;
if (player.isBypassBuild()) return;

event.setCancelled(true);
SkyBlockRegion region = SkyBlockRegion.getRegionOfPosition(event.getBlockPosition());

Block block = event.getBlock();
Material material = Material.fromNamespaceId(block.name());
Boolean shouldItemDrop = false;

if (SkyBlockConst.isIslandServer()) {
event.getInstance().setBlock(event.getBlockPosition(), Block.AIR);
shouldItemDrop = true;
} else if (region != null) {
RegionType type = region.getType();
SkyBlockMiningConfiguration mining = type.getMiningHandler();
Expand All @@ -48,41 +49,45 @@ public void run(PlayerBlockBreakEvent event) {

if (mining != null && material != null) {
mining.addToQueue(player, Pos.fromPoint(event.getBlockPosition()), (SharedInstance) player.getInstance());
shouldItemDrop = true;
}
} else {
event.setCancelled(true);
return;
}

SkyBlockItem item;
if (ItemDropChanger.get(material) != null) {
item = ItemDropChanger.get(material).getItemSupplier().get();
} else {
item = new SkyBlockItem(material);
}
if (material != null && shouldItemDrop) {
SkyBlockItem item;
if (ItemDropChanger.get(material) != null) {
item = ItemDropChanger.get(material).getItemSupplier().get();
} else {
item = new SkyBlockItem(material);
}

SkyBlockEventHandler.callSkyBlockEvent(new CustomBlockBreakEvent(
player, item.getMaterial(), event.getBlockPosition()
));
SkyBlockEventHandler.callSkyBlockEvent(new CustomBlockBreakEvent(
player, item.getMaterial(), event.getBlockPosition()
));

/**
* Handle block dropping
*/
DroppedItemEntityImpl droppedItem = new DroppedItemEntityImpl(item, player);
Pos pos = Pos.fromPoint(event.getBlockPosition());
// Move the dropped item to the center of the block
pos = pos.add(0.5, 0.5, 0.5);
// Move block closer to player by 0.5 blocks
Pos playerPos = player.getPosition().add(0, 0.5, 0);
double x = playerPos.x() - pos.x();
double y = playerPos.y() - pos.y();
double z = playerPos.z() - pos.z();
double distance = Math.sqrt(x * x + y * y + z * z);
double multiplier = 1.4 / distance;
pos = pos.add(x * multiplier, y * multiplier * 3, z * multiplier);
/**
* Handle block dropping
*/
DroppedItemEntityImpl droppedItem = new DroppedItemEntityImpl(item, player);
Pos pos = Pos.fromPoint(event.getBlockPosition());
// Move the dropped item to the center of the block
pos = pos.add(0.5, 0.5, 0.5);
// Move block closer to player by 0.5 blocks
Pos playerPos = player.getPosition().add(0, 0.5, 0);
double x = playerPos.x() - pos.x();
double y = playerPos.y() - pos.y();
double z = playerPos.z() - pos.z();
double distance = Math.sqrt(x * x + y * y + z * z);
double multiplier = 1.4 / distance;
pos = pos.add(x * multiplier, y * multiplier * 3, z * multiplier);

droppedItem.setInstance(player.getInstance(), pos);
droppedItem.addViewer(player);
droppedItem.setInstance(player.getInstance(), pos);
droppedItem.addViewer(player);
}
shouldItemDrop = false;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
import net.swofty.types.generic.item.items.vanilla.*;
import net.swofty.types.generic.item.items.vanilla.armor.*;
import net.swofty.types.generic.item.items.vanilla.blocks.Anvil;
import net.swofty.types.generic.item.items.vanilla.blocks.colored.wool.WhiteWool;
import net.swofty.types.generic.item.items.vanilla.blocks.stone.andesite.*;
import net.swofty.types.generic.item.items.vanilla.blocks.stone.cobblestone.Cobblestone;
import net.swofty.types.generic.item.items.vanilla.blocks.stone.cobblestone.CobblestoneSlab;
Expand Down Expand Up @@ -915,7 +916,6 @@ public enum ItemType {
RABBIT_FOOT(Material.RABBIT_FOOT, Rarity.COMMON, RabbitFoot.class),
RABBIT_HIDE(Material.RABBIT_HIDE, Rarity.COMMON, RabbitHide.class),
BEEF(Material.BEEF, Rarity.COMMON, Beef.class),
WOOL(Material.WHITE_WOOL, Rarity.COMMON, Wool.class),
COAL_BLOCK(Material.COAL_BLOCK, Rarity.COMMON, CoalBlock.class),
LAPIS_LAZULI_BLOCK(Material.LAPIS_BLOCK, Rarity.COMMON, LapisLazuliBlock.class),
BROWN_MUSHROOM_BLOCK(Material.BROWN_MUSHROOM_BLOCK, Rarity.COMMON),
Expand Down Expand Up @@ -1055,6 +1055,22 @@ public enum ItemType {
NETHER_BRICK_STAIRS(Material.NETHER_BRICK_STAIRS, Rarity.COMMON, NetherBrickStairs.class),
NETHER_BRICK_WALL(Material.NETHER_BRICK_WALL, Rarity.COMMON, NetherBrickWall.class),
NETHER_BRICK_FENCE(Material.NETHER_BRICK_FENCE, Rarity.COMMON, NetherBrickFence.class),
WHITE_WOOL(Material.WHITE_WOOL, Rarity.COMMON, WhiteWool.class),
ORANGE_WOOL(Material.ORANGE_WOOL, Rarity.COMMON),
MAGENTA_WOOL(Material.MAGENTA_WOOL, Rarity.COMMON),
LIGHT_BLUE_WOOL(Material.LIGHT_BLUE_WOOL, Rarity.COMMON),
YELLOW_WOOL(Material.YELLOW_WOOL, Rarity.COMMON),
LIME_WOOL(Material.LIME_WOOL, Rarity.COMMON),
PINK_WOOL(Material.PINK_WOOL, Rarity.COMMON),
GRAY_WOOL(Material.GRAY_WOOL, Rarity.COMMON),
LIGHT_GRAY_WOOL(Material.LIGHT_GRAY_WOOL, Rarity.COMMON),
CYAN_WOOL(Material.CYAN_WOOL, Rarity.COMMON),
PURPLE_WOOL(Material.PURPLE_WOOL, Rarity.COMMON),
BLUE_WOOL(Material.BLUE_WOOL, Rarity.COMMON),
BROWN_WOOL(Material.BROWN_WOOL, Rarity.COMMON),
GREEN_WOOL(Material.GREEN_WOOL, Rarity.COMMON),
RED_WOOL(Material.RED_WOOL, Rarity.COMMON),
BLACK_WOOL(Material.BLACK_WOOL, Rarity.COMMON),


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public double getSellValue() {

@Override
public SkyBlockRecipe<?> getRecipe() {
return getStandardEnchantedRecipe(SkyBlockRecipe.RecipeType.FARMING, ItemType.WOOL);
return getStandardEnchantedRecipe(SkyBlockRecipe.RecipeType.FARMING, ItemType.WHITE_WOOL);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package net.swofty.types.generic.item.items.vanilla.blocks.colored.wool;

import net.swofty.types.generic.block.BlockType;
import net.swofty.types.generic.item.ItemType;
import net.swofty.types.generic.item.MaterialQuantifiable;
import net.swofty.types.generic.item.SkyBlockItem;
import net.swofty.types.generic.item.impl.DefaultCraftable;
import net.swofty.types.generic.item.impl.PlaceableCustomSkyBlockItem;
import net.swofty.types.generic.item.impl.Sellable;
import net.swofty.types.generic.item.impl.SkyBlockRecipe;
import net.swofty.types.generic.item.impl.recipes.ShapedRecipe;
import net.swofty.types.generic.user.statistics.ItemStatistics;
import org.jetbrains.annotations.Nullable;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class WhiteWool implements PlaceableCustomSkyBlockItem, Sellable, DefaultCraftable {
@Override
public ItemStatistics getStatistics(SkyBlockItem instance) {
return ItemStatistics.empty();
}

@Override
public @Nullable BlockType getAssociatedBlockType() {
return null;
}

@Override
public double getSellValue() {
return 2;
}

@Override
public SkyBlockRecipe<?> getRecipe() {
Map<Character, MaterialQuantifiable> ingredientMap = new HashMap<>();
ingredientMap.put('A', new MaterialQuantifiable(ItemType.STRING, 1));
List<String> pattern = List.of(
"AA",
"AA");
return new ShapedRecipe(SkyBlockRecipe.RecipeType.NONE, new SkyBlockItem(ItemType.WHITE_WOOL), ingredientMap, pattern);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import lombok.Getter;
import lombok.SneakyThrows;
import net.swofty.commons.Songs;
import net.swofty.types.generic.region.mining.configurations.MineCoalConfiguration;
import net.swofty.types.generic.region.mining.configurations.MineLogsConfiguration;
import net.swofty.types.generic.region.mining.configurations.MineWheatConfiguration;
import net.swofty.types.generic.region.mining.configurations.WheatAndFlowersConfiguration;
import net.swofty.types.generic.region.mining.configurations.*;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -30,7 +27,7 @@ public enum RegionType {
BANK("Bank", "§6"),
BLACKSMITH("Blacksmith"),
LIBRARY("Library"),
THE_BARN("The Barn", "§b"),
THE_BARN("The Barn", "§b", MineWheatConfiguration.class),
MUSHROOM_DESERT("Mushroom Desert"),
GOLD_MINE("Gold Mine", "§6"),
DEEP_CAVERN("Deep Caverns", "§b"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class SkyBlockPlayer extends Player {
@Setter
private boolean inLaunchpad = false;
@Setter
private ServerType originServer = ServerType.VILLAGE;
private ServerType originServer = ServerType.HUB;
private StatisticDisplayReplacement manaDisplayReplacement = null;
private StatisticDisplayReplacement defenseDisplayReplacement = null;
private StatisticDisplayReplacement coinsDisplayReplacement = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

@Getter
public enum LaunchPads {
VILLAGE_TO_FARMING(getSlimeBlocksNear(new Pos(79, 71, -185)), ServerType.VILLAGE,
VILLAGE_TO_FARMING(getSlimeBlocksNear(new Pos(79, 71, -185)), ServerType.HUB,
new Pos(116.5, 74, -210.5), (player) -> {
player.sendTo(ServerType.FARMING_ISLANDS);
player.sendTo(ServerType.THE_FARMING_ISLANDS);
}, (player) -> player.getSkills().getCurrentLevel(SkillCategories.FARMING) >= 5,
"§cYou must be at least Farming Level V to join this island!",
(player) -> {
Expand All @@ -45,9 +45,9 @@ public enum LaunchPads {
.build();
}
}),
FARMING_TO_VILLAGE(getSlimeBlocksNear(new Pos(111, 71, -202)), ServerType.FARMING_ISLANDS,
FARMING_TO_VILLAGE(getSlimeBlocksNear(new Pos(111, 71, -202)), ServerType.THE_FARMING_ISLANDS,
new Pos(74, 72, -180), (player) -> {
player.sendTo(ServerType.VILLAGE);
player.sendTo(ServerType.HUB);
}, (player) -> true,
"",
(player) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public enum TravelScrollIslands {
"f151cffdaf303673531a7651b36637cad912ba485643158e548d59b2ead5011",
(unused) -> "Your very own chunk of SkyBlock. Nice housing for your minions.", ServerType.ISLAND),
SKYBLOCK_HUB("hub", "§bSkyBlock Hub", "9c465a5d348c53d473f8115ed8923be416f35149f73ebaf5f2b05e13401e814f", (unused) -> "Where everything happens and anything is possible.",
ServerType.VILLAGE, List.of(TravelScrollType.HUB_CASTLE, TravelScrollType.HUB_MUSEUM, TravelScrollType.HUB_CRYPTS)),
ServerType.HUB, List.of(TravelScrollType.HUB_CASTLE, TravelScrollType.HUB_MUSEUM, TravelScrollType.HUB_CRYPTS)),
;

private final String internalName;
Expand Down
4 changes: 2 additions & 2 deletions loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
</dependency>
<dependency>
<groupId>net.swofty</groupId>
<artifactId>type.village</artifactId>
<artifactId>type.hub</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>net.swofty</groupId>
<artifactId>type.farmingislands</artifactId>
<artifactId>type.thefarmingislands</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<module>spark</module>
<module>loader</module>

<module>type-farmingislands</module>
<module>type-thefarmingislands</module>
<module>type-island</module>
<module>type-village</module>
<module>type-hub</module>

<module>service-auctionhouse</module>
<module>service-bazaar</module>
Expand Down
Loading

0 comments on commit a0fcfe8

Please sign in to comment.