mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
Another WIP
This commit is contained in:
parent
947174c34e
commit
07796c78b4
@ -56,7 +56,7 @@ public class Combat {
|
|||||||
event.setDamage(event.getDamage()+4);
|
event.setDamage(event.getDamage()+4);
|
||||||
|
|
||||||
//If there are any abilities to activate
|
//If there are any abilities to activate
|
||||||
combatAbilityChecks(attacker, PPa);
|
combatAbilityChecks(attacker, PPa, pluginx);
|
||||||
|
|
||||||
//Check for offensive procs
|
//Check for offensive procs
|
||||||
Axes.axeCriticalCheck(attacker, eventb); //Axe Criticals
|
Axes.axeCriticalCheck(attacker, eventb); //Axe Criticals
|
||||||
@ -118,10 +118,17 @@ public class Combat {
|
|||||||
//Taming Debug Stuff
|
//Taming Debug Stuff
|
||||||
if(event.getEntity() instanceof Wolf)
|
if(event.getEntity() instanceof Wolf)
|
||||||
{
|
{
|
||||||
attacker.sendMessage("mcMMO Debug: Wolf Owner Name "+Taming.getOwnerName(event.getEntity()));
|
if(attacker.getItemInHand().getTypeId() == 352)
|
||||||
|
{
|
||||||
|
attacker.sendMessage(ChatColor.GREEN+"**You examine the Wolf using Beast Lore**");
|
||||||
|
if(Taming.getOwnerName(event.getEntity()) != null)
|
||||||
|
attacker.sendMessage(ChatColor.DARK_GREEN+"The Beast's Master : "+Taming.getOwnerName(event.getEntity()));
|
||||||
|
else
|
||||||
|
attacker.sendMessage(ChatColor.GRAY+"This Beast has no Master...");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* OFFENSIVE CHECKS FOR WOLVES VERSUS ENTITIES
|
* OFFENSIVE CHECKS FOR WOLVES VERSUS ENTITIES
|
||||||
*/
|
*/
|
||||||
@ -195,14 +202,14 @@ public class Combat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void combatAbilityChecks(Player attacker, PlayerProfile PPa){
|
public static void combatAbilityChecks(Player attacker, PlayerProfile PPa, Plugin pluginx){
|
||||||
//Check to see if any abilities need to be activated
|
//Check to see if any abilities need to be activated
|
||||||
if(PPa.getAxePreparationMode())
|
if(PPa.getAxePreparationMode())
|
||||||
Skills.skullSplitterCheck(attacker, plugin);
|
Skills.skullSplitterCheck(attacker, pluginx);
|
||||||
if(PPa.getSwordsPreparationMode())
|
if(PPa.getSwordsPreparationMode())
|
||||||
Skills.serratedStrikesActivationCheck(attacker, plugin);
|
Skills.serratedStrikesActivationCheck(attacker, pluginx);
|
||||||
if(PPa.getFistsPreparationMode())
|
if(PPa.getFistsPreparationMode())
|
||||||
Skills.berserkActivationCheck(attacker, plugin);
|
Skills.berserkActivationCheck(attacker, pluginx);
|
||||||
}
|
}
|
||||||
public static void archeryCheck(EntityDamageByProjectileEvent event){
|
public static void archeryCheck(EntityDamageByProjectileEvent event){
|
||||||
Entity y = event.getDamager();
|
Entity y = event.getDamager();
|
||||||
|
@ -125,8 +125,6 @@ public class Database {
|
|||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
HashMap<Integer, ArrayList<String>> Rows = new HashMap<Integer, ArrayList<String>>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
stmt = this.conn.prepareStatement(sql);
|
stmt = this.conn.prepareStatement(sql);
|
||||||
if (stmt.executeQuery() != null) {
|
if (stmt.executeQuery() != null) {
|
||||||
@ -147,8 +145,6 @@ public class Database {
|
|||||||
System.out.println("VendorError: " + ex.getErrorCode());
|
System.out.println("VendorError: " + ex.getErrorCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// release dataset
|
// release dataset
|
||||||
if (rs != null) {
|
if (rs != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -3,8 +3,11 @@ package com.gmail.nossr50.config;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class mcProperties extends Properties{
|
public class mcProperties extends Properties{
|
||||||
//private static volatile mcProperties instance;
|
//private static volatile mcProperties instance;
|
||||||
@ -22,6 +25,30 @@ public class mcProperties extends Properties{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void makeProperties(File Properties, Logger log){
|
||||||
|
if(!Properties.exists()){
|
||||||
|
try {
|
||||||
|
Properties.createNewFile();
|
||||||
|
FileWriter writer = null;
|
||||||
|
try {
|
||||||
|
writer = new FileWriter(Properties);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.log(Level.SEVERE, "Exception while creating " + Properties, e);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (writer != null) {
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.log(Level.SEVERE, "Exception while closing writer for " + Properties, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public void save(String start){
|
public void save(String start){
|
||||||
try{
|
try{
|
||||||
store(new FileOutputStream(this.fileName), start);
|
store(new FileOutputStream(this.fileName), start);
|
||||||
|
@ -69,6 +69,8 @@ public class PlayerProfile
|
|||||||
public boolean loadMySQL(Player p) {
|
public boolean loadMySQL(Player p) {
|
||||||
Integer id = 0;
|
Integer id = 0;
|
||||||
id = mcMMO.database.GetInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + p.getName() + "'");
|
id = mcMMO.database.GetInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + p.getName() + "'");
|
||||||
|
if(id == 0)
|
||||||
|
return false;
|
||||||
this.userid = id;
|
this.userid = id;
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
HashMap<Integer, ArrayList<String>> users = mcMMO.database.Read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id);
|
HashMap<Integer, ArrayList<String>> users = mcMMO.database.Read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id);
|
||||||
|
@ -53,29 +53,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
mcMMO_Timer.schedule(new mcTimer(this), (long)0, (long)(1000));
|
mcMMO_Timer.schedule(new mcTimer(this), (long)0, (long)(1000));
|
||||||
new File(maindirectory).mkdir();
|
new File(maindirectory).mkdir();
|
||||||
|
//Check if props file exists, if not make it
|
||||||
if(!Properties.exists()){
|
mcProperties.makeProperties(Properties, log);
|
||||||
try {
|
|
||||||
Properties.createNewFile();
|
|
||||||
FileWriter writer = null;
|
|
||||||
try {
|
|
||||||
writer = new FileWriter(Properties);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.log(Level.SEVERE, "Exception while creating " + Properties, e);
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (writer != null) {
|
|
||||||
writer.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.log(Level.SEVERE, "Exception while closing writer for " + Properties, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Load the file
|
//Load the file
|
||||||
LoadProperties.loadMain();
|
LoadProperties.loadMain();
|
||||||
Users.getInstance().loadUsers();
|
Users.getInstance().loadUsers();
|
||||||
@ -89,7 +68,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Lowest, this);
|
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Lowest, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Priority.Highest, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_FROMTO, blockListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.BLOCK_FROMTO, blockListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Monitor, this);
|
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Monitor, this);
|
||||||
@ -102,8 +81,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
mcPermissions.initialize(getServer());
|
mcPermissions.initialize(getServer());
|
||||||
mcLoadMySQL();
|
mcLoadMySQL();
|
||||||
database.createStructure(); //Make Structure
|
database.createStructure(); //Make Structure
|
||||||
|
if(!LoadProperties.useMySQL)
|
||||||
//Leaderboard.makeLeaderboards(); //Make the leaderboards
|
Leaderboard.makeLeaderboards(); //Make the leaderboards
|
||||||
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.CreatureType;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
@ -102,6 +103,8 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
Block targetBlock = player.getTargetBlock(null, 20);
|
Block targetBlock = player.getTargetBlock(null, 20);
|
||||||
player.sendMessage("Target Block TypeID = "+targetBlock.getTypeId());
|
player.sendMessage("Target Block TypeID = "+targetBlock.getTypeId());
|
||||||
player.sendMessage("Target Block Byte Data = "+targetBlock.getData());
|
player.sendMessage("Target Block Byte Data = "+targetBlock.getData());
|
||||||
|
player.sendMessage("Wold Entity List SIZE : "+targetBlock.getWorld().getEntities().size());
|
||||||
|
player.sendMessage("Chunk Entity List SIZE : "+targetBlock.getChunk().getEntities().length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(player.getItemInHand().getTypeId() == 261 && LoadProperties.archeryFireRateLimit){
|
if(player.getItemInHand().getTypeId() == 261 && LoadProperties.archeryFireRateLimit){
|
||||||
@ -204,6 +207,8 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
if(split[0].equalsIgnoreCase("/details")){
|
if(split[0].equalsIgnoreCase("/details")){
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
player.getLocation().getWorld().spawnCreature(player.getLocation(), CreatureType.WOLF);
|
||||||
|
player.getLocation().getWorld().spawnCreature(player.getLocation(), CreatureType.WOLF);
|
||||||
player.sendMessage("Material : "+player.getItemInHand().getType());
|
player.sendMessage("Material : "+player.getItemInHand().getType());
|
||||||
player.sendMessage("Type ID : "+player.getItemInHand().getTypeId());
|
player.sendMessage("Type ID : "+player.getItemInHand().getTypeId());
|
||||||
player.sendMessage("Byte Data : "+player.getItemInHand().getDurability());
|
player.sendMessage("Byte Data : "+player.getItemInHand().getDurability());
|
||||||
@ -331,6 +336,8 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
|
|
||||||
for(int i=n;i<=n+10;i++)
|
for(int i=n;i<=n+10;i++)
|
||||||
{
|
{
|
||||||
|
if (i >= userslist.size())
|
||||||
|
break;
|
||||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||||
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
||||||
}
|
}
|
||||||
@ -344,6 +351,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||||
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if(split.length >= 1)
|
if(split.length >= 1)
|
||||||
{
|
{
|
||||||
@ -363,6 +371,8 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
+LoadProperties.MySQLtablePrefix+"skills ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
|
+LoadProperties.MySQLtablePrefix+"skills ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
|
||||||
for(int i=n;i<=n+10;i++)
|
for(int i=n;i<=n+10;i++)
|
||||||
{
|
{
|
||||||
|
if (i >= userslist.size())
|
||||||
|
break;
|
||||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||||
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
||||||
}
|
}
|
||||||
@ -372,6 +382,8 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
+LoadProperties.MySQLtablePrefix+"skills ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
|
+LoadProperties.MySQLtablePrefix+"skills ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
|
||||||
for(int i=1;i<=10;i++)
|
for(int i=1;i<=10;i++)
|
||||||
{
|
{
|
||||||
|
if (i >= userslist.size())
|
||||||
|
break;
|
||||||
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
|
||||||
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
|
||||||
//System.out.println(username.get(1).get(0));
|
//System.out.println(username.get(1).get(0));
|
||||||
@ -394,6 +406,7 @@ public class mcPlayerListener extends PlayerListener {
|
|||||||
/*
|
/*
|
||||||
* PREP MODES
|
* PREP MODES
|
||||||
*/
|
*/
|
||||||
|
PP = Users.getProfile(player);
|
||||||
PP.setRecentlyHurt((long) 0);
|
PP.setRecentlyHurt((long) 0);
|
||||||
PP.setHoePreparationMode(false);
|
PP.setHoePreparationMode(false);
|
||||||
PP.setAxePreparationMode(false);
|
PP.setAxePreparationMode(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user