mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Small refactoring
This commit is contained in:
parent
dd159184a4
commit
c93c6cfa68
17
pom.xml
17
pom.xml
@ -28,10 +28,18 @@
|
||||
</properties>
|
||||
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<system>GitHub Issues</system>
|
||||
<url>https://github.com/TheBusyBiscuit/Slimefun4/issues</url>
|
||||
</issueManagement>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GNU General Public License v3.0</name>
|
||||
<url>https://github.com/TheBusyBiscuit/Slimefun4/blob/master/LICENSE</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>paper-repo</id>
|
||||
@ -73,8 +81,8 @@
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<!-- package info files are only important to the Javadocs -->
|
||||
<!-- We can exclude them from the final jar -->
|
||||
<!-- package info files are only important for Javadocs -->
|
||||
<!-- We can safely exclude them from the final jar -->
|
||||
<exclude>**/package-info.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
@ -174,6 +182,7 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Javadocs Settings -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
@ -226,7 +235,7 @@
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Resources we want to include, such as configs or language files -->
|
||||
<!-- Resources we want to include, e.g. configs or language files -->
|
||||
<resource>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
|
@ -130,10 +130,6 @@ public class SlimefunRegistry {
|
||||
return enabledItems;
|
||||
}
|
||||
|
||||
public int countNonAddonItems() {
|
||||
return (int) getEnabledSlimefunItems().stream().filter(item -> !item.isAddonItem()).count();
|
||||
}
|
||||
|
||||
public List<Research> getResearches() {
|
||||
return researches;
|
||||
}
|
||||
|
@ -87,13 +87,13 @@ public final class PostSetup {
|
||||
CommandSender sender = Bukkit.getConsoleSender();
|
||||
|
||||
int total = SlimefunPlugin.getRegistry().getEnabledSlimefunItems().size();
|
||||
int vanilla = SlimefunPlugin.getRegistry().countNonAddonItems();
|
||||
int slimefunOnly = countNonAddonItems();
|
||||
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(ChatColor.GREEN + "######################### - Slimefun v" + SlimefunPlugin.getVersion() + " - #########################");
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(ChatColor.GREEN + "Successfully loaded " + total + " Items and " + SlimefunPlugin.getRegistry().getResearches().size() + " Researches");
|
||||
sender.sendMessage(ChatColor.GREEN + "( " + vanilla + " Items from Slimefun, " + (total - vanilla) + " Items from " + SlimefunPlugin.getInstalledAddons().size() + " Addons )");
|
||||
sender.sendMessage(ChatColor.GREEN + "( " + slimefunOnly + " Items from Slimefun, " + (total - slimefunOnly) + " Items from " + SlimefunPlugin.getInstalledAddons().size() + " Addons )");
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(ChatColor.GREEN + "Slimefun is an Open-Source project that is kept alive by a large community.");
|
||||
sender.sendMessage(ChatColor.GREEN + "Consider helping us maintain this project by contributing on GitHub!");
|
||||
@ -117,6 +117,10 @@ public final class PostSetup {
|
||||
SlimefunPlugin.getRegistry().setAutoLoadingMode(true);
|
||||
}
|
||||
|
||||
private static int countNonAddonItems() {
|
||||
return (int) SlimefunPlugin.getRegistry().getEnabledSlimefunItems().stream().filter(item -> item.getAddon() instanceof SlimefunPlugin).count();
|
||||
}
|
||||
|
||||
private static void loadAutomaticCraftingChamber() {
|
||||
AutomatedCraftingChamber crafter = (AutomatedCraftingChamber) SlimefunItems.AUTOMATED_CRAFTING_CHAMBER.getItem();
|
||||
|
||||
|
@ -275,15 +275,6 @@ public class SlimefunItem implements Placeable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns whether this {@link SlimefunItem} was added by an addon.
|
||||
*
|
||||
* @return Whether this {@link SlimefunItem} was added by an addon.
|
||||
*/
|
||||
public final boolean isAddonItem() {
|
||||
return !(addon instanceof SlimefunPlugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns whether this {@link SlimefunItem} is disabled.
|
||||
*
|
||||
|
@ -103,7 +103,7 @@ import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu;
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
*/
|
||||
public class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
|
||||
public static SlimefunPlugin instance;
|
||||
|
||||
|
@ -48,7 +48,6 @@ public class TestSlimefunItemRegistration {
|
||||
Assertions.assertEquals(ItemState.ENABLED, item.getState());
|
||||
Assertions.assertFalse(item.isDisabled());
|
||||
Assertions.assertEquals(id, item.getID());
|
||||
Assertions.assertFalse(item.isAddonItem());
|
||||
Assertions.assertEquals(item, SlimefunItem.getByID(id));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user