Skip to content

Commit

Permalink
feat: Update legacy to only have legacy features
Browse files Browse the repository at this point in the history
  • Loading branch information
IanTapply22 committed Jun 21, 2024
1 parent d34040a commit c2dec1a
Show file tree
Hide file tree
Showing 38 changed files with 52 additions and 1,979 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.jeqo</groupId>
<artifactId>bloons</artifactId>
<version>2.0.0</version>
<version>1.1.4</version>
<packaging>jar</packaging>

<name>Bloons</name>
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/net/jeqo/bloons/Bloons.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@
import lombok.Getter;
import lombok.Setter;
import net.jeqo.bloons.balloon.BalloonCore;
import net.jeqo.bloons.balloon.multipart.balloon.MultipartBalloon;
import net.jeqo.bloons.balloon.single.SingleBalloon;
import net.jeqo.bloons.commands.manager.CommandCore;
import net.jeqo.bloons.listeners.*;
import net.jeqo.bloons.listeners.multipart.MultipartBalloonPlayerJoinListener;
import net.jeqo.bloons.listeners.multipart.MultipartBalloonPlayerLeaveListener;
import net.jeqo.bloons.listeners.single.SingleBalloonPlayerListener;
import net.jeqo.bloons.utils.UpdateChecker;
import net.jeqo.bloons.logger.Logger;
import net.jeqo.bloons.utils.Metrics;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public final class Bloons extends JavaPlugin {
Expand All @@ -34,9 +30,6 @@ public final class Bloons extends JavaPlugin {
@Getter @Setter
public static HashMap<UUID, String> playerSingleBalloonID = new HashMap<>();

@Getter
public static final Map<UUID, MultipartBalloon> playerMultipartBalloons = new HashMap<>();

@Override
public void onEnable() {
// Create an instance of the plugin
Expand All @@ -56,9 +49,6 @@ public void onEnable() {
getListenerCore().stageListener(new BalloonMenuListener());
getListenerCore().stageListener(new BalloonEntityListener());

getListenerCore().stageListener(new MultipartBalloonPlayerJoinListener());
getListenerCore().stageListener(new MultipartBalloonPlayerLeaveListener());

// Register all handlers
getListenerCore().registerListeners();

Expand Down Expand Up @@ -93,13 +83,6 @@ public void onDisable() {
}
}

if (getPlayerMultipartBalloons() != null) {
// Unregister all multipart balloons
for (MultipartBalloon owner : getPlayerMultipartBalloons().values()) {
owner.destroy();
}
}

// Clear all balloon data if it exists
if (getPlayerSingleBalloons() != null) {
getPlayerSingleBalloons().clear();
Expand Down
54 changes: 1 addition & 53 deletions src/main/java/net/jeqo/bloons/balloon/BalloonCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.Getter;
import lombok.Setter;
import net.jeqo.bloons.Bloons;
import net.jeqo.bloons.balloon.multipart.MultipartBalloonType;
import net.jeqo.bloons.balloon.single.SingleBalloonType;
import net.jeqo.bloons.configuration.ConfigConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
Expand All @@ -16,18 +15,15 @@
@Setter @Getter
public class BalloonCore {
private JavaPlugin plugin;
public ArrayList<MultipartBalloonType> multipartBalloonTypes = new ArrayList<>();
public ArrayList<SingleBalloonType> singleBalloonTypes = new ArrayList<>();

/**
* Creates a new instance of the balloon core manager with preset registered balloons
* @param plugin The plugin instance, type org.bukkit.plugin.java.JavaPlugin
* @param balloons The balloons to register, type java.util.ArrayList<net.jeqo.bloons.balloon.multipart.MultipartBalloonType>
* @param singleBalloons The single balloons to register, type java.util.ArrayList<net.jeqo.bloons.balloon.single.SingleBalloonType>
*/
public BalloonCore(JavaPlugin plugin, ArrayList<MultipartBalloonType> balloons, ArrayList<SingleBalloonType> singleBalloons) {
public BalloonCore(JavaPlugin plugin, ArrayList<SingleBalloonType> singleBalloons) {
this.setPlugin(plugin);
this.setMultipartBalloonTypes(balloons);
this.setSingleBalloonTypes(singleBalloons);
}

Expand All @@ -45,12 +41,8 @@ public BalloonCore(JavaPlugin plugin) {
public void initialize() {

// Clear the current balloons list to reduce memory usage
this.getMultipartBalloonTypes().clear();
getSingleBalloonTypes().clear();

// Set the array to be full of all multipart balloons
this.setMultipartBalloonTypes(ConfigConfiguration.getMultipartBalloons());

// Set the array to be full of all single balloons
this.setSingleBalloonTypes(ConfigConfiguration.getSingleBalloons());
}
Expand All @@ -62,23 +54,6 @@ public void copyExampleBalloons() {
// Save all example files in the balloons folder in /resources
Bloons.getInstance().saveResource("balloons/color_pack_example.yml", false);
Bloons.getInstance().saveResource("balloons/dyeable_example.yml", false);
Bloons.getInstance().saveResource("balloons/multipart_example.yml", false);
}

/**
* Adds a balloon to the registered balloons list
* @param balloon The balloon to add, type net.jeqo.bloons.balloon.multipart.MultipartBalloonType
*/
public void addMultipartBalloon(MultipartBalloonType balloon) {
this.getMultipartBalloonTypes().add(balloon);
}

/**
* Removes a balloon from the registered balloons list
* @param balloon The balloon to remove, type net.jeqo.bloons.balloon.multipart.MultipartBalloonType
*/
public void removeMultipartBalloon(MultipartBalloonType balloon) {
this.getMultipartBalloonTypes().remove(balloon);
}

/**
Expand All @@ -97,24 +72,6 @@ public void removeSingleBalloon(SingleBalloonType balloon) {
this.getSingleBalloonTypes().remove(balloon);
}

/**
* Retrieves a balloon by its ID from the registered balloons list
* @param ID The ID of the balloon, type java.lang.String
* @return The balloon with the specified name, type net.jeqo.bloons.balloon.multipart.MultipartBalloonType/null
*/
public MultipartBalloonType getMultipartBalloonByID(String ID) {
// Loop over every balloon in the registered balloons list
for (MultipartBalloonType balloon : this.getMultipartBalloonTypes()) {
// Check if the balloon's name matches the specified name
if (balloon.getId().equalsIgnoreCase(ID)) {
return balloon;
}
}

// Return null if the balloon is not found
return null;
}

/**
* Retrieves a single balloon by its ID from the registered balloons list
* @param ID The ID of the balloon, type java.lang.String
Expand All @@ -133,15 +90,6 @@ public SingleBalloonType getSingleBalloonByID(String ID) {
return null;
}

/**
* Checks if the registered balloons list contains a balloon with the specified ID
* @param ID The ID of the balloon, type java.lang.String
* @return Whether the balloon is in the registered balloons list, type boolean
*/
public boolean containsMultipartBalloon(String ID) {
return getMultipartBalloonByID(ID) == null;
}

/**
* Checks if the registered balloons list contains a single balloon with the specified ID
* @param ID The ID of the balloon, type java.lang.String
Expand Down

This file was deleted.

Loading

0 comments on commit c2dec1a

Please sign in to comment.