mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-26 02:19:28 +00:00
3.0.0-beta2
This commit is contained in:
@@ -100,6 +100,7 @@ public final class CustomCrops extends JavaPlugin {
|
||||
AdventureUtils.consoleMessage("[CustomCrops] Running on <white>" + Bukkit.getVersion());
|
||||
this.registerCommands();
|
||||
this.loadPlatform();
|
||||
ProtectionLib.hook();
|
||||
|
||||
this.scheduler = new Scheduler(this);
|
||||
this.configManager = new ConfigManager(this);
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
package net.momirealms.customcrops.api;
|
||||
|
||||
import net.momirealms.customcrops.CustomCrops;
|
||||
import net.momirealms.customcrops.api.object.crop.GrowingCrop;
|
||||
import net.momirealms.customcrops.api.object.pot.Pot;
|
||||
import net.momirealms.customcrops.api.object.sprinkler.Sprinkler;
|
||||
import net.momirealms.customcrops.api.object.world.SimpleLocation;
|
||||
import org.bukkit.Location;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CustomCropsAPI {
|
||||
|
||||
@@ -32,4 +38,26 @@ public class CustomCropsAPI {
|
||||
public static CustomCropsAPI getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Pot getPotAt(Location location) {
|
||||
return plugin.getWorldDataManager().getPotData(SimpleLocation.getByBukkitLocation(location));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public GrowingCrop getCropAt(Location location) {
|
||||
return plugin.getWorldDataManager().getCropData(SimpleLocation.getByBukkitLocation(location));
|
||||
}
|
||||
|
||||
public boolean isGreenhouseGlass(Location location) {
|
||||
return plugin.getWorldDataManager().isGreenhouse(SimpleLocation.getByBukkitLocation(location));
|
||||
}
|
||||
|
||||
public boolean hasScarecrowInChunk(Location location) {
|
||||
return plugin.getWorldDataManager().hasScarecrow(SimpleLocation.getByBukkitLocation(location));
|
||||
}
|
||||
|
||||
public Sprinkler getSprinklerAt(Location location) {
|
||||
return plugin.getWorldDataManager().getSprinklerData(SimpleLocation.getByBukkitLocation(location));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,10 +45,8 @@ import net.momirealms.customcrops.api.object.sprinkler.SprinklerConfig;
|
||||
import net.momirealms.customcrops.api.object.wateringcan.WateringCanConfig;
|
||||
import net.momirealms.customcrops.api.object.world.SimpleLocation;
|
||||
import net.momirealms.customcrops.api.util.AdventureUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import net.momirealms.protectionlib.ProtectionLib;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -95,7 +93,7 @@ public class PlatformManager extends Function {
|
||||
public void onPlaceVanilla(BlockPlaceEvent event) {
|
||||
if (event.isCancelled()) return;
|
||||
Block block = event.getBlock();
|
||||
onPlaceSomething(block.getLocation(), block.getType().name());
|
||||
onPlaceSomething(event.getPlayer(), block.getLocation(), block.getType().name(), event);
|
||||
}
|
||||
|
||||
public void onBreakTripWire(Player player, Block block, String id, Cancellable event) {
|
||||
@@ -118,13 +116,14 @@ public class PlatformManager extends Function {
|
||||
onBreakSomething(player, entity.getLocation().getBlock().getLocation(), id, event);
|
||||
}
|
||||
|
||||
public void onPlaceFurniture(Location location, String id) {
|
||||
onPlaceSomething(location, id);
|
||||
public void onPlaceFurniture(Player player, Location location, String id, Cancellable event) {
|
||||
if (event != null && event.isCancelled()) return;
|
||||
onPlaceSomething(player, location, id, event);
|
||||
}
|
||||
|
||||
public void onPlaceBlock(Location location, String id, Cancellable event) {
|
||||
public void onPlaceBlock(Player player, Location location, String id, Cancellable event) {
|
||||
if (event.isCancelled()) return;
|
||||
onPlaceSomething(location, id);
|
||||
onPlaceSomething(player, location, id, event);
|
||||
}
|
||||
|
||||
public void onInteractBlock(PlayerInteractEvent event) {
|
||||
@@ -155,7 +154,7 @@ public class PlatformManager extends Function {
|
||||
|
||||
public void onBreakSomething(Player player, Location location, String id, Cancellable event) {
|
||||
|
||||
if (onBreakGlass(id, location)) {
|
||||
if (onBreakGlass(player, id, location, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -167,26 +166,26 @@ public class PlatformManager extends Function {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onBreakSprinkler(id, location)) {
|
||||
if (onBreakSprinkler(player, id, location, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onBreakScarecrow(id, location)) {
|
||||
if (onBreakScarecrow(player, id, location, event)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlaceSomething(Location location, String id) {
|
||||
public void onPlaceSomething(Player player, Location location, String id, @Nullable Cancellable event) {
|
||||
|
||||
if (onPlaceGlass(id, location)) {
|
||||
if (onPlaceGlass(player, id, location, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onPlacePot(id, location)) {
|
||||
if (onPlacePot(player, id, location, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onPlaceScarecrow(id, location)) {
|
||||
if (onPlaceScarecrow(player, id, location, event)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -196,69 +195,106 @@ public class PlatformManager extends Function {
|
||||
ItemStack item_in_hand = player.getInventory().getItemInMainHand();
|
||||
String item_in_hand_id = plugin.getPlatformInterface().getItemStackID(item_in_hand);
|
||||
|
||||
if (onInteractWithSprinkler(player, location, item_in_hand, item_in_hand_id)) {
|
||||
return;
|
||||
if (ProtectionLib.canBreak(player, location)) {
|
||||
if (onInteractCrop(player, id, location, item_in_hand, item_in_hand_id, event)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (onInteractSprinkler(player, id, location, item_in_hand, item_in_hand_id, event)) {
|
||||
return;
|
||||
}
|
||||
if (ProtectionLib.canPlace(player, location)) {
|
||||
if (onInteractWithSprinkler(player, location, item_in_hand, item_in_hand_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onInteractPot(player, id, location, item_in_hand, item_in_hand_id, event)) {
|
||||
return;
|
||||
}
|
||||
if (onInteractSprinkler(player, id, location, item_in_hand, item_in_hand_id, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onInteractCrop(player, id, location, item_in_hand, item_in_hand_id, event)) {
|
||||
return;
|
||||
}
|
||||
if (onInteractPot(player, id, location, item_in_hand, item_in_hand_id, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onInteractWithWateringCan(player, item_in_hand_id, item_in_hand, id, location)) {
|
||||
return;
|
||||
if (onInteractWithWateringCan(player, item_in_hand_id, item_in_hand, id, location)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean onBreakGlass(String id, Location location) {
|
||||
public boolean onBreakGlass(Player player, String id, Location location, Cancellable event) {
|
||||
if (!id.equals(ConfigManager.greenhouseBlock)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GreenhouseGlassBreakEvent greenhouseGlassBreakEvent = new GreenhouseGlassBreakEvent(player, location);
|
||||
if (greenhouseGlassBreakEvent.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
plugin.getWorldDataManager().removeGreenhouse(SimpleLocation.getByBukkitLocation(location));
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onPlaceGlass(String id, Location location) {
|
||||
public boolean onPlaceGlass(Player player, String id, Location location, Cancellable event) {
|
||||
if (!id.equals(ConfigManager.greenhouseBlock)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GreenhouseGlassPlaceEvent greenhouseGlassPlaceEvent = new GreenhouseGlassPlaceEvent(player, location);
|
||||
Bukkit.getPluginManager().callEvent(greenhouseGlassPlaceEvent);
|
||||
if (greenhouseGlassPlaceEvent.isCancelled()) {
|
||||
if (event != null) event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
plugin.getWorldDataManager().addGreenhouse(SimpleLocation.getByBukkitLocation(location));
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onBreakScarecrow(String id, Location location) {
|
||||
public boolean onBreakScarecrow(Player player, String id, Location location, Cancellable event) {
|
||||
if (!id.equals(ConfigManager.scarecrow)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ScarecrowBreakEvent scarecrowBreakEvent = new ScarecrowBreakEvent(player, location);
|
||||
Bukkit.getPluginManager().callEvent(scarecrowBreakEvent);
|
||||
if (scarecrowBreakEvent.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
plugin.getWorldDataManager().removeScarecrow(SimpleLocation.getByBukkitLocation(location));
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onPlaceScarecrow(String id, Location location) {
|
||||
public boolean onPlaceScarecrow(Player player, String id, Location location, Cancellable event) {
|
||||
if (!id.equals(ConfigManager.scarecrow)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ScarecrowPlaceEvent scarecrowPlaceEvent = new ScarecrowPlaceEvent(player, location);
|
||||
Bukkit.getPluginManager().callEvent(scarecrowPlaceEvent);
|
||||
if (scarecrowPlaceEvent.isCancelled()) {
|
||||
if (event != null) event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
plugin.getWorldDataManager().addScarecrow(SimpleLocation.getByBukkitLocation(location));
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean onPlacePot(String id, Location location) {
|
||||
String pot_id = plugin.getPotManager().getPotKeyByBlockID(id);
|
||||
if (pot_id == null) return false;
|
||||
private boolean onPlacePot(Player player, String id, Location location, Cancellable event) {
|
||||
PotConfig potConfig = plugin.getPotManager().getPotConfigByBlockID(id);
|
||||
if (potConfig == null) return false;
|
||||
|
||||
plugin.getWorldDataManager().addPotData(SimpleLocation.getByBukkitLocation(location), new Pot(pot_id, null, 0));
|
||||
PotPlaceEvent potPlaceEvent = new PotPlaceEvent(player, location, potConfig);
|
||||
Bukkit.getPluginManager().callEvent(potPlaceEvent);
|
||||
if (potPlaceEvent.isCancelled()) {
|
||||
if (event != null) event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
plugin.getWorldDataManager().addPotData(SimpleLocation.getByBukkitLocation(location), new Pot(potConfig.getKey(), null, 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -268,6 +304,13 @@ public class PlatformManager extends Function {
|
||||
return false;
|
||||
}
|
||||
|
||||
SprinklerInteractEvent sprinklerInteractEvent = new SprinklerInteractEvent(player, item_in_hand, location, sprinklerConfig);
|
||||
Bukkit.getPluginManager().callEvent(sprinklerInteractEvent);
|
||||
if (sprinklerInteractEvent.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
outer: {
|
||||
// water
|
||||
PassiveFillMethod[] passiveFillMethods = sprinklerConfig.getPassiveFillMethods();
|
||||
@@ -365,6 +408,11 @@ public class PlatformManager extends Function {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent player from placing sprinkler on furniture
|
||||
if (location.getBlock().getType() == Material.AIR) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Location sprinkler_loc = location.clone().add(0,1,0);
|
||||
if (plugin.getPlatformInterface().detectAnyThing(sprinkler_loc)) return true;
|
||||
|
||||
@@ -393,6 +441,13 @@ public class PlatformManager extends Function {
|
||||
return true;
|
||||
}
|
||||
|
||||
CropInteractEvent cropInteractEvent = new CropInteractEvent(player, item_in_hand, location, cropConfig, stageConfig);
|
||||
Bukkit.getPluginManager().callEvent(cropInteractEvent);
|
||||
if (cropInteractEvent.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item_in_hand_id.equals("AIR")) {
|
||||
Action[] actions = stageConfig.getInteractByHandActions();
|
||||
if (actions != null) {
|
||||
@@ -696,10 +751,18 @@ public class PlatformManager extends Function {
|
||||
}
|
||||
|
||||
public boolean onBreakPot(Player player, String id, Location location, Cancellable event) {
|
||||
if (!plugin.getPotManager().containsPotBlock(id)) {
|
||||
PotConfig potConfig = plugin.getPotManager().getPotConfigByBlockID(id);
|
||||
if (potConfig == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PotBreakEvent potBreakEvent = new PotBreakEvent(player, location, potConfig);
|
||||
Bukkit.getPluginManager().callEvent(potBreakEvent);
|
||||
if (potBreakEvent.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
Location above_loc = location.clone().add(0,1,0);
|
||||
String above_id = plugin.getPlatformInterface().getAnyItemIDAt(above_loc);
|
||||
// has item above
|
||||
@@ -716,11 +779,19 @@ public class PlatformManager extends Function {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean onBreakSprinkler(String id, Location location) {
|
||||
if (plugin.getSprinklerManager().getConfigKeyByItemID(id) == null) {
|
||||
private boolean onBreakSprinkler(Player player, String id, Location location, Cancellable event) {
|
||||
SprinklerConfig sprinklerConfig = plugin.getSprinklerManager().getConfigByItemID(id);
|
||||
if (sprinklerConfig == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SprinklerBreakEvent sprinklerBreakEvent = new SprinklerBreakEvent(player, location, sprinklerConfig);
|
||||
Bukkit.getPluginManager().callEvent(sprinklerBreakEvent);
|
||||
if (sprinklerBreakEvent.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
plugin.getWorldDataManager().removeSprinklerData(SimpleLocation.getByBukkitLocation(location));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -50,12 +50,12 @@ public class ItemsAdderHandler extends Handler {
|
||||
|
||||
@EventHandler
|
||||
public void onPlaceFurniture(FurniturePlaceSuccessEvent event) {
|
||||
platformManager.onPlaceFurniture(event.getBukkitEntity().getLocation().getBlock().getLocation(), event.getNamespacedID());
|
||||
platformManager.onPlaceFurniture(event.getPlayer(), event.getBukkitEntity().getLocation().getBlock().getLocation(), event.getNamespacedID(), null);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlaceCustomBlock(CustomBlockPlaceEvent event) {
|
||||
platformManager.onPlaceBlock(event.getBlock().getLocation(), event.getNamespacedID(), event);
|
||||
platformManager.onPlaceBlock(event.getPlayer(), event.getBlock().getLocation(), event.getNamespacedID(), event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -50,17 +50,17 @@ public class OraxenHandler extends Handler {
|
||||
|
||||
@EventHandler
|
||||
public void onPlaceFurniture(OraxenFurniturePlaceEvent event) {
|
||||
platformManager.onPlaceFurniture(event.getBaseEntity().getLocation().getBlock().getLocation(), event.getMechanic().getItemID());
|
||||
platformManager.onPlaceFurniture(event.getPlayer(), event.getBaseEntity().getLocation().getBlock().getLocation(), event.getMechanic().getItemID(), event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlaceStringBlock(OraxenStringBlockPlaceEvent event) {
|
||||
platformManager.onPlaceBlock(event.getBlock().getLocation(), event.getMechanic().getItemID(), event);
|
||||
platformManager.onPlaceBlock(event.getPlayer(), event.getBlock().getLocation(), event.getMechanic().getItemID(), event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlaceNoteBlock(OraxenNoteBlockPlaceEvent event) {
|
||||
platformManager.onPlaceBlock(event.getBlock().getLocation(), event.getMechanic().getItemID(), event);
|
||||
platformManager.onPlaceBlock(event.getPlayer(), event.getBlock().getLocation(), event.getMechanic().getItemID(), event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.object.crop.CropConfig;
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.object.crop.CropConfig;
|
||||
import net.momirealms.customcrops.api.object.crop.StageConfig;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CropInteractEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Location location;
|
||||
private final StageConfig stageConfig;
|
||||
private final CropConfig cropConfig;
|
||||
private final ItemStack hand;
|
||||
|
||||
public CropInteractEvent(@NotNull Player who, ItemStack hand, Location location, CropConfig cropConfig, StageConfig stageConfig) {
|
||||
super(who);
|
||||
this.stageConfig = stageConfig;
|
||||
this.location = location;
|
||||
this.cropConfig = cropConfig;
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public StageConfig getStageConfig() {
|
||||
return stageConfig;
|
||||
}
|
||||
|
||||
public CropConfig getCropConfig() {
|
||||
return cropConfig;
|
||||
}
|
||||
|
||||
public ItemStack getHand() {
|
||||
return hand;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class GreenhouseGlassBreakEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Location location;
|
||||
|
||||
public GreenhouseGlassBreakEvent(@NotNull Player who, Location location) {
|
||||
super(who);
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class GreenhouseGlassPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Location location;
|
||||
|
||||
public GreenhouseGlassPlaceEvent(@NotNull Player who, Location location) {
|
||||
super(who);
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.object.pot.PotConfig;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PotBreakEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Location location;
|
||||
private final PotConfig potConfig;
|
||||
|
||||
public PotBreakEvent(@NotNull Player who, Location location, PotConfig potConfig) {
|
||||
super(who);
|
||||
this.location = location;
|
||||
this.potConfig = potConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public PotConfig getPotConfig() {
|
||||
return potConfig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.object.pot.PotConfig;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PotPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Location location;
|
||||
private final PotConfig potConfig;
|
||||
|
||||
public PotPlaceEvent(@NotNull Player who, Location location, PotConfig potConfig) {
|
||||
super(who);
|
||||
this.location = location;
|
||||
this.potConfig = potConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public PotConfig getPotConfig() {
|
||||
return potConfig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ScarecrowBreakEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Location location;
|
||||
|
||||
public ScarecrowBreakEvent(@NotNull Player who, Location location) {
|
||||
super(who);
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ScarecrowPlaceEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Location location;
|
||||
|
||||
public ScarecrowPlaceEvent(@NotNull Player who, Location location) {
|
||||
super(who);
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.object.sprinkler.SprinklerConfig;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SprinklerBreakEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Location location;
|
||||
private final SprinklerConfig sprinklerConfig;
|
||||
|
||||
public SprinklerBreakEvent(@NotNull Player who, Location location, SprinklerConfig sprinklerConfig) {
|
||||
super(who);
|
||||
this.location = location;
|
||||
this.sprinklerConfig = sprinklerConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public SprinklerConfig getSprinklerConfig() {
|
||||
return sprinklerConfig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.object.sprinkler.SprinklerConfig;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SprinklerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Location location;
|
||||
private final SprinklerConfig sprinklerConfig;
|
||||
private final ItemStack hand;
|
||||
|
||||
public SprinklerInteractEvent(@NotNull Player who, ItemStack hand, Location location, SprinklerConfig sprinklerConfig) {
|
||||
super(who);
|
||||
this.location = location;
|
||||
this.sprinklerConfig = sprinklerConfig;
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public SprinklerConfig getSprinklerConfig() {
|
||||
return sprinklerConfig;
|
||||
}
|
||||
|
||||
public ItemStack getHand() {
|
||||
return hand;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customcrops.api.event;
|
||||
|
||||
import net.momirealms.customcrops.api.object.sprinkler.SprinklerConfig;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CrowAttack implements Condition {
|
||||
public boolean isMet(SimpleLocation simpleLocation) {
|
||||
if (Math.random() > chance) return false;
|
||||
Location location = simpleLocation.getBukkitLocation();
|
||||
if (location == null) return false;
|
||||
if (location == null || CustomCrops.getInstance().getWorldDataManager().hasScarecrow(simpleLocation)) return false;
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
SimpleLocation playerLoc = SimpleLocation.getByBukkitLocation(player.getLocation());
|
||||
if (playerLoc.isNear(simpleLocation, 48)) {
|
||||
|
||||
@@ -109,6 +109,7 @@ public class CropManager extends Function implements Listener {
|
||||
int parsed = Integer.parseInt(point);
|
||||
String stageModel = pointSec.getString(point + ".model");
|
||||
StageConfig stageConfig = new StageConfig(
|
||||
parsed,
|
||||
stageModel,
|
||||
ConfigUtils.getActions(pointSec.getConfigurationSection(point + ".events.break"), stageModel),
|
||||
ConfigUtils.getActions(pointSec.getConfigurationSection(point + ".events.grow"), stageModel),
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class StageConfig {
|
||||
|
||||
private final int point;
|
||||
private final String model;
|
||||
private final Action[] breakActions;
|
||||
private final InteractWithItem[] interactActions;
|
||||
@@ -30,7 +31,8 @@ public class StageConfig {
|
||||
private final Action[] interactByHandActions;
|
||||
private final double offsetCorrection;
|
||||
|
||||
public StageConfig(@Nullable String model, @Nullable Action[] breakActions, @Nullable Action[] growActions, @Nullable InteractWithItem[] interactActions, @Nullable Action[] interactByHandActions, double offsetCorrection) {
|
||||
public StageConfig(int point, @Nullable String model, @Nullable Action[] breakActions, @Nullable Action[] growActions, @Nullable InteractWithItem[] interactActions, @Nullable Action[] interactByHandActions, double offsetCorrection) {
|
||||
this.point = point;
|
||||
this.breakActions = breakActions;
|
||||
this.interactActions = interactActions;
|
||||
this.growActions = growActions;
|
||||
@@ -67,4 +69,8 @@ public class StageConfig {
|
||||
public double getOffsetCorrection() {
|
||||
return offsetCorrection;
|
||||
}
|
||||
|
||||
public int getPoint() {
|
||||
return point;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,6 @@
|
||||
package net.momirealms.customcrops.api.object.hologram;
|
||||
|
||||
public class TextDisplayMeta {
|
||||
public record TextDisplayMeta(boolean hasShadow, boolean isSeeThrough, boolean useDefaultBackground,
|
||||
int backgroundColor, byte opacity) {
|
||||
|
||||
private final boolean hasShadow;
|
||||
private final boolean isSeeThrough;
|
||||
private final boolean useDefaultBackground;
|
||||
private final int backgroundColor;
|
||||
private final byte opacity;
|
||||
|
||||
public TextDisplayMeta(boolean hasShadow, boolean isSeeThrough, boolean useDefaultBackground, int backgroundColor, byte opacity) {
|
||||
this.hasShadow = hasShadow;
|
||||
this.isSeeThrough = isSeeThrough;
|
||||
this.useDefaultBackground = useDefaultBackground;
|
||||
this.backgroundColor = backgroundColor;
|
||||
this.opacity = opacity;
|
||||
}
|
||||
|
||||
public boolean isHasShadow() {
|
||||
return hasShadow;
|
||||
}
|
||||
|
||||
public boolean isSeeThrough() {
|
||||
return isSeeThrough;
|
||||
}
|
||||
|
||||
public boolean isUseDefaultBackground() {
|
||||
return useDefaultBackground;
|
||||
}
|
||||
|
||||
public int getBackgroundColor() {
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
public byte getOpacity() {
|
||||
return opacity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.HashMap;
|
||||
|
||||
public class PotConfig {
|
||||
|
||||
private final String key;
|
||||
private final HashMap<FertilizerType, Pair<String, String>> fertilizerConvertMap;
|
||||
private final int max_storage;
|
||||
private final Pair<String, String> pot;
|
||||
@@ -40,11 +41,12 @@ public class PotConfig {
|
||||
private final WaterAmountHologram waterAmountHologram;
|
||||
private final String requiredItem;
|
||||
|
||||
public PotConfig(int max_storage, String dry_pot, String wet_pot, boolean enableFertilized,
|
||||
public PotConfig(String key, int max_storage, String dry_pot, String wet_pot, boolean enableFertilized,
|
||||
@NotNull PassiveFillMethod[] passiveFillMethods,
|
||||
@Nullable FertilizerHologram fertilizerHologram,
|
||||
@Nullable WaterAmountHologram waterAmountHologram,
|
||||
String requiredItem) {
|
||||
this.key = key;
|
||||
this.max_storage = max_storage;
|
||||
this.pot = Pair.of(dry_pot, wet_pot);
|
||||
this.enableFertilized = enableFertilized;
|
||||
@@ -102,4 +104,9 @@ public class PotConfig {
|
||||
public String getRequiredItem() {
|
||||
return requiredItem;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ public class PotManager extends Function {
|
||||
blockToPotKey.put(base_wet, key);
|
||||
blockToPotKey.put(base_dry, key);
|
||||
PotConfig potConfig = new PotConfig(
|
||||
key,
|
||||
section.getInt("max-water-storage"),
|
||||
base_dry,
|
||||
base_wet,
|
||||
|
||||
@@ -139,13 +139,13 @@ public class FakeEntityUtils {
|
||||
metaPacket.getModifier().write(0, id);
|
||||
WrappedDataWatcher wrappedDataWatcher = new WrappedDataWatcher();
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(22, WrappedDataWatcher.Registry.getChatComponentSerializer(false)), WrappedChatComponent.fromJson(GsonComponentSerializer.gson().serialize(component)));
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(24, WrappedDataWatcher.Registry.get(Integer.class)), textDisplayMeta.getBackgroundColor());
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(24, WrappedDataWatcher.Registry.get(Integer.class)), textDisplayMeta.backgroundColor());
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(14, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 3);
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(25, WrappedDataWatcher.Registry.get(Byte.class)), textDisplayMeta.getOpacity());
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(25, WrappedDataWatcher.Registry.get(Byte.class)), textDisplayMeta.opacity());
|
||||
int mask = 0;
|
||||
if (textDisplayMeta.isHasShadow()) mask += 1;
|
||||
if (textDisplayMeta.hasShadow()) mask += 1;
|
||||
if (textDisplayMeta.isSeeThrough()) mask += 2;
|
||||
if (textDisplayMeta.isUseDefaultBackground()) mask += 4;
|
||||
if (textDisplayMeta.useDefaultBackground()) mask += 4;
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(26, WrappedDataWatcher.Registry.get(Byte.class)), (byte) mask);
|
||||
setWrappedDataValue(metaPacket, wrappedDataWatcher);
|
||||
return metaPacket;
|
||||
|
||||
Reference in New Issue
Block a user