Skip to content

Commit

Permalink
Updates for CPU usage
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceribs committed Jun 23, 2014
1 parent 4e7d4dc commit 550e568
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ minecraft/plugins/Metropolis/disabled
Metropolis.jar
minecraft/world_nether
minecraft/world_the_end
minecraft/crash-reports
1 change: 1 addition & 0 deletions minecraft/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider :virtualbox do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "6144"]
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "60"]
end

# View the documentation for the provider you're using for more
Expand Down
10 changes: 5 additions & 5 deletions minecraft/server.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Minecraft server properties
#Sun Jun 15 20:38:04 UTC 2014
#Thu Jun 19 18:17:58 EDT 2014
generator-settings=
op-permission-level=4
allow-nether=true
Expand All @@ -18,19 +18,19 @@ spawn-npcs=true
white-list=false
debug=false
spawn-animals=true
snooper-enabled=true
hardcore=false
snooper-enabled=true
online-mode=true
resource-pack=
pvp=true
difficulty=1
server-name=Metropolis Testing
enable-command-block=false
player-idle-timeout=0
server-name=Metropolis Testing
gamemode=0
player-idle-timeout=0
max-players=20
spawn-monsters=true
view-distance=10
generate-structures=true
view-distance=10
spawn-protection=16
motd=A Minecraft Server
68 changes: 34 additions & 34 deletions minecraft/spigot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,55 @@
# Forums: http://www.spigotmc.org/forum/

config-version: 6
commands:
replace-commands:
- setblock
- summon
- testforblock
- tellraw
tab-complete: 0
silent-commandblock-console: false
spam-exclusions:
- /skill
log: true
settings:
timeout-time: 600
restart-on-crash: true
restart-script: ./start.sh
netty-threads: 4
save-user-cache-on-stop-only: false
user-cache-size: 1000
player-shuffle: 0
bungeecord: false
save-user-cache-on-stop-only: false
late-bind: false
sample-count: 12
filter-creative-items: true
late-bind: false
timeout-time: 600
restart-on-crash: true
restart-script: ./start.sh
netty-threads: 4
stats:
disable-saving: false
forced-stats: {}
commands:
tab-complete: 0
silent-commandblock-console: false
spam-exclusions:
- /skill
log: true
replace-commands:
- setblock
- summon
- testforblock
- tellraw
messages:
restart: Server is restarting
whitelist: You are not whitelisted on this server!
unknown-command: Unknown command. Type "/help" for help.
server-full: The server is full!
outdated-client: Outdated client! Please use {}
outdated-server: Outdated server! I'm still on {0}
stats:
disable-saving: false
forced-stats: {}
restart: Server is restarting
world-settings:
default:
verbose: true
mob-spawn-range: 4
view-distance: 10
chunks-per-tick: 650
clear-tick-list: false
merge-radius:
exp: 3.0
item: 2.5
nerf-spawner-mobs: false
item-despawn-rate: 6000
arrow-despawn-rate: 1200
enable-zombie-pigmen-portal-spawns: true
wither-spawn-sound-radius: 0
zombie-aggressive-towards-villager: true
anti-xray:
enabled: true
engine-mode: 1
Expand Down Expand Up @@ -95,16 +108,3 @@ world-settings:
max-bulk-chunks: 5
max-entity-collisions: 8
dragon-death-sound-radius: 0
view-distance: 10
chunks-per-tick: 650
clear-tick-list: false
merge-radius:
exp: 3.0
item: 2.5
mob-spawn-range: 4
nerf-spawner-mobs: false
arrow-despawn-rate: 1200
item-despawn-rate: 6000
enable-zombie-pigmen-portal-spawns: true
wither-spawn-sound-radius: 0
zombie-aggressive-towards-villager: true
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ch.k42.metropolis.grid.urbanGrid.clipboard;


import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.LinkedList;
import java.util.List;

import com.avaje.ebean.EbeanServer;
import org.bukkit.Bukkit;

import ch.k42.metropolis.grid.urbanGrid.config.SchematicConfig;
Expand All @@ -29,19 +30,22 @@
*/
public class ClipboardDAO {

private final ch.k42.metropolis.plugin.MetropolisPlugin plugin;
private final ch.k42.metropolis.plugin.MetropolisPlugin plugin;
private final EbeanServer database;

public ClipboardDAO(MetropolisPlugin plugin) {
EbeanServer database = plugin.getDatabase();
try {
plugin.getDatabase().find(ClipboardBean.class).findRowCount();
database.find(ClipboardBean.class).findRowCount();
} catch (PersistenceException e){
plugin.installDDL();
try {
Files.deleteIfExists(Paths.get(plugin.getDataFolder()+ File.separator+"cache"));
Files.deleteIfExists(Paths.get(plugin.getDataFolder() + File.separator + "cache"));
} catch (IOException e1) {
Minions.w("Recreating database, couldn't delete old cache");
}
}
this.database = database;
this.plugin = plugin;
}

Expand All @@ -63,15 +67,18 @@ public boolean storeClipboard(String fileHash,String fileName, Direction directi
}

public void storeClipboard(String fileHash,String fileName, Direction direction, ContextType context, SchematicType schematicType, RoadType roadType, Cartesian2D size){
ClipboardBean bean = plugin.getDatabase().createEntityBean(ClipboardBean.class);

ClipboardBean bean = database.createEntityBean(ClipboardBean.class);

bean.setContext(context);
bean.setDirection(direction);
bean.setFileHash(fileHash);
bean.setSize(size);
bean.setFileName(fileName);
bean.setRoadType(roadType);
bean.setSchematicType(schematicType);
plugin.getDatabase().save(bean);

database.save(bean);
}

public boolean containsHash(String hash){
Expand All @@ -95,15 +102,18 @@ public List<String> findAllClipboardHashes(Cartesian2D size, SchematicType schem
return getHashes(findAllClipboards(size,schematicType, direction));
}

public List<ClipboardBean> findAllClipboards(Cartesian2D size, SchematicType schematicType,Direction direction){
public List<ClipboardBean> findAllClipboards(Cartesian2D size, SchematicType schematicType, Direction direction){
Query<ClipboardBean> query = plugin.getDatabase().find(ClipboardBean.class);
query.where().eq("size_x",size.X).eq("size_y",size.Y).eq("direction",direction).eq("schematicType",schematicType);
query.where()
.eq("size_x",size.X)
.eq("size_y",size.Y)
.eq("direction",direction)
.eq("schematicType",schematicType);
query.select("fileHash,fileName");
List<ClipboardBean> beans = query.findList();
return beans;
}


public List<ClipboardBean> findAllClipboardRoads(RoadType roadType){
Query<ClipboardBean> query = plugin.getDatabase().find(ClipboardBean.class);
query.where().eq("roadType",roadType);
Expand Down

0 comments on commit 550e568

Please sign in to comment.