Merge pull request #34 from JEFF-Media-GbR/Dump

Dump
This commit is contained in:
JEFF 2019-07-16 13:04:48 +02:00 committed by GitHub
commit 768d6f9f55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 106 additions and 4 deletions

View File

@ -3,3 +3,6 @@
## Change default categories
## Maybe dump option
## Inventory pages support
Read from InventoryPages config which slots are used for the buttons, then ignore them in sorting when cycling through the slots and when gathering the inventory in the first place

View File

@ -6,7 +6,7 @@
<groupId>de.jeffclan</groupId>
<artifactId>JeffChestSort</artifactId>
<version>6.3</version>
<version>6.4-dev</version>
<packaging>jar</packaging>
<name>JeffChestSort</name>

View File

@ -1,5 +1,7 @@
package de.jeffclan.JeffChestSort;
import java.io.BufferedWriter;
/*
ChestSort - maintained by mfnalex / JEFF Media GbR ( www.jeff-media.de )
@ -31,10 +33,12 @@ package de.jeffclan.JeffChestSort;
*/
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -43,6 +47,7 @@ import java.util.UUID;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
@ -144,6 +149,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
getConfig().addDefault("hotkeys.shift-click", true);
getConfig().addDefault("hotkeys.double-click", true);
getConfig().addDefault("hotkeys.shift-right-click", true);
getConfig().addDefault("dump", false);
getConfig().addDefault("hook-crackshot", true);
getConfig().addDefault("hook-crackshot-prefix", "crackshot_weapon");
@ -293,6 +299,15 @@ public class JeffChestSortPlugin extends JavaPlugin {
}
registerMetrics();
if(getConfig().getBoolean("dump")) {
try {
dump();
} catch (IOException e) {
System.out.println("Error while writing dump file.");
e.printStackTrace();
}
}
}
@ -465,5 +480,17 @@ public class JeffChestSortPlugin extends JavaPlugin {
PerPlayerSettings.remove(uniqueId.toString());
}
}
// Dumps all Materials into a csv file with their current category
void dump() throws IOException {
File file = new File(getDataFolder() + File.separator + "dump.csv");
FileOutputStream fos = new FileOutputStream(file);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
for(Material mat : Material.values()) {
bw.write(mat.name()+","+organizer.getCategoryLinePair(mat.name()).getCategoryName());
bw.newLine();
}
bw.close();
}
}

View File

@ -23,8 +23,10 @@ mushroom_stew
porkchop
cooked_porkchop
cod
carrots
salmon
cooked_cod
sweet_berries
cooked_salmon
cake
cookie

View File

@ -17,6 +17,7 @@ diamond
emerald
diamond_ore
emerald_ore
emerald_block
iron_ingot
iron_ore
gold_ingot
@ -26,11 +27,29 @@ diamond_block
iron_block
lapis_lazuli
lapis_block
lapis_ore
obsidian
nether_quartz_ore
nether_star
beacon
prismarine_crystals
conduit
scute
elytra
enchanted_golden_apple
enchanting_table
experience_bottle
firework_rocket
firework_star
glowstone*
name_tag
jukebox
golden_apple
ender_chest
end_crystal
end_gateway
end_portal_frame
end_rod
ender_pearl
ender_eye
*_horse_armor
@ -39,4 +58,5 @@ heart_of_the_sea
nautilus_shell
gold_nugget
iron_nugget
saddle
enchanted_book

View File

@ -16,10 +16,13 @@ sticky=false
ghast_tear
potion
glass_bottle
blaze_rod
fermented_spider_eye
blaze_powder
magma_cream
brewing_stand
nether_wart
nether_wart_block
cauldron
glistering_melon_slice
golden_carrot

View File

@ -14,10 +14,17 @@
sticky=false
*_planks
*_sapling
*_log
*_wood
*_leaves
*_sign
barrel
oak_sapling
spruce_sapling
birch_sapling
jungle_sapling
acacia_sapling
dark_oak_sapling
acacia_slab
birch_slab
jungle_slab
@ -27,6 +34,12 @@ spruce_slab
acacia_fence
birch_fence
jungle_fence
campfire
chest
composter
stick
ladder
crafting_table
oak_fence
dark_oak_fence
spruce_fence

View File

@ -19,8 +19,24 @@ granite
polished_granite
diorite
polished_diorite
andesite
andesite*
diorite*
granite*
end_stone*
brick
brick_wall
*sandstone
terracotta
mossy_stone_brick_wall
netherrack
nether_brick*
polished_andesite_*
polished_diorite_*
polished_granite_*
*_terracotta
polished_andesite
stone_brick_wall
stone_stairs
*stone_bricks
stone_slab
cobblestone_slab

View File

@ -14,6 +14,7 @@
sticky=false
grass
bamboo
fern
dead_bush
seagrass
@ -36,6 +37,23 @@ cactus
vine
lily_pad
sunflower
beetroots
bone_meal
chorus_fruit
kelp
kelp_plant
lily_of_the_valley
popped_chorus_fruit
potatoes
potted_*
sweet_berry_bush
tall_seagrass
cocoa
cocoa_beans
dried_kelp_block
hay_block
flower_pot
cornflower
lilac
rose_bush
peony

View File

@ -1,6 +1,6 @@
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
name: ChestSort
version: 6.3
version: 6.4-dev
api-version: 1.13
description: Allows automatic chest sorting
author: mfnalex