mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Merge branch 'master' of https://github.com/TheBusyBiscuit/Slimefun4
This commit is contained in:
commit
e98c66544f
33
.github/CONTRIBUTING.md
vendored
33
.github/CONTRIBUTING.md
vendored
@ -3,18 +3,27 @@
|
||||
Slimefun is a community project, everyone is welcome to open Issues, make Pull Requests or make Pull Requests for an opened Issue.
|
||||
Without your help, this project is going to die.
|
||||
|
||||
## General Guidelines
|
||||
|
||||
Rules for all types of posts:
|
||||
|
||||
1. Follow our Templates for Issues and Pull Request, they are designed to tell you what exact Information we need and how you should present it to us.
|
||||
2. Be nice and give constructive critism. Insulting, Harassment, Racism, Sexism or any form of bullying or discrimination is not tolerated.
|
||||
3. Try to engage in conversations by pointing out scenarios to replicate Issues, providing fix approaches or other kind of help.
|
||||
4. Advertisement is inappropriate and will be removed, especially advertisement for Minecraft Servers is completely unaccepted.
|
||||
|
||||
## GitHub Issues
|
||||
|
||||
Rules for posting an Issue on GitHub:
|
||||
|
||||
1. This Issue Section is ONLY for Slimefun-related Issues, Issues about other Plugins or Slimefun Addons should not be posted here.
|
||||
2. Check other Issues before posting to make sure you are not posting a duplicate.
|
||||
3. Do not put any Tags inside your title like [IMPORTANT], [URGENT] or [SUGGESTION].
|
||||
Try to be professional by making your title as short as possible, we will assign it the required labels if necessary.
|
||||
4. Do not post your Issue more than once, this is considered spam and does not benefit our community in any way.
|
||||
Do not repost your Issue if it was closed either.
|
||||
5. Give us all available information right away, it may be a bit of time-wasting for us to keep asking for more Info.
|
||||
3. Do not put any Tags inside your title like [IMPORTANT], [URGENT] or [SUGGESTION]. Try to be professional by making your title as short as possible, we will assign it the required labels if necessary.
|
||||
4. Do not post your Issue more than once, this is considered spam and does not benefit our community in any way. Do not repost your Issue if it was closed either.
|
||||
5. Give us all available information right away, it may be a bit of time-wasting for us to keep asking for more Info. And this includes any Information to reproduce your Issue step-by-step.
|
||||
6. Check whether there are newer versions available than the ones you are using, it might be that your Issue has been fixed already.
|
||||
7. All text logs must be posted via a link to http://pastebin.com or similiar websites.
|
||||
8. Please read the [FAQ Section](#frequently-asked-questions) before posting.
|
||||
|
||||
Your Issue will be CLOSED WITHOUT WARNING if we think you violated these Rules.
|
||||
|
||||
@ -22,9 +31,11 @@ Your Issue will be CLOSED WITHOUT WARNING if we think you violated these Rules.
|
||||
|
||||
Guidelines for making a Pull Request on GitHub:
|
||||
|
||||
1. Try to be reasonable with your additions.
|
||||
No, a Bacon flavoured unicorn that flies on a rainbow while dancing Gangnam Style is NOT a reasonable addition to this Project.
|
||||
2. Try to make your values configurable in the config.yml / Items.yml or any additional file.
|
||||
This may not be necessary at every instance but it does give the end-users a way to customize their experience.
|
||||
3. If your Pull Request is made in response to an Issue opened on GitHub,
|
||||
comment on that Issue and reference your Pull Request to show that you are proposing a fix for it.
|
||||
1. Try to be reasonable with your additions. No, a Bacon flavoured unicorn that flies on a rainbow while dancing Gangnam Style is NOT a reasonable addition to this Project.
|
||||
2. Try to make your values configurable in the config.yml / Items.yml or any additional file. This may not be necessary at every instance but it does give the end-users a way to customize their experience.
|
||||
3. If your Pull Request is made in response to an Issue opened on GitHub, comment on that Issue and reference your Pull Request to show that you are proposing a fix for it.
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Slimefun does not work!?
|
||||
> Install CS-CoreLib...
|
||||
|
6
.github/ISSUE_TEMPLATE.md
vendored
6
.github/ISSUE_TEMPLATE.md
vendored
@ -10,5 +10,7 @@ Attach as many Screenshots or Videos if possible.
|
||||
Anything that helps us understand the Issue better, is gonna get your Issue fixed even faster.
|
||||
|
||||
## Environment
|
||||
State what Version of Minecraft, CS-CoreLib and Slimefun you're using
|
||||
"latest" is not enough, we need the EXACT VERSIONS.
|
||||
We need the EXACT VERSIONS of the Software you are using.
|
||||
This includes your Minecraft Version, your CS-CoreLib version and your Slimefun Version.
|
||||
If you cannot figure out what versions you are running, then please run /sf versions and
|
||||
show us the output of that command.
|
||||
|
@ -1,4 +1,4 @@
|
||||
package me.mrCookieSlime.CSCoreLibSetup;
|
||||
package me.mrCookieSlime.Slimefun.CSCoreLibSetup;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
@ -35,18 +35,17 @@ public class CSCoreLibLoader {
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("CS-CoreLib")) return true;
|
||||
else {
|
||||
System.err.println(" ");
|
||||
System.err.println("#################### - FATAL ERROR - ####################");
|
||||
System.err.println("#################### - INFO - ####################");
|
||||
System.err.println(" ");
|
||||
System.err.println(plugin.getName() + " could not be properly installed!");
|
||||
System.err.println(plugin.getName() + " could not be loaded.");
|
||||
System.err.println("It appears that you have not installed CS-CoreLib");
|
||||
System.err.println("And because of that, CS-CoreLib is now going to be");
|
||||
System.err.println("downloaded and installed.");
|
||||
System.err.println("But for the time being " + plugin.getName() + " will remain disabled");
|
||||
System.err.println("After the installation process has finished,");
|
||||
System.out.println("you will be asked to restart your Server.");
|
||||
System.err.println("- mrCookieSlime");
|
||||
System.err.println("Your Server will now try to download and install");
|
||||
System.err.println("CS-CoreLib for you.");
|
||||
System.err.println("You will be asked to restart your Server when it's finished.");
|
||||
System.err.println("If this somehow fails, please download and install CS-CoreLib manually:");
|
||||
System.err.println("https://dev.bukkit.org/projects/cs-corelib");
|
||||
System.err.println(" ");
|
||||
System.err.println("#################### - FATAL ERROR - ####################");
|
||||
System.err.println("#################### - INFO - ####################");
|
||||
System.err.println(" ");
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@ -74,11 +73,13 @@ public class CSCoreLibLoader {
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
System.err.println(" ");
|
||||
System.err.println("#################### - FATAL ERROR - ####################");
|
||||
System.err.println("#################### - WARNING - ####################");
|
||||
System.err.println(" ");
|
||||
System.err.println("Could not connect to BukkitDev, is it down?");
|
||||
System.err.println("Could not connect to BukkitDev.");
|
||||
System.err.println("Please download & install CS-CoreLib manually:");
|
||||
System.err.println("https://dev.bukkit.org/projects/cs-corelib");
|
||||
System.err.println(" ");
|
||||
System.err.println("#################### - FATAL ERROR - ####################");
|
||||
System.err.println("#################### - WARNING - ####################");
|
||||
System.err.println(" ");
|
||||
return false;
|
||||
}
|
||||
@ -105,7 +106,7 @@ public class CSCoreLibLoader {
|
||||
break;
|
||||
}
|
||||
|
||||
return connection.getURL();
|
||||
return new URL(connection.getURL().toString().replaceAll(" ", "%20"));
|
||||
}
|
||||
|
||||
private void install() {
|
||||
@ -122,23 +123,25 @@ public class CSCoreLibLoader {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.err.println(" ");
|
||||
System.err.println("#################### - FATAL ERROR - ####################");
|
||||
System.err.println("#################### - WARNING - ####################");
|
||||
System.err.println(" ");
|
||||
System.err.println("Could not download CS-CoreLib");
|
||||
System.err.println("Failed to download CS-CoreLib");
|
||||
System.err.println("Please download & install CS-CoreLib manually:");
|
||||
System.err.println("https://dev.bukkit.org/projects/cs-corelib");
|
||||
System.err.println(" ");
|
||||
System.err.println("#################### - FATAL ERROR - ####################");
|
||||
System.err.println("#################### - WARNING - ####################");
|
||||
System.err.println(" ");
|
||||
} finally {
|
||||
try {
|
||||
if (input != null) input.close();
|
||||
if (output != null) output.close();
|
||||
System.err.println(" ");
|
||||
System.err.println("#################### - WARNING - ####################");
|
||||
System.err.println("#################### - INFO - ####################");
|
||||
System.err.println(" ");
|
||||
System.err.println("Please restart your Server to finish the Installation");
|
||||
System.err.println("of " + plugin.getName() + " and CS-CoreLib");
|
||||
System.err.println(" ");
|
||||
System.err.println("#################### - WARNING - ####################");
|
||||
System.err.println("#################### - INFO - ####################");
|
||||
System.err.println(" ");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
@ -18,9 +18,11 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Variable;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Chat.CommandHelp;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Player.Players;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Reflection.ReflectionUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.World.TitleBuilder;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.World.TitleBuilder.TitleType;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunGuide;
|
||||
@ -152,21 +154,34 @@ public class SlimefunCommand implements CommandExecutor, Listener {
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("versions")) {
|
||||
if (sender.hasPermission("slimefun.command.versions")|| sender instanceof ConsoleCommandSender) {
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&a" + Bukkit.getName() + " &2" + ReflectionUtils.getVersion()));
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&aCS-CoreLib &2v" + CSCoreLib.getLib().getDescription().getVersion()));
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&aSlimefun &2v" + plugin.getDescription().getVersion()));
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7&oInstalled Addons:"));
|
||||
|
||||
List<String> addons = new ArrayList<String>();
|
||||
|
||||
for (Plugin plugin: Bukkit.getPluginManager().getPlugins()) {
|
||||
if (plugin.getDescription().getDepend().contains("Slimefun") || plugin.getDescription().getSoftDepend().contains("Slimefun")) {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled(plugin)) {
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', " &a" + plugin.getName() + " &2v" + plugin.getDescription().getVersion()));
|
||||
addons.add(ChatColor.translateAlternateColorCodes('&', " &a" + plugin.getName() + " &2v" + plugin.getDescription().getVersion()));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', " &c" + plugin.getName() + " &4v" + plugin.getDescription().getVersion()));
|
||||
addons.add(ChatColor.translateAlternateColorCodes('&', " &c" + plugin.getName() + " &4v" + plugin.getDescription().getVersion()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7Installed Addons &8(" + addons.size() + ")"));
|
||||
|
||||
for (String addon: addons) {
|
||||
sender.sendMessage(addon);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Messages.local.sendTranslation(sender, "messages.no-permission", true);
|
||||
}
|
||||
else Messages.local.sendTranslation(sender, "messages.no-permission", true);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("give")) {
|
||||
if (args.length == 3) {
|
||||
|
@ -1,26 +1,9 @@
|
||||
package me.mrCookieSlime.Slimefun;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.AutoEnchanter;
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.CoreProtectAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -37,10 +20,9 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.PluginUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Clock;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Reflection.ReflectionUtils;
|
||||
import me.mrCookieSlime.CSCoreLibSetup.CSCoreLibLoader;
|
||||
import me.mrCookieSlime.Slimefun.AncientAltar.Pedestals;
|
||||
import me.mrCookieSlime.Slimefun.CSCoreLibSetup.CSCoreLibLoader;
|
||||
import me.mrCookieSlime.Slimefun.Commands.SlimefunCommand;
|
||||
import me.mrCookieSlime.Slimefun.Commands.SlimefunTabCompleter;
|
||||
import me.mrCookieSlime.Slimefun.GEO.OreGenSystem;
|
||||
@ -55,6 +37,7 @@ import me.mrCookieSlime.Slimefun.Objects.Research;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunArmorPiece;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.AutoEnchanter;
|
||||
import me.mrCookieSlime.Slimefun.Setup.Files;
|
||||
import me.mrCookieSlime.Slimefun.Setup.Messages;
|
||||
import me.mrCookieSlime.Slimefun.Setup.MiscSetup;
|
||||
@ -66,6 +49,7 @@ import me.mrCookieSlime.Slimefun.URID.URID;
|
||||
import me.mrCookieSlime.Slimefun.WorldEdit.WESlimefunManager;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunBackup;
|
||||
import me.mrCookieSlime.Slimefun.api.TickerTask;
|
||||
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
|
||||
import me.mrCookieSlime.Slimefun.api.energy.EnergyNet;
|
||||
@ -89,6 +73,8 @@ import me.mrCookieSlime.Slimefun.listeners.ItemListener;
|
||||
import me.mrCookieSlime.Slimefun.listeners.TalismanListener;
|
||||
import me.mrCookieSlime.Slimefun.listeners.TeleporterListener;
|
||||
import me.mrCookieSlime.Slimefun.listeners.ToolListener;
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.CoreProtectAPI;
|
||||
|
||||
public class SlimefunStartup extends JavaPlugin {
|
||||
|
||||
@ -375,7 +361,7 @@ public class SlimefunStartup extends JavaPlugin {
|
||||
connector.pullFile();
|
||||
}
|
||||
}
|
||||
}, 60L, 20 * 60 * 20L);
|
||||
}, 80L, 60 * 60 * 20L);
|
||||
|
||||
// Hooray!
|
||||
System.out.println("[Slimefun] Finished!");
|
||||
@ -409,109 +395,22 @@ public class SlimefunStartup extends JavaPlugin {
|
||||
public void onDisable() {
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
|
||||
try {
|
||||
for (Map.Entry<Block, Block> entry: ticker.move.entrySet()) {
|
||||
BlockStorage._integrated_moveBlockInfo(entry.getKey(), entry.getValue());
|
||||
}
|
||||
ticker.move.clear();
|
||||
// Finishes all started movements/removals of block data
|
||||
ticker.HALTED = true;
|
||||
ticker.run();
|
||||
|
||||
try {
|
||||
for (World world: Bukkit.getWorlds()) {
|
||||
BlockStorage storage = BlockStorage.getStorage(world);
|
||||
if (storage != null) storage.save(true);
|
||||
else System.err.println("[Slimefun] Could not save Slimefun Blocks for World \"" + world.getName() + "\"");
|
||||
}
|
||||
|
||||
File folder = new File("data-storage/Slimefun/block-backups");
|
||||
List<File> backups = Arrays.asList(folder.listFiles());
|
||||
if (backups.size() > 20) {
|
||||
Collections.sort(backups, new Comparator<File>() {
|
||||
|
||||
@Override
|
||||
public int compare(File f1, File f2) {
|
||||
try {
|
||||
return (int) (new SimpleDateFormat("yyyy-MM-dd-HH-mm").parse(f1.getName().replace(".zip", "")).getTime() - new SimpleDateFormat("yyyy-MM-dd-HH-mm").parse(f2.getName().replace(".zip", "")).getTime());
|
||||
} catch (ParseException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = backups.size() - 20; i > 0; i--) {
|
||||
backups.get(i).delete();
|
||||
if (storage != null) {
|
||||
storage.save(true);
|
||||
}
|
||||
else {
|
||||
System.err.println("[Slimefun] Could not save Slimefun Blocks for World \"" + world.getName() + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
File file = new File("data-storage/Slimefun/block-backups/" + Clock.format(new Date()) + ".zip");
|
||||
byte[] buffer = new byte[1024];
|
||||
|
||||
if (file.exists()) file.delete();
|
||||
|
||||
try {
|
||||
file.createNewFile();
|
||||
|
||||
ZipOutputStream output = new ZipOutputStream(new FileOutputStream(file));
|
||||
|
||||
for (File f1: new File("data-storage/Slimefun/stored-blocks/").listFiles()) {
|
||||
for (File f: f1.listFiles()) {
|
||||
ZipEntry entry = new ZipEntry("stored-blocks/" + f1.getName() + "/" + f.getName());
|
||||
output.putNextEntry(entry);
|
||||
FileInputStream input = new FileInputStream(f);
|
||||
|
||||
int length;
|
||||
while ((length = input.read(buffer)) > 0) {
|
||||
output.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
input.close();
|
||||
output.closeEntry();
|
||||
}
|
||||
}
|
||||
|
||||
for (File f: new File("data-storage/Slimefun/universal-inventories/").listFiles()) {
|
||||
ZipEntry entry = new ZipEntry("universal-inventories/" + f.getName());
|
||||
output.putNextEntry(entry);
|
||||
FileInputStream input = new FileInputStream(f);
|
||||
|
||||
int length;
|
||||
while ((length = input.read(buffer)) > 0) {
|
||||
output.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
input.close();
|
||||
output.closeEntry();
|
||||
}
|
||||
|
||||
for (File f: new File("data-storage/Slimefun/stored-inventories/").listFiles()) {
|
||||
ZipEntry entry = new ZipEntry("stored-inventories/" + f.getName());
|
||||
output.putNextEntry(entry);
|
||||
FileInputStream input = new FileInputStream(f);
|
||||
|
||||
int length;
|
||||
while ((length = input.read(buffer)) > 0) {
|
||||
output.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
input.close();
|
||||
output.closeEntry();
|
||||
}
|
||||
|
||||
ZipEntry entry = new ZipEntry("stored-chunks/chunks.sfc");
|
||||
output.putNextEntry(entry);
|
||||
FileInputStream input = new FileInputStream(new File("data-storage/Slimefun/stored-chunks/chunks.sfc"));
|
||||
|
||||
int length;
|
||||
while ((length = input.read(buffer)) > 0) {
|
||||
output.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
input.close();
|
||||
output.closeEntry();
|
||||
|
||||
output.close();
|
||||
System.out.println("[Slimfun] Backed up Blocks to " + file.getName());
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SlimefunBackup.start();
|
||||
} catch(Exception x) {
|
||||
}
|
||||
|
||||
|
119
src/me/mrCookieSlime/Slimefun/api/SlimefunBackup.java
Normal file
119
src/me/mrCookieSlime/Slimefun/api/SlimefunBackup.java
Normal file
@ -0,0 +1,119 @@
|
||||
package me.mrCookieSlime.Slimefun.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Clock;
|
||||
|
||||
public class SlimefunBackup {
|
||||
|
||||
public static void start() {
|
||||
File folder = new File("data-storage/Slimefun/block-backups");
|
||||
List<File> backups = Arrays.asList(folder.listFiles());
|
||||
if (backups.size() > 20) {
|
||||
Collections.sort(backups, new Comparator<File>() {
|
||||
|
||||
@Override
|
||||
public int compare(File f1, File f2) {
|
||||
try {
|
||||
return (int) (new SimpleDateFormat("yyyy-MM-dd-HH-mm").parse(f1.getName().replace(".zip", "")).getTime() - new SimpleDateFormat("yyyy-MM-dd-HH-mm").parse(f2.getName().replace(".zip", "")).getTime());
|
||||
} catch (ParseException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = backups.size() - 20; i > 0; i--) {
|
||||
backups.get(i).delete();
|
||||
}
|
||||
}
|
||||
|
||||
File file = new File("data-storage/Slimefun/block-backups/" + Clock.format(new Date()) + ".zip");
|
||||
byte[] buffer = new byte[1024];
|
||||
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
try {
|
||||
file.createNewFile();
|
||||
|
||||
ZipOutputStream output = new ZipOutputStream(new FileOutputStream(file));
|
||||
|
||||
for (File f1: new File("data-storage/Slimefun/stored-blocks/").listFiles()) {
|
||||
for (File f: f1.listFiles()) {
|
||||
ZipEntry entry = new ZipEntry("stored-blocks/" + f1.getName() + "/" + f.getName());
|
||||
output.putNextEntry(entry);
|
||||
FileInputStream input = new FileInputStream(f);
|
||||
|
||||
int length;
|
||||
while ((length = input.read(buffer)) > 0) {
|
||||
output.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
input.close();
|
||||
output.closeEntry();
|
||||
}
|
||||
}
|
||||
|
||||
for (File f: new File("data-storage/Slimefun/universal-inventories/").listFiles()) {
|
||||
ZipEntry entry = new ZipEntry("universal-inventories/" + f.getName());
|
||||
output.putNextEntry(entry);
|
||||
FileInputStream input = new FileInputStream(f);
|
||||
|
||||
int length;
|
||||
while ((length = input.read(buffer)) > 0) {
|
||||
output.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
input.close();
|
||||
output.closeEntry();
|
||||
}
|
||||
|
||||
for (File f: new File("data-storage/Slimefun/stored-inventories/").listFiles()) {
|
||||
ZipEntry entry = new ZipEntry("stored-inventories/" + f.getName());
|
||||
output.putNextEntry(entry);
|
||||
FileInputStream input = new FileInputStream(f);
|
||||
|
||||
int length;
|
||||
while ((length = input.read(buffer)) > 0) {
|
||||
output.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
input.close();
|
||||
output.closeEntry();
|
||||
}
|
||||
|
||||
if (new File("data-storage/Slimefun/stored-chunks/chunks.sfc").exists()) {
|
||||
ZipEntry entry = new ZipEntry("stored-chunks/chunks.sfc");
|
||||
output.putNextEntry(entry);
|
||||
FileInputStream input = new FileInputStream(new File("data-storage/Slimefun/stored-chunks/chunks.sfc"));
|
||||
|
||||
int length;
|
||||
while ((length = input.read(buffer)) > 0) {
|
||||
output.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
input.close();
|
||||
output.closeEntry();
|
||||
}
|
||||
|
||||
output.close();
|
||||
System.out.println("[Slimfun] Backed up Blocks to " + file.getName());
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -23,6 +23,8 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.handlers.BlockTicker;
|
||||
|
||||
public class TickerTask implements Runnable {
|
||||
|
||||
public boolean HALTED = false;
|
||||
|
||||
public Map<Block, Block> move = new HashMap<Block, Block>();
|
||||
public Map<Location, Boolean> delete = new HashMap<Location, Boolean>();
|
||||
|
||||
@ -42,6 +44,7 @@ public class TickerTask implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
long timestamp = System.currentTimeMillis();
|
||||
|
||||
skipped = 0;
|
||||
@ -65,57 +68,59 @@ public class TickerTask implements Runnable {
|
||||
delete.remove(entry.getKey());
|
||||
}
|
||||
|
||||
for (final String c: BlockStorage.getTickingChunks()) {
|
||||
long timestamp2 = System.currentTimeMillis();
|
||||
chunks++;
|
||||
if (!HALTED) {
|
||||
for (final String c: BlockStorage.getTickingChunks()) {
|
||||
long timestamp2 = System.currentTimeMillis();
|
||||
chunks++;
|
||||
|
||||
blocks:
|
||||
for (final Block b: BlockStorage.getTickingBlocks(c)) {
|
||||
if (b.getChunk().isLoaded()) {
|
||||
final Location l = b.getLocation();
|
||||
final SlimefunItem item = BlockStorage.check(l);
|
||||
if (item != null) {
|
||||
machines++;
|
||||
try {
|
||||
item.getTicker().update();
|
||||
if (item.getTicker().isSynchronized()) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
|
||||
blocks:
|
||||
for (final Block b: BlockStorage.getTickingBlocks(c)) {
|
||||
if (b.getChunk().isLoaded()) {
|
||||
final Location l = b.getLocation();
|
||||
final SlimefunItem item = BlockStorage.check(l);
|
||||
if (item != null) {
|
||||
machines++;
|
||||
try {
|
||||
item.getTicker().update();
|
||||
if (item.getTicker().isSynchronized()) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
long timestamp3 = System.currentTimeMillis();
|
||||
item.getTicker().tick(b, item, BlockStorage.getBlockInfo(l));
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
long timestamp3 = System.currentTimeMillis();
|
||||
item.getTicker().tick(b, item, BlockStorage.getBlockInfo(l));
|
||||
|
||||
map_machinetime.put(item.getName(), (map_machinetime.containsKey(item.getName()) ? map_machinetime.get(item.getName()): 0) + (System.currentTimeMillis() - timestamp3));
|
||||
map_chunk.put(c, (map_chunk.containsKey(c) ? map_chunk.get(c): 0) + 1);
|
||||
map_machine.put(item.getName(), (map_machine.containsKey(item.getName()) ? map_machine.get(item.getName()): 0) + 1);
|
||||
block_timings.put(l, System.currentTimeMillis() - timestamp3);
|
||||
} catch(Exception x) {
|
||||
int errors = 0;
|
||||
if (bugged.containsKey(l)) errors = bugged.get(l);
|
||||
errors++;
|
||||
map_machinetime.put(item.getName(), (map_machinetime.containsKey(item.getName()) ? map_machinetime.get(item.getName()): 0) + (System.currentTimeMillis() - timestamp3));
|
||||
map_chunk.put(c, (map_chunk.containsKey(c) ? map_chunk.get(c): 0) + 1);
|
||||
map_machine.put(item.getName(), (map_machine.containsKey(item.getName()) ? map_machine.get(item.getName()): 0) + 1);
|
||||
block_timings.put(l, System.currentTimeMillis() - timestamp3);
|
||||
} catch(Exception x) {
|
||||
int errors = 0;
|
||||
if (bugged.containsKey(l)) errors = bugged.get(l);
|
||||
errors++;
|
||||
|
||||
if (errors == 1) {
|
||||
File file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + ".err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(2).err");
|
||||
if (errors == 1) {
|
||||
File file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + ".err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(3).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(2).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(4).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(3).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(5).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(4).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(6).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(5).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(7).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(6).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(8).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(7).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(9).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(8).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(10).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(9).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(10).err");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -124,113 +129,113 @@ public class TickerTask implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
PrintStream stream = new PrintStream(file);
|
||||
stream.println();
|
||||
stream.println("Server Software: " + Bukkit.getName());
|
||||
stream.println(" Build: " + Bukkit.getVersion());
|
||||
stream.println(" Minecraft: " + Bukkit.getBukkitVersion());
|
||||
stream.println();
|
||||
stream.println("Installed Plugins (" + Bukkit.getPluginManager().getPlugins().length + ")");
|
||||
for (Plugin p: Bukkit.getPluginManager().getPlugins()) {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled(p)) {
|
||||
stream.println(" + " + p.getName() + " " + p.getDescription().getVersion());
|
||||
try {
|
||||
PrintStream stream = new PrintStream(file);
|
||||
stream.println();
|
||||
stream.println("Server Software: " + Bukkit.getName());
|
||||
stream.println(" Build: " + Bukkit.getVersion());
|
||||
stream.println(" Minecraft: " + Bukkit.getBukkitVersion());
|
||||
stream.println();
|
||||
stream.println("Installed Plugins (" + Bukkit.getPluginManager().getPlugins().length + ")");
|
||||
for (Plugin p: Bukkit.getPluginManager().getPlugins()) {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled(p)) {
|
||||
stream.println(" + " + p.getName() + " " + p.getDescription().getVersion());
|
||||
}
|
||||
else {
|
||||
stream.println(" - " + p.getName() + " " + p.getDescription().getVersion());
|
||||
}
|
||||
}
|
||||
else {
|
||||
stream.println(" - " + p.getName() + " " + p.getDescription().getVersion());
|
||||
}
|
||||
}
|
||||
stream.println();
|
||||
stream.println("Ticked Block:");
|
||||
stream.println(" World: " + l.getWorld().getName());
|
||||
stream.println(" X: " + l.getBlockX());
|
||||
stream.println(" Y: " + l.getBlockY());
|
||||
stream.println(" Z: " + l.getBlockZ());
|
||||
stream.println();
|
||||
stream.println("Slimefun Data:");
|
||||
stream.println(" ID: " + item.getName());
|
||||
stream.println(" Inventory: " + BlockStorage.getStorage(l.getWorld()).hasInventory(l));
|
||||
stream.println(" Data: " + BlockStorage.getBlockInfoAsJson(l));
|
||||
stream.println();
|
||||
stream.println("Stacktrace:");
|
||||
stream.println();
|
||||
x.printStackTrace(stream);
|
||||
stream.println();
|
||||
stream.println("Ticked Block:");
|
||||
stream.println(" World: " + l.getWorld().getName());
|
||||
stream.println(" X: " + l.getBlockX());
|
||||
stream.println(" Y: " + l.getBlockY());
|
||||
stream.println(" Z: " + l.getBlockZ());
|
||||
stream.println();
|
||||
stream.println("Slimefun Data:");
|
||||
stream.println(" ID: " + item.getName());
|
||||
stream.println(" Inventory: " + BlockStorage.getStorage(l.getWorld()).hasInventory(l));
|
||||
stream.println(" Data: " + BlockStorage.getBlockInfoAsJson(l));
|
||||
stream.println();
|
||||
stream.println("Stacktrace:");
|
||||
stream.println();
|
||||
x.printStackTrace(stream);
|
||||
|
||||
stream.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
System.err.println("[Slimefun] Exception caught while ticking a Block:" + x.getClass().getName());
|
||||
System.err.println("[Slimefun] X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ());
|
||||
System.err.println("[Slimefun] Saved as: ");
|
||||
System.err.println("[Slimefun] /plugins/Slimefun/error-reports/" + file.getName());
|
||||
System.err.println("[Slimefun] Please consider sending this File to the developer(s) of Slimefun, sending this Error won't get you any help though.");
|
||||
System.err.println("[Slimefun] ");
|
||||
|
||||
bugged_blocks.put(l, errors);
|
||||
}
|
||||
else if (errors == 4) {
|
||||
System.err.println("[Slimefun] X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ() + "(" + item.getName() + ")");
|
||||
System.err.println("[Slimefun] has thrown 4 Exceptions in the last 4 Ticks, the Block has been terminated.");
|
||||
System.err.println("[Slimefun] Check your /plugins/Slimefun/error-reports/ folder for details.");
|
||||
System.err.println("[Slimefun] ");
|
||||
|
||||
BlockStorage._integrated_removeBlockInfo(l, true);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
l.getBlock().setType(Material.AIR);
|
||||
stream.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
bugged_blocks.put(l, errors);
|
||||
System.err.println("[Slimefun] Exception caught while ticking a Block:" + x.getClass().getName());
|
||||
System.err.println("[Slimefun] X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ());
|
||||
System.err.println("[Slimefun] Saved as: ");
|
||||
System.err.println("[Slimefun] /plugins/Slimefun/error-reports/" + file.getName());
|
||||
System.err.println("[Slimefun] Please consider sending this File to the developer(s) of Slimefun, sending this Error won't get you any help though.");
|
||||
System.err.println("[Slimefun] ");
|
||||
|
||||
bugged_blocks.put(l, errors);
|
||||
}
|
||||
else if (errors == 4) {
|
||||
System.err.println("[Slimefun] X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ() + "(" + item.getName() + ")");
|
||||
System.err.println("[Slimefun] has thrown 4 Exceptions in the last 4 Ticks, the Block has been terminated.");
|
||||
System.err.println("[Slimefun] Check your /plugins/Slimefun/error-reports/ folder for details.");
|
||||
System.err.println("[Slimefun] ");
|
||||
|
||||
BlockStorage._integrated_removeBlockInfo(l, true);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
l.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
bugged_blocks.put(l, errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
long timestamp3 = System.currentTimeMillis();
|
||||
item.getTicker().tick(b, item, BlockStorage.getBlockInfo(l));
|
||||
});
|
||||
}
|
||||
else {
|
||||
long timestamp3 = System.currentTimeMillis();
|
||||
item.getTicker().tick(b, item, BlockStorage.getBlockInfo(l));
|
||||
|
||||
map_machinetime.put(item.getName(), (map_machinetime.containsKey(item.getName()) ? map_machinetime.get(item.getName()): 0) + (System.currentTimeMillis() - timestamp3));
|
||||
map_chunk.put(c, (map_chunk.containsKey(c) ? map_chunk.get(c): 0) + 1);
|
||||
map_machine.put(item.getName(), (map_machine.containsKey(item.getName()) ? map_machine.get(item.getName()): 0) + 1);
|
||||
block_timings.put(l, System.currentTimeMillis() - timestamp3);
|
||||
}
|
||||
tickers.add(item.getTicker());
|
||||
} catch(Exception x) {
|
||||
map_machinetime.put(item.getName(), (map_machinetime.containsKey(item.getName()) ? map_machinetime.get(item.getName()): 0) + (System.currentTimeMillis() - timestamp3));
|
||||
map_chunk.put(c, (map_chunk.containsKey(c) ? map_chunk.get(c): 0) + 1);
|
||||
map_machine.put(item.getName(), (map_machine.containsKey(item.getName()) ? map_machine.get(item.getName()): 0) + 1);
|
||||
block_timings.put(l, System.currentTimeMillis() - timestamp3);
|
||||
}
|
||||
tickers.add(item.getTicker());
|
||||
} catch(Exception x) {
|
||||
|
||||
int errors = 0;
|
||||
if (bugged.containsKey(l)) errors = bugged.get(l);
|
||||
errors++;
|
||||
int errors = 0;
|
||||
if (bugged.containsKey(l)) errors = bugged.get(l);
|
||||
errors++;
|
||||
|
||||
if (errors == 1) {
|
||||
File file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + ".err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(2).err");
|
||||
if (errors == 1) {
|
||||
File file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + ".err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(3).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(2).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(4).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(3).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(5).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(4).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(6).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(5).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(7).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(6).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(8).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(7).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(9).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(8).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(10).err");
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(9).err");
|
||||
if (file.exists()) {
|
||||
file = new File("plugins/Slimefun/error-reports/" + Clock.getFormattedTime() + "(10).err");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -239,86 +244,86 @@ public class TickerTask implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
PrintStream stream = new PrintStream(file);
|
||||
stream.println();
|
||||
stream.println("Server Software: " + Bukkit.getName());
|
||||
stream.println(" Build: " + Bukkit.getVersion());
|
||||
stream.println(" Minecraft: " + Bukkit.getBukkitVersion());
|
||||
stream.println();
|
||||
stream.println("Installed Plugins (" + Bukkit.getPluginManager().getPlugins().length + ")");
|
||||
for (Plugin p: Bukkit.getPluginManager().getPlugins()) {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled(p)) {
|
||||
stream.println(" + " + p.getName() + " " + p.getDescription().getVersion());
|
||||
try {
|
||||
PrintStream stream = new PrintStream(file);
|
||||
stream.println();
|
||||
stream.println("Server Software: " + Bukkit.getName());
|
||||
stream.println(" Build: " + Bukkit.getVersion());
|
||||
stream.println(" Minecraft: " + Bukkit.getBukkitVersion());
|
||||
stream.println();
|
||||
stream.println("Installed Plugins (" + Bukkit.getPluginManager().getPlugins().length + ")");
|
||||
for (Plugin p: Bukkit.getPluginManager().getPlugins()) {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled(p)) {
|
||||
stream.println(" + " + p.getName() + " " + p.getDescription().getVersion());
|
||||
}
|
||||
else {
|
||||
stream.println(" - " + p.getName() + " " + p.getDescription().getVersion());
|
||||
}
|
||||
}
|
||||
else {
|
||||
stream.println(" - " + p.getName() + " " + p.getDescription().getVersion());
|
||||
}
|
||||
}
|
||||
stream.println();
|
||||
stream.println("Ticked Block:");
|
||||
stream.println(" World: " + l.getWorld().getName());
|
||||
stream.println(" X: " + l.getBlockX());
|
||||
stream.println(" Y: " + l.getBlockY());
|
||||
stream.println(" Z: " + l.getBlockZ());
|
||||
stream.println();
|
||||
stream.println("Slimefun Data:");
|
||||
stream.println(" ID: " + item.getName());
|
||||
stream.println(" Inventory: " + BlockStorage.getStorage(l.getWorld()).hasInventory(l));
|
||||
stream.println(" Data: " + BlockStorage.getBlockInfoAsJson(l));
|
||||
stream.println();
|
||||
stream.println("Stacktrace:");
|
||||
stream.println();
|
||||
x.printStackTrace(stream);
|
||||
stream.println();
|
||||
stream.println("Ticked Block:");
|
||||
stream.println(" World: " + l.getWorld().getName());
|
||||
stream.println(" X: " + l.getBlockX());
|
||||
stream.println(" Y: " + l.getBlockY());
|
||||
stream.println(" Z: " + l.getBlockZ());
|
||||
stream.println();
|
||||
stream.println("Slimefun Data:");
|
||||
stream.println(" ID: " + item.getName());
|
||||
stream.println(" Inventory: " + BlockStorage.getStorage(l.getWorld()).hasInventory(l));
|
||||
stream.println(" Data: " + BlockStorage.getBlockInfoAsJson(l));
|
||||
stream.println();
|
||||
stream.println("Stacktrace:");
|
||||
stream.println();
|
||||
x.printStackTrace(stream);
|
||||
|
||||
stream.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
System.err.println("[Slimefun] Exception caught while ticking a Block:" + x.getClass().getName());
|
||||
System.err.println("[Slimefun] X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ());
|
||||
System.err.println("[Slimefun] Saved as: ");
|
||||
System.err.println("[Slimefun] /plugins/Slimefun/error-reports/" + file.getName());
|
||||
System.err.println("[Slimefun] Please consider sending this File to the developer(s) of Slimefun, sending this Error won't get you any help though.");
|
||||
System.err.println("[Slimefun] ");
|
||||
|
||||
bugged_blocks.put(l, errors);
|
||||
}
|
||||
else if (errors == 4) {
|
||||
System.err.println("[Slimefun] X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ() + "(" + item.getName() + ")");
|
||||
System.err.println("[Slimefun] has thrown 4 Exceptions in the last 4 Ticks, the Block has been terminated.");
|
||||
System.err.println("[Slimefun] Check your /plugins/Slimefun/error-reports/ folder for details.");
|
||||
System.err.println("[Slimefun] ");
|
||||
|
||||
BlockStorage._integrated_removeBlockInfo(l, true);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
l.getBlock().setType(Material.AIR);
|
||||
stream.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
bugged_blocks.put(l, errors);
|
||||
System.err.println("[Slimefun] Exception caught while ticking a Block:" + x.getClass().getName());
|
||||
System.err.println("[Slimefun] X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ());
|
||||
System.err.println("[Slimefun] Saved as: ");
|
||||
System.err.println("[Slimefun] /plugins/Slimefun/error-reports/" + file.getName());
|
||||
System.err.println("[Slimefun] Please consider sending this File to the developer(s) of Slimefun, sending this Error won't get you any help though.");
|
||||
System.err.println("[Slimefun] ");
|
||||
|
||||
bugged_blocks.put(l, errors);
|
||||
}
|
||||
else if (errors == 4) {
|
||||
System.err.println("[Slimefun] X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ() + "(" + item.getName() + ")");
|
||||
System.err.println("[Slimefun] has thrown 4 Exceptions in the last 4 Ticks, the Block has been terminated.");
|
||||
System.err.println("[Slimefun] Check your /plugins/Slimefun/error-reports/ folder for details.");
|
||||
System.err.println("[Slimefun] ");
|
||||
|
||||
BlockStorage._integrated_removeBlockInfo(l, true);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
l.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
bugged_blocks.put(l, errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
else skipped++;
|
||||
}
|
||||
else {
|
||||
skipped += BlockStorage.getTickingBlocks(c).size();
|
||||
skipped_chunks.add(c);
|
||||
chunks--;
|
||||
break blocks;
|
||||
}
|
||||
else skipped++;
|
||||
}
|
||||
else {
|
||||
skipped += BlockStorage.getTickingBlocks(c).size();
|
||||
skipped_chunks.add(c);
|
||||
chunks--;
|
||||
break blocks;
|
||||
}
|
||||
}
|
||||
|
||||
map_chunktime.put(c, System.currentTimeMillis() - timestamp2);
|
||||
map_chunktime.put(c, System.currentTimeMillis() - timestamp2);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<Block, Block> entry: move.entrySet()) {
|
||||
@ -336,6 +341,8 @@ public class TickerTask implements Runnable {
|
||||
|
||||
public void info(CommandSender sender) {
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&2== &aSlimefun Diagnostic Tool &2=="));
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6Halted: &e&l" + String.valueOf(HALTED).toUpperCase()));
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6Impact: &e" + time + "ms / 50-750ms"));
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6Ticked Chunks: &e" + chunks));
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6Ticked Machines: &e" + machines));
|
||||
|
@ -11,7 +11,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
||||
|
||||
public class BlockMenu extends ChestMenu {
|
||||
|
||||
@ -105,26 +104,6 @@ public class BlockMenu extends ChestMenu {
|
||||
return this.preset.canOpen(b, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChestMenu addItem(int slot, ItemStack item, MenuClickHandler handler) {
|
||||
addMenuClickHandler(slot, handler);
|
||||
return super.addItem(slot, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChestMenu addMenuClickHandler(int slot, final MenuClickHandler handler) {
|
||||
MenuClickHandler ch = new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
public boolean onClick(Player p, int slot, ItemStack stack, ClickAction action) {
|
||||
changes++;
|
||||
return handler.onClick(p, slot, stack, action);
|
||||
}
|
||||
};
|
||||
|
||||
return super.addMenuClickHandler(slot, ch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceExistingItem(int slot, ItemStack item) {
|
||||
this.replaceExistingItem(slot, item, true);
|
||||
@ -141,6 +120,16 @@ public class BlockMenu extends ChestMenu {
|
||||
changes++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChestMenu addMenuOpeningHandler(MenuOpeningHandler handler) {
|
||||
if (handler instanceof SaveHandler) {
|
||||
return super.addMenuOpeningHandler(new SaveHandler(this, ((SaveHandler) handler).handler));
|
||||
}
|
||||
else {
|
||||
return super.addMenuOpeningHandler(new SaveHandler(this, handler));
|
||||
}
|
||||
}
|
||||
|
||||
public void close() {
|
||||
Iterator<HumanEntity> iterator = toInventory().getViewers().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
@ -148,4 +137,22 @@ public class BlockMenu extends ChestMenu {
|
||||
human.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
public class SaveHandler implements MenuOpeningHandler {
|
||||
|
||||
BlockMenu menu;
|
||||
MenuOpeningHandler handler;
|
||||
|
||||
public SaveHandler(BlockMenu menu, MenuOpeningHandler handler) {
|
||||
this.handler = handler;
|
||||
this.menu = menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen(Player p) {
|
||||
handler.onOpen(p);
|
||||
menu.changes++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: Slimefun
|
||||
version: 4.1.3
|
||||
version: 4.1.5
|
||||
authors: [mrCookieSlime, John000708, st392, DeathlyPanda, BlackBeltPanda]
|
||||
description: Slimefun basically turns your entire Server into a FTB modpack without installing a single mod
|
||||
website: http://TheBusyBiscuit.github.io/
|
||||
|
Loading…
Reference in New Issue
Block a user