MissionGUI improvements with a small fix for first run of the plugin

This commit is contained in:
DroppingAnvil 2019-10-12 13:34:36 -05:00
parent b1d51f40ce
commit b46009f633
3 changed files with 39 additions and 28 deletions

View File

@ -2,7 +2,6 @@ package com.massivecraft.factions;
import ch.njol.skript.Skript;
import ch.njol.skript.SkriptAddon;
import com.earth2me.essentials.Essentials;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.cmd.CmdAutoHelp;
@ -189,7 +188,10 @@ public class FactionsPlugin extends MPlugin {
}
this.loadSuccessful = false;
saveDefaultConfig();
if (!new File(this.getDataFolder() + "/config.yml").exists()) {
this.saveResource("config.yml", false);
this.reloadConfig();
}
//Attempt to generate a permission list
PermissionList.generateFile();
@ -266,7 +268,7 @@ public class FactionsPlugin extends MPlugin {
this.getServer().getScheduler().runTaskTimer(this, CheckTask::cleanupTask, 0L, 1200L);
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new WeeWooTask(this), 600L, 600L);
}
if(Conf.useDiscordSystem) {
if(Conf.useDiscordSystem && !Conf.discordBotToken.equals("<token here>")) {
new FactionChatHandler(this);
} else {
System.out.println("\n\n\n SABER-FACTIONS-DISCORD-INTEGRATION - You are not using Discord integration features, set conf.json option useDiscordSystem to true and put a valid token in before using!\n\n\n");

View File

@ -14,10 +14,7 @@ import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
public class MissionGUI implements FactionGUI {
private FactionsPlugin plugin;
@ -79,7 +76,15 @@ public class MissionGUI implements FactionGUI {
if (configurationSection == null) {
return;
}
for (int fill = 0; fill < configurationSection.getInt("FillItem.Rows") * 9; ++fill) {
ItemStack fillItem = new ItemStack(XMaterial.matchXMaterial(configurationSection.getString("FillItem.Material")).parseItem());
ItemMeta meta = fillItem.getItemMeta();
meta.setDisplayName("");
fillItem.setItemMeta(meta);
inventory.setItem(fill, fillItem);
}
for (String key : configurationSection.getKeys(false)) {
if (!key.equals("FillItem")) {
ConfigurationSection section = configurationSection.getConfigurationSection(key);
int slot = section.getInt("Slot");
@ -105,6 +110,7 @@ public class MissionGUI implements FactionGUI {
slots.put(slot, key);
}
}
}
public Inventory getInventory() {
return inventory;

View File

@ -756,6 +756,9 @@ DenyMissionsMoreThenOnce: true #this setting to true, means that if they complet
#Mission Types: KILL, MINE, PLACE, FISH, TAME, ENCHANT, CONSUME
Missions:
FillItem:
Material: BLACK_STAINED_GLASS_PANE
Rows: 3
sugarcane:
Slot: 11
Material: "SUGAR_CANE"