Skip to content

Commit

Permalink
Version 7.0
Browse files Browse the repository at this point in the history
- Added Configurable Blocks that bouncy balls can bounce on
- Added New Improved Husky Core
- Updated the Edit BouncyBall Menu
- Improved the commands
- Improved the particle system
- Improved the projectile System
- Did a bug recode of the plugin
  • Loading branch information
HuskyDreaming committed Oct 31, 2024
1 parent bdff088 commit e02a101
Show file tree
Hide file tree
Showing 37 changed files with 789 additions and 535 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

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

10 changes: 10 additions & 0 deletions .idea/jarRepositories.xml

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

13 changes: 13 additions & 0 deletions Bouncyballs.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
</autoDetectTypes>
<projectReimportVersion>1</projectReimportVersion>
</configuration>
</facet>
</component>
</module>
7 changes: 6 additions & 1 deletion dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.huskydreaming</groupId>
<artifactId>Bouncyballs</artifactId>
<version>6.4-RELEASE</version>
<version>6.5-RELEASE</version>
<build>
<resources>
<resource>
Expand Down Expand Up @@ -41,6 +41,11 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<snapshots />
<id>github</id>
<url>https://maven.pkg.github.com/huskydreaming/huskycore</url>
</repository>
</repositories>
<dependencies>
<dependency>
Expand Down
24 changes: 10 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.huskydreaming</groupId>
<artifactId>Bouncyballs</artifactId>
<version>6.4-RELEASE</version>
<version>7.0-RELEASE</version>

