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 ## Change default categories
## Maybe dump option ## 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> <groupId>de.jeffclan</groupId>
<artifactId>JeffChestSort</artifactId> <artifactId>JeffChestSort</artifactId>
<version>6.3</version> <version>6.4-dev</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>JeffChestSort</name> <name>JeffChestSort</name>

View File

@ -1,5 +1,7 @@
package de.jeffclan.JeffChestSort; package de.jeffclan.JeffChestSort;
import java.io.BufferedWriter;
/* /*
ChestSort - maintained by mfnalex / JEFF Media GbR ( www.jeff-media.de ) 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.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -43,6 +47,7 @@ import java.util.UUID;
import org.bstats.bukkit.Metrics; import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -144,6 +149,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
getConfig().addDefault("hotkeys.shift-click", true); getConfig().addDefault("hotkeys.shift-click", true);
getConfig().addDefault("hotkeys.double-click", true); getConfig().addDefault("hotkeys.double-click", true);
getConfig().addDefault("hotkeys.shift-right-click", true); getConfig().addDefault("hotkeys.shift-right-click", true);
getConfig().addDefault("dump", false);
getConfig().addDefault("hook-crackshot", true); getConfig().addDefault("hook-crackshot", true);
getConfig().addDefault("hook-crackshot-prefix", "crackshot_weapon"); getConfig().addDefault("hook-crackshot-prefix", "crackshot_weapon");
@ -293,6 +299,15 @@ public class JeffChestSortPlugin extends JavaPlugin {
} }
registerMetrics(); 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()); 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 porkchop
cooked_porkchop cooked_porkchop
cod cod
carrots
salmon salmon
cooked_cod cooked_cod
sweet_berries
cooked_salmon cooked_salmon
cake cake
cookie cookie

View File

@ -17,6 +17,7 @@ diamond
emerald emerald
diamond_ore diamond_ore
emerald_ore emerald_ore
emerald_block
iron_ingot iron_ingot
iron_ore iron_ore
gold_ingot gold_ingot
@ -26,11 +27,29 @@ diamond_block
iron_block iron_block
lapis_lazuli lapis_lazuli
lapis_block lapis_block
lapis_ore
obsidian obsidian
nether_quartz_ore
nether_star
beacon beacon
prismarine_crystals
conduit conduit
scute scute
elytra 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_pearl
ender_eye ender_eye
*_horse_armor *_horse_armor
@ -39,4 +58,5 @@ heart_of_the_sea
nautilus_shell nautilus_shell
gold_nugget gold_nugget
iron_nugget iron_nugget
saddle
enchanted_book enchanted_book

View File

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

View File

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

View File

@ -19,8 +19,24 @@ granite
polished_granite polished_granite
diorite diorite
polished_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 polished_andesite
stone_brick_wall
stone_stairs
*stone_bricks *stone_bricks
stone_slab stone_slab
cobblestone_slab cobblestone_slab

View File

@ -14,6 +14,7 @@
sticky=false sticky=false
grass grass
bamboo
fern fern
dead_bush dead_bush
seagrass seagrass
@ -36,6 +37,23 @@ cactus
vine vine
lily_pad lily_pad
sunflower 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 lilac
rose_bush rose_bush
peony peony

View File

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