From 8f97b8b94bb455c5487648cf79fe84ee6873a12c Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 16 Feb 2014 01:32:02 -0700 Subject: [PATCH] Prevent jobs from earning players money. Add temporary revenue source. Add bug report announcement message. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 24 +++++++++++++++++-- .../src/me/kaZep/Base/PlayerBuffData.java | 2 +- .../src/me/kaZep/Base/PlayerData.java | 1 + .../src/me/kaZep/Base/PlayerListener.java | 4 ++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 7301711..ecb116b 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -2489,13 +2489,29 @@ public void runTick() { } } } + if (Main.SERVER_TICK_TIME%72000==0) { + for (int i=0;i10000) {earned=20;} else { + earned=(getPlayerData(SPEED_CONTROL.get(i).p).gameinteractions/10000d)*10d; + } + economy.depositPlayer(p.getName(), earned); + getPlayerData(SPEED_CONTROL.get(i).p).gameinteractions=0; + DecimalFormat df = new DecimalFormat("#0.00"); + SPEED_CONTROL.get(i).p.sendMessage(ChatColor.YELLOW+"You made $"+df.format(earned)+" in the past hour!"); SPEED_CONTROL.get(i).updatePlayerSpd(); - try + /*try { String filename= "PlayerBuffData.txt"; FileWriter fw = new FileWriter(filename,true); //the true will append the new data @@ -2509,7 +2525,7 @@ public void runTick() { catch(IOException ioe) { System.err.println("IOException: " + ioe.getMessage()); - } + }*/ } } if (Main.SERVER_TICK_TIME%600==0) { @@ -4231,7 +4247,9 @@ public void payDay(int time) public void gainMoneyExp(String p,String job,double amount,double exp) { Player m = Bukkit.getPlayer(p); if (m!=null) { + /* DISABLED AT THE MOMENT. gainMoneyExp(m,job,amount,exp); + */ } else { Bukkit.getLogger().severe("Could not find player "+p+"! Could not add in job experience!"); } @@ -4272,6 +4290,7 @@ public void payDay(int time) } public void gainMoneyExp(Player p,String job,double amount,double exp) { + /* DISABLED AT THE MOMENT. String[] jobs = getJobs(p); int slot=-1; if (getConfig().getBoolean("halloween-enabled") || getConfig().getBoolean("thanksgiving-enabled")) { @@ -4314,6 +4333,7 @@ public void payDay(int time) } } //saveAccountsConfig() //Commented out; + */ } public void levelUpJob(Player p, String job) { diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java index 8263e50..04009a1 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java @@ -261,7 +261,7 @@ public class PlayerBuffData { last_money_report_time=Main.SERVER_TICK_TIME; if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify6")) { DecimalFormat df = new DecimalFormat("#0.00"); - p.sendMessage(ChatColor.YELLOW+""+ChatColor.ITALIC+"You have earned $"+df.format(money_gained)+" from your jobs in the past hour."); + //p.sendMessage(ChatColor.YELLOW+""+ChatColor.ITALIC+"You have earned $"+df.format(money_gained)+" from your jobs in the past hour."); } money_gained=0; } diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerData.java b/BankEconomyMod/src/me/kaZep/Base/PlayerData.java index c5cfb92..316fee9 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerData.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerData.java @@ -8,6 +8,7 @@ import org.bukkit.entity.Player; public class PlayerData { int buildamt=10; Material lastblocktype=null; + int gameinteractions=0; long lastinteracttime=0; long lastminetime=0; long lastsneaktime=0; diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index cfc5bf8..ac73703 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -4479,6 +4479,8 @@ implements Listener //p.sendMessage("Name is: "+p.getItemInHand().getItemMeta().getDisplayName()); int myData=this.plugin.getPlayerDataSlot(p); boolean has_silktouch=p.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH); + + this.plugin.getPlayerData(p).gameinteractions+=50; //*******************************//Job Buffs Begin here! if (this.plugin.hasJobBuff("Builder", p, Job.JOB40) && p.getAllowFlight()) { @@ -12053,6 +12055,7 @@ implements Listener @EventHandler public void onBlockPlace(BlockPlaceEvent e) { Player p = e.getPlayer(); + this.plugin.getPlayerData(p).gameinteractions+=50; //***********************************//JOB BUFFFS!!! HYPE if (this.plugin.PlayerinJob(p, "Builder")) { if (this.plugin.hasJobBuff("Builder", p, Job.JOB40) && !p.getAllowFlight()) { @@ -16228,6 +16231,7 @@ implements Listener public void onPlayerMove(PlayerMoveEvent e) { if (e.getPlayer().isOnGround() && this.plugin.hasJobBuff("Fisherman", e.getPlayer(), Job.JOB40) && e.getPlayer().getItemInHand().getType()==Material.FISHING_ROD && !e.getPlayer().getAllowFlight()) { this.plugin.getPlayerData(e.getPlayer()).haslanded=true; + this.plugin.getPlayerData(e.getPlayer()).gameinteractions+=1; e.getPlayer().setAllowFlight(true); e.getPlayer().sendMessage(ChatColor.DARK_GRAY+""+ChatColor.ITALIC+"Flight enabled..."); }