Skip to content
Snippets Groups Projects
Commit f81cd1c1 authored by Zandor Smith's avatar Zandor Smith :computer:
Browse files

+ Added main files.

parent 2d6c66bf
No related branches found
No related tags found
No related merge requests found
pom.xml 0 → 100644
<?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>com.zandor300</groupId>
<artifactId>TorchLight</artifactId>
<version>1.8-1.0.0</version>
<name>TorchLight</name>
<repositories>
<repository>
<id>MavenPi</id>
<url>http://play.zsinfo.nl/maven</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<type>jar</type>
<version>1.8-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<type>jar</type>
<version>1.8-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.zandor300</groupId>
<artifactId>ZSUtilities</artifactId>
<type>jar</type>
<version>1.8-1.0.4.1</version>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-alpha-6</version>
</extension>
</extensions>
</build>
<distributionManagement>
<repository>
<id>MavenPi-FTP</id>
<url>ftp://192.168.1.18/var/www/maven</url>
</repository>
</distributionManagement>
</project>
\ No newline at end of file
/**
* Copyright 2015 Zandor Smith
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zandor300.torchlight;
import com.zandor300.zsutilities.utilities.Chat;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
/**
* @author Zandor Smith
* @since 1.0.0
*/
public class TorchLight extends JavaPlugin {
private static HashMap<String, BlockState> playerState = new HashMap<String, BlockState>();
private static Chat chat = new Chat("TorchLight");
private static TorchLight plugin;
@Override
public void onEnable() {
chat.sendConsoleMessage("Setting things up...");
plugin = this;
chat.sendConsoleMessage("Starting timers...");
Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
@Override
public void run() {
for(Player player : Bukkit.getOnlinePlayers()) {
if(!player.getItemInHand().getType().equals(Material.TORCH)) {
if (playerState.get(player.getName()) != null) {
BlockState state = playerState.get(player.getName());
state.getLocation().getBlock().setType(state.getType());
state.getLocation().getBlock().setData(state.getData().getData());
}
playerState.put(player.getName(), null);
} else {
BlockState state = playerState.get(player.getName());
state.getLocation().getBlock().setType(state.getType());
state.getLocation().getBlock().setData(state.getData().getData());
Location location = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY() - 1, player.getLocation().getZ());
playerState.put(player.getName(), location.getBlock().getState());
location.getBlock().setType(Material.GLOWSTONE);
}
}
}
}, 20l, 1l);
chat.sendConsoleMessage("Timers started.");
chat.sendConsoleMessage("Everything is setup!");
chat.sendConsoleMessage("Enabled.");
}
@Override
public void onDisable() {
}
public static Chat getChat() {
return chat;
}
public static TorchLight getPlugin() {
return plugin;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment