mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-22 08:29:35 +00:00
no change
This commit is contained in:
@@ -18,8 +18,6 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public class TimeCheck extends BukkitRunnable {
|
public class TimeCheck extends BukkitRunnable {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
long time = Bukkit.getWorld("world").getTime();
|
long time = Bukkit.getWorld("world").getTime();
|
||||||
@@ -155,9 +153,7 @@ public class TimeCheck extends BukkitRunnable {
|
|||||||
private void waterPot(Location tempLoc, World world, FileConfiguration config) {
|
private void waterPot(Location tempLoc, World world, FileConfiguration config) {
|
||||||
if(CustomBlock.byAlreadyPlaced(world.getBlockAt(tempLoc)) != null){
|
if(CustomBlock.byAlreadyPlaced(world.getBlockAt(tempLoc)) != null){
|
||||||
if(CustomBlock.byAlreadyPlaced(world.getBlockAt(tempLoc)).getNamespacedID().equalsIgnoreCase(config.getString("config.pot"))){
|
if(CustomBlock.byAlreadyPlaced(world.getBlockAt(tempLoc)).getNamespacedID().equalsIgnoreCase(config.getString("config.pot"))){
|
||||||
|
|
||||||
PacketContainer fakeWater = new PacketContainer(PacketType.Play.Server.ENTITY_HEAD_ROTATION);
|
PacketContainer fakeWater = new PacketContainer(PacketType.Play.Server.ENTITY_HEAD_ROTATION);
|
||||||
|
|
||||||
Bukkit.getScheduler().callSyncMethod(CustomCrops.instance,()->{
|
Bukkit.getScheduler().callSyncMethod(CustomCrops.instance,()->{
|
||||||
CustomBlock.remove(tempLoc);
|
CustomBlock.remove(tempLoc);
|
||||||
CustomBlock.place(config.getString("config.watered-pot"), tempLoc);
|
CustomBlock.place(config.getString("config.watered-pot"), tempLoc);
|
||||||
|
|||||||
@@ -57,7 +57,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class BackUp {
|
|||||||
BackUp.backUp(sprinkler_data,sprinklerBackUp);
|
BackUp.backUp(sprinkler_data,sprinklerBackUp);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
CustomCrops.instance.getLogger().warning("备份发生错误");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class CropManager {
|
|||||||
CropManager.instances = new HashMap<Location, String>();
|
CropManager.instances = new HashMap<Location, String>();
|
||||||
if(data.getConfigurationSection(world) != null){
|
if(data.getConfigurationSection(world) != null){
|
||||||
for (String coordinate : data.getConfigurationSection(world).getKeys(false)) {
|
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);
|
String season = data.getString(world + "." + coordinate);
|
||||||
CropManager.instances.put(tempLocation, season);
|
CropManager.instances.put(tempLocation, season);
|
||||||
}
|
}
|
||||||
@@ -84,20 +84,10 @@ public class CropManager {
|
|||||||
e.printStackTrace();
|
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) {
|
public static void putInstance(Location location, String season) {
|
||||||
CropManager.instances.put(location, season);
|
CropManager.instances.put(location, season);
|
||||||
}
|
}
|
||||||
public HashMap<Location, String> getMap() {
|
|
||||||
return CropManager.instances;
|
|
||||||
}
|
|
||||||
|
|
||||||
//清理无效的农作物
|
//清理无效的农作物
|
||||||
public static void cleanLoadedCache() {
|
public static void cleanLoadedCache() {
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ public class KingdomsXIntegrations {
|
|||||||
KingdomPlayer kp = KingdomPlayer.getKingdomPlayer(player);
|
KingdomPlayer kp = KingdomPlayer.getKingdomPlayer(player);
|
||||||
Land land = Land.getLand(location);
|
Land land = Land.getLand(location);
|
||||||
if (land == null) return false;
|
if (land == null) return false;
|
||||||
|
if (player.isOp()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (land.isClaimed()) {
|
if (land.isClaimed()) {
|
||||||
Kingdom cropKingdom = land.getKingdom();
|
Kingdom cropKingdom = land.getKingdom();
|
||||||
if (kp.getKingdom() != null) {
|
if (kp.getKingdom() != null) {
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ public class WorldGuardIntegrations {
|
|||||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||||
RegionQuery query = container.createQuery();
|
RegionQuery query = container.createQuery();
|
||||||
|
|
||||||
if (!query.testState(BukkitAdapter.adapt(loc), localPlayer, Flags.BUILD)) {
|
return !query.testState(BukkitAdapter.adapt(loc), localPlayer, Flags.BUILD);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
public static boolean checkWGHarvest(Location loc,Player player){
|
public static boolean checkWGHarvest(Location loc,Player player){
|
||||||
|
|
||||||
@@ -28,9 +25,6 @@ public class WorldGuardIntegrations {
|
|||||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||||
RegionQuery query = container.createQuery();
|
RegionQuery query = container.createQuery();
|
||||||
|
|
||||||
if (!query.testState(BukkitAdapter.adapt(loc), localPlayer, Flags.BLOCK_BREAK)) {
|
return !query.testState(BukkitAdapter.adapt(loc), localPlayer, Flags.BLOCK_BREAK);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user