9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-21 16:09:21 +00:00

no change

This commit is contained in:
Xiao-MoMi
2022-05-22 19:46:48 +08:00
parent 9fe67dd7cc
commit eb97f1e8fc
6 changed files with 8 additions and 25 deletions

View File

@@ -18,8 +18,6 @@ import java.util.Objects;
public class TimeCheck extends BukkitRunnable {
@Override
public void run() {
long time = Bukkit.getWorld("world").getTime();
@@ -155,9 +153,7 @@ public class TimeCheck extends BukkitRunnable {
private void waterPot(Location tempLoc, World world, FileConfiguration config) {
if(CustomBlock.byAlreadyPlaced(world.getBlockAt(tempLoc)) != null){
if(CustomBlock.byAlreadyPlaced(world.getBlockAt(tempLoc)).getNamespacedID().equalsIgnoreCase(config.getString("config.pot"))){
PacketContainer fakeWater = new PacketContainer(PacketType.Play.Server.ENTITY_HEAD_ROTATION);
Bukkit.getScheduler().callSyncMethod(CustomCrops.instance,()->{
CustomBlock.remove(tempLoc);
CustomBlock.place(config.getString("config.watered-pot"), tempLoc);

View File

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

View File

@@ -25,6 +25,7 @@ public class BackUp {
BackUp.backUp(sprinkler_data,sprinklerBackUp);
} catch (IOException e) {
e.printStackTrace();
CustomCrops.instance.getLogger().warning("备份发生错误");
}
}

View File

@@ -25,7 +25,7 @@ public class CropManager {
CropManager.instances = new HashMap<Location, String>();
if(data.getConfigurationSection(world) != null){
for (String coordinate : data.getConfigurationSection(world).getKeys(false)) {
Location tempLocation = new Location(Bukkit.getWorld(world), (double)Integer.parseInt(coordinate.split(",")[0]), (double)Integer.parseInt(coordinate.split(",")[1]), (double)Integer.parseInt(coordinate.split(",")[2]));
Location tempLocation = new Location(Bukkit.getWorld(world), Integer.parseInt(coordinate.split(",")[0]), Integer.parseInt(coordinate.split(",")[1]), Integer.parseInt(coordinate.split(",")[2]));
String season = data.getString(world + "." + coordinate);
CropManager.instances.put(tempLocation, season);
}
@@ -84,20 +84,10 @@ public class CropManager {
e.printStackTrace();
}
}
//test
public static void testData(){
for(int i = 1; i < 100000;i++){
Location tempLoc = new Location(Bukkit.getWorld("world"),i,100,i);
String name = "1";
instances.put(tempLoc, name);
}
}
public static void putInstance(Location location, String season) {
CropManager.instances.put(location, season);
}
public HashMap<Location, String> getMap() {
return CropManager.instances;
}
//清理无效的农作物
public static void cleanLoadedCache() {

View File

@@ -11,6 +11,9 @@ public class KingdomsXIntegrations {
KingdomPlayer kp = KingdomPlayer.getKingdomPlayer(player);
Land land = Land.getLand(location);
if (land == null) return false;
if (player.isOp()) {
return false;
}
if (land.isClaimed()) {
Kingdom cropKingdom = land.getKingdom();
if (kp.getKingdom() != null) {

View File

@@ -17,10 +17,7 @@ public class WorldGuardIntegrations {
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
if (!query.testState(BukkitAdapter.adapt(loc), localPlayer, Flags.BUILD)) {
return true;
}
return false;
return !query.testState(BukkitAdapter.adapt(loc), localPlayer, Flags.BUILD);
}
public static boolean checkWGHarvest(Location loc,Player player){
@@ -28,9 +25,6 @@ public class WorldGuardIntegrations {
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
if (!query.testState(BukkitAdapter.adapt(loc), localPlayer, Flags.BLOCK_BREAK)) {
return true;
}
return false;
return !query.testState(BukkitAdapter.adapt(loc), localPlayer, Flags.BLOCK_BREAK);
}
}