Skip to content

Commit

Permalink
Version 1.3
Browse files Browse the repository at this point in the history
Update for 1.9
Use Maven
  • Loading branch information
Vinnie committed May 2, 2016
1 parent 95b43a4 commit a39059a
Show file tree
Hide file tree
Showing 6 changed files with 505 additions and 258 deletions.
137 changes: 137 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# =========================
# Java Files
# =========================
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*


# Maven
# =========================
target/
dependency-reduced-pom.xml


# =========================
# IDE Files
# =========================

# IntelliJ
# =========================
.idea/
.idea_modules/
out/
*.iml
*.ipr
*.iws


# NetBeans
# =========================
nbproject/private/
build/
dist/
deploy/
nbproject/
nbactions.xml
nb-configuration.xml


# Eclipse
# =========================
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.project
.externalToolBuilders/
*.launch
.classpath
.factorypath
.buildpath
.target
.texlipse
.springBeans


# =========================
# Operating System Files
# =========================

# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


# Windows
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk


# Linux
# =========================
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*
Binary file removed lib/Bukkit-1.8.jar
Binary file not shown.
51 changes: 51 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?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.coolv1994</groupId>
<artifactId>vote4item</artifactId>
<version>1.3</version>

<name>Vote4Item</name>
<description>A vote listener that run commands from a txt file.</description>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.9-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.vexsoftware</groupId>
<artifactId>votifier</artifactId>
<version>1.9</version>
<scope>system</scope>
<systemPath>${basedir}/lib/Votifier-1.9.jar</systemPath>
</dependency>
</dependencies>

<build>
<finalName>${name}</finalName>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
33 changes: 0 additions & 33 deletions src/ItemDrop.java

This file was deleted.

69 changes: 69 additions & 0 deletions src/main/java/RewardTask.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.Map;
import java.util.List;

/**
* Created by Vinnie on 12/17/2014.
*/
public class RewardTask implements Runnable {
// The player instance
private Player player;
// The vote reward
private ItemStack[] items;
// Broadcast messages
private List<String> broadcast;
// Private messages
private List<String> pm;
// Reward messages
private String claimed;
private String dropped;

public RewardTask() {
}

public RewardTask(Player player, ItemStack[] items,
List<String> broadcast, List<String> pm,
String claimed, String dropped) {
this.player = player;
this.items = items;
this.broadcast = broadcast;
this.pm = pm;
this.claimed = claimed;
this.dropped = dropped;
}

@Override
public void run() {
// Broadcast Message
for (String message : broadcast) {
Bukkit.broadcastMessage(message);
}
// No player / Offline
if (player == null) {
return;
}
// Private Messages
for (String message : pm) {
player.sendMessage(message);
}
// Give Item
Map<Integer, ItemStack> failed = player.getInventory().addItem(items);
if (failed.isEmpty()) {
player.sendMessage(claimed);
return;
}
// No free space, Drop on ground
Location location = player.getLocation();
World world = player.getWorld();
for (ItemStack item : failed.values()) {
world.dropItem(location, item);
player.sendMessage(dropped.replaceAll("\\{item\\}", item.getType().name()));
}
player.sendMessage(claimed);
}
}
Loading

0 comments on commit a39059a

Please sign in to comment.