forked from Upstream/mmocore
merged
This commit is contained in:
commit
e6bb5fbdd4
@ -9,6 +9,7 @@ import java.util.UUID;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.command.CommandMap;
|
import org.bukkit.command.CommandMap;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -95,7 +96,6 @@ import net.Indyuce.mmocore.manager.social.PartyManager;
|
|||||||
import net.Indyuce.mmocore.manager.social.RequestManager;
|
import net.Indyuce.mmocore.manager.social.RequestManager;
|
||||||
import net.Indyuce.mmocore.version.ServerVersion;
|
import net.Indyuce.mmocore.version.ServerVersion;
|
||||||
import net.Indyuce.mmocore.version.nms.NMSHandler;
|
import net.Indyuce.mmocore.version.nms.NMSHandler;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
|
||||||
@ -241,42 +241,43 @@ public class MMOCore extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}.runTaskTimerAsynchronously(MMOCore.plugin, 100, 20);
|
}.runTaskTimerAsynchronously(MMOCore.plugin, 100, 20);
|
||||||
|
|
||||||
//For the sake of the lord, make sure they aren't using MMOItems Mana and Stamina Addon...
|
/*
|
||||||
//This should prevent a couple error reports produced by people not reading the installation guide...
|
* For the sake of the lord, make sure they aren't using MMOItems Mana
|
||||||
if(Bukkit.getPluginManager().getPlugin("MMOItemsMana") != null) {
|
* and Stamina Addon...This should prevent a couple error reports
|
||||||
new BukkitRunnable() {
|
* produced by people not reading the installation guide...
|
||||||
public void run() {
|
*/
|
||||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "MMOCore is not compatible with the Mana and Stamina addon of MMOItems!!!");
|
if (Bukkit.getPluginManager().getPlugin("MMOItemsMana") != null) {
|
||||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "Please read the installation guide!");
|
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with the Mana & Stamina MMOItems!!!");
|
||||||
}
|
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!");
|
||||||
}.runTaskTimer(MMOCore.plugin, 1200, 1200);
|
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with the Mana & Stamina MMOItems!!!");
|
||||||
|
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveDefaultConfig();
|
saveDefaultConfig();
|
||||||
reloadPlugin();
|
reloadPlugin();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* default action bar.
|
* default action bar. only ran if the action bar is enabled
|
||||||
* only ran if the action bar is enabled
|
|
||||||
*/
|
*/
|
||||||
if(getConfig().getBoolean("action-bar.enabled")) {
|
if (getConfig().getBoolean("action-bar.enabled")) {
|
||||||
DecimalFormat format = new DecimalFormat(getConfig().getString("action-bar.decimal"), configManager.formatSymbols);
|
DecimalFormat format = new DecimalFormat(getConfig().getString("action-bar.decimal"), configManager.formatSymbols);
|
||||||
int ticks = getConfig().getInt("action-bar.ticks-to-update");
|
int ticks = getConfig().getInt("action-bar.ticks-to-update");
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
//System.out.println("Tick!");
|
|
||||||
|
|
||||||
for (PlayerData data : PlayerData.getAll()) {
|
for (PlayerData data : PlayerData.getAll()) {
|
||||||
if (data.isOnline() && !data.getPlayer().isDead() && !data.isCasting() && !pausePlayers.contains(data.getUniqueId())) {
|
if (!data.isCasting() && !pausePlayers.contains(data.getUniqueId())) {
|
||||||
//System.out.println("Display!");
|
data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(placeholderParser.parse(data.getPlayer(),
|
||||||
data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(placeholderParser.parse(data.getPlayer(), ChatColor.translateAlternateColorCodes('&', getConfig().getString("action-bar.format")
|
ChatColor.translateAlternateColorCodes('&', getConfig().getString("action-bar.format").replace("{health}", format.format(data.getPlayer().getHealth()))
|
||||||
.replace("{health}", format.format(data.getPlayer().getHealth())).replace("{max_health}", "" + StatType.MAX_HEALTH.format(data.getStats().getStat(StatType.MAX_HEALTH)))
|
.replace("{max_health}", "" + StatType.MAX_HEALTH.format(data.getStats().getStat(StatType.MAX_HEALTH))).replace("{mana}", format.format(data.getMana()))
|
||||||
.replace("{mana}", format.format(data.getMana())).replace("{max_mana}", "" + StatType.MAX_MANA.format(data.getStats().getStat(StatType.MAX_MANA)))
|
.replace("{max_mana}", "" + StatType.MAX_MANA.format(data.getStats().getStat(StatType.MAX_MANA))).replace("{stamina}", format.format(data.getStamina()))
|
||||||
.replace("{stamina}", format.format(data.getStamina())).replace("{max_stamina}", "" + StatType.MAX_STAMINA.format(data.getStats().getStat(StatType.MAX_STAMINA)))
|
.replace("{max_stamina}", "" + StatType.MAX_STAMINA.format(data.getStats().getStat(StatType.MAX_STAMINA)))
|
||||||
.replace("{stellium}", format.format(data.getStellium())).replace("{max_stellium}", "" + StatType.MAX_STELLIUM.format(data.getStats().getStat(StatType.MAX_STELLIUM)))
|
.replace("{stellium}", format.format(data.getStellium()))
|
||||||
.replace("{class}", data.getProfess().getName()).replace("{xp}", "" + data.getExperience()).replace("{armor}", "" + StatType.ARMOR.format(data.getPlayer().getAttribute(Attribute.GENERIC_ARMOR).getValue()))
|
.replace("{max_stellium}", "" + StatType.MAX_STELLIUM.format(data.getStats().getStat(StatType.MAX_STELLIUM)))
|
||||||
.replace("{level}", "" + data.getLevel()).replace("{name}", data.getPlayer().getDisplayName())))));
|
.replace("{class}", data.getProfess().getName()).replace("{xp}", "" + data.getExperience())
|
||||||
|
.replace("{armor}", "" + StatType.ARMOR.format(data.getPlayer().getAttribute(Attribute.GENERIC_ARMOR).getValue())).replace("{level}", "" + data.getLevel())
|
||||||
|
.replace("{name}", data.getPlayer().getDisplayName())))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,22 +331,32 @@ public class MMOCore extends JavaPlugin {
|
|||||||
|
|
||||||
FileConfiguration config = new ConfigFile("commands").getConfig();
|
FileConfiguration config = new ConfigFile("commands").getConfig();
|
||||||
|
|
||||||
if(config.contains("player")) commandMap.register("mmocore", new PlayerStatsCommand(config.getConfigurationSection("player")));
|
if (config.contains("player"))
|
||||||
if(config.contains("attributes")) commandMap.register("mmocore", new AttributesCommand(config.getConfigurationSection("attributes")));
|
commandMap.register("mmocore", new PlayerStatsCommand(config.getConfigurationSection("player")));
|
||||||
if(config.contains("class")) commandMap.register("mmocore", new ClassCommand(config.getConfigurationSection("class")));
|
if (config.contains("attributes"))
|
||||||
if(config.contains("waypoints")) commandMap.register("mmocore", new WaypointsCommand(config.getConfigurationSection("waypoints")));
|
commandMap.register("mmocore", new AttributesCommand(config.getConfigurationSection("attributes")));
|
||||||
if(config.contains("quests")) commandMap.register("mmocore", new QuestsCommand(config.getConfigurationSection("quests")));
|
if (config.contains("class"))
|
||||||
if(config.contains("skills")) commandMap.register("mmocore", new SkillsCommand(config.getConfigurationSection("skills")));
|
commandMap.register("mmocore", new ClassCommand(config.getConfigurationSection("class")));
|
||||||
if(config.contains("friends")) commandMap.register("mmocore", new FriendsCommand(config.getConfigurationSection("friends")));
|
if (config.contains("waypoints"))
|
||||||
if(config.contains("party")) commandMap.register("mmocore", new PartyCommand(config.getConfigurationSection("party")));
|
commandMap.register("mmocore", new WaypointsCommand(config.getConfigurationSection("waypoints")));
|
||||||
if(config.contains("guild")) commandMap.register("mmocore", new GuildCommand(config.getConfigurationSection("guild")));
|
if (config.contains("quests"))
|
||||||
|
commandMap.register("mmocore", new QuestsCommand(config.getConfigurationSection("quests")));
|
||||||
|
if (config.contains("skills"))
|
||||||
|
commandMap.register("mmocore", new SkillsCommand(config.getConfigurationSection("skills")));
|
||||||
|
if (config.contains("friends"))
|
||||||
|
commandMap.register("mmocore", new FriendsCommand(config.getConfigurationSection("friends")));
|
||||||
|
if (config.contains("party"))
|
||||||
|
commandMap.register("mmocore", new PartyCommand(config.getConfigurationSection("party")));
|
||||||
|
if (config.contains("guild"))
|
||||||
|
commandMap.register("mmocore", new GuildCommand(config.getConfigurationSection("guild")));
|
||||||
|
|
||||||
if (hasEconomy() && economy.isValid()) {
|
if (hasEconomy() && economy.isValid()) {
|
||||||
if(config.contains("withdraw")) commandMap.register("mmocore", new WithdrawCommand(config.getConfigurationSection("withdraw")));
|
if (config.contains("withdraw"))
|
||||||
if(config.contains("deposit")) commandMap.register("mmocore", new DepositCommand(config.getConfigurationSection("deposit")));
|
commandMap.register("mmocore", new WithdrawCommand(config.getConfigurationSection("withdraw")));
|
||||||
|
if (config.contains("deposit"))
|
||||||
|
commandMap.register("mmocore", new DepositCommand(config.getConfigurationSection("deposit")));
|
||||||
}
|
}
|
||||||
}
|
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) {
|
||||||
catch(NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) {
|
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ import net.Indyuce.mmocore.manager.RestrictionManager.BlockPermissions;
|
|||||||
public class BlockListener implements Listener {
|
public class BlockListener implements Listener {
|
||||||
private static final BlockFace[] order = { BlockFace.UP, BlockFace.DOWN, BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH };
|
private static final BlockFace[] order = { BlockFace.UP, BlockFace.DOWN, BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH };
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void a(BlockBreakEvent event) {
|
public void a(BlockBreakEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (player.getGameMode() == GameMode.CREATIVE || event.isCancelled())
|
if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String savedData = event.getBlock().getBlockData().getAsString();
|
String savedData = event.getBlock().getBlockData().getAsString();
|
||||||
@ -69,7 +69,6 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* remove vanilla drops if needed
|
* remove vanilla drops if needed
|
||||||
*/
|
*/
|
||||||
@ -79,17 +78,18 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* apply triggers, add experience info to the event so the other events
|
* apply triggers, add experience info to the event so the other
|
||||||
* can give exp to other TOOLS and display HOLOGRAMS
|
* events can give exp to other TOOLS and display HOLOGRAMS
|
||||||
*/
|
*/
|
||||||
if (info.hasTriggers()) {
|
if (info.hasTriggers()) {
|
||||||
PlayerData playerData = PlayerData.get(player);
|
PlayerData playerData = PlayerData.get(player);
|
||||||
info.getTriggers().forEach(trigger -> {
|
info.getTriggers().forEach(trigger -> {
|
||||||
if(!block.hasMetadata("player_placed") && trigger instanceof ExperienceTrigger)
|
if (!block.hasMetadata("player_placed") && trigger instanceof ExperienceTrigger)
|
||||||
trigger.apply(playerData);
|
trigger.apply(playerData);
|
||||||
});
|
});
|
||||||
if(!block.hasMetadata("player_placed") && info.hasExperience() && MMOCore.plugin.hasHolograms())
|
if (!block.hasMetadata("player_placed") && info.hasExperience() && MMOCore.plugin.hasHolograms())
|
||||||
MMOCore.plugin.hologramSupport.displayIndicator(block.getLocation().add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + called.getGainedExperience().getValue()).message(), player);
|
MMOCore.plugin.hologramSupport.displayIndicator(block.getLocation().add(.5, 1.5, .5),
|
||||||
|
MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + called.getGainedExperience().getValue()).message(), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user