Merge pull request #12 from DroppingAnvil/1.6.x
Added new mission type + added an existing type that was missing from config + added ALL for all missions that use Material or EntityType
This commit is contained in:
commit
7e9c6cead8
Binary file not shown.
0
src/main/java/com/massivecraft/factions/FactionsPlugin.java
Normal file → Executable file
0
src/main/java/com/massivecraft/factions/FactionsPlugin.java
Normal file → Executable file
@ -562,4 +562,4 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,6 +6,8 @@ import com.massivecraft.factions.FactionsPlugin;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -13,6 +15,7 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityBreedEvent;
|
import org.bukkit.event.entity.EntityBreedEvent;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
|
import org.bukkit.event.entity.EntityTameEvent;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -38,7 +41,7 @@ public class MissionHandler implements Listener {
|
|||||||
List<Mission> missions = fPlayer.getFaction().getMissions().values().stream().filter(mission -> mission.getType().equalsIgnoreCase("kill")).collect(Collectors.toList());
|
List<Mission> missions = fPlayer.getFaction().getMissions().values().stream().filter(mission -> mission.getType().equalsIgnoreCase("kill")).collect(Collectors.toList());
|
||||||
for (Mission mission2 : missions) {
|
for (Mission mission2 : missions) {
|
||||||
ConfigurationSection section = plugin.getConfig().getConfigurationSection("Missions").getConfigurationSection(mission2.getName());
|
ConfigurationSection section = plugin.getConfig().getConfigurationSection("Missions").getConfigurationSection(mission2.getName());
|
||||||
if (!event.getEntityType().toString().equals(section.getConfigurationSection("Mission").getString("EntityType"))) {
|
if (!event.getEntityType().toString().equals(section.getConfigurationSection("Mission").getString("EntityType")) && !section.getConfigurationSection("Mission").getString("EntityType").equalsIgnoreCase("ALL")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mission2.incrementProgress();
|
mission2.incrementProgress();
|
||||||
@ -55,7 +58,7 @@ public class MissionHandler implements Listener {
|
|||||||
List<Mission> missions = fPlayer.getFaction().getMissions().values().stream().filter(mission -> mission.getType().equalsIgnoreCase("mine")).collect(Collectors.toList());
|
List<Mission> missions = fPlayer.getFaction().getMissions().values().stream().filter(mission -> mission.getType().equalsIgnoreCase("mine")).collect(Collectors.toList());
|
||||||
for (Mission mission2 : missions) {
|
for (Mission mission2 : missions) {
|
||||||
ConfigurationSection section = plugin.getConfig().getConfigurationSection("Missions").getConfigurationSection(mission2.getName());
|
ConfigurationSection section = plugin.getConfig().getConfigurationSection("Missions").getConfigurationSection(mission2.getName());
|
||||||
if (!event.getBlock().getType().toString().equals(section.getConfigurationSection("Mission").getString("Material"))) {
|
if (!event.getBlock().getType().toString().equals(section.getConfigurationSection("Mission").getString("Material")) && !section.getConfigurationSection("Mission").getString("Material").equalsIgnoreCase("ALL")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mission2.incrementProgress();
|
mission2.incrementProgress();
|
||||||
@ -72,7 +75,7 @@ public class MissionHandler implements Listener {
|
|||||||
List<Mission> missions = fPlayer.getFaction().getMissions().values().stream().filter(mission -> mission.getType().equalsIgnoreCase("place")).collect(Collectors.toList());
|
List<Mission> missions = fPlayer.getFaction().getMissions().values().stream().filter(mission -> mission.getType().equalsIgnoreCase("place")).collect(Collectors.toList());
|
||||||
for (Mission mission2 : missions) {
|
for (Mission mission2 : missions) {
|
||||||
ConfigurationSection section = plugin.getConfig().getConfigurationSection("Missions").getConfigurationSection(mission2.getName());
|
ConfigurationSection section = plugin.getConfig().getConfigurationSection("Missions").getConfigurationSection(mission2.getName());
|
||||||
if (!event.getBlock().getType().toString().equals(section.getConfigurationSection("Mission").getString("Material"))) {
|
if (!event.getBlock().getType().toString().equals(section.getConfigurationSection("Mission").getString("Material")) && !section.getConfigurationSection("Mission").getString("Material").equalsIgnoreCase("ALL")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mission2.incrementProgress();
|
mission2.incrementProgress();
|
||||||
@ -97,6 +100,26 @@ public class MissionHandler implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onPlayerTame(EntityTameEvent event) {
|
||||||
|
if (!(event.getOwner() instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FPlayer fPlayer = FPlayers.getInstance().getByPlayer((Player)event.getOwner());
|
||||||
|
if (fPlayer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Mission> missions = fPlayer.getFaction().getMissions().values().stream().filter(mission -> mission.getType().equalsIgnoreCase("tame")).collect(Collectors.toList());
|
||||||
|
for (Mission mission2 : missions) {
|
||||||
|
ConfigurationSection section = plugin.getConfig().getConfigurationSection("Missions").getConfigurationSection(mission2.getName());
|
||||||
|
if (!event.getEntityType().toString().equals(section.getConfigurationSection("Mission").getString("EntityType")) && !section.getConfigurationSection("Mission").getString("EntityType").equalsIgnoreCase("ALL")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
mission2.incrementProgress();
|
||||||
|
checkIfDone(fPlayer, mission2, section);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void checkIfDone(FPlayer fPlayer, Mission mission, ConfigurationSection section) {
|
private void checkIfDone(FPlayer fPlayer, Mission mission, ConfigurationSection section) {
|
||||||
if (mission.getProgress() < section.getConfigurationSection("Mission").getLong("Amount")) {
|
if (mission.getProgress() < section.getConfigurationSection("Mission").getLong("Amount")) {
|
||||||
return;
|
return;
|
||||||
|
0
src/main/java/com/massivecraft/factions/struct/Permission.java
Normal file → Executable file
0
src/main/java/com/massivecraft/factions/struct/Permission.java
Normal file → Executable file
@ -741,7 +741,7 @@ Missions-GUI-Title: '&bFaction Missions'
|
|||||||
MaximumMissionsAllowedAtOnce: 1
|
MaximumMissionsAllowedAtOnce: 1
|
||||||
Mission-Progress-Format: '&b&lProgression: &f{progress}&7/&e{total}'
|
Mission-Progress-Format: '&b&lProgression: &f{progress}&7/&e{total}'
|
||||||
|
|
||||||
#Mission Types: KILL, MINE, FISH
|
#Mission Types: KILL, MINE, PLACE, FISH, TAME
|
||||||
Missions:
|
Missions:
|
||||||
sugarcane:
|
sugarcane:
|
||||||
Slot: 11
|
Slot: 11
|
||||||
@ -778,6 +778,18 @@ Missions:
|
|||||||
Amount: 100
|
Amount: 100
|
||||||
Reward:
|
Reward:
|
||||||
Commands: ["f points add %faction% 100"]
|
Commands: ["f points add %faction% 100"]
|
||||||
|
animaltaming:
|
||||||
|
Slot: 21
|
||||||
|
Material: "BONE"
|
||||||
|
Name: "&f100 &cTamed Animals"
|
||||||
|
Lore:
|
||||||
|
- "&b&lTame an animal &n100&r &d<imes"
|
||||||
|
Mission:
|
||||||
|
Type: "TAME"
|
||||||
|
EntityType: "ALL"
|
||||||
|
Amount: 100
|
||||||
|
Reward:
|
||||||
|
Commands: ["f points add %faction% 100"]
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
|
@ -22,6 +22,7 @@ permissions:
|
|||||||
factions.modifypower: true
|
factions.modifypower: true
|
||||||
factions.ahome: true
|
factions.ahome: true
|
||||||
factions.setmaxvaults: true
|
factions.setmaxvaults: true
|
||||||
|
factions.convertconfig: true
|
||||||
factions.*:
|
factions.*:
|
||||||
description: This is just an alias for factions.kit.admin
|
description: This is just an alias for factions.kit.admin
|
||||||
children:
|
children:
|
||||||
|
Loading…
Reference in New Issue
Block a user