Skip to content

Commit

Permalink
Cleaned Code
Browse files Browse the repository at this point in the history
  • Loading branch information
XDPXI committed Oct 16, 2024
1 parent 04a5d66 commit 5c426cb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/main/java/dev/xdpxi/xdlib/api/convert.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,63 @@ public class convert {
public static String toString(String convert) {
return convert;
}

public static String toString(int convert) {
return String.valueOf(convert);
}

public static String toString(boolean convert) {
return String.valueOf(convert);
}

public static String toString(float convert) {
return String.valueOf(convert);
}

public static int toInt(String convert) {
return Integer.parseInt(convert);
}

public static int toInt(int convert) {
return convert;
}

public static int toInt(boolean convert) {
return convert ? 1 : 0;
}

public static int toInt(float convert) {
return (int) convert;
}

public static boolean toBoolean(String convert) {
return Boolean.parseBoolean(convert);
}

public static boolean toBoolean(int convert) {
return convert != 0;
}

public static boolean toBoolean(boolean convert) {
return convert;
}

public static boolean toBoolean(float convert) {
return convert != 0.0f;
}

public static float toFloat(String convert) {
return Float.parseFloat(convert);
}

public static float toFloat(int convert) {
return (float) convert;
}

public static float toFloat(boolean convert) {
return convert ? 1.0f : 0.0f;
}

public static float toFloat(float convert) {
return convert;
}
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/dev/xdpxi/xdlib/api/custom.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public static void ItemGroup(String itemGroupID, String modID, Item itemIconID,
}
});
}
public static void AddToItemGroup(String itemGroupID, String modID, List<Item> itemsToAdd) { ItemGroup(itemGroupID, modID, null, itemsToAdd); }

public static void AddToItemGroup(String itemGroupID, String modID, List<Item> itemsToAdd) {
ItemGroup(itemGroupID, modID, null, itemsToAdd);
}

public static Item Item(String itemID, String modID, RegistryKey<ItemGroup> itemGroup) {
itemID = itemID.toLowerCase();
Expand All @@ -46,6 +49,7 @@ public static Item Item(String itemID, String modID, RegistryKey<ItemGroup> item
}
return item;
}

public static Item Item(String itemID, String modID) {
return Item(itemID, modID, null);
}
Expand All @@ -63,6 +67,7 @@ public static BlockItem Block(String blockID, String modID, RegistryKey<ItemGrou
}
return blockItem;
}

public static BlockItem Block(String blockID, String modID) {
return Block(blockID, modID, null);
}
Expand All @@ -79,7 +84,9 @@ public static Item Weapon(String weaponID, String modID, ToolMaterial material,
return weapon;
}

public static Item Weapon(String weaponID, String modID, ToolMaterial material) { return Weapon(weaponID, modID, material, null); }
public static Item Weapon(String weaponID, String modID, ToolMaterial material) {
return Weapon(weaponID, modID, material, null);
}

public static Item Armor(String armorID, String modID, RegistryEntry<ArmorMaterial> armorType, ArmorItem.Type armorPart, RegistryKey<ItemGroup> itemGroup) {
armorID = armorID.toLowerCase();
Expand All @@ -92,5 +99,8 @@ public static Item Armor(String armorID, String modID, RegistryEntry<ArmorMateri
}
return armor;
}
public static Item Armor(String armorID, String modID, RegistryEntry<ArmorMaterial> armorType, ArmorItem.Type armorPart) { return Armor(armorID, modID, armorType, armorPart, null); }

public static Item Armor(String armorID, String modID, RegistryEntry<ArmorMaterial> armorType, ArmorItem.Type armorPart) {
return Armor(armorID, modID, armorType, armorPart, null);
}
}
2 changes: 1 addition & 1 deletion src/main/java/dev/xdpxi/xdlib/plugin/xdlib.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import java.util.UUID;

public final class xdlib extends JavaPlugin implements CommandExecutor {
private final HashMap<UUID, UUID> teleportRequests = new HashMap<>();
private welcomeListener WelcomeListener;
private chatListener ChatListener;
private joinLeaveListener JoinLeaveListener;
private final HashMap<UUID, UUID> teleportRequests = new HashMap<>();

@Override
public void onEnable() {
Expand Down

0 comments on commit 5c426cb

Please sign in to comment.