Skip to content

Commit

Permalink
Merge pull request #1 from lampask/develop
Browse files Browse the repository at this point in the history
Develop branch
  • Loading branch information
lampask authored Nov 24, 2019
2 parents cf8b05d + 34ecc4b commit ba48512
Show file tree
Hide file tree
Showing 26 changed files with 2,015 additions and 0 deletions.
120 changes: 120 additions & 0 deletions bedyeetus.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 22, 2019 at 11:16 PM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.11

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `bedyeetus`
--

-- --------------------------------------------------------

--
-- Table structure for table `games`
--

CREATE TABLE `games` (
`id` int(50) NOT NULL,
`name` varchar(50) NOT NULL,
`world` varchar(50) NOT NULL,
`x` decimal(10,0) NOT NULL,
`y` decimal(10,0) NOT NULL,
`z` decimal(10,0) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `spawners`
--

CREATE TABLE `spawners` (
`id` int(50) NOT NULL,
`type` varchar(50) NOT NULL,
`game_id` int(50) NOT NULL,
`x` int(10) NOT NULL,
`y` int(10) NOT NULL,
`z` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Table structure for table `teams`
--

CREATE TABLE `teams` (
`id` int(50) NOT NULL,
`name` int(50) NOT NULL,
`game_id` int(50) NOT NULL,
`spawn_x` decimal(10,0) NOT NULL,
`spawn_y` decimal(10,0) NOT NULL,
`spawn_z` decimal(10,0) NOT NULL,
`nexus_x` decimal(10,0) NOT NULL,
`nexus_y` decimal(10,0) NOT NULL,
`nexus_z` decimal(10,0) NOT NULL,
`d_shop_x` decimal(10,0) NOT NULL,
`d_shop_y` decimal(10,0) NOT NULL,
`d_shop_z` decimal(10,0) NOT NULL,
`e_shop_x` decimal(10,0) NOT NULL,
`e_shop_y` decimal(10,0) NOT NULL,
`e_shop_z` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `games`
--
ALTER TABLE `games`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `spawners`
--
ALTER TABLE `spawners`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `teams`
--
ALTER TABLE `teams`
ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `games`
--
ALTER TABLE `games`
MODIFY `id` int(50) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `teams`
--
ALTER TABLE `teams`
MODIFY `id` int(50) NOT NULL AUTO_INCREMENT;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
88 changes: 88 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>sk.riesky</groupId>
<artifactId>Bedyeet</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Bedyeetus</name>

<description>Simple Bedwars plugin for riesky vikendovka 2019 event</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>papermc-repo</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>

</dependencies>
</project>
32 changes: 32 additions & 0 deletions src/main/java/sk/riesky/bedyeet/Bedyeetus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package sk.riesky.bedyeet;

import org.bukkit.plugin.java.JavaPlugin;
import sk.riesky.bedyeet.Commands.Join;
import sk.riesky.bedyeet.Commands.Leave;
import sk.riesky.bedyeet.Commands.MainCommand;
import sk.riesky.bedyeet.Resources.Config;
import sk.riesky.bedyeet.Resources.Constants;
import sk.riesky.bedyeet.Resources.Database;


public final class Bedyeetus extends JavaPlugin {

@Override
public void onEnable() {
Config.getInstance().init(this);
//Database.getInstance().init(this);
// Commands
this.getCommand(Constants.main_command).setExecutor(new MainCommand(this));
this.getCommand("join").setExecutor(new Join());
this.getCommand("leave").setExecutor(new Leave());
}

@Override
public void onDisable() {
// Plugin shutdown logic7
for (Game g: Manager.getInstance().getGames().values()) {
g.delete();
}

}
}
36 changes: 36 additions & 0 deletions src/main/java/sk/riesky/bedyeet/Classes/DiamondShop.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package sk.riesky.bedyeet.Classes;

import javafx.util.Pair;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;

import java.util.Arrays;

public class DiamondShop extends Shop {
String name = ChatColor.AQUA + "Diamond Shop";

public DiamondShop(Location loc) {
super(loc);
this.shop_villager.setCustomName(this.name);
this.shop_gui = Bukkit.createInventory(this, 45, this.name);
super.prices = Arrays.asList(
new Pair<>(19, 4),
new Pair<>(20, 6),
new Pair<>(21, 4),
new Pair<>(22, 1),
new Pair<>(23, 1),
new Pair<>(24, 1),
new Pair<>(25, 4),
new Pair<>(31, 1)
);
}

public void initializeItems() {
super.getInventory().addItem(super.createGuiItem(Material.DIAMOND_SWORD, "Example Sword", "§aFirst line of the lore", "§bSecond line of the lore"));
super.getInventory().addItem(super.createGuiItem(Material.IRON_HELMET, "§bExample Helmet", "§aFirst line of the lore", "§bSecond line of the lore"));
}


}
51 changes: 51 additions & 0 deletions src/main/java/sk/riesky/bedyeet/Classes/DiamondSpawner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package sk.riesky.bedyeet.Classes;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import sk.riesky.bedyeet.Bedyeetus;
import sk.riesky.bedyeet.Events.GameStartEvent;

public class DiamondSpawner extends Spawner {
private long delay = 120000/50;
private int iterator = 0;

public DiamondSpawner(Location loc, Bedyeetus main) {
super(loc, main, Material.DIAMOND_BLOCK, new ItemStack(Material.DIAMOND));
}

void runTask() {
cancelTask();
Bukkit.getScheduler().runTaskLater(main, new Runnable() {

@Override
public void run() {
iterator++;
Bukkit.getLogger().info("created");
if (iterator == 10) {
delay = 80000/50;
} else if (iterator == 40) {
delay = 60000/50;
}
spawnItem();
task = main.getServer().getScheduler().runTaskLater(main, this, delay);
}

}, this.delay);
}

void cancelTask() {
if (task != null) try {
task.cancel();
} catch(Throwable ex) {
// Ignore.
}
}

@EventHandler
public void OnGameStart(GameStartEvent event) {
this.runTask();
}
}
Loading

0 comments on commit ba48512

Please sign in to comment.