-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xcoldfyrex
committed
Apr 21, 2013
0 parents
commit 188ac65
Showing
15 changed files
with
572 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
<classpathentry kind="lib" path="/home/lenny/mc_dev/plugins/WaffleLib.jar"/> | ||
<classpathentry kind="lib" path="/home/lenny/mc_dev/craftbukkit-dev.jar"> | ||
<attributes> | ||
<attribute name="javadoc_location" value="http://jd.bukkit.org/apidocs/"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>WaffleCraft</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/com/cfdigital/wafflecraft/WaffleCraft.java=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: WaffleCraft | ||
main: com.cfdigital.wafflecraft.WaffleCraft | ||
version: 1.0 | ||
author: ColdFyre | ||
depend: | ||
- Vault | ||
- WaffleLib | ||
description: WaffleCraft | ||
commands: | ||
Skill: | ||
description: WaffleCraft main menu | ||
usage: /skill | ||
WC: | ||
description: WaffleCraft administrative menu | ||
usage: /wc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package com.cfdigital.wafflecraft; | ||
|
||
import org.bukkit.Material; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.entity.*; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
import org.bukkit.plugin.PluginManager; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
import com.cfdigital.wafflecraft.classes.ClassManager; | ||
import com.cfdigital.wafflecraft.classes.PlayerClass; | ||
import com.cfdigital.wafflecraft.commands.Skill; | ||
import com.cfdigital.wafflecraft.commands.WC; | ||
import com.cfdigital.wafflecraft.listeners.BlockListener; | ||
import com.cfdigital.wafflecraft.listeners.PlayerListener; | ||
import com.cfdigital.wafflecraft.util.Config; | ||
import com.cfdigital.wafflecraft.util.WaffleLogger; | ||
|
||
|
||
public class WaffleCraft extends JavaPlugin { | ||
|
||
public WaffleCraft plugin; | ||
|
||
public static String prefix = "§6[§aWaffleCraft§6]§f "; | ||
|
||
public WaffleCraft() { | ||
plugin = this; | ||
} | ||
|
||
private final PlayerListener playerListener = new PlayerListener(this); | ||
private final BlockListener blockListener = new BlockListener(this); | ||
|
||
@Override | ||
public void onEnable() | ||
{ | ||
PluginManager pm = getServer().getPluginManager(); | ||
pm.registerEvents(playerListener, this); | ||
pm.registerEvents(blockListener, this); | ||
|
||
Config config = new Config(this); | ||
|
||
if (!config.loadClasses()){ | ||
WaffleLogger.severe("Failed to load classes! Disabling.."); | ||
this.plugin.onDisable(); | ||
} | ||
|
||
getCommand("wc").setExecutor(new WC(this)); | ||
getCommand("skill").setExecutor(new Skill(this)); | ||
|
||
for (Player player : getServer().getOnlinePlayers()) { | ||
PlayerClass pc = new PlayerClass(player); | ||
ClassManager.addWafflePlayer(player, pc); | ||
} | ||
} | ||
|
||
@Override | ||
public void onDisable() { | ||
plugin.getServer().getScheduler().cancelTasks(plugin); | ||
} | ||
|
||
public boolean rankAllowed(Material material) { | ||
//probably came from placing or mining | ||
return true; | ||
} | ||
|
||
public boolean rankAllowed(ItemStack itemstack) { | ||
//was something that was crafted | ||
return true; | ||
} | ||
|
||
public boolean rankAllowed(Item items) { | ||
//probably picked up | ||
return true; | ||
} | ||
|
||
public boolean rankAllowed(Player player, Block block) { | ||
//broke/placed | ||
return false; | ||
} | ||
|
||
public void showDenied(Player player) { | ||
player.sendMessage(prefix + "Your rank is not high enough for this!"); | ||
|
||
} | ||
|
||
public boolean isItemInClass(Material material) { | ||
return false; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.cfdigital.wafflecraft.classes; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
import org.bukkit.Material; | ||
import org.bukkit.entity.Player; | ||
|
||
public class ClassManager { | ||
|
||
private static HashMap<String,SkillClass> waffleClasses = new HashMap<String,SkillClass>(); | ||
private static HashMap<Player,PlayerClass> playerClass = new HashMap<Player,PlayerClass>(); | ||
private static List<Material> registeredItems = new ArrayList<Material>(); | ||
|
||
public static SkillClass WaffleClass(String className) { | ||
if (waffleClasses.containsKey(className)) { | ||
return waffleClasses.get(className); | ||
} | ||
return null; | ||
} | ||
|
||
public static boolean addWaffleClass(String className, SkillClass WC) { | ||
if (waffleClasses.containsKey(className)) return false; | ||
waffleClasses.put(className, WC); | ||
return true; | ||
} | ||
|
||
public static boolean addWafflePlayer(Player player, PlayerClass pc) { | ||
if (playerClass.containsKey(player)) return false; | ||
playerClass.put(player, pc); | ||
return true; | ||
} | ||
|
||
public static void clearWaffleClasses() { | ||
waffleClasses.clear(); | ||
} | ||
|
||
public static HashMap<String,SkillClass> getWaffleClasses(){ | ||
return waffleClasses; | ||
} | ||
|
||
public static PlayerClass getPlayerClass(Player player) { | ||
if (!playerClass.containsKey(player)) return null; | ||
PlayerClass pc = playerClass.get(player); | ||
return pc; | ||
} | ||
|
||
public static List<Material> getRegisteredItems() { | ||
return registeredItems; | ||
} | ||
|
||
public static void addRegisteredItems(List<Material> registeredItems) { | ||
ClassManager.registeredItems = registeredItems; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.cfdigital.wafflecraft.classes; | ||
|
||
import org.bukkit.ChatColor; | ||
import org.bukkit.entity.Player; | ||
|
||
public class PlayerClass { | ||
|
||
public PlayerClass(Player player) { | ||
this.player = player; | ||
} | ||
|
||
public String getSkillClass() { | ||
if (skillClass == null) { | ||
return null; | ||
} | ||
return skillClass.toString(); | ||
} | ||
public void setSkillClass(String skillClass) { | ||
if (ClassManager.WaffleClass(skillClass) != null) { | ||
this.skillClass = skillClass; | ||
} else { | ||
player.sendMessage(ChatColor.RED + "That class does not exist!"); | ||
} | ||
} | ||
|
||
public int getskillLevel() { | ||
return skillLevel; | ||
} | ||
|
||
public void setskillLevel(int skillRank) { | ||
this.skillLevel = skillRank; | ||
} | ||
|
||
public Player getPlayer() { | ||
return player; | ||
} | ||
|
||
public void setPlayer(Player player) { | ||
this.player = player; | ||
} | ||
|
||
private int skillLevel = 1; | ||
private String skillClass; | ||
private Player player; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.cfdigital.wafflecraft.classes; | ||
|
||
import java.util.List; | ||
|
||
import org.bukkit.Material; | ||
import org.bukkit.craftbukkit.libs.jline.internal.Log; | ||
|
||
public class SkillClass { | ||
public SkillClass (String className, List<?> classItems, int pointsRequired) { | ||
this.setPointsRequired(pointsRequired); | ||
int x = 0; | ||
while (x < classItems.size()) { | ||
Material material = Material.valueOf(classItems.get(x).toString()); | ||
Log.warn(material); | ||
this.classItems.add(material); | ||
} | ||
} | ||
|
||
public List<Material> getClassItems() { | ||
return classItems; | ||
} | ||
|
||
public int getPointsRequired() { | ||
return pointsRequired; | ||
} | ||
|
||
private void setPointsRequired(int pointsRequired) { | ||
this.pointsRequired = pointsRequired; | ||
} | ||
|
||
public String getClassName() { | ||
return className; | ||
} | ||
|
||
private List<Material> classItems; | ||
private int pointsRequired; | ||
private String className; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.cfdigital.wafflecraft.commands; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
import com.cfdigital.wafflecraft.WaffleCraft; | ||
|
||
public class Skill implements CommandExecutor { | ||
|
||
WaffleCraft plugin; | ||
|
||
public Skill(WaffleCraft plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { | ||
String commandName = command.getName().toLowerCase(); | ||
String[] trimmedArgs = args; | ||
Player player = (Player) sender; | ||
if (commandName.equalsIgnoreCase("skill")) { | ||
player.sendMessage("You have X SkillPoints left to spend"); | ||
|
||
return true; | ||
} | ||
|
||
if (commandName.equalsIgnoreCase("skill help")) { | ||
return true; | ||
} | ||
return true; | ||
} | ||
} |
Oops, something went wrong.