9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-22 16:39:36 +00:00
This commit is contained in:
Xiao-MoMi
2022-05-26 00:29:14 +08:00
6 changed files with 10 additions and 16 deletions

View File

@@ -1 +1,3 @@
MCBBS发布帖: https://www.mcbbs.net/thread-1342178-1-1.html MCBBS发布帖: https://www.mcbbs.net/thread-1342178-1-1.html
MineDown: https://github.com/Phoenix616/MineDown

View File

@@ -93,7 +93,7 @@
<relocations> <relocations>
<relocation> <relocation>
<pattern>de.themoep.minedown</pattern> <pattern>de.themoep.minedown</pattern>
<shadedPattern>net.momirealms.customcrops.libraries.minedown</shadedPattern> <shadedPattern>net.momirealms.customcrops.Libs.minedown</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
</configuration> </configuration>

View File

@@ -54,7 +54,6 @@ public final class CustomCrops extends JavaPlugin {
List<WrappedChatComponent> components = packet.getChatComponents().getValues(); List<WrappedChatComponent> components = packet.getChatComponents().getValues();
for (WrappedChatComponent component : components) { for (WrappedChatComponent component : components) {
if(component.toString().contains("Ender Chest")){ if(component.toString().contains("Ender Chest")){
//component.setJson("{\"text\":\"收纳袋\"}");
component.setJson("{\"translate\":\"container.enderchest\"}"); component.setJson("{\"translate\":\"container.enderchest\"}");
packet.getChatComponents().write(components.indexOf(component), component); packet.getChatComponents().write(components.indexOf(component), component);
} }

View File

@@ -10,7 +10,6 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
public class BackUp { public class BackUp {
public static void backUpData(){ public static void backUpData(){
Date date = new Date(); Date date = new Date();
@@ -23,11 +22,13 @@ public class BackUp {
try { try {
BackUp.backUp(crop_data,cropBackUp); BackUp.backUp(crop_data,cropBackUp);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
try { try {
BackUp.backUp(sprinkler_data,sprinklerBackUp); BackUp.backUp(sprinkler_data,sprinklerBackUp);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@@ -3,15 +3,13 @@ package net.momirealms.customcrops.DataManager;
import dev.lone.itemsadder.api.CustomBlock; import dev.lone.itemsadder.api.CustomBlock;
import net.momirealms.customcrops.CustomCrops; import net.momirealms.customcrops.CustomCrops;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
public class MaxCropsPerChunk { public class MaxCropsPerChunk {
static FileConfiguration config = CustomCrops.instance.getConfig();
public static boolean maxCropsPerChunk(Location location){ public static boolean maxCropsPerChunk(Location location){
FileConfiguration config = CustomCrops.instance.getConfig();
if(!config.getBoolean("config.enable-limit")){ if(!config.getBoolean("config.enable-limit")){
return false; return false;
} }
@@ -26,10 +24,10 @@ public class MaxCropsPerChunk {
Label_out: Label_out:
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) { for (int j = 0; j < 16; ++j) {
Location square = chunkLocation.clone().add(i, 0.0, j); final Location square = chunkLocation.clone().add((double)i, 0.0, (double)j);
for (int k = minY; k <= maxY; ++k) { for (int k = minY; k <= maxY; ++k) {
square.add(0.0, 1.0, 0.0); square.add(0.0, 1.0, 0.0);
Block b = location.getWorld().getBlockAt(square); Blcok b = location.getWorld().getBlcokAt(square);
if(CustomBlock.byAlreadyPlaced(b)!= null){ if(CustomBlock.byAlreadyPlaced(b)!= null){
if (CustomBlock.byAlreadyPlaced(b).getNamespacedID().contains("stage")) { if (CustomBlock.byAlreadyPlaced(b).getNamespacedID().contains("stage")) {
if (n++ > maxAmount) { if (n++ > maxAmount) {

View File

@@ -7,11 +7,8 @@ import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
public class MaxSprinklersPerChunk { public class MaxSprinklersPerChunk {
static FileConfiguration config = CustomCrops.instance.getConfig();
public static boolean maxSprinklersPerChunk(Location location){ public static boolean maxSprinklersPerChunk(Location location){
FileConfiguration config = CustomCrops.instance.getConfig();
if(!config.getBoolean("config.enable-limit")){ if(!config.getBoolean("config.enable-limit")){
return false; return false;
} }
@@ -27,7 +24,7 @@ public class MaxSprinklersPerChunk {
Label_out: Label_out:
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) { for (int j = 0; j < 16; ++j) {
Location square = chunkLocation.clone().add(i+0.5, 0.5, j+0.5); final Location square = chunkLocation.clone().add((double)(i+0.5), 0.5, (double)(j+0.5));
for (int k = minY; k <= maxY; ++k) { for (int k = minY; k <= maxY; ++k) {
square.add(0.0, 1.0, 0.0); square.add(0.0, 1.0, 0.0);
if(IAFurniture.getFromLocation(square, world)){ if(IAFurniture.getFromLocation(square, world)){
@@ -40,7 +37,4 @@ public class MaxSprinklersPerChunk {
} }
return n > maxAmount; return n > maxAmount;
} }
public static boolean alreadyPlaced(Location location){
return IAFurniture.getFromLocation(location.clone().add(0.5, 1.5, 0.5), location.getWorld());
}
} }