Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/BreweryTeam/BreweryX into…
Browse files Browse the repository at this point in the history
… snapshot
  • Loading branch information
Jsinco committed Dec 18, 2024
2 parents 6566065 + 65b04f6 commit 104357d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/dre/brewery/Barrel.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ public static boolean create(Block sign, Player player) {
* @param breaker The Player that broke it, or null if not known
* @param dropItems If the items in the barrels inventory should drop to the ground
*/
@Override
public void remove(@Nullable Block broken, @Nullable Player breaker, boolean dropItems) {
BarrelRemoveEvent event = new BarrelRemoveEvent(this, dropItems);
// Listened to by LWCBarrel (IntegrationListener)
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/dre/brewery/BarrelBody.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
import com.dre.brewery.utility.BUtil;
import com.dre.brewery.utility.BoundingBox;
import com.dre.brewery.utility.MaterialUtil;
import com.dre.brewery.utility.MinecraftVersion;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;

/**
* The Blocks that make up a Barrel in the World
Expand All @@ -45,6 +48,15 @@ public BarrelBody(Block spigot, byte signoffset) {
this.spigot = spigot;
this.signoffset = signoffset;
this.bounds = new BoundingBox(0, 0, 0, 0, 0, 0);

if (MinecraftVersion.isFolia()) { // Issues#70
BreweryPlugin.getScheduler().runTask(spigot.getLocation(), () -> {
Block broken = getBrokenBlock(true);
if (broken != null) {
this.remove(broken, null, true);
}
});
}
}

/**
Expand Down Expand Up @@ -201,6 +213,8 @@ public static Block getSpigotOfSign(Block block) {
return block;
}

public abstract void remove(@Nullable Block broken, @Nullable Player breaker, boolean dropItems);

/**
* Regenerate the Barrel Bounds.
*
Expand Down
26 changes: 22 additions & 4 deletions src/main/java/com/dre/brewery/BreweryPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,29 @@ public void onEnable() {
return;
}

// Load objects
DataManager.loadMiscData(dataManager.getBreweryMiscData());
Barrel.getBarrels().addAll(dataManager.getAllBarrels().stream().filter(Objects::nonNull).toList());
BCauldron.getBcauldrons().putAll(dataManager.getAllCauldrons().stream().filter(Objects::nonNull).collect(Collectors.toMap(BCauldron::getBlock, Function.identity())));
BPlayer.getPlayers().putAll(dataManager.getAllPlayers().stream().filter(Objects::nonNull).collect(Collectors.toMap(BPlayer::getUuid, Function.identity())));
Wakeup.getWakeups().addAll(dataManager.getAllWakeups().stream().filter(Objects::nonNull).toList());
Barrel.getBarrels().addAll(dataManager.getAllBarrels()
.stream()
.filter(Objects::nonNull)
.toList());
BCauldron.getBcauldrons().putAll(dataManager.getAllCauldrons().stream()
.filter(Objects::nonNull)
.collect(Collectors.toMap(
BCauldron::getBlock, Function.identity(),
(existing, replacement) -> replacement // Issues#69
)));
BPlayer.getPlayers().putAll(dataManager.getAllPlayers()
.stream()
.filter(Objects::nonNull)
.collect(Collectors.toMap(
BPlayer::getUuid,
Function.identity()
)));
Wakeup.getWakeups().addAll(dataManager.getAllWakeups()
.stream()
.filter(Objects::nonNull)
.toList());


// Setup Metrics
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/languages/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ Help_Create: '&6/brew create <Recipe> [Quality] [Player] &9Create a Brew with op
Help_Give: '&6/brew give <Recipe> [Quality] [Player] &9Alias for /brew create'
Help_Delete: '&6/brew delete &9Deletes the potion in your hand'
Help_Help: '&6/brew help [Page] &9Shows a specific help-page'
Help_Info: '&6/brew info&9 Displays your current Drunkeness and Quality'
Help_InfoOther: '&6/brew info [Player]&9 Displays the current Drunkeness and Quality of [Player]'
Help_Info: '&6/brew info&9 Displays your current Drunkenness and Quality'
Help_InfoOther: '&6/brew info [Player]&9 Displays the current Drunkenness and Quality of [Player]'
Help_Reload: '&6/brew reload &9Reload config'
Help_Configname: '&6/brew ItemName &9Display name of item in hand for the config'
Help_Static: '&6/brew static &9Make Brew static -> No further ageing or distilling'
Help_Set: '&6/brew set <player> <drunkenness> [quality] &9Sets Drunkeness (and Quality) of a Player'
Help_Set: '&6/brew set <player> <drunkenness> [quality] &9Sets Drunkenness (and Quality) of a Player'
Help_UnLabel: '&6/brew unlabel &9Removes the detailled label of a potion'
Help_Seal: '&6/brew seal &9Seal Brews for selling in shops'
Help_Wakeup: '&6/brew wakeup list <Page>&9 Lists all wakeup points'
Expand Down Expand Up @@ -114,5 +114,5 @@ Player_WakeNoPoints: '&cThere are no Wakeup Points!'
Player_WakeNotExist: '&cThe Wakeup Point with the id: &6&v1 &cdoesn''t exist!'
Player_WakeTeleport: 'Teleport to Wakeup Point with the id: &6&v1&f At position: &6&v2 &v3, &v4, &v5'
Player_ShopSealBrew: '&eIt''s recommended to trade/sell &6sealed &eBrews'
Player_Drunkeness: 'Drunkeness'
Player_Drunkeness: 'Drunkenness'
Player_Hangover: 'Your Hangover'

0 comments on commit 104357d

Please sign in to comment.