mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 16:19:53 +01:00
A WIP of 0.9 - Not recommended to use currently but it seems half-stable on my server.
This commit is contained in:
parent
2f6dbfccfc
commit
cb0960ee6e
@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -69,29 +71,34 @@ public class mcBlockListener extends BlockListener {
|
||||
/*
|
||||
* IF PLAYER IS USING TREEFELLER
|
||||
*/
|
||||
/*
|
||||
if(mcPermissions.getInstance().woodcuttingability(player)){
|
||||
player.sendMessage(ChatColor.RED+"TIIIIIIIIIIIMBER");
|
||||
mcWoodCutting.getInstance().treeFeller(block);
|
||||
if(mcPermissions.getInstance().woodcuttingability(player) && mcUsers.getProfile(player).getTreeFellerMode() && block.getTypeId() == 17){
|
||||
mcWoodCutting.getInstance().treeFeller(block, player);
|
||||
for(Block blockx : mcConfig.getInstance().getTreeFeller()){
|
||||
if(blockx != null){
|
||||
Material mat = Material.getMaterial(blockx.getTypeId());
|
||||
byte damage = 0;
|
||||
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
blockx.setTypeId(0);
|
||||
if(item.getTypeId() == 17)
|
||||
if(item.getTypeId() == 17){
|
||||
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
|
||||
mcWoodCutting.getInstance().woodCuttingProcCheck(player, blockx, blockx.getLocation());
|
||||
mcUsers.getProfile(player).addWoodcuttingGather(7);
|
||||
}
|
||||
if(item.getTypeId() == 18){
|
||||
mat = Material.getMaterial(6);
|
||||
item = new ItemStack(mat, 1, (byte)0, damage);
|
||||
if(Math.random() * 10 > 6)
|
||||
if(Math.random() * 10 > 8)
|
||||
blockx.getLocation().getWorld().dropItemNaturally(blockx.getLocation(), item);
|
||||
}
|
||||
}
|
||||
//mcConfig.getInstance().removeTreeFeller(blockx);
|
||||
}
|
||||
/*
|
||||
* NOTE TO SELF
|
||||
* I NEED TO REMOVE TREE FELL BLOCKS FROM BEING WATCHED AFTER THIS CODE IS EXECUTED
|
||||
* OR ELSE IT COULD BE A MEMORY LEAK SITUATION
|
||||
*/
|
||||
mcConfig.getInstance().clearTreeFeller();
|
||||
}
|
||||
*/
|
||||
}
|
||||
/*
|
||||
* EXCAVATION
|
||||
|
@ -32,6 +32,9 @@ public class mcConfig {
|
||||
public void removeBleedTrack(Entity entity){
|
||||
bleedTracker.remove(entity);
|
||||
}
|
||||
public void clearTreeFeller(){
|
||||
treeFeller.clear();
|
||||
}
|
||||
public void setBleedCount(Entity entity, Integer newvalue){
|
||||
bleedTracker.add(entity);
|
||||
}
|
||||
|
@ -69,6 +69,20 @@ public class mcPlayerListener extends PlayerListener {
|
||||
Block block = event.getBlockClicked();
|
||||
Player player = event.getPlayer();
|
||||
ItemStack is = player.getItemInHand();
|
||||
if(mcPermissions.getInstance().woodcuttingability(player) && mcm.getInstance().isAxes(is)){
|
||||
if(block != null){
|
||||
if(!mcm.getInstance().abilityBlockCheck(block))
|
||||
return;
|
||||
}
|
||||
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
|
||||
player.sendMessage(ChatColor.GRAY+"You feel great strength enter you");
|
||||
mcUsers.getProfile(player).setTreeFellerTicks(8);
|
||||
mcUsers.getProfile(player).setTreeFellerMode(true);
|
||||
}
|
||||
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){
|
||||
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again.");
|
||||
}
|
||||
}
|
||||
if(mcPermissions.getInstance().herbalism(player)){
|
||||
//BREADCHECK, CHECKS HERBALISM SKILL FOR BREAD HP MODIFIERS
|
||||
mcHerbalism.getInstance().breadCheck(player, is);
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.gmail.nossr50;
|
||||
import java.awt.Color;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
public class mcTimer extends TimerTask{
|
||||
@ -13,6 +15,7 @@ public class mcTimer extends TimerTask{
|
||||
|
||||
public void run() {
|
||||
Player[] playerlist = plugin.getServer().getOnlinePlayers();
|
||||
/*
|
||||
if(thecount == 5 || thecount == 10 || thecount == 15 || thecount == 20){
|
||||
for(Player player : playerlist){
|
||||
if(player != null &&
|
||||
@ -58,5 +61,29 @@ public class mcTimer extends TimerTask{
|
||||
thecount = 1;
|
||||
}
|
||||
mcCombat.getInstance().bleedSimulate();
|
||||
*/
|
||||
/*
|
||||
* TREE FELLER INTERACTIONS
|
||||
*/
|
||||
for(Player player : playerlist){
|
||||
if(mcPermissions.getInstance().woodcuttingability(player)){
|
||||
//Monitor the length of TreeFeller mode
|
||||
if(mcUsers.getProfile(player).getTreeFellerMode()){
|
||||
mcUsers.getProfile(player).decreaseTreeFellerTicks();
|
||||
if(mcUsers.getProfile(player).getTreeFellerTicks() <= 0){
|
||||
mcUsers.getProfile(player).setTreeFellerMode(false);
|
||||
mcUsers.getProfile(player).setTreeFellerCooldown(120);
|
||||
player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**");
|
||||
}
|
||||
}
|
||||
//Monitor the cooldown
|
||||
if(!mcUsers.getProfile(player).getTreeFellerMode() && mcUsers.getProfile(player).getTreeFellerCooldown() >= 1){
|
||||
mcUsers.getProfile(player).decreaseTreeFellerCooldown();
|
||||
if(mcUsers.getProfile(player).getTreeFellerCooldown() == 0){
|
||||
player.sendMessage(ChatColor.GREEN+"Your Tree Felling ability is refreshed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,8 +156,8 @@ class PlayerList
|
||||
protected final Logger log = Logger.getLogger("Minecraft");
|
||||
private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation,
|
||||
archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
|
||||
private boolean dead;
|
||||
private int recentlyhurt = 0, bleedticks = 0;
|
||||
private boolean dead, treefellermode;
|
||||
private int recentlyhurt = 0, bleedticks = 0, treefellerticks = 0, treefellercooldown = 0;
|
||||
Player thisplayer;
|
||||
char defaultColor;
|
||||
|
||||
@ -206,7 +206,7 @@ class PlayerList
|
||||
//gather = "0";
|
||||
party = null;
|
||||
dead = false;
|
||||
|
||||
treefellermode = false;
|
||||
//Try to load the player and if they aren't found, append them
|
||||
if(!load())
|
||||
addPlayer();
|
||||
@ -433,6 +433,34 @@ class PlayerList
|
||||
public void setBleedTicks(Integer newvalue){
|
||||
bleedticks = newvalue;
|
||||
}
|
||||
public boolean getTreeFellerMode(){
|
||||
return treefellermode;
|
||||
}
|
||||
public void setTreeFellerMode(Boolean bool){
|
||||
treefellermode = bool;
|
||||
}
|
||||
public Integer getTreeFellerTicks(){
|
||||
return treefellerticks;
|
||||
}
|
||||
public void setTreeFellerTicks(Integer newvalue){
|
||||
treefellerticks = newvalue;
|
||||
}
|
||||
public void decreaseTreeFellerTicks(){
|
||||
if(treefellerticks >= 1){
|
||||
treefellerticks--;
|
||||
}
|
||||
}
|
||||
public void setTreeFellerCooldown(Integer newvalue){
|
||||
treefellercooldown = newvalue;
|
||||
}
|
||||
public int getTreeFellerCooldown(){
|
||||
return treefellercooldown;
|
||||
}
|
||||
public void decreaseTreeFellerCooldown(){
|
||||
if(treefellercooldown >= 1){
|
||||
treefellercooldown--;
|
||||
}
|
||||
}
|
||||
public Integer getRecentlyHurt(){
|
||||
return recentlyhurt;
|
||||
}
|
||||
|
@ -34,8 +34,12 @@ public class mcWoodCutting {
|
||||
}
|
||||
}
|
||||
}
|
||||
public void treeFeller(Block block){
|
||||
public void treeFeller(Block block, Player player){
|
||||
int radius = 1;
|
||||
if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= 500)
|
||||
radius++;
|
||||
if(mcUsers.getProfile(player).getWoodCuttingGatherInt() >= 950)
|
||||
radius++;
|
||||
ArrayList<Block> blocklist = new ArrayList<Block>();
|
||||
ArrayList<Block> toAdd = new ArrayList<Block>();
|
||||
if(block != null)
|
||||
|
@ -35,6 +35,14 @@ public class mcm {
|
||||
return Math.sqrt(Math.pow(loca.getX() - locb.getX(), 2) + Math.pow(loca.getY() - locb.getY(), 2)
|
||||
+ Math.pow(loca.getZ() - locb.getZ(), 2));
|
||||
}
|
||||
public boolean abilityBlockCheck(Block block){
|
||||
int i = block.getTypeId();
|
||||
if(i == 58 || i == 61 || i == 42 || i == 71 || i == 64 || i == 84 || i == 324 || i == 330){
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean isBlockAround(Location loc, Integer radius, Integer typeid){
|
||||
Block blockx = loc.getBlock();
|
||||
int ox = blockx.getX();
|
||||
|
@ -1,3 +1,3 @@
|
||||
name: mcMMO
|
||||
main: com.gmail.nossr50.mcMMO
|
||||
version: 0.8.16
|
||||
version: 0.9 WIP
|
Loading…
Reference in New Issue
Block a user