Write GPowerAPI
This commit is contained in:
parent
2ec5f26737
commit
e605f72b4b
26 changed files with 366 additions and 370 deletions
|
@ -14,7 +14,6 @@ import alisolarflare.components.gpowers.GPowerComponent;
|
||||||
import alisolarflare.components.insurance.InsuranceComponent;
|
import alisolarflare.components.insurance.InsuranceComponent;
|
||||||
import alisolarflare.components.magic.MagicComponent;
|
import alisolarflare.components.magic.MagicComponent;
|
||||||
import alisolarflare.components.metrics.MetricsComponent;
|
import alisolarflare.components.metrics.MetricsComponent;
|
||||||
import alisolarflare.components.minigames.MinigameComponent;
|
|
||||||
|
|
||||||
public class AliPresents extends JavaPlugin{
|
public class AliPresents extends JavaPlugin{
|
||||||
public void onEnable(){
|
public void onEnable(){
|
||||||
|
@ -32,7 +31,6 @@ public class AliPresents extends JavaPlugin{
|
||||||
new InsuranceComponent().register(this);
|
new InsuranceComponent().register(this);
|
||||||
new MagicComponent().register(this);
|
new MagicComponent().register(this);
|
||||||
new MetricsComponent().register(this);
|
new MetricsComponent().register(this);
|
||||||
new MinigameComponent().register(this);
|
|
||||||
|
|
||||||
|
|
||||||
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
|
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
|
||||||
|
|
90
src/alisolarflare/components/gpowers/GPowerAPI.java
Normal file
90
src/alisolarflare/components/gpowers/GPowerAPI.java
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
package alisolarflare.components.gpowers;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
public class GPowerAPI{
|
||||||
|
public static final int defaultPowerLength = 300;
|
||||||
|
public static Map<UUID, PoweredPlayer> poweredPlayerList = new HashMap<UUID, PoweredPlayer>();
|
||||||
|
|
||||||
|
public static void addPlayer(Player player, String colour, boolean powerIsActive){
|
||||||
|
poweredPlayerList.put(player.getUniqueId(), new PoweredPlayer(player.getUniqueId(), colour, true));
|
||||||
|
}
|
||||||
|
public static void PowerUpPlayer(Player player){
|
||||||
|
player.sendMessage("Powering up!");
|
||||||
|
if(poweredPlayerList.containsKey(player.getUniqueId())){
|
||||||
|
poweredPlayerList.get(player.getUniqueId()).isPowersActive = true;
|
||||||
|
player.sendMessage("Powered up!");
|
||||||
|
}else{
|
||||||
|
player.sendMessage("You must instantiate your power settings using /GPower");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void PowerUpAllPlayers(){
|
||||||
|
for (PoweredPlayer poweredPlayer : GPowerAPI.poweredPlayerList.values()){
|
||||||
|
poweredPlayer.isPowersActive = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PowerDownPlayer(Player player){
|
||||||
|
player.sendMessage("Powering down!");
|
||||||
|
if (poweredPlayerList.containsKey(player.getUniqueId())){
|
||||||
|
player.sendMessage("Powered down!");
|
||||||
|
poweredPlayerList.get(player.getUniqueId()).isPowersActive = false;
|
||||||
|
}else{
|
||||||
|
player.sendMessage("P down!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void activatePower(Player player){
|
||||||
|
activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour, defaultPowerLength);
|
||||||
|
}
|
||||||
|
public static void activatePower(Player player, String colour){
|
||||||
|
activatePower(player, colour, defaultPowerLength);
|
||||||
|
}
|
||||||
|
public static void activatePower(Player player, String colour, int powerLength) {
|
||||||
|
//GREY
|
||||||
|
for (PotionEffect potionEffect : player.getActivePotionEffects()){
|
||||||
|
player.removePotionEffect(potionEffect.getType());
|
||||||
|
}
|
||||||
|
if ((colour.startsWith("grey") || colour.startsWith("gra")) && (player.getWorld().getTime() > 12575 && player.getWorld().getTime() < 22925)){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, powerLength, 0, true, false, Color.GRAY), true);
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, powerLength+100, 0, true, false, Color.GRAY), true);
|
||||||
|
//RED
|
||||||
|
}else if (colour.startsWith("r")){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, powerLength, 0, true, false, Color.RED), true);
|
||||||
|
//ORANGE
|
||||||
|
}else if (colour.startsWith("o")){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, powerLength, 0, true, false, Color.ORANGE), true);
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, powerLength, 0, true, false, Color.ORANGE), true);
|
||||||
|
//YELLOW
|
||||||
|
}else if (colour.startsWith("y") && player.getLocation().getBlock().getLightFromSky() == 15 && player.getLocation().getBlock().getLightFromBlocks() == 15){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, powerLength, 0, true, false, Color.YELLOW), true);
|
||||||
|
//GREEN
|
||||||
|
}else if (colour.startsWith("g") && !colour.startsWith("gra") && !colour.startsWith("grey")){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, powerLength, 1, true, false, Color.GREEN), true);
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, powerLength, 0, true, false, Color.GREEN), true);
|
||||||
|
//BLUE
|
||||||
|
}else if (colour.startsWith("b")){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, powerLength, 1, true, false, Color.BLUE), true);
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, powerLength, 0, true, false, Color.BLUE), true);
|
||||||
|
//PURPLE
|
||||||
|
}else if (colour.startsWith("p")){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, powerLength, 0, true, false, Color.PURPLE), true);
|
||||||
|
//NULL
|
||||||
|
}else{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean playerHasActivePowers(Player player){
|
||||||
|
return poweredPlayerList.containsKey(player.getUniqueId()) && poweredPlayerList.get(player.getUniqueId()).isPowersActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -12,12 +12,11 @@ public class GPowerComponent extends Component {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(JavaPlugin plugin) {
|
public void register(JavaPlugin plugin) {
|
||||||
GPowerMemory gPowerMemory = new GPowerMemory();
|
registerCommand(plugin, new GPower());
|
||||||
registerCommand(plugin, new GPower(gPowerMemory));
|
registerCommand(plugin, new PowerUp());
|
||||||
registerCommand(plugin, new PowerUp(gPowerMemory));
|
registerCommand(plugin, new PowerDown());
|
||||||
registerCommand(plugin, new PowerDown(gPowerMemory));
|
|
||||||
|
|
||||||
registerListener(plugin, new EnchantingLoop(plugin, gPowerMemory));
|
registerListener(plugin, new EnchantingLoop(plugin));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
package alisolarflare.components.gpowers;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class GPowerMemory{
|
|
||||||
public Map<UUID, poweredPlayer> poweredPlayerList = new HashMap<UUID, poweredPlayer>();
|
|
||||||
|
|
||||||
public void configurePlayer(Player player, String colour, boolean powerIsActive){
|
|
||||||
poweredPlayerList.put(player.getUniqueId(), new poweredPlayer(player.getUniqueId(), colour, true));
|
|
||||||
}
|
|
||||||
public void PowerUpPlayer(Player player){
|
|
||||||
player.sendMessage("Powering up!");
|
|
||||||
if(poweredPlayerList.containsKey(player.getUniqueId())){
|
|
||||||
poweredPlayerList.get(player.getUniqueId()).isPowersActive = true;
|
|
||||||
player.sendMessage("Powered up!");
|
|
||||||
}else{
|
|
||||||
player.sendMessage("You must instantiate your power settings using /GPower");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PowerDownPlayer(Player player){
|
|
||||||
player.sendMessage("Powering down!");
|
|
||||||
if (poweredPlayerList.containsKey(player.getUniqueId())){
|
|
||||||
player.sendMessage("Powered down!");
|
|
||||||
poweredPlayerList.get(player.getUniqueId()).isPowersActive = false;
|
|
||||||
}else{
|
|
||||||
player.sendMessage("P down!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class poweredPlayer{
|
|
||||||
public UUID uuid;
|
|
||||||
public String colour;
|
|
||||||
public Boolean isPowersActive;
|
|
||||||
|
|
||||||
public poweredPlayer(UUID uuid, String colour, Boolean activated){
|
|
||||||
this.uuid = (uuid);
|
|
||||||
this.colour = (colour);
|
|
||||||
this.isPowersActive = (activated);
|
|
||||||
}
|
|
||||||
public String toString(){
|
|
||||||
return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+isPowersActive + "]";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
18
src/alisolarflare/components/gpowers/PoweredPlayer.java
Normal file
18
src/alisolarflare/components/gpowers/PoweredPlayer.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package alisolarflare.components.gpowers;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class PoweredPlayer{
|
||||||
|
public UUID uuid;
|
||||||
|
public String colour;
|
||||||
|
public Boolean isPowersActive;
|
||||||
|
|
||||||
|
public PoweredPlayer(UUID uuid, String colour, Boolean activated){
|
||||||
|
this.uuid = (uuid);
|
||||||
|
this.colour = (colour);
|
||||||
|
this.isPowersActive = (activated);
|
||||||
|
}
|
||||||
|
public String toString(){
|
||||||
|
return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+isPowersActive + "]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,16 +3,9 @@ package alisolarflare.components.gpowers.commands;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.architecture.commands.PlayerCommand;
|
import alisolarflare.architecture.commands.PlayerCommand;
|
||||||
import alisolarflare.components.gpowers.GPowerMemory;
|
import alisolarflare.components.gpowers.GPowerAPI;
|
||||||
|
|
||||||
public class GPower extends PlayerCommand {
|
public class GPower extends PlayerCommand {
|
||||||
|
|
||||||
private GPowerMemory gPowerMemory;
|
|
||||||
|
|
||||||
public GPower(GPowerMemory gPowerMemory) {
|
|
||||||
this.gPowerMemory = gPowerMemory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(Player player, String label, String[] args) {
|
public boolean OnCommand(Player player, String label, String[] args) {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
|
@ -39,7 +32,7 @@ public class GPower extends PlayerCommand {
|
||||||
}
|
}
|
||||||
player.sendMessage("Terms Vaild!");
|
player.sendMessage("Terms Vaild!");
|
||||||
player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive);
|
player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive);
|
||||||
gPowerMemory.configurePlayer(player, colour, isActive);
|
GPowerAPI.addPlayer(player, colour, isActive);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,75 +1,32 @@
|
||||||
package alisolarflare.components.gpowers.enchant;
|
package alisolarflare.components.gpowers.enchant;
|
||||||
|
|
||||||
import java.util.Map;
|
import org.bukkit.Server;
|
||||||
import java.util.UUID;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Listener;
|
import alisolarflare.components.gpowers.GPowerAPI;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
public class EnchantingLoop extends BukkitRunnable implements Listener{
|
||||||
import org.bukkit.potion.PotionEffectType;
|
private Server server;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import alisolarflare.components.gpowers.GPowerMemory;
|
public EnchantingLoop(JavaPlugin plugin){
|
||||||
import alisolarflare.components.gpowers.GPowerMemory.poweredPlayer;
|
this.server = plugin.getServer();
|
||||||
|
this.runTaskTimer(plugin, 0, 190);
|
||||||
public class EnchantingLoop extends BukkitRunnable implements Listener{
|
}
|
||||||
private int powerLength = 300;
|
|
||||||
private Server server;
|
//REPEATS EVERY 5 SECONDS
|
||||||
private Map<UUID, poweredPlayer> poweredPlayerList;
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (Player player : server.getOnlinePlayers()){
|
||||||
public EnchantingLoop(JavaPlugin plugin, GPowerMemory gPowerMemory){
|
if(GPowerAPI.playerHasActivePowers(player)){
|
||||||
this.server = plugin.getServer();
|
GPowerAPI.activatePower(player);
|
||||||
this.poweredPlayerList = gPowerMemory.poweredPlayerList;
|
}
|
||||||
this.runTaskTimer(plugin, 0, 190);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//REPEATS EVERY 5 SECONDS
|
|
||||||
@Override
|
|
||||||
public void run() {
|
}
|
||||||
//server.broadcastMessage("ping!");
|
|
||||||
for (Player player : server.getOnlinePlayers()){
|
|
||||||
if(poweredPlayerList.containsKey(player.getUniqueId()) && poweredPlayerList.get(player.getUniqueId()).isPowersActive){
|
|
||||||
activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void activatePower(Player player, String colour) {
|
|
||||||
//GREY
|
|
||||||
for (PotionEffect potionEffect : player.getActivePotionEffects()){
|
|
||||||
player.removePotionEffect(potionEffect.getType());
|
|
||||||
}
|
|
||||||
if ((colour.startsWith("grey") || colour.startsWith("gra")) && (player.getWorld().getTime() > 12575 && player.getWorld().getTime() < 22925)){
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, powerLength, 0, true, false, Color.GRAY), true);
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, powerLength+100, 0, true, false, Color.GRAY), true);
|
|
||||||
//RED
|
|
||||||
}else if (colour.startsWith("r")){
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, powerLength, 0, true, false, Color.RED), true);
|
|
||||||
//ORANGE
|
|
||||||
}else if (colour.startsWith("o")){
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, powerLength, 0, true, false, Color.ORANGE), true);
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, powerLength, 0, true, false, Color.ORANGE), true);
|
|
||||||
//YELLOW
|
|
||||||
}else if (colour.startsWith("y") && player.getLocation().getBlock().getLightFromSky() == 15 && player.getLocation().getBlock().getLightFromBlocks() == 15){
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, powerLength, 0, true, false, Color.YELLOW), true);
|
|
||||||
//GREEN
|
|
||||||
}else if (colour.startsWith("g") && !colour.startsWith("gra") && !colour.startsWith("grey")){
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, powerLength, 1, true, false, Color.GREEN), true);
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, powerLength, 0, true, false, Color.GREEN), true);
|
|
||||||
//BLUE
|
|
||||||
}else if (colour.startsWith("b")){
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, powerLength, 1, true, false, Color.BLUE), true);
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, powerLength, 0, true, false, Color.BLUE), true);
|
|
||||||
//PURPLE
|
|
||||||
}else if (colour.startsWith("p")){
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, powerLength, 0, true, false, Color.PURPLE), true);
|
|
||||||
//NULL
|
|
||||||
}else{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,20 +3,12 @@ package alisolarflare.components.gpowers.powerstate;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.architecture.commands.ModCommand;
|
import alisolarflare.architecture.commands.ModCommand;
|
||||||
import alisolarflare.components.gpowers.GPowerMemory;
|
import alisolarflare.components.gpowers.GPowerAPI;
|
||||||
import alisolarflare.components.gpowers.GPowerMemory.poweredPlayer;
|
|
||||||
|
|
||||||
public class PowerAll extends ModCommand{
|
public class PowerAll extends ModCommand{
|
||||||
private GPowerMemory gPowerMemory;
|
|
||||||
|
|
||||||
public PowerAll(GPowerMemory gPowerMemory) {
|
|
||||||
this.gPowerMemory = gPowerMemory;
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
for (poweredPlayer poweredPlayer : gPowerMemory.poweredPlayerList.values()){
|
GPowerAPI.PowerUpAllPlayers();
|
||||||
poweredPlayer.isPowersActive = true;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public String[] GetHelpText(String alias){
|
public String[] GetHelpText(String alias){
|
||||||
|
|
|
@ -3,19 +3,12 @@ package alisolarflare.components.gpowers.powerstate;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.architecture.commands.PlayerCommand;
|
import alisolarflare.architecture.commands.PlayerCommand;
|
||||||
import alisolarflare.components.gpowers.GPowerMemory;
|
import alisolarflare.components.gpowers.GPowerAPI;
|
||||||
|
|
||||||
public class PowerDown extends PlayerCommand {
|
public class PowerDown extends PlayerCommand {
|
||||||
|
|
||||||
private GPowerMemory gPowerMemory;
|
|
||||||
|
|
||||||
public PowerDown(GPowerMemory gPowerMemory) {
|
|
||||||
this.gPowerMemory = gPowerMemory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(Player player, String label, String[] args) {
|
public boolean OnCommand(Player player, String label, String[] args) {
|
||||||
gPowerMemory.PowerDownPlayer(player);
|
GPowerAPI.PowerDownPlayer(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,19 +3,12 @@ package alisolarflare.components.gpowers.powerstate;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.architecture.commands.PlayerCommand;
|
import alisolarflare.architecture.commands.PlayerCommand;
|
||||||
import alisolarflare.components.gpowers.GPowerMemory;
|
import alisolarflare.components.gpowers.GPowerAPI;
|
||||||
|
|
||||||
public class PowerUp extends PlayerCommand {
|
public class PowerUp extends PlayerCommand {
|
||||||
|
|
||||||
private GPowerMemory gPowerMemory;
|
|
||||||
|
|
||||||
public PowerUp(GPowerMemory gPowerMemory) {
|
|
||||||
this.gPowerMemory = gPowerMemory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(Player player, String label, String[] args) {
|
public boolean OnCommand(Player player, String label, String[] args) {
|
||||||
gPowerMemory.PowerUpPlayer(player);
|
GPowerAPI.PowerUpPlayer(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package alisolarflare.components.minigames;
|
/*package graveyard.minigames;
|
||||||
|
|
||||||
public enum GameState {
|
public enum GameState {
|
||||||
Idle, FreeForAll, Heroes;
|
Idle, FreeForAll, Heroes;
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package alisolarflare.components.minigames;
|
/*package graveyard.minigames;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -6,11 +6,11 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import alisolarflare.architecture.Component;
|
import alisolarflare.architecture.Component;
|
||||||
import alisolarflare.components.minigames.commands.JoinMinigame;
|
import graveyard.minigames.commands.JoinMinigame;
|
||||||
import alisolarflare.components.minigames.commands.LeaveMinigame;
|
import graveyard.minigames.commands.LeaveMinigame;
|
||||||
import alisolarflare.components.minigames.commands.ListFighters;
|
import graveyard.minigames.commands.ListFighters;
|
||||||
import alisolarflare.components.minigames.commands.SetColourSpawn;
|
import graveyard.minigames.commands.SetColourSpawn;
|
||||||
import alisolarflare.components.minigames.data.SpawnSet;
|
import graveyard.minigames.data.SpawnSet;
|
||||||
|
|
||||||
public class MinigameComponent extends Component{
|
public class MinigameComponent extends Component{
|
||||||
public SpawnSet spawnSet;
|
public SpawnSet spawnSet;
|
||||||
|
@ -34,3 +34,4 @@ public class MinigameComponent extends Component{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,11 +1,11 @@
|
||||||
package alisolarflare.components.minigames.commands;
|
/*package graveyard.minigames.commands;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.architecture.commands.PlayerCommand;
|
import alisolarflare.architecture.commands.PlayerCommand;
|
||||||
import alisolarflare.components.minigames.MinigameComponent;
|
import graveyard.minigames.MinigameComponent;
|
||||||
|
|
||||||
public class JoinMinigame extends PlayerCommand {
|
public class JoinMinigame extends PlayerCommand {
|
||||||
private List<String> fighterList;
|
private List<String> fighterList;
|
||||||
|
@ -31,3 +31,4 @@ public class JoinMinigame extends PlayerCommand {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,11 +1,11 @@
|
||||||
package alisolarflare.components.minigames.commands;
|
/*package graveyard.minigames.commands;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.architecture.commands.PlayerCommand;
|
import alisolarflare.architecture.commands.PlayerCommand;
|
||||||
import alisolarflare.components.minigames.MinigameComponent;
|
import graveyard.minigames.MinigameComponent;
|
||||||
|
|
||||||
public class LeaveMinigame extends PlayerCommand {
|
public class LeaveMinigame extends PlayerCommand {
|
||||||
private List<String> fighters;
|
private List<String> fighters;
|
||||||
|
@ -39,3 +39,4 @@ public class LeaveMinigame extends PlayerCommand {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,9 +1,9 @@
|
||||||
package alisolarflare.components.minigames.commands;
|
/*package graveyard.minigames.commands;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.architecture.commands.PlayerCommand;
|
import alisolarflare.architecture.commands.PlayerCommand;
|
||||||
import alisolarflare.components.minigames.MinigameComponent;
|
import graveyard.minigames.MinigameComponent;
|
||||||
|
|
||||||
public class ListFighters extends PlayerCommand {
|
public class ListFighters extends PlayerCommand {
|
||||||
private MinigameComponent component;
|
private MinigameComponent component;
|
||||||
|
@ -24,3 +24,4 @@ public class ListFighters extends PlayerCommand {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,9 +1,9 @@
|
||||||
package alisolarflare.components.minigames.commands;
|
/*package graveyard.minigames.commands;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.architecture.commands.ModCommand;
|
import alisolarflare.architecture.commands.ModCommand;
|
||||||
import alisolarflare.components.minigames.data.SpawnSet;
|
import graveyard.minigames.data.SpawnSet;
|
||||||
|
|
||||||
public class SetColourSpawn extends ModCommand{
|
public class SetColourSpawn extends ModCommand{
|
||||||
private SpawnSet spawnSet;
|
private SpawnSet spawnSet;
|
||||||
|
@ -62,3 +62,4 @@ public class SetColourSpawn extends ModCommand{
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package alisolarflare.components.minigames.data;
|
/*package graveyard.minigames.data;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
@ -11,3 +11,4 @@ public class SpawnSet {
|
||||||
public Location PSpawn;
|
public Location PSpawn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package graveyard.thebuttonrebirth;
|
/*package graveyard.thebuttonrebirth;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -68,3 +68,4 @@ public class ButtonRebirthPlugin extends JavaPlugin{
|
||||||
shrineCreator.createShrine(chestX, chestY, chestZ, 10, Material.BEDROCK);
|
shrineCreator.createShrine(chestX, chestY, chestZ, 10, Material.BEDROCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package graveyard.thebuttonrebirth.admin;
|
/*package graveyard.thebuttonrebirth.admin;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
@ -96,7 +96,7 @@ public class CreateShrine implements CommandExecutor{
|
||||||
sender.sendMessage("Error in CreateShrine Class: No world defined in config...");
|
sender.sendMessage("Error in CreateShrine Class: No world defined in config...");
|
||||||
sender.sendMessage("Defining world based on player location.");
|
sender.sendMessage("Defining world based on player location.");
|
||||||
|
|
||||||
/*
|
|
||||||
//Changes world variable in config file
|
//Changes world variable in config file
|
||||||
if (sender instanceof Player){
|
if (sender instanceof Player){
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
@ -107,14 +107,14 @@ public class CreateShrine implements CommandExecutor{
|
||||||
//Sends player the result of the change
|
//Sends player the result of the change
|
||||||
sender.sendMessage("World variable set to " + player.getWorld().getName() + "in config file");
|
sender.sendMessage("World variable set to " + player.getWorld().getName() + "in config file");
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (!(player.hasPermission("Moderator") || player.hasPermission("Admin"))){
|
if (!(player.hasPermission("Moderator") || player.hasPermission("Admin"))){
|
||||||
player.sendMessage(ChatColor.RED + "You must be in the group Moderator or Admin to access this command!");
|
player.sendMessage(ChatColor.RED + "You must be in the group Moderator or Admin to access this command!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
chestX = plugin.getConfig().getInt("chestX");
|
chestX = plugin.getConfig().getInt("chestX");
|
||||||
chestY = plugin.getConfig().getInt("chestY");
|
chestY = plugin.getConfig().getInt("chestY");
|
||||||
chestZ = plugin.getConfig().getInt("chestZ");
|
chestZ = plugin.getConfig().getInt("chestZ");
|
||||||
|
@ -126,3 +126,4 @@ public class CreateShrine implements CommandExecutor{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package graveyard.thebuttonrebirth.commands;
|
/*package graveyard.thebuttonrebirth.commands;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
@ -28,3 +28,4 @@ public class ShowBars implements CommandExecutor{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package graveyard.thebuttonrebirth.listeners;
|
/*package graveyard.thebuttonrebirth.listeners;
|
||||||
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
@ -17,3 +17,4 @@ public class CyclicalDisplayListener implements Listener{
|
||||||
bukkitTask = cyclicalDisplayTask.runTaskTimer(this.plugin, 20, 20);
|
bukkitTask = cyclicalDisplayTask.runTaskTimer(this.plugin, 20, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package graveyard.thebuttonrebirth.listeners;
|
/*package graveyard.thebuttonrebirth.listeners;
|
||||||
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
@ -17,3 +17,4 @@ public class MidnightListener implements Listener{
|
||||||
checkChestTask = new CheckChestTask(this.plugin).runTaskTimer(this.plugin, 20, 60);
|
checkChestTask = new CheckChestTask(this.plugin).runTaskTimer(this.plugin, 20, 60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package graveyard.thebuttonrebirth.listeners;
|
/*package graveyard.thebuttonrebirth.listeners;
|
||||||
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
@ -16,3 +16,4 @@ public class StealChestListener implements Listener{
|
||||||
stealChestTask = new StealChestTask(this.plugin).runTaskTimer(this.plugin, 20, 20);
|
stealChestTask = new StealChestTask(this.plugin).runTaskTimer(this.plugin, 20, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,169 +1,169 @@
|
||||||
package graveyard.thebuttonrebirth.tasks;
|
//package graveyard.thebuttonrebirth.tasks;
|
||||||
|
//
|
||||||
import java.time.Clock;
|
//import java.time.Clock;
|
||||||
import java.time.LocalDateTime;
|
//import java.time.LocalDateTime;
|
||||||
|
//
|
||||||
import org.bukkit.ChatColor;
|
//import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
//import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
//import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
//import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
//import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
//import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Chest;
|
//import org.bukkit.block.Chest;
|
||||||
import org.bukkit.inventory.Inventory;
|
//import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
//import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
//
|
||||||
import graveyard.thebuttonrebirth.ButtonRebirthPlugin;
|
//import graveyard.thebuttonrebirth.ButtonRebirthPlugin;
|
||||||
import graveyard.thebuttonrebirth.admin.CreateShrine;
|
//import graveyard.thebuttonrebirth.admin.CreateShrine;
|
||||||
|
//
|
||||||
public class CheckChestTask extends BukkitRunnable{
|
//public class CheckChestTask extends BukkitRunnable{
|
||||||
//Plugin
|
// //Plugin
|
||||||
private final ButtonRebirthPlugin BRplugin;
|
// private final ButtonRebirthPlugin BRplugin;
|
||||||
private World world;
|
// private World world;
|
||||||
|
//
|
||||||
//Chest
|
// //Chest
|
||||||
private int chestX;
|
// private int chestX;
|
||||||
private int chestY;
|
// private int chestY;
|
||||||
private int chestZ;
|
// private int chestZ;
|
||||||
private Block chestBlock;
|
// private Block chestBlock;
|
||||||
private Chest shrineChest;
|
// private Chest shrineChest;
|
||||||
private Inventory shrineInventory;
|
// private Inventory shrineInventory;
|
||||||
|
//
|
||||||
//Time
|
// //Time
|
||||||
private LocalDateTime currentTime;
|
// private LocalDateTime currentTime;
|
||||||
private LocalDateTime configTime;
|
// private LocalDateTime configTime;
|
||||||
|
//
|
||||||
private int minimumDiamondBlocks;
|
// private int minimumDiamondBlocks;
|
||||||
private int diamondsInserted;
|
// private int diamondsInserted;
|
||||||
|
//
|
||||||
public CheckChestTask(ButtonRebirthPlugin initBRplugin){
|
// public CheckChestTask(ButtonRebirthPlugin initBRplugin){
|
||||||
//INIT - plugin
|
// //INIT - plugin
|
||||||
this.BRplugin = initBRplugin;
|
// this.BRplugin = initBRplugin;
|
||||||
|
//
|
||||||
//INIT - chestX, chestY, chestZ
|
// //INIT - chestX, chestY, chestZ
|
||||||
chestX = BRplugin.getConfig().getInt("chestX");
|
// chestX = BRplugin.getConfig().getInt("chestX");
|
||||||
chestY = BRplugin.getConfig().getInt("chestY");
|
// chestY = BRplugin.getConfig().getInt("chestY");
|
||||||
chestZ = BRplugin.getConfig().getInt("chestZ");
|
// chestZ = BRplugin.getConfig().getInt("chestZ");
|
||||||
|
//
|
||||||
//INIT - World
|
// //INIT - World
|
||||||
world = BRplugin.getServer().getWorld(BRplugin.getConfig().getString("world"));
|
// world = BRplugin.getServer().getWorld(BRplugin.getConfig().getString("world"));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void run(){
|
// public void run(){
|
||||||
//run() activates every 20 server ticks.
|
// //run() activates every 20 server ticks.
|
||||||
|
//
|
||||||
//CHECK - Plugin is Enabled
|
// //CHECK - Plugin is Enabled
|
||||||
if (BRplugin.isEnabled() == false){
|
// if (BRplugin.isEnabled() == false){
|
||||||
this.cancel();
|
// this.cancel();
|
||||||
}
|
// }
|
||||||
//CHECK - World Exists
|
// //CHECK - World Exists
|
||||||
if (!(BRplugin.getServer().getWorlds().contains(BRplugin.getServer().getWorld(BRplugin.getConfig().getString("world"))))) {
|
// if (!(BRplugin.getServer().getWorlds().contains(BRplugin.getServer().getWorld(BRplugin.getConfig().getString("world"))))) {
|
||||||
BRplugin.logger.info("Error: Config world does not exist in Server.");
|
// BRplugin.logger.info("Error: Config world does not exist in Server.");
|
||||||
BRplugin.logger.info("Server Worlds: " + BRplugin.getServer().getWorlds().toString());
|
// BRplugin.logger.info("Server Worlds: " + BRplugin.getServer().getWorlds().toString());
|
||||||
BRplugin.logger.info("Config World: " + BRplugin.getConfig().getString("world"));
|
// BRplugin.logger.info("Config World: " + BRplugin.getConfig().getString("world"));
|
||||||
BRplugin.logger.info("Turning off Display...");
|
// BRplugin.logger.info("Turning off Display...");
|
||||||
this.cancel();
|
// this.cancel();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//INIT - currentTime, configTime
|
// //INIT - currentTime, configTime
|
||||||
currentTime = LocalDateTime.now(Clock.systemUTC());
|
// currentTime = LocalDateTime.now(Clock.systemUTC());
|
||||||
configTime = LocalDateTime.parse(BRplugin.getConfig().getString("lastCheckChestTime"));
|
// configTime = LocalDateTime.parse(BRplugin.getConfig().getString("lastCheckChestTime"));
|
||||||
|
//
|
||||||
//TIME - Current Time after Config Time
|
// //TIME - Current Time after Config Time
|
||||||
if (currentTime.isAfter(configTime)){
|
// if (currentTime.isAfter(configTime)){
|
||||||
|
//
|
||||||
//SANITIZE "world"
|
// //SANITIZE "world"
|
||||||
if (BRplugin.getConfig().getString("world") == null) BRplugin.getServer().broadcastMessage("Error: No world defined in config file.");
|
// if (BRplugin.getConfig().getString("world") == null) BRplugin.getServer().broadcastMessage("Error: No world defined in config file.");
|
||||||
if (BRplugin.getServer().getWorlds() == null) BRplugin.getServer().broadcastMessage("Error: plugin.getServer().getWorlds() returns null");
|
// if (BRplugin.getServer().getWorlds() == null) BRplugin.getServer().broadcastMessage("Error: plugin.getServer().getWorlds() returns null");
|
||||||
|
//
|
||||||
//INIT - world, chestBlock
|
// //INIT - world, chestBlock
|
||||||
chestBlock = world.getBlockAt(chestX, chestY, chestZ);
|
// chestBlock = world.getBlockAt(chestX, chestY, chestZ);
|
||||||
|
//
|
||||||
//SANITIZE - chestBlock
|
// //SANITIZE - chestBlock
|
||||||
if (!(chestBlock.getType() == Material.CHEST)){
|
// if (!(chestBlock.getType() == Material.CHEST)){
|
||||||
damageShrine();
|
// damageShrine();
|
||||||
reconstructShrine();
|
// reconstructShrine();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//INIT - shrineChest, shrineInventory
|
// //INIT - shrineChest, shrineInventory
|
||||||
shrineChest = (Chest) chestBlock.getState();
|
// shrineChest = (Chest) chestBlock.getState();
|
||||||
shrineInventory = shrineChest.getInventory();
|
// shrineInventory = shrineChest.getInventory();
|
||||||
|
//
|
||||||
|
//
|
||||||
//UPDATE - configTime
|
// //UPDATE - configTime
|
||||||
BRplugin.getConfig().set("lastCheckChestTime", currentTime.plusMinutes(BRplugin.getConfig().getInt("barDuration")).toString());
|
// BRplugin.getConfig().set("lastCheckChestTime", currentTime.plusMinutes(BRplugin.getConfig().getInt("barDuration")).toString());
|
||||||
BRplugin.saveConfig();
|
// BRplugin.saveConfig();
|
||||||
|
//
|
||||||
//INIT - minimumDiamondBlocks, diamondsInserted
|
// //INIT - minimumDiamondBlocks, diamondsInserted
|
||||||
minimumDiamondBlocks = BRplugin.getConfig().getInt("minimumDiamondBlocks");
|
// minimumDiamondBlocks = BRplugin.getConfig().getInt("minimumDiamondBlocks");
|
||||||
diamondsInserted = BRplugin.getConfig().getInt("diamondsInserted");
|
// diamondsInserted = BRplugin.getConfig().getInt("diamondsInserted");
|
||||||
|
//
|
||||||
//CHECK - chest for diamonds
|
// //CHECK - chest for diamonds
|
||||||
if(diamondsInserted > minimumDiamondBlocks || shrineInventory.contains(Material.DIAMOND_BLOCK, (minimumDiamondBlocks - diamondsInserted))){
|
// if(diamondsInserted > minimumDiamondBlocks || shrineInventory.contains(Material.DIAMOND_BLOCK, (minimumDiamondBlocks - diamondsInserted))){
|
||||||
//INVENTORY SUCCESS
|
// //INVENTORY SUCCESS
|
||||||
|
//
|
||||||
//CHECK - First Time
|
// //CHECK - First Time
|
||||||
if (minimumDiamondBlocks == 0){
|
// if (minimumDiamondBlocks == 0){
|
||||||
broadcastExperimentHasBegun();
|
// broadcastExperimentHasBegun();
|
||||||
}else{
|
// }else{
|
||||||
broadcastButtonRefuled();
|
// broadcastButtonRefuled();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//UPDATE minimumDiamondBlocks
|
// //UPDATE minimumDiamondBlocks
|
||||||
minimumDiamondBlocks++;
|
// minimumDiamondBlocks++;
|
||||||
BRplugin.getConfig().set("minimumDiamondBlocks", minimumDiamondBlocks);
|
// BRplugin.getConfig().set("minimumDiamondBlocks", minimumDiamondBlocks);
|
||||||
BRplugin.getConfig().set("diamondsInserted", 0);
|
// BRplugin.getConfig().set("diamondsInserted", 0);
|
||||||
BRplugin.saveConfig();
|
// BRplugin.saveConfig();
|
||||||
}else{
|
// }else{
|
||||||
//INVENTORY FAILURE
|
// //INVENTORY FAILURE
|
||||||
damageShrine();
|
// damageShrine();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//RESET - shrine, shrineInventory
|
// //RESET - shrine, shrineInventory
|
||||||
reconstructShrine();
|
// reconstructShrine();
|
||||||
shrineInventory.clear();
|
// shrineInventory.clear();
|
||||||
BRplugin.getConfig().set("diamondsInserted",0);
|
// BRplugin.getConfig().set("diamondsInserted",0);
|
||||||
|
//
|
||||||
}else{
|
// }else{
|
||||||
//currentTime is before config time.
|
// //currentTime is before config time.
|
||||||
//therefore wait.
|
// //therefore wait.
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
private void damageShrine(){
|
// private void damageShrine(){
|
||||||
//UPDATE - buttonHealth
|
// //UPDATE - buttonHealth
|
||||||
int buttonHealth = BRplugin.getConfig().getInt("buttonHealth");
|
// int buttonHealth = BRplugin.getConfig().getInt("buttonHealth");
|
||||||
buttonHealth--;
|
// buttonHealth--;
|
||||||
BRplugin.getConfig().set("buttonHealth", buttonHealth);
|
// BRplugin.getConfig().set("buttonHealth", buttonHealth);
|
||||||
|
//
|
||||||
//DISPLAY AND MAKE SOUND
|
// //DISPLAY AND MAKE SOUND
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.DARK_RED + "--------------------------");
|
// BRplugin.getServer().broadcastMessage(ChatColor.DARK_RED + "--------------------------");
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.DARK_RED + "----- BUTTON DAMAGED -----");
|
// BRplugin.getServer().broadcastMessage(ChatColor.DARK_RED + "----- BUTTON DAMAGED -----");
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.DARK_RED + "--------------------------");
|
// BRplugin.getServer().broadcastMessage(ChatColor.DARK_RED + "--------------------------");
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.RED + " " + buttonHealth + "s of Health left");
|
// BRplugin.getServer().broadcastMessage(ChatColor.RED + " " + buttonHealth + "s of Health left");
|
||||||
world.playSound(new Location(world,chestX,chestY,chestZ), Sound.ENTITY_ENDERDRAGON_DEATH,50,1);
|
// world.playSound(new Location(world,chestX,chestY,chestZ), Sound.ENTITY_ENDERDRAGON_DEATH,50,1);
|
||||||
world.playSound(new Location(world,chestX,chestY,chestZ), Sound.ENTITY_LIGHTNING_THUNDER,50,1);
|
// world.playSound(new Location(world,chestX,chestY,chestZ), Sound.ENTITY_LIGHTNING_THUNDER,50,1);
|
||||||
world.playSound(new Location(world,chestX,chestY,chestZ), Sound.ENTITY_GENERIC_EXPLODE,50,50);
|
// world.playSound(new Location(world,chestX,chestY,chestZ), Sound.ENTITY_GENERIC_EXPLODE,50,50);
|
||||||
}
|
// }
|
||||||
private void reconstructShrine(){
|
// private void reconstructShrine(){
|
||||||
CreateShrine shrineConstructor= new CreateShrine(BRplugin);
|
// CreateShrine shrineConstructor= new CreateShrine(BRplugin);
|
||||||
shrineConstructor.createShrine(chestX, chestY, chestZ, 10, Material.BEDROCK);
|
// shrineConstructor.createShrine(chestX, chestY, chestZ, 10, Material.BEDROCK);
|
||||||
}
|
// }
|
||||||
private void broadcastExperimentHasBegun(){
|
// private void broadcastExperimentHasBegun(){
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "------------------------------------");
|
// BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "------------------------------------");
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "----- THE EXPERIMENT HAS BEGUN -----");
|
// BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "----- THE EXPERIMENT HAS BEGUN -----");
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "------------------------------------");
|
// BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "------------------------------------");
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.BLUE + " " + minimumDiamondBlocks + " Blocks required");
|
// BRplugin.getServer().broadcastMessage(ChatColor.BLUE + " " + minimumDiamondBlocks + " Blocks required");
|
||||||
world.playSound(new Location(world,chestX,chestY,chestZ), Sound.ENTITY_WITHER_SPAWN,50,10);
|
// world.playSound(new Location(world,chestX,chestY,chestZ), Sound.ENTITY_WITHER_SPAWN,50,10);
|
||||||
}
|
// }
|
||||||
private void broadcastButtonRefuled(){
|
// private void broadcastButtonRefuled(){
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "--------------------------");
|
// BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "--------------------------");
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "----- BUTTON REFULED -----");
|
// BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "----- BUTTON REFULED -----");
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "--------------------------");
|
// BRplugin.getServer().broadcastMessage(ChatColor.AQUA + "--------------------------");
|
||||||
BRplugin.getServer().broadcastMessage(ChatColor.BLUE + " " + minimumDiamondBlocks + " Blocks required");
|
// BRplugin.getServer().broadcastMessage(ChatColor.BLUE + " " + minimumDiamondBlocks + " Blocks required");
|
||||||
world.playSound(new Location(world,chestX,chestY,chestZ), Sound.ENTITY_WITHER_SPAWN,50,10);
|
// world.playSound(new Location(world,chestX,chestY,chestZ), Sound.ENTITY_WITHER_SPAWN,50,10);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package graveyard.thebuttonrebirth.tasks;
|
/*package graveyard.thebuttonrebirth.tasks;
|
||||||
|
|
||||||
import java.time.Clock;
|
import java.time.Clock;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
@ -213,7 +213,7 @@ public class CyclicalDisplayTask extends BukkitRunnable{
|
||||||
if (stack.getType() == Material.DIAMOND_BLOCK){
|
if (stack.getType() == Material.DIAMOND_BLOCK){
|
||||||
totalDiamonds += stack.getAmount();
|
totalDiamonds += stack.getAmount();
|
||||||
}
|
}
|
||||||
}catch(Exception e){/*stack isn't a diamond block*/}
|
}catch(Exception e){stack isn't a diamond block}
|
||||||
}
|
}
|
||||||
|
|
||||||
diamondBar.setProgress((diamondsInserted+totalDiamonds)/(double)minimumDiamondBlocks);
|
diamondBar.setProgress((diamondsInserted+totalDiamonds)/(double)minimumDiamondBlocks);
|
||||||
|
@ -243,3 +243,4 @@ public class CyclicalDisplayTask extends BukkitRunnable{
|
||||||
currentBar = barCycleDuration * (bar);
|
currentBar = barCycleDuration * (bar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,4 +1,4 @@
|
||||||
package graveyard.thebuttonrebirth.tasks;
|
/*package graveyard.thebuttonrebirth.tasks;
|
||||||
|
|
||||||
import java.time.Clock;
|
import java.time.Clock;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
@ -135,7 +135,7 @@ public class StealChestTask extends BukkitRunnable{
|
||||||
totalDiamonds += (stack.getAmount() *1);
|
totalDiamonds += (stack.getAmount() *1);
|
||||||
|
|
||||||
}
|
}
|
||||||
}catch(Exception e){/*stack is empty*/}
|
}catch(Exception e){stack is empty}
|
||||||
}
|
}
|
||||||
shrineInventory.clear();
|
shrineInventory.clear();
|
||||||
diamondsInserted += totalDiamonds;
|
diamondsInserted += totalDiamonds;
|
||||||
|
@ -198,3 +198,4 @@ public class StealChestTask extends BukkitRunnable{
|
||||||
return closestPlayer;
|
return closestPlayer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
Loading…
Reference in a new issue