mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-12-01 06:53:26 +01:00
Fixed some modifiers
This commit is contained in:
parent
b0324f9da8
commit
675492b667
@ -10,8 +10,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public abstract class DCommand {
|
public abstract class DCommand {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
static MessageConfig messageConfig = plugin.getMessageConfig();
|
protected static MessageConfig messageConfig = plugin.getMessageConfig();
|
||||||
|
|
||||||
public boolean costsMoney;
|
public boolean costsMoney;
|
||||||
private String command;
|
private String command;
|
||||||
|
@ -30,7 +30,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class WorldConfig {
|
public class WorldConfig {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static WorldConfig defaultConfig = new WorldConfig();
|
public static WorldConfig defaultConfig = new WorldConfig();
|
||||||
|
@ -12,7 +12,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class DLootInventory {
|
public class DLootInventory {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
private Inventory inventory;
|
private Inventory inventory;
|
||||||
private InventoryView inventoryView;
|
private InventoryView inventoryView;
|
||||||
|
@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class EditWorld {
|
public class EditWorld {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private World world;
|
private World world;
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package io.github.dre2n.dungeonsxl.game;
|
package io.github.dre2n.dungeonsxl.game;
|
||||||
|
|
||||||
|
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||||
import io.github.dre2n.dungeonsxl.player.DGroup;
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Game {
|
public class Game {
|
||||||
|
|
||||||
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
private List<DGroup> dGroups = new ArrayList<DGroup>();
|
private List<DGroup> dGroups = new ArrayList<DGroup>();
|
||||||
private GameType type;
|
private GameType type;
|
||||||
|
|
||||||
@ -58,4 +63,37 @@ public class Game {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return if the DGroup list is empty
|
||||||
|
*/
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return dGroups.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
public static Game getByDGroup(DGroup dGroup) {
|
||||||
|
for (Game game : plugin.getGames()) {
|
||||||
|
if (game.getDGroups().contains(dGroup)) {
|
||||||
|
return game;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Game getByPlayer(Player player) {
|
||||||
|
return getByDGroup(DGroup.getByPlayer(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Game getByGameWorld(GameWorld gameWorld) {
|
||||||
|
for (Game game : plugin.getGames()) {
|
||||||
|
if (game.getDGroups().get(0).getGameWorld().equals(gameWorld)) {
|
||||||
|
return game;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class GameChest {
|
public class GameChest {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private boolean used = false;
|
private boolean used = false;
|
||||||
|
@ -10,6 +10,7 @@ import io.github.dre2n.dungeonsxl.event.gameworld.GameWorldStartGameEvent;
|
|||||||
import io.github.dre2n.dungeonsxl.event.gameworld.GameWorldUnloadEvent;
|
import io.github.dre2n.dungeonsxl.event.gameworld.GameWorldUnloadEvent;
|
||||||
import io.github.dre2n.dungeonsxl.event.requirement.RequirementCheckEvent;
|
import io.github.dre2n.dungeonsxl.event.requirement.RequirementCheckEvent;
|
||||||
import io.github.dre2n.dungeonsxl.mob.DMob;
|
import io.github.dre2n.dungeonsxl.mob.DMob;
|
||||||
|
import io.github.dre2n.dungeonsxl.player.DGroup;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
import io.github.dre2n.dungeonsxl.player.DPlayer;
|
||||||
import io.github.dre2n.dungeonsxl.requirement.Requirement;
|
import io.github.dre2n.dungeonsxl.requirement.Requirement;
|
||||||
import io.github.dre2n.dungeonsxl.sign.DSign;
|
import io.github.dre2n.dungeonsxl.sign.DSign;
|
||||||
@ -41,7 +42,7 @@ import org.bukkit.entity.Spider;
|
|||||||
|
|
||||||
public class GameWorld {
|
public class GameWorld {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private Game game;
|
private Game game;
|
||||||
@ -60,7 +61,7 @@ public class GameWorld {
|
|||||||
|
|
||||||
private CopyOnWriteArrayList<Sign> signClass = new CopyOnWriteArrayList<Sign>();
|
private CopyOnWriteArrayList<Sign> signClass = new CopyOnWriteArrayList<Sign>();
|
||||||
private CopyOnWriteArrayList<DMob> dMobs = new CopyOnWriteArrayList<DMob>();
|
private CopyOnWriteArrayList<DMob> dMobs = new CopyOnWriteArrayList<DMob>();
|
||||||
//TODO: Killed mobs
|
// TODO: Killed mobs
|
||||||
private CopyOnWriteArrayList<GameChest> gameChests = new CopyOnWriteArrayList<GameChest>();
|
private CopyOnWriteArrayList<GameChest> gameChests = new CopyOnWriteArrayList<GameChest>();
|
||||||
private CopyOnWriteArrayList<DSign> dSigns = new CopyOnWriteArrayList<DSign>();
|
private CopyOnWriteArrayList<DSign> dSigns = new CopyOnWriteArrayList<DSign>();
|
||||||
private WorldConfig worldConfig;
|
private WorldConfig worldConfig;
|
||||||
@ -512,17 +513,17 @@ public class GameWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canPlayDungeon(String dungeon, Player player) {
|
public static boolean canPlayDungeon(String map, Player player) {
|
||||||
if (player.hasPermission("dxl.ignoretimelimit")) {
|
if (player.hasPermission("dxl.ignoretimelimit")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new File(plugin.getDataFolder() + "/maps/" + dungeon).isDirectory()) {
|
if (new File(plugin.getDataFolder() + "/maps/" + map).isDirectory()) {
|
||||||
WorldConfig worldConfig = new WorldConfig(new File(plugin.getDataFolder() + "/maps/" + dungeon, "config.yml"));
|
WorldConfig worldConfig = new WorldConfig(new File(plugin.getDataFolder() + "/maps/" + map, "config.yml"));
|
||||||
|
|
||||||
if (worldConfig.getTimeToNextPlay() != 0) {
|
if (worldConfig.getTimeToNextPlay() != 0) {
|
||||||
// read PlayerConfig
|
// read PlayerConfig
|
||||||
long time = getPlayerTime(dungeon, player);
|
long time = getPlayerTime(map, player);
|
||||||
if (time != -1) {
|
if (time != -1) {
|
||||||
if (time + worldConfig.getTimeToNextPlay() * 1000 * 60 * 60 > System.currentTimeMillis()) {
|
if (time + worldConfig.getTimeToNextPlay() * 1000 * 60 * 60 > System.currentTimeMillis()) {
|
||||||
return false;
|
return false;
|
||||||
@ -537,6 +538,20 @@ public class GameWorld {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean canPlayDungeon(String dungeon, DGroup dGroup) {
|
||||||
|
if (dGroup.getCaptain().hasPermission("dxl.ignoretimelimit")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
if ( !canPlayDungeon(dungeon, player)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static long getPlayerTime(String dungeon, Player player) {
|
public static long getPlayerTime(String dungeon, Player player) {
|
||||||
File file = new File(plugin.getDataFolder() + "/maps/" + dungeon, "players.yml");
|
File file = new File(plugin.getDataFolder() + "/maps/" + dungeon, "players.yml");
|
||||||
|
|
||||||
@ -559,16 +574,16 @@ public class GameWorld {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkRequirements(String dungeon, Player player) {
|
public static boolean checkRequirements(String map, Player player) {
|
||||||
if (player.hasPermission("dxl.ignorerequirements")) {
|
if (player.hasPermission("dxl.ignorerequirements")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new File(plugin.getDataFolder() + "/maps/" + dungeon).isDirectory() == false) {
|
if (new File(plugin.getDataFolder() + "/maps/" + map).isDirectory() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldConfig worldConfig = new WorldConfig(new File(plugin.getDataFolder() + "/maps/" + dungeon, "config.yml"));
|
WorldConfig worldConfig = new WorldConfig(new File(plugin.getDataFolder() + "/maps/" + map, "config.yml"));
|
||||||
|
|
||||||
for (Requirement requirement : worldConfig.getRequirements()) {
|
for (Requirement requirement : worldConfig.getRequirements()) {
|
||||||
RequirementCheckEvent event = new RequirementCheckEvent(requirement, player);
|
RequirementCheckEvent event = new RequirementCheckEvent(requirement, player);
|
||||||
@ -634,4 +649,18 @@ public class GameWorld {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean checkRequirements(String map, DGroup dGroup) {
|
||||||
|
if (dGroup.getCaptain().hasPermission("dxl.ignorerequirements")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
if ( !checkRequirements(map, player)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class DPortal {
|
public class DPortal {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
private World world;
|
private World world;
|
||||||
private Block block1;
|
private Block block1;
|
||||||
|
@ -21,7 +21,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class GroupSign {
|
public class GroupSign {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
// Sign Labels
|
// Sign Labels
|
||||||
public static final String IS_PLAYING = ChatColor.DARK_RED + "Is Playing";
|
public static final String IS_PLAYING = ChatColor.DARK_RED + "Is Playing";
|
||||||
@ -313,7 +313,7 @@ public class GroupSign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static GroupSign getSign(Block block) {
|
public static GroupSign getSign(Block block) {
|
||||||
if (block.getType() != Material.WALL_SIGN) {
|
if ( !(block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ public class GroupSign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void load(FileConfiguration configFile) {
|
public static void load(FileConfiguration configFile) {
|
||||||
for (World world : DungeonsXL.getPlugin().getServer().getWorlds()) {
|
for (World world : plugin.getServer().getWorlds()) {
|
||||||
if ( !configFile.contains("groupsign." + world.getName())) {
|
if ( !configFile.contains("groupsign." + world.getName())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class LeaveSign {
|
public class LeaveSign {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
private Sign sign;
|
private Sign sign;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import org.bukkit.event.block.SignChangeEvent;
|
|||||||
|
|
||||||
public class BlockListener implements Listener {
|
public class BlockListener implements Listener {
|
||||||
|
|
||||||
DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPhysics(BlockPhysicsEvent event) {
|
public void onPhysics(BlockPhysicsEvent event) {
|
||||||
|
@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class CommandListener implements CommandExecutor {
|
public class CommandListener implements CommandExecutor {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd_notused, String arg, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd_notused, String arg, String[] args) {
|
||||||
|
@ -51,8 +51,8 @@ import org.bukkit.inventory.meta.BookMeta;
|
|||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
static MessageConfig messageConfig = plugin.getMessageConfig();
|
protected static MessageConfig messageConfig = plugin.getMessageConfig();
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onDeath(PlayerDeathEvent event) {
|
public void onDeath(PlayerDeathEvent event) {
|
||||||
|
@ -26,7 +26,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
|
|
||||||
public class DMobType {
|
public class DMobType {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private EntityType type;
|
private EntityType type;
|
||||||
|
@ -27,8 +27,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class DGroup {
|
public class DGroup {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
static MessageConfig messageConfig = plugin.getMessageConfig();
|
protected static MessageConfig messageConfig = plugin.getMessageConfig();
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private Player captain;
|
private Player captain;
|
||||||
|
@ -46,8 +46,8 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
|
|
||||||
public class DPlayer {
|
public class DPlayer {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
static MessageConfig messageConfig = plugin.getMessageConfig();
|
protected static MessageConfig messageConfig = plugin.getMessageConfig();
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
private Player player;
|
private Player player;
|
||||||
|
@ -21,7 +21,7 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
|
|
||||||
public class DSavePlayer {
|
public class DSavePlayer {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
private static CopyOnWriteArrayList<DSavePlayer> savePlayers = new CopyOnWriteArrayList<DSavePlayer>();
|
private static CopyOnWriteArrayList<DSavePlayer> savePlayers = new CopyOnWriteArrayList<DSavePlayer>();
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import io.github.dre2n.dungeonsxl.event.requirement.RequirementRegistrationEvent
|
|||||||
|
|
||||||
public abstract class Requirement {
|
public abstract class Requirement {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
public static Requirement create(RequirementType type) {
|
public static Requirement create(RequirementType type) {
|
||||||
Requirement requirement = null;
|
Requirement requirement = null;
|
||||||
|
@ -13,7 +13,7 @@ import io.github.dre2n.dungeonsxl.reward.RewardTypeDefault;
|
|||||||
|
|
||||||
public abstract class Reward {
|
public abstract class Reward {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
public static Reward create(RewardType type) {
|
public static Reward create(RewardType type) {
|
||||||
Reward reward = null;
|
Reward reward = null;
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public abstract class DSign {
|
public abstract class DSign {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
private Sign sign;
|
private Sign sign;
|
||||||
private GameWorld gameWorld;
|
private GameWorld gameWorld;
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
public class LazyUpdateTask extends BukkitRunnable {
|
public class LazyUpdateTask extends BukkitRunnable {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
public class RedstoneEventTask extends BukkitRunnable {
|
public class RedstoneEventTask extends BukkitRunnable {
|
||||||
|
|
||||||
private final Block block;
|
private Block block;
|
||||||
|
|
||||||
public RedstoneEventTask(final Block block) {
|
public RedstoneEventTask(final Block block) {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
public class WorldUnloadTask extends BukkitRunnable {
|
public class WorldUnloadTask extends BukkitRunnable {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public abstract class Trigger {
|
public abstract class Trigger {
|
||||||
|
|
||||||
static DungeonsXL plugin = DungeonsXL.getPlugin();
|
protected static DungeonsXL plugin = DungeonsXL.getPlugin();
|
||||||
|
|
||||||
private boolean triggered;
|
private boolean triggered;
|
||||||
private Player player; // Holds Player for Player specific Triggers
|
private Player player; // Holds Player for Player specific Triggers
|
||||||
|
Loading…
Reference in New Issue
Block a user