mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 00:30:07 +01:00
Merge remote branch 'org.eclipse.jgit.transport.RemoteConfig@10a3c73/master'
This commit is contained in:
commit
1aa231c902
@ -75,11 +75,16 @@ public class mcBlockListener implements Listener
|
||||
//Check if the blocks placed should be monitored so they do not give out XP in the future
|
||||
if(m.shouldBeWatched(block))
|
||||
{
|
||||
if(block.getTypeId() != 17 && block.getTypeId() != 39 && block.getTypeId() != 40 && block.getTypeId() != 91 && block.getTypeId() != 86)
|
||||
block.setData((byte) 5); //Change the byte
|
||||
else if(block.getTypeId() == 17 || block.getTypeId() == 39 || block.getTypeId() == 40 || block.getTypeId() == 91 || block.getTypeId() == 86)
|
||||
if(block.getTypeId() != 17 && block.getTypeId() != 39 && block.getTypeId() != 40 && block.getTypeId() != 91 && block.getTypeId() != 86) {
|
||||
//block.setData((byte) 5); //Change the byte
|
||||
//The following is a method to get around a breakage in 1.1-R2 and onward
|
||||
//it should be removed as soon as functionality to change a block
|
||||
//in this event returns.
|
||||
plugin.changeQueue.push(block);
|
||||
} else if(block.getTypeId() == 17 || block.getTypeId() == 39 || block.getTypeId() == 40 || block.getTypeId() == 91 || block.getTypeId() == 86) {
|
||||
plugin.misc.blockWatchList.add(block);
|
||||
}
|
||||
}
|
||||
|
||||
if(block.getTypeId() == 42 && LoadProperties.anvilmessages)
|
||||
{
|
||||
|
@ -89,6 +89,9 @@ public class m
|
||||
public static boolean shouldBeWatched(Block block)
|
||||
{
|
||||
int id = block.getTypeId();
|
||||
return shouldBeWatched(id);
|
||||
}
|
||||
public static boolean shouldBeWatched(int id) {
|
||||
return id == 103 || id == 82 || id == 16 || id == 73 || id == 49 || id == 81 || id == 83 || id == 86 || id == 91 || id == 1 || id == 17 || id == 42 || id == 87 || id == 89 || id == 2 || id == 3 || id == 12 || id == 13 || id == 21 || id == 15 || id == 14 || id == 56 || id == 38 || id == 37 || id == 39 || id == 40 || id == 24;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ import com.gmail.nossr50.commands.mc.*;
|
||||
import com.gmail.nossr50.commands.party.*;
|
||||
import com.gmail.nossr50.commands.general.*;
|
||||
import com.gmail.nossr50.config.*;
|
||||
import com.gmail.nossr50.runnables.mcTimer;
|
||||
import com.gmail.nossr50.runnables.*;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
import com.gmail.nossr50.listeners.mcBlockListener;
|
||||
import com.gmail.nossr50.listeners.mcEntityListener;
|
||||
@ -35,6 +35,7 @@ import com.gmail.nossr50.skills.*;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
@ -44,6 +45,7 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
@ -52,6 +54,7 @@ import java.util.logging.Logger;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.player.FileManager;
|
||||
@ -84,6 +87,7 @@ public class mcMMO extends JavaPlugin
|
||||
private Permissions permissions;
|
||||
|
||||
private Runnable mcMMO_Timer = new mcTimer(this); //BLEED AND REGENERATION
|
||||
private Runnable ChangeDataValueTimer = new ChangeDataValueTimer(this); //R2 block place workaround
|
||||
//private Timer mcMMO_SpellTimer = new Timer(true);
|
||||
|
||||
//Alias - Command
|
||||
@ -97,6 +101,9 @@ public class mcMMO extends JavaPlugin
|
||||
//Jar stuff
|
||||
public static File mcmmo;
|
||||
|
||||
//Queue for block data change for R2+ fix
|
||||
public ArrayDeque<Block> changeQueue = new ArrayDeque<Block>();
|
||||
|
||||
public void onEnable()
|
||||
{
|
||||
mcmmo = this.getFile();
|
||||
@ -157,6 +164,8 @@ public class mcMMO extends JavaPlugin
|
||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_Timer, 0, 20);
|
||||
//R2+ block place fix
|
||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, ChangeDataValueTimer, 0, 10);
|
||||
|
||||
registerCommands();
|
||||
|
||||
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
This file is part of mcMMO.
|
||||
|
||||
mcMMO is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
mcMMO is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
/*
|
||||
* This file was created for a breakage introduced in 1.1-R2
|
||||
* It should be removed afterwards if the breakage is removed.
|
||||
*/
|
||||
public class ChangeDataValueTimer implements Runnable {
|
||||
private mcMMO plugin;
|
||||
|
||||
public ChangeDataValueTimer(mcMMO instance) {
|
||||
this.plugin = instance;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
int size = plugin.changeQueue.size();
|
||||
if(size == 0) return;
|
||||
if(size > 25) {
|
||||
size = (int) Math.floor(size / 10);
|
||||
}
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
Block change = plugin.changeQueue.poll();
|
||||
if(change == null) continue;
|
||||
change.setData((byte) 5);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user