Skip to content

Commit

Permalink
null
Browse files Browse the repository at this point in the history
  • Loading branch information
nullaqua committed Mar 4, 2022
1 parent 610258d commit 4002d7f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 23 deletions.
46 changes: 27 additions & 19 deletions src/main/java/me/lanzhi/bluestarapi/Api/Bluestar.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.lanzhi.bluestarapi.Api;

import me.lanzhi.bluestarapi.BluestarAPI;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
Expand All @@ -22,34 +23,41 @@ public void run()
}
}.runTask(plugin);
}
public static void setBlock(Location location, Material block,String playerName)
public static void setBlock(Location location,Material block,String playerName)
{
if(location.getBlock().getType() == block)
{
return;
}
Material type = location.getBlock().getType();
if (coreProtect==null)
{
coreProtect=getCoreProtect();
}
if(coreProtect!=null)
location.getBlock().setType(block);
new BukkitRunnable()
{
if(type==Material.AIR&&block!=Material.AIR)
{
coreProtect.logPlacement(playerName,location,block,null);
}
else if(type!=Material.AIR&&block==Material.AIR)
{
coreProtect.logRemoval(playerName,location,type,null);
}
else if(type!=Material.AIR)
@Override
public void run()
{
coreProtect.logRemoval(playerName,location,type,null);
coreProtect.logPlacement(playerName,location,block,null);
if (coreProtect==null)
{
coreProtect=getCoreProtect();
}
if(coreProtect!=null)
{
if(type==Material.AIR&&block!=Material.AIR)
{
coreProtect.logPlacement(playerName,location,block,null);
}
else if(type!=Material.AIR&&block==Material.AIR)
{
coreProtect.logRemoval(playerName,location,type,null);
}
else if(type!=Material.AIR)
{
coreProtect.logRemoval(playerName,location,type,null);
coreProtect.logPlacement(playerName,location,block,null);
}
}
}
}
location.getBlock().setType(block);
}.runTaskAsynchronously(BluestarAPI.thisPlugin);
}
private static CoreProtectAPI coreProtect=null;
private static CoreProtectAPI getCoreProtect()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package me.lanzhi.bluestarapi.Api;

import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;

import java.io.File;
import java.io.IOException;

public class yamlConfig extends YamlConfiguration
public class YamlFile extends YamlConfiguration
{
private File file;

public yamlConfig(File file)
public YamlFile(File file)
{
this.file = file;
try
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/me/lanzhi/bluestarapi/BluestarAPI.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package me.lanzhi.bluestarapi;

import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;

public final class BluestarAPI extends JavaPlugin
{
public static Plugin thisPlugin;
@Override
public void onEnable()
{
thisPlugin=BluestarAPI.getProvidingPlugin(BluestarAPI.class);
System.out.println("BluestarAPI已加载");
}
@Override
Expand Down

0 comments on commit 4002d7f

Please sign in to comment.