Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Drison64 authored Oct 25, 2019
1 parent d441f84 commit dd73107
Show file tree
Hide file tree
Showing 15 changed files with 1,016 additions and 0 deletions.
28 changes: 28 additions & 0 deletions data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
lobby:
maintenance:
1: false
2: false
3: false
4: false
5: false
servers:
1:
enabled: false
host: 167.86.92.68
port: 25567
2:
enabled: false
host: 167.86.92.68
port: 25568
3:
enabled: false
host: 167.86.92.68
port: 25569
4:
enabled: false
host: 167.86.92.68
port: 25570
5:
enabled: false
host: 167.86.92.68
port: 25571
72 changes: 72 additions & 0 deletions me/Drison64/Lobby/ASclick.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package me.Drison64.Lobby;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityInteractEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.ItemStack;

import java.time.Instant;
import java.util.Arrays;
import java.util.Date;
import java.util.Timer;

public class ASclick implements Listener {

public void clicked(Entity entity, Player player) {
if (entity.getType().equals(EntityType.ARMOR_STAND)) {
if (entity.getCustomName().equals(ChatColor.BLUE + "Daily Reward")) {
customConfig.reload();
/*
if (customConfig.get().isSet("dailyreward." + player.getName() + ".timestamp")) {
long now = Instant.now().getEpochSecond();
long finish = customConfig.get().getLong("dailyreward." + player.getName() + ".timestamp") + 86400;
player.openInventory(dailyReward.inv);
long seconds = (finish - now) % 60;
long hours = (finish - now) / 60;
long minutes = hours % 60;
hours = hours / 60;
if (!((finish - now) == 0)) {
dailyReward.inv.setItem(1, new ItemStack(mkitem.mkitem(1, Material.COAL, "Daily Reward", Arrays.asList("", "Next in " + hours + ":" + minutes + ":" + seconds))));
} else {
customConfig.get().set("dailyreward." + player.getName() + ".timestamp", null);
}
} else {
dailyReward.inv.setItem(1, new ItemStack(mkitem.mkitem(1, Material.DIAMOND, "Daily Reward", Arrays.asList("", "Click to get!"))));
}
*/
player.openInventory(dailyReward.inv);
} else if (entity.getCustomName().equals(ChatColor.BLUE + "Tic Tac Toe")) {
player.openInventory(Bukkit.createInventory(null, 27, "Tic tac toe menu"));
customConfig.save();
player.getOpenInventory().getTopInventory().setItem(11, mkitem.mkitem(1, Material.DIRT, "Random", Arrays.asList("")));
player.getOpenInventory().getTopInventory().setItem(15, mkitem.mkitem(1, Material.DIAMOND_BLOCK, "Enter name", Arrays.asList("")));
}
}
}

@EventHandler
public void onEntityClick(PlayerInteractAtEntityEvent e) {
e.setCancelled(true);
clicked(e.getRightClicked(), e.getPlayer());
}

@EventHandler
public void onDamage(EntityDamageByEntityEvent e) {
e.setCancelled(true);
if (e.getDamager() instanceof Player) {
clicked(e.getEntity(), (Player) e.getDamager());
}
}

}
Loading

0 comments on commit dd73107

Please sign in to comment.