Merge from DroppingAnvil/1.6.x

This commit is contained in:
DroppingAnvil 2019-10-12 13:37:30 -05:00 committed by GitHub
commit 9b9633aa68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.Skript;
import ch.njol.skript.SkriptAddon; import ch.njol.skript.SkriptAddon;
import com.earth2me.essentials.Essentials;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.cmd.CmdAutoHelp; import com.massivecraft.factions.cmd.CmdAutoHelp;
@ -189,7 +188,10 @@ public class FactionsPlugin extends MPlugin {
} }
this.loadSuccessful = false; 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 //Attempt to generate a permission list
PermissionList.generateFile(); PermissionList.generateFile();
@ -266,7 +268,7 @@ public class FactionsPlugin extends MPlugin {
this.getServer().getScheduler().runTaskTimer(this, CheckTask::cleanupTask, 0L, 1200L); this.getServer().getScheduler().runTaskTimer(this, CheckTask::cleanupTask, 0L, 1200L);
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new WeeWooTask(this), 600L, 600L); this.getServer().getScheduler().runTaskTimerAsynchronously(this, new WeeWooTask(this), 600L, 600L);
} }
if(Conf.useDiscordSystem) { if(Conf.useDiscordSystem && !Conf.discordBotToken.equals("<token here>")) {
new FactionChatHandler(this); new FactionChatHandler(this);
} else { } 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"); 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.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MissionGUI implements FactionGUI { public class MissionGUI implements FactionGUI {
private FactionsPlugin plugin; private FactionsPlugin plugin;
@ -79,30 +76,39 @@ public class MissionGUI implements FactionGUI {
if (configurationSection == null) { if (configurationSection == null) {
return; 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)) { for (String key : configurationSection.getKeys(false)) {
ConfigurationSection section = configurationSection.getConfigurationSection(key); if (!key.equals("FillItem")) {
int slot = section.getInt("Slot"); ConfigurationSection section = configurationSection.getConfigurationSection(key);
int slot = section.getInt("Slot");
ItemStack itemStack = XMaterial.matchXMaterial(section.getString("Material")).parseItem(); ItemStack itemStack = XMaterial.matchXMaterial(section.getString("Material")).parseItem();
ItemMeta itemMeta = itemStack.getItemMeta(); ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', section.getString("Name"))); itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', section.getString("Name")));
List<String> loreLines = new ArrayList<>(); List<String> loreLines = new ArrayList<>();
for (String line : section.getStringList("Lore")) { for (String line : section.getStringList("Lore")) {
loreLines.add(ChatColor.translateAlternateColorCodes('&', line)); loreLines.add(ChatColor.translateAlternateColorCodes('&', line));
}
if (fPlayer.getFaction().getMissions().containsKey(key)) {
Mission mission = fPlayer.getFaction().getMissions().get(key);
itemMeta.addEnchant(Enchantment.SILK_TOUCH, 1, true);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
loreLines.add("");
loreLines.add(plugin.color(plugin.getConfig().getString("Mission-Progress-Format")
.replace("{progress}", String.valueOf(mission.getProgress()))
.replace("{total}", String.valueOf(section.getConfigurationSection("Mission").get("Amount")))));
}
itemMeta.setLore(loreLines);
itemStack.setItemMeta(itemMeta);
inventory.setItem(slot, itemStack);
slots.put(slot, key);
} }
if (fPlayer.getFaction().getMissions().containsKey(key)) {
Mission mission = fPlayer.getFaction().getMissions().get(key);
itemMeta.addEnchant(Enchantment.SILK_TOUCH, 1, true);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
loreLines.add("");
loreLines.add(plugin.color(plugin.getConfig().getString("Mission-Progress-Format")
.replace("{progress}", String.valueOf(mission.getProgress()))
.replace("{total}", String.valueOf(section.getConfigurationSection("Mission").get("Amount")))));
}
itemMeta.setLore(loreLines);
itemStack.setItemMeta(itemMeta);
inventory.setItem(slot, itemStack);
slots.put(slot, key);
} }
} }

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 #Mission Types: KILL, MINE, PLACE, FISH, TAME, ENCHANT, CONSUME
Missions: Missions:
FillItem:
Material: BLACK_STAINED_GLASS_PANE
Rows: 3
sugarcane: sugarcane:
Slot: 11 Slot: 11
Material: "SUGAR_CANE" Material: "SUGAR_CANE"