<properties>
<minecraft.version>1.20.4-R0.1-SNAPSHOT</minecraft.version>
Expand Down Expand Up @@ -55,6 +55,13 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/huskydreaming/huskycore</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<dependencies>
Expand All @@ -65,21 +72,10 @@
<version>${minecraft.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>23.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.huskydreaming</groupId>
<artifactId>HuskyCore</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.minuskube.inv</groupId>
<artifactId>smart-invs</artifactId>
<version>1.2.7</version>
<artifactId>huskycore</artifactId>
<version>1.7-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
59 changes: 31 additions & 28 deletions src/main/java/com/huskydreaming/bouncyball/BouncyBallPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,46 @@
import com.huskydreaming.bouncyball.commands.subcommands.CreateCommand;
import com.huskydreaming.bouncyball.commands.subcommands.GiveCommand;
import com.huskydreaming.bouncyball.commands.subcommands.ReloadCommand;
import com.huskydreaming.bouncyball.handlers.implementations.InventoryHandlerImpl;
import com.huskydreaming.bouncyball.handlers.implementations.LocalizationHandlerImpl;
import com.huskydreaming.bouncyball.handlers.implementations.ParticleHandlerImpl;
import com.huskydreaming.bouncyball.handlers.implementations.ProjectileHandlerImpl;
import com.huskydreaming.bouncyball.handlers.interfaces.InventoryHandler;
import com.huskydreaming.bouncyball.handlers.interfaces.LocalizationHandler;
import com.huskydreaming.bouncyball.handlers.interfaces.ParticleHandler;
import com.huskydreaming.bouncyball.handlers.interfaces.ProjectileHandler;
import com.huskydreaming.bouncyball.listeners.ProjectileListener;
import com.huskydreaming.bouncyball.services.implementations.InventoryServiceImpl;
import com.huskydreaming.bouncyball.services.implementations.LocaleServiceImpl;
import com.huskydreaming.bouncyball.services.implementations.ParticleServiceImpl;
import com.huskydreaming.bouncyball.services.implementations.ProjectileServiceImpl;
import com.huskydreaming.bouncyball.services.interfaces.InventoryService;
import com.huskydreaming.bouncyball.services.interfaces.LocaleService;
import com.huskydreaming.bouncyball.services.interfaces.ParticleService;
import com.huskydreaming.bouncyball.services.interfaces.ProjectileService;
import com.huskydreaming.bouncyball.repositories.implementations.ParticleRepositoryImpl;
import com.huskydreaming.bouncyball.repositories.implementations.ProjectileRepositoryImpl;
import com.huskydreaming.bouncyball.repositories.interfaces.ParticleRepository;
import com.huskydreaming.bouncyball.repositories.interfaces.ProjectileRepository;
import com.huskydreaming.huskycore.HuskyPlugin;
import com.huskydreaming.huskycore.handlers.implementations.DefaultConfigHandlerImpl;
import com.huskydreaming.huskycore.handlers.interfaces.CommandHandler;
import com.huskydreaming.huskycore.handlers.interfaces.DefaultConfigHandler;

public class BouncyBallPlugin extends HuskyPlugin {

@Override
public void onEnable() {
super.onEnable();
public void onInitialize() {
handlerRegistry.register(DefaultConfigHandler.class, new DefaultConfigHandlerImpl());
handlerRegistry.register(LocalizationHandler.class, new LocalizationHandlerImpl());
handlerRegistry.register(InventoryHandler.class, new InventoryHandlerImpl());
handlerRegistry.register(ParticleHandler.class, new ParticleHandlerImpl());
handlerRegistry.register(ProjectileHandler.class, new ProjectileHandlerImpl());

// Register Services
serviceRegistry.register(LocaleService.class, new LocaleServiceImpl());
serviceRegistry.register(InventoryService.class, new InventoryServiceImpl());
serviceRegistry.register(ProjectileService.class, new ProjectileServiceImpl());
serviceRegistry.register(ParticleService.class, new ParticleServiceImpl(this));
serviceRegistry.deserialize(this);
serviceRegistry.provide(ParticleService.class).run(this);

// Register Commands
commandRegistry.setCommandExecutor(new BaseCommand(this));
commandRegistry.add(new CreateCommand(this));
commandRegistry.add(new GiveCommand(this));
commandRegistry.add(new ReloadCommand(this));
commandRegistry.deserialize(this);

registerListeners(new ProjectileListener(this));
repositoryRegistry.register(ParticleRepository.class, new ParticleRepositoryImpl());
repositoryRegistry.register(ProjectileRepository.class, new ProjectileRepositoryImpl());
}

@Override
public void onDisable() {
serviceRegistry.serialize(this);
public void onPostInitialize() {
CommandHandler commandHandler = handlerRegistry.provide(CommandHandler.class);
commandHandler.setCommandExecutor(new BaseCommand(this));
commandHandler.add(new CreateCommand(this));
commandHandler.add(new GiveCommand(this));
commandHandler.add(new ReloadCommand(this));

registerListeners(new ProjectileListener(this));
}
}
Original file line number Diff line number Diff line change
@@ -1,38 +1,49 @@
package com.huskydreaming.bouncyball.commands;

import com.huskydreaming.bouncyball.services.interfaces.InventoryService;
import com.huskydreaming.bouncyball.services.interfaces.ProjectileService;
import com.huskydreaming.bouncyball.pareseables.Locale;
import com.huskydreaming.bouncyball.handlers.interfaces.InventoryHandler;
import com.huskydreaming.bouncyball.enumerations.Locale;
import com.huskydreaming.bouncyball.repositories.interfaces.ProjectileRepository;
import com.huskydreaming.huskycore.HuskyPlugin;
import com.huskydreaming.huskycore.commands.AbstractCommand;
import com.huskydreaming.huskycore.interfaces.Parseable;
import com.huskydreaming.huskycore.commands.abstraction.AbstractCommand;
import com.huskydreaming.huskycore.commands.annotations.CommandAnnotation;
import com.huskydreaming.huskycore.utilities.general.Parseable;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

@CommandAnnotation(label = "bouncyballs")
public class BaseCommand extends AbstractCommand {

private final HuskyPlugin plugin;
private final InventoryService inventoryService;
private final ProjectileService projectileService;
private final InventoryHandler inventoryHandler;
private final ProjectileRepository projectileRepository;

public BaseCommand(HuskyPlugin plugin) {
super("bouncyballs", plugin);

super(plugin);
this.plugin = plugin;
this.inventoryService = plugin.provide(InventoryService.class);
this.projectileService = plugin.provide(ProjectileService.class);
this.inventoryHandler = plugin.provide(InventoryHandler.class);
this.projectileRepository = plugin.provide(ProjectileRepository.class);
}

@Override
public void run(Player player, String[] strings) {
if (projectileService.getProjectileDataMap().isEmpty()) {
player.sendMessage(Locale.NO_BOUNCY_BALLS.prefix());
public void onCommand(CommandSender commandSender, String[] strings) {
if(commandSender instanceof Player player) {
if (projectileRepository.getProjectileDataMap().isEmpty()) {
player.sendMessage(Locale.NO_BOUNCY_BALLS.prefix());
} else {
inventoryHandler.getBouncyBallsInventory(plugin).open(player);
}
} else {
inventoryService.getBouncyBallsInventory(plugin).open(player);
commandSender.sendMessage("You must be a player to run this command");
}
}

@Override
public Parseable getPermissionsLocale() {
public Parseable getUsage() {
return Locale.USAGE;
}

@Override
public Parseable getPermission() {
return Locale.NO_PERMISSIONS;
}
}
Original file line number Diff line number Diff line change
@@ -1,57 +1,39 @@
package com.huskydreaming.bouncyball.commands.subcommands;

import com.huskydreaming.bouncyball.data.projectiles.ProjectileDefault;
import com.huskydreaming.bouncyball.services.interfaces.ParticleService;
import com.huskydreaming.bouncyball.services.interfaces.ProjectileService;
import com.huskydreaming.bouncyball.pareseables.Locale;
import com.huskydreaming.bouncyball.enumerations.Locale;
import com.huskydreaming.bouncyball.repositories.interfaces.ParticleRepository;
import com.huskydreaming.bouncyball.repositories.interfaces.ProjectileRepository;
import com.huskydreaming.huskycore.HuskyPlugin;
import com.huskydreaming.huskycore.commands.Command;
import com.huskydreaming.huskycore.commands.SubCommand;
import org.bukkit.command.ConsoleCommandSender;
import com.huskydreaming.huskycore.commands.annotations.CommandAnnotation;
import com.huskydreaming.huskycore.commands.providers.PlayerCommandProvider;
import org.bukkit.entity.Player;

@Command(label = "create")
public class CreateCommand implements SubCommand {
@CommandAnnotation(label = "create")
public class CreateCommand implements PlayerCommandProvider {

private final ParticleService particleService;
private final ProjectileService projectileService;
private final ParticleRepository particleRepository;
private final ProjectileRepository projectileRepository;

public CreateCommand(HuskyPlugin plugin) {
this.particleService = plugin.provide(ParticleService.class);
this.projectileService = plugin.provide(ProjectileService.class);
this.particleRepository = plugin.provide(ParticleRepository.class);
this.projectileRepository = plugin.provide(ProjectileRepository.class);
}

@Override
public void run(Player player, String[] strings) {
public void onCommand(Player player, String[] strings) {
if (strings.length == 2) {
String string = strings[1].toLowerCase();
if (projectileService.containKey(string.toLowerCase())) {
player.sendMessage(Locale.BOUNCY_BALL_EXISTS.prefix(string));
String projectileName = strings[1].toLowerCase();
if (projectileRepository.hasProjectileData(projectileName)) {
player.sendMessage(Locale.BOUNCY_BALL_EXISTS.prefix(projectileName));
return;
}

ProjectileDefault projectileDefault = ProjectileDefault.DEFAULT;
particleService.addParticle(string, projectileDefault.getParticleData());
projectileService.addProjectile(string, projectileDefault.getProjectileData());
particleRepository.addParticleData(projectileName, projectileDefault.getParticleData());
projectileRepository.addProjectileData(projectileName, projectileDefault.getProjectileData());

player.sendMessage(Locale.BOUNCY_BALL_CREATE.prefix(string));
}
}

@Override
public void run(ConsoleCommandSender sender, String[] strings) {
if (strings.length == 2) {
String string = strings[1].toLowerCase();
if (projectileService.containKey(string.toLowerCase())) {
sender.sendMessage(Locale.BOUNCY_BALL_EXISTS.prefix(string));
return;
}

ProjectileDefault projectileDefault = ProjectileDefault.DEFAULT;
particleService.addParticle(string, projectileDefault.getParticleData());
projectileService.addProjectile(string, projectileDefault.getProjectileData());

sender.sendMessage(Locale.BOUNCY_BALL_CREATE.prefix(string));
player.sendMessage(Locale.BOUNCY_BALL_CREATE.prefix(projectileName));
}
}
}
Loading

0 comments on commit e02a101

Please sign in to comment